[Pkg-clamav-commits] [SCM] Debian repository for ClamAV branch, debian/unstable, updated. debian/0.95+dfsg-1-6156-g094ec9b

Török Edvin edwin at clamav.net
Sun Apr 4 01:22:11 UTC 2010


The following commit has been merged in the debian/unstable branch:
commit 24cb93723b5393ab248da80d78ebd968726491bd
Author: Török Edvin <edwin at clamav.net>
Date:   Sat Mar 6 20:17:15 2010 +0200

    Merge LLVM upstream SVN r97877.
    
    This brings in the new ISel emitter, which should improve build times,
    and code size.
    
    Squashed commit of the following:
    
    commit 8b8baa7196d3ee855a618977101333cca26db4dc
    Author: Anton Korobeynikov <asl at math.spbu.ru>
    Date:   Sat Mar 6 11:41:12 2010 +0000
    
        Do not use '&' prefix for globals when register base field is non-zero, otherwise msp430-as will silently miscompile the code (TI's assembler report an error though).
    
        This fixes PR6349
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97877 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 8092cc9adfe019b29dd6443965fe3c1ed3765544
    Author: Eric Christopher <echristo at apple.com>
    Date:   Sat Mar 6 10:59:25 2010 +0000
    
        Let the fallthrough handle whether or not we've changed anything
        before we try to optimize.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97876 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 129ed5cf3e6c1b662886a0b4069fecc72b8b45ee
    Author: Eric Christopher <echristo at apple.com>
    Date:   Sat Mar 6 10:50:38 2010 +0000
    
        Migrate _chk call lowering from SimplifyLibCalls to InstCombine. Stub
        out the remainder of the calls that we should lower in some way and
        move the tests to the new correct directory. Fix up tests that are now
        optimized more than they were before by -instcombine.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97875 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit aa346d0816abd2196aa6966f7003b3d6c0719cf3
    Author: Rafael Espindola <rafael.espindola at gmail.com>
    Date:   Sat Mar 6 07:22:39 2010 +0000
    
        Add static methods to handle Linkage Types.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97871 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit f320cc8cfc783519aa09952dfbfe0fa06d012cf3
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sat Mar 6 07:02:28 2010 +0000
    
        clean this up.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97870 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit e0f0509a54528a29f3f6a40359d2b9f710d27490
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sat Mar 6 04:32:46 2010 +0000
    
        revert r97807, it introduced build warnings.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97869 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ca26451b6fb2e2f6a68a2ffdd2268ac89828bf76
    Author: Jim Grosbach <grosbach at apple.com>
    Date:   Sat Mar 6 03:28:39 2010 +0000
    
        Thumb1 epilogue code generation needs to take into account that callee-saved
        registers may be restored via a pop instruction, not just a tRestore.
        This fixes nightly test 471.omnetep for Thumb1.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97867 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 1a7906741bf0850f017cb68ea4ac9b6e1ec17e67
    Author: Eric Christopher <echristo at apple.com>
    Date:   Sat Mar 6 03:11:35 2010 +0000
    
        Temporarily revert:
    
        Log:
        Transform @llvm.objectsize to integer if the argument is a result of malloc of known size.
    
        Modified:
           llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp
           llvm/trunk/test/Transforms/InstCombine/objsize.ll
    
        It appears to be causing swb and nightly test failures.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97866 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit e0178525100218078fe2c8109d12d3a88b559fae
    Author: Dale Johannesen <dalej at apple.com>
    Date:   Sat Mar 6 02:45:26 2010 +0000
    
        Fix another case where LSR was affected by debug info.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97865 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 10af7bf2237461239e34f84c3eec3e4bbf28d3fa
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Sat Mar 6 01:14:19 2010 +0000
    
        Don't update physical register def.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97861 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit d456295b41ec822aebc5c7bab86dc405defea74f
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Sat Mar 6 01:01:42 2010 +0000
    
        Transform @llvm.objectsize to integer if the argument is a result of malloc of known size.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97860 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 33764fd6174986391c4f1f37561453de4f9bed81
    Author: Erick Tryzelaar <idadesub at users.sourceforge.net>
    Date:   Sat Mar 6 00:30:06 2010 +0000
    
        Add a LLVMWriteBitcodeToFD that exposes the raw_fd_ostream options.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97858 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 894a386aa80308f468be3492a79e533319fbdafa
    Author: Erick Tryzelaar <idadesub at users.sourceforge.net>
    Date:   Sat Mar 6 00:30:01 2010 +0000
    
        Whoops, the old LLVMWriteBitcodeToFileHandle closed the stream.
    
        Luckily this never was released.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97857 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 983e27ee9080161bba57afbf34aee5cf0cf0058f
    Author: Erick Tryzelaar <idadesub at users.sourceforge.net>
    Date:   Sat Mar 6 00:29:58 2010 +0000
    
        LLVMWriteBitcodeToFileHandle should work on all architectures now.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97856 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit a391cead11d5f588720c0347cd40643df5c0904e
    Author: Dale Johannesen <dalej at apple.com>
    Date:   Sat Mar 6 00:03:23 2010 +0000
    
        Add some new bits of debug info handling.  No
        functional change yet.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97855 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit b16da2f136a493ddf05b5190b6689de4199098db
    Author: Dan Gohman <gohman at apple.com>
    Date:   Sat Mar 6 00:00:55 2010 +0000
    
        Reapply r97778 and r97779, enabled only for unsigned i64 to f64
        conversions.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97854 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ff4a90cdf553545ed3b4c2094b4437931d986be0
    Author: Devang Patel <dpatel at apple.com>
    Date:   Fri Mar 5 23:35:04 2010 +0000
    
        Test case for r97851.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97852 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 95563fe18c05036964c1e561c0610d416c14784c
    Author: Ted Kremenek <kremenek at apple.com>
    Date:   Fri Mar 5 22:34:16 2010 +0000
    
        Update CMake build.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97846 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit d8d42e67971c8bbf491976af0c3b275140e5563b
    Author: Charles Davis <cdavis at mines.edu>
    Date:   Fri Mar 5 22:28:45 2010 +0000
    
        Don't emit global symbols into the (__TEXT,__ustring) section on Darwin. This
        is a workaround for <rdar://problem/7672401/> (which I filed).
    
        This let's us build Wine on Darwin, and it gets the Qt build there a little bit
        further (so Doug says).
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97845 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit a06312178d2f5f93eec745c276b52a2a2c68d5da
    Author: Eric Christopher <echristo at apple.com>
    Date:   Fri Mar 5 22:25:30 2010 +0000
    
        Move SimplifyLibCalls's LibCall builders to a separate file so they
        can be used in more places.  Add an argument for the TargetData that
        most of them need. Update for the getInt8PtrTy() change.  Should be
        no functionality change.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97844 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit f31408102aa0351eadf6ec1169b03fdb4cd58c51
    Author: Eric Christopher <echristo at apple.com>
    Date:   Fri Mar 5 22:21:58 2010 +0000
    
        Add support for an i8* type accessor.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97841 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 198d7c43ac6d798c5711d7ee2bbef60a373bea0c
    Author: Jakob Stoklund Olesen <stoklund at 2pi.dk>
    Date:   Fri Mar 5 21:49:17 2010 +0000
    
        Better handling of dead super registers in LiveVariables. We used to do this:
    
           CALL ... %RAX<imp-def>
           ... [not using %RAX]
           %EAX = ..., %RAX<imp-use, kill>
           RET %EAX<imp-use,kill>
    
        Now we do this:
    
           CALL ... %RAX<imp-def, dead>
           ... [not using %RAX]
           %EAX = ...
           RET %EAX<imp-use,kill>
    
        By not artificially keeping %RAX alive, we lower register pressure a bit.
    
        The correct number of instructions for 2008-08-05-SpillerBug.ll is obviously
        55, anybody can see that. Sheesh.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97838 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 0ed0665a7bcdd00f9304abc0cc57c73ae64d4d6b
    Author: Jakob Stoklund Olesen <stoklund at 2pi.dk>
    Date:   Fri Mar 5 21:49:13 2010 +0000
    
        We don't really care about correct register liveness information after the
        post-ra scheduler has run. Disable the verifier checks that late in the game.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97837 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit aa3341e6c8b494d275fe2cd6b4401fcfff926844
    Author: Jakob Stoklund Olesen <stoklund at 2pi.dk>
    Date:   Fri Mar 5 21:49:10 2010 +0000
    
        Avoid creating bad PHI instructions when BR is being const-folded.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97836 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 39d3644211e5eed38c6eb7feb64ce882def1ade8
    Author: Dale Johannesen <dalej at apple.com>
    Date:   Fri Mar 5 21:12:40 2010 +0000
    
        Fix a case where LSR is sensitive to debug info.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97830 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 737ae96836ec3ab9c72747810612e2a5eb1d6efb
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Fri Mar 5 20:59:47 2010 +0000
    
        Safely turn memset_chk etc. to non-chk variant if the known object size is >= memset / memcpy / memmove size.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97828 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit fd91987d3895fa05add6982a809bd571b4ff6c4d
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Fri Mar 5 20:47:23 2010 +0000
    
        Instcombine should turn llvm.objectsize of a alloca with static size to an integer.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97827 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit d448115fc3b5977504811ab2747b75dd176dc5f3
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Fri Mar 5 19:55:55 2010 +0000
    
        Fix typo.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97818 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 4f330b5f50d2ca35937b5b11f6c606d263c43230
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Fri Mar 5 18:55:36 2010 +0000
    
        fix bss section printing for cell, patch by Kalle Raiskila!
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97814 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit d0e7c613208be8f1e242c12a63f253fcd749eea5
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Fri Mar 5 18:53:28 2010 +0000
    
        fix PR6512, a case where instcombine would incorrectly merge loads
        from different addr spaces.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97813 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 3c0511d9ab206da7bf20a3bb48a29260d28e1f35
    Author: Wesley Peck <peckw at wesleypeck.com>
    Date:   Fri Mar 5 15:26:02 2010 +0000
    
        Reworking the stack layout that the MicroBlaze backend generates.
    
        The MicroBlaze backend was generating stack layouts that did not
        conform correctly to the ABI. This update generates stack layouts
        which are closer to what GCC does.
    
        Variable arguments support was added as well but the stack layout
        for varargs has not been finalized.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97807 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 50a5b7b8f82e6256ac661859dc10f9455a790f2d
    Author: Wesley Peck <peckw at wesleypeck.com>
    Date:   Fri Mar 5 15:15:55 2010 +0000
    
        Adding MBlaze to cmake target list.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97806 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 7c4d10999c93a3e002ed8d994063d5a4ac413125
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Fri Mar 5 08:46:26 2010 +0000
    
        Fix PR6503.  This turned into a much more interesting and nasty bug.  Various
        parts of the cmp|cmp and cmp&cmp folding logic wasn't prepared for vectors
        (unrelated to the bug but noticed while in the code) and the code was
        *definitely* not safe to use by the (cast icmp)|(cast icmp) handling logic
        that I added in r95855.  Fix all this up by changing the various routines
        to more consistently use IRBuilder and not pass in the I which had the wrong
        type.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97801 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 0f0557ebc64b81b67ef263f7ecf3ff8c7a61e1fd
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Fri Mar 5 08:43:33 2010 +0000
    
        make these less sensitive to temporary naming.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97799 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 02c78af1f36c8e991b8d4202f8b2e17f493b1276
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Fri Mar 5 08:43:06 2010 +0000
    
        remove this testcase, it isn't clear what it was testing and it is subsumed by or.ll
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97798 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 78e26a68c480fe6e3b612698e3f61ef7bcd88bdc
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Fri Mar 5 08:38:04 2010 +0000
    
        Fix an oops in x86 sibcall optimization. If the ByVal callee argument is itself passed as a pointer, then it's obviously not safe to do a tail call.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97797 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit fd405377206ce3f3d6b366a2b913d4e501126ea1
    Author: Duncan Sands <baldrick at free.fr>
    Date:   Fri Mar 5 08:21:02 2010 +0000
    
        If LD_LIBRARY_PATH is set in the system environment, use it.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97796 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 44debf4f7d10ec8ad414873df3047e6f4c23930b
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Fri Mar 5 07:47:57 2010 +0000
    
        simplify some functions and make them work with vector
        compares, noticed by inspection.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97795 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 59ffdbd8644519afeca1f1c77637d2bfad2fbe02
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Fri Mar 5 07:18:54 2010 +0000
    
        fix a nice subtle reassociate bug which would only occur
        in a very specific use pattern embodied in the carefully
        reduced testcase.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97794 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 801dee0ea3164b1b07bc17fdf05fe63d57de637c
    Author: Eric Christopher <echristo at apple.com>
    Date:   Fri Mar 5 06:58:57 2010 +0000
    
        Move GetStringLength and helper from SimplifyLibCalls to ValueTracking.
        No functionality change.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97793 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 7a5210b06ed03f9ff422921992a404c14c591855
    Author: Jeffrey Yasskin <jyasskin at google.com>
    Date:   Fri Mar 5 06:43:49 2010 +0000
    
        Revert r97788 because it broke test/FrontendC/2010-02-16-DbgVarScope.c.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97792 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit df97abcc77da393760a7bcc12c03645cf1728b67
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Fri Mar 5 06:19:13 2010 +0000
    
        Fix PR6497, a bug where we'd fold a load into an addc
        node which has a flag.  That flag in turn was used by an
        already-selected adde which turned into an ADC32ri8 which
        used a selected load which was chained to the load we
        folded.  This flag use caused us to form a cycle.  Fix
        this by not ignoring chains in IsLegalToFold even in
        cases where the isel thinks it can.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97791 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 8bd98df78e0099db2dc9e013f79d7ffa9400689d
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Fri Mar 5 06:17:43 2010 +0000
    
        cleanup
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97790 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 50163132c78a04867316371dfc108d81d6bd192e
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Fri Mar 5 05:49:45 2010 +0000
    
        inline a small function with one call site.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97789 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit e1df73fd6d634705e69c8fcb6f556ecaf35b4fde
    Author: Jeffrey Yasskin <jyasskin at google.com>
    Date:   Fri Mar 5 05:47:09 2010 +0000
    
        Free MDNodes when the LLVMContext is destroyed.  Leak found by Valgrind.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97788 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit cd88637114a2246b2c48fcd61512e04468fe3a73
    Author: Mikhail Glushenkov <foldr at codedgers.com>
    Date:   Fri Mar 5 04:46:39 2010 +0000
    
        Make it not an error to specify -O* options several times.
    
        As in 'llvmc -O2 -O2 test.c'.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97787 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 6c014502943a288377d325367c89b1a0159618ff
    Author: Mikhail Glushenkov <foldr at codedgers.com>
    Date:   Fri Mar 5 04:46:28 2010 +0000
    
        Use FindExecutable as a fall-back search method.
    
        Allows us to find executables that are in the same directory.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97786 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit f8755dd455a462aed4cc923cd5eebc701ae95afc
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Fri Mar 5 03:08:23 2010 +0000
    
        Rever 96389 and 96990. They are causing some miscompilation that I do not fully understand.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97782 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 59043f24a7c8d723b66c5176d1520507dc2cfbe7
    Author: Dan Gohman <gohman at apple.com>
    Date:   Fri Mar 5 02:40:23 2010 +0000
    
        Revert r97778 and r97779. They're somehow breaking llvm-gcc builds.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97781 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 342e270897302e5d14b94f8521d50beb337edda0
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Fri Mar 5 02:34:34 2010 +0000
    
        apparently if gold is around lto needs to be part of DIRS.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97780 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 1f6137e125ce7be6d42232420acadb71f846687a
    Author: Dan Gohman <gohman at apple.com>
    Date:   Fri Mar 5 02:13:10 2010 +0000
    
        Fix these constants to be more portable.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97779 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 512edab665b19b56f46a5e884726d3b95001a5ca
    Author: Dan Gohman <gohman at apple.com>
    Date:   Fri Mar 5 02:00:46 2010 +0000
    
        Rewrite i64-to-f64 conversion using an algorithm which handles
        rounding correctly. This implementation is a generalization of
        the x86_64 code in compiler-rt.
    
        This fixes rdar://7683708.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97778 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ede8780a38eb918050be9805a685976466d9a4d6
    Author: Johnny Chen <johnny.chen at apple.com>
    Date:   Fri Mar 5 01:45:46 2010 +0000
    
        Trivial comment change.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97776 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 3c2ab41b4f483d9af9026112de00902d9e875b4d
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Fri Mar 5 01:22:47 2010 +0000
    
        Add missing break for Intrinsic::objectsize case. It was falling through to the following Intrinsic::bswap code. I have no idea why it wasn't breaking stuff.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97774 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 97f858f693f64e690937a0a09c2eee0c83fc49cb
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Fri Mar 5 01:00:34 2010 +0000
    
        disable libprofile on cygwin, patch by Aaron Gray.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97772 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 076c95a931cc4eb4fcc65a38b55e18337340a96f
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Fri Mar 5 00:59:18 2010 +0000
    
        Only build libedis if ENABLE_SHARED is specified, just like liblto.
        Don't build any of the dynamic library stuff on cygwin/mingw.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97771 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 7b3845a8ee5c93ba2f9c060db7daf5bd83dc6f9a
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Fri Mar 5 00:54:45 2010 +0000
    
        liblto and gold don't need to be built in serial
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97770 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 042b9b4377110320a37b5362c944d18ef483d669
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Fri Mar 5 00:49:08 2010 +0000
    
        add an assertion requested on llvmdev.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97769 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ff150b4c021a69e2e42f08e70a8d8f6d41ec1eeb
    Author: Bill Wendling <isanbard at gmail.com>
    Date:   Fri Mar 5 00:33:59 2010 +0000
    
        Revert r97766. It's deleting a tag.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97768 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 32fa39ec4dd17337d99925ce7eb7843a0f7b1ef9
    Author: Bill Wendling <isanbard at gmail.com>
    Date:   Fri Mar 5 00:24:26 2010 +0000
    
        Micro-optimization:
    
        This code:
    
        float floatingPointComparison(float x, float y) {
            double product = (double)x * y;
            if (product == 0.0)
                return product;
            return product - 1.0;
        }
    
        produces this:
    
        _floatingPointComparison:
        0000000000000000        cvtss2sd        %xmm1,%xmm1
        0000000000000004        cvtss2sd        %xmm0,%xmm0
        0000000000000008        mulsd           %xmm1,%xmm0
        000000000000000c        pxor            %xmm1,%xmm1
        0000000000000010        ucomisd         %xmm1,%xmm0
        0000000000000014        jne             0x00000004
        0000000000000016        jp              0x00000002
        0000000000000018        jmp             0x00000008
        000000000000001a        addsd           0x00000006(%rip),%xmm0
        0000000000000022        cvtsd2ss        %xmm0,%xmm0
        0000000000000026        ret
    
        The "jne/jp/jmp" sequence can be reduced to this instead:
    
        _floatingPointComparison:
        0000000000000000        cvtss2sd        %xmm1,%xmm1
        0000000000000004        cvtss2sd        %xmm0,%xmm0
        0000000000000008        mulsd           %xmm1,%xmm0
        000000000000000c        pxor            %xmm1,%xmm1
        0000000000000010        ucomisd         %xmm1,%xmm0
        0000000000000014        jp              0x00000002
        0000000000000016        je              0x00000008
        0000000000000018        addsd           0x00000006(%rip),%xmm0
        0000000000000020        cvtsd2ss        %xmm0,%xmm0
        0000000000000024        ret
    
        for a savings of 2 bytes.
    
        This xform can happen when we recognize that jne and jp jump to the same "true"
        MBB, the unconditional jump would jump to the "false" MBB, and the "true" branch
        is the fall-through MBB.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97766 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 90c537295ce9dbd44b75b065eb377cb343457637
    Author: Dale Johannesen <dalej at apple.com>
    Date:   Fri Mar 5 00:02:59 2010 +0000
    
        Fix some more places where dbg_value affected codegen.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97765 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 0cbf4231649e0d3106449d9c8f30eed622a2f21b
    Author: Devang Patel <dpatel at apple.com>
    Date:   Thu Mar 4 23:44:48 2010 +0000
    
        Add metadata example.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97764 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit b8a7df8e453fbdaf71745d107d420cadcfa80a41
    Author: Jeffrey Yasskin <jyasskin at google.com>
    Date:   Thu Mar 4 23:24:19 2010 +0000
    
        Stop leaking MDStrings.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97763 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 64e333257e0989ac508a616039f3f5054ced2322
    Author: Johnny Chen <johnny.chen at apple.com>
    Date:   Thu Mar 4 22:24:41 2010 +0000
    
        Drop the ".w" qualifier for t2UXTB16* instructions as there is no 16-bit version
        of either sxtb16 or uxtb16, and the unified syntax does not specify ".w".
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97760 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 36efd7ebd8a76e37b7042cdc8e9c4c1688e6d457
    Author: Jeffrey Yasskin <jyasskin at google.com>
    Date:   Thu Mar 4 22:15:01 2010 +0000
    
        Fix memcheck-found leaks: one false positive from using new[], and one true
        positive where pointers would be leaked on llvm_shutdown.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97759 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 6dcf1ed5d44a22743b500b901440c6c3086a4a59
    Author: Jim Grosbach <grosbach at apple.com>
    Date:   Thu Mar 4 22:07:46 2010 +0000
    
        For SJLJ exception handling, make sure that all calls that are not marked
        as nounwind are marked with a -1 call-site value. This is necessary to, for
        example, correctly process exceptions thrown from within an "unexpected"
        execption handler (see SingleSource/Regression/C++/EH/expection_spec_test.cpp).
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97757 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 15b85c2e52fd6e074e2bdabd16047dde42163641
    Author: Bob Wilson <bob.wilson at apple.com>
    Date:   Thu Mar 4 21:42:36 2010 +0000
    
        pr6478: The frame pointer spill frame index is only defined when there is a
        frame pointer.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97755 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit f8ca9d5a19983aafb289d2452c23ff8368ea0831
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Thu Mar 4 21:28:09 2010 +0000
    
        Run machine licm before machine cse to avoid messing up licm opportunities.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97752 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 768d399deacd93a6faa14575414eb2ddf1ccf7d7
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Thu Mar 4 21:18:08 2010 +0000
    
        Avoid cse load instructions unless they are known to be invariant loads.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97747 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit fb199e565c052ac002a1353a0a211a0a3959618e
    Author: Bob Wilson <bob.wilson at apple.com>
    Date:   Thu Mar 4 21:04:38 2010 +0000
    
        pr6480: Don't try producing ld/st-multiple instructions when the address is
        an undef value.  This is only going to come up for bugpoint-reduced tests --
        correct programs will not access memory at undefined addresses -- so it's not
        worth the effort of doing anything more aggressive.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97745 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 1b9a1c6368243323b47ad85d080d646922616eee
    Author: Erick Tryzelaar <idadesub at users.sourceforge.net>
    Date:   Thu Mar 4 20:56:19 2010 +0000
    
        Rewrite makefiles to explicitly reference DESTDIR to fix bug 3153.
    
        We need this so can not bake DESTDIR into the O'Caml symlinks.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97743 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 07cecc814cfac381611dfe35440402e2a1b47bf6
    Author: Jakob Stoklund Olesen <stoklund at 2pi.dk>
    Date:   Thu Mar 4 20:42:07 2010 +0000
    
        Fix the remaining MUL8 and DIV8 to define AX instead of AL,AH.
    
        These instructions technically define AL,AH, but a trick in X86ISelDAGToDAG
        reads AX in order to avoid reading AH with a REX instruction.
    
        Fix PR6489.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97742 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 60c81d5a0323eddf67fdaffd1183a313053658e5
    Author: Dan Gohman <gohman at apple.com>
    Date:   Thu Mar 4 19:58:08 2010 +0000
    
        Fix recognition of 16-bit bswap for C front-ends which emit the
        clobber registers in a different order.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97741 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 43dd4fd11a1ee702e7ae85b3aaff8cc89c2d6503
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Thu Mar 4 19:54:45 2010 +0000
    
        not committing what you test = bad.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97740 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 9753af92498d6c71afb58df09117828971134f2a
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Thu Mar 4 19:48:19 2010 +0000
    
        make gep matching in fastisel match the base of the gep as a
        register if it isn't possible to match the indexes *and* the base.
        This fixes some fast isel rejects of load instructions on oggenc.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97739 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 9a0ce1421722365b719efb4bb4f98dfe091d4b9c
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Thu Mar 4 19:46:56 2010 +0000
    
        add a statistic for # times fastisel fails.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97738 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 14b1ebdfedcaa80d296942999d4eb95b416f7dd7
    Author: Jeffrey Yasskin <jyasskin at google.com>
    Date:   Thu Mar 4 19:45:09 2010 +0000
    
        Fix PR6360.  It's easy for a stub's address to escape to user code, so we can't
        just count references to it from JIT output to decide when to destroy it.  This
        patch waits to destroy the JIT's memory of a stub until the Function it refers
        to is destroyed.  External function stubs and GVIndirectSyms aren't destroyed
        until the JIT itself is.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97737 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 80c162a1b7771a0a81c0d0028c508b89b4b3711c
    Author: Dan Gohman <gohman at apple.com>
    Date:   Thu Mar 4 19:11:28 2010 +0000
    
        Fix a typo Duncan noticed.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97735 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit e4a7af91b1aa122d4a34e9c4119f779b652cdaf1
    Author: Johnny Chen <johnny.chen at apple.com>
    Date:   Thu Mar 4 17:40:44 2010 +0000
    
        Added 32-bit Thumb instructions for Preload Data (PLD, PLDW) and Preload
        Instruction (PLI) for disassembly only.
    
        According to A8.6.120 PLI (immediate, literal), for example, different
        instructions are generated for "pli [pc, #0]" and "pli [pc, #-0"].  The
        disassembler solves it by mapping -0 (negative zero) to -1, -1 to -2, ..., etc.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97731 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 91ad25ef8391b5bfdcfca4d003b3d0e33edf52f2
    Author: John McCall <rjmccall at apple.com>
    Date:   Thu Mar 4 11:48:42 2010 +0000
    
        Simplify the condition-checking logic and hopefully clear up a build failure
        that somehow got through my testing.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97728 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 1722deb2df37444ef0a1f9ccf310d2867e833520
    Author: John McCall <rjmccall at apple.com>
    Date:   Thu Mar 4 09:36:50 2010 +0000
    
        Teach lit to honor conditional directives.  The syntax is:
          IF(condition(value)):
        If the value satisfies the condition, the line is processed by lit;  otherwise
        it is skipped.  A test with no unignored directives is resolved as Unsupported.
    
        The test suite is responsible for defining conditions;  conditions are unary
        functions over strings.  I've defined two conditions in the LLVM test suite,
        TARGET (with values like those in TARGETS_TO_BUILD) and BINDING (with values
        like those in llvm_bindings).  So for example you can write:
          IF(BINDING(ocaml)): RUN: %blah %s -o -
        and the RUN line will only execute if LLVM was configured with the ocaml
        bindings.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97726 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit df8dfbd216ce1f77f1128f1d24f3598ded7c8be6
    Author: Nick Lewycky <nicholas at mxc.ca>
    Date:   Thu Mar 4 06:54:10 2010 +0000
    
        Make the 'icmp pred trunc(ext(X)), CST --> icmp pred X, ext(trunc(CST))'
        transformation much more careful. Truncating binary '01' to '1' sounds like it's
        safe until you realize that it switched from positive to negative under a signed
        interpretation, and that depends on the icmp predicate.
    
        Also a few miscellaneous cleanups.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97721 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit d9fbe67d7e4211d18505e71477b1061f0ea71e71
    Author: Jeffrey Yasskin <jyasskin at google.com>
    Date:   Thu Mar 4 06:50:01 2010 +0000
    
        Fix PR5291, in which a SmallPtrSet iterator was held across an insertion into
        the set.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97720 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 54639611efd444f3ef2fa26f618d106b1aa40c80
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Thu Mar 4 02:08:04 2010 +0000
    
        Rename -machine-cse to -enable-machine-cse.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97713 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 4c1d83b5ef2893f5e7aadc33e5c3b0596c21b717
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Thu Mar 4 01:43:43 2010 +0000
    
        add a comment.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97709 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 3240a2ab76d6152aa4c97bbe0e5c4abebeb541fb
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Thu Mar 4 01:34:29 2010 +0000
    
        so hey, it turns out that the histogram was completely wrong, because
        we sometimes emit nodes multiple times to string buffers to size them.
        Compute the histogram correctly.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97708 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit e69a659304234a7d5385fd343d5eb3489fb5b21a
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Thu Mar 4 01:33:55 2010 +0000
    
        Look ahead a bit to determine if a physical register def that is not marked dead is really alive. This is necessary to catch a lot of common cse opportunities for targets like x86.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97706 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit a4066394fb9bfff2924047b05dee47ccfba69a0e
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Thu Mar 4 01:26:00 2010 +0000
    
        zap fixme.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97705 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 71c277e71d757d586f3bcaec601f5b10b216ba79
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Thu Mar 4 01:25:36 2010 +0000
    
        now that  complexpatterns are all emitted at the end of the match
        sequence, just emit instruction predicates right before them.  This
        exposes yet more factoring opportunitites, shrinking the X86 table
        to 79144 bytes.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97704 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 06f2729c970c7e93e5cbd1f7f7e1231842dda721
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Thu Mar 4 01:23:08 2010 +0000
    
        change the new isel matcher to emit ComplexPattern matches
        as the very last thing before node emission.  This should
        dramatically reduce the number of times we do 'MatchAddress'
        on X86, speeding up compile time.  This also improves comments
        in the tables and shrinks the table a bit, now down to
        80506 bytes for x86.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97703 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit c3b56d7c4e0efb7026b92d2dcc5e37b252ede90e
    Author: Jeffrey Yasskin <jyasskin at google.com>
    Date:   Thu Mar 4 00:32:33 2010 +0000
    
        Make sure JITResolvers don't leave any stubs behind.  When a JITResolver was
        destroyed, it could leave stubs in the StubToResolverMap, which would confuse
        the lookup for subsequent lazy compilations.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97698 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit f3d51353b648f973743ca15c74e4013977755b97
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Thu Mar 4 00:28:05 2010 +0000
    
        enhance comment output to specify what recorded slot
        numbers a ComplexPat will match into.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97696 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 411907fd64949307ed5abab5cb41e0c721e7d4f6
    Author: Dan Gohman <gohman at apple.com>
    Date:   Thu Mar 4 00:23:16 2010 +0000
    
        Fix more code to work properly with vector operands. Based on
        a patch my Micah Villmow for PR6465.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97692 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 20a0937af355b3759cdae25113e97b3eebe16a5a
    Author: John McCall <rjmccall at apple.com>
    Date:   Thu Mar 4 00:21:47 2010 +0000
    
        Teach the pic16 target to recognize pic16-*-* triples.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97691 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 32f610d51cac9d0edc1c772d3a11943f7a292ca8
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Thu Mar 4 00:21:16 2010 +0000
    
        inline CannotYetSelectIntrinsic into CannotYetSelect and simplify.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97690 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 1a647b1bcf1066ce6fe762f4cca38abd5b668994
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Wed Mar 3 23:59:08 2010 +0000
    
        Fix a logic error. An instruction that has a live physical register def cannot be CSE'ed, but it *can* be used to replace a common subexpression.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97688 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 0688e58596dc38e21023437985b6f6e1910ce2f6
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Wed Mar 3 23:55:49 2010 +0000
    
        Remove PHINodeTraits and use MachineInstrExpressionTrait instead.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97687 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 54fda172ce1260ee0537a5cf2c510fb1b5cf3b36
    Author: Erick Tryzelaar <idadesub at users.sourceforge.net>
    Date:   Wed Mar 3 23:51:34 2010 +0000
    
        Expose the rest of the llvm-c scalar opts to ocaml.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97685 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 6152c59ec9f9fd4dce205e08ef83eb5af08babd4
    Author: Erick Tryzelaar <idadesub at users.sourceforge.net>
    Date:   Wed Mar 3 23:51:30 2010 +0000
    
        Rename some ocaml functions.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97684 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit f0a775a5c3ecde86ba6f3f4ea3576de1beb9a9a6
    Author: Erick Tryzelaar <idadesub at users.sourceforge.net>
    Date:   Wed Mar 3 23:51:28 2010 +0000
    
        Expose the external functions for ocaml's execution engine as an optimization.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97683 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 5164fc103e317ca2d3a16c1e2ab84fbc279c7ba3
    Author: Erick Tryzelaar <idadesub at users.sourceforge.net>
    Date:   Wed Mar 3 23:51:25 2010 +0000
    
        Expose alignment and stack alignment attributes to llvm-c and ocaml.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97682 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ca6a35be3cc2271ce8a3dbdbe268ff7598e68fb2
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Wed Mar 3 23:37:30 2010 +0000
    
        Move MachineInstrExpressionTrait::getHashValue() out of line so it can skip over only virtual register defs. This matches what isEqual() is doing.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97680 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 1412446ac97a6d60293a0c2ce45cb7232e391f24
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Wed Mar 3 23:27:36 2010 +0000
    
        Re-apply r97667 but with a little bit of thought put into the patch. This implements a special DenseMapInfo trait for DenseMap<MachineInstr*> that compare the value of the MachineInstr rather than the pointer value. Since the hashing and equality test functions ignore defs it's useful for doing CSE kind optimization.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97678 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 030b0c94091a045229471ec228afef2dfaf9921d
    Author: Johnny Chen <johnny.chen at apple.com>
    Date:   Wed Mar 3 23:15:43 2010 +0000
    
        Modified the asm string of 16-bit Thumb MUL instruction so that it prints:
    
        MULS <Rdm>, <Rn>, <Rdm>
    
        according to A8.6.105 MUL Encoding T1.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97675 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 199822da16404d8ea037cdd8225b0138ce29e285
    Author: Dan Gohman <gohman at apple.com>
    Date:   Wed Mar 3 22:40:03 2010 +0000
    
        Revert 97667. It broke a bunch of tests.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97673 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ec2f71188b6ad456e4fb5c2ddeefd18ca9c34caf
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Wed Mar 3 21:54:14 2010 +0000
    
        Fix funky indentation and add comments.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97670 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ffaadf4aa0736a77a33bd754d38c6ee4a294fdc8
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Wed Mar 3 21:47:16 2010 +0000
    
        Move DenseMapInfo for MachineInstr* to MachineInstr.h
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97667 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit c0fbcf5f91bc2c7d9d477cefae111f2c9c56d630
    Author: Dan Gohman <gohman at apple.com>
    Date:   Wed Mar 3 21:33:37 2010 +0000
    
        Fix a bug in SelectionDAG's ReplaceAllUsesWith in the case where
        CSE and recursive RAUW calls delete a node from the use list,
        invalidating the use list iterator. There's currently no known
        way to reproduce this in an unmodified LLVM, however there's no
        fundamental reason why a SelectionDAG couldn't be formed which
        would trigger this case.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97665 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 25c64ba019aff84b6d0eca309b8f0bf21c72d511
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Wed Mar 3 21:20:05 2010 +0000
    
        Machine CSE work in progress. It's doing some CSE now. But implicit def of physical registers are getting in the way.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97664 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ebeba930713e58fbacbbd0e7ad06eeea4c0b265c
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Wed Mar 3 21:18:38 2010 +0000
    
        Add MachineRegisterInfo::hasOneUse and hasOneNonDBGUse.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97663 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 57d4a663bbbb96b28ba9d34c4ebb596a9d9a9a09
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Mar 3 20:47:12 2010 +0000
    
        don't use always_inline with gcc 3.4, it has some unimplemented features
        and is too old to really care about the performance of the generated
        compiler.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97662 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit c13c95f62aeb8279d1169466260bec7e02470b8c
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Wed Mar 3 20:46:48 2010 +0000
    
        TopLevelMap[] reference is a pointer.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97661 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 4374df984b4a3f4c681dd8db85144d6d7f26f5f2
    Author: Andrew Lenharth <alenhar2 at cs.uiuc.edu>
    Date:   Wed Mar 3 20:15:31 2010 +0000
    
        Fix PR6444, note still doesn't compile libgcc2 all the way, but fixes that error.  May not fix it in an ABI complient way.  It wasn't clear what gcc does
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97660 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 7a1a27fe0a29565581344c147c85e117abd53263
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Mar 3 19:46:03 2010 +0000
    
        fix incorrect folding of icmp with undef, PR6481.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97659 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit cce2077e349773f96e4bea5462ec679e5aba46c3
    Author: Bill Wendling <isanbard at gmail.com>
    Date:   Wed Mar 3 19:31:05 2010 +0000
    
        Revert...
        --- Reverse-merging r97592 into '.':
        U    lib/CodeGen/TargetLoweringObjectFileImpl.cpp
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97657 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 5b9fb5eb26cb221e5ae9f83e753e2d1524c98311
    Author: Johnny Chen <johnny.chen at apple.com>
    Date:   Wed Mar 3 18:45:36 2010 +0000
    
        Added 32-bit Thumb instructions LDRT, LDRBT, LDRHT,,LDRSBT, LDRSHT, STRT, STRBT,
        and STRHT for disassembly only.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97655 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 07866f7546b839a9e86f9351ae26cf8b37168ee3
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Mar 3 07:46:25 2010 +0000
    
        add some of the more obscure predicate types to the
        Scope accelerator.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97652 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ac70ddc123577b33a45328ed95a403c21be33fac
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Mar 3 07:31:15 2010 +0000
    
        speed up scope node processing: if the first element of a scope
        entry we're about to process is obviously going to fail, don't
        bother pushing a scope only to have it immediately be popped.
        This avoids a lot of scope stack traffic in common cases.
    
        Unfortunately, this requires duplicating some of the predicate
        dispatch.  To avoid duplicating the actual logic I pulled each
        predicate out to its own static function which gets used in
        both places.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97651 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 6fd97aa747bf0a6bbd821471077ec2a5021911ec
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Mar 3 06:28:15 2010 +0000
    
        introduce a new SwitchTypeMatcher node (which is analogous to
        SwitchOpcodeMatcher) and have DAGISelMatcherOpt form it.  This
        speeds up selection, particularly for X86 which has lots of
        variants of instructions with only type differences.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97645 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 54125a770694e7015f0c6464ce382469f7bc9994
    Author: Bill Wendling <isanbard at gmail.com>
    Date:   Wed Mar 3 05:40:40 2010 +0000
    
        Fix comment.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97644 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 3982ab8b1a4c1defde9fd99aaa8d5dd6f80bb441
    Author: Dan Gohman <gohman at apple.com>
    Date:   Wed Mar 3 05:29:13 2010 +0000
    
        Make SCEVExpander and LSR more aggressive about hoisting expressions out
        of loops.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97642 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 8b2b13390084be1013c0389a064d231c0db97a44
    Author: Dan Gohman <gohman at apple.com>
    Date:   Wed Mar 3 04:36:42 2010 +0000
    
        Revert r97580; that's not the right way to fix this.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97639 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ef1404358254b727461473d04294714053832faa
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Wed Mar 3 02:48:20 2010 +0000
    
        Work in progress. Finding some cse now.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97635 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 4e82e907837347fddf2cc4ba2c4cc68966a24577
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Mar 3 02:14:54 2010 +0000
    
        remove nvload and two patterns that use it which are
        better done by dag combine.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97633 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 7cb0881fd0475b57bc6ad64b4ecf15c6591a4c3f
    Author: Johnny Chen <johnny.chen at apple.com>
    Date:   Wed Mar 3 02:09:43 2010 +0000
    
        Added 32-bit Thumb instructions t2NOP, t2YIELD, t2WFE, t2WFI, t2SEV, and t2DBG
        for disassembly only.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97632 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ee63dbcce4be6e492cddde020d274f9ff0dd26ac
    Author: Bill Wendling <isanbard at gmail.com>
    Date:   Wed Mar 3 01:58:01 2010 +0000
    
        Use APInt instead of zext value.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97631 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 5774689caeda43775891121c70ee9104629090e4
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Mar 3 01:52:59 2010 +0000
    
        factor the 'in the default address space' check out to a single
        'dsload' pattern.  tblgen doesn't check patterns to see if they're
        textually identical.  This allows better factoring.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97630 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 5eed36be09b45b5e53247ceeb109672fde26cc8e
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Mar 3 01:45:01 2010 +0000
    
        factor the 'sign extended from 8 bit' patterns better so
        that they are not destination type specific.  This allows
        tblgen to factor them and the type check is redundant with
        what the isel does anyway.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97629 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 63e7fbc85a6e4d34d32ff0a7dcb20d74ca22f1a1
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Wed Mar 3 01:44:33 2010 +0000
    
        - Change MachineInstr::isIdenticalTo to take a new option that determines whether it should skip checking defs or at least virtual register defs. This subsumes part of the TargetInstrInfo::isIdentical functionality.
        - Eliminate TargetInstrInfo::isIdentical and replace it with produceSameValue. In the default case, produceSameValue just checks whether two machine instructions are identical (except for virtual register defs). But targets may override it to check for unusual cases (e.g. ARM pic loads from constant pools).
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97628 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 7771179a389bef5311ad359763084de19f6d0c47
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Wed Mar 3 01:38:35 2010 +0000
    
        Add an option to enable machine cse (it's not doing anything yet.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97627 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 0784aada6ac3a30b3890f2b52d9ecc74bdf61a73
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Wed Mar 3 01:37:50 2010 +0000
    
        Ordering forward declarations.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97626 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 779a9f3bc89883d77d398dec2359a4343213b560
    Author: Bill Wendling <isanbard at gmail.com>
    Date:   Wed Mar 3 01:13:55 2010 +0000
    
        Don't turn assertions on by default.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97623 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 6a7678e2072b637e7a720afa157816cc11ea0aa6
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Wed Mar 3 00:43:15 2010 +0000
    
        Eliminate unused instruction classes.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97617 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 63d35d28de1073c6d9214e3cab2ef319a3c8a012
    Author: Bill Wendling <isanbard at gmail.com>
    Date:   Wed Mar 3 00:35:56 2010 +0000
    
        This test case:
    
        long test(long x) { return (x & 123124) | 3; }
    
        Currently compiles to:
    
        _test:
                orl     $3, %edi
                movq    %rdi, %rax
                andq    $123127, %rax
                ret
    
        This is because instruction and DAG combiners canonicalize
    
          (or (and x, C), D) -> (and (or, D), (C | D))
    
        However, this is only profitable if (C & D) != 0. It gets in the way of the
        3-addressification because the input bits are known to be zero.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97616 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 6c25aa2e25e2f9007e66e2f81d5f731f598f056c
    Author: Johnny Chen <johnny.chen at apple.com>
    Date:   Wed Mar 3 00:16:28 2010 +0000
    
        Added 32-bit Thumb instructions t2DMB variants, t2DSB variants, and t2ISBsy for
        disassembly only.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97614 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ce6affafe652f88bcdacec9397499db154dcd434
    Author: Erick Tryzelaar <idadesub at users.sourceforge.net>
    Date:   Tue Mar 2 23:59:08 2010 +0000
    
        Use the ocaml tag 0 since we are just returning an option value.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97612 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ce13383fe9ea3ed047f8fb621d395af0995edaa5
    Author: Erick Tryzelaar <idadesub at users.sourceforge.net>
    Date:   Tue Mar 2 23:59:05 2010 +0000
    
        Don't use an ocaml keyword in an ocamldoc comment.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97611 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 0610f44010292b2bfecc84a419b8702459066d19
    Author: Erick Tryzelaar <idadesub at users.sourceforge.net>
    Date:   Tue Mar 2 23:59:03 2010 +0000
    
        Expose the optimization level for the jit in ocaml.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97610 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit f8eac021cc43c2987b90237466cf46f347dd8bc3
    Author: Erick Tryzelaar <idadesub at users.sourceforge.net>
    Date:   Tue Mar 2 23:59:00 2010 +0000
    
        Remove module providers from ocaml.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97609 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 0dd5a40bf2fe15fbf022b70666bb2113301455ce
    Author: Erick Tryzelaar <idadesub at users.sourceforge.net>
    Date:   Tue Mar 2 23:58:54 2010 +0000
    
        Add Module functions in place of module providers.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97608 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 3de906f1dfb8f7f3358ab864487115aefde0b8ff
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Mar 2 23:12:51 2010 +0000
    
        merge two loops over all nodes in the graph into one.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97606 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 2303f1f374c5a8fa23879a3c933da9f56f2e5f6c
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Mar 2 22:33:56 2010 +0000
    
        eliminate PreprocessForRMW now that isel handles it.
        We still preprocess calls and fp return stuff.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97598 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit a15890fac1a6b1534a0ce7848fb1221c28a61d55
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Mar 2 22:30:08 2010 +0000
    
        remove 300 lines of code that is now dead in the MSP430 backend
        now that isel handles chains more aggressively.  This also
        allows us to make isLegalToFold non-virtual.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97597 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit e15b5610729840a5a78cfcb623cb2ab530d06a40
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Mar 2 22:20:06 2010 +0000
    
        Fix some issues in WalkChainUsers dealing with
        CopyToReg/CopyFromReg/INLINEASM.  These are annoying because
        they have the same opcode before an after isel.  Fix this by
        setting their NodeID to -1 to indicate that they are selected,
        just like what automatically happens when selecting things that
        end up being machine nodes.
    
        With that done, give IsLegalToFold a new flag that causes it to
        ignore chains.  This lets the HandleMergeInputChains routine be
        the one place that validates chains after a match is successful,
        enabling the new hotness in chain processing.  This smarter
        chain processing eliminates the need for "PreprocessRMW" in the
        X86 and MSP430 backends and enables MSP to start matching it's
        multiple mem operand instructions more aggressively.
    
        I currently #if out the dead code in the X86 backend and MSP
        backend, I'll remove it for real in a follow-on patch.
    
        The testcase changes are:
          test/CodeGen/X86/sse3.ll: we generate better code
          test/CodeGen/X86/store_op_load_fold2.ll: PreprocessRMW was
              miscompiling this before, we now generate correct code
              Convert it to filecheck while I'm at it.
          test/CodeGen/MSP430/Inst16mm.ll: Add a testcase for mem/mem
              folding to make anton happy. :)
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97596 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit b905028b4ba7b851af940c91901ac5214ea0b73b
    Author: Johnny Chen <johnny.chen at apple.com>
    Date:   Tue Mar 2 22:11:06 2010 +0000
    
        Added 32-bit Thumb instruction CLREX (Clear-Exclusive) for disassembly only.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97595 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 5210aa3afd28b390195d929c05e4bc0ff4f2cba9
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Tue Mar 2 22:10:24 2010 +0000
    
        Allow specialization of ScopedHashTable of non-default DenseMapInfo.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97594 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ddde6747e4069a787fe44517b9856383712070fb
    Author: Bill Wendling <isanbard at gmail.com>
    Date:   Tue Mar 2 21:50:35 2010 +0000
    
        Okay. One last attempt:
    
        Place the LSDA into the TEXT section on Mach-O. This saves space.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97592 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 905465e7420cd11c4368e80ee0b68529234e536b
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Mar 2 20:48:24 2010 +0000
    
        this testcase is failing because pic16 doesn't define a reg/reg
        xor pattern.  I have no plans to fix this XFAIL.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97587 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit a6bd358b68e8d5ab977d15faa309c66f42482643
    Author: Erick Tryzelaar <idadesub at users.sourceforge.net>
    Date:   Tue Mar 2 20:32:32 2010 +0000
    
        Add support for use to ocaml.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97586 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 6a5b54284276cba3c33fc2673cd56cf7f94ae143
    Author: Erick Tryzelaar <idadesub at users.sourceforge.net>
    Date:   Tue Mar 2 20:32:28 2010 +0000
    
        Rename LLVMUseIteratorRef to LLVMUseRef since we don't refer to iterators in llvm-c.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97585 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit f5635f0323df2a9a3675a310e45ef0c61e959ff1
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Mar 2 19:53:25 2010 +0000
    
        xfail this for now.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97584 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 77eb6bea8bc6914093bd759d4a1a6f19c76e0c64
    Author: Johnny Chen <johnny.chen at apple.com>
    Date:   Tue Mar 2 19:38:59 2010 +0000
    
        Removed the extra S from the multiclass def T2I_adde_sube_s_irs as well as from
        the opc string passed in, since it's a given from the class inheritance of T2sI.
        The fixed the extra 's' in adcss & sbcss when disassembly printing.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97582 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit c8163f938b0e5e62a13e18125fb6f79d3c96cead
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Mar 2 19:34:59 2010 +0000
    
        run HandleMergeInputChains even if we only have one input chain.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97581 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit bb10eea9fd12836819acfa4d5d73b048e3e9e3d4
    Author: Dan Gohman <gohman at apple.com>
    Date:   Tue Mar 2 19:32:21 2010 +0000
    
        When expanding an expression such as (A + B + C + D), sort the operands
        by loop depth and emit loop-invariant subexpressions outside of loops.
        This speeds up MultiSource/Applications/viterbi and others.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97580 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 417282ec649a3b8d52c4749be0edbd0cd8885528
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Tue Mar 2 19:03:01 2010 +0000
    
        Swap parameters of isSafeToMove and isSafeToReMat for consistency.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97578 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 58a36789dc375f5b8057527b37f61ba2b24642c1
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Tue Mar 2 19:02:27 2010 +0000
    
        Fix typo.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97577 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 475c915bc20438417296734952a6c29a16233192
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Mar 2 18:56:03 2010 +0000
    
        clean up some testcases.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97576 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 483e6c612accc3f613291675ba6d6bfe49ccaf13
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Mar 2 18:15:02 2010 +0000
    
        the sorting predicate should work for comparing an element
        to itself, even though this isn't wildly useful.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97574 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 7795907648d497959c58d099064faa0a525317f6
    Author: Johnny Chen <johnny.chen at apple.com>
    Date:   Tue Mar 2 18:14:57 2010 +0000
    
        Added 32-bit Thumb instructions: CPS, SDIV, UDIV, SXTB16, SXTAB16, UXTAB16, SEL,
        SMMULR, SMMLAR, SMMLSR, TBB, TBH, and 16-bit Thumb instruction CPS for
        disassembly only.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97573 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit cdff186e041e26e7bf719d4ca0397274fe92639a
    Author: Devang Patel <dpatel at apple.com>
    Date:   Tue Mar 2 17:58:15 2010 +0000
    
        Fix grammar.
        Thanks Duncan!
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97572 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ad2444f6d85258477141bf67ebfb509ab7b5e521
    Author: Johnny Chen <johnny.chen at apple.com>
    Date:   Tue Mar 2 17:57:15 2010 +0000
    
        AL is an optional mnemonic extension for always, except in IT instructions.
        Add printMandatoryPredicateOperand() PrintMethod for IT predicate printing.
    
        Ref: A8.3 Conditional execution
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97571 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit c53e80f9669af6a1bf51f1a8c48df658644b428b
    Author: Johnny Chen <johnny.chen at apple.com>
    Date:   Tue Mar 2 17:03:18 2010 +0000
    
        Change some asm shift opcode strings to lowercase.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97567 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit d928e505781c90b0f2638a14581efa2e02109998
    Author: Xerxes Ranby <xerxes at zafena.se>
    Date:   Tue Mar 2 13:42:03 2010 +0000
    
        fix typo add missing (
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97565 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit dbf8d6503ad48921440fb59c5d0fdb8eac06938f
    Author: Xerxes Ranby <xerxes at zafena.se>
    Date:   Tue Mar 2 13:26:18 2010 +0000
    
        Unbreak llvm-arm-linux buildbot and fix PR5309.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97564 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 0d58d6576bedd9be85df075e24776d28658ccbb2
    Author: Duncan Sands <baldrick at free.fr>
    Date:   Tue Mar 2 11:18:43 2010 +0000
    
        Rather than passing "false" for InsertBefore, AddressSpace for ThreadLocal,
        and nothing for AddressSpace, pass 0 for InsertBefore, "false" for ThreadLocal
        and AddressSpace for AddressSpace.  Spotted by gcc-4.5.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97563 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 12227402851982da92af8257263bd7a3dc213ab3
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Mar 2 07:50:03 2010 +0000
    
        Fix the xfail I added a couple of patches back.  The issue
        was that we weren't properly handling the case when interior
        nodes of a matched pattern become dead after updating chain
        and flag uses.  Now we handle this explicitly in
        UpdateChainsAndFlags.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97561 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 4ccb30d2dffed0f20c74cc36745c222414e3d765
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Mar 2 07:14:49 2010 +0000
    
        I was confused about this, it turns out that MorphNodeTo
        *does* delete ex-operands that become dead.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97559 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit b2c2cbb24ffa9818864fecdd0edc781cd2d994f5
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Mar 2 06:55:04 2010 +0000
    
        factor node morphing out to its own helper method.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97558 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 7ff97812803efa6bbb640493731bcc7d00c3bc50
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Mar 2 06:36:51 2010 +0000
    
        attributes are not part of types anymore, patch by James Woodyatt!
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97557 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 24466bd998a4f0669ca776c5b944876e29a2af6c
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Mar 2 06:36:28 2010 +0000
    
        eliminate CodeGen/DAGISelHeader.h, it is empty now.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97556 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 58132fddf1ea639401e08340d3c51143e93bbc15
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Mar 2 06:34:30 2010 +0000
    
        Sink InstructionSelect() out of each target into SDISel, and rename it
        DoInstructionSelection.  Inline "SelectRoot" into it from DAGISelHeader.
        Sink some other stuff out of DAGISelHeader into SDISel.
    
        Eliminate the various 'Indent' stuff from various targets, which dates
        to when isel was recursive.
    
         17 files changed, 114 insertions(+), 430 deletions(-)
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97555 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit f2d40399a72c153339f3b945f066b8c96c0bf3e0
    Author: Eric Christopher <echristo at apple.com>
    Date:   Tue Mar 2 06:25:00 2010 +0000
    
        Only save vector registers if we've defined for the vector registers.
    
        Fixes PR5309.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97554 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 5f67a13451468f8ce717ca9027b6682877f9f7d2
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Mar 2 06:04:12 2010 +0000
    
        move some code out of DAGISelHeader up to SelectionDAGISel.h where it
        is shared by all targets.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97553 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ab60ef8f311ea273509797ec2c4318732d1012ce
    Author: Erick Tryzelaar <idadesub at users.sourceforge.net>
    Date:   Tue Mar 2 05:32:52 2010 +0000
    
        Fix looking up MD names to not need a module.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97550 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit e698201c7f1c69b21bc4793670d889309c54f924
    Author: Eric Christopher <echristo at apple.com>
    Date:   Tue Mar 2 05:17:21 2010 +0000
    
        Move the docsdir to /usr/share/doc/llvm to match other projects.
    
        Fixes PR6267.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97549 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 46d06bbfb91bf06007f62cf8e3e55db44f41d18f
    Author: Eric Christopher <echristo at apple.com>
    Date:   Tue Mar 2 05:06:54 2010 +0000
    
        Make sure we save CXXFLAGS before setting it as pedantic and regenerate
        configure.
    
        Fixes PR6388.
    
        Patch by Yann Droneaud!
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97548 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 3dcff6b02d5fbca92a6f689dc736e899e7931eaf
    Author: Eric Christopher <echristo at apple.com>
    Date:   Tue Mar 2 02:49:43 2010 +0000
    
        Add file to CMakeLists.txt
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97545 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 33880353f3b7bb2b8068e6ed39eccc08c263f60e
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Tue Mar 2 02:38:24 2010 +0000
    
        Add skeleton of a machine level cse pass.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97543 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 37c9263aca6dab843a9b1b4d84b4fc4ccf52a732
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Tue Mar 2 02:37:33 2010 +0000
    
        Add count() and lookup() to ScopedHashTable. It might be useful to get information out of the hash table.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97542 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit dd20d2550e38dec3e1b1666e4166c2c8e46850fb
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Mar 2 02:37:23 2010 +0000
    
        Use the right induction variable.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97541 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 645d1cecf03833d5fdcd62a62286d3193d6dda20
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Mar 2 02:22:10 2010 +0000
    
        Rewrite chain handling validation and input TokenFactor handling
        stuff now that we don't care about emulating the old broken
        behavior of the old isel.  This eliminates the
        'CheckChainCompatible' check (along with IsChainCompatible) which
        did an incorrect and inefficient scan *up* the chain nodes which
        happened as the pattern was being formed and does the validation
        at the end in HandleMergeInputChains when it forms a structural
        pattern.  This scans "down" the graph, which means that it is
        quickly bounded by nodes already selected.  This also handles
        token factors that get "trapped" in the dag.
    
        Removing the CheckChainCompatible nodes also shrinks the
        generated tables by about 6K for X86 (down to 83K).
    
        There are two pieces remaining before I can nuke PreprocessRMW:
        1. I xfailed a test because we're now producing worse code in a
           case that has nothing to do with the change: it turns out that
           our use of MorphNodeTo will leave dead nodes in the graph
           which (depending on how the graph is walked) end up causing
           bogus uses of chains and blocking matches.  This is really
           bad for other reasons, so I'll fix this in a follow-up patch.
    
        2. CheckFoldableChainNode needs to be improved to handle the TF.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97539 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit a14a5077a5804713ff8262f5eb4ce43ab41aeb7e
    Author: Dan Gohman <gohman at apple.com>
    Date:   Tue Mar 2 02:14:38 2010 +0000
    
        Fix several places to handle vector operands properly.
        Based on a patch by Micah Villmow for PR6438.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97538 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 3d553d864b97fd0283fe0d4f5a740780289386ed
    Author: Dan Gohman <gohman at apple.com>
    Date:   Tue Mar 2 01:59:21 2010 +0000
    
        Non-affine post-inc SCEV expansions have more code which must be
        emitted after the increment. Make sure the insert position
        reflects this. This fixes PR6453.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97537 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 3b90d3794cfe6e8ad522399cf81af8afe01d6535
    Author: Bill Wendling <isanbard at gmail.com>
    Date:   Tue Mar 2 01:55:18 2010 +0000
    
        Remove dead parameter passing.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97536 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 1d7ac48da3b9e6a7709d661695920c111bc8d172
    Author: Devang Patel <dpatel at apple.com>
    Date:   Tue Mar 2 01:26:20 2010 +0000
    
        Constructors and operators for anonymous aggregates does not names. Do not force empty AT_name attribute in such cases.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97533 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit df236b99612bf13242fd83e74e5ce902dc2050b2
    Author: Dan Gohman <gohman at apple.com>
    Date:   Tue Mar 2 01:11:08 2010 +0000
    
        Floating-point add, sub, and mul are now spelled fadd, fsub, and fmul,
        respectively.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97531 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit f90913ecdaba0e911feff5419bddae0cd3945359
    Author: Dan Gohman <gohman at apple.com>
    Date:   Tue Mar 2 01:08:11 2010 +0000
    
        PerformTailCallOpt was renamed to GuaranteedTailCallOpt to
        better reflect its meaning, now that tail call optimizations
        are done by default in some cases.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97530 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit f3fcac3316951ba07b0b7ea1b35fac04e47e43db
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Mar 2 00:40:26 2010 +0000
    
        remove dead code.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97529 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 260058f76c2106f6f4acfdf38b1ef4a95c5945a4
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Mar 2 00:13:03 2010 +0000
    
        add some missing \n's
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97527 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 50a69481871546040ce068be4513ad612331e46b
    Author: Bob Wilson <bob.wilson at apple.com>
    Date:   Tue Mar 2 00:09:29 2010 +0000
    
        Don't attempt load PRE when there is no real redundancy (i.e., the load is in
        a loop and is itself the only dependency).
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97526 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 4c85da73dae24e6f2b27378efe16b9a0624a5701
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Mar 2 00:00:03 2010 +0000
    
        refactor some code out of OPC_EmitMergeInputChains into a
        new helper function.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97525 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 08a3d3fb1e0f5859d9a5700fc19a104dc99714ae
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Mon Mar 1 23:40:33 2010 +0000
    
        remove some functions that were only used by the
        old isel generated code.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97522 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit cdc2f6d89067566b9296fa533767143e92c3cc81
    Author: Bob Wilson <bob.wilson at apple.com>
    Date:   Mon Mar 1 23:37:32 2010 +0000
    
        When GVN needs to split critical edges for load PRE, check all of the
        predecessors before returning.  Otherwise, if multiple predecessor edges need
        splitting, we only get one of them per iteration.  This makes a small but
        measurable compile time improvement with -enable-full-load-pre.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97521 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 7feeb6e3d905c5fa8d4a2880629df7c4ef0e381e
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Mon Mar 1 23:08:51 2010 +0000
    
        fixme resolved.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97517 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 24ebfdd24c06935f75e62e96895d37f35434a2f0
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Mon Mar 1 22:51:11 2010 +0000
    
        remove a little hack I did for the old isel, not needed
        now that it is gone.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97516 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 57ebc5e653cbf4284f907b24a0fab8add8115f08
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Mon Mar 1 22:49:06 2010 +0000
    
        resolve some fixmes
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97515 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 8d6a51163d2e8d0911aaeb265e8dfab3fc2a934a
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Mon Mar 1 22:46:42 2010 +0000
    
        resolve a fixme and simplify code by moving insertion of the
        EmitMergeInputChainsMatcher node up into EmitResultCode.  This
        doesn't have much of an effect on the generated code, the X86
        table is exactly the same size.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97514 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 62300e6cebb26b0de1f8f99ed62463d0ef4d7c9c
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Mon Mar 1 22:29:19 2010 +0000
    
        resolve a fixme by having the .td file parser reject thigns like
    
        (set GPR, somecomplexpattern)
    
        if somecomplexpattern doesn't declare what it can match.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97513 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 5d53bd63665da09ed931b601d19da0c08097491f
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Mon Mar 1 22:23:12 2010 +0000
    
        MemoryDepAnalysis is not used if redundant load processing is disabled.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97512 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 2d44157df53834c145dc42123b6e5fb777ca5539
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Mon Mar 1 22:20:05 2010 +0000
    
        remove all but one version of SelectionDAG::MorphNodeTo
        (the most general) the others are dead.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97511 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit a862e2d42700b96c82d6c8df8401519151972fe6
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Mon Mar 1 22:19:47 2010 +0000
    
        remove dead code, simplify.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97510 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 22e438bea13c3dfcb0474c8d7553cb9f19bdcbb3
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Mon Mar 1 22:09:11 2010 +0000
    
        Fix PR2590 by making PatternSortingPredicate actually be
        ordered correctly.  Previously it would get in trouble when
        two patterns were too similar and give them nondet ordering.
        We force this by using the record ID order as a fallback.
    
        The testsuite diff is due to alpha patterns being ordered
        slightly differently, the change is a semantic noop afaict:
    
        < 	lda $0,-100($16)
        ---
        > 	subq $16,100,$0
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97509 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 4418997fb6ffa56726629c271c122495c2c7c0c4
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Mon Mar 1 22:04:33 2010 +0000
    
        tolerate factoring the *last* node for CellSPU.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97508 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit e15fe40f5a32095a05f4ff5f4893c62b87ce26ce
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Mon Mar 1 22:00:11 2010 +0000
    
        Remove the optimize for code size limitation on r67917. Optimize 64-bit imul by constants into leas + shl regardless if optimizing for code size. The size saving from using imulq isn't worth it. Also, the lea and shl instructions may expose further optimization.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97507 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 8295665bba2279540d57829dcecff576ae25e439
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Mon Mar 1 21:49:54 2010 +0000
    
        optimize tblgen compile time by eliminating the old isel.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97504 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 5b23bcf07f255f7d4fce0e591e35471a75fdc683
    Author: Dan Gohman <gohman at apple.com>
    Date:   Mon Mar 1 21:45:21 2010 +0000
    
        Make llc opt into the addPassesToEmitFile verify pass.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97502 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 7fb316404308c1aac6821255982e5b67866a499a
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Mon Mar 1 21:20:46 2010 +0000
    
        remove a terrible hack that disabled assertions from this file because of build time
        problems.  rdar://7697850.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97500 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit b2f406b555d99585ac8a4f1415285779696ddf1e
    Author: Jakob Stoklund Olesen <stoklund at 2pi.dk>
    Date:   Mon Mar 1 20:59:38 2010 +0000
    
        Use methods to determine if a LiveInterval is spillable.
    
        Don't accidentally produce unspillable intervals for deeply nested loops.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97496 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit c01812c5876a287ed5b8dcf6202a4f1bd96602b7
    Author: Devang Patel <dpatel at apple.com>
    Date:   Mon Mar 1 20:33:48 2010 +0000
    
        Remove  tests that checks @llvm.dbg.stoppoint handling.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97493 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 2c4d5029d1d0f88c30bf95fda9214a8d89bba751
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Mon Mar 1 20:24:50 2010 +0000
    
        stop using anders-aa
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97492 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 32f6cf91d506799397c854220680a4418e28cfad
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Mon Mar 1 20:24:05 2010 +0000
    
        stop using anders-aa
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97491 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 3d424a60864d2adf37098d15c8a5c21545cdfa08
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Mon Mar 1 20:23:15 2010 +0000
    
        remove andersen's tests.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97490 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit aa7e2749f520bbfd4a4d107e16d0704ed417c7ee
    Author: Devang Patel <dpatel at apple.com>
    Date:   Mon Mar 1 19:46:08 2010 +0000
    
        @llvm.dbg.stoppoint intrinsic is not used anymore.
        Delete dead testcase.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97489 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 0f7d3b5afa2490eb194fe931b6477fd22d3a96c2
    Author: Ted Kremenek <kremenek at apple.com>
    Date:   Mon Mar 1 19:42:47 2010 +0000
    
        Update CMake build.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97488 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit f30f0316e20fa83ab95dcbed7d7ba68c32347aad
    Author: Devang Patel <dpatel at apple.com>
    Date:   Mon Mar 1 19:41:26 2010 +0000
    
        Update to use new debug info encoding scheme. As a bonus, now the test passes!
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97487 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit b5199788f617a98bf5b27759e1f797bf5e0b3923
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Mon Mar 1 19:39:15 2010 +0000
    
        don't emit the old sdnodexform stuff for the new isel.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97486 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 3e46b9150341e9427461eadb8f6ad1ef9a189430
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Mon Mar 1 19:38:53 2010 +0000
    
        stop using generated sdnodexforms.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97485 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit d85206bea0a36f0c4076a32cb2e95601645e640f
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Mon Mar 1 19:29:17 2010 +0000
    
        note that andersaa was removed in 2.7
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97484 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit cfbb0c6be01df99a6ffeae22115516f0e945fef2
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Mon Mar 1 19:24:17 2010 +0000
    
        remove anders-aa from mainline, it isn't maintained and is
        tantalyzing enough that people keep trying to use it.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97483 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit b1f2cde6af7f0db1517bd466ccb899b4ee9d5a23
    Author: Johnny Chen <johnny.chen at apple.com>
    Date:   Mon Mar 1 19:22:00 2010 +0000
    
        Added STRHT for disassembly only and fixed a bug in AI3sthpo class where the W
        bit should be set to 0 instead of 1.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97481 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit c0ab0702974c022f6a18439c5a48377ac2342c64
    Author: Devang Patel <dpatel at apple.com>
    Date:   Mon Mar 1 19:14:25 2010 +0000
    
        Remove this test because it checks wheter optimizer handled @llvm.dbg.global_variable appropriately or not. LLVM does not use this scheme to encode debug info for global variables any more.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97480 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit a269f3e1aba5cdad240aec7076ca5e7152d15969
    Author: Devang Patel <dpatel at apple.com>
    Date:   Mon Mar 1 19:09:55 2010 +0000
    
        Remove test to check bugfix in handing debug info for global variables using intrinsics. Now, debug info for global variable is encoded using metadata. The old code path is now history and there is no need to have a test to check a bug fix in old code path.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97477 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit fb1c9ef6ed13e877ccf48be75e6a1023c3b2b7c5
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Mon Mar 1 19:05:25 2010 +0000
    
        Turn on the new isel by default.  Here are some fun numbers
        with a release-asserts build on x86-64-darwin10:
    
        LLC Size:
        Old: 15,426,852
        New: 12,759,140  (down 2.7M)
    
        LLI Size:
        Old: 9,926,876
        New: 8,864,292   (down 1.1M)
    
        X86ISelDAGToDAG.o size:
        Old: 1,401,232
        New:   162,868   (down 1.3M)
    
        Time to build X86ISelDAGToDAG.o:
        Old: 67.147u 2.060s 1:09.78
        New:  4.234u 0.387s 0:04.77
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97475 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 0d791b44af91da373093865ea230fbf38ec0948f
    Author: Devang Patel <dpatel at apple.com>
    Date:   Mon Mar 1 19:04:23 2010 +0000
    
        Remove dead test.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97474 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit a7ed258a0bfd46180a030422d9558aa74d20bcfe
    Author: Devang Patel <dpatel at apple.com>
    Date:   Mon Mar 1 19:02:51 2010 +0000
    
        Replace test case that uses @llvm.dbg.* intrinsic with a test that uses metadata.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97473 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit d43e9a3a28b001bf2dbbcd34a4fbebecf7e64d4d
    Author: Edwin Török <edwintorok at gmail.com>
    Date:   Mon Mar 1 19:00:55 2010 +0000
    
        Missed a \n in previous commit.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97472 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 900084a3a996d57d247b2cf2e5dc3891f38bb6ef
    Author: Edwin Török <edwintorok at gmail.com>
    Date:   Mon Mar 1 18:49:10 2010 +0000
    
        Add command-line flag to tblgen to turn off generating comments for the new
        isel (defaults it to generate comments).
        This reduces the size of the generated source file.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97470 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 4cf6005fd6c4683897dc7900db9d0e18f1c1c163
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Mon Mar 1 18:47:11 2010 +0000
    
        Accelerate isel dispatch for tables that start with a top-level
        OPC_SwitchOpcode to use a table lookup instead of having to go
        through the interpreter for this.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97469 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 73faf3b452fb3f786eaf59dd94653f0a1e417f97
    Author: Devang Patel <dpatel at apple.com>
    Date:   Mon Mar 1 18:45:28 2010 +0000
    
        These two tests check whether oprimizer safely ignores @llvm.dbg.stoppoint intrinsic or not. This intrinsic is not used anymore.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97468 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 57fb3dc4756b2368cd4dfc9d7dc69fbd07ec6eba
    Author: John McCall <rjmccall at apple.com>
    Date:   Mon Mar 1 18:38:45 2010 +0000
    
        Don't potentially read past the end of the fill data when making a NaN from
        an APInt.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97467 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ce6fc8a4994331b09cae2aea6d056acd7d854acb
    Author: Devang Patel <dpatel at apple.com>
    Date:   Mon Mar 1 18:32:27 2010 +0000
    
        This test checks whether LICM ignores @llvm.dbg.stoppoint intrinsics appropriately or not. Now, llvm does not use this intrinsic. Remove this test.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97466 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ff71abdc1ad48564ec39a08c2dfc8ada00d09269
    Author: Devang Patel <dpatel at apple.com>
    Date:   Mon Mar 1 18:30:58 2010 +0000
    
        Rewrite test to test VLA using new debug info encoding scheme.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97465 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit a2208249ae2bfc2bfe44891b9428285f1be8ecb8
    Author: Devang Patel <dpatel at apple.com>
    Date:   Mon Mar 1 18:30:08 2010 +0000
    
        Remove this generic debug info intrinsic test. LLVM does not use this llvm.dbg.stoppoint intrinsic anymore. There are tests to check new implementation, which attaches location information directly with an instruction using metadata.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97464 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 67cd6e6ab83953b91433830206ccd949cdd42546
    Author: Dan Gohman <gohman at apple.com>
    Date:   Mon Mar 1 17:59:21 2010 +0000
    
        Fix optimization of ISD::TRUNCATE on vector operands. Based on a patch
        by Micah Villmow for PR6335.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97461 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 394b4939b4abb5aaa780407b6185638488fa9171
    Author: Dan Gohman <gohman at apple.com>
    Date:   Mon Mar 1 17:56:46 2010 +0000
    
        Add explicit keywords.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97460 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit bbbcd55632c777c274e90f3287fc0c3e89e388ac
    Author: Dan Gohman <gohman at apple.com>
    Date:   Mon Mar 1 17:56:04 2010 +0000
    
        Add a comment.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97459 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 7f37d90123bcf49949425057710641d0e35897d2
    Author: Dan Gohman <gohman at apple.com>
    Date:   Mon Mar 1 17:55:27 2010 +0000
    
        Add some debug output to LoopSimplify.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97458 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit c099730599723c7545055dd1ce973b8e86ddc422
    Author: Dan Gohman <gohman at apple.com>
    Date:   Mon Mar 1 17:53:39 2010 +0000
    
        Add the alignstack keyword.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97457 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 4aca1f7708d659f0f318433f12f4a985aa753aad
    Author: Dan Gohman <gohman at apple.com>
    Date:   Mon Mar 1 17:53:15 2010 +0000
    
        LLVM instruction syntax doesn't have trailing semicolons.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97456 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 2bc097deea0aef83a61f7058471b2962416bb8a3
    Author: Dan Gohman <gohman at apple.com>
    Date:   Mon Mar 1 17:52:16 2010 +0000
    
        svn:ignore fixes.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97455 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit a823e5e5935f53e6446c1adc4efde2974a9ca8e3
    Author: Dan Gohman <gohman at apple.com>
    Date:   Mon Mar 1 17:51:02 2010 +0000
    
        Spelling fixes.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97454 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 03bf33a56bce72af7a76cea32f2b01fe0ab5a4e1
    Author: Dan Gohman <gohman at apple.com>
    Date:   Mon Mar 1 17:49:51 2010 +0000
    
        Spelling fixes.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97453 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 39cf7ad065e20be0898c6003b3e350cb42f379eb
    Author: Dan Gohman <gohman at apple.com>
    Date:   Mon Mar 1 17:47:21 2010 +0000
    
        Whitespace cleanups.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97452 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 6600d10855c8457fb20f04362c678911f6cfb648
    Author: Dan Gohman <gohman at apple.com>
    Date:   Mon Mar 1 17:45:15 2010 +0000
    
        Use Doxygen comment syntax.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97451 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 3f6a178532279b83f4eb30d58ec66f704f219e87
    Author: Dan Gohman <gohman at apple.com>
    Date:   Mon Mar 1 17:43:57 2010 +0000
    
        This is now done.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97450 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 2119ecfcab1b531dbd10b8371c5b143aa155b75a
    Author: Dan Gohman <gohman at apple.com>
    Date:   Mon Mar 1 17:42:55 2010 +0000
    
        Fix a missing newline in debug output.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97449 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 9568d4b7819c5d7f928ace96ea7d7732e3db2eb4
    Author: Dan Gohman <gohman at apple.com>
    Date:   Mon Mar 1 17:42:17 2010 +0000
    
        Prune #includes.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97448 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit d5c104e7a9aabb7645db735cd4cdfc714b5916fc
    Author: Dan Gohman <gohman at apple.com>
    Date:   Mon Mar 1 17:41:39 2010 +0000
    
        Fix spelling.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97447 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 6577b50b6f8ad580eb7d3f7016f0273457061098
    Author: Dan Gohman <gohman at apple.com>
    Date:   Mon Mar 1 17:34:28 2010 +0000
    
        Don't print "Modified" for passes which haven't modified anything.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97446 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 98bcbe6c99e81d18bd0aec239b0a818fc42df6e9
    Author: Nathan Keynes <Nathan.Keynes at sun.com>
    Date:   Mon Mar 1 10:40:41 2010 +0000
    
        Add JIT support to the TODO list (test commit)
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97443 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 9dc91ac6e34d324bab29063b90aff9f6216541b8
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Mon Mar 1 07:54:59 2010 +0000
    
        Emit type checks late instead of early, this encourages
        structural matching code to be factored and shared this
        shrinks the X86 isel table from 86537 to 83890 bytes.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97442 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit c512fe0ee4f668f6df9c4e2adf994a042c589597
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Mon Mar 1 07:43:08 2010 +0000
    
        some trivial microoptimizations.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97441 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ad0f17c91f61dd1118e48937e67b82381f26a8be
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Mon Mar 1 07:27:07 2010 +0000
    
        Emit a redundant check for immediates at root context, e.g. (imm 0).
        This allows formation of OpcodeSwitch for top level patterns, in
        particular on X86.  This saves about 1K of data space in the x86
        table and makes the dispatch much more efficient.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97440 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 6ccd7096ef3cd69a663ec57bf08515f42feb7fc1
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Mon Mar 1 07:17:40 2010 +0000
    
        eliminate the CheckMultiOpcodeMatcher code and have each
        ComplexPattern at the root be generated multiple times, once
        for each opcode they are part of.  This encourages factoring
        because the opcode checks get treated just like everything
        else in the matcher.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97439 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 7b12730d457b342eb88dcca8bc7a6af4be6167ca
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Mon Mar 1 06:59:22 2010 +0000
    
        add a new OPC_SwitchOpcode which is semantically equivalent
        to a scope where every child starts with a CheckOpcode, but
        executes more efficiently.  Enhance DAGISelMatcherOpt to
        form it.
    
        This also fixes a bug in CheckOpcode: apparently the SDNodeInfo
        objects are not pointer comparable, we have to compare the
        enum name.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97438 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 6e68128b5add40945c87a8158210a262882b74d0
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Mon Mar 1 02:33:14 2010 +0000
    
        pull MarkFlagResult out from between an EmitNode/CompleteMatch
        pair.  This encourages MorphNodeTo formation, this gets us 200
        more MorphNodeTo's on X86 and shrinks the table a bit.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97434 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 5fb9cc77917868b356308408cccec6556b692058
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Mon Mar 1 02:24:17 2010 +0000
    
        enhance RecordNode and RecordChild comments to indicate what
        slot they're recording into, no functionality change.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97433 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 51a318403fb8e5d67c3aeeee9f31d1f01d2aa4ab
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Mon Mar 1 02:15:34 2010 +0000
    
        Emit redundant opcode checks for andimm and orimm tests at root
        so that we get grouping at the top level.
    
        Add an optimization to reorder type check & record nodes
        after opcode checks.  We prefer to expose tree shape
        matching which improves grouping and will enhance the next
        optimization.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97432 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ea9b74379f485b6de4fef0ba8f6217fd9b84f16b
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Mon Mar 1 01:54:19 2010 +0000
    
        inline the node transforms and node predicates into the generated
        dispatcher method.  This eliminates the dependence of the new isel's
        generated code on the old isel's predicates, however some random
        hand written isel code still uses them.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97431 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 4ce0b03a5953fefa42ca43c150130907903bd64a
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sun Feb 28 23:00:47 2010 +0000
    
        simplify some code now that chain/flag results are not stored in
        the vtlist for emitnode.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97429 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit bfbeef9fd80c771c49c245f10b42d2a636a6934f
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sun Feb 28 22:57:03 2010 +0000
    
        don't emit useless functions.  These were producing
        warnings in release-assert builds if there were no cases.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97428 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 36ae3a009e6568e3ca67b2a2fbfe7856291c13e2
    Author: Mikhail Glushenkov <foldr at codedgers.com>
    Date:   Sun Feb 28 22:54:30 2010 +0000
    
        80-col violations/trailing whitespace.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97427 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 96cef7b5473e983c9ff73eb828499e6a13f751d7
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sun Feb 28 22:38:43 2010 +0000
    
        eliminate GetInt1/2
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97426 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 0417ed0c15a13e3db6ffe44ee2c48173484a1109
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sun Feb 28 22:37:22 2010 +0000
    
        hoist the new isel interpreter out of DAGISelHeader.h
        (which gets #included into the middle of each
        target's DAGISel class) into a .cpp file where it is
        only compiled once.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97425 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 856846ab383401ba1dbfeeec0f47ced8b118a4bb
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sun Feb 28 22:14:32 2010 +0000
    
        change a few opcodes to use VBRs instead of embedding
        immediate sizes into the opcode.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97423 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit cb595e5073d524aee1567d7cee9fe3494278eb6f
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sun Feb 28 21:58:42 2010 +0000
    
        move all the opcodes out of DAGISelHeader.h (which gets
        #included into the middle of each isel class) into a real
        header.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97421 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 43c6ab0a079de32d6fb58d1a90a3809ba2901908
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sun Feb 28 21:56:16 2010 +0000
    
        resolve a fixme by using hte new flag.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97420 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit b7fcce3c10c92cbf96d224235dc4b76cfd08fde8
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sun Feb 28 21:53:42 2010 +0000
    
        enhance the EmitNode/MorphNodeTo operands to take a bit that
        specifies whether there is an output flag or not.  Use this
        instead of redundantly encoding the chain/flag results in the
        output vtlist.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97419 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 53bd1ebee622628c7343ed41c5712f36b6e4ce5e
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sun Feb 28 21:36:14 2010 +0000
    
        enhance the new isel to handle the 'node already exists'
        case of MorphNodeTo directly.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97417 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit c7f6db0a804e649cf9ca8287e124992f1fb4c9fe
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sun Feb 28 20:55:18 2010 +0000
    
        use MorphNodeTo instead of SelectNodeTo.  SelectNodeTo
        is just a silly wrapper around MorphNodeTo.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97416 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 4051f97bd0cec2c25a612275d784bf3158f7d519
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sun Feb 28 20:49:53 2010 +0000
    
        enhance the new isel to use SelectNodeTo for most patterns,
        even some the old isel didn't.  There are several parts of
        this that make me feel dirty, but it's no worse than the
        old isel.  I'll clean up the parts I can do without ripping
        out the old one next.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97415 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 83cf81459909f6ad4fc1d4f4156b80ba7af75069
    Author: Erick Tryzelaar <idadesub at users.sourceforge.net>
    Date:   Sun Feb 28 20:45:03 2010 +0000
    
        Add support getting the operands of a User to ocaml.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97414 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 450fb9a0dcaea37af6c84ab5dad4300dd8879c88
    Author: Erick Tryzelaar <idadesub at users.sourceforge.net>
    Date:   Sun Feb 28 20:44:58 2010 +0000
    
        Add support for global aliases to ocaml.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97413 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit d3bde2b90fafbbf7d9aabf68b23af9b628cf0085
    Author: Erick Tryzelaar <idadesub at users.sourceforge.net>
    Date:   Sun Feb 28 20:44:53 2010 +0000
    
        Add support for inserting inline asm to ocaml.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97412 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 93a2c6ec39a97fe46492cf53eb650eddab7bbfc1
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sun Feb 28 20:36:49 2010 +0000
    
        add some random nounwinds.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97411 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit aa921203d13ac0fb0d154010c24a417958283020
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sun Feb 28 18:57:59 2010 +0000
    
        I'm removing andersaa after the branch is made.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97409 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 9d3d749dfb45895948c6a8d8528e1bd2a7b13837
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sun Feb 28 18:53:13 2010 +0000
    
        simplify this code, return only ever has zero or one operands.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97408 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit a60c85a69c177be912465a44b4717adfeb979816
    Author: John McCall <rjmccall at apple.com>
    Date:   Sun Feb 28 12:49:50 2010 +0000
    
        Properly clear all the extra bits in a significand when making a NaN from an
        APInt.  Be certain to set the integer bit in an x87 extended-precision
        significand so that we don't accidentally make a pseudo-NaN.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97382 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit b73b9b8128235c347a93945605d1cd84e582696c
    Author: John McCall <rjmccall at apple.com>
    Date:   Sun Feb 28 09:55:58 2010 +0000
    
        Add an override to StringRef::getAsInteger which parses into an APInt.
        It gets its own implementation totally divorced from the (presumably
        performance-sensitive) routines which parse into a uint64_t.
    
        Add APInt::operator|=(uint64_t), which is situationally much better than
        using a full APInt.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97381 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit f70395da00a55ea0ae9734f316d3be00e31978a7
    Author: Erick Tryzelaar <idadesub at users.sourceforge.net>
    Date:   Sun Feb 28 09:46:27 2010 +0000
    
        Add support for getting a null pointer.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97380 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit b522f73045d581a47646967565b75e494ced5c79
    Author: Erick Tryzelaar <idadesub at users.sourceforge.net>
    Date:   Sun Feb 28 09:46:21 2010 +0000
    
        Add a way to look up a type by it's name in a module.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97379 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit d00375038d31c98adbbf3c990168b1fac0cd2735
    Author: Erick Tryzelaar <idadesub at users.sourceforge.net>
    Date:   Sun Feb 28 09:46:16 2010 +0000
    
        Add replace_all_uses_with to ocaml.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97378 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 0dc2daf8a6c205a9ee950843ad527b5b88e7463d
    Author: Erick Tryzelaar <idadesub at users.sourceforge.net>
    Date:   Sun Feb 28 09:46:13 2010 +0000
    
        Add support for global variables in an address space for llvm-c and ocaml.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97377 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 15b767e020fdfaa8d198f5f030d330469a5f131a
    Author: Erick Tryzelaar <idadesub at users.sourceforge.net>
    Date:   Sun Feb 28 09:46:06 2010 +0000
    
        Add indirect br support to llvm-c and ocaml.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97376 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 8aaaa83f6c0ab52f16a54243e9b68057e8148d7f
    Author: Erick Tryzelaar <idadesub at users.sourceforge.net>
    Date:   Sun Feb 28 09:45:59 2010 +0000
    
        Add metadata functions to llvm-c and ocaml.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97375 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit c5e4e15881e31968d97b62653a4379fed11c4f3d
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sun Feb 28 07:23:21 2010 +0000
    
        remove redundant instruction.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97374 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit e8936e3701522f0e8fd033265372badb466bc84e
    Author: Erick Tryzelaar <idadesub at users.sourceforge.net>
    Date:   Sun Feb 28 05:51:43 2010 +0000
    
        Add the new builder arthmetic instructions to llvm-c and ocaml.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97372 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit efc5c4e7d824f4ad8619c5e615062f2928479350
    Author: Erick Tryzelaar <idadesub at users.sourceforge.net>
    Date:   Sun Feb 28 05:51:33 2010 +0000
    
        Add the new union arthmetic instructions to llvm-c and ocaml.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97371 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 1c8058555c5031abf80cbd817ae869991069742b
    Author: Erick Tryzelaar <idadesub at users.sourceforge.net>
    Date:   Sun Feb 28 05:51:27 2010 +0000
    
        Add generic binary op and cast builder functions.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97370 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 7aede7fced6359bd3aa9869ef3d5d0ce5362fb6f
    Author: Erick Tryzelaar <idadesub at users.sourceforge.net>
    Date:   Sun Feb 28 05:51:21 2010 +0000
    
        Rename ocaml vmcore tests to make it easier to insert tests.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97369 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 146b87473f05694f887df9b3e6c546e95e868941
    Author: Erick Tryzelaar <idadesub at users.sourceforge.net>
    Date:   Sun Feb 28 05:51:16 2010 +0000
    
        Fix incorrect uses of an ocaml llbuilder without extracting it from ocaml.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97368 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 0279de8b895de809986fe333fed332d7c2566cf2
    Author: Erick Tryzelaar <idadesub at users.sourceforge.net>
    Date:   Sun Feb 28 05:51:09 2010 +0000
    
        Remove malloc and free from the ocaml bindings.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97367 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit c7d12e99d2a502cec60edc40fccf93e065cc2968
    Author: Bob Wilson <bob.wilson at apple.com>
    Date:   Sun Feb 28 05:34:05 2010 +0000
    
        Revert r97245 which seems to be causing performance problems.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97366 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 91b67e07d2385dc10690b7616b0d130049be6185
    Author: John McCall <rjmccall at apple.com>
    Date:   Sun Feb 28 02:51:25 2010 +0000
    
        Teach APFloat how to create both QNaNs and SNaNs and with arbitrary-width
        payloads.  APFloat's internal folding routines always make QNaNs now,
        instead of sometimes making QNaNs and sometimes SNaNs depending on the
        type.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97364 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit bc3645f2ee3c76cd9e607ddcb431d05048e52b1f
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sun Feb 28 02:41:25 2010 +0000
    
        enhance EmitNodeMatcher to keep track of the recorded slot numbers
        it will populate.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97363 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 0d33d1b229f9c69b7d426477fc02a4c060a40d13
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sun Feb 28 02:31:26 2010 +0000
    
        add infrastructure to support forming selectnodeto.  Not used yet
        because I have to go on another detour first.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97362 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 62f32a3103755eaf327dfafd131c4c459858e326
    Author: Dan Gohman <gohman at apple.com>
    Date:   Sun Feb 28 01:33:43 2010 +0000
    
        Don't try to replace physical registers when doing CSE.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97360 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 8511f87ea283219b6d25d37fe66179b511e35e9f
    Author: Dan Gohman <gohman at apple.com>
    Date:   Sun Feb 28 00:41:59 2010 +0000
    
        Add a flag to addPassesToEmit* to disable the Verifier pass run
        after LSR, so that clients can opt in.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97357 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit c58b4d7e491b331370d3a79a43a986f1946a93d2
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sun Feb 28 00:22:30 2010 +0000
    
        Generalize my hack to use SDNodeInfo to find out when a
        node is always guaranteed to have a particular type
        instead of hacking in ISD::STORE explicitly.  This allows
        us to use implied types for a broad range of nodes, even
        target specific ones.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97355 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 497f06b7b7bc7205a6379d1abe5d10b8fa4d9bf4
    Author: Dan Gohman <gohman at apple.com>
    Date:   Sun Feb 28 00:17:42 2010 +0000
    
        Implement XMM subregs.
    
        Extracting the low element of a vector is now done with EXTRACT_SUBREG,
        and the zero-extension performed by load movss is now modeled with
        SUBREG_TO_REG, and so on.
    
        Register-to-register movss and movsd are no longer considered copies;
        they are two-address instructions which insert a scalar into a vector.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97354 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 9aa35000ba4cbc3d03575ab72d657d82f761f370
    Author: Dan Gohman <gohman at apple.com>
    Date:   Sun Feb 28 00:08:44 2010 +0000
    
        Don't unconditionally suppress hoisting of instructions with implicit
        defs or uses. The regular def and use checking below covers them, and
        can be more precise. It's safe to hoist an instruction with a dead
        implicit def if the register isn't live into the loop header.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97352 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit de6a265c339af6a79f20a4add9c890f09521fe71
    Author: Dan Gohman <gohman at apple.com>
    Date:   Sat Feb 27 23:53:53 2010 +0000
    
        Add nounwinds.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97349 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 35d4ac0dc7c9a2616bb63d2f133c688b8299f525
    Author: Dan Gohman <gohman at apple.com>
    Date:   Sat Feb 27 23:47:46 2010 +0000
    
        The mayHaveSideEffects flag is no longer used.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97348 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit d99a053a4c2e05046149d6c7bb5dde3807d999ec
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sat Feb 27 21:48:43 2010 +0000
    
        change CheckOpcodeMatcher to hold the SDNodeInfo instead of
        the opcode name.  This gives the optimizer more semantic info.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97346 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 4247398be6f858db37404021873d11b8e8c4f985
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sat Feb 27 21:15:32 2010 +0000
    
        remove a bogus pattern, which had the same pattern as STDU
        but codegen'd differently.  This really wanted to use some
        sort of subreg to get the low 4 bytes of the G8RC register
        or something.  However, it's invalid and nothing is testing
        it, so I'm just zapping the bogosity.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97345 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit a438b4a8e0e10a25846fe051b68153917abc9538
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sat Feb 27 08:19:47 2010 +0000
    
        add another case from the ppc backend.  This is obviously a huge and
        dissatisfying hack.  TODO: Improve it. :)
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97317 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit dacb44537c6fec3bd9dfb76512ae9d3f327250f6
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sat Feb 27 08:18:55 2010 +0000
    
        fix an incorrect (overly conservative) predicate.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97316 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 24ca8ffb85f2e87c2cc89e910f8de279336c142f
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sat Feb 27 08:13:23 2010 +0000
    
        fix logic in DEBUG.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97315 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit d04d261fdcd3ac272de8cb68226825fa9eba6313
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sat Feb 27 08:11:15 2010 +0000
    
        teach the optimizer that opcode == ISD::STORE  is contradictory
        with getType() == MVT::i32 etc.  Teach it that two different
        integer constants are contradictory.  This cuts 1K off the X86
        table, down to 98k
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97314 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 5834855cea71c583026c77c7bde0ec2fbbd97a25
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sat Feb 27 07:50:40 2010 +0000
    
        fix grammaro's pointed out by daniel
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97313 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 830549b90a14b345509a0984526c78eb1c65fffa
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sat Feb 27 07:49:13 2010 +0000
    
        Teach the grouper some simple tricks about looking contradictory
        predicates.  For example if we have:
    
        Scope:
          CheckType i32
            ABC
          CheckType f32
            DEF
          CheckType i32
            GHI
    
        Then we know that we can transform this into:
        Scope:
          CheckType i32
            Scope
              ABC
              GHI
          CheckType f32
            DEF
    
        This reorders the check for the 'GHI' predicate above
        the check for the 'DEF' predidate.  However it is safe to do this
        in this situation because we know that a node cannot have both an
        i32 and f32 type.
    
        We're now doing more factoring that the old isel did.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97312 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 1f3fcd72c730a01993b6cf1563d03e56da42c237
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Sat Feb 27 07:36:59 2010 +0000
    
        Re-apply 97040 with fix. This survives a ppc self-host llvm-gcc bootstrap.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97310 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 792a0ed7161970678528fc14db1c8d9a6a719247
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sat Feb 27 06:51:44 2010 +0000
    
        use DEBUG instead of DebugFlag directly so that this
        respects -debug-only=something-else.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97307 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 509ed849a170b844b41841ae3aa518040e191de8
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sat Feb 27 06:22:57 2010 +0000
    
        implement a new optimization to sink pattern predicates (like isSSE1)
        as deeply into the pattern as we can get away with.  In pratice, this
        means "all the way to to the emitter code, but not across
        ComplexPatterns".  This substantially increases the amount of factoring
        we get.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97305 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit d600f8d37b6ec0f628498b978f078fdae0a56247
    Author: Bill Wendling <isanbard at gmail.com>
    Date:   Sat Feb 27 01:05:51 2010 +0000
    
        The TType is always absptr on Mach-O...at least for now.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97295 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit f9ceeeae6ddb552b4c4d6319f6f38e9b691edd3d
    Author: Jeffrey Yasskin <jyasskin at google.com>
    Date:   Sat Feb 27 00:25:18 2010 +0000
    
        Fix the ocaml bindings for the bitcode reader.
        llvm_get_module_provider() was returning a value of the wrong type.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97290 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 360dc7efa16a2c94ca408ff16921b2295117a05b
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sat Feb 27 00:07:42 2010 +0000
    
        fix PR6414, a nondeterminism issue in IPSCCP which was because
        of a subtle interation in a loop operating in densemap order.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97288 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 1cd1e9442328fdae0d0d84e2e21dbcaae0d454fa
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Fri Feb 26 23:42:13 2010 +0000
    
        Fix rdar://7694996 a miscompile of 183.equake from my patch yesterday,
        confusing the old MAT variable with the new GlobalType one.  This caused
        us to promote the @disp global pointer into:
    
        @disp.body = internal global double*** undef
    
        instead of:
    
        @disp.body = internal global [3 x double**] undef
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97285 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 8976a55c744f61ee237c314bd0b066631f016b54
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Fri Feb 26 23:35:25 2010 +0000
    
        remove dead code, by this point all uses of CI are gone.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97283 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit e3cd39b2d873bbc924dd63f5eaad787bda20b92c
    Author: Jeffrey Yasskin <jyasskin at google.com>
    Date:   Fri Feb 26 22:25:06 2010 +0000
    
        Test that docs are updating.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97279 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit d3965a7b28926fb40c38c0a2aec31808f86285aa
    Author: John McCall <rjmccall at apple.com>
    Date:   Fri Feb 26 22:20:41 2010 +0000
    
        Make APFloat's string-parsing routines a bit safer against very large exponents.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97278 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 00969bab536007305f3d9d9c7ff1b762ee86fc8c
    Author: Bill Wendling <isanbard at gmail.com>
    Date:   Fri Feb 26 22:17:52 2010 +0000
    
        A much cleaner (and less code!) way of inserting the correct amount of padding
        for alignment into the LSDA. If the TType base offset is emitted, then put the
        padding there. Otherwise, put it in the call site table length. There will be no
        conflict between the two sites when placing the padding in one place.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97277 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit a13a014855f0a2b93cb4e26fd33648d976691a5b
    Author: Johnny Chen <johnny.chen at apple.com>
    Date:   Fri Feb 26 22:04:29 2010 +0000
    
        Added the follwoing 32-bit Thumb instructions for disassembly only:
    
        o Parallel addition and subtraction, signed/unsigned
        o Miscellaneous operations: QADD, QDADD, QSUB, QDSUB
        o Unsigned sum of absolute differences [and accumulate]: USAD8, USADA8
        o Signed/Unsigned saturate: SSAT, SSAT16, USAT, USAT16
        o Signed multiply accumulate long (halfwords): SMLAL<x><y>
        o Signed multiply accumulate/subtract [long] (dual): SMLAD[x], SMLALD[X], SMLSD[X], SMLSLD[X]
        o Signed dual multiply add/subtract [long]: SMUAD[X], SMUSD[X]
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97276 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit fe01e44b8a2fc762d4514160955dede4ca282c8e
    Author: Jakob Stoklund Olesen <stoklund at 2pi.dk>
    Date:   Fri Feb 26 21:53:24 2010 +0000
    
        Merge PPC instructions FMRS and FMRD into a single FMR instruction.
    
        This is possible because F8RC is a subclass of F4RC. We keep FMRSD around so
        fextend has a pattern.
    
        Also allow folding of memory operands on FMRSD.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97275 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 0121a9111a1eb81a2aec04671e30a540ff3a7df4
    Author: Dan Gohman <gohman at apple.com>
    Date:   Fri Feb 26 21:45:37 2010 +0000
    
        Fix grammaro in a comment.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97273 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 7c95ce5459c63f98c09cd3c3bc44cd76dbd6d5fa
    Author: Dan Gohman <gohman at apple.com>
    Date:   Fri Feb 26 21:39:02 2010 +0000
    
        Use the right svn:keywords value.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97271 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 2d3f1b5dff1263397df8b3b30c48a5184be36f94
    Author: Dan Gohman <gohman at apple.com>
    Date:   Fri Feb 26 21:38:04 2010 +0000
    
        Add Revision keywords to these files, as it's common for them to be
        copied out of the source tree.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97270 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit fcc1fcf93d832105213aff60ee0cfe7fc30a1a6b
    Author: Bill Wendling <isanbard at gmail.com>
    Date:   Fri Feb 26 21:31:01 2010 +0000
    
        Comment typo.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97269 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ed686f4264ca2a868811193b3ce64b6fbefaf0bd
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Fri Feb 26 21:26:33 2010 +0000
    
        don't build edis if the x86 target isn't enabld.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97268 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 193c9fd0cb4dd45ae7003b71b9f6336aebec0773
    Author: Dan Gohman <gohman at apple.com>
    Date:   Fri Feb 26 21:24:46 2010 +0000
    
        Improve the vim code for highlighting trailing whitespace and lines
        longer than 80 columns. This replaces the heavy-handed "textwidth"
        mechanism, and makes the trailing-whitespace highlighting lazy so
        that it isn't constantly jumping on the user during typing.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97267 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit cc6e0499f95fc697c42e9c84463e0dd6f3446850
    Author: Tanya Lattner <tonic at nondot.org>
    Date:   Fri Feb 26 21:23:59 2010 +0000
    
        Test autoupdate.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97266 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 8b54f4ff53bb38c245970d79b4f0662cdd3212ed
    Author: Tanya Lattner <tonic at nondot.org>
    Date:   Fri Feb 26 21:19:09 2010 +0000
    
        Test auto update.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97265 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 9cf739796efea50e724cbda35c535613126414c2
    Author: Dan Gohman <gohman at apple.com>
    Date:   Fri Feb 26 21:16:17 2010 +0000
    
        Add the alignstack keyword.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97264 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 6f7d0be35e02a24b8ba3290254bdcec816592b61
    Author: Dan Gohman <gohman at apple.com>
    Date:   Fri Feb 26 21:15:49 2010 +0000
    
        Remove bogus Updated line.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97263 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit d21af378e4c987c368684e57fb90ec61660f95b8
    Author: Jakob Stoklund Olesen <stoklund at 2pi.dk>
    Date:   Fri Feb 26 21:09:24 2010 +0000
    
        Use the right floating point load/store instructions in PPCInstrInfo::foldMemoryOperandImpl().
    
        The PowerPC floating point registers can represent both f32 and f64 via the
        two register classes F4RC and F8RC. F8RC is considered a subclass of F4RC to
        allow cross-class coalescing. This coalescing only affects whether registers
        are spilled as f32 or f64.
    
        Spill slots must be accessed with load/store instructions corresponding to the
        class of the spilled register. PPCInstrInfo::foldMemoryOperandImpl was looking
        at the instruction opcode which is wrong.
    
        X86 has similar floating point register classes, but doesn't try to fold
        memory operands, so there is no problem there.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97262 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 55a6b3854c1c906f66abfac8d890f7cc41d39884
    Author: Jakob Stoklund Olesen <stoklund at 2pi.dk>
    Date:   Fri Feb 26 21:09:20 2010 +0000
    
        Remove dead code
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97261 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit aa08d6d52785dd06ecdc0e101e169ed963d9fee9
    Author: Jeffrey Yasskin <jyasskin at google.com>
    Date:   Fri Feb 26 20:43:33 2010 +0000
    
        Remove REQUIRES_EH from the suggested set of make variables, since users can
        build with exceptions even if LLVM is built without.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97260 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 837fd84eff2aef17d7e036241baccb383a91c44b
    Author: Benjamin Kramer <benny.kra at googlemail.com>
    Date:   Fri Feb 26 20:28:29 2010 +0000
    
        Replace a temporary std::string with SmallString.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97259 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ce4ae7a26789a5cc8332d575466b00bb43053568
    Author: Dan Gohman <gohman at apple.com>
    Date:   Fri Feb 26 20:18:32 2010 +0000
    
        Fix typos in comments.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97257 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 02defac4a7ea5025c71e0d2f371cf7fac1f3e269
    Author: Dan Gohman <gohman at apple.com>
    Date:   Fri Feb 26 20:16:58 2010 +0000
    
        Delete empty directories.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97256 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 38a74a3e8dc4bc2c343d01ee6645fadc611d899f
    Author: Dale Johannesen <dalej at apple.com>
    Date:   Fri Feb 26 20:01:55 2010 +0000
    
        Move dbg_value generation to target-independent FastISel,
        as X86 is currently the only FastISel target.  Per review.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97255 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit c5d788748fccb8dca8ccb406b45adf04baac48d6
    Author: Dale Johannesen <dalej at apple.com>
    Date:   Fri Feb 26 19:39:56 2010 +0000
    
        Further constify MDNode* references.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97252 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 7376e1b36c13b3fd0d9cf1df033e1ca6c08b23be
    Author: Dale Johannesen <dalej at apple.com>
    Date:   Fri Feb 26 19:38:59 2010 +0000
    
        Add type printing for Metadata pseudo.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97251 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 0d6a7ebc285174e734eae27611301c505c537764
    Author: Bob Wilson <bob.wilson at apple.com>
    Date:   Fri Feb 26 19:09:47 2010 +0000
    
        Move the EnableFullLoadPRE flag from a separate command-line option to an
        argument of createGVNPass and set it automatically for -O3.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97245 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 7d0e14b692a1c220f012d76be88adb4a4b50dda9
    Author: Sanjiv Gupta <sanjiv.gupta at microchip.com>
    Date:   Fri Feb 26 18:38:44 2010 +0000
    
        disable-mem2reg and disable-gvn options should not be used by the driver.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97236 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 6b3a0ccf3a43747662aad9a5c9c9ceee74bdbe54
    Author: Bob Wilson <bob.wilson at apple.com>
    Date:   Fri Feb 26 18:35:19 2010 +0000
    
        Remove unused "NoPRE" parameter in GVN and createGVNPass().
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97235 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit c3606dbe53179e7d9b94eb9015e92017715b5938
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Fri Feb 26 18:32:26 2010 +0000
    
        pass in more section kinds, enough to get the .align 0x90
        stuff to emit optimal nops in the right places.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97233 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 338ffcf804d1a754fa21eae3555f1cad030437ca
    Author: Sanjiv Gupta <sanjiv.gupta at microchip.com>
    Date:   Fri Feb 26 18:32:18 2010 +0000
    
        The cloner has nothing to do if any of the main or ISR entrypoints are not
        present in the module.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97232 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 31eac0edbafd56f31d2536daeb47f37c2267c1f4
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Fri Feb 26 18:23:13 2010 +0000
    
        fix PR6435 another bug from the MallocInst elimination work.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97231 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 6f6ab3ff36eb4ef9521db8aef90801057b8086bb
    Author: Jeffrey Yasskin <jyasskin at google.com>
    Date:   Fri Feb 26 18:07:00 2010 +0000
    
        Set svn:keywords property on docs/Packaging.html.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97230 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 97878a0d8d271041b3a72e45832d08cda8e0ee93
    Author: Jeffrey Yasskin <jyasskin at google.com>
    Date:   Fri Feb 26 18:03:43 2010 +0000
    
        Add to the packaging advice.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97229 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit dc6fcccc4b7966c23e7dcaacb9d27bf7e7810223
    Author: Sanjiv Gupta <sanjiv.gupta at microchip.com>
    Date:   Fri Feb 26 17:59:28 2010 +0000
    
        Reapply things reverted back in 97220, with the fixed test case.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97228 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 25fa95c3b6422e0792ade7a1afa60eb1c3c3098a
    Author: Dan Gohman <gohman at apple.com>
    Date:   Fri Feb 26 16:49:27 2010 +0000
    
        movl is a cheaper way to materialize 0 without clobbering EFLAGS than movabsq.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97227 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 095893143d070222b4d3627c7eb1464909f90312
    Author: Richard Osborne <richard at xmos.com>
    Date:   Fri Feb 26 16:44:51 2010 +0000
    
        Fix XCoreTargetLowering::isLegalAddressingMode() to handle VoidTy.
        Previously LoopStrengthReduce would sometimes be unable to find
        a legal formula, causing an assertion failure.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97226 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit d291e6e8eb4590e0094855f1f732e2dcfe66ac9e
    Author: Chandler Carruth <chandlerc at gmail.com>
    Date:   Fri Feb 26 08:43:09 2010 +0000
    
        Revert r97211 and r97213 to get the build green again.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97220 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit b90bb4346576b86c6b18c5c3cd6e0c666705650d
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Fri Feb 26 08:15:02 2010 +0000
    
        add some helpful comments to the emitter
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97219 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 9f9178d662149c01455db2c1a6a99458edea52ea
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Fri Feb 26 08:08:41 2010 +0000
    
        switch from my nice hashtable based merging solution to a
        gross little neighbor merging implementation.  This one has
        the benefit of not violating the ordering of patterns, so it
        generates code that passes tests again.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97218 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit eb86fc33d99ce108b83067264e57d81163c3ec74
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Fri Feb 26 08:06:02 2010 +0000
    
        fix same bug in CheckChainCompatibleMatcher::isEqualImpl
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97217 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit f5897353a7c64ec534b347ffaee2ea0f4ea71ba5
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Fri Feb 26 08:05:36 2010 +0000
    
        fix a nasty bug in CheckTypeMatcher::isEqualImpl
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97216 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 66595ab540f5f03ba40935506f230f1dd5f3c614
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Fri Feb 26 07:36:37 2010 +0000
    
        finish off the factoring optimization along the lines of the
        current design.  This generates a matcher that successfully
        runs, but it turns out that the factoring we're doing violates
        the ordering of patterns, so we end up matching (e.g.) movups
        where we want movaps.  This won't due, but I'll address this in
        a follow on patch.  It's nice to not be on by default yet! :)
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97215 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 9b3ba4224ce5187e937a80812ed02ee15d6b0fa2
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Fri Feb 26 07:35:27 2010 +0000
    
        add a new setNumChildren method for resizing scopes.  Tweak getHash() so
        that we never return a tombstone value, which (thankfully) triggers an
        assert in densemap.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97214 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ba7d63b090d32aeb6c875972e5b0a3e5a67c6af9
    Author: Sanjiv Gupta <sanjiv.gupta at microchip.com>
    Date:   Fri Feb 26 07:31:15 2010 +0000
    
        Currently in LLVM, names of libcalls are assigned during TargetLowering
        object construction. There is no provision to change them when the
        code for a function generated.
        So we have to change these names while printing assembly.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97213 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit e14d01fc992a5e2ce1d78a1a6864eea9f3e797a8
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Fri Feb 26 07:28:20 2010 +0000
    
        fix the matcher in the presence of multiple scopes: we need to save
        and restore the entire matcher stack by value.  This is because children
        we're testing could do moveparent or other things besides just
        scribbling on additions to the stack.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97212 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 5ca8903c0caadb86f80763653dfc838f34bae7e5
    Author: Sanjiv Gupta <sanjiv.gupta at microchip.com>
    Date:   Fri Feb 26 07:27:35 2010 +0000
    
        Before converting an operand to mem, check if it is legal to do so.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97211 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ad8ae688adffd304a7453e88e2c6139a755e81ad
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Fri Feb 26 02:40:57 2010 +0000
    
        this file lacks a run line!
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97208 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 08094647d10c1a4be6b1947a4f6745128bd47560
    Author: Dan Gohman <gohman at apple.com>
    Date:   Fri Feb 26 02:15:17 2010 +0000
    
        Fix a typo.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97206 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit a11c31a0f605235a8c39c3726e4180b525934a76
    Author: Dan Gohman <gohman at apple.com>
    Date:   Fri Feb 26 01:14:30 2010 +0000
    
        Delete a bunch of redundant predicates.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97201 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 2978dc8ec509246ee9564846e3a3beaf69e7c320
    Author: Bill Wendling <isanbard at gmail.com>
    Date:   Fri Feb 26 01:12:52 2010 +0000
    
        Fix comments.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97200 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit d3b25988a817adc6ea6a01a324f2f92053977c52
    Author: Jeffrey Yasskin <jyasskin at google.com>
    Date:   Fri Feb 26 00:54:42 2010 +0000
    
        Give packagers some advice about how to build LLVM so it's useful to
        the most users.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97198 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 8ef6de4e422e1fe70cdac4d733dfad35d0db7955
    Author: Bill Wendling <isanbard at gmail.com>
    Date:   Fri Feb 26 00:43:54 2010 +0000
    
        Add another (and hopefully the last) exception case, where once we recalculate
        the alignment requirement, if it no longer makes the TType base offset overflow
        into extra bytes, then we need to pad to those bytes ourselves.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97196 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 09191712250bd71363403a56ebab15bf78d59ddb
    Author: Bill Wendling <isanbard at gmail.com>
    Date:   Fri Feb 26 00:24:25 2010 +0000
    
        And should use the correct variable.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97193 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit c90d1edb08d7dad93a41e10ff593d556fa10f3bc
    Author: Bill Wendling <isanbard at gmail.com>
    Date:   Fri Feb 26 00:22:42 2010 +0000
    
        Got assertion check backwards.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97192 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 3246d273e5dd23259e066a7b214416ba79054aaf
    Author: Bill Wendling <isanbard at gmail.com>
    Date:   Thu Feb 25 23:52:44 2010 +0000
    
        Catch a corner case where adding the padding to the "TType base offset" field
        will eliminate the need for padding in the "Call site table length". E.g., if
        we have this:
    
            GCC_except_table1:
            Lexception1:
                .byte   0xff  ## @LPStart Encoding = omit
                .byte   0x9b  ## @TType Encoding = indirect pcrel sdata4
                .byte   0x7f  ## @TType base offset
                .byte   0x03  ## Call site Encoding = udata4
                .byte   0x89  ## Call site table length
    
        with padding of 1. We want to emit the padding like this:
    
            GCC_except_table1:
            Lexception1:
                .byte   0xff  ## @LPStart Encoding = omit
                .byte   0x9b  ## @TType Encoding = indirect pcrel sdata4
                .byte   0xff  ## @TType base offset
                .space  1,0   ## Padding
                .byte   0x03  ## Call site Encoding = udata4
                .byte   0x89  ## Call site table length
    
        and not with padding on the "Call site table length" entry.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97183 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 1e6ecdb72a446a8bc4dab0b4fc794f6e281543ac
    Author: Dan Gohman <gohman at apple.com>
    Date:   Thu Feb 25 23:51:27 2010 +0000
    
        Fix a few more typos.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97182 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 3fe65922d2e711f2a7b3571c88a212e403f1f6be
    Author: Dan Gohman <gohman at apple.com>
    Date:   Thu Feb 25 23:41:41 2010 +0000
    
        Fix a typo.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97181 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 90146b2b24f3143af41bc061ed80293f93ce149d
    Author: John Criswell <criswell at uiuc.edu>
    Date:   Thu Feb 25 22:57:19 2010 +0000
    
        Added SAFECode (safecode) to the list of projects to automatically configure.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97179 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 7e7b3ba394bf30ed84a7b458f28dee285ab14af6
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Thu Feb 25 22:33:52 2010 +0000
    
        rewrite OptimizeGlobalAddressOfMalloc to fix PR6422, some bugs
        introduced when mallocinst was eliminated.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97178 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 62a987ca0bf453a147a245629ebd5b927431d49f
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Thu Feb 25 22:09:09 2010 +0000
    
        tests: Propogate the HOME environment variable through to tests. I'm ambivalent
        about this, but it can be useful for users who use ccache, since the LLVMC tests
        are fond of calling gcc.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97171 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 69f0bf8bdddcad98a7208edbaee2f9348c70b35c
    Author: Bill Wendling <isanbard at gmail.com>
    Date:   Thu Feb 25 21:23:24 2010 +0000
    
        Fix HTML.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97170 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 1f56ec28fec2419c8517ea9e4bd6486747776af7
    Author: Bill Wendling <isanbard at gmail.com>
    Date:   Thu Feb 25 21:19:47 2010 +0000
    
        Make comment more meaningful.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97169 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit e163d0ab418f5bcf1ecdb20d6f5ce2761dfb3f4d
    Author: Dan Gohman <gohman at apple.com>
    Date:   Thu Feb 25 20:56:25 2010 +0000
    
        Add svn:ignore.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97167 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 17d4481a6d2a63898b4bac80b884a06f2777c572
    Author: Dan Gohman <gohman at apple.com>
    Date:   Thu Feb 25 20:30:49 2010 +0000
    
        Fix ExpandVectorBuildThroughStack for the case where the
        operands are themselves vectors. Based on a patch by
        Micah Villmow for PR6338.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97165 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 88048deab97eca1d1215984920409e6145da3831
    Author: Johnny Chen <johnny.chen at apple.com>
    Date:   Thu Feb 25 20:25:24 2010 +0000
    
        Added the following 32-bit Thumb instructions for disassembly only: SMC, RFE,
        and SRS.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97164 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit a07e055aede2b7016019d4ec24cb82785eee9041
    Author: Johnny Chen <johnny.chen at apple.com>
    Date:   Thu Feb 25 19:05:29 2010 +0000
    
        Added the 32-bit Thumb instructions (BXJ) for disassembly only.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97163 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit d913047f01a0ec03c2c0f5e48f619aa31e72202a
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Thu Feb 25 19:00:39 2010 +0000
    
        change the scope node to include a list of children to be checked
        instead of to have a chained series of scope nodes.  This makes
        the generated table smaller, improves the efficiency of the
        interpreter, and make the factoring optimization much more
        reasonable to implement.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97160 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit e52ee1611aec57416b5e43fe1efa56fc247f46b0
    Author: Johnny Chen <johnny.chen at apple.com>
    Date:   Thu Feb 25 18:46:43 2010 +0000
    
        Added the 32-bit Thumb instructions (MRS and MSR) for disassembly only.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97159 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit bd9ca732bd4bc3249e633d8155b02b68fd622275
    Author: Kevin Enderby <enderby at apple.com>
    Date:   Thu Feb 25 18:46:04 2010 +0000
    
        This is a patch to the assembler frontend to detect when aligning a text
        section with TextAlignFillValue and calls EmitCodeAlignment() instead of
        calling EmitValueToAlignment().  This allows x86 assembly code to be aligned
        with optimal nops.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97158 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 3b13ee53db4ca5270e3407dd2b7e60393c3a05d6
    Author: Dan Gohman <gohman at apple.com>
    Date:   Thu Feb 25 18:18:49 2010 +0000
    
        stkrc is gone.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97156 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit caa449962270218e9d7ead67167cd5ac3800623a
    Author: Dan Gohman <gohman at apple.com>
    Date:   Thu Feb 25 18:17:58 2010 +0000
    
        Add the union keyword.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97155 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 538317d5ae05ae872c16a8a982774ca11b69efdf
    Author: Dan Gohman <gohman at apple.com>
    Date:   Thu Feb 25 18:16:03 2010 +0000
    
        Merge the advanced getelementptr FAQ into the regular
        getelementptr FAQ.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97154 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 70e6e4acd826c5f6771dab04adff70109de18e8b
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Thu Feb 25 18:07:10 2010 +0000
    
        Fix TextAlignFillValue in a few places
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97151 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 85bb95785699c5322e9915933356e285fd1eed8d
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Thu Feb 25 18:07:07 2010 +0000
    
        Add simple script for finding most-recent-rev-before-N in a git-svn repo; useful
        when bisecting multiple repos in sync.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97150 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 3ec09ae83be027258b7202904cd3a19270ac63f5
    Author: Johnny Chen <johnny.chen at apple.com>
    Date:   Thu Feb 25 17:51:03 2010 +0000
    
        Added the following 16-bit Thumb instructions for disassembly only: YIELD, WFE,
        WFI, SEV, SETEND.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97149 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 9eafaf32ba39bd82eab083b70abc4acdf54d72e5
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Thu Feb 25 17:39:34 2010 +0000
    
        remove a dead PatLeaf, I previously changed all uses to use -1 instead.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97148 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit a259122f615ddf153605bddce888fe40b0aa20a0
    Author: Dan Gohman <gohman at apple.com>
    Date:   Thu Feb 25 16:51:31 2010 +0000
    
        Fix a typo.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97144 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 9090481cfdeb37674acd5754708e2050da51af64
    Author: Dan Gohman <gohman at apple.com>
    Date:   Thu Feb 25 16:50:07 2010 +0000
    
        Clarify the description of pointer types, and move the
        address space content to its own paragraph.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97143 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit b7c07581c416bd68ca799f7e22fb2e9d50c67bcd
    Author: Dan Gohman <gohman at apple.com>
    Date:   Thu Feb 25 16:45:19 2010 +0000
    
        Teach the constant folder about union types.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97142 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 2d961446491ef701698585a70e949c30e4b904a8
    Author: Dan Gohman <gohman at apple.com>
    Date:   Thu Feb 25 16:05:33 2010 +0000
    
        Remove code which assumes it knows how vectors are stored in memory.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97141 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 5c3a8df44d6de7ffc8338605f27a04e086436e77
    Author: Dan Gohman <gohman at apple.com>
    Date:   Thu Feb 25 15:55:28 2010 +0000
    
        Add more information to the getSizeOf comment.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97140 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit cf7d5be98d40e15a3880f2a7c5b910cdb0369f0c
    Author: Dan Gohman <gohman at apple.com>
    Date:   Thu Feb 25 15:53:42 2010 +0000
    
        Remove this paragraph. Vectors may not always have the same layout as
        arrays now.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97139 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 58152e31a6dc0030f74bd5a22260a2a833aa7d2c
    Author: Dan Gohman <gohman at apple.com>
    Date:   Thu Feb 25 15:20:39 2010 +0000
    
        Revert r97064. Duncan pointed out that bitcasts are defined in
        terms of store and load, which means bitcasting between scalar
        integer and vector has endian-specific results, which undermines
        this whole approach.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97137 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 75800fdc170d6a113fd695c1d475498081b55bb3
    Author: Nick Lewycky <nicholas at mxc.ca>
    Date:   Thu Feb 25 08:30:17 2010 +0000
    
        Make the side-numbering of instructions used by metadata (which is needed to
        keep track of instructions that return void) per-function. This fixes PR5278.
    
        This breaks backwards compatibility with the metadata format. That's okay
        because we haven't released the metadata bitcode yet.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97132 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit a891ffdd67f66052e371b7510a48124c3ee01b61
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Thu Feb 25 07:45:24 2010 +0000
    
        Implement the first half of redundancy factoring: efficiently
        splitting all the patterns under scope nodes into equality sets
        based on their first node.  The second step is to rewrite the
        graph info a form that exposes the sharing.  Before I do this,
        I want to redesign the Scope node.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97130 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 5b66d0ee1daab85438c6e3d4fd2e6b77c6edaa00
    Author: Dan Gohman <gohman at apple.com>
    Date:   Thu Feb 25 06:57:05 2010 +0000
    
        Make LoopSimplify change conditional branches in loop exiting blocks
        which branch on undef to branch on a boolean constant for the edge
        exiting the loop. This helps ScalarEvolution compute trip counts for
        loops.
    
        Teach ScalarEvolution to recognize single-value PHIs, when safe, and
        ForgetSymbolicName to forget such single-value PHI nodes as apprpriate
        in ForgetSymbolicName.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97126 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit e64a5697b891feeffca085560f9a8f4013221f74
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Thu Feb 25 06:53:39 2010 +0000
    
        factor the print method better.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97125 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 2d3b221aeee85d972d6cd622e7e6d8acbfae215c
    Author: Nick Lewycky <nicholas at mxc.ca>
    Date:   Thu Feb 25 06:53:04 2010 +0000
    
        Dump the presence of attached metadata even if we don't know what it is. This
        format is not parsable, even if the module is legal. To get parsable output,
        dump the module instead of the function or smaller, since metadata kind are
        attached to the module (not the context).
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97124 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit d540a808f3b39120dccd7ad3332d5c3405c4c254
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Thu Feb 25 06:49:58 2010 +0000
    
        add methods to do equality checks and get hashes of Matchers
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97123 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 449a50228c7843c1b674230ad183fce0032b49ce
    Author: Nick Lewycky <nicholas at mxc.ca>
    Date:   Thu Feb 25 06:39:10 2010 +0000
    
        Modernize comment.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97121 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit be67e72a30b96b70e5269ba24d915922d06b6f28
    Author: Nick Lewycky <nicholas at mxc.ca>
    Date:   Thu Feb 25 06:38:51 2010 +0000
    
        Correct whitespace.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97120 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 9aca70bbf976cebbe37167977c142f5abf0f2c1a
    Author: Jeffrey Yasskin <jyasskin at google.com>
    Date:   Thu Feb 25 06:34:33 2010 +0000
    
        Try r96559 for the third time.  This time the shared library is only built if
        --enable-shared is passed to configure.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97119 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit f82c55ce698883ac93d9c51e0034d19d51f9b874
    Author: Sanjiv Gupta <sanjiv.gupta at microchip.com>
    Date:   Thu Feb 25 03:54:49 2010 +0000
    
        Each field of auxiliary debug entry is only 1 byte long.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97108 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 0ce5dad9c76773bf40644f2e6f9e853760bf54a1
    Author: Johnny Chen <johnny.chen at apple.com>
    Date:   Thu Feb 25 03:28:51 2010 +0000
    
        Added tNOP for disassembly only.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97105 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit df7d6ebc126f0a70edf9b3ecbc4dc1a4b1461fb8
    Author: Dan Gohman <gohman at apple.com>
    Date:   Thu Feb 25 03:04:36 2010 +0000
    
        Truncate from i64 to i32 is "free" on x86-32, because it involves
        just discarding one of the registers.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97100 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 01c09177f73fd5bca8e9c6775a0610c1d07aa99a
    Author: Scott Michel <scottm at aero.org>
    Date:   Thu Feb 25 02:32:54 2010 +0000
    
        Revert this patch for the time being. Needs more testing.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97099 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 77df7b669954158dfc4a27af03f42ec9965e1aba
    Author: Johnny Chen <johnny.chen at apple.com>
    Date:   Thu Feb 25 02:21:11 2010 +0000
    
        Added tSVC and tTRAP for disassembly only.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97098 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 0fb0aa00f6f1d324362f565fceb6196662f86364
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Thu Feb 25 02:09:00 2010 +0000
    
        formatting.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97097 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 7c5413491d90d7e893e07d220006f47ee4a203c1
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Thu Feb 25 02:04:40 2010 +0000
    
        rename fooMatcherNode to fooMatcher.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97096 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 3ce8368df4a263d98b072e232e646c63493316ce
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Thu Feb 25 01:57:41 2010 +0000
    
        add some noop code to push it out of my tree.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97094 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 0dc46efa7afb24de5fd71d8e4d76be2887c8ae05
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Thu Feb 25 01:56:48 2010 +0000
    
        rename PushMatcherNode -> ScopeMatcherNode to more accurately
        reflect what it does.  Switch the sense of the Next and the Check
        arms to be more logical.  No functionality change.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97093 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 4de064d29fe4db363865a800b2a9881038757660
    Author: Scott Michel <scottm at aero.org>
    Date:   Thu Feb 25 01:53:17 2010 +0000
    
        Large stack frame patch for the CellSPU: handle stack frames that exceed 8176
        (511*16) bytes register displacement (D-form).
    
        NOTE: This is a potential headache, given the SPU's local core limitations,
        allowing the software developer to commit stack overrun suicide unknowingly.
        Also, large SPU stack frames will cause code size explosion. But, one presumes
        that the software developer knows what they're doing...
    
        Contributed by Kalle.Raiskila at nokia.com, edited slightly before commit.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97091 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit fceff16fd4c03bd5c471a4fcae8102e1f10911ea
    Author: Jeffrey Yasskin <jyasskin at google.com>
    Date:   Thu Feb 25 01:21:38 2010 +0000
    
        Filter the future all-of-llvm shared library out of the llvm-config
        results.  I'm checking this in before the shared library so that I can
        tell if it breaks anything on its own.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97089 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 2aab0b1da47e56b674837c1bc450aaf9c7b0da5f
    Author: Bill Wendling <isanbard at gmail.com>
    Date:   Thu Feb 25 00:24:52 2010 +0000
    
        MC'ize padding when padding the ULEB128 value.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97087 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 9a75f2ebd78e94d67f28e842b9a18958a099c2f3
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Thu Feb 25 00:03:03 2010 +0000
    
        add a fixme for an experiment that defeated me for the time being.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97081 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 5e23979c9c77e08b7c6979f747b75ca43f999b75
    Author: Bill Wendling <isanbard at gmail.com>
    Date:   Wed Feb 24 23:34:35 2010 +0000
    
        LLVM puts padding bytes in the __gcc_except_tab section after the
        GCC_except_table label but before the Lexception, which the FDE references.
        This causes problems as the FDE does not point to the start of an LSDA chunk.
    
        Use an unnormalized uleb128 for the call-site table length that includes the
        padding.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97078 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 163767793646774da228d4ec2331458c8c478a14
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 24 22:52:52 2010 +0000
    
        fix a bug I introduced by checking the wrong node's VT in OPC_CheckChildXType
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97074 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 1c105788b821f3a7e59f3c6e0c8c005eb33ff024
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 24 22:44:06 2010 +0000
    
        clean up various VT manipulations, patch by Micah Villmow! PR6337
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97072 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 6bd6f736c442270586dd2366fdf59b6386f07c6c
    Author: Jakob Stoklund Olesen <stoklund at 2pi.dk>
    Date:   Wed Feb 24 22:43:17 2010 +0000
    
        Create a stack frame on ARM when
    
        - Function uses all scratch registers AND
        - Function does not use any callee saved registers AND
        - Stack size is too big to address with immediate offsets.
    
        In this case a register must be scavenged to calculate the address of a stack
        object, and the scavenger needs a spare register or emergency spill slot.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97071 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 6c4a1b7306d2ab167ac5f38204d9a4a7abf10cd9
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 24 22:33:41 2010 +0000
    
        fix PR5954, patch by Roman Divacky.
    
        I don't have a great way to test this myself (it's linux/bsd only),
        but Roman says it works. :)
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97069 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 8662ba4d955fcfa2e0258cea12bab3ae107474aa
    Author: Bob Wilson <bob.wilson at apple.com>
    Date:   Wed Feb 24 22:15:53 2010 +0000
    
        Check for comparisons of +/- zero when optimizing less-than-or-equal and
        greater-than-or-equal SELECT_CCs to NEON vmin/vmax instructions.  This is
        only allowed when UnsafeFPMath is set or when at least one of the operands
        is known to be nonzero.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97065 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 95b3b3f5b7a3be22b1c5ff8b5481bcc6ac87a6f2
    Author: Dan Gohman <gohman at apple.com>
    Date:   Wed Feb 24 22:05:23 2010 +0000
    
        Make getTypeSizeInBits work correctly for array types; it should return
        the number of value bits, not the number of bits of allocation for in-memory
        storage.
    
        Make getTypeStoreSize and getTypeAllocSize work consistently for arrays and
        vectors.
    
        Fix several places in CodeGen which compute offsets into in-memory vectors
        to use TargetData information.
    
        This fixes PR1784.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97064 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 32ade6676326c1b0e56da7452413af50e555f188
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 24 21:34:04 2010 +0000
    
        convert cycle checker to smallptrset, add comments and make it
        more elegant.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97059 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit d0cb694ca5ca12d814dacddb8a95b51140bedfd3
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 24 21:25:08 2010 +0000
    
        revert david's patch which does not even build.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97057 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit f6103e0c0bc07407f1afc80c9aac37436eb87a48
    Author: David Greene <greened at obbligato.org>
    Date:   Wed Feb 24 20:59:49 2010 +0000
    
        Use a SmallPtrSet as suggested by Chris.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97056 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit e3c09bd4af8cd78f4d5b007b9f2ca7fe1a0151e2
    Author: Wesley Peck <peckw at wesleypeck.com>
    Date:   Wed Feb 24 20:16:27 2010 +0000
    
        Adding function "lookupGCCName" to MBlazeIntrinsicInfo
    
        Adding the function "lookupGCCName" to the MBlazeIntrinsicInfo
        class to support the Clang MicroBlaze target.
    
        Additionally, minor fixes which remove some unused PIC code
        (PIC is not supported yet in the MicroBlaze backend) and
        removed some unused variables.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97054 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 732223ec718d47a63fb4fee2a128163270dc848f
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 24 20:15:25 2010 +0000
    
        contract movechild+checktype into a new checkchild node, shrinking the
        x86 table by 1200 bytes.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97053 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 215a251a1d6fd3485e69ddf9299f8ccc95db184e
    Author: Johnny Chen <johnny.chen at apple.com>
    Date:   Wed Feb 24 20:06:07 2010 +0000
    
        Added Vector Swap (VSWPd and VSWPq) instructions for disassembly only.
    
        A8.6.405
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97052 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit e7c4596fa24da15c2143930ee2b45616b47b67d9
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 24 19:52:48 2010 +0000
    
        split the movechild/record/moveparent -> recordchild optzn into a
        movechild/record -> recordchild/movechild and
        movechild/moveparent -> noop xforms.  This slightly shrinks the tables
        (x86 to 117454) and enables adding future improvements.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97051 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 093f2ce980c8773a98894465dfb835f65754919c
    Author: Dan Gohman <gohman at apple.com>
    Date:   Wed Feb 24 19:31:47 2010 +0000
    
        ConstantFoldInstOperands can theoretically return null if it
        didn't fold anything.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97049 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 6971a55cb1f913f83c3f86dff2a3526afacfb06b
    Author: Dan Gohman <gohman at apple.com>
    Date:   Wed Feb 24 19:31:06 2010 +0000
    
        Simplify this code; these casts aren't necessary.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97048 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 1518ef49f8c0c50ae8b1336bd83c03dd07718887
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 24 19:17:12 2010 +0000
    
        emit a histogram of the opcodes in comments.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97047 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 9b573fba71e1e58fb5022f68690f78c39fa66048
    Author: Jakob Stoklund Olesen <stoklund at 2pi.dk>
    Date:   Wed Feb 24 18:57:08 2010 +0000
    
        Stay away from str <undef> in ARMLoadStoreOpt. This pass does not understand
        <undef> operands, and can cause scavenger failures when it translates
        <kill,undef> to <kill>.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97046 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 37e8c75dd31f12b5d2911cf20198e2243ed5b40e
    Author: Johnny Chen <johnny.chen at apple.com>
    Date:   Wed Feb 24 18:00:40 2010 +0000
    
        Fixed typo of opcodestr, should be "vst1", not "vld1".
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97044 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 9be117f489051eae2a5571f7d0c0163412afeb1b
    Author: Dan Gohman <gohman at apple.com>
    Date:   Wed Feb 24 17:31:30 2010 +0000
    
        Convert a few more backedge-taken count functions to use BackedgeTakenInfo.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97042 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 40daa3bef360da5966e748a21bf1c36f667c16f9
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Wed Feb 24 17:05:47 2010 +0000
    
        Speculatively revert r97011, "Re-apply 96540 and 96556 with fixes.", again in
        the hopes of fixing PPC bootstrap.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97040 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 004492d7dd5ede35df13cedbee66a99cc2bd21f1
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Wed Feb 24 08:48:04 2010 +0000
    
        Reapply r97010, the speculative revert failed.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97036 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit a9c14b6c37b05876f45b4b80e2d2d72191904e98
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 24 07:41:11 2010 +0000
    
        lets not break the old isel.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97034 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 5e609477f98a1cc418ad32fa697a8a0736a6dcdb
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 24 07:35:09 2010 +0000
    
        Since the new instruction selector now works, I don't need to keep
        the old one around for comparative purposes: have the
        ENABLE_NEW_ISEL #define (which is not enabled on mainline) stop
        emitting the old isel at all, yay for build time win.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97033 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit e434eff35addbaa33db1edebc34b1901f035fe85
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 24 07:31:45 2010 +0000
    
        implement a simple proof-of-concept optimization for
        the new isel: fold movechild+record+moveparent into a
        single recordchild N node.  This shrinks the X86 table
        from 125443 to 117502 bytes.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97031 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit c6eb29ddf46c6420cf1b6ea78c20abf77996dcb1
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 24 07:06:50 2010 +0000
    
        The new isel passes all tests, time to start making it go fast.
        Also add an easy macro at the top of DAGISelEmitter.cpp to enable
        it.  Lets see if I can avoid accidentally turning it on :)
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97029 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit f2702d8f9ead14b173b6058b6e193141b4430f84
    Author: Dan Gohman <gohman at apple.com>
    Date:   Wed Feb 24 07:06:20 2010 +0000
    
        Add svn:ignore properties.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97028 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 5a5a832146529ad09783d54cb06f854d94898b79
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Wed Feb 24 06:55:22 2010 +0000
    
        Speculatively revert r97010, "Add an argument to PHITranslateValue to specify
        the DominatorTree. ...", in hopes of restoring poor old PPC bootstrap.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97027 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 6d8b2db59991c2b56e14f72fdc55dc32cb3491e7
    Author: Dan Gohman <gohman at apple.com>
    Date:   Wed Feb 24 06:52:40 2010 +0000
    
        When forming SSE min and max nodes for UGE and ULE comparisons, it's
        necessary to swap the operands to handle NaN and negative zero properly.
    
        Also, reintroduce logic for checking for NaN conditions when forming
        SSE min and max instructions, fixed to take into consideration NaNs and
        negative zeros. This allows forming min and max instructions in more
        cases.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97025 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit b1120863f3abbda2c8ce92590e0533fc1cd57e40
    Author: Dan Gohman <gohman at apple.com>
    Date:   Wed Feb 24 06:46:09 2010 +0000
    
        Fix indentation.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97024 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 4c27d06de74b1dcdbdb64e8976a6d3f23ee7f81e
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 24 06:11:37 2010 +0000
    
        Change the scheduler from adding nodes in allnodes order
        to adding them in a determinstic order (bottom up from
        the root) based on the structure of the graph itself.
    
        This updates tests for some random changes, interesting
        bits: CodeGen/Blackfin/promote-logic.ll no longer crashes.
        I have no idea why, but that's good right?
    
        CodeGen/X86/2009-07-16-LoadFoldingBug.ll also fails, but
        now compiles to have one fewer constant pool entry, making
        the expected load that was being folded disappear.  Since it
        is an unreduced mass of gnast, I just removed it.
    
        This fixes PR6370
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97023 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit aa1744295338c27e0077e68096c9168335a9ec8b
    Author: Chandler Carruth <chandlerc at gmail.com>
    Date:   Wed Feb 24 06:09:03 2010 +0000
    
        Remove an unused variable. Was this intentional?
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97022 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit c51418455570858863a38e15db639611e8031e0e
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 24 05:33:42 2010 +0000
    
        The new isel was not properly handling patterns that covered
        internal nodes with flag results.  Record these with a new
        OPC_MarkFlagResults opcode and use this to update the interior
        nodes' flag results properly.  This fixes CodeGen/X86/i256-add.ll
        with the new isel.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97021 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 792ea8226fe1a1eaf37e292b3934406b66cb0fd2
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 24 04:24:44 2010 +0000
    
        add node #'s to debug dumps.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97019 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 2d80284c131ebc9e3e3aca521ebc0fa8c7e95486
    Author: Johnny Chen <johnny.chen at apple.com>
    Date:   Wed Feb 24 02:57:20 2010 +0000
    
        Added for disassembly VST1 (multiple single elements) which stores elements to
        memory from three or four registers and VST2 (multiple two-element structures)
        which stores to memory from two double-spaced registers.
    
        A8.6.391 & A8.6.393
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97018 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit e3c4c121c47630185e008362c2e92b86db6f74f2
    Author: Sean Callanan <scallanan at apple.com>
    Date:   Wed Feb 24 02:56:25 2010 +0000
    
        Changed the table generator so that the X86
        disassembler never recognizes InitReg instructions.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97017 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit e049cd2d55a9c7bfa49cfe89048441e8b44b43a9
    Author: Jim Grosbach <grosbach at apple.com>
    Date:   Wed Feb 24 02:15:43 2010 +0000
    
        handle very large call frames when require SPAdj != 0 for Thumb1
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97013 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit cc5ab7839a5600708cad8e640efe99b3f57ffee4
    Author: Jim Grosbach <grosbach at apple.com>
    Date:   Wed Feb 24 01:43:03 2010 +0000
    
        LowerCall() should always do getCopyFromReg() to reference the stack pointer.
        Machine instruction selection is much happier when operands are in virtual
        registers.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97012 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 7273e875e4bac0374877c91991cd59338df3f788
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Wed Feb 24 01:42:31 2010 +0000
    
        Re-apply 96540 and 96556 with fixes.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97011 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 32848c7e9115fbbc1799817fb3f5ca6c65242860
    Author: Bob Wilson <bob.wilson at apple.com>
    Date:   Wed Feb 24 01:39:00 2010 +0000
    
        Add an argument to PHITranslateValue to specify the DominatorTree.  If this
        argument is non-null, pass it along to PHITranslateSubExpr so that it can
        prefer using existing values that dominate the PredBB, instead of just
        blindly picking the first equivalent value that it finds on a uselist.
        Also when the DominatorTree is specified, have PHITranslateValue filter
        out any result that does not dominate the PredBB.  This is basically just
        refactoring the check that used to be in GetAvailablePHITranslatedSubExpr
        and also in GVN.
    
        Despite my initial expectations, this change does not affect the results
        of GVN for any testcases that I could find, but it should help compile time.
        Before this change, if PHITranslateSubExpr picked a value that does not
        dominate, PHITranslateWithInsertion would then insert a new value, which GVN
        would later determine to be redundant and would replace.  By picking a good
        value to begin with, we save GVN the extra work of inserting and then
        replacing a new value.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97010 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 93d3b5ed10b910d5c04b1ba299db4026c9d3a83a
    Author: Jakob Stoklund Olesen <stoklund at 2pi.dk>
    Date:   Wed Feb 24 00:39:35 2010 +0000
    
        DIV8r must define %AX since X86DAGToDAGISel::Select() sometimes uses it
        instead of %AL/%AH.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97006 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit fd9e22303ebc96f9950527c4f4f7712c4662dc07
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 23 23:47:34 2010 +0000
    
        fix X86/uint_to_fp-2.ll, only fold loads when they have a
        single use.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97003 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 0a9de9dc0b29305a302194a707323f41830f8d82
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 23 23:01:35 2010 +0000
    
        make selectnodeto set the nodeid to -1.  This makes it more akin to
        creating a new node then replacing uses.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97000 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 9032d968e8fead82607c9179c5a4b270c1d59af7
    Author: Jakob Stoklund Olesen <stoklund at 2pi.dk>
    Date:   Tue Feb 23 22:44:02 2010 +0000
    
        Remember to handle sub-registers when moving imp-defs to a rematted instruction.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96995 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 44894027646a0d9bccec120ce3c13ba93a9bb26c
    Author: Jakob Stoklund Olesen <stoklund at 2pi.dk>
    Date:   Tue Feb 23 22:43:58 2010 +0000
    
        Keep track of phi join registers explicitly in LiveVariables.
    
        Previously, LiveIntervalAnalysis would infer phi joins by looking for multiply
        defined registers. That doesn't work if the phi join is implicitly defined in
        all but one of the predecessors.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96994 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 087baeb205f8475bc819b53118882c7021ae9b61
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Tue Feb 23 21:51:54 2010 +0000
    
        Fix rev 96389 by restricting the xform to mask that's either signbit or max signed value.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96990 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 793779392c0ce7ec21cfa7b4880aeeced3c4033f
    Author: Kevin Enderby <enderby at apple.com>
    Date:   Tue Feb 23 21:41:24 2010 +0000
    
        This is the second patch to allow x86 code to be aligned with optimal nops.
        With the compiler changed to use EmitCodeAlignment() it does change the
        functionality.  But X86 assembly code assembled with llvm-mc does not change
        its output.  For that we will eventually change the assembler frontend to
        detect a '.align x, 0x90' when used in a section that 'hasInstructions' and use
        EmitCodeAlignment, but will wait until we have better target hooks.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96988 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 0180cd2113754c7d3e4f3de1f125f1df052f9a3f
    Author: Richard Osborne <richard at xmos.com>
    Date:   Tue Feb 23 21:08:11 2010 +0000
    
        Don't mark call instruction as a barrier.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96983 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit b4cfc1b15fef78486d2520a8d45d9e45d5c7c28e
    Author: Jeffrey Yasskin <jyasskin at google.com>
    Date:   Tue Feb 23 20:53:37 2010 +0000
    
        Roll back r96959 again.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96981 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 7f37cc74b5c23318b1e98b5740ea5ef4ea6f691e
    Author: Johnny Chen <johnny.chen at apple.com>
    Date:   Tue Feb 23 20:51:23 2010 +0000
    
        Added for disassembly VLD1 (multiple single elements) which loads memory into
        three or four registers and VLD2 (multiple two-element structures) which loads
        memory into two double-spaced registers.
    
        A8.6.307 & A8.6.310
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96980 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 54dc357c8714bdea1a1b038e940255e791fbfe61
    Author: Nicolas Geoffray <nicolas.geoffray at lip6.fr>
    Date:   Tue Feb 23 19:42:44 2010 +0000
    
        Use the module's context instead of the global context.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96977 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 1b11c0bbb8d0a5506f5ba1e6444499f16efd0222
    Author: Devang Patel <dpatel at apple.com>
    Date:   Tue Feb 23 19:37:40 2010 +0000
    
        new test case for r96974.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96975 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 31e2f4feadd988291349db6d449c067863d0306d
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 23 19:33:11 2010 +0000
    
        no need to override IsLegalToFold, the base implementation
        disables load folding at -O0.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96973 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 78da63aabbc4beae079ca8c5e8036a5357473b76
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 23 19:32:27 2010 +0000
    
        fix a bug in findNonImmUse (used by IsLegalToFold) where nodes with
        no id's would cause early exit allowing IsLegalToFold to return true
        instead of false, producing a cyclic dag.
    
        This was striking the new isel because it isn't using SelectNodeTo yet,
        which theoretically is just an optimization.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96972 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ad9c441bd53cb6ba3813009d7bb9798082c831d6
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 23 19:31:18 2010 +0000
    
        Print node ID's in dumps and views if set.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96971 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 6b671c1c4b1d4924a7d2b52ab24bbdc8979d0202
    Author: Wesley Peck <peckw at wesleypeck.com>
    Date:   Tue Feb 23 19:15:24 2010 +0000
    
        Adding the MicroBlaze backend.
    
        The MicroBlaze is a highly configurable 32-bit soft-microprocessor for
        use on Xilinx FPGAs. For more information see:
        http://www.xilinx.com/tools/microblaze.htm
        http://en.wikipedia.org/wiki/MicroBlaze
    
        The current LLVM MicroBlaze backend generates assembly which can be
        compiled using the an appropriate binutils assembler.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96969 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 5386c11ac88551b1b62176415b05a5b8321f0d82
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 23 18:46:22 2010 +0000
    
        use OutStreamer.EmitCodeAlignment for alignment in the text
        segment.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96967 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 76392cd1fd1f451d9195435a36031638f55b3720
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 23 18:44:31 2010 +0000
    
        genericize MCAsmStreamer::EmitCodeAlignment to support other targets
        so that it doesn't break them when the code generator starts using it.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96966 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 47bdfce72cdef2d79c0f221c484f47cf6a569980
    Author: Jeffrey Yasskin <jyasskin at google.com>
    Date:   Tue Feb 23 18:40:48 2010 +0000
    
        Oops.  Pass -lgcc _only_ on ARM, not on everything except ARM.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96965 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit c1709f4e5b0d69f90713688a760b72d6727c7ca9
    Author: Richard Osborne <richard at xmos.com>
    Date:   Tue Feb 23 18:29:49 2010 +0000
    
        ECALLF, ECALLT shouldn't be marked as barriers.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96964 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 3aadf754e2af29d3435a500ebc75abdd50b44987
    Author: Kevin Enderby <enderby at apple.com>
    Date:   Tue Feb 23 18:26:34 2010 +0000
    
        This is the first patch to put the needed bits in place to eventually allow code
        to be aligned with optimal nops.  This patch does not change any functionality
        and when the compiler is changed to use EmitCodeAlignment() it should also not
        change the resulting output.  Once the compiler change is made and everything
        looks good the next patch with the table of optimal X86 nops will be added to
        WriteNopData() changing the output.  There are many FIXMEs in this patch which
        will be removed when we have better target hooks (coming soon I hear).
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96963 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 60958e8ff34ede7f9a4f12bbac5800f0270cfeb0
    Author: Richard Osborne <richard at xmos.com>
    Date:   Tue Feb 23 18:13:38 2010 +0000
    
        Mark unconditional branches as barriers. Found using -verify-machineinstrs
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96960 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 3c3228ed1ed85a8fa165804453f76013a235017e
    Author: Jeffrey Yasskin <jyasskin at google.com>
    Date:   Tue Feb 23 18:10:07 2010 +0000
    
        Roll r96559 forward again, adding libLLVM-2.7svn.so to LLVM.  This links 3 of
        the examples shared to make sure the shared library keeps working.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96959 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit e7e0655956273b963c22e849b19428161d29e5db
    Author: David Greene <greened at obbligato.org>
    Date:   Tue Feb 23 17:37:50 2010 +0000
    
        Speed up cycle checking significantly by caching results.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96956 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 785fb2889749908232c65e7a5f7643bd03cb4516
    Author: Dan Gohman <gohman at apple.com>
    Date:   Tue Feb 23 17:17:57 2010 +0000
    
        Don't do (X != Y) ? X : Y  -> X for floating-point values; it doesn't
        handle NaN properly.
    
        Do (X une Y) ? X : Y  -> X if one of X and Y is not zero.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96955 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit da5a01b1e4a41f1a32061f918315d82743e00c0d
    Author: Jim Grosbach <grosbach at apple.com>
    Date:   Tue Feb 23 17:16:27 2010 +0000
    
        Spelling. s/suppor /support /
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96954 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 68861c2bab3bc88114f605b12c3f622e13ac8caf
    Author: Dan Gohman <gohman at apple.com>
    Date:   Tue Feb 23 16:35:41 2010 +0000
    
        Remove the code which constant-folded ptrtoint(inttoptr(x)+c) to
        getelementptr. Despite only doing so in the case where x is a known
        array object and c can be converted to an index within range, this
        could still be invalid if c is actually the address of an object
        allocated outside of LLVM. Also, SCEVExpander, the original motivation
        for this code, has since been improved to avoid inttoptr+ptroint in
        more cases.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96950 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit cf46f94f8d494e2acd2dd922595b3fc4ed13ebc7
    Author: Garrison Venn <gvenn.cfe.dev at gmail.com>
    Date:   Tue Feb 23 16:27:59 2010 +0000
    
        Modified examples Makefile to only build the ExceptionDemo example for
        x86 and x86_64 on UNIX systems. Only OS X 10.6.2 (x86_64) and 32bit CentOS 5.2
        with gcc 4.1.2 were tested. ARM UNIX build triggered failure motivating this
        modification, as it seems that the ARM ABI does not support _Unwind_GetIP(...),
        _Unwind_SetGR(...), and _Unwind_SetIP(...). From doing a quick browse of:
        http://infocenter.arm.com/help/topic/com.arm.doc.ihi0038a/IHI0038A_ehabi.pdf,
        it seems as if all other exception related apis are supported. Looks like
        the port can be done to ARM. Thanks to Xerxes Rånby <xerxes at zafena.se> for
        pointing out this error.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96949 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 799c443aefc44b7f8a7b37edc2dfd1506d7db102
    Author: Wesley Peck <peckw at wesleypeck.com>
    Date:   Tue Feb 23 15:11:17 2010 +0000
    
        Testing subversion commit access
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96948 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit bb8c29c897e2cd875db6138873a428edfd24ffc8
    Author: Mikhail Glushenkov <foldr at codedgers.com>
    Date:   Tue Feb 23 14:29:42 2010 +0000
    
        Fix -mtune forwarding.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96944 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit e52062e22ccf8a0217138f340edf325ae777b0ae
    Author: Richard Osborne <richard at xmos.com>
    Date:   Tue Feb 23 14:17:20 2010 +0000
    
        Remove unused lowering function LowerJumpTable
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96943 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 5ea4d623aec666e9c370e319d3cfc0617c68108d
    Author: Richard Osborne <richard at xmos.com>
    Date:   Tue Feb 23 13:25:07 2010 +0000
    
        Lower BR_JT on the XCore to a jump into a series of jump instructions.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96942 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 59bd608420d50dd3f5f63badcc905b04de995981
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Tue Feb 23 11:34:12 2010 +0000
    
        tests: Don't make a missing llvm-gcc dir a fatal error.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96938 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 706aebd40ae61e7859b0d88e37531b52115ace9a
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Tue Feb 23 10:28:06 2010 +0000
    
        Switch .bc/.ll Makefile rules to use LLVM{CC,CXX} instead of LLVMG{CC,XX}
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96936 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 79f73683baece556d2b95f80e15a0f52ee6cad65
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Tue Feb 23 10:00:53 2010 +0000
    
        Add LLVM{CC,CXX} make variables, which specify the configured path the LLVM
        capable compilers (which could be llvm-gcc or clang).
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96935 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit e3a42e30c5cbb5c69a8a61c4ea995a644d730da1
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Tue Feb 23 10:00:49 2010 +0000
    
        Initial configure support for using Clang as the LLVM capable compiler.
    
        Comes in two parts:
         1. Use --with-clang=path/to/clang/compiler to select an installed clang, or
            --with-built-clang to have the makefiles use the clang which will be built
            as the LLVM capable compiler. If neither is given, --with-built-clang will
            be used if the Clang sources are checked out into the standard location
            (tools/clang).
    
         2. Use --with-llvmcc={llvm-gcc,clang,none} to specify which LLVM capable
            compiler to use. If not given, then llvm-gcc will be used if available,
            otherwise Clang.
    
        Makefile support still to come.
    
        Eric, Doug, Chris, seem reasonable?
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96934 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 316860cd7a773e14524bbc03ae55d1e455e6d6d7
    Author: Mikhail Glushenkov <foldr at codedgers.com>
    Date:   Tue Feb 23 09:59:30 2010 +0000
    
        Update mcc16 and the ancient Clang plugin for the 'cmd_line' -> 'command' change.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96933 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ddd2e2efb12eb7ceaa07fbf4a2b1b68597c444e9
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Tue Feb 23 09:28:50 2010 +0000
    
        Eliminate CFERuntimeLibDir make variable, this shouldn't be needed.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96932 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 6dc97ddee4b14b8f7ed2119f845e7a924afe1033
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Tue Feb 23 09:28:48 2010 +0000
    
        Fix a thinko in the lit.cfg.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96931 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit a1e7b55f72f575f02740968a53c572084a1216b4
    Author: Mikhail Glushenkov <foldr at codedgers.com>
    Date:   Tue Feb 23 09:05:21 2010 +0000
    
        Input files with empty suffixes must be passed to linker.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96927 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 5686d1b590eb41268164f9df9a50dcf7c5143a61
    Author: Mikhail Glushenkov <foldr at codedgers.com>
    Date:   Tue Feb 23 09:05:15 2010 +0000
    
        Support -Xlinker et al.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96926 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 92bca8707d8318a1e809a3fcc3e1129440129376
    Author: Mikhail Glushenkov <foldr at codedgers.com>
    Date:   Tue Feb 23 09:05:10 2010 +0000
    
        Temporary disable response files.
    
        They are giving us problems on Mac.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96925 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ae666386a261a9f30b9478907d86420ba4c7c928
    Author: Mikhail Glushenkov <foldr at codedgers.com>
    Date:   Tue Feb 23 09:05:06 2010 +0000
    
        Typo.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96924 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 41a3555705547d6c79ae6a20e4ce08fb96d939fa
    Author: Mikhail Glushenkov <foldr at codedgers.com>
    Date:   Tue Feb 23 09:05:01 2010 +0000
    
        Trailing whitespace.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96923 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 5e6ccb4ea1896699389d126993af1b3182fc8f22
    Author: Mikhail Glushenkov <foldr at codedgers.com>
    Date:   Tue Feb 23 09:04:57 2010 +0000
    
        Implement order-preserving option forwarding.
    
        Needed to correctly handle things like 'llvmc -framework Foo foo.o -framework
        Bar bar.o' - before this commit all '-framework' options would've been grouped
        together in the beginning.
    
        Due to our dependence on CommandLine this turned out to be a giant hack; we will
        migrate away from CommandLine eventually.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96922 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 5018426d8b6e09c6493bed4fda999c37089bb59d
    Author: Mikhail Glushenkov <foldr at codedgers.com>
    Date:   Tue Feb 23 09:04:51 2010 +0000
    
        Update the test suite.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96921 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 9dbac04a6e48423cc9dc4b537b802b192cbc00e9
    Author: Mikhail Glushenkov <foldr at codedgers.com>
    Date:   Tue Feb 23 09:04:44 2010 +0000
    
        Correct option forwarding: initial implementation.
    
        Does not work, but the infrastructure changes are in place.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96920 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 2aa9c93d46a5f034e941f1bb844fbb9c3013b674
    Author: Mikhail Glushenkov <foldr at codedgers.com>
    Date:   Tue Feb 23 09:04:33 2010 +0000
    
        Precompiled headers: initial support.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96919 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit f86bacffdf5b8c90f6615fdc756eb982deeebe7e
    Author: Mikhail Glushenkov <foldr at codedgers.com>
    Date:   Tue Feb 23 09:04:28 2010 +0000
    
        New experimental/undocumented feature: 'works_on_empty'.
    
        For now, just enough support to make -filelist work.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96918 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 09cf0ced1c1913e5910e1b105bbb6a66a2f6fd8c
    Author: Mikhail Glushenkov <foldr at codedgers.com>
    Date:   Tue Feb 23 09:04:18 2010 +0000
    
        Support '-install_name'.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96917 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 2f69ce7242d155ad08ab584acdf746689cfa359c
    Author: Mikhail Glushenkov <foldr at codedgers.com>
    Date:   Tue Feb 23 09:04:13 2010 +0000
    
        Add a way to enable '-opt=foo' forwarding.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96916 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 8d4f4e142948e0e55707eca80e84774d825c0654
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Tue Feb 23 07:56:41 2010 +0000
    
        Inline and eliminate LLVMG{CC,XX}WITHPATH.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96913 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit a7ddfaa3fc91428f11e2e6e51032e651731c801c
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Tue Feb 23 07:56:38 2010 +0000
    
        Remove ancient Xcode project, replaced by CMake project.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96912 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit f8a57eda57c5816a6a7f98dd81fabf0e7c4a2340
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Tue Feb 23 07:56:36 2010 +0000
    
        Remove dead LUPGRADE make variable.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96911 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 5781b528c7cc6585c722d466551a6a6b52469844
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Tue Feb 23 07:56:34 2010 +0000
    
        Kill off unused LLVMGCCLIBEXEC make variable.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96910 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 1909b1c644cf4886f4c879e6d9e211b30cab063d
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Tue Feb 23 07:56:31 2010 +0000
    
        Kill off LLVMGCCARCH and LLVMGCC_VERSION make variables.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96909 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 1f18e4e91f7b0e8a52fcf79da85302c2a5d7f112
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Tue Feb 23 07:56:28 2010 +0000
    
        Eliminate llvmgcc_version testing variable.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96908 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 4e22a9246338579c9f28347574e5749faae70891
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Tue Feb 23 07:56:22 2010 +0000
    
        Kill off LLVMGCC_MAJVERS make variable.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96907 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit feea95357e133db966876fe164104d2cd5e3d563
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Tue Feb 23 07:56:18 2010 +0000
    
        Kill unused llvmgccmajvers testing variable.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96906 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit aa0ba4af64684a80953b059bd6ab9e6d909cabda
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 23 07:50:58 2010 +0000
    
        add some #if 0'd out code for checking that named values in
        input/output patterns have the same type.  It turns out that
        this triggers all the time because we don't infer types
        between these boundaries.  Until we do, don't turn this on.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96905 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 0207875c1f7f2cb645fd2db40ba94af3e6966738
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 23 07:22:28 2010 +0000
    
        Reject patterns that use a name multiple times in the src or result
        of a pattern and where the uses have different types.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96904 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 6f675fd4860f21cb112a361131a62dd49ec3f91f
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 23 07:21:15 2010 +0000
    
        disable two patterns that are using non-sensical result pattern types.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96903 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit d5258df2152326cd89a84b5f8e4d6d64c0bc0bf5
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 23 07:16:12 2010 +0000
    
        remove a confused pattern that is trying to match an address
        then use it as an MMX register (!?).
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96901 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit b6301df9646f1169d1bab1beb26abd7902030fed
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 23 06:55:24 2010 +0000
    
        reject patterns that have dead named arguments in the input pattern
        this is tidier and can find bugs.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96900 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit b727fd1bd5f835e8c618347c4aaf2b1c8fe1718a
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 23 06:54:29 2010 +0000
    
        remove a bunch of dead named arguments in input patterns,
        though some look dubious afaict, these are all ok.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96899 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 51f3fd420b6d225f925f0b6f9e60278a6825841f
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 23 06:35:45 2010 +0000
    
        reject patterns that mention a name in the destination pattern
        but not in the input.  Previously, this would trigger an abort
        late in the isel logic.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96898 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 7f9408792ecd755b6c6493a0f99d19509ba34060
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 23 06:16:51 2010 +0000
    
        merge some code.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96896 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit dab91266db960ba6e05573c3bf56586d2f290950
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 23 06:09:57 2010 +0000
    
        fix a type mismatch in this pattern, where we were using an i64 imm in a
        place where an i32 imm was required, the old isel just got lucky.
    
        This fixes CodeGen/X86/x86-64-and-mask.ll
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96894 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 08feacc63e2d73921cbe3be6bbac6cfd624276fe
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 23 05:59:10 2010 +0000
    
        more tidying up
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96891 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 0128d21f3418a5d3e0b09bb9125a103e25951ec6
    Author: Bob Wilson <bob.wilson at apple.com>
    Date:   Tue Feb 23 05:55:00 2010 +0000
    
        Update memdep when load PRE inserts a new load, and add some debug output.
        I don't have a small testcase for this.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96890 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 64836d55daa56e649354b6ef04ea20d04cc7e334
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 23 05:51:07 2010 +0000
    
        reduce indentation by eliminating 'else after return'
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96889 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit f5a5d91944507c2da994bc9e6e0419ca2b9ae768
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 23 05:30:43 2010 +0000
    
        reapply my cellspu changes with a fix to not break the old isel.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96885 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit f29f8f086c3afa203fea0889b85744e5dabdace5
    Author: Dan Gohman <gohman at apple.com>
    Date:   Tue Feb 23 02:44:03 2010 +0000
    
        Update LangRef to match the code; pointers default to being 64-bit.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96873 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 412db15093fb1998042f609993174f1313407861
    Author: Dan Gohman <gohman at apple.com>
    Date:   Tue Feb 23 02:33:29 2010 +0000
    
        Revert 96854, 96852, and 96849, unbreaking test/CodeGen/CellSPU/i64ops.ll.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96871 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit bbf86a2f1eb0320a6a1e6c409df096f91acebd4a
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 23 02:07:48 2010 +0000
    
        X86InstrInfoSSE.td declares PINSRW as having type v8i16,
        don't alis it in the MMX .td file with a different width,
        split into two X86ISD opcodes.  This fixes an x86 testcase.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96859 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 5097f5bc6c1e5ae0aa1b1dfde6bfd1f8bede97b0
    Author: Johnny Chen <johnny.chen at apple.com>
    Date:   Tue Feb 23 01:42:58 2010 +0000
    
        Added versions of VCGE, VCGT, VCLE, and VCLT NEON instructions which compare to
        (immediate #0) for disassembly only.
    
        A8.6.283, A8.6.285, A8.6.287, A8.6.290
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96856 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 598bb53b8c017f2ccf6400c205748bdf92cf7840
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 23 01:37:39 2010 +0000
    
        fix hte last cellspu failure.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96854 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 19d8a01c41bb230ac9f3b184353af9d4fb1f2e7c
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 23 01:33:17 2010 +0000
    
        hack around more crimes in instruction selection.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96852 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 948f49b2aa339a1dbdb2718155fae635ae83e744
    Author: Dan Gohman <gohman at apple.com>
    Date:   Tue Feb 23 01:28:09 2010 +0000
    
        Convert this test to FileCheck and add a testcase for PR3574.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96851 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit b7f668406b8d3b63433e791b2a555257c110000b
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 23 01:20:00 2010 +0000
    
        the cell backend is making all sorts of unsafe and incorrect assumptions
        about ownership and update policies.  It isn't clear why it is doing all
        this lowering at isel time instead of in legalize.  This fixes fcmp64.ll
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96849 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 536238183b92ef3c98a7c7ae480eaed7dfb59e73
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 23 01:07:39 2010 +0000
    
        really fix an off-by-one error
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96845 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit b1a7ecd44bc2961988479c15435b4f242cfcc07b
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 23 01:07:09 2010 +0000
    
        fix an off-by-one error.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96844 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 82d2983ef9fb574977226d41893ea2e4e73f62cb
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 23 00:59:59 2010 +0000
    
        switch the value# in OPC_CompleteMatch and OPC_EmitNode to use a
        VBR encoding for the insanity being perpetrated by the spu backend.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96843 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 951eae263c5326cd581df33fe404bc7521190c49
    Author: Johnny Chen <johnny.chen at apple.com>
    Date:   Tue Feb 23 00:33:12 2010 +0000
    
        Added VCEQ (immediate #0) NEON instruction for disassembly only.
    
        A8.6.281
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96838 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 67ac9950b677731f8766d29717564ff0218577c5
    Author: Jakob Stoklund Olesen <stoklund at 2pi.dk>
    Date:   Tue Feb 23 00:28:53 2010 +0000
    
        Dead code elimination
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96837 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 08d2e8bae2ee1a7443f9a78719d48f06ee63b147
    Author: Jeffrey Yasskin <jyasskin at google.com>
    Date:   Tue Feb 23 00:04:53 2010 +0000
    
        Fix viewCFG on Linux.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96834 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit d4fd103b6e2dc93ccc63c469a4d5a9f0bc864c4e
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Mon Feb 22 23:55:39 2010 +0000
    
        add a new Push2 opcode for targets (like cellspu) which have
        ridiculously ginormous patterns and need more than one byte
        of displacement for encodings.  This fixes CellSPU/fdiv.ll.
        SPU is still doing something else ridiculous though.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96833 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit dbe487d049f68b1cbcbe9e28bc4aa08d937ee8f1
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Mon Feb 22 23:37:48 2010 +0000
    
        These should not have been committed.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96827 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 8a2d6b0c040c01c5eedb913c9435e92bfbdbac3a
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Mon Feb 22 23:34:12 2010 +0000
    
        no need to run llvm-as here.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96826 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit f0dfed5686c151314fc5f58e50c6604bbc82fd14
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Mon Feb 22 23:34:00 2010 +0000
    
        Instcombine constant folding can normalize gep with negative index to index with large offset. When instcombine objsize checking transformation sees these geps where the offset seemingly point out of bound, it should just return "i don't know" rather than asserting.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96825 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 8fd50a5f98a5d18a1b7f17e89e06596157574930
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Mon Feb 22 23:33:44 2010 +0000
    
        Change ComplexPattern handling to push the node being matched as
        well as the operands produced when the pattern is matched.  This
        allows CheckSame to work correctly when matching replicated
        names involving ComplexPatterns.  This fixes a bunch of MSP430
        failures, we're down to 13 failures, two of which are
        due to a sched bug.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96824 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 5a5eb3eafba49861717869ba90f560f7a7752709
    Author: Jim Grosbach <grosbach at apple.com>
    Date:   Mon Feb 22 23:10:38 2010 +0000
    
        Updated version of r96634 (which was reverted due to failing 176.gcc and
        126.gcc nightly tests. These failures uncovered latent bugs that machine DCE
        could remove one half of a stack adjust down/up pair, causing PEI to assert.
        This update fixes that, and the tests now pass.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96822 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 6253658d7c7da5e4680d9c53d5492ff8bd5fc828
    Author: Dan Gohman <gohman at apple.com>
    Date:   Mon Feb 22 23:07:52 2010 +0000
    
        Add a test for canonicalizing ConstantExpr operands.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96820 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit e3321cf25d054bb18e07c686efc391df88afadeb
    Author: Jim Grosbach <grosbach at apple.com>
    Date:   Mon Feb 22 22:54:55 2010 +0000
    
        Clean up a bit and fix for when SPAdj != 0
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96818 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 0f419caeca7d02e44fcfe066edd73522c83f9d5a
    Author: Jim Grosbach <grosbach at apple.com>
    Date:   Mon Feb 22 22:47:46 2010 +0000
    
        The predicate index isn't fixed, so scan for it to make sure we get the proper
        value.
    
        Thumb2 uses the tADJCALLSTACK* instructions, and doesn't need t2 versions, so
        remove the FIXME entry.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96817 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit a69fb559527a30ab40a5e2bc40df8a263e657ee5
    Author: Dan Gohman <gohman at apple.com>
    Date:   Mon Feb 22 22:43:23 2010 +0000
    
        Canonicalize ConstantInts to the right operand of commutative
        operators.
    
        The test difference is just due to the multiplication operands
        being commuted (and thus requiring a more elaborate match). In
        optimized code, that expression would be folded.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96816 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 3bfccd6129136dedbc905cbcb9fe331ae9b5831f
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Mon Feb 22 22:37:11 2010 +0000
    
        expand my hack to work with nodes that have flags but no chains and the
        isel doesn't know the correct # results.  This fixes 8 codegen tests,
        down to 22 failures.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96815 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 28cded9689401154617716d81a9adde3e8167464
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Mon Feb 22 22:30:37 2010 +0000
    
        add a new CheckMultiOpcode opcode for checking that a node
        has one of the list of acceptable opcodes for a complex
        pattern.  This fixes 4 regtest failures.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96814 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 8218d428ddd48485276d25087a86ab45dff01622
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Mon Feb 22 22:18:05 2010 +0000
    
        When matching patterns that have a complex pattern as their root, make
        sure to only run the complex pattern on nodes where the target opts in.
        This patch only handles targets with one opcode specified so far, but
        fixes 16 failures, only 34 left.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96813 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit e85a094d8be56def5b5a921889de7e7a65e101e4
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Mon Feb 22 22:15:39 2010 +0000
    
        add some debug hooks for tracking the behavior of the isel.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96812 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 0875e0bbb87d2428f877d9b53adf58522840f53c
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Mon Feb 22 22:15:05 2010 +0000
    
        remove dupes now.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96811 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit f4f39d6fe2ca15bb6153bd3a02da5daee93f06e4
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Mon Feb 22 22:14:47 2010 +0000
    
        move #includes earlier.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96810 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit a91798edfed53022f83cd69f8e55127065ba815f
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Mon Feb 22 22:08:57 2010 +0000
    
        MC/Mach-O: Remove non-sensical comment, and add a missing AddValueSymbols call.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96809 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 17da190000390f02beec08296e8f4b5e0ac21dcb
    Author: Dan Gohman <gohman at apple.com>
    Date:   Mon Feb 22 22:07:27 2010 +0000
    
        Minor formatting cleanup.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96808 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 720a1ace28bbd268ce6de3feb3d5579f7f63292d
    Author: Dan Gohman <gohman at apple.com>
    Date:   Mon Feb 22 22:05:18 2010 +0000
    
        Use Instruction::isCommutative instead of duplicating it.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96807 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 7562e569a22a2e6e473672d8cba4f9b6e6a355e6
    Author: Johnny Chen <johnny.chen at apple.com>
    Date:   Mon Feb 22 21:50:40 2010 +0000
    
        Added SEL, SXTB16, SXTAB16, UXTAB16, SMMULR, SMMLAR, SMMLSR, SMUAD, and SMUSD,
        for disassembly only.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96806 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 7dd6b2805419e37c3e127b62b9bc27869afdae1a
    Author: Bob Wilson <bob.wilson at apple.com>
    Date:   Mon Feb 22 21:39:41 2010 +0000
    
        Erase deleted instructions from GVN's ValueTable.  This fixes assertion
        failures from ValueTable::verifyRemoved() when using -debug.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96805 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit d83ba06e0894188259a46294a30cb7a47ed2fd83
    Author: Dan Gohman <gohman at apple.com>
    Date:   Mon Feb 22 18:53:26 2010 +0000
    
        Actually enable the -enable-unsafe-fp-math tests.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96796 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 0b41870f23040455bb631f43c4261f412ed01dd1
    Author: Johnny Chen <johnny.chen at apple.com>
    Date:   Mon Feb 22 18:50:54 2010 +0000
    
        Added a bunch of instructions for disassembly only:
    
        o signed/unsigned add/subtract
        o signed/unsigned halving add/subtract
        o unsigned sum of absolute difference [and accumulate]
        o signed/unsigned saturate
        o signed multiply accumulate/subtract [long] dual
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96795 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit d651e2e920026c0c98d00c1c8805c008e51703fc
    Author: Arnold Schwaighofer <arnold.schwaighofer at gmail.com>
    Date:   Mon Feb 22 16:18:09 2010 +0000
    
        Mark the return address stack slot as mutable when moving the return address
        during a tail call. A parameter might overwrite this stack slot during the tail
        call.
    
        The sequence during a tail call is:
        1.) load return address to temp reg
        2.) move parameters (might involve storing to return address stack slot)
        3.) store return address to new location from temp reg
    
        If the stack location is marked immutable CodeGen can colocate load (1) with the
        store (3).
    
        This fixes bug 6225.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96783 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 662af7c4654a217a18f943cb47f4128792a211c0
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Mon Feb 22 05:55:32 2010 +0000
    
        LLVMC/MultiplePluginPriorities.td: Generally XFAIL this test for now, it is
        still failing during (one) llvm-gcc powerpc build, and is also failing on my
        x86_64-apple-darwin10.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96781 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 561c47eb14ac9d2d179b46795e1510119ae2126b
    Author: Dan Gohman <gohman at apple.com>
    Date:   Mon Feb 22 04:11:59 2010 +0000
    
        Remove unused variables and parameters.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96780 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 551a234702e5fa424881cc866db45b1608509932
    Author: Dan Gohman <gohman at apple.com>
    Date:   Mon Feb 22 04:10:52 2010 +0000
    
        Fix various doxygen warnings.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96779 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 85a0e9c5ad6ea03720f460a850d6c2ec81034b5d
    Author: Dan Gohman <gohman at apple.com>
    Date:   Mon Feb 22 04:09:26 2010 +0000
    
        Fix a typo in a comment.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96778 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit b7ba80a3580ef087314d23cf0a81e636fb333ade
    Author: Dan Gohman <gohman at apple.com>
    Date:   Mon Feb 22 04:06:03 2010 +0000
    
        Constant-fold certain comparisons with infinity and negative infinity.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96777 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 651d3026e737756d2f52f988ddf60ef0b798418a
    Author: Dan Gohman <gohman at apple.com>
    Date:   Mon Feb 22 04:04:24 2010 +0000
    
        Rename a variable to avoid a -Wshadow warning.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96776 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ccbad01de34516a064c2dafb7dfa535aedbfacd1
    Author: Dan Gohman <gohman at apple.com>
    Date:   Mon Feb 22 04:03:39 2010 +0000
    
        Remove the logic for reasoning about NaNs from the code that forms
        SSE min and max instructions. The real thing this code needs to be
        concerned about is negative zero.
    
        Update the sse-minmax.ll test accordingly, and add tests for
        -enable-unsafe-fp-math mode as well.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96775 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 3c32d8008e58a65cbf2675c560bdab24e7615549
    Author: Dan Gohman <gohman at apple.com>
    Date:   Mon Feb 22 03:59:54 2010 +0000
    
        When emitting an instruction which depends on both a post-incremented
        induction variable value and a loop-variant value, don't force the
        insert position to be at the post-increment position, because it may
        not be dominated by the loop-variant value. This fixes a
        use-before-def problem noticed on PPC.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96774 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit c040d3cb34ae0adb52a5f513b9c2365b75bfee56
    Author: Dan Gohman <gohman at apple.com>
    Date:   Mon Feb 22 02:07:36 2010 +0000
    
        This cast<Instruction> is unnecessary.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96771 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 8224c0bb6201d54b259b0b458de632a95d749a70
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Mon Feb 22 00:47:38 2010 +0000
    
        enhance my hack for flags handling, this allows us to pass
        CodeGen/X86/pr2182.ll.  Down to 13 x86 failures out of ~1100
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96770 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 94ebcde2aaee561c2a9c7f6211c1a0fce712dd22
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Mon Feb 22 00:28:59 2010 +0000
    
        fix an incorrect VT: eflags is always i32.  The bug was causing us to
        create an X86ISD::Cmp node with result type i64 on the
        CodeGen/X86/shift-i256.ll testcase and the new isel was assert on it
        downstream.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96768 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 3ae24d70824e4ee0f16223e3368da7537e1bc055
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sun Feb 21 23:54:05 2010 +0000
    
        fix most of the failures in the x86 suite by handling multiple
        result nodes correctly.  Note that this includes a horrible hack
        in DAGISelHeader which cannot be fixed reasonably without
        eliminating (parallel) from input patterns.  That, in turn,
        can't be done until we support writing multiple result patterns
        for the X86and_flag and related multiple-result nodes.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96767 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 2c1568a7514847bf2ec37b93a6d3364b55fbb9ef
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Sun Feb 21 21:54:14 2010 +0000
    
        MC/X86: Add stub AsmBackend.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96763 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit f822b3393654d327f22e3404a171db1e03253561
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Sun Feb 21 21:53:53 2010 +0000
    
        MC: Sketch registry support for target specific assembler backends.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96762 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 94890962008ba6daab9ec1a6b1dbcd4b4f1a8a9a
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Sun Feb 21 21:53:37 2010 +0000
    
        Formatting tweaks (trailing whitespace, ordering, comments).
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96761 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 8252aafc429c328e67ee0aa81b66b5fe3af5af60
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sun Feb 21 20:57:28 2010 +0000
    
        fix an odd thinko in an assertion, all arm tests pass now.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96758 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 76b3124496a1e414191e4d5318680b50fd752a95
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sun Feb 21 20:53:45 2010 +0000
    
        Always emit register class id references as i32 like
        DAGISelEmitter does.  This fixes 11 arm failures (8
        left).
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96757 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 247465195ba60d00b8a0d6fa0492ec42c659f664
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sun Feb 21 20:33:20 2010 +0000
    
        add some no-unwinds, other minor cleanups.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96756 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit a80c01e5c5608c0dd71219c6f5beda1466002263
    Author: Anton Korobeynikov <asl at math.spbu.ru>
    Date:   Sun Feb 21 20:28:15 2010 +0000
    
        It turned out that we failed to emit proper symbol stubs on non-x86/darwin for ages (we emitted a reference to a stub, but no stub was emitted). The code inside x86-32/macho target objfile lowering should actually be the generic one - move it there.
    
        This (I really, really hope) should fix EH issues on ppc/darwin
        and arm/darwin.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96755 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 17d2e870e73eef73f15d20f3e02ae111396c3d37
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sun Feb 21 20:15:25 2010 +0000
    
        speculatively teach OPC_CheckValueType and OPC_EmitNode to handle
        MVT::iPTR.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96753 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 18c3cba3eb42771ce9b777b6c4d6a444339bd088
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sun Feb 21 20:10:43 2010 +0000
    
        teach OPC_CheckType to handle MVT::iPTR, down to 2 ppc failures.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96752 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ac982429dc553f285c460b64a51ce1f862f6f57b
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sun Feb 21 20:02:15 2010 +0000
    
        make this check a bit more generous, it may be outliving its
        utility.  Down to 6 ppc failures.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96751 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit f08accb33eac1edc73848b157c7d026d1a76aa2c
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sun Feb 21 19:35:07 2010 +0000
    
        Relax an assertion a bit.  We allow replacing things like
        <4 x i32> with <4 x float> values if they end up the same
        register class.  This gets us up to 231 passes on the ppc
        tests (only 7 fails).
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96750 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit c044ffeb91d65555585612d29d82d85c39353f3f
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sun Feb 21 19:27:38 2010 +0000
    
        add a triple so that this doesn't fail due to linux/ppc register printing
        syntax.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96748 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ea17a4cc66e4b517ae08a4da4d2e8b24e477235e
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sun Feb 21 19:22:06 2010 +0000
    
        Sort the patterns before adding them to the FA so that we get the
        least cost matches.  This gets us from 195 -> 208 passes on the ppc codegen tests.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96747 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 097058c74354e8f22b5e23f0282e907f580aaeda
    Author: Duncan Sands <baldrick at free.fr>
    Date:   Sun Feb 21 19:15:19 2010 +0000
    
        Remove a bunch of duplicated code, where there was one version taking a std::ostream
        and another taking a raw_ostream, but otherwise identical.  Use raw_ostream everywhere.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96746 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit f81d7a9c6647ea5058840fbf6e68c7ec0e24e64c
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sun Feb 21 18:53:28 2010 +0000
    
        filecheckize and add nouwinds.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96745 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit d8718c5bba41d2909709f51f10cddbe0bc84e52f
    Author: Jakob Stoklund Olesen <stoklund at 2pi.dk>
    Date:   Sun Feb 21 18:51:48 2010 +0000
    
        Enable assertion to detect cyclic valno references.
    
        This changes the stack overflow in PR6363 to an assertion failure.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96744 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 4eab8871a8c351e08021ebfa38aa9dc7cf382193
    Author: Anton Korobeynikov <asl at math.spbu.ru>
    Date:   Sun Feb 21 12:28:58 2010 +0000
    
        IT turns out that during jumpless setcc lowering eq and ne were swapped.
        This fixes PR6348
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96734 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ec8bfbc2c69f076e6710d470a4ae1571c19e7f86
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sun Feb 21 07:55:48 2010 +0000
    
        when a match fails and we have to rollback, make sure to keep 'N' in
        sync with the top of stack.  This fixes a bunch of failures on larger
        testcases.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96732 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 95ae06faabbfa6c4753aad51b0a256e52d38133d
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sun Feb 21 07:19:06 2010 +0000
    
        handle optional in flags that aren't present.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96731 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit eab3a483ebdf3110aafe8c7caaf61ce692db843c
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sun Feb 21 07:16:41 2010 +0000
    
        emit table indexes before each row so that it is debuggable.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96730 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 6252811370eaa8e82979dd56cda3a1fcbb617daa
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sun Feb 21 06:58:27 2010 +0000
    
        fix two bugs in OPC_EmitRegister, which makes ppc happier.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96728 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 50356ba1682201debb58d84ea89d02f79906c69e
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sun Feb 21 06:44:29 2010 +0000
    
        fix a table size miscomputation, target opcodes are 2 bytes.
        With this, the matcher actually works reasonably well, but
        crashes on larger examples in the scheduler.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96727 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit d43cbc17992b19d624499d0a5a6a344002665381
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sun Feb 21 06:30:04 2010 +0000
    
        emit to the right streams, to avoid emitting the push
        body before the push.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96726 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 2ade183489d62cb7c3a42e161526fb7c125e5673
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sun Feb 21 06:03:56 2010 +0000
    
        oops don't turn this on for everyone yet.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96725 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 55214c3f2617d719286df0e6a5b0f9d20cba5d97
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sun Feb 21 06:03:07 2010 +0000
    
        implement the last known missing feature: updating uses of results
        of the matched pattern to use the newly created node results.  Onto
        the "making it actually work" phase!
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96724 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit e4bd7f0b3b6f44838dacdc01e8d1683f1b939dcc
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sun Feb 21 04:53:34 2010 +0000
    
        fix and un-xfail X86/vec_ss_load_fold.ll
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96720 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit bfe6e63a044c5ce2f13b61bc08f8075882dccfce
    Author: Johnny Chen <johnny.chen at apple.com>
    Date:   Sun Feb 21 04:42:01 2010 +0000
    
        Undo r96654.  The printing of ARM shift instructions in canonical forms can be
        handled in ARMInstPrinter.cpp.
    
        And added PLD/PLDW/PLI (Preload Data/Instruction) for disassembly only.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96719 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit bacb17f722a7b36d3190ceb1914fd434cac8f9a0
    Author: Charles Davis <cdavis at mines.edu>
    Date:   Sun Feb 21 04:26:06 2010 +0000
    
        Reduce size of 'StackAlignment' field from 5 to 3 bits. Seriously, who needs a
        2GB-aligned stack anyway? 256 bytes is plenty. Requested by Chris.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96718 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 1740fe351bd1fd93536b80d8419dc0b36cc028d9
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sun Feb 21 03:24:41 2010 +0000
    
        temporarily disable this.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96717 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 3593bf4e3f6d569673cb73a9a4d3701cebfe582d
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sun Feb 21 03:22:59 2010 +0000
    
        Lots of improvements to the new dagisel emitter.  This gets it to
        the point where it is to the 95% feature complete mark, it just
        needs result updating to be done (then testing, optimization
        etc).
    
        More specificallly, this adds support for chain and flag handling
        on the result nodes, support for sdnodexforms, support for variadic
        nodes, memrefs, pinned physreg inputs, and probably lots of other
        stuff.
    
        In the old DAGISelEmitter, this deletes the dead code related to
        OperatorMap, cleans up a variety of dead stuff handling "implicit
        remapping" from things like globaladdr -> targetglobaladdr (which
        is no longer used because globaladdr always needs to be legalized),
        and some minor formatting fixes.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96716 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 3f79718ae585a2f69d0e69626cf4c971b64de73c
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sun Feb 21 03:17:59 2010 +0000
    
        rename SelectScalarSSELoad -> SelectScalarSSELoadXXX and rewrite
        it to follow the mode needed by the new isel.  Instead of returning
        the input and output chains, it just returns the (currently only one,
        which is a silly limitation) node that has input and output chains.
    
        Since we want the old thing to still work, add a new
        SelectScalarSSELoad to emulate the old interface.  The XXX suffix
        and the wrapper will eventually go away.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96715 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 6205d98fb0edfed046cca455ddf151aa25d0df96
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sun Feb 21 03:15:11 2010 +0000
    
        add a hook so that the new isel can run SDNodeXForms.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96714 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 73052f4b2f4b5759ce98d0d4ed2e4146f862ceaf
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sun Feb 21 03:13:10 2010 +0000
    
        Eliminate some uses of immAllOnes, just use -1, it does
        the same thing and is more efficient for the matcher.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96713 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit eacbfef5101dff9dcf620f42e120538cbf6fe40d
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sun Feb 21 03:12:16 2010 +0000
    
        Eliminate some uses of immAllOnes, just use -1, it does
        the same thing and is more efficient for the matcher.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96712 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit f1d83db8838172a16b80cb6b508d68716fee0357
    Author: Tanya Lattner <tonic at nondot.org>
    Date:   Sun Feb 21 03:01:05 2010 +0000
    
        Test commit.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96711 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit f95fdf4bcb48e21f3f3d2fdce74bf3c9c0c217da
    Author: Tanya Lattner <tonic at nondot.org>
    Date:   Sun Feb 21 02:59:05 2010 +0000
    
        Test commit
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96710 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 349819a813c8c93544f27a9d4131234f52140ff1
    Author: Dan Gohman <gohman at apple.com>
    Date:   Fri Feb 19 19:35:48 2010 +0000
    
        Rename getSDiv to getExactSDiv to reflect its behavior in cases where
        the division would have a remainder.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96693 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 2b0ea295dee969b3d103778799500ea519f9b5d6
    Author: Dan Gohman <gohman at apple.com>
    Date:   Fri Feb 19 19:32:49 2010 +0000
    
        Check for overflow when scaling up an add or an addrec for
        scaled reuse.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96692 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 6a891b6e11775b26d8400d49c2f1ea35845d1591
    Author: Bob Wilson <bob.wilson at apple.com>
    Date:   Fri Feb 19 18:59:53 2010 +0000
    
        Revert 96634.  It causes assertion failures for 126.gcc and 176.gcc in
        the armv6 nightly tests.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96691 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ff49692a11b9f95bae17b5a560827a35700cb6e9
    Author: Dan Gohman <gohman at apple.com>
    Date:   Fri Feb 19 18:49:22 2010 +0000
    
        Add a comment.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96688 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit c3151807449da3ff92a4219edb5600c1c2c0ac56
    Author: Charles Davis <cdavis at mines.edu>
    Date:   Fri Feb 19 18:17:13 2010 +0000
    
        Add support for the 'alignstack' attribute to the x86 backend. Fixes PR5254.
    
        Also, FileCheck'ize a test.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96686 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 5ce4c01bea8e41eba62084717b08e47104427041
    Author: Dan Gohman <gohman at apple.com>
    Date:   Fri Feb 19 18:12:07 2010 +0000
    
        Teach ScalarEvolution how to compute a tripcount for a loop with
        true or false as its exit condition. These are usually eliminated by
        SimplifyCFG, but the may be left around during a pass which wishes
        to preserve the CFG.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96683 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 33aacdd25540b32eb7aef0c5e23bc3d2e0830742
    Author: Bob Wilson <bob.wilson at apple.com>
    Date:   Fri Feb 19 17:10:59 2010 +0000
    
        Revert Anton's most recent EH patch (r96637), since it breaks a lot of
        ARM and Thumb tests.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96680 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit cf382697b2fcfa693142067489746f74bb84c7c1
    Author: Duncan Sands <baldrick at free.fr>
    Date:   Fri Feb 19 11:30:41 2010 +0000
    
        Revert commits 96556 and 96640, because commit 96556 breaks the
        dragonegg self-host build.  I reverted 96640 in order to revert
        96556 (96640 goes on top of 96556), but it also looks like with
        both of them applied the breakage happens even earlier.  The
        symptom of the 96556 miscompile is the following crash:
    
          llvm[3]: Compiling AlphaISelLowering.cpp for Release build
          cc1plus: /home/duncan/tmp/tmp/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:4982: void llvm::SelectionDAG::ReplaceAllUsesWith(llvm::SDNode*, llvm::SDNode*, llvm::SelectionDAG::DAGUpdateListener*): Assertion `(!From->hasAnyUseOfValue(i) || From->getValueType(i) == To->getValueType(i)) && "Cannot use this version of ReplaceAllUsesWith!"' failed.
          Stack dump:
          0.	Running pass 'X86 DAG->DAG Instruction Selection' on function '@_ZN4llvm19AlphaTargetLowering14LowerOperationENS_7SDValueERNS_12SelectionDAGE'
          g++: Internal error: Aborted (program cc1plus)
    
        This occurs when building LLVM using LLVM built by LLVM (via
        dragonegg).  Probably LLVM has miscompiled itself, though it
        may have miscompiled GCC and/or dragonegg itself: at this point
        of the self-host build, all of GCC, LLVM and dragonegg were built
        using LLVM.  Unfortunately this kind of thing is extremely hard
        to debug, and while I did rummage around a bit I didn't find any
        smoking guns, aka obviously miscompiled code.
    
        Found by bisection.
    
        r96556 | evancheng | 2010-02-18 03:13:50 +0100 (Thu, 18 Feb 2010) | 5 lines
    
        Some dag combiner goodness:
        Transform br (xor (x, y)) -> br (x != y)
        Transform br (xor (xor (x,y), 1)) -> br (x == y)
        Also normalize (and (X, 1) == / != 1 -> (and (X, 1)) != / == 0 to match to "test on x86" and "tst on arm"
    
        r96640 | evancheng | 2010-02-19 01:34:39 +0100 (Fri, 19 Feb 2010) | 16 lines
    
        Transform (xor (setcc), (setcc)) == / != 1 to
        (xor (setcc), (setcc)) != / == 1.
    
        e.g. On x86_64
          %0 = icmp eq i32 %x, 0
          %1 = icmp eq i32 %y, 0
          %2 = xor i1 %1, %0
          br i1 %2, label %bb, label %return
        =>
        	testl   %edi, %edi
        	sete    %al
        	testl   %esi, %esi
        	sete    %cl
        	cmpb    %al, %cl
        	je      LBB1_2
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96672 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ecab71b9f5ffc6afe46407a9dd0450449e8fe119
    Author: Duncan Sands <baldrick at free.fr>
    Date:   Fri Feb 19 09:18:53 2010 +0000
    
        Correct LastPrimitiveTyID: MetadataType is a primitive type.
        This change probably has no functional effect.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96669 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit f558bd3a1c802d7aac37f3827c4c70be51fe2a0b
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Fri Feb 19 07:49:56 2010 +0000
    
        add emitter support for integer constants and simple physreg references.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96663 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 9f6c0cadfb533897312545d0dce31b8590b8e0e0
    Author: Dale Johannesen <dalej at apple.com>
    Date:   Fri Feb 19 07:14:22 2010 +0000
    
        recommit 96626, evidence that it broke things appears
        to be spurious
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96662 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit e3c5c26d37ca134ec8107498a5fff100338052b4
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Fri Feb 19 07:02:20 2010 +0000
    
        fix this to work more determinstically, patch by Thomas Veith!
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96661 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit c479dcf7e4bca1325343d38eb63347f6f28641db
    Author: Devang Patel <dpatel at apple.com>
    Date:   Fri Feb 19 02:58:33 2010 +0000
    
        Test case for r96656.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96657 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 1afbdfceab05493bcfd67e17131274e853000e82
    Author: Johnny Chen <johnny.chen at apple.com>
    Date:   Fri Feb 19 02:12:06 2010 +0000
    
        Added entries for ASR, LSL, LSR, ROR, and RRX so that the disassembler prints
        out the canonical form (A8.6.98) instead of the pseudo-instruction as provided
        via MOVs.
    
        DBG_ARM_DISASM=YES llvm-mc -triple=arm-unknown-unknown --disassemble
        0xc0 0x00 0xa0 0xe1
        Opcode=29 Name=ASR Format=ARM_FORMAT_LDMISCFRM
         31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10  9  8  7  6  5  4  3  2  1  0
        -------------------------------------------------------------------------------------------------
        | 1: 1: 1: 0| 0: 0: 0: 1| 1: 0: 1: 0| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 1: 1: 0: 0| 0: 0: 0: 0|
        -------------------------------------------------------------------------------------------------
    
        	asr	r0, r0, #1
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96654 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 5856c910917b665fc21bdb66cacef37ca7ec0148
    Author: Dale Johannesen <dalej at apple.com>
    Date:   Fri Feb 19 01:54:37 2010 +0000
    
        Revert 96626, which causes build failure on ppc Darwin.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96653 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 33403fea96f346dd67174dd75fa55b25c077b908
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Fri Feb 19 00:34:39 2010 +0000
    
        Transform (xor (setcc), (setcc)) == / != 1 to
        (xor (setcc), (setcc)) != / == 1.
    
        e.g. On x86_64
          %0 = icmp eq i32 %x, 0
          %1 = icmp eq i32 %y, 0
          %2 = xor i1 %1, %0
          br i1 %2, label %bb, label %return
        =>
        	testl   %edi, %edi
        	sete    %al
        	testl   %esi, %esi
        	sete    %cl
        	cmpb    %al, %cl
        	je      LBB1_2
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96640 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 58ec19ab4901514845922ec08bc9b2b3e352f577
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Fri Feb 19 00:33:13 2010 +0000
    
        I confused myself, temporaries will be recorded right along with other inputs.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96639 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ef9d04cf557b0fa77b0824fbd7befdf2d8d6e075
    Author: Anton Korobeynikov <asl at math.spbu.ru>
    Date:   Fri Feb 19 00:29:36 2010 +0000
    
        Use the same encoding for EH stuff uniformly on all MachO targets.
        This hopefulyl should unbreak EH on PPC/Darwin.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96637 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 5aa3ace5a4bacc9897298c537372b13a9aa74798
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Fri Feb 19 00:27:40 2010 +0000
    
        introduce a new ResultVal and start keeping track of temporary values.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96636 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit c3f173cbfa675a63489d344c0a91d2b1f480163f
    Author: Jim Grosbach <grosbach at apple.com>
    Date:   Fri Feb 19 00:16:24 2010 +0000
    
        Radar 7636153. In the presence of large call frames, it's not sufficient
        for ARM to just check if a function has a FP to determine if it's safe
        to simplify the stack adjustment pseudo ops prior to eliminating frame
        indices. Allow targets to override the default behavior and does so for ARM
        and Thumb2.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96634 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit bd3ddf5f0c0f633c39b42f1a48b483d65f3d0fed
    Author: Dan Gohman <gohman at apple.com>
    Date:   Fri Feb 19 00:05:23 2010 +0000
    
        When determining the set of interesting reuse factors, consider
        strides in foreign loops. This helps locate reuse opportunities
        with existing induction variables in foreign loops and reduces
        the need for inserting new ones. This fixes rdar://7657764.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96629 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit d5e9beaff4973477663acc5cc9e444ebfde07bd7
    Author: Dan Gohman <gohman at apple.com>
    Date:   Thu Feb 18 23:26:33 2010 +0000
    
        Indvars needs to explicitly notify ScalarEvolution when it is replacing
        a loop exit value, so that if a loop gets deleted, ScalarEvolution
        isn't stick holding on to dangling SCEVAddRecExprs for that loop. This
        fixes PR6339.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96626 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit e62abaebf48091afd1b488baed1698fa4e02e043
    Author: Mon P Wang <wangmp at apple.com>
    Date:   Thu Feb 18 22:33:18 2010 +0000
    
        getSplatIndex assumes that the first element of the mask contains the splat index
        which is not always true if the mask contains undefs. Modified it to return
        the first non undef value.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96621 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit baf26c82ecd15bd28a9e04e7684836c102534b40
    Author: Johnny Chen <johnny.chen at apple.com>
    Date:   Thu Feb 18 22:31:18 2010 +0000
    
        Added LDRD_PRE/POST & STRD_PRE/POST for disassembly only.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96619 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 6220d28bab41ec354a1e56632aebb597108970f0
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Thu Feb 18 22:03:03 2010 +0000
    
        add support for referencing registers and immediates,
        building the tree to represent them but not emitting
        table entries for them yet.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96617 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit a82887a0e7503764e687e7ef62bf3ba0983b86fc
    Author: Talin <viridia at gmail.com>
    Date:   Thu Feb 18 21:43:45 2010 +0000
    
        replaceUsesOfWithOnConstant implementation for unions.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96616 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 8e7364467b85336639f9736a4d0aa332679bc230
    Author: Dan Gohman <gohman at apple.com>
    Date:   Thu Feb 18 21:34:02 2010 +0000
    
        Hoist this loop-invariant logic out of the loop.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96614 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 6d57ee9fbdb3dbe96ad7f63784f25c9474211014
    Author: Jakob Stoklund Olesen <stoklund at 2pi.dk>
    Date:   Thu Feb 18 21:33:05 2010 +0000
    
        Always normalize spill weights, also for intervals created by spilling.
    
        Moderate the weight given to very small intervals.
    
        The spill weight given to new intervals created when spilling was not
        normalized in the same way as the original spill weights calculated by
        CalcSpillWeights. That meant that restored registers would tend to hang around
        because they had a much higher spill weight that unspilled registers.
    
        This improves the runtime of a few tests by up to 10%, and there are no
        significant regressions.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96613 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 97a6c69733a3db6a5889c085b4e395c9677b908b
    Author: Dan Gohman <gohman at apple.com>
    Date:   Thu Feb 18 21:25:53 2010 +0000
    
        Make CodePlacementOpt detect special EH control flow by
        checking whether AnalyzeBranch disagrees with the CFG
        directly, rather than looking for EH_LABEL instructions.
        EH_LABEL instructions aren't always at the end of the
        block, due to FP_REG_KILL and other things. This fixes
        an infinite loop compiling MultiSource/Benchmarks/Bullet.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96611 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 54484f9f17de14a9699bb78fb35452566c3b5b8d
    Author: Devang Patel <dpatel at apple.com>
    Date:   Thu Feb 18 21:03:36 2010 +0000
    
        Fix comments.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96610 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 762426382d050e324da72c78c66d3b69a864a141
    Author: Devang Patel <dpatel at apple.com>
    Date:   Thu Feb 18 20:53:16 2010 +0000
    
        Destroy MDNodes gracefully while deleting llvm context.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96609 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 5159342e3edf28d46fa2e50def6498c2c2e35a5f
    Author: Devang Patel <dpatel at apple.com>
    Date:   Thu Feb 18 19:52:12 2010 +0000
    
        Ignore target dependent value in grep search.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96604 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit b95d51083697cd7b6a09462b18dfbe600df60223
    Author: Dale Johannesen <dalej at apple.com>
    Date:   Thu Feb 18 18:51:15 2010 +0000
    
        Generate DBG_VALUE from dbg.value intrinsics.  These currently
        comes out as comments but will eventually generate DWARF.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96601 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 89bf1e188b68b5637e416ff2b8539574ee7f5c14
    Author: Dan Gohman <gohman at apple.com>
    Date:   Thu Feb 18 18:40:29 2010 +0000
    
        Clarify that ptrtoint+inttoptr are an alternative to GEP which are
        not restricted by the GEP rules.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96598 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 3f74a0fa87916426a46ba5316d4ea47a3b4992bd
    Author: Dan Gohman <gohman at apple.com>
    Date:   Thu Feb 18 18:22:41 2010 +0000
    
        Fix a typo.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96597 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 5c73aa9e95526f86f8c9d7a537d82eb65defeae8
    Author: Dan Gohman <gohman at apple.com>
    Date:   Thu Feb 18 18:22:18 2010 +0000
    
        Clarify that the rules about object hopping kick in when a pointer is
        deferenced, rather than when the pointer value is computed.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96596 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 74e1ff45131888ab4e5ea1fc5ff263f9a6373c1e
    Author: Dan Gohman <gohman at apple.com>
    Date:   Thu Feb 18 18:19:17 2010 +0000
    
        Fix typos Duncan noticed.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96594 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit c8696719f59aac87b9f53375b08a752defe63430
    Author: Sanjiv Gupta <sanjiv.gupta at microchip.com>
    Date:   Thu Feb 18 18:00:35 2010 +0000
    
        Remap the call sites of a shared function  in interrupt line functions.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96591 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 834466c4a192dcb36370d4c2c3f3871b7bf21dee
    Author: Sanjiv Gupta <sanjiv.gupta at microchip.com>
    Date:   Thu Feb 18 17:32:25 2010 +0000
    
        Re-factoring.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96589 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 9ad781ac4b8a0f8ce961356113c9d65d5728d789
    Author: Duncan Sands <baldrick at free.fr>
    Date:   Thu Feb 18 14:37:52 2010 +0000
    
        Uniformize the way these options are printed.  Requested by
        Russell Wallace.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96580 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit c24378d92d55f2e3b4764f6372e9d8193f1cc0da
    Author: Duncan Sands <baldrick at free.fr>
    Date:   Thu Feb 18 14:10:41 2010 +0000
    
        Remove terminating dot in description.  Inconsistency pointed
        out by Russell Wallace.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96579 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ddd5b4c929d39bd491f51ab576c1fafeaaf7e170
    Author: Duncan Sands <baldrick at free.fr>
    Date:   Thu Feb 18 14:08:13 2010 +0000
    
        Refer to -help instead of --help since this is what tools themselves say.
        Also, have tools output -help-hidden rather than refer to --help-hidden,
        for consistency, and likewise adjust documentation.  This doesn't change
        every mention of --help, only those which seemed clearly safe.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96578 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 7316dea5cc26e2825cfe53b1880fcd05f924e698
    Author: Benjamin Kramer <benny.kra at googlemail.com>
    Date:   Thu Feb 18 12:57:05 2010 +0000
    
        Avoid a dangling pointer dereference, PassManager::add can delete the Pass.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96576 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 986fab2dc7197715928875decd663068944ac9de
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Thu Feb 18 06:47:49 2010 +0000
    
        start sketching out the structure of code for result emission generation.
        Nothing real here yet.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96575 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 9041a138d986e9ee5e775aa8d13d485c5778dd94
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Thu Feb 18 06:33:42 2010 +0000
    
        add a missing type cast.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96574 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 5b5cbcab08ff5058af7e38fe74a9d5cf795461ea
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Thu Feb 18 06:29:06 2010 +0000
    
        remove empty file
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96573 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 3a76807eff146d515f2d2035898e87015737df1a
    Author: Bob Wilson <bob.wilson at apple.com>
    Date:   Thu Feb 18 06:05:53 2010 +0000
    
        Use NEON vmin/vmax instructions for floating-point selects.
        Radar 7461718.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96572 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit fc90957195bbe47f7182a935b3a33f0f5476d793
    Author: Jeffrey Yasskin <jyasskin at google.com>
    Date:   Thu Feb 18 04:43:02 2010 +0000
    
        Roll back the shared library, r96559.  It broke two darwins and arm, mysteriously.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96569 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 6d4ee4e9b21f3e0d74ee548b6d419ede88bb9732
    Author: Johnny Chen <johnny.chen at apple.com>
    Date:   Thu Feb 18 03:27:42 2010 +0000
    
        Added LDRSBT, LDRHT, LDRSHT for disassembly only.  And fixed encoding errors
        of AI3ldsbpo, AI3ldhpo, and AI3ldshpo in ARMInstrFormats.td in the process.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96565 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ad7e41d5e53f19b14c2c746a006240c39eaad559
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Thu Feb 18 02:53:41 2010 +0000
    
        rename the child field to 'next'.  This is not a parent/child
        relationship, this is a linear list relationship.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96561 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 0d4e8f0f59fd1ccb81bc11551892e8b686bc12be
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Thu Feb 18 02:49:24 2010 +0000
    
        eliminate the MatcherNodeWithChild class, give the 'child'
        field to MatcherNode.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96560 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 88881e1168e32522529e2feaeb539dbf82cd4a4a
    Author: Jeffrey Yasskin <jyasskin at google.com>
    Date:   Thu Feb 18 02:36:02 2010 +0000
    
        Add a shared library for LLVM, named libLLVM2.7svn.(so|dylib), and add an
        --enable-shared configure flag to have the tools linked shared. (2.7svn is just
        $(LLVMVersion) so it'll change to "2.7" in the release.)  Always link the
        example programs shared to test that the shared library keeps working.
    
        On my mac laptop, Debug libLLVM2.7svn.dylib is 39MB, and opt (for example) is
        16M static vs 440K shared.
    
        Two things are less than ideal here:
        1) The library doesn't include any version information. Since we expect to break
        the ABI with every release, this shouldn't be much of a problem. If we do
        release a compatible 2.7.1, we may be able to hack its library to work with
        binaries compiled against 2.7.0, or we can just ask them to recompile. I'm
        hoping to get a real packaging expert to look at this for the 2.8 release.
        2) llvm-config doesn't yet have an option to print link options for the shared
        library. I'll add this as a subsequent patch.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96559 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit eadf9fc23721aea592981955c91f3f4c250afbc6
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Thu Feb 18 02:13:50 2010 +0000
    
        Some dag combiner goodness:
        Transform br (xor (x, y)) -> br (x != y)
        Transform br (xor (xor (x,y), 1)) -> br (x == y)
        Also normalize (and (X, 1) == / != 1 -> (and (X, 1)) != / == 0 to match to "test on x86" and "tst on arm"
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96556 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit c94d789e58f994c2f2d8a588389965102e78710a
    Author: Devang Patel <dpatel at apple.com>
    Date:   Thu Feb 18 00:53:49 2010 +0000
    
        New test case for r96543.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96544 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 7292fda1bbff055771af5068db1db6593764648d
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Thu Feb 18 00:23:27 2010 +0000
    
        fit in 80 cols
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96541 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 8aabefbe150a42c2f429b33795e9065f68dc12ad
    Author: Johnny Chen <johnny.chen at apple.com>
    Date:   Thu Feb 18 00:19:08 2010 +0000
    
        Added for disassembly only the variants of DMB, DSB, and ISB.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96540 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit f95eb8ce753dff7310811807e467f420f1577946
    Author: Eric Christopher <echristo at apple.com>
    Date:   Wed Feb 17 23:55:26 2010 +0000
    
        Fix a few unused parameter warnings.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96533 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 7f7a015d6c211d086ff07328bd20f41ada29b05b
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Wed Feb 17 23:45:16 2010 +0000
    
        MC/Mach-O: Update fixup values for change to X86 offsets.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96532 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 48b4e349ddac3e974a031d4dd988d35d69de963d
    Author: Dan Gohman <gohman at apple.com>
    Date:   Wed Feb 17 22:54:10 2010 +0000
    
        Make this an unnumbered list.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96528 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit a7ef1d069dd569aaa93feac6dfcbf7b4596741dd
    Author: Dan Gohman <gohman at apple.com>
    Date:   Wed Feb 17 22:50:12 2010 +0000
    
        HTML validation fixes.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96527 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 9c811a7b2e5b9c0c3ec4abf639b05b7c3cb8add2
    Author: Dan Gohman <gohman at apple.com>
    Date:   Wed Feb 17 22:47:06 2010 +0000
    
        Add an "advanced" GetElementPtr FAQ document, with answers to
        questions left unanswered by the first GetElementPtr FAQ.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96526 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit c32176e1bd44ce5f9514a9ccf997e0c097122cd2
    Author: Bob Wilson <bob.wilson at apple.com>
    Date:   Wed Feb 17 22:42:54 2010 +0000
    
        Remove the NEON N2VSInt instruction class: it's only used in one place and
        since it has no pattern, there's not much point in distinguishing an "N2VS"
        class for intrinsics anyway.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96525 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit e51e54f5bb0f8634ab4e9753f98289ba9cd31ff3
    Author: Johnny Chen <johnny.chen at apple.com>
    Date:   Wed Feb 17 22:37:58 2010 +0000
    
        Added CLREX (Clear-Exclusive) for disassembly only.
    
        A8.6.30
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96523 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit c364642e09715f19769b5b53da29da56e52a7586
    Author: Bob Wilson <bob.wilson at apple.com>
    Date:   Wed Feb 17 22:23:11 2010 +0000
    
        More cleanup for NEON:
        * Use "S" abbreviation for scalar single FP registers in class and pattern
        names, instead of keeping the "D" (for "double") abbreviation and tacking on
        an "s" elsewhere in the name.
        * Move the scalar single FP register classes and patterns to be more
        consistent with other definitions in the file.
        * Rename "VNEGf32d" definition to "VNEGfd" for consistency.
        * Deleted the N2VDIntsPat pattern; N2VSPat is good enough.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96521 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 64f6921be53c5451a213952c145ffab395ce8c22
    Author: Johnny Chen <johnny.chen at apple.com>
    Date:   Wed Feb 17 21:39:10 2010 +0000
    
        Added RFE for disassembly only.
    
        B6.1.8 RFE Return From Exception loads the PC and the CPSR from the word at the
        specified address and the following word respectively.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96519 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 98fc471e7a10772a978fd849928eb9905bb97859
    Author: David Greene <greened at obbligato.org>
    Date:   Wed Feb 17 20:21:42 2010 +0000
    
        Make the non-temporal bit "significant" in MemSDNodes so they aren't
        CSE'd or otherwise combined with temporal MemSDNodes.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96505 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 587e14be8e8ac7fc3c74110de6a9e549e79434d5
    Author: Jakob Stoklund Olesen <stoklund at 2pi.dk>
    Date:   Wed Feb 17 20:18:50 2010 +0000
    
        Remember to define super registers in mips calls.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96504 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit b19b7d10d3ef4cdca16100ee15f78044d43c15d4
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Wed Feb 17 20:08:42 2010 +0000
    
        Add Regex::sub, for doing regular expression substitution with backreferences.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96503 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 739ef571a2d239ebb3b0743748b042c99a8533d8
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 17 19:54:34 2010 +0000
    
        irbuilder is doing constant folding now by default, PR6092
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96502 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 1aedc2c20ca91f228093407fd5eee479f249a0f9
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 17 19:51:31 2010 +0000
    
        fix some out of date prose dating from the LLVMContext changes.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96500 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit e209ed52e3d0baed0d80195a462ad80cf4f3a64c
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Wed Feb 17 19:26:45 2010 +0000
    
        Fix comment.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96498 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit bd84b4bebc1d3d9c85e4e65fe66ae7e10326cf95
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 17 19:19:50 2010 +0000
    
        redisable this to save people a small amount of build time.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96497 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 17ab361f218b0c9c823b4900ed28876bc0848866
    Author: Jakob Stoklund Olesen <stoklund at 2pi.dk>
    Date:   Wed Feb 17 19:13:56 2010 +0000
    
        Dead code elimination.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96496 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 49b4f955f8027576a49aacf264e297cc0493b0d5
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 17 18:57:19 2010 +0000
    
        "Fix and issue in SparcAsmPrinter where multiple identical .LLGETPCHn symbols could be emitted in the same file (it was uniqued by block number, but not by function number). "  Patch by Nathan Keynes!
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96495 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 54f5c508486c1d120d8a62efe6bbcca444551478
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 17 18:52:56 2010 +0000
    
        move isOnlyReachableByFallthrough out of MachineBasicBlock into AsmPrinter,
        and add a sparc implementation that knows about delay slots.  Patch by
        Nathan Keynes!
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96492 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 3cbf45556d0dd1cd039400aeba3b4ba5ac9a0202
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 17 18:42:24 2010 +0000
    
        add a note, from PR5100
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96490 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 4e76fd0c478b8a328e76a3364688c9d9fe20525d
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 17 18:39:56 2010 +0000
    
        add missing method, PR6284
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96489 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit daf84e05852c3b3199a3c075eba0fe8b915e8882
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 17 18:33:13 2010 +0000
    
        add optional debian instructions, PR6272
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96488 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit cac5f1f58d7df62d5ca893c3db3c8d3d706a7d99
    Author: Sanjiv Gupta <sanjiv.gupta at microchip.com>
    Date:   Wed Feb 17 18:11:29 2010 +0000
    
        Added routine to clone the body of a function and maintain a map of already
        cloned functions.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96485 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 491a1ff42cd2b311880b77c70c401121fa6474ca
    Author: Duncan Sands <baldrick at free.fr>
    Date:   Wed Feb 17 17:20:17 2010 +0000
    
        Mention an API change.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96480 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 7f5ee33ea755aa8110c6b3bede2589689adaf071
    Author: Duncan Sands <baldrick at free.fr>
    Date:   Wed Feb 17 14:52:22 2010 +0000
    
        Pacify gcc-4.5, which warns (correctly) that these switches have
        cases that are not part of the enum.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96477 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 197ad60fa75a81c866710e99bb9cc6dd0bb66541
    Author: Eric Christopher <echristo at apple.com>
    Date:   Wed Feb 17 08:53:27 2010 +0000
    
        Revert:
        r95605 | dpatel | 2010-02-08 15:27:46 -0800 (Mon, 08 Feb 2010) | 2 lines
    
        test case for r95604.
    
        Which was the testcase for the patch reverted from llvm-gcc.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96474 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit cfa756308b82a1644fb9176b3b8307fc82db1076
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 17 06:53:36 2010 +0000
    
        reduce nesting.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96466 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 9a1ae6843df7e7545e7c4bbb94fa9fdbc1c9561d
    Author: Sanjiv Gupta <sanjiv.gupta at microchip.com>
    Date:   Wed Feb 17 06:48:50 2010 +0000
    
        Added a function to clone locals of a function.( which for pic16 are globals
        with mangled names).
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96465 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 3dea247c3b95e66a33ec36d08f00726f9a7da0c5
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 17 06:47:35 2010 +0000
    
        improve comments, the matcher is now feature complete, on to codegen.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96464 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 4e90a2924873fee4f0c24f9bbe2e2acd6aafa6f7
    Author: Sanjiv Gupta <sanjiv.gupta at microchip.com>
    Date:   Wed Feb 17 06:46:23 2010 +0000
    
        Removed header files from .h by adding forward decls.
        Renamed PIC16FrameOverlay namespace to PIC16OVERLAY.
        Renamed PIC16FrameOverlay class to PIC16Overlay.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96463 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit eb01b1e85f3c9730759fcb13349b45b0b42d4133
    Author: Johnny Chen <johnny.chen at apple.com>
    Date:   Wed Feb 17 06:31:48 2010 +0000
    
        Added BFI for disassembly only.
    
        A8.6.18  BFI - Bitfield insert (Encoding A1)
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96462 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit c6692fa908a3a3f4437609b0e817f0acd8098292
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 17 06:28:22 2010 +0000
    
        sink special case "cannotyetselect" for intrinsics out of the
        tblgen splatted code into the implementation.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96460 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit f1dd428284e6058052e5a6689b2af2060b838f11
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 17 06:23:39 2010 +0000
    
        Emulate the current isel's "IsChainCompatible" logic for now.
        I'd like to eventually rip it out, but for now producing the
        same selections as the old matcher is more important.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96458 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit f080de44754a95cddca4d9f86dc93e74988f0136
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 17 06:08:25 2010 +0000
    
        properly record chain inputs to complex patterns,
        resolving a fixme.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96457 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 212c5804c459dfe7f23ea3de1941c105c7728af2
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 17 06:07:47 2010 +0000
    
        rename and document some arguments so I don't have to keep
        reverse engineering what they are.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96456 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 8d98c838d5eb47e3c66291ea2e27380f0d3139ef
    Author: Anton Korobeynikov <asl at math.spbu.ru>
    Date:   Wed Feb 17 05:53:11 2010 +0000
    
        Use pointer-wide encoding for LSDA and FDE on Darwin.
        Hopefully, this will fix the remaining issues seen there.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96454 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit eaf82d889ecc0056cbadb355c1153fdf7858686f
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 17 05:35:28 2010 +0000
    
        simplify IsChainCompatible codegen, add comments.  no
        functionality change.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96453 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 0be6757d9bc10b078ddaa9e3987b6b0eaed2e4a0
    Author: Lang Hames <lhames at gmail.com>
    Date:   Wed Feb 17 03:42:51 2010 +0000
    
        Removed an early out which was causing the PBQP allocator to not compute live-in sets or run the rewriter.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96450 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 51e24cb395ef99fbbc6fbe88be989a3f86bd9985
    Author: Dan Gohman <gohman at apple.com>
    Date:   Wed Feb 17 02:39:31 2010 +0000
    
        Fix SCEVExpander's existing PHI reuse checking to recognize the
        case where there are loop-invariant instructions somehow left
        inside the loop, and in a position where they won't dominate
        the IV increment position.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96448 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit c5419f2f9d45ac84f567eff6508a94a292c849e5
    Author: Devang Patel <dpatel at apple.com>
    Date:   Wed Feb 17 02:20:34 2010 +0000
    
        Before setting scope end marker, pay attention to scope begin marker and existing scope end marker, if any. Scope must begin before it ends and nested inlined scope do not truncate surrounding scope.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96445 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 82d7099221326012de1a84a84832e66e2be2a8a3
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 17 02:16:19 2010 +0000
    
        Prep work to handle input chains of matched patterns and checking for
        'ischaincompatible' when a pattern has more than one input chain.  Need
        to do some commenting and cleanup now that I understand how this works.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96443 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 5b423812d6e781c533b537e9beefa593cad45e88
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 17 01:55:54 2010 +0000
    
        daniel remembered why this was needed.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96440 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit c4ab22d6e915d3a1f6acd388c2209a3f4f9ea981
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 17 01:38:01 2010 +0000
    
        add a comment explaining why darwin/i386 uses ## as a comment.
        It's not clear why this is really required, but it was explicitly
        added in r48808 with no real explanation or rdar #.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96438 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit cdbb8357a71f36257d0eee4f35024142806c928d
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 17 01:34:15 2010 +0000
    
        record input chains.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96437 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 4ab37e16af2275b8cb6d3960d83bb26563736822
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 17 01:27:29 2010 +0000
    
        prefix captured value names with $ so they look like
        variables.  Use the fancy OpNo variable instead of i,
        which has the right index including chains.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96436 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 0b4f2e55c0db3873138723b3a5f8de004dab506e
    Author: Sanjiv Gupta <sanjiv.gupta at microchip.com>
    Date:   Wed Feb 17 01:11:53 2010 +0000
    
        Initial implementation of PIC16 Cloner pass.
    
        This pass is supposed to be run on the linked .bc module.
        It traveses the module call graph twice. Once starting from the main function
        and marking each reached function as "ML". Again, starting from the ISR
        and cloning any reachable function that was marked as "ML". After cloning
        the function, it remaps all the call sites in IL functions to call the
        cloned functions.
    
        Currently only marking is being done.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96435 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit e1da86b25d395726d446dbd4814b09e52c060ccd
    Author: Dan Gohman <gohman at apple.com>
    Date:   Wed Feb 17 01:08:57 2010 +0000
    
        Don't check for comments, which vary between subtargets.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96434 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit e78397b57651577bf13613ac6ec6ab4b1b75b3c4
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 17 01:03:09 2010 +0000
    
        improve comments on OPC_Record to say what we're recording a node.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96433 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 0d1673fb026b070b802460077e62c3d8fdd1e004
    Author: Dan Gohman <gohman at apple.com>
    Date:   Wed Feb 17 00:54:58 2010 +0000
    
        Fold bswap(undef) to undef.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96432 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit a93b0de79e649a8d4463ca525a4a950b129db6eb
    Author: Dan Gohman <gohman at apple.com>
    Date:   Wed Feb 17 00:42:19 2010 +0000
    
        Delete some unneeded casts.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96429 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ec933669c4039f33b38cc766982229974ca382ea
    Author: Dan Gohman <gohman at apple.com>
    Date:   Wed Feb 17 00:41:53 2010 +0000
    
        Don't attempt to divide INT_MIN by -1; consider such cases to
        have overflowed.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96428 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit f4d4076386ecb4617e09b8b15e671cdc07c8a1db
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 17 00:41:34 2010 +0000
    
        make the new isel's interpreter loop call the generated
        CheckComplexPattern function.  Though it is logically const,
        I don't have the fortitude to clean up all the targets now,
        and it not being const doesn't block anything.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96426 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 59749a3cb6ae45955865f7e875e7dd38568df5d9
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 17 00:39:26 2010 +0000
    
        improve comments in generated matcher a bit.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96422 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 69957ff9041ce113d7d2c5d41446ddf9c5900e44
    Author: Dan Gohman <gohman at apple.com>
    Date:   Wed Feb 17 00:37:20 2010 +0000
    
        Make the operand and format specifier match, and print all
        64 bits, fixing a variety of problems.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96421 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 4411c2e11d783ee6d4b9a65a48fdc3f5ef03d7e9
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 17 00:31:50 2010 +0000
    
        make the new isel generator plop out a CheckComplexPattern function
        for evaluating complex patterns.  Some cleanup has to happen before
        this can be used though.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96419 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit dfdce68ddbbb43b4a2f2628b58582870e8cc1b81
    Author: Bob Wilson <bob.wilson at apple.com>
    Date:   Wed Feb 17 00:31:29 2010 +0000
    
        Wrap lines to 80 columns and generally try to clean up whitespace and
        indentation.  No functional changes.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96418 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 4d7619e9f971d2299ddf1140b14da3aeeb5b5e36
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 17 00:29:06 2010 +0000
    
        roundss is an sse 4 thing, fix the test on non-sse41 builders
        like llvm-gcc-x86_64-darwin10-selfhost
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96417 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 42675c6528107adcf75cbf2425e88dfe2132f630
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 17 00:11:30 2010 +0000
    
        fix inverted condition.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96416 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 598072cf6deac9bad6c543d0186e6d0982580caa
    Author: Dale Johannesen <dalej at apple.com>
    Date:   Tue Feb 16 23:25:23 2010 +0000
    
        Make g5 target explicit; scheduling affects register choice.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96413 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit fa71393244402d8beffef682b9344b0a404c2ec9
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 16 23:16:25 2010 +0000
    
        complex patterns don't get 'record' nodes, they implicitly
        record all their results.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96412 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 4b8803bdb263d380042e910efe5444b39c9d1b4b
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 16 23:13:59 2010 +0000
    
        clean up some code, eliminate NodeIsComplexPattern, which
        does the same thing as getComplexPatternInfo.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96411 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 5faa9d59ece74fdf5e836ef32d14976500ba6c3f
    Author: Bill Wendling <isanbard at gmail.com>
    Date:   Tue Feb 16 22:47:14 2010 +0000
    
        Make error statement more personal.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96410 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 49e718489de8b969973ec4324acc8060ce11d0fa
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 16 22:38:31 2010 +0000
    
        fix indentation
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96409 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 494c589c39c9549b906398802608b0983adc88be
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 16 22:35:06 2010 +0000
    
        fix rdar://7653908, a crash on a case where we would fold a load
        into a roundss intrinsic, producing a cyclic dag.  The root cause
        of this is badness handling ComplexPattern nodes in the old dagisel
        that I noticed through inspection.  Eliminate a copy of the of the
        code that handled ComplexPatterns by making EmitChildMatchCode call
        into EmitMatchCode.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96408 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 38a65967dec66441c5610ba19dfe35a28272f2b9
    Author: Dale Johannesen <dalej at apple.com>
    Date:   Tue Feb 16 22:31:31 2010 +0000
    
        Adjust register numbers in tests to compensate for the
        new lack of R2.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96407 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 60fd8df8b5bbb2b66af3f97ebeabc8bb27180823
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 16 22:13:43 2010 +0000
    
        filecheckize
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96404 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 11ea1ddcc1b08203a0db0eea4146e93cf792a79c
    Author: Bob Wilson <bob.wilson at apple.com>
    Date:   Tue Feb 16 22:01:59 2010 +0000
    
        Handle tGPR register class in a few more places.  This fixes some llvm-gcc
        build failures due to my fix for pr6111.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96402 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit d44933d247156442c64c8e0ac9c5b4ac121063c2
    Author: Johnny Chen <johnny.chen at apple.com>
    Date:   Tue Feb 16 21:59:54 2010 +0000
    
        Add SMC (Secure Monitor Call) system instruction for disassembly only.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96401 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 86bcc29c3189c775fae8c69f0359b4f9f510b1be
    Author: Dale Johannesen <dalej at apple.com>
    Date:   Tue Feb 16 21:53:27 2010 +0000
    
        Really reserve R2 on PPC Darwin.  PR 6314.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96399 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 14568d790b7e5dab04a4b9c1873a6a69d8055adc
    Author: Devang Patel <dpatel at apple.com>
    Date:   Tue Feb 16 21:39:34 2010 +0000
    
        Use line and column number to distinguish two lexical blocks at the same level.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96395 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 5d473e60e8d1b9d5f2246e0b3b108cd93dcb1aea
    Author: Jim Grosbach <grosbach at apple.com>
    Date:   Tue Feb 16 21:23:02 2010 +0000
    
        80 column cleanup
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96393 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit feaea7beb8e8d2f4cdc8a9b9d0edeb5f443162ec
    Author: Devang Patel <dpatel at apple.com>
    Date:   Tue Feb 16 21:16:08 2010 +0000
    
        New testcase.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96391 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 57fa1e6039d5414abe846d8b8b4a7348b9ca2299
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Tue Feb 16 21:09:44 2010 +0000
    
        Look for SSE and instructions of this form: (and x, (build_vector c1,c2,c3,c4)).
        If there exists a use of a build_vector that's the bitwise complement of the mask,
        then transform the node to
        (and (xor x, (build_vector -1,-1,-1,-1)), (build_vector ~c1,~c2,~c3,~c4)).
    
        Since this transformation is only useful when 1) the given build_vector will
        become a load from constpool, and 2) (and (xor x -1), y) matches to a single
        instruction, I decided this is appropriate as a x86 specific transformation.
        rdar://7323335
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96389 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit d926bc7168536737dcb44b6b15ac11d78dddaaf8
    Author: Jim Grosbach <grosbach at apple.com>
    Date:   Tue Feb 16 21:07:46 2010 +0000
    
        Remove trailing whitespace
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96388 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 74fd8d32929a7b076649f82b218f5d4d9aa0e03a
    Author: Bob Wilson <bob.wilson at apple.com>
    Date:   Tue Feb 16 21:06:42 2010 +0000
    
        Rename SuccessorNumber to GetSuccessorNumber.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96387 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 2d620a400b1479e1a4a37424b9c9fa325907f1ff
    Author: David Greene <greened at obbligato.org>
    Date:   Tue Feb 16 20:50:18 2010 +0000
    
        Add support for emitting non-temporal stores for DAGs marked
        non-temporal.  Fix from r96241 for botched encoding of MOVNTDQ.
    
        Add documentation for !nontemporal metadata.
    
        Add a simpler movnt testcase.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96386 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 2fadab28bfcef8470d12c068616ada11cbd683f5
    Author: Bob Wilson <bob.wilson at apple.com>
    Date:   Tue Feb 16 20:48:55 2010 +0000
    
        Testcase for critical edge splitting with load PRE.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96385 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit fef89ea2a62eaba2e0743530ac3530f00b817039
    Author: Jim Grosbach <grosbach at apple.com>
    Date:   Tue Feb 16 20:42:29 2010 +0000
    
        Update Thumb2 to not use CarryDefIsUnused or CarryDefIsUsed predicates, but
        to have the predicate on the pattern itself instead. Support for the new
        ISel. Remove definitions of CarryDefIsUnused and CarryDefIsUsed since they are
        no longer used anywhere.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96384 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit d8c650aa2c53a07d466ccf6845b7821768aa1d7d
    Author: Jim Grosbach <grosbach at apple.com>
    Date:   Tue Feb 16 20:35:59 2010 +0000
    
        Remove redundant setting of Defs. CPSR is already marked by the block level set of Defs.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96383 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit a9e9c208698b4243e9a9a260ea5b1dbc34dc2694
    Author: Dan Gohman <gohman at apple.com>
    Date:   Tue Feb 16 20:25:07 2010 +0000
    
        Refactor rewriting for PHI nodes into a separate function.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96382 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ee58357256ebbf38229782dd30b8d5bdda0bdfcd
    Author: Jim Grosbach <grosbach at apple.com>
    Date:   Tue Feb 16 20:17:57 2010 +0000
    
        First step in eliminating the CarryDefIsUnused and CarryDefIsUsed predicates.
        They won't work with the new ISel mechanism, as Requires predicates are no
        longer allowed to reference the node being selected. Moving the predicate to
        the patterns instead solves the problem.
    
        This patch handles ARM mode. Thumb2 will follow.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96381 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 77992fea5250cb63b179847da70dc42f91962c35
    Author: Johnny Chen <johnny.chen at apple.com>
    Date:   Tue Feb 16 20:04:27 2010 +0000
    
        Added for disassembly the following instructions:
    
        o Store Return State (SRSW, SRS)
        o Load/Store Coprocessor (LDC/STC and friends)
        o MSR (immediate)
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96380 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit c9b39793e3f4dc0e33f898786ab7d7f7936083d4
    Author: Bob Wilson <bob.wilson at apple.com>
    Date:   Tue Feb 16 19:51:59 2010 +0000
    
        Split critical edges as needed for load PRE.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96378 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 39eaa32127cf3250d6f2c6be289ee036038e5906
    Author: Bob Wilson <bob.wilson at apple.com>
    Date:   Tue Feb 16 19:49:17 2010 +0000
    
        Refactor to share code to find the position of a basic block successor in the
        terminator's list of successors.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96377 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit b7760d0e0606a822021c0159226242f3b007f9e2
    Author: Dan Gohman <gohman at apple.com>
    Date:   Tue Feb 16 19:42:34 2010 +0000
    
        Fix whitespace.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96372 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 6680cd2dc9be8f353f9d5d494127e2c716e7fb38
    Author: Kenneth Uildriks <kennethuil at gmail.com>
    Date:   Tue Feb 16 19:28:02 2010 +0000
    
        Function attributes have index ~0, not 0
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96370 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit c7ce535453a375581f8d9857c5f17715bddbdc5d
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 16 19:19:58 2010 +0000
    
        simplify this code.  In the new world order there is no
        need to scan the entire subtree of the pattern anymore.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96369 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit e1b6280131fc345cd67c6246a800a886cc280c37
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 16 19:15:55 2010 +0000
    
        convert the new matcher to check intermediate nodes for a single
        use and only call IsProfitableToFold/IsLegalToFold on the load
        being folded, like the old dagiselemitter does.  This
        substantially simplifies the code and improves opportunities for
        sharing.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96368 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit d93d4503a10f8e4f7a3a2be7a32e57ab790a0fb9
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 16 19:03:34 2010 +0000
    
        change dag isel emitter to only call 'IsProfitableToFold' on nodes
        with chains.  On interior nodes that lead up to them, we just directly
        check that there is a single use.  This generates slightly more
        efficient code.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96366 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit f25ffc2eaca3ca1720444abe9993baa41380ac8d
    Author: Bob Wilson <bob.wilson at apple.com>
    Date:   Tue Feb 16 17:24:15 2010 +0000
    
        Fix pr6111: Avoid using the LR register for the target address of an indirect
        branch in ARM v4 code, since it gets clobbered by the return address before
        it is used.  Instead of adding a new register class containing all the GPRs
        except LR, just use the existing tGPR class.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96360 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit e1c5b8bfbb203c63720dfb83dce31625b9924a7c
    Author: Duncan Sands <baldrick at free.fr>
    Date:   Tue Feb 16 14:50:09 2010 +0000
    
        Introduce isOpaqueTy and use it rather than isa<OpaqueType>.  Also, move some
        methods to try to have the type predicates be more logically positioned.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96349 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 00f2a6b91ad2dbbce9edfecce9caa47d72ffac93
    Author: Duncan Sands <baldrick at free.fr>
    Date:   Tue Feb 16 11:11:14 2010 +0000
    
        There are two ways of checking for a given type, for example isa<PointerType>(T)
        and T->isPointerTy().  Convert most instances of the first form to the second form.
        Requested by Chris.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96344 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 10b11b5ee8b0dc0c620565411e2ef5c1af4d1ca8
    Author: Benjamin Kramer <benny.kra at googlemail.com>
    Date:   Tue Feb 16 10:25:04 2010 +0000
    
        Minor warning fixes (semicolons, newline at EOF).
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96343 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit f74051bfc6788ab0af465b7629aa213e5c381dcc
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 16 07:26:36 2010 +0000
    
        mark all the generated node predicates 'const'.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96337 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 9e4ed1a4543e88e5697469e24f17e800169c3129
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 16 07:21:10 2010 +0000
    
        generate code for node and pattern predicates.  Note that this won't
        build if enabled, it will fail with constness issues. I'll resolve
        these next.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96336 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 7a6eebb2aebde9f605906bb08ab0b0f1ed228572
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 16 06:52:01 2010 +0000
    
        refactor some code into a local class.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96334 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 2dd2f23953a69ec2c342d5421982db02af3d7f24
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 16 06:15:00 2010 +0000
    
        remove now dead code and fixme.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96333 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 638838d250bc239a714c16a3268cfe6d61013161
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 16 06:14:22 2010 +0000
    
        remove dead code.  This is never generated for any targets in mainline.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96332 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit b6556761e463fa7022b3000a7f674501872f8607
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 16 06:10:58 2010 +0000
    
        add support for the new isel matcher to generate
        (isprofitable|islegal)tofold checks.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96331 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ab38222131e3e43a366e4da26aea0cc8e0ca4b8a
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 16 05:03:17 2010 +0000
    
        make pcrel immediate values relative to the start of the field,
        not the end of the field, fixing rdar://7651978
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96330 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 8b666cda8f23b02e7e37a50baad79e547299977b
    Author: Erick Tryzelaar <idadesub at users.sourceforge.net>
    Date:   Tue Feb 16 03:45:23 2010 +0000
    
        Fix a typo in an LLVMOpcode enum. LLVMTrunk -> LLVMTrunc.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96324 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit d07191c7433f724ab011dc8dd066405b7d6a8543
    Author: Erick Tryzelaar <idadesub at users.sourceforge.net>
    Date:   Tue Feb 16 03:45:17 2010 +0000
    
        Fix some ocaml documentation
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96323 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 6fe8877a1160488bbe6b99bf57e89bd2c8537cca
    Author: Sanjiv Gupta <sanjiv.gupta at microchip.com>
    Date:   Tue Feb 16 03:41:07 2010 +0000
    
        The code section for an ISR has a specific address.
        Currently, whether a function is ISR or not is encoded in the section attribute for that function.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96322 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 0667d716109d2962b78895f11c6569c19ddf39de
    Author: Dale Johannesen <dalej at apple.com>
    Date:   Tue Feb 16 01:57:28 2010 +0000
    
        Handle DBG_VALUE mixed with labels when doing PHI
        elimination.  Before a DBG_VALUE could affect codegen.
        The solution here is imperfect and not final.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96318 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 9bbef3224217647a4ebd7dfa8fd96c0c242bd4e7
    Author: Rafael Espindola <rafael.espindola at gmail.com>
    Date:   Tue Feb 16 01:50:18 2010 +0000
    
        Drop support for the InReg attribute on the ppc backend. This was used by
        llvm-gcc but has been replaced with pad argument which don't need any
        special backend support.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96312 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 74122dc59729d434f36bd9616da6a48ebe710bba
    Author: Dan Gohman <gohman at apple.com>
    Date:   Tue Feb 16 01:42:53 2010 +0000
    
        Split the main for-each-use loop again, this time for GenerateTruncates,
        as it also peeks at which registers are being used by other uses. This
        makes LSR less sensitive to use-list order.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96308 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 56d339fd25e7fab39d24ffb2b9f526f462d70902
    Author: Dale Johannesen <dalej at apple.com>
    Date:   Tue Feb 16 01:27:47 2010 +0000
    
        Reapply 96294; now that I've gotten around to looking
        at older buildbot messages, I see the failure predates
        this patch.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96307 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 146ea06aba961faffacce13ea7ef13bfc1bc0034
    Author: Bill Wendling <isanbard at gmail.com>
    Date:   Tue Feb 16 00:58:02 2010 +0000
    
        Apply patch from http://llvm.org/bugs/attachment.cgi?id=4136 now that PR5004 is
        finished.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96304 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 308a961045b0f98cbb7ec563d714af28ea22cc57
    Author: Dale Johannesen <dalej at apple.com>
    Date:   Tue Feb 16 00:43:58 2010 +0000
    
        Something broke.  Hard to believe it was this patch
        but it's harder to believe it's the other candidate,
        so reverting.  Temporarily I hope.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96303 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 9e08033bba79f68e5026dba6bff8b2c88f4969f0
    Author: Dan Gohman <gohman at apple.com>
    Date:   Tue Feb 16 00:20:08 2010 +0000
    
        When reusing an existing PHI node in a loop, be even more
        strict about the requirements.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96301 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 32e19800e215b85fa3add4e80dd02a41cf0c57ce
    Author: Bob Wilson <bob.wilson at apple.com>
    Date:   Mon Feb 15 23:43:47 2010 +0000
    
        Put repeated empty pattern into the AQI instruction class.
        We could almost use a multiclass for the signed/unsigned instructions, but
        there are only 6 of them so I guess it's not worth it.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96297 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 3f4ee011ff7bf7b42502ce88731bcd87271847e9
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Mon Feb 15 23:16:53 2010 +0000
    
        Fix a memory leak. Patch by Nicolas Geoffray.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96295 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 8d3f45c5a477928f872cba01f9224955b3a3b24e
    Author: Dale Johannesen <dalej at apple.com>
    Date:   Mon Feb 15 23:05:03 2010 +0000
    
        More handling of DBG_VALUE.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96294 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 865e8c7081d5ab11222986a6798f1ce58a618080
    Author: Anton Korobeynikov <asl at math.spbu.ru>
    Date:   Mon Feb 15 22:55:13 2010 +0000
    
        Add missed entry to cmake build list file
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96292 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit a55abaffd833a86872e2e33b00eafda8a15c36f9
    Author: Anton Korobeynikov <asl at math.spbu.ru>
    Date:   Mon Feb 15 22:38:25 2010 +0000
    
        Use ttype encoding consistently
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96290 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 38d61a078546b3e111a46bc425ce585b76cdf5d2
    Author: Anton Korobeynikov <asl at math.spbu.ru>
    Date:   Mon Feb 15 22:38:10 2010 +0000
    
        Fix a silly darwin-only typo introduced during merge.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96289 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit cfda2e31ac49f798133c388273797c2b542de9e9
    Author: Anton Korobeynikov <asl at math.spbu.ru>
    Date:   Mon Feb 15 22:37:53 2010 +0000
    
        Move TLOF implementations to libCodegen to resolve layering violation.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96288 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit d4200bc29ff68ab1594cda5b2eee048e0c8359eb
    Author: Anton Korobeynikov <asl at math.spbu.ru>
    Date:   Mon Feb 15 22:36:41 2010 +0000
    
        It turns out that we emitted completely wrong common EH frame since the early beginning! The "z" CIE augmentation mark indicates that there is an extra word containing the size of augmentation section. However, even for frames w/o any augmentation data we emitted size uleb! (this is the case of "unwinding through C code"). Thus frame moves information was emitterd completely wrong.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96287 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit fb1b1a8e83983d1b587f4b0366399ef73ae8b0ca
    Author: Anton Korobeynikov <asl at math.spbu.ru>
    Date:   Mon Feb 15 22:36:26 2010 +0000
    
        Add suffix for stubs, so we won't have name clashes with private symbols.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96286 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit a8b5cf127ff2b6bc0058933115e479a5d2d19605
    Author: Anton Korobeynikov <asl at math.spbu.ru>
    Date:   Mon Feb 15 22:35:59 2010 +0000
    
        Preliminary patch to improve dwarf EH generation - Hooks to return Personality / FDE / LSDA / TType encoding depending on target / options (e.g. code model / relocation model) - MCIzation of Dwarf EH printer to use encoding information - Stub generation for ELF target (needed for indirect references) - Some other small changes here and there
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96285 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 83540cf4ee16238a036905f916ff450beef5136b
    Author: Nick Lewycky <nicholas at mxc.ca>
    Date:   Mon Feb 15 22:09:09 2010 +0000
    
        Teach the verifier to check the condition on a branch and ensure that it has
        'i1' type.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96282 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit dc3c0a23abd0dde7266c4a26a94da33ad11dfa9a
    Author: Jakob Stoklund Olesen <stoklund at 2pi.dk>
    Date:   Mon Feb 15 22:03:29 2010 +0000
    
        Fix PR6300.
    
        A virtual register can be used before it is defined in the same MBB if the MBB
        is part of a loop. Teach the implicit-def pass about this case.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96279 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 3aa3691a322badcabcf0507fc5d418af3a245c21
    Author: Bob Wilson <bob.wilson at apple.com>
    Date:   Mon Feb 15 21:56:40 2010 +0000
    
        Last week we were generating code with duplicate induction variables in this
        test, but the problem seems to have gone away today.  Add a check to make sure
        it doesn't come back.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96277 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 64bc51ccf6c4d6feb599bb3926dd6be78c47ed0a
    Author: Nick Lewycky <nicholas at mxc.ca>
    Date:   Mon Feb 15 21:52:04 2010 +0000
    
        Fix crash in VerifyType when checking Contexts. Because there may not be a
        Module (we were called with verifyFunction and an unowned Function) we can't
        rely on Mod->getContext().
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96275 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit fce19f702065e5508104b97d398b421b0ae15548
    Author: Nick Lewycky <nicholas at mxc.ca>
    Date:   Mon Feb 15 21:27:56 2010 +0000
    
        Don't try to materialize a function that isn't materializable anyways. This
        fixes a crash using FPM on a Function that isn't owned by a Module.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96273 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit c5b71ecaa3ebeb3b1cab0dcffac87ea2234e4ae2
    Author: Nick Lewycky <nicholas at mxc.ca>
    Date:   Mon Feb 15 21:27:20 2010 +0000
    
        A function with no Module owner isn't materializable.  This fixes F->dump() for
        functions not embedded within modules.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96272 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit bdf8ea5260cbc0da97b97c6375f5a08f91f544f0
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Mon Feb 15 21:14:50 2010 +0000
    
        remove empty file.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96271 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 29fb7359e9c95c60e25d6c6ec04226258e2f23d1
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Mon Feb 15 21:08:22 2010 +0000
    
        Simplify.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96269 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 2701109863eb6d7429f7466872be024975d250f6
    Author: Bill Wendling <isanbard at gmail.com>
    Date:   Mon Feb 15 20:53:17 2010 +0000
    
        Remove c++ style comments from c header.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96266 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit aa926c2fa04593fcba3ac8c2be1e2d190de2a43e
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Mon Feb 15 20:53:01 2010 +0000
    
        revert r96241.  It breaks two regression tests, isn't documented,
        and the testcase needs improvement.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96265 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 5649118a2dbf2c08001b2fbb0d14368452a170b1
    Author: Bill Wendling <isanbard at gmail.com>
    Date:   Mon Feb 15 20:50:51 2010 +0000
    
        Renumber Instruction enums in llvm-c.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96264 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 06cbf699410d304f30bae868d77c24dd4d4c06db
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Mon Feb 15 20:47:49 2010 +0000
    
        fix PR6305 by handling BlockAddress in a helper function
        called by jump threading.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96263 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 6c2a2ee1e16b8ea0e06b90e6144b8c530a02ba47
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Mon Feb 15 19:41:07 2010 +0000
    
        Split SelectionDAGISel::IsLegalAndProfitableToFold to
        IsLegalToFold and IsProfitableToFold. The generic version of the later simply checks whether the folding candidate has a single use.
    
        This allows the target isel routines more flexibility in deciding whether folding makes sense. The specific case we are interested in is folding constant pool loads with multiple uses.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96255 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 1c2c36ec20ff2725c64b0f0abae8d31cfbedd6b5
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Mon Feb 15 18:55:04 2010 +0000
    
        comment fix.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96248 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 22592eb38c87f396aa04c046a16e83045e6baea3
    Author: David Greene <greened at obbligato.org>
    Date:   Mon Feb 15 17:02:56 2010 +0000
    
        Add support for emitting non-temporal stores for DAGs marked
        non-temporal.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96241 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 06fd33bfbf6f211c48b4fd3ceeb04a3e110567da
    Author: David Greene <greened at obbligato.org>
    Date:   Mon Feb 15 17:00:31 2010 +0000
    
        Add non-temporal flags and remove an assumption of default arguments.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96240 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 6b2f30ed619ffc3bcb0e661cad06160cc4ecc437
    Author: David Greene <greened at obbligato.org>
    Date:   Mon Feb 15 16:57:43 2010 +0000
    
        Remove an assumption of default arguments.  This is in anticipation of a
        change to SelectionDAG build APIs.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96239 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 1259402d5897c33be616a852ed4562de73a676b7
    Author: David Greene <greened at obbligato.org>
    Date:   Mon Feb 15 16:57:13 2010 +0000
    
        Remove an assumption of default arguments.  This is in anticipation of a
        change to SelectionDAG build APIs.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96238 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 4b152e3a7279b532f9341c9a0d68d3bd0d5b9820
    Author: David Greene <greened at obbligato.org>
    Date:   Mon Feb 15 16:57:02 2010 +0000
    
        Remove an assumption of default arguments.  This is in anticipation of a
        change to SelectionDAG build APIs.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96237 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 61b1ae04b047927e8d446379ead249b894870b6b
    Author: David Greene <greened at obbligato.org>
    Date:   Mon Feb 15 16:56:53 2010 +0000
    
        Remove an assumption of default arguments.  This is in anticipation of a
        change to SelectionDAG build APIs.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96236 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 633141d5738691281f96cfa0785299001d9dfa69
    Author: David Greene <greened at obbligato.org>
    Date:   Mon Feb 15 16:56:34 2010 +0000
    
        Remove an assumption of default arguments.  This is in anticipation of a
        change to SelectionDAG build APIs.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96235 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit c534755355037f2a75b39518aaa3a48f341c1253
    Author: David Greene <greened at obbligato.org>
    Date:   Mon Feb 15 16:56:22 2010 +0000
    
        Remove an assumption of default arguments.  This is in anticipation of a
        change to SelectionDAG build APIs.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96234 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 20cbce0f2c3e4ec73b27fd36b34babdcd6ce942a
    Author: David Greene <greened at obbligato.org>
    Date:   Mon Feb 15 16:56:10 2010 +0000
    
        Remove an assumption of default arguments.  This is in anticipation of a
        change to SelectionDAG build APIs.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96233 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ec311a98211de0c5949700e7196a67cc24b5666e
    Author: David Greene <greened at obbligato.org>
    Date:   Mon Feb 15 16:55:58 2010 +0000
    
        Remove an assumption of default arguments.  This is in anticipation of a
        change to SelectionDAG build APIs.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96232 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 25e1f1a2577aa77accd8f74f7a70ae85701b5706
    Author: David Greene <greened at obbligato.org>
    Date:   Mon Feb 15 16:55:37 2010 +0000
    
        Remove an assumption of default arguments.  This is in anticipation of a
        change to SelectionDAG build APIs.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96231 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 31403f268e554af4c9764775df246d61762133b7
    Author: David Greene <greened at obbligato.org>
    Date:   Mon Feb 15 16:55:24 2010 +0000
    
        Remove an assumption of default arguments.  This is in anticipation of a
        change to SelectionDAG build APIs.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96230 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 33f0e02d5336a1719fb7b2d3c9c72b22ede654bb
    Author: David Greene <greened at obbligato.org>
    Date:   Mon Feb 15 16:55:07 2010 +0000
    
        Remove an assumption of default arguments.  This is in anticipation of a
        change to SelectionDAG build APIs.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96229 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 82394ef82056375bf752676859c219791996319e
    Author: David Greene <greened at obbligato.org>
    Date:   Mon Feb 15 16:53:33 2010 +0000
    
        Remove an assumption of default arguments.  This is in anticipation of a
        change to SelectionDAG build APIs.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96228 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit cf22e0946e6fe86ccd4c421a4b22ce7214f7cf5d
    Author: David Greene <greened at obbligato.org>
    Date:   Mon Feb 15 16:49:52 2010 +0000
    
        Remove an assumption of default arguments.  This is in anticipation of a
        change to SelectionDAG build APIs.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96227 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit a870e9d00ccdf325bd441638e79d0ea799233835
    Author: David Greene <greened at obbligato.org>
    Date:   Mon Feb 15 16:48:31 2010 +0000
    
        Add non-temporal flags to MachineMemOperand.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96226 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit a1acb80d4e42f7a5a0fff08737d068afb5601149
    Author: Duncan Sands <baldrick at free.fr>
    Date:   Mon Feb 15 16:12:20 2010 +0000
    
        Uniformize the names of type predicates: rather than having isFloatTy and
        isInteger, we now have isFloatTy and isIntegerTy.  Requested by Chris!
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96223 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit b743e68144f4a59dac95dc80251fd794ba58e8d8
    Author: Oscar Fuentes <ofv at wanadoo.es>
    Date:   Mon Feb 15 15:17:05 2010 +0000
    
        CMake: Fixed syntax in conditional.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96221 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 011dfdfde2e50769b9f276ad614bd888b12fc7ae
    Author: Andrew Lenharth <alenhar2 at cs.uiuc.edu>
    Date:   Mon Feb 15 15:00:44 2010 +0000
    
        Fix changes from r75027
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96220 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit d31ee026569a5f24c445267e016cf9910583ecd1
    Author: Dan Gohman <gohman at apple.com>
    Date:   Mon Feb 15 10:28:37 2010 +0000
    
        When testing whether a given SCEV depends on a temporary symbolic
        name, test whether the SCEV itself is that temporary symbolic name,
        in addition to checking whether the symbolic name appears as a
        possibly-indirect operand.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96216 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 657373b3503c19e66e2dd7a396f14b8986883f81
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Mon Feb 15 08:04:42 2010 +0000
    
        Check in the first big step of rewriting DAGISelEmitter to
        produce a table based matcher instead of gobs of C++ Code.
    
        Though it's not done yet, the shrinkage seems promising,
        the table for the X86 ISel is 75K and still has a lot of
        optimization to come (compare to the ~1.5M of .o generated
        the old way, much of which will go away).
    
        The code is currently disabled by default (the #if 0 in
        DAGISelEmitter.cpp).  When enabled it generates a dead
        SelectCode2 function in the DAGISel Header which will
        eventually replace SelectCode.
    
        There is still a lot of stuff left to do, which are
        documented with a trail of FIXMEs.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96215 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 0dc91ca186b2e7dd7c308c4e6cf7d3e7969ca5e3
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Mon Feb 15 07:11:34 2010 +0000
    
        give SDValue an operator->, allowing V->isTargetOpcode() and
        many other natural things.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96214 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit f02f4757dc20afc15f8a81a882b4f1ecefd00077
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Mon Feb 15 06:39:31 2010 +0000
    
        don't make insanely large node numbers for no reason,
        packing somewhat densely is better than not.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96213 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit a4aac10ec660a06e22dce191128eb5024ab21518
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Mon Feb 15 06:38:41 2010 +0000
    
        no need to add the instruction count anymore.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96212 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 1bba1bac8b95c78b92a4a72b5705e2a25713755f
    Author: Mikhail Glushenkov <foldr at codedgers.com>
    Date:   Mon Feb 15 03:17:06 2010 +0000
    
        Revert r96130 ("Forward parameter options as '-option=param'").
    
        This behaviour must be configurable.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96210 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit bd9b922998ba89ea8f5d1189eace6e32789abaad
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Mon Feb 15 02:18:26 2010 +0000
    
        enhance raw_svector_ostream::write_impl to work with unbuffered streams,
        which may call write_impl on things that are not the usual buffer.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96209 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 55386b01a4cecd00ced70506053c42a484377f97
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Mon Feb 15 02:17:50 2010 +0000
    
        make PadToColumn return the stream so you can use:
         OS.PadToColumn(42) << "foo";
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96208 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 2fb413bb51d0dee81a73bd9172f9143a34131f00
    Author: Dale Johannesen <dalej at apple.com>
    Date:   Mon Feb 15 01:45:47 2010 +0000
    
        Ignore DBG_VALUE in a couple more places.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96207 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit f26cfe1cb289c64d1b4837ee27cf8a82c807c52b
    Author: Dan Gohman <gohman at apple.com>
    Date:   Mon Feb 15 00:21:43 2010 +0000
    
        When restoring a saved insert location, check to see if the saved
        insert location has become an "inserted" instruction since the time
        it was saved. If so, advance to the first non-"inserted" instruction.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96203 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ace26149d15397912b33d27b2581d5c8152ff748
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sun Feb 14 22:33:49 2010 +0000
    
        constize
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96199 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit e8205a02f245f50066f35d18b185b10f6991437a
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sun Feb 14 22:22:58 2010 +0000
    
        clean up a bunch of code, move some random predicates
        on TreePatternNode to be methods on TreePatternNode.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96197 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit a7345cb780331e29aaf65aac22dd0fa47cb2ab3a
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sun Feb 14 21:53:19 2010 +0000
    
        mark "addr" as having type "iPTR", eliminating some type comparisons
        in hte generated dag isel fil.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96193 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit d61d15ec8e1c357e5b95d2cb5165134f8a969d49
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sun Feb 14 21:11:53 2010 +0000
    
        remove the DisablePatternForFastISel predicate, which is a check
        that predated -fast-isel which attempted to speed up the dag pattern
        matchers at -O0.  Since fast-isel is around, this is basically
        obsolete and removing it shrinks the generated dag isels.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96188 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 5e3d5991f3236a4d47a10fed9b3a49fdac06e873
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sun Feb 14 21:10:33 2010 +0000
    
        add an insertion operator.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96187 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 9579a01585fd387c4d3d4dcc422b6adcec0d91d4
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sun Feb 14 21:10:15 2010 +0000
    
        tidy up
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96186 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 99fca24dccf031de508b81747ae8370f86360845
    Author: Dan Gohman <gohman at apple.com>
    Date:   Sun Feb 14 18:51:39 2010 +0000
    
        Fix whitespace.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96179 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit c406240f44cb131e976cb4d51b7ab83a7b0b0ed9
    Author: Dan Gohman <gohman at apple.com>
    Date:   Sun Feb 14 18:51:20 2010 +0000
    
        Fix a comment.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96178 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 82460b98c2e062fd5148427a9cb1cb78a4909769
    Author: Dan Gohman <gohman at apple.com>
    Date:   Sun Feb 14 18:50:49 2010 +0000
    
        When complicated expressions are broken down into subexpressions
        with multiplication by constants distributed through, occasionally
        those subexpressions can include both x and -x. For now, if this
        condition is discovered within LSR, just prune such cases away,
        as they won't be profitable. This fixes a "zero allocated in a
        base register" assertion failure.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96177 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 40742a3a3882348c797524c7c86a9ec5814725aa
    Author: Sanjiv Gupta <sanjiv.gupta at microchip.com>
    Date:   Sun Feb 14 18:27:42 2010 +0000
    
        fixes to pagesel/banksel inserter.
        1. restore these across direct/indirect calls.
        2. restore pagesel for any macros with gotos.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96175 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 33e8473580e0fbf1f3a69fdc43933f5587017f55
    Author: Anton Korobeynikov <asl at math.spbu.ru>
    Date:   Sun Feb 14 18:25:41 2010 +0000
    
        Forgot to commit the header
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96174 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit cc2ace8a01bf1365ef8ee7b51c5c11ae8948fa0d
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sun Feb 14 18:20:09 2010 +0000
    
        follow-on to PR6280
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96172 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 47600ebabd031883ce4391d8b6cb731be4fdb52a
    Author: Anton Korobeynikov <asl at math.spbu.ru>
    Date:   Sun Feb 14 15:19:54 2010 +0000
    
        Drop winmcasminfo and use normal AT&T COFF for all windows targets.
        Otherwise AT&T asm printer is used with non-compatible MCAsmInfo and
        there is no way to override this behaviour.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96165 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 3efdcb0c01aaf4f8ce026b8951a1355c07ea83ac
    Author: Johnny Chen <johnny.chen at apple.com>
    Date:   Sun Feb 14 06:32:20 2010 +0000
    
        Try to factorize the specification of saturating add/subtract operations a bit,
        as suggested by Bob Wilson.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96153 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 8a3f2908bb5c8bb7a7a431b46da88c0312fbf07f
    Author: Dan Gohman <gohman at apple.com>
    Date:   Sun Feb 14 03:21:49 2010 +0000
    
        Actually, this code doesn't have to be quite so conservative in
        the no-TLI case. But it should still default to declining the
        transformation.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96152 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 8bbd4650fd1deb087fc0d14ef7ddd75433a56f61
    Author: Dan Gohman <gohman at apple.com>
    Date:   Sun Feb 14 03:12:47 2010 +0000
    
        In rememberInstruction, if the value being remembered is the
        current insertion point, advance the current insertion point.
        This avoids a use-before-def situation in a testcase extracted
        from clang which is difficult to reduce to a reasonable-sized
        regression test.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96151 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 0c74bfa2a1ddd7a2ef248b0230fedf9876b8f575
    Author: Dan Gohman <gohman at apple.com>
    Date:   Sun Feb 14 02:48:58 2010 +0000
    
        Simplify this code; no need for a custom subclass if it doesn't need
        to override anything from the parent class.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96150 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 74fca1b9ff661b978f7618e0728f73e0fdd54a6d
    Author: Dan Gohman <gohman at apple.com>
    Date:   Sun Feb 14 02:47:26 2010 +0000
    
        Remove a 'protected' keyword, now that SCEVExpander is no longer
        intended to be subclassed.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96149 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit f264808f2cb4a8b38128c3a7ae2b4f1d879d3a4e
    Author: Dan Gohman <gohman at apple.com>
    Date:   Sun Feb 14 02:45:21 2010 +0000
    
        Don't attempt aggressive post-inc uses if TargetLowering is not available,
        because profitability can't be sufficiently approximated.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96148 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 2aed470b47f8328773c0ddb95cf580fd3925d934
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Sun Feb 14 01:47:19 2010 +0000
    
        2.7: Note that DataTypes.h moved.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96143 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit eead7ba8da9d823e3bc0a65749598cab9884a89f
    Author: John McCall <rjmccall at apple.com>
    Date:   Sat Feb 13 23:40:16 2010 +0000
    
        Make LSR not crash if invoked without target lowering info, e.g. if invoked
        from opt.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96135 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 44f9090da450cf9dacfb75992fd9aeb26f68fc4d
    Author: Eric Christopher <echristo at apple.com>
    Date:   Sat Feb 13 23:38:01 2010 +0000
    
        Fix a problem where we had bitcasted operands that gave us
        odd offsets since the bitcasted pointer size and the offset pointer
        size are going to be different types for the GEP vs base object.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96134 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 8042b4e7edc9d542d2e58143943ffb3beaed9390
    Author: Mikhail Glushenkov <foldr at codedgers.com>
    Date:   Sat Feb 13 22:37:28 2010 +0000
    
        Forward parameter options as '-option=parameter'.
    
        Some tools do not like the '-option parameter' form. Should this be
        configurable?
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96130 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 92cd5e38ac6edcef4b749c69b80746c4259989a2
    Author: Mikhail Glushenkov <foldr at codedgers.com>
    Date:   Sat Feb 13 22:37:13 2010 +0000
    
        Support some more Darwin-only options.
    
        We really need a conditional compilation mechanism...
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96129 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 49f2808120c4d0f15687725809b0e536474e791a
    Author: Mikhail Glushenkov <foldr at codedgers.com>
    Date:   Sat Feb 13 22:37:00 2010 +0000
    
        Support -mfix-and-continue properly.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96128 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 50d6b85789129c236b23be735e1b32dd63abc8ca
    Author: Mikhail Glushenkov <foldr at codedgers.com>
    Date:   Sat Feb 13 22:36:43 2010 +0000
    
        Revert r94752, turns out we don't need to touch these options.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96127 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit f23debd520b74ad86a216ada0e01f7fd0ffc61e2
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Sat Feb 13 22:23:47 2010 +0000
    
        Trim trailing spaces (aka, trigger rebuild).
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96126 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 1b0a6878e6c460e05f4b03c46bac57a7fa59a59c
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sat Feb 13 20:06:50 2010 +0000
    
        pull a bunch of huge inline methods in the PatternCodeEmitter
        class out of line.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96113 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 663660c70218e3a2d5278c28c9565a818151c332
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sat Feb 13 19:16:53 2010 +0000
    
        teach the encoder to handle pseudo instructions like FP_REG_KILL,
        encoding them into nothing.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96110 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 30b038f436af6b6fd4628abf88d49d40c23d0fc1
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sat Feb 13 19:07:06 2010 +0000
    
        remove dead code.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96109 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit e253572d2fad7b182b894cbc7289ffc3375560f6
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Sat Feb 13 09:45:59 2010 +0000
    
        MCAssembler: Fix pcrel relocations. Oh and,
        --
        ddunbar at ozzy:tmp$ clang -m32 -integrated-as hello.c && ./a.out
        hello world!
        --
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96096 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit cf1ebe1dbfdd13d852f13bf8d6974f3f5d87a0d4
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Sat Feb 13 09:29:02 2010 +0000
    
        MC/Mach-O: Start emitting fixups/relocations for instructions.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96095 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit bc7fba3c3fed472e1ad8dc3e649dd60482500e98
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Sat Feb 13 09:28:54 2010 +0000
    
        MCAssembler: Switch MCAsmFixup to storing MCFixupKind instead of just a size.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96094 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 3f39f69797b8f84d4a40ab7ba02a93f55996444c
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Sat Feb 13 09:28:43 2010 +0000
    
        MCAssembler: Sink fixup list into MCDataFragment.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96093 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 6e60008ce79947b3de0cfaf1db17750a162c93aa
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Sat Feb 13 09:28:32 2010 +0000
    
        MCAssembler: Switch MCFillFragment to only taking constant values. Symbolic expressions can always be emitted as data + fixups.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96092 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 09b30df90d48aca2e01f3f79e5067796f221f058
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Sat Feb 13 09:28:22 2010 +0000
    
        MC/Mach-O: Implement EmitValue using data fragments + fixups instead of fill fragment.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96091 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 290d22e0420d15aa4ea88760f8e3e4dacc97892f
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Sat Feb 13 09:28:15 2010 +0000
    
        MCAssembler: Start applying fixups in the data section.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96090 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit fb1e5f4b351ffa37946abf905337573a8dc0f70b
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Sat Feb 13 09:28:03 2010 +0000
    
        MCAssembler: Add assorted dump() methods.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96089 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ed2a7790092b11455a8595c78c875f5f975e4162
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Sat Feb 13 09:27:52 2010 +0000
    
        X86: Move extended MCFixupKinds into X86FixupKinds.h
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96088 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ca1cd7f210bbbb36d3124bf4acc3a04631042752
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sat Feb 13 05:35:08 2010 +0000
    
        Split some code out to a helper function (FindReusablePredBB)
        and add a doxygen comment.
    
        Cache the phi entry to avoid doing tons of
        PHINode::getBasicBlockIndex calls in the common case.
    
        On my insane testcase from re2c, this speeds up CGP from
        617.4s to 7.9s (78x).
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96083 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit cdfc77eb6fbafeed46c78bc811fcc2209946c066
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sat Feb 13 05:01:14 2010 +0000
    
        Speed up codegen prepare from 3.58s to 0.488s.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96081 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 74a9792208d00e0f761b05f81ffeafbace02c098
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sat Feb 13 04:24:19 2010 +0000
    
        PHINode::getBasicBlockIndex is O(n) in the number of inputs
        to a PHI, avoid it in the common case where the BB occurs
        in the same index for multiple phis.  This speeds up CGP on
        an insane testcase from 8.35 to 3.58s.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96080 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit b57f90e32d5fe848d9f74f11a28bc850bde69e87
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sat Feb 13 04:15:26 2010 +0000
    
        iterate over preds using PHI information when available instead of
        using pred_begin/end.  It is much faster.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96079 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ecdb218b1b4d1f8ab7bf8d17b0c9ec123e8cd566
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sat Feb 13 04:04:42 2010 +0000
    
        speed up CGP a bit by scanning predecessors through phi operands
        instead of with pred_begin/end.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96078 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit a17ee30ede09175873860c5dead5c87c4f998729
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sat Feb 13 03:42:24 2010 +0000
    
        add encoder support and tests for rdtscp
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96076 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit d12893a3644282505cc9646c5b105377b431f48a
    Author: Johnny Chen <johnny.chen at apple.com>
    Date:   Sat Feb 13 02:51:09 2010 +0000
    
        Add SETEND and BXJ instructions for disassembly only.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96075 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 16468d9e438555645102fbb2778432bd35abd4c3
    Author: Sean Callanan <scallanan at apple.com>
    Date:   Sat Feb 13 02:06:11 2010 +0000
    
        Added the rdtscp instruction to the x86 instruction
        tables.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96073 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 0cf36cd25850354adaf0f3edf3de938e0ec3bc80
    Author: Jakob Stoklund Olesen <stoklund at 2pi.dk>
    Date:   Sat Feb 13 02:06:10 2010 +0000
    
        Fix PR6283.
    
        When coalescing with a physreg, remember to add imp-def and imp-kill when
        dealing with sub-registers.
    
        Also fix a related bug in VirtRegRewriter where substitutePhysReg may
        reallocate the operand list on an instruction and invalidate the reg_iterator.
        This can happen when a register is mentioned twice on the same instruction.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96072 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 8f5f11fcbf30f78b7a5329a531e27f245db19c45
    Author: Dan Gohman <gohman at apple.com>
    Date:   Sat Feb 13 02:06:02 2010 +0000
    
        Fix a pruning heuristic which implicitly assumed that SmallPtrSet is
        deterministically sorted.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96071 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit eff3bca8f97276e92e90f8d56c9e4291a66c4341
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Sat Feb 13 01:56:41 2010 +0000
    
        Teach MachineFrameInfo to track maximum alignment while stack objects are being
        created. This ensures it's updated at all time. It means targets which perform
        dynamic stack alignment would know whether it is required and whether frame
        pointer register cannot be made available register allocation.
        This is a fix for rdar://7625239. Sorry, I can't create a reasonably sized test
        case.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96069 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 0e628ba996e2e2af6de56252cca6e53f426301b7
    Author: Jakob Stoklund Olesen <stoklund at 2pi.dk>
    Date:   Sat Feb 13 01:51:53 2010 +0000
    
        Enable the inlinehint attribute in the Inliner.
    
        Functions explicitly marked inline will get an inlining threshold slightly
        more aggressive than the default for -O3. This means than -O3 builds are
        mostly unaffected while -Os builds will be a bit bigger and faster.
    
        The difference depends entirely on how many 'inline's are sprinkled on the
        source.
    
        In the CINT2006 suite, only these tests are significantly affected under -Os:
    
                       Size   Time
        471.omnetpp   +1.63% -1.85%
        473.astar     +4.01% -6.02%
        483.xalancbmk +4.60%  0.00%
    
        Note that 483.xalancbmk runs too quickly to give useful timing results.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96066 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 8d3a51e5f880151165ac69bba2515f328ed66515
    Author: Sean Callanan <scallanan at apple.com>
    Date:   Sat Feb 13 01:48:34 2010 +0000
    
        Fixed encodings for invlpg, invept, and invvpid.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96065 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 58d70fd72375c42ccbb96705419ed1e13a44fdc7
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Sat Feb 13 01:28:07 2010 +0000
    
        MC/AsmParser: Attempt to constant fold expressions up-front. This ensures we avoid fixups for obvious cases like '-(16)'.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96064 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit dbc39e6574315ebfefa022c80b089212f9bb796e
    Author: Johnny Chen <johnny.chen at apple.com>
    Date:   Sat Feb 13 01:21:01 2010 +0000
    
        Added a bunch of saturating add/subtract instructions for disassembly only.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96063 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 3116cb4e9495b87fdab0c951cc7d155f6b33b6c3
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sat Feb 13 00:49:29 2010 +0000
    
        rip out the 'heinous' x86 MCCodeEmitter implementation.
        We still have the templated X86 JIT emitter, *and* the
        almost-copy in X86InstrInfo for getting instruction sizes.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96059 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 7045e8c400a5496101069eb11da81da4a40ccad0
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Sat Feb 13 00:41:14 2010 +0000
    
        remove special cases for vmlaunch, vmresume, vmxoff, and swapgs
        fix swapgs to be spelled right.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96058 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 62b451b2ee84750519f2508d2945ed576a1cd034
    Author: Bob Wilson <bob.wilson at apple.com>
    Date:   Sat Feb 13 00:31:44 2010 +0000
    
        Besides removing phi cycles that reduce to a single value, also remove dead
        phi cycles.  Adjust a few tests to keep dead instructions from being optimized
        away.  This (together with my previous change for phi cycles) fixes Apple
        radar 7627077.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96057 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit a7f18489ed04021e50814b8b8232e2c303f5bd89
    Author: Dan Gohman <gohman at apple.com>
    Date:   Sat Feb 13 00:19:39 2010 +0000
    
        Override dominates and properlyDominates for SCEVAddRecExpr, as a
        SCEVAddRecExpr doesn't necessarily dominate blocks merely dominated
        by all of its operands. This fixes an abort compiling 403.gcc.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96056 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 96b7ae4a9f1f68fd1cf9ec8c8bd828aa40fdf7c5
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Sat Feb 13 00:17:21 2010 +0000
    
        MC/X86: Push immediate operands as immediates not expressions when possible.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96055 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 8587b0bf8eb4a2d867b2a0243b4a115221df45dd
    Author: Jeffrey Yasskin <jyasskin at google.com>
    Date:   Sat Feb 13 00:03:17 2010 +0000
    
        Make PassRegistrar thread-safe since it can be modified by code running in
        separate LLVMContexts.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96051 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 11203379493732fa422589f5c9ff46e7ae4e17c3
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Fri Feb 12 23:54:57 2010 +0000
    
        Remove special cases for [LM]FENCE, MONITOR and MWAIT from
        encoder and decoder by using new MRM_ forms.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96048 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 8002ba66e96485214e3c57b43b4d6eb7706522d1
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Fri Feb 12 23:46:48 2010 +0000
    
        add some disassemble testcases for weird instructions
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96045 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit a37c9b5a95253eb24d2658d55adb1c73b605c915
    Author: Sean Callanan <scallanan at apple.com>
    Date:   Fri Feb 12 23:39:46 2010 +0000
    
        Reworked the Intel disassembler to support instructions
        whose opcodes extend into the ModR/M field using the
        Form field of the instruction rather than by special
        casing each instruction.  Commented out the special
        casing of VMCALL, which is the first instruction to use
        this special form.  While I was in the neighborhood,
        added a few comments for people modifying the Intel
        disassembler.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96043 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 62574fd778f9c1cd9b8e1404d1ad92daa0e8110f
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Fri Feb 12 23:24:09 2010 +0000
    
        implement the rest of correct x86-64 encoder support for
        rip-relative addresses, and add a testcase.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96040 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 3aaba2b64692bb1b59451546fba55b4d06fe5df0
    Author: Dale Johannesen <dalej at apple.com>
    Date:   Fri Feb 12 23:16:24 2010 +0000
    
        Add the problem I just hacked around in 96015/96020.
        The solution there produces correct code, but is seriously
        deficient in several ways.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96039 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 5978124b36300af6cb60dfd56c4200d4156eeb0f
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Fri Feb 12 23:12:47 2010 +0000
    
        give MCCodeEmitters access to the current MCContext.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96038 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit faa7feddabee6e3f294785114ef824326268edf4
    Author: Jeffrey Yasskin <jyasskin at google.com>
    Date:   Fri Feb 12 23:05:31 2010 +0000
    
        Make JIT::runFunction clean up the generated stub function.
    
        Patch by Shivram K!
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96037 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 0609b1e6d69aa82937e6f54af73c92c6596252da
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Fri Feb 12 23:00:36 2010 +0000
    
        implement infrastructure to support fixups for rip-rel
        addressing.  This isn't complete because I need an MCContext
        to generate new MCExprs.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96036 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 2ceb228ee2b5482144e935cbe17928f60648c601
    Author: Johnny Chen <johnny.chen at apple.com>
    Date:   Fri Feb 12 22:53:19 2010 +0000
    
        Add YIELD, WFE, WFI, and SEV instructions for disassembly only.
        Plus add two formats: MiscFrm and ThumbMiscFrm.  Some of the for disassembly
        only instructions are changed from Pseudo Format to MiscFrm Format.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96032 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 87ee5c9565c4362991e2fd99adf365f216574eff
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Fri Feb 12 22:47:55 2010 +0000
    
        pull the rip-relative addressing mode case up early.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96031 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 4410c7506473b5ff6c075356eed07fca9c87ec26
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Fri Feb 12 22:39:06 2010 +0000
    
        fixme resolved!
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96029 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit da3abd11aead14b8b5812bb8a5dc7fff0687f399
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Fri Feb 12 22:36:47 2010 +0000
    
        start producing reloc_pcrel_4byte/reloc_pcrel_1byte for calls.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96028 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit c52c146a6c499821a37e4a260b17dcb65f46e2d1
    Author: Bob Wilson <bob.wilson at apple.com>
    Date:   Fri Feb 12 22:34:54 2010 +0000
    
        Fix a comment typo.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96027 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 6f45b9dfd57cd29af5a286c95c67e7f8831e6599
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Fri Feb 12 22:27:07 2010 +0000
    
        enhance the immediate field encoding to know whether the immediate
        is pc relative or not, mark call and branches as pcrel.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96026 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 7312910f142ffc20c8ed466df2808be6e6ffbc65
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Fri Feb 12 22:17:21 2010 +0000
    
        Load / store multiple instructions cannot load / store sp. Sorry, can't come up with a reasonable test case.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96023 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 78597677837983b2bd54345792c5727e5cb7df0d
    Author: Dale Johannesen <dalej at apple.com>
    Date:   Fri Feb 12 22:00:40 2010 +0000
    
        This should have gone in with 26015, see comments there.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96020 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 97637b840f772fd49bbb73c0ec32b578a30ddc59
    Author: Johnny Chen <johnny.chen at apple.com>
    Date:   Fri Feb 12 21:59:23 2010 +0000
    
        Add halfword multiply accumulate long SMLALBB/BT/TB/TT for disassembly only.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96019 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 0bcde6783ba1ef149066bf5f226ea3b5bb204a62
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Fri Feb 12 21:54:28 2010 +0000
    
        doxygenize some comments, patch by Peter Collingbourne!
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96018 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit d9ccefd1972a73e609d2a4460ef24c4d1277332f
    Author: Dale Johannesen <dalej at apple.com>
    Date:   Fri Feb 12 21:35:34 2010 +0000
    
        When save/restoring CR at prolog/epilog, in a large
        stack frame, the prolog/epilog code was using the same
        register for the copy of CR and the address of the save slot.  Oops.
        This is fixed here for Darwin, sort of, by reserving R2 for this case.
        A better way would be to do the store before the decrement of SP,
        which is safe on Darwin due to the red zone.
    
        SVR4 probably has the same problem, but I don't know how to fix it;
        there is no red zone and R2 is already used for something else.
        I'm going to leave it to someone interested in that target.
    
        Better still would be to rewrite the CR-saving code completely;
        spilling each CR subregister individually is horrible code.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96015 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 964eda1b7e6d2c274537d6887598d94afc39cb86
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Fri Feb 12 20:49:41 2010 +0000
    
        Add support for a union type in LLVM IR.  Patch by Talin!
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96011 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 8d4b966df8f910f36c5d8e02befd5b8da5c39038
    Author: Johnny Chen <johnny.chen at apple.com>
    Date:   Fri Feb 12 20:48:24 2010 +0000
    
        Add SWP (Swap) and SWPB (Swap Byte) for disassembly only.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96010 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit a477ca64a2ff06c295fc5d79a4ae847044964764
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Fri Feb 12 20:39:35 2010 +0000
    
        Also recognize armv6t2-* and armv5te-* triplets.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96008 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 1abb17f23368025054fac2a266293c52308413c7
    Author: Dan Gohman <gohman at apple.com>
    Date:   Fri Feb 12 20:39:25 2010 +0000
    
        Fix a case of mismatched types in an Add that turned up in 447.dealII.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96007 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit db0084c8abbc02963d7087b1b89ed3ecb6bbc5d3
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Fri Feb 12 20:13:44 2010 +0000
    
        Add ARM bitcode file magic.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96006 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit b20bd310eda5e159d28993229dabb4f6e481102c
    Author: Dan Gohman <gohman at apple.com>
    Date:   Fri Feb 12 19:35:25 2010 +0000
    
        Reapply 95979, a compile-time speedup, now that the bug it exposed is fixed.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96005 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 91e7b9265d247c5206860c9655fdee62d16a8512
    Author: Dan Gohman <gohman at apple.com>
    Date:   Fri Feb 12 19:20:37 2010 +0000
    
        Fix this code to avoid dereferencing an end() iterator in
        offset distributions it doesn't expect.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96002 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit f012c07c5e30ab36e1fc81c6e6a27f19dba4fd44
    Author: Johnny Chen <johnny.chen at apple.com>
    Date:   Fri Feb 12 18:55:33 2010 +0000
    
        Add CPS, MRS, MRSsys, MSR, MSRsys for disassembly only.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95999 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 0abe9e7645ab2f98ceafea4644c210d270a3b5d2
    Author: Dale Johannesen <dalej at apple.com>
    Date:   Fri Feb 12 18:40:17 2010 +0000
    
        Rewrite handling of DBG_VALUE; previous algorithm
        didn't handle
        X =
        Y<dead> = use X
        DBG_VALUE(X)
        I was hoping to avoid this approach as it's slower,
        but I don't think it can be done.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95996 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit e92534406bed8cb0d869cf6f03bf0a0b5e8967e4
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Fri Feb 12 18:17:23 2010 +0000
    
        1. modernize the constantmerge pass, using densemap/smallvector.
        2. don't bother trying to merge globals in non-default sections,
           doing so is quite dubious at best anyway.
        3. fix a bug reported by Arnaud de Grandmaison where we'd try to
           merge two globals in different address spaces.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95995 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit a996e79bdf9a1e3c94c87657c639ea3a4ff2a3cc
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Fri Feb 12 18:05:00 2010 +0000
    
        rename test
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95993 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 0ac9e9e4b79e63595606f0c2a1f956b460c1529b
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Fri Feb 12 17:27:08 2010 +0000
    
        Revert "Reverse the order for collecting the parts of an addrec. The order", it
        is breaking llvm-gcc bootstrap.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95988 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 5d685a4fab6fd002bfd297096e3571df4deab415
    Author: Anton Korobeynikov <asl at math.spbu.ru>
    Date:   Fri Feb 12 15:29:13 2010 +0000
    
        Testcases for recent stdcall / fastcall mangling improvements
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95982 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 412cd99612db589101a9a01cf76109f517045a77
    Author: Anton Korobeynikov <asl at math.spbu.ru>
    Date:   Fri Feb 12 15:28:56 2010 +0000
    
        Setup correct data layout to match gcc's expectations on mingw32.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95981 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 24d33f599734b757d8574dbacbbfb7d09f43618d
    Author: Anton Korobeynikov <asl at math.spbu.ru>
    Date:   Fri Feb 12 15:28:40 2010 +0000
    
        Cleanup stdcall / fastcall name mangling.
        This should fix alot of problems we saw so far, e.g. PRs 5851 & 2936
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95980 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit d8ed2ebf5ac86bfd799d9bdc66f99abe73a96620
    Author: Dan Gohman <gohman at apple.com>
    Date:   Fri Feb 12 11:08:26 2010 +0000
    
        Reverse the order for collecting the parts of an addrec. The order
        doesn't matter, except that ScalarEvolution tends to need less time
        to fold the results this way.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95979 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 5a607b8949e73a508c26771e26f7c30b7cd26c0c
    Author: Dan Gohman <gohman at apple.com>
    Date:   Fri Feb 12 10:34:29 2010 +0000
    
        Reapply the new LoopStrengthReduction code, with compile time and
        bug fixes, and with improved heuristics for analyzing foreign-loop
        addrecs.
    
        This change also flattens IVUsers, eliminating the stride-oriented
        groupings, which makes it easier to work with.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95975 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ca41a7d6ca95108aa285a499434a85e65830b200
    Author: Lang Hames <lhames at gmail.com>
    Date:   Fri Feb 12 09:43:37 2010 +0000
    
        * Updated the cost matrix normalization proceedure to better handle infinite costs.
        * Enabled R1/R2 application for nodes with infinite spill costs in the Briggs heuristic (made
        safe by the changes to the normalization proceedure).
        * Removed a redundant header.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95973 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 864d3c380bfe2a46ca0bb1e45a77232723a040d0
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Fri Feb 12 07:48:46 2010 +0000
    
        Update test to match 95961.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95971 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 253134e443bed0a1abbac39f1159b43103805680
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Fri Feb 12 02:35:03 2010 +0000
    
        Test for 95961.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95962 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 2563a3d8062d011dc92c68bfab12d8aadb96cb14
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Fri Feb 12 02:06:33 2010 +0000
    
        add a bunch of mod/rm encoding types for fixed mod/rm bytes.
        This will work better for the disassembler for modeling things
        like lfence/monitor/vmcall etc.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95960 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit a11f1f613938c87def9975d1d02d24ab8e031db2
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Fri Feb 12 02:02:23 2010 +0000
    
        Test case for 95958.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95959 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ea6d61133cdc7b23708456c2f39b58f2999e8eeb
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Fri Feb 12 01:55:31 2010 +0000
    
        revert r95949, it turns out that adding new prefixes is not a
        great solution for the disassembler, we'll go with "plan b".
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95957 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit a6e257ddfe666a2a5f2d3c785ca0db1bc464ce55
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Fri Feb 12 01:46:54 2010 +0000
    
        MC: Fix bug where trailing tied operands were forgotten; the X86 assembler
        matcher is now free of implicit operands!
         - Still need to clean up the code now that we don't to worry about implicit
           operands, and to make it a hard error if an instruction fails to specify all
           of its operands for some reason.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95956 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit dc6dcfca28dededf4dacff3f810655dafe5f0fc1
    Author: Johnny Chen <johnny.chen at apple.com>
    Date:   Fri Feb 12 01:44:23 2010 +0000
    
        Added coprocessor Instructions CDP, CDP2, MCR, MCR2, MRC, MRC2, MCRR, MCRR2,
        MRRC, MRRc2.  For disassembly only.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95955 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 0267dc4352974ba2cc5d21eb434570c7e11b6cde
    Author: Bob Wilson <bob.wilson at apple.com>
    Date:   Fri Feb 12 01:30:21 2010 +0000
    
        Add a new pass on machine instructions to optimize away PHI cycles that
        reduce down to a single value.  InstCombine already does this transformation
        but DAG legalization may introduce new opportunities.  This has turned out to
        be important for ARM where 64-bit values are split up during type legalization:
        InstCombine is not able to remove the PHI cycles on the 64-bit values but
        the separate 32-bit values can be optimized.  I measured the compile time
        impact of this (running llc on 176.gcc) and it was not significant.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95951 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit dd9673a09a416b6f443c8191f7e4aa5272ab36c3
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Fri Feb 12 01:22:03 2010 +0000
    
        X86: Fix definition for RCL/RCR.*m? operations -- they were getting represented
        with "tied memory operands", which is wrong.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95950 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit c70ef3e2792a0a37e3517998f8aa6a7f3e9781df
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Fri Feb 12 01:15:16 2010 +0000
    
        add another bit of space for new kinds of instruction prefixes.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95949 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 3629bdb8b22324c2bfe33c036fa8cab10511548d
    Author: Nate Begeman <natebegeman at mac.com>
    Date:   Fri Feb 12 01:10:45 2010 +0000
    
        Add a missing pattern for movhps so that we get:
    
        movq	(%ecx,%edx,2), %xmm2
        movhps	(%ecx,%eax,2), %xmm2
    
        rather than:
    
        movq     (%eax, %edx, 2), %xmm2
        movq     (%eax, %ebx, 2), %xmm3
        movlhps  %xmm3, %xmm2
    
        Testcase forthcoming.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95948 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 76b82cb12274539b254a04a0423006b1a8584844
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Fri Feb 12 01:06:22 2010 +0000
    
        fix the encodings of monitor and mwait, which were completely
        busted in both encoders.  I'm not bothering to fix it in the
        old one at this point.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95947 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 30d51dce30851e64cdeb1e6136d6f6d5d879a4db
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Fri Feb 12 00:37:46 2010 +0000
    
        improve support for minix, PR6280, patch by
        Kees van Reeuwijk!
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95946 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 7e5dc6e9bdeefbc238c336bfba82bc403b8b69ac
    Author: Charles Davis <cdavis at mines.edu>
    Date:   Fri Feb 12 00:31:15 2010 +0000
    
        Add a new function attribute, 'alignstack'. It will indicate (when the backends
        implement support for it) that the stack should be forcibly realigned in the
        prologue (and the process reversed in the epilogue).
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95945 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit c33bef344039f91e8bdc63766252b3c480b6a67a
    Author: Jakob Stoklund Olesen <stoklund at 2pi.dk>
    Date:   Thu Feb 11 23:55:29 2010 +0000
    
        Reapply coalescer fix for better cross-class coalescing.
    
        This time with fixed test cases.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95938 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit af2b332ed86806c193669dcac77961b2d945b9a3
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Thu Feb 11 22:57:32 2010 +0000
    
        enhance llvm-mc -show-inst to print the enum of an instruction, like so:
    
        	testb	%al, %al                ## <MCInst #2412 TEST8rr
                                                ##   <MCOperand Reg:2>
                                                ##   <MCOperand Reg:2>>
        	jne	LBB1_7                  ## <MCInst #938 JNE_1
                                                ##   <MCOperand Expr:(LBB1_7)>>
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95935 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 68316b7ed1283ed43ef1814d51a3666ae9c30ced
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Thu Feb 11 22:39:10 2010 +0000
    
        add a new MCInstPrinter::getOpcodeName interface, when it is
        implemented, llvm-mc --show-inst now uses it to print the
        instruction opcode as well as the number.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95929 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 13f9209eeea6b78a89e14da0a400c7281984cc1a
    Author: Anton Korobeynikov <asl at math.spbu.ru>
    Date:   Thu Feb 11 21:51:51 2010 +0000
    
        Document binutils requirements for coff targets (cygwin / mingw32).
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95928 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ef7bd26055041eee137b3b732377e8ec7843b8c8
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Thu Feb 11 21:45:31 2010 +0000
    
        improve encoding information for branches.  We now know they have
        8 or 32-bit immediates, which allows the new encoder to handle
        them.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95927 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 1d0ac4072239b9aea6e993b67470d675c94b497f
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Thu Feb 11 21:29:46 2010 +0000
    
        MC: Move assembler-backend's fixup list into the fragment.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95926 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 94ad6823bc3bb8e2ce5d285bb8258c6129df8e0c
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Thu Feb 11 21:29:29 2010 +0000
    
        MC: Move MCSectionData::Fixup out to MCAsmFixup.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95925 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 252990b75fb84cd3b8005a8cd2abcdd1e3a7ebcb
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Thu Feb 11 21:27:18 2010 +0000
    
        make getFixupKindInfo return a const reference, allowing
        the tables to be const.  Teach MCCodeEmitter to handle
        the target-indep kinds so that we don't crash on them.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95924 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit e84ffbd5af615af4b4326b4a5937d8e7725fa875
    Author: Jakob Stoklund Olesen <stoklund at 2pi.dk>
    Date:   Thu Feb 11 21:19:44 2010 +0000
    
        Revert functional change. This broke a bunch of tests.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95921 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit bf922f08f3f3dba6d8f6204270cc9d4df30c3dc3
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Thu Feb 11 21:17:54 2010 +0000
    
        switch to target-indep fixups for 1/2/4/8 byte data.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95920 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit a62b13e4334c3dd03f90db7e9212c5629455cc4a
    Author: Devang Patel <dpatel at apple.com>
    Date:   Thu Feb 11 20:58:56 2010 +0000
    
        revert 95903.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95918 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit bde99e7657bb11b7edf9fcf35467c9497abfd6f8
    Author: Jakob Stoklund Olesen <stoklund at 2pi.dk>
    Date:   Thu Feb 11 20:58:45 2010 +0000
    
        It is always good to do a cross-class join when the large register has a tiny interval.
    
        Also avoid division by zero.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95917 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 892cf047c170383369f88f936e03607b87f2e4c3
    Author: Johnny Chen <johnny.chen at apple.com>
    Date:   Thu Feb 11 20:31:08 2010 +0000
    
        Added LDRT/LDRBT/STRT/STRBT for disassembly only.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95916 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 021109ade238fd0e25cf8c69f7c367a461ea03ae
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Thu Feb 11 19:52:11 2010 +0000
    
        unbreak the build.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95915 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 34b92a3f30c7e01062f7d7eee5db972a1b1208c8
    Author: Dan Gohman <gohman at apple.com>
    Date:   Thu Feb 11 19:35:26 2010 +0000
    
        llvm-db was removed.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95904 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ee2e10cf787b7c935085d156343ee9b48033bc86
    Author: Devang Patel <dpatel at apple.com>
    Date:   Thu Feb 11 19:35:10 2010 +0000
    
        Destroy MDNodes while destructing llvm context.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95903 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit a9f95edce8035bbea61d68c4fd373e46ae2cd493
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Thu Feb 11 19:31:22 2010 +0000
    
        refactor x86 conditional branches to use a multipattern
        that generates the 1-byte and 4-byte immediate versions
        from one definition.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95902 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 7c9872327581faf7d85aad5e570973c6f359d77c
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Thu Feb 11 19:25:55 2010 +0000
    
        refactor the conditional jump instructions in the .td file to
        use a multipattern that generates both the 1-byte and 4-byte
        versions from the same defm
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95901 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit b1ef56bd34602273702b98cbb28c6a3c589ca70b
    Author: Jeffrey Yasskin <jyasskin at google.com>
    Date:   Thu Feb 11 19:15:20 2010 +0000
    
        Make Kaleidoscope not link against the interpreter, since that didn't
        work anyway (Interpreter::getPointerToFunction doesn't return a
        callable pointer), and improve the error message when an
        ExecutionEngine can't be created.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95896 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit df0649adf48fa3343dc1ec95975259777b87b45f
    Author: Dan Gohman <gohman at apple.com>
    Date:   Thu Feb 11 19:07:04 2010 +0000
    
        Add an svn:ignore.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95895 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 98c5eed093b2f21580925541ff971003be227939
    Author: Johnny Chen <johnny.chen at apple.com>
    Date:   Thu Feb 11 18:47:03 2010 +0000
    
        Forgot to also check in this file for vcvt (floating-point <-> fixed-point, VFP).
        Sorry!
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95892 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 75f18b48f297a4f31af3d70dcacb6601558d174e
    Author: Dale Johannesen <dalej at apple.com>
    Date:   Thu Feb 11 18:23:23 2010 +0000
    
        Allow for more than one DBG_VALUE targeting the
        same dead instruction.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95890 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 177849e66e24ccca09fbbd282eaa4f5ed0904de7
    Author: Dale Johannesen <dalej at apple.com>
    Date:   Thu Feb 11 18:22:31 2010 +0000
    
        Don't allow DBG_VALUE to affect codegen.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95889 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 56c787f5c53084f7283a8fe47711db65d167c9a5
    Author: Johnny Chen <johnny.chen at apple.com>
    Date:   Thu Feb 11 18:17:16 2010 +0000
    
        Added VCVT (between floating-point and fixed-point, VFP) for disassembly.
        A8.6.297
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95885 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 31a24b15aa460aa543772be3b415f06432630506
    Author: Johnny Chen <johnny.chen at apple.com>
    Date:   Thu Feb 11 18:12:29 2010 +0000
    
        Added BKPT/tBKPT (breakpoint) to the instruction table for disassembly purpose.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95884 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit d7cf68f307458f6cc214734685f361f530893b4a
    Author: Jakob Stoklund Olesen <stoklund at 2pi.dk>
    Date:   Thu Feb 11 18:06:56 2010 +0000
    
        Use array_pod_sort instead of std::sort for improved code size.
    
        Use SmallVector instead of std::vector for better speed when indirectbr has
        few successors.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95879 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 9a058c4604c121efbe8d8783c17d1b20605dc938
    Author: Eric Christopher <echristo at apple.com>
    Date:   Thu Feb 11 17:44:04 2010 +0000
    
        Make sure that ConstantExpr offsets also aren't off of extern
        symbols.
    
        Thanks to Duncan Sands for the testcase!
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95877 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 310f24fcfcf54e6cf1e6ca350b7b431b1c474c51
    Author: Johnny Chen <johnny.chen at apple.com>
    Date:   Thu Feb 11 17:14:31 2010 +0000
    
        Add pseudo instruction TRAP for disassembly, which is encoded according to A5-21
        as the "Permanently UNDEFINED" instruction.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95873 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 62b33dc015061dc780d345bf5c2e47c3b3c27051
    Author: Bill Wendling <isanbard at gmail.com>
    Date:   Thu Feb 11 10:37:57 2010 +0000
    
        Use .empty() instead of .size().
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95871 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit d38bd5ececc6c84836b8ee52d809e2d6e450152a
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Thu Feb 11 08:45:56 2010 +0000
    
        dont' call getX86RegNum on X86::RIP, it doesn't like that.  This
        fixes the remaining x86-64 jit failures afaik.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95867 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 46a26bbf505cc07b5e51d2d7aab9827181cbf9d3
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Thu Feb 11 08:41:21 2010 +0000
    
        fix a really nasty bug I introduced in r95693: r12 (and r12d,
        r12b, etc) also encodes to a R/M value of 4, which is just
        as illegal as ESP/RSP for the non-sib version an address.
    
        This fixes x86-64 jit miscompilations of a bunch of programs.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95866 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 321617629bf8b7cec0b12c591acff40ccc278784
    Author: Jeffrey Yasskin <jyasskin at google.com>
    Date:   Thu Feb 11 07:16:13 2010 +0000
    
        Fix (harmless) memory leak found by memcheck.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95862 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ebce12bbcf2508514afc2fa55c7580d46e7e3afe
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Thu Feb 11 07:06:31 2010 +0000
    
        Add and commonize encoder support for all immediates.
        Stub out some dummy fixups to make things work.
    
        We can now emit fixups like this:
        	subl	$20, %esp               ## encoding: [0x83,0xec,A]
                                                ##   fixup A - offset: 2, value: 20, kind: fixup_1byte_imm
    
        Emitting $20 as a single-byte fixup to be later resolved
        by the assembler is ridiculous of course (vs just emitting
        the byte) but this is a failure of the matcher, which
        should be producing an imm of 20, not an MCExpr of 20.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95860 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit f80c505d83787296cffb3e7495d3b8b7dfc35794
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Thu Feb 11 06:54:23 2010 +0000
    
        generalize EmitDisplacementField to work with any size
        and rename it to EmitImmediate.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95859 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 97374c6e6a29b7dff39632a1b8dc96ee86e44c1a
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Thu Feb 11 06:51:36 2010 +0000
    
        eliminate the dead IsPCRel argument.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95858 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 9e07afd152a07b1c6c1d144646f4869e9533dc33
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Thu Feb 11 06:49:52 2010 +0000
    
        eliminate the dead "PCAdj" logic.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95857 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 77c7077e8f39f2efa8a74091743af08db20833f4
    Author: Jeffrey Yasskin <jyasskin at google.com>
    Date:   Thu Feb 11 06:41:30 2010 +0000
    
        Fix some of the memcheck errors found in the JIT unittests.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95856 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 5f3e09483b108ba4fa6ee06a1ca9540267d7d21b
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Thu Feb 11 06:26:33 2010 +0000
    
        Rename ValueRequiresCast to ShouldOptimizeCast, to better reflect
        what it does.  Enhance it to return false to optimizing vector
        sign extensions from vector comparisions, which is the idiom used
        to get a splatted vector for a vector comparison.
    
        Doing this breaks vector-casts.ll, add some compensating
        transformations to handle the important case they cover without
        depending on this canonicalization.
    
        This fixes rdar://7434900 a serious pessimization of vector compares.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95855 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 48df834a4a87a035ff4311057ad8fd2250415249
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Thu Feb 11 06:24:37 2010 +0000
    
        convert to filecheck.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95854 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit f05a4a82b719a1bd583cdd7739079504d9963422
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Thu Feb 11 05:11:54 2010 +0000
    
        Make DSE only scan blocks that are reachable from the entry
        block.  Other blocks may have pointer cycles that will crash
        basicaa and other alias analyses.  In any case, there is no
        point wasting cycles optimizing dead blocks.  This fixes
        rdar://7635088
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95852 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 9211ea57815c52083d4bd54c2f40fe1cbee1744f
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Thu Feb 11 05:08:05 2010 +0000
    
        a testcase that doesn't crash GVN but could someday.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95851 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 089ed82c48bd69fe4a98ab3ef8e37ae26eabd9a1
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Thu Feb 11 04:40:44 2010 +0000
    
        Make jump threading honor x|undef -> true and x&undef -> false,
        instead of considering x|undef -> x, which may not be true.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95850 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 042109e6237b5fc008570e8adbb6ba445fb6120e
    Author: Eric Christopher <echristo at apple.com>
    Date:   Thu Feb 11 01:48:54 2010 +0000
    
        Add ConstantExpr handling to Intrinsic::objectsize lowering.
    
        Update testcase accordingly now that we can optimize another
        section.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95846 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 65944ae3e1b2fdd6b8966b5af084f9607b34999d
    Author: Devang Patel <dpatel at apple.com>
    Date:   Thu Feb 11 01:31:01 2010 +0000
    
        test case for r95842.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95844 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 459468d4434427a26cbc0fe5f79e4c31fbaf2795
    Author: Bill Wendling <isanbard at gmail.com>
    Date:   Thu Feb 11 01:15:27 2010 +0000
    
        Fix to get it to compile.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95840 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit d4880f4c56524735b593e4a852b584e101c80a54
    Author: Bill Wendling <isanbard at gmail.com>
    Date:   Thu Feb 11 01:13:02 2010 +0000
    
        Don't print out a default newline when emitting the section offset. There are
        almost always comments afterwards that need printing.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95839 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit b3caf596efddb31aa4998bf8f9bbea09071198c2
    Author: Jeffrey Yasskin <jyasskin at google.com>
    Date:   Thu Feb 11 01:07:39 2010 +0000
    
        Make it possible to create multiple JIT instances at the same time, by removing
        the global TheJIT and TheJITResolver variables.  Lazy compilation is supported
        by a global map from a stub address to the JITResolver that knows how to
        compile it.
    
        Patch by Olivier Meurant!
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95837 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit f5d1bc4945f66b39363f5adb70d652280d71f796
    Author: Jakob Stoklund Olesen <stoklund at 2pi.dk>
    Date:   Thu Feb 11 00:34:33 2010 +0000
    
        Reuse operand location when updating PHI instructions.
    
        Calling RemoveOperand is very expensive on huge PHI instructions. This makes
        early tail duplication run twice as fast on the Firefox JavaScript
        interpreter.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95832 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 983620a4957887088e3a54edf80d4a52789d7de3
    Author: Jakob Stoklund Olesen <stoklund at 2pi.dk>
    Date:   Thu Feb 11 00:34:18 2010 +0000
    
        Remove duplicate successors from indirectbr instructions before building the machine CFG.
    
        This makes early tail duplication run 60 times faster when compiling the Firefox
        JavaScript interpreter, see PR6186.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95831 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 01dd2eed529c40aaee21eb3ce179e12cad1f36d9
    Author: Devang Patel <dpatel at apple.com>
    Date:   Thu Feb 11 00:20:49 2010 +0000
    
        Ignore dbg info intrinsics.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95828 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit bddbb3549a3e706e1e48f4069b0820872b4bfe49
    Author: Kevin Enderby <enderby at apple.com>
    Date:   Thu Feb 11 00:18:12 2010 +0000
    
        Remove the few # TAILCALL comments that snuck in.  As they may fail on linux.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95827 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit f9d6893474485fb9d42fb67f566494bf8119184b
    Author: Kevin Enderby <enderby at apple.com>
    Date:   Thu Feb 11 00:13:43 2010 +0000
    
        Update the X86 assembler matcher test case now that a few more things match
        with some of the recent changes that have gone into llvm-mc.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95826 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 3125ea6e98852dab38710e6c9f4eb1fe31fec216
    Author: Dan Gohman <gohman at apple.com>
    Date:   Wed Feb 10 23:58:53 2010 +0000
    
        Add support to llvm-extract for extracting multiple functions and/or
        multiple global variables at a time.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95825 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 4c0275b0f91c1ea26942e6178dd62b0247b4252d
    Author: Mon P Wang <wangmp at apple.com>
    Date:   Wed Feb 10 23:37:45 2010 +0000
    
        The previous fix of widening divides that trap was too fragile as it depends on custom
        lowering and requires that certain types exist in ValueTypes.h.  Modified widening to
        check if an op can trap and if so, the widening algorithm will apply only the op on
        the defined elements.  It is safer to do this in widening because the optimizer can't
        guarantee removing unused ops in some cases.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95823 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit a4f4b1506d2a7bd676adcd886d98c12012bdd952
    Author: Dale Johannesen <dalej at apple.com>
    Date:   Wed Feb 10 23:04:09 2010 +0000
    
        Ignore debug info one more place during coalescing.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95819 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 0df83f4b11cb2e8b6f793a1425b77f9b6cd5e19b
    Author: Dale Johannesen <dalej at apple.com>
    Date:   Wed Feb 10 23:03:20 2010 +0000
    
        Allow isDebug inquiry on any MO.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95818 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 1ca197830a1a1906a5657c9e9c52977510106e39
    Author: Bob Wilson <bob.wilson at apple.com>
    Date:   Wed Feb 10 22:58:57 2010 +0000
    
        Delete dead PHI machine instructions.  These can be created due to type
        legalization even when the IR-level optimizer has removed dead phis, such
        as when the high half of an i64 value is unused on a 32-bit target.
        I had to adjust a few test cases that had dead phis.
        This is a partial fix for Radar 7627077.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95816 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 2b0ea846f73eb83706dd80d1fbde28fe3eeed217
    Author: Dale Johannesen <dalej at apple.com>
    Date:   Wed Feb 10 21:47:48 2010 +0000
    
        Skip debug info in a couple of places.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95814 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit e3393b63d1a2483a7b7a2dd23e20cb16ea43c210
    Author: Bill Wendling <isanbard at gmail.com>
    Date:   Wed Feb 10 21:41:57 2010 +0000
    
        Use an index instead of pointers into the vector. If the vector resizes, then
        the pointer values could be invalid.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95813 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 4dae4593c8310d09e587a928c15d3e7b32172037
    Author: Dale Johannesen <dalej at apple.com>
    Date:   Wed Feb 10 21:41:41 2010 +0000
    
        When I rewrote this loop per Chris' preference I
        changed its behavior.  Oops.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95811 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit e824fb17b264b0696b236304671ddb4ccb50c895
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 10 21:37:31 2010 +0000
    
        add a virtual dtor to MCTargetExpr, hopefully silencing some warnings.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95810 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 1b9161cf664d44a0c0789a2ea7e439b81f02d83f
    Author: Eli Friedman <eli.friedman at gmail.com>
    Date:   Wed Feb 10 21:26:04 2010 +0000
    
        A few missed optimizations; the last one could have a significant impact on
        code with lots of bitfields.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95809 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 1196f9ba64661542cc87fcd99b96655874c057d4
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 10 21:22:51 2010 +0000
    
        work around a gcc bug with -Wuninitialized.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95808 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 4343998c96075c771bc1b8c486cd4d141f4ddf9f
    Author: Devang Patel <dpatel at apple.com>
    Date:   Wed Feb 10 21:19:56 2010 +0000
    
        Strip new llvm.dbg.value intrinsic.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95807 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 9c7b65e886227bf3cbff010868d91c22daec111b
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Wed Feb 10 21:19:28 2010 +0000
    
        MC/X86 AsmMatcher: Fix a use after free spotted by d0k, and de-XFAIL
        x86_32-encoding.s in on expectation of it passing.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95806 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 06e24dc5f9ea9603d282f77e327fff27748c8e95
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Wed Feb 10 21:01:04 2010 +0000
    
        XFAIL this on linux until I figure out what is happening.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95804 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 63bb9e8ff151f1d947682100594e794b646a6646
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Wed Feb 10 21:00:55 2010 +0000
    
        lit: Ignore dot files when scanning for tests (e.g., editor temprary files,
        etc.)
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95803 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 20631dbca24c6895ac647923fa3742fe94e7b3a7
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Wed Feb 10 21:00:47 2010 +0000
    
        MC/AsmMatcher: Tweak conversion function name.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95802 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 013ca607f6404a26921689e0e2936f9eeff85891
    Author: Dan Gohman <gohman at apple.com>
    Date:   Wed Feb 10 20:42:57 2010 +0000
    
        Minor whitespace cleanups.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95801 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 3eeaacd71c0b4925eef44b315fa41d16588f2fad
    Author: Dan Gohman <gohman at apple.com>
    Date:   Wed Feb 10 20:42:37 2010 +0000
    
        Use an AssemblyAnnotatorWriter to clean up IVUsers' debug output.
        The "uses=" comments are just clutter in this context.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95799 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit d73878ab5df6dcade0aab73f789b9173e0a21a3e
    Author: Dan Gohman <gohman at apple.com>
    Date:   Wed Feb 10 20:41:46 2010 +0000
    
        Add a hook to AssemblyAnnotationWriter to allow custom info comments
        to be printed, in place of the familiar "uses=" comments.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95798 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 50d20e115bc9907aa170fd14b720a17c002e3db6
    Author: Dan Gohman <gohman at apple.com>
    Date:   Wed Feb 10 20:23:33 2010 +0000
    
        Use doxygen comment syntax.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95797 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 1cb9e26a4f8e5f3037fe24dff0780cfb0c8acae0
    Author: Dan Gohman <gohman at apple.com>
    Date:   Wed Feb 10 20:04:19 2010 +0000
    
        Fix several comments which had previously been "the the" where a
        different word was intended.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95795 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 6cd9da8b837fbb130cfb68bdfaf307f069838a6a
    Author: Kevin Enderby <enderby at apple.com>
    Date:   Wed Feb 10 19:13:56 2010 +0000
    
        Replace this file containing 4 tests of x86 32-bit encodings with a file
        containing the subset of the full auto generated test case that currently
        encodes correctly.  Again it is useful as we bring up the the new encoder
        to make sure currently working stuff stays working.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95791 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 3e91762c19cff323979775171efd78ce52cbd6f2
    Author: Johnny Chen <johnny.chen at apple.com>
    Date:   Wed Feb 10 18:02:25 2010 +0000
    
        Added NOP, DBG, SVC to the instruction table for disassembly purpose.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95784 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit af23afb740065a6c0c12f1d2fbc88eb3f18036bd
    Author: Dan Gohman <gohman at apple.com>
    Date:   Wed Feb 10 16:03:48 2010 +0000
    
        Fix "the the" and similar typos.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95781 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 349b2a1b5c6c41646b8f04bf96ed0383b5607602
    Author: Dan Gohman <gohman at apple.com>
    Date:   Wed Feb 10 15:54:22 2010 +0000
    
        Minor code simplification.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95780 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit a960e5e14330ff0f2791bd69fb3576813a5cea7a
    Author: Benjamin Kramer <benny.kra at googlemail.com>
    Date:   Wed Feb 10 13:34:02 2010 +0000
    
        Silence GCC warnings.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95779 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 67f1b0e981f324a66a7e6713a20cd6758ce57633
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Wed Feb 10 08:15:48 2010 +0000
    
        MC/AsmMatcher: Add support for creating tied operands when constructing MCInsts.
         - Pretty messy, but we need to rework how we handle tied operands in MCInst
           anyway.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95774 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit f35eb9fa274c8e1ca4cd0c349cfb780aefda3758
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 10 06:52:12 2010 +0000
    
        emit some simple (and probably incorrect) fixups for symbolic
        displacement values.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95773 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 64f2e32ed184eb327d7dca782a2f34e0e4ed6e0f
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 10 06:41:02 2010 +0000
    
        keep track of what the current byte being emitted is
        throughout the X86 encoder.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95771 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 52a804e27005885de0e26cc29ecdbfda4389bc17
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 10 06:30:00 2010 +0000
    
        simplify displacement handling, emit displacements by-operand
        even for the immediate case.  No functionality change.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95770 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit fb024ff9f39712daa425d097cd3d497e2973087f
    Author: Dan Gohman <gohman at apple.com>
    Date:   Wed Feb 10 06:13:07 2010 +0000
    
        Canonicalize sizeof and alignof on pointer types to a canonical
        pointer type.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95769 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit d637aba529b5cc6a8dedbddfc187b3cd6ef4ccde
    Author: Dan Gohman <gohman at apple.com>
    Date:   Wed Feb 10 05:54:04 2010 +0000
    
        Implement operators |=, &=, and ^= for SmallBitVector, and remove the
        restriction in BitVector for |= and ^= that the operand must be the
        same length.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95768 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 2c7ab5dec64227e63d7417a99abe57324ae84436
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Wed Feb 10 04:47:08 2010 +0000
    
        MC: Switch MCFixup to just hold an MCExpr pointer instead of index into the
        MCInst it came from.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95767 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 5336c8961a2c3379da09d95ee4d7903fd04f7ad8
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Wed Feb 10 04:46:51 2010 +0000
    
        Fix a signed comparison warning.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95766 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit dbeaaa6b9892186196acaa7576334eec63a738e5
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Wed Feb 10 04:10:10 2010 +0000
    
        Remove stray DOS newline.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95765 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 252efd4f274ba896f82b785774973941198a79c9
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Wed Feb 10 04:09:52 2010 +0000
    
        Add a ReleaseNotes FIXME.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95764 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 99fff3e301012321a0a0a7db660bfc6ca6852a38
    Author: Garrison Venn <gvenn.cfe.dev at gmail.com>
    Date:   Wed Feb 10 03:38:29 2010 +0000
    
        Prevented build on WINDOWS using default make system. Stopped WINDOWS build
        at eh llvm/examples level using if check on LLVM_ON_UNIX.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95763 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 07663f302606e6b2112b4fde8db8c1c76bb97c11
    Author: Sean Callanan <scallanan at apple.com>
    Date:   Wed Feb 10 03:23:23 2010 +0000
    
        Updated the enhanced disassembly library's TableGen
        backend to not use exceptions at all except in cases
        of actual error.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95762 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit f327869a5de5fb01a4c42cc789ab97663fc31762
    Author: Garrison Venn <gvenn.cfe.dev at gmail.com>
    Date:   Wed Feb 10 02:50:08 2010 +0000
    
        Prevented ExceptionDemo example being built on WINDOWS via if( NOT WIN32 )
        check in examples cmake list file. This has NOT been tested.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95761 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 096b097f4a245dd6e043ffbff4d574800f4768c4
    Author: Sean Callanan <scallanan at apple.com>
    Date:   Wed Feb 10 02:47:08 2010 +0000
    
        Updated the TableGen emitter for the Enhanced
        Disassembler to take advantage of the refactored
        AsmWriterInst.h.  Note removed parser code.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95760 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 605a402cc2a7ef412ad4144a2de45d68f7b65dcb
    Author: Sean Callanan <scallanan at apple.com>
    Date:   Wed Feb 10 02:27:43 2010 +0000
    
        Changed AsmWriterOperand to also include the index of the
        operand into the CodeGenInstruction's list of operands,
        which is useful for EDEmitter.  (Still working on PR6219)
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95759 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit e8f028b8bce6e92e12809beac0e0379b601980a4
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Wed Feb 10 02:17:34 2010 +0000
    
        Now that ShrinkDemandedOps() is separated out from DAG combine. It sometimes leave some obvious nops which dag combine used to clean up afterwards e.g. (trunk (ext n)) -> n. Look for them and squash them.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95757 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit a7a939aeea7bbbadddde5c0491621dbe1059c00d
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 10 01:46:47 2010 +0000
    
        "fixup" a comment.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95754 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 33fe554b0bb1dd7fc2ee9c9e5d7afae9233d652c
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 10 01:45:28 2010 +0000
    
        Introduce a new CodeGenInstruction::ConstraintInfo class
        for representing constraint info semantically instead of
        as a c expression that will be blatted out to the .inc
        file.  Fix X86RecognizableInstr to use this instead of
        parsing C code :).
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95753 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit b6129a289288b6bd0d237dece7ccc494a01bb59e
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Wed Feb 10 01:41:14 2010 +0000
    
        llvm-mc: Remove --show-fixups and always show as part of --show-encoding.
    
        Also, fix a silly memory leak.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95752 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit bf8fe6a7fc7a6722143d6025007aaab01a3b1526
    Author: Dale Johannesen <dalej at apple.com>
    Date:   Wed Feb 10 01:31:26 2010 +0000
    
        Rewrite loop to suit Chris' preference.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95749 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit c3f58b6ce58d2287a291f0c82993b461c0cc5bc6
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 10 01:23:18 2010 +0000
    
        fix a layering violation: VirtRegRewriter.cpp shouldn't use AsmPrinter.h.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95748 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit e8fc7b209da57482995dcb78a33449bcb3ceacbf
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Wed Feb 10 01:22:57 2010 +0000
    
        Remove duplicated #include.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95747 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 93726d8a787a3b1e7d709ea6259eca7eb8bdd6c8
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Wed Feb 10 01:21:02 2010 +0000
    
        Emit an error for illegal inline asm constraint (which uses illegal type) rather than asserting.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95746 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 5b2322be1ee42dbf4dd1df42e3cb097b231f7603
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 10 01:17:36 2010 +0000
    
        fix missing #includes.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95745 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 28afd8223a04f38c87746e0fe8c7e1e251db0a97
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 10 01:05:28 2010 +0000
    
        daniel *really* likes fixups!
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95742 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit e90535cbb30c071096987e9f5ae2114f3132ea96
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 10 01:04:16 2010 +0000
    
        Stop MachineInstr.h from #including AsmPrinter.h
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95741 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ce5a93e4cdc1ca70c5dc436453f227b3d0fcb715
    Author: Bill Wendling <isanbard at gmail.com>
    Date:   Wed Feb 10 00:59:47 2010 +0000
    
        Improve comments a even more.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95740 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit d832aa8fb8044b80a86273493c70770537bcce14
    Author: Dale Johannesen <dalej at apple.com>
    Date:   Wed Feb 10 00:55:42 2010 +0000
    
        Skip DBG_VALUE many places in live intervals and
        register coalescing.  This fixes many crashes and
        places where debug info affects codegen (when
        dbg.value is lowered to machine instructions, which
        it isn't yet in TOT).
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95739 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit f87769d484291b79abcbce9c1d93e189a9429529
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 10 00:47:53 2010 +0000
    
        Move verbose asm instruction comments to using MCStreamer.
        The major win of this is that the code is simpler and they
        print on the same line as the instruction again:
    
                movl    %eax, 96(%esp)          ## 4-byte Spill
                movl    96(%esp), %eax          ## 4-byte Reload
                cmpl    92(%esp), %eax          ## 4-byte Folded Reload
                jl      LBB7_86
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95738 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit db7b35ff8026dfdbc0d33da63a3a7c19b6e656ea
    Author: Bill Wendling <isanbard at gmail.com>
    Date:   Wed Feb 10 00:45:28 2010 +0000
    
        Improve comments a bit more.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95737 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 9c711aa69b6220492b543f42e477dc1b92704450
    Author: Dale Johannesen <dalej at apple.com>
    Date:   Wed Feb 10 00:44:23 2010 +0000
    
        more comment updates
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95736 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit de4b068361b29005fab942ac14ac8f12be1b743e
    Author: Dale Johannesen <dalej at apple.com>
    Date:   Wed Feb 10 00:41:49 2010 +0000
    
        Add isDebug argument to ChangeToRegister; this prevents
        the field from being used uninitialized later in some cases.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95735 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit e8e397b58489fd96a45e69c7d7710eab6d5cab18
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 10 00:36:00 2010 +0000
    
        print all the newlines at the end of instructions with
        OutStreamer.AddBlankLine instead of textually.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95734 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit bf50ddc93cf854eb803d580e07b4b2276a4e6430
    Author: Kenneth Uildriks <kennethuil at gmail.com>
    Date:   Wed Feb 10 00:14:03 2010 +0000
    
        IntegerValType holds a uint32_t, so its constructor should take a uint32_t.  This allows it to be properly initialized with bit widths > 65535
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95731 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 94f6097942b3dd9b13c2c71a74b7f7c034cc70e0
    Author: Dale Johannesen <dalej at apple.com>
    Date:   Wed Feb 10 00:11:11 2010 +0000
    
        Fix comments to reflect renaming elsewhere.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95730 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 3d9d97cddb404caf738a7b494b931b17e8f585a8
    Author: Kevin Enderby <enderby at apple.com>
    Date:   Wed Feb 10 00:10:31 2010 +0000
    
        Fix the encoding of the movntdqa X86 instruction.  It was missing the 0x66
        prefix which is part of the opcode encoding.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95729 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 59ee3d246bb7292180f55bdc97b9d0ace583f7db
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 10 00:10:18 2010 +0000
    
        Add ability for MCInstPrinters to add comments for instructions.
        Enhance the x86 backend to show the hex values of immediates in
        comments when they are large.  For example:
    
                movl    $1072693248, 4(%esp)    ## imm = 0x3FF00000
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95728 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit a0431e6c49421e302de8d311c1a5581549fc1f18
    Author: David Greene <greened at obbligato.org>
    Date:   Tue Feb 9 23:52:19 2010 +0000
    
        TableGen fragment refactoring.
    
        Move some utility TableGen defs, classes, etc. into a common file so
        they may be used my multiple pattern files.  We will use this for
        the AVX specification to help with the transition from the current
        SSE specification.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95727 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 7a6844b9567642a99a459eee65f8bce25dbe7449
    Author: Garrison Venn <gvenn.cfe.dev at gmail.com>
    Date:   Tue Feb 9 23:22:43 2010 +0000
    
        Adds a JIT based exception handling example to the examples directory.
        Both zero cost example domain specific, and C++ foreign exception handling are
        shown. The example's documentation fully explains how to run the example.
    
        Notes:
    
        1)   The code uses an extremely simple type info model.
        2)   Only a single landing pad is used per unwind edge
             (one call to llvm.eh.selector)
        3)   llvm.eh.selector support for filter arguments is not given.
        4)   llvm.eh.typeid.for is not used.
        5)   Forced unwind behavior is not supported.
        6)   Very little if any error handling is given.
        7)   __attribute__((__aligned__)) is used.
        8)   The code uses parts from the llvm compiler-rt project and
             the llvm Kaleidoscope example.
        9)   The code has not been ported or tested on WINDOWS.
        10)  The code was not tested with a cmake build.
        11)  The code was tested for a debug build on 32bit X86 CentOS LINUX,
             and both a debug and release build on OS X 10.6.2 (64bit).
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95723 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 490852e92928683702e224b0a92a4d5a333c3bf7
    Author: Sean Callanan <scallanan at apple.com>
    Date:   Tue Feb 9 23:06:35 2010 +0000
    
        Fixed some indentation in the AsmWriterInst
        implementation.  Also changed the constructor
        so that it does not require a Record, making it
        usable by the EDEmitter.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95715 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 23d193a06140d17e33ddb4428a71f67d8d3992a6
    Author: Johnny Chen <johnny.chen at apple.com>
    Date:   Tue Feb 9 23:05:23 2010 +0000
    
        Add VBIF/VBIT for disassembly only.
        A8.6.279
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95713 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit c321472b1f49b10f261f74508c40cb5ce72431da
    Author: Jeffrey Yasskin <jyasskin at google.com>
    Date:   Tue Feb 9 23:03:44 2010 +0000
    
        Make --disable-libffi work on systems with libffi installed.  Also
        make no-ffi the default even on systems with libffi.  This fixes
        http://llvm.org/PR5018.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95712 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit c1bdcf1fa7cdd98c7b4da719dd74ebfec1f4e027
    Author: David Greene <greened at obbligato.org>
    Date:   Tue Feb 9 23:03:05 2010 +0000
    
        Only dump output in debug mode.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95711 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ab57543e713bc754b2640e3747c2ff65457b63c2
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Tue Feb 9 23:00:14 2010 +0000
    
        llvm-mc: Add --show-fixups option, for displaying the instruction fixup information in the asm comments.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95710 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit e466b68c58bdc2ce05dbabdc02783c53b955500b
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Tue Feb 9 23:00:03 2010 +0000
    
        MC/X86: Add a dummy implementation of MCFixup generation for hacky X86 MCCodeEmitter.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95709 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit c5a052a84947f80567a72d99944f943b79d9f76b
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Tue Feb 9 22:59:55 2010 +0000
    
        MC: First cut at MCFixup, for getting fixup/relocation information out of an MCCodeEmitter.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95708 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit b8f02384dcbe2c57d4a0798687cdc06ebcdf0845
    Author: Bill Wendling <isanbard at gmail.com>
    Date:   Tue Feb 9 22:49:16 2010 +0000
    
        Improve comments in the LSDA somewhat. They can be improved much more.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95707 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 63ac41c0db09647d6469560b8803ee8d0a2d8903
    Author: Johnny Chen <johnny.chen at apple.com>
    Date:   Tue Feb 9 22:35:38 2010 +0000
    
        Added VMRS/VMSR for disassembly only.
        A8.6.335 & A8.6.336
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95703 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ecadd7d8ef99681205ed4527530cda4773a5bbbb
    Author: Sean Callanan <scallanan at apple.com>
    Date:   Tue Feb 9 22:29:16 2010 +0000
    
        Added AsmWriterInst.cpp to the CMakeList so that
        it builds OK on Visual Studio.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95702 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 78db1ba08fe914adb89e6c66e7065a7c0eb202ea
    Author: Dale Johannesen <dalej at apple.com>
    Date:   Tue Feb 9 22:15:27 2010 +0000
    
        Disable unittests/ADT/BitVectorTest on PPC Darwin.
        It fails with a release build only, for reasons
        as yet unknown.  (If there's a better way to Xfail
        things here let me know, doesn't seem to be any
        prior art in unittests.)
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95700 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit f373fc3257d5b0aa0fcfc59298f8033d2643078b
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 9 21:57:34 2010 +0000
    
        port encoder enhancements over to the new encoder.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95699 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit b3b3acf9317ca5fac7207f3493583422f7a9400f
    Author: Sean Callanan <scallanan at apple.com>
    Date:   Tue Feb 9 21:50:41 2010 +0000
    
        Per PR 6219, factored AsmWriterInst and AsmWriterOperand
        out of the AsmWriterEmitter.  This patch does the physical
        code movement, but leaves the implementation unchanged. I'll
        make any changes necessary to generalize the code in a
        separate patch.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95697 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit e8b1aac62bd8a74b004e4abed07d2f693a4cd365
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 9 21:47:19 2010 +0000
    
        fix X86 encoder to output [disp] only addresses with no SIB byte
        in X86-32 mode.  This is still required in x86-64 mode to avoid
        forming [disp+rip] encoding.  Rewrite the SIB byte decision logic
        to be actually understandable.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95693 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 9d47ee14b397d7315c3fa1767cb01bd6823daa87
    Author: Eric Christopher <echristo at apple.com>
    Date:   Tue Feb 9 21:24:27 2010 +0000
    
        Move Intrinsic::objectsize lowering back to InstCombineCalls and
        enable constant 0 offset lowering.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95691 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 616e35969b69d0fcb063634b465a41c1bf8a817a
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 9 21:21:26 2010 +0000
    
        revert r95689: getX86RegNum(BaseReg) != N86::ESP is
        a confusing idiom to check for ESP or RSP.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95690 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 20f133563c8c6dd09f4c754e6236bc79801e0adf
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 9 21:00:12 2010 +0000
    
        simplify.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95689 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 7a50aac9641027f9608ce3ab34664266bab982e7
    Author: Dale Johannesen <dalej at apple.com>
    Date:   Tue Feb 9 19:54:29 2010 +0000
    
        Re-disable for Darwin; I was mistaken to think this was fixed.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95688 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 261a07e6802837ca121afbd35aa67d66b8cddf79
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 9 19:54:29 2010 +0000
    
        move target-independent opcodes out of TargetInstrInfo
        into TargetOpcodes.h.  #include the new TargetOpcodes.h
        into MachineInstr.  Add new inline accessors (like isPHI())
        to MachineInstr, and start using them throughout the
        codebase.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95687 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 10b4c2ecc28cb21e6038f53185a0409a12ba02fc
    Author: Jim Grosbach <grosbach at apple.com>
    Date:   Tue Feb 9 19:51:37 2010 +0000
    
        Radar 7417921
    
        tMOVCCi pattern only valid for low registers, as the Thumb1 mov immediate to
        register instruction only works with low registers. Allowing high registers
        for the instruction resulted in the assembler choosing the wide (32-bit)
        encoding for the mov, but LLVM though the instruction was only 16 bits wide,
        so offset calculations for constant pools became incorrect, leading to
        out of range constant pool entries.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95686 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 6ab0b29165870293ea8a9c896fcda6bb15f685ab
    Author: Jeffrey Yasskin <jyasskin at google.com>
    Date:   Tue Feb 9 19:07:19 2010 +0000
    
        Add support for TypeBuilder<const/volatile void*, false>.
        Thanks to Jochen Wilhelmy for the suggestion!
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95677 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 01f65f0fa690ad8c066d2b79b9c0ffe51f7e300a
    Author: Eric Christopher <echristo at apple.com>
    Date:   Tue Feb 9 17:29:18 2010 +0000
    
        Pull these back out, they're a little too aggressive and time
        consuming for a simple optimization.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95671 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 3dd1b1df4e46cfa0453b91c17d5d5513b0573262
    Author: Jakob Stoklund Olesen <stoklund at 2pi.dk>
    Date:   Tue Feb 9 17:24:21 2010 +0000
    
        Oops.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95670 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 887f91b80eeb4259ebcf31ed1404fdc7eaec8d4c
    Author: Johnny Chen <johnny.chen at apple.com>
    Date:   Tue Feb 9 17:21:56 2010 +0000
    
        Added vcvtb/vcvtt (between half-precision and single-precision, VFP).
        For disassembly only.
    
        A8.6.300
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95669 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 541e03a3b0eee5b3d76cc1ae3cd8544e40476e7e
    Author: Jakob Stoklund Olesen <stoklund at 2pi.dk>
    Date:   Tue Feb 9 17:20:11 2010 +0000
    
        Remember to update live-in lists when coalescing physregs.
    
        Patch by M Wahab!
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95668 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit aa2cc940fb5cc78df37805e32e5f2c1650107b3a
    Author: Jakob Stoklund Olesen <stoklund at 2pi.dk>
    Date:   Tue Feb 9 17:20:03 2010 +0000
    
        clang test suite
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95667 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit f5839e96c8d3207d3640a2c2dc07a2ab5ce18630
    Author: Dan Gohman <gohman at apple.com>
    Date:   Tue Feb 9 17:00:40 2010 +0000
    
        Mention IndVarSimplify in the comment by getSmallConstantTripCount, as
        is done for getTripCount.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95666 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit e6fc8fab2a22b9ef1bc4a9d9c5dd8077a87a6554
    Author: Dan Gohman <gohman at apple.com>
    Date:   Tue Feb 9 16:59:14 2010 +0000
    
        Mention vAny and iPTRAny in a comment.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95665 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit d2609573cf0c9beb247b7f0e8c9d280bce8656ac
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 9 06:41:03 2010 +0000
    
        move tests that depend on the x86 backend out of codegen/generic,
        and remove a few old and unreduced ones.  Fixes PR5624.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95656 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 50c7723419a8a2e74c9f511917e120a8a9f4f45f
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 9 06:36:30 2010 +0000
    
        make target independent.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95655 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 0392fa4a69ca47c515211ce34325408b3dedb97e
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 9 06:35:50 2010 +0000
    
        merge a target-specific add test into x86 directory.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95654 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 636fef000f14238f8efdf5308e0630a849f35a7f
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 9 06:33:27 2010 +0000
    
        merge another test in, drop the trivially constant folded cases.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95653 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit e3c0bc8b5d2cdd6217ee00202582d426996cd29e
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 9 06:24:00 2010 +0000
    
        consolidate and filecheckize two tests.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95652 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit db71d597a8f3632d5e8c7417fa5247dc589543cc
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 9 06:19:20 2010 +0000
    
        merge two tests, make target independent.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95651 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 46bf694a136bd056d2546abe8a1d6b74f0a56efa
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 9 05:55:14 2010 +0000
    
        move PR3462 to here.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95650 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit a3f972db36312b043592d64b359686f77a2d1e0c
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 9 05:45:29 2010 +0000
    
        add a note from PR6194
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95649 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit a70edceec20bee694492901eb019aa97b8f27e75
    Author: Dale Johannesen <dalej at apple.com>
    Date:   Tue Feb 9 02:01:46 2010 +0000
    
        Skip DEBUG_VALUE in some places where it was affecting codegen.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95647 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ad7410a2b169cd871652cbeeda802c3955960e69
    Author: Devang Patel <dpatel at apple.com>
    Date:   Tue Feb 9 01:58:33 2010 +0000
    
        Add declaration attribute to a variable DIE, if there is a separate DIE for the definition.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95646 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 2f916df02dd583e77cc2414ce0c5d6a26a42ecf6
    Author: Sean Callanan <scallanan at apple.com>
    Date:   Tue Feb 9 01:50:54 2010 +0000
    
        Updated the enhanced disassembly library to produce
        whitespace tokens in the right places.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95645 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 8257d65e9602988beb2bc4f85a07ba4ef52722ed
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 9 01:39:46 2010 +0000
    
        fix llvm_build_struct_gep for PR6167, patch by
        Peter Hawkins!
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95644 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 420101c495eff5b9473802dcac80ab787ca2fc9a
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 9 01:14:06 2010 +0000
    
        simplify this code, duh.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95643 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 23480f2817a488aad23eea3858b328fbccbc85b5
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 9 01:12:41 2010 +0000
    
        fix PR6193, only considering sign extensions *from i1* for this
        xform.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95642 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 4f11751b8b463eed987b81ec2352fff4a2ba654e
    Author: Eric Christopher <echristo at apple.com>
    Date:   Tue Feb 9 01:11:03 2010 +0000
    
        Add file in here too.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95641 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 51cc5e94852ad9d40e2715b6e22f285b68b6b339
    Author: Sean Callanan <scallanan at apple.com>
    Date:   Tue Feb 9 01:00:18 2010 +0000
    
        Fixed a problem where the enhanced disassembly
        library was reporting inaccurate token IDs.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95639 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit c092b994e77608bec7eae1478d7f39d0479dc107
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 9 00:54:51 2010 +0000
    
        make -show-inst be formatted a bit nicer.  Before:
    
        	movl	$3735928559, a          ## inst: <MCInst 1273 <MCOperand Reg:0> <MCOperand Imm:1> <MCOperand Reg:0> <MCOperand Expr:(a)> <MCOperand Reg:0> <MCOperand Expr:(3735928559)>>
    
        after:
    
        	movl	$3735928559, a          ## <MCInst #1273
                                                ##   <MCOperand Reg:0>
                                                ##   <MCOperand Imm:1>
                                                ##   <MCOperand Reg:0>
                                                ##   <MCOperand Expr:(a)>
                                                ##   <MCOperand Reg:0>
                                                ##   <MCOperand Expr:(3735928559)>>
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95637 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 73aae2a863dc7bdc27506b9d9f8c037cb35bc810
    Author: Lang Hames <lhames at gmail.com>
    Date:   Tue Feb 9 00:50:27 2010 +0000
    
        Fixed a bug in the PBQP allocator's findCoalesces method.
    
        Previously spill registers, whose def indexes are not defined, would sometimes be improperly marked as coalescable with conflicting registers. The new findCoalesces routine conservatively assumes that any register with at least one undefined def is not coalescable with any register it interferes with.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95636 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit f8fdb73df3da757998d2e067b1f62a2b4df1f53d
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 9 00:49:22 2010 +0000
    
        Implement x86 asm parsing support for %st and %st(4)
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95634 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 7b2795d4e1854a9d649280895bea2ead196e45c3
    Author: Lang Hames <lhames at gmail.com>
    Date:   Tue Feb 9 00:45:48 2010 +0000
    
        Added copy sensible construction & assignment to PBQP graphs and fixed a memory access bug in the heuristic solver.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95633 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 4895f0c2e0218dfb21c8e52849e1191b8db23734
    Author: Dale Johannesen <dalej at apple.com>
    Date:   Tue Feb 9 00:42:08 2010 +0000
    
        Debug operands should not be def or kill.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95632 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 2a60d78777508f981da8ba050a16009751e6bcf0
    Author: Lang Hames <lhames at gmail.com>
    Date:   Tue Feb 9 00:41:23 2010 +0000
    
        Changed the definition of an "invalid" slot to include the empty & tombstone values, but not zero.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95631 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit f4c9a75bd96cec540f28ec731274329dfcf2b2b7
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 9 00:40:07 2010 +0000
    
        stop using reserved identifiers.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95630 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit e45e9747b90f8717f22e1c433e5208ad7aee3750
    Author: Eric Christopher <echristo at apple.com>
    Date:   Tue Feb 9 00:35:38 2010 +0000
    
        Add a new pass to do llvm.objsize lowering using SCEV.
        Initial skeleton and SCEVUnknown lowering implemented,
        the rest should come relatively quickly.  Move testcase
        to new directory.
    
        Move pass to right before SimplifyLibCalls - which is
        moved down a bit so we can take advantage of a few opts.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95628 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit d332011a64483f20d6095defb03d03ce0dbd32f1
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 9 00:34:28 2010 +0000
    
        pass stringref by value instead of by const&
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95627 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 38600491dcf049ee6444b4c9b3a5e805b3ed89c9
    Author: Dan Gohman <gohman at apple.com>
    Date:   Tue Feb 9 00:29:29 2010 +0000
    
        Add explicit keywords.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95626 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 945d6e6ef5500953740ddf25d349b7d8553b3539
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 9 00:11:10 2010 +0000
    
        move PR6212 to this file.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95624 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 60992d698f56b41c8052610257dd0a84900e8b96
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 9 00:05:45 2010 +0000
    
        enhance bits_storage to work with enums by using a c-style
        cast instead of reinterpret_cast, fixing PR6243.  Apparently
        reinterpret_cast and I aren't getting along today.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95622 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 47a9f41cc78716c82d2bbe2ce4b0211d33a916cf
    Author: Dan Gohman <gohman at apple.com>
    Date:   Tue Feb 9 00:02:37 2010 +0000
    
        Implement AsmPrinter support for several more operators which have
        direct MCExpr equivalents. Don't use MCExpr::Shr because it isn't
        consistent between targets.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95620 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 2376dd8e47d549492464909444dff454c23a7b3d
    Author: Dan Gohman <gohman at apple.com>
    Date:   Mon Feb 8 23:58:47 2010 +0000
    
        Document that MCExpr::Mod is actually remainder.
    
        Document that MCExpr::Div, Mod, and the comparison operators are all
        signed operators.
    
        Document that the comparison operators' results are target-dependent.
    
        Document that the behavior of shr is target-dependent.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95619 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 8479c1b655a03a1c166221803312525333cc2f46
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Mon Feb 8 23:56:03 2010 +0000
    
        fix some problems handling large vectors reported in PR6230
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95616 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit cba43384cca80445e3c3f75208aeba9cfc3c25e4
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Mon Feb 8 23:48:10 2010 +0000
    
        this is done, tested by CodeGen/ARM/iabs.ll
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95609 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 015b886f496c17e3283b12ee9898e3795fe17964
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Mon Feb 8 23:47:34 2010 +0000
    
        convert to filecheck.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95608 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit b31a0feb5bf1db49cb3a9be767650a7b6a4a5f74
    Author: Sean Callanan <scallanan at apple.com>
    Date:   Mon Feb 8 23:34:25 2010 +0000
    
        Added header file declarations and .exports entries
        for the new APIs offered by the enhanced disassembler
        for inspecting operands.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95606 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit f4e2d98e4e90b4cd1042261bf561b83cd3971d5a
    Author: Devang Patel <dpatel at apple.com>
    Date:   Mon Feb 8 23:27:46 2010 +0000
    
        test case for r95604.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95605 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 98b68dabfc5f27450a8827437dbc66ce9736f987
    Author: Jim Grosbach <grosbach at apple.com>
    Date:   Mon Feb 8 23:22:00 2010 +0000
    
        tighten up eh.setjmp sequence a bit.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95603 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit f444ae4711a92742b13d76d3174611058cfb2c40
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Mon Feb 8 23:10:08 2010 +0000
    
        now that @GOTOFF is no longer represented as a suffix on a
        MCSymbol, we can remove the 'suffix' argument of
        GetBlockAddressSymbol.  Do so.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95601 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit e7566f7ea341feb29e7d06d560ea0468f9da7e76
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Mon Feb 8 23:03:41 2010 +0000
    
        unify the paths for external symbols and global variables:
         2 files changed, 48 insertions(+), 83 deletions(-)
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95599 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 878b5bee0314e26770cf4c4940c250c68707d1c5
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Mon Feb 8 22:52:47 2010 +0000
    
        switch the rest of the "@ concatentation" logic in the X86
        backend to use X86MCTargetExpr, simplifying a bunch of code.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95595 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit d4b7310a90a8dc31334903ce141fb6728bef4a0d
    Author: Sean Callanan <scallanan at apple.com>
    Date:   Mon Feb 8 22:50:23 2010 +0000
    
        Fixed the AT&T AsmLexer to report the proper strings
        for register tokens.  Before, if it encountered
        '%al,' it would report 'al,' as the token.  Now it
        correctly reports '%al'.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95594 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 3c9bf8bf6d2ac83f79f0e3d5f3f7de7ae1579ef9
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Mon Feb 8 22:33:55 2010 +0000
    
        switch ELF @GOTOFF references to use X86MCTargetExpr.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95593 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 36657aab3e97cf1ca68815bf7eba7b5b4e080b30
    Author: Dan Gohman <gohman at apple.com>
    Date:   Mon Feb 8 22:19:11 2010 +0000
    
        ConstantFoldConstantExpression can theoretically return the original
        expression; don't go into an infinite loop if it does.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95591 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 0fdcbcae5f72970bc4c9732ecd9c72d0e4bed5e1
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Mon Feb 8 22:09:08 2010 +0000
    
        add an x86 implementation of MCTargetExpr for
        representing @GOT and friends.  Use it for
        personality references as a first use.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95588 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 0d2e850f5ff5a513c8ab0177b034361f2f489cba
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Mon Feb 8 22:07:36 2010 +0000
    
        don't make hte dtor private or we can't construct the class.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95587 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit f0273f0d4692800e282fa4a1babcf3511a22fe8a
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Mon Feb 8 22:05:38 2010 +0000
    
        use a c-style cast instead of reinterpret-cast, as sometimes the
        cast needs to adjust for a vtable pointer when going from base to
        derived type (when the base doesn't have a vtable but the
        derived type does).
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95585 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit d1240766902e48f93afc1b46520bc146007bdb9f
    Author: Johnny Chen <johnny.chen at apple.com>
    Date:   Mon Feb 8 22:02:41 2010 +0000
    
        Add VCVTR (between floating-point and integer, VFP) for disassembly purpose.
        The 'R' suffix means the to-integer operations use the rounding mode specified
        by the FPSCR, encoded as Inst{7} = 0.
    
        A8.6.295
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95584 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ea0b08efa466c274c270305165ea473406353d7a
    Author: Dan Gohman <gohman at apple.com>
    Date:   Mon Feb 8 22:02:38 2010 +0000
    
        When CodeGen'ing unoptimized code, there may be unfolded constant expressions
        in global initializers. Instead of aborting, attempt to fold them on the
        spot. If folding succeeds, emit the folded expression instead.
    
        This fixes PR6255.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95583 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 642a130ec467059b96527271834db7ec40c5eb0c
    Author: Dan Gohman <gohman at apple.com>
    Date:   Mon Feb 8 22:00:06 2010 +0000
    
        Add const qualifiers.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95582 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 739b7feb51bda6378f4a403e248cdb36ac4d28e0
    Author: Dale Johannesen <dalej at apple.com>
    Date:   Mon Feb 8 21:53:27 2010 +0000
    
        Apply the 95471 fix to SelectionDAGBuilder as well;
        we can get in here if FastISel gives up in a block.
        (Actually the two copies of this need to be unified.  Later.)
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95579 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 95d7e60ad7d30e54f42e40ac6d6362e8ed079821
    Author: Dan Gohman <gohman at apple.com>
    Date:   Mon Feb 8 20:34:14 2010 +0000
    
        In guaranteed tailcall mode, don't decline the tailcall optimization
        for blocks ending in "unreachable".
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95565 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit a64ddd5cca43fd3abfaa3191f01ff1ecc762ada4
    Author: Dan Gohman <gohman at apple.com>
    Date:   Mon Feb 8 20:27:50 2010 +0000
    
        Rename the PerformTailCallOpt variable to GuaranteedTailCallOpt to reflect
        its current purpose.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95564 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 9d81583775836536a9e7a7c2d0140ab236a67f98
    Author: Johnny Chen <johnny.chen at apple.com>
    Date:   Mon Feb 8 19:41:48 2010 +0000
    
        Add VCMP (VFP floating-point compare without 'E' bit set) for disassembly purpose.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95560 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 1020ff0702994f0ae376d644967f824716e11182
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Mon Feb 8 19:41:07 2010 +0000
    
        add scaffolding for target-specific MCExprs.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95559 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 8f85fa82f062103cbbf764911e4c29720bbdee01
    Author: Duncan Sands <baldrick at free.fr>
    Date:   Mon Feb 8 19:36:51 2010 +0000
    
        Flesh out the list of predicates, for those who like this style.  I was
        looking for isPointer, and added the rest for uniformity.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95557 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 683f4fdca2b99ea8313f4ec9e95d91f1ceadbe2b
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Mon Feb 8 18:08:46 2010 +0000
    
        ImmutableIntervalMap: Fix for unqualified lookup into dependent base class, done
        by clang's -fixit! :)
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95551 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit f4bd310a7b73b1e80acb35c8c415db368ca854d0
    Author: Johnny Chen <johnny.chen at apple.com>
    Date:   Mon Feb 8 17:26:09 2010 +0000
    
        Added VMOVRRS/VMOVSRR to ARMInstrVFP.td for disassembly purpose.
    
        A8.6.331 VMOV (between two ARM core registers and two single-precision registers)
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95548 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 11449e728495f679b4c6b67dc3d656cd04796f9a
    Author: Duncan Sands <baldrick at free.fr>
    Date:   Mon Feb 8 11:03:31 2010 +0000
    
        Fix some typos.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95542 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 0e8ce476cbf724f9490deefccf6a170b7a1330a7
    Author: Edwin Török <edwintorok at gmail.com>
    Date:   Mon Feb 8 08:37:27 2010 +0000
    
        Fix x86 JIT stub on MSVC.
        Thanks to Kristaps Straupe for noticing the bug.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95537 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit abd3dd6ba14de9b44290bb2b4861406fdc076fa0
    Author: Sanjiv Gupta <sanjiv.gupta at microchip.com>
    Date:   Mon Feb 8 06:08:32 2010 +0000
    
        Fixed build error for redefinition.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95532 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 022752dff182da48cd5f6db70a90a331d7aaaa46
    Author: Sanjiv Gupta <sanjiv.gupta at microchip.com>
    Date:   Mon Feb 8 05:56:37 2010 +0000
    
        Add uppercase and lowercase part defines in driver.
        Use a temp dir with a unique name in the current dir itself.
        Use forward_value instead of unpack_values.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95530 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 640885d04fc3bdd4d001fea92ef486a325fb0d72
    Author: Nick Lewycky <nicholas at mxc.ca>
    Date:   Sun Feb 7 21:13:46 2010 +0000
    
        Make the destructor for TypeMapBase protected. Spotted by Duncan Sands with
        cppcheck!
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95527 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit b29f6887c9b9ca1815e71885a14de6f4119a61ee
    Author: Duncan Sands <baldrick at free.fr>
    Date:   Sun Feb 7 21:09:22 2010 +0000
    
        Give DwarfPrinter a protected (but not virtual) destructor.  Cppcheck
        warns about this base class not having a virtual destructor, but since
        this class has no virtual methods and neither it or the types derived
        from it has a destructor, a protected trivial destructor will do (and
        shuts cppcheck up) the trick without the cost of introducing a vtable.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95526 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 78506244d7ca04009b74cba63a767bfff889362b
    Author: Bruno Cardoso Lopes <bruno.cardoso at gmail.com>
    Date:   Sat Feb 6 21:00:02 2010 +0000
    
        Add suport for VASTART on Mips.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95506 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ac629f51303d4578b4024ea9112bdea846b1fb6b
    Author: Bruno Cardoso Lopes <bruno.cardoso at gmail.com>
    Date:   Sat Feb 6 19:20:49 2010 +0000
    
        First step towards varargs support in Mips:
        - o32 cc must pass all arguments in A0...A3 and stack regardless
        if its type (but respect the alignment).
        - Store all variable arguments back to the caller stack.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95500 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 4377cdcc95e445d0cd120d7911bf73603ca1e1c1
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Sat Feb 6 09:07:11 2010 +0000
    
        Run codegen dce pass for all targets at all optimization levels. Previously it's
        only run for x86 with fastisel. I've found it being very effective in
        eliminating some obvious dead code as result of formal parameter lowering
        especially when tail call optimization eliminated the need for some of the loads
        from fixed frame objects. It also shrinks a number of the tests. A couple of
        tests no longer make sense and are now eliminated.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95493 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 63d86fe59317d155058309d486d9b12c9749af7e
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Sat Feb 6 09:00:30 2010 +0000
    
        Remove a large test case that (soon will) no longer make sense.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95492 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ebcb016721cf15218e983e00896d7d0fd9c69aee
    Author: Bob Wilson <bob.wilson at apple.com>
    Date:   Sat Feb 6 05:55:20 2010 +0000
    
        Fix an uninitialized value.  Radar 7609421.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95488 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ddc00c2e5437a927e17e5f9990e95c3adf202a01
    Author: Rafael Espindola <rafael.espindola at gmail.com>
    Date:   Sat Feb 6 03:32:21 2010 +0000
    
        Fix alignment on ppc linux. This fixes the build of crtend.o
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95477 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit a338d790c56083d455bc753f473949f7c77ee3e9
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Sat Feb 6 03:28:46 2010 +0000
    
        Do not emit callseq instructions around sibcalls. This eliminated some unnecessary stack adjustments.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95475 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 4fdd461c821799cfb547167b3f6dc339a0d4531c
    Author: Dale Johannesen <dalej at apple.com>
    Date:   Sat Feb 6 02:28:32 2010 +0000
    
        Add a Debug bit to MachineOperand, for uses that
        are from debug info.  Add an iterator to MachineRegisterInfo
        to skip Debug operands when walking the use list.  No
        functional change yet.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95473 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 8ce1aefd18dd02f4a7a780423d83f0934f2ff883
    Author: Dale Johannesen <dalej at apple.com>
    Date:   Sat Feb 6 02:26:02 2010 +0000
    
        After Victor's latest commits I am seeing null
        addresses in dbg.declare; ignore this for the
        moment to prevent things from breaking.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95471 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 8d5b21baf41576fa4016a3c6d838c1b77d8f000b
    Author: Victor Hernandez <vhernandez at apple.com>
    Date:   Sat Feb 6 01:31:55 2010 +0000
    
        Linker should not remap null operands of metadata
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95468 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit a48cde4a81346c7b01a3359b48d0fdb1434b2ec2
    Author: Victor Hernandez <vhernandez at apple.com>
    Date:   Sat Feb 6 01:21:09 2010 +0000
    
        Function-local metadata whose operands had been optimized to no longer refer to function-local IR were not getting written by BitcodeWriter; solution is for these metadata to be enumerated just like global metadata.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95467 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 3f30baafce7c09af90bb6e9e79c152f9eb4b7b0b
    Author: Jakob Stoklund Olesen <stoklund at 2pi.dk>
    Date:   Sat Feb 6 01:16:28 2010 +0000
    
        Reintroduce the InlineHint function attribute.
    
        This time it's for real! I am going to hook this up in the frontends as well.
    
        The inliner has some experimental heuristics for dealing with the inline hint.
        When given a -respect-inlinehint option, functions marked with the inline
        keyword are given a threshold just above the default for -O3.
    
        We need some experiments to determine if that is the right thing to do.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95466 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 268778b077fe46127e6a00235ce728bf64858387
    Author: Bob Wilson <bob.wilson at apple.com>
    Date:   Sat Feb 6 01:16:25 2010 +0000
    
        Add a test for my change to disable reassociation for i1 types.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95465 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 13ccbeb95d19fd81634289f1bb7ecdd1bebd056f
    Author: Devang Patel <dpatel at apple.com>
    Date:   Sat Feb 6 01:02:37 2010 +0000
    
        Set DW_AT_artificial only if argument is marked as artificial.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95461 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ac664e555198be231007a735bd10b376fbf08c59
    Author: Bob Wilson <bob.wilson at apple.com>
    Date:   Sat Feb 6 00:24:38 2010 +0000
    
        Handle AddrMode6 (for NEON load/stores) in Thumb2's rewriteT2FrameIndex.
        Radar 7614112.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95456 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 9f5a066d16bee2846ae86747422154fae74382ce
    Author: Jakob Stoklund Olesen <stoklund at 2pi.dk>
    Date:   Fri Feb 5 23:21:31 2010 +0000
    
        Don't unroll loops containing function calls.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95454 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ed4441a21fde2e7c649dff89fbc78469111e2be9
    Author: Jakob Stoklund Olesen <stoklund at 2pi.dk>
    Date:   Fri Feb 5 23:21:18 2010 +0000
    
        Update CodeMetrics to count 'big' function calls explicitly.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95453 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit a27bd000ed8d5a90462c151449de482167518d73
    Author: Devang Patel <dpatel at apple.com>
    Date:   Fri Feb 5 23:09:20 2010 +0000
    
        Do not generate specification DIE for nested functions.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95452 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit f77c07ec9ec5fce04c1c12449d86e8aa76d89958
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Fri Feb 5 22:56:11 2010 +0000
    
        fix incorrect encoding of SBB8mi that Kevin noticed.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95448 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit fb382fa1126c564624a73f3f3c342e7257c65965
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Fri Feb 5 22:49:06 2010 +0000
    
        fix a case where we'd mis-encode fisttp because of an incorrect (and
        redundant with a correct one) pattern that was added for the disassembler.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95446 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 58758822aa166beecd3633bb2dcc0d1cb40270f7
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Fri Feb 5 22:48:33 2010 +0000
    
        add note.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95445 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 76c3b4645cfb88bed06ac303e3bd5eca7fbd76d3
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Fri Feb 5 22:46:46 2010 +0000
    
        remove fixme
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95444 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit fede66007333c9d37b55becc6478c660ffbb2f97
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Fri Feb 5 22:20:08 2010 +0000
    
        print encodings like this:
        	pslld	69, %mm3                ## encoding: [0x0f,0xf2,0x1c,0x25,0x45,0x00,0x00,0x00]
    
        instead of like this:
        	pslld	69, %mm3                ## encoding: [0x0f,0xf2,0x1c,0x25,0x45,0000,0000,0000]
    
        this only affects 0.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95441 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit d29fd16ba6730e5d468b3c801036defc38d4fee8
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Fri Feb 5 22:10:22 2010 +0000
    
        port X86InstrInfo::determineREX over to the new encoder.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95440 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit e263df713726cad8194b57e152b239fefe116328
    Author: Jakob Stoklund Olesen <stoklund at 2pi.dk>
    Date:   Fri Feb 5 22:03:18 2010 +0000
    
        Teach SimplifyCFG about magic pointer constants.
    
        Weird code sometimes uses pointer constants other than null. This patch
        teaches SimplifyCFG to build switch instructions in those cases.
    
        Code like this:
    
        void f(const char *x) {
          if (!x)
            puts("null");
          else if ((uintptr_t)x == 1)
            puts("one");
          else if (x == (char*)2 || x == (char*)3)
            puts("two");
          else if ((intptr_t)x == 4)
            puts("four");
          else
            puts(x);
        }
    
        Now becomes a switch:
    
        define void @f(i8* %x) nounwind ssp {
        entry:
          %magicptr23 = ptrtoint i8* %x to i64            ; <i64> [#uses=1]
          switch i64 %magicptr23, label %if.else16 [
            i64 0, label %if.then
            i64 1, label %if.then2
            i64 2, label %if.then9
            i64 3, label %if.then9
            i64 4, label %if.then14
          ]
    
        Note that LLVM's own DenseMap uses magic pointers.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95439 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ea6cb061194032ea1cc02f3a0fa464862414c8c7
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Fri Feb 5 21:51:35 2010 +0000
    
        wire up 64-bit MCCodeEmitter.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95438 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ca4ccadd5a260f18e4a0028eb8e98eb66aed0119
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Fri Feb 5 21:34:18 2010 +0000
    
        really kill off the last MRMInitReg inst, remove logic from encoder.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95437 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit f2187ef165bbd8862570d9a442efa069a2f21c32
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Fri Feb 5 21:30:49 2010 +0000
    
        lower the last of the MRMInitReg instructions in MCInstLower.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95435 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 1d1881dc28eaf484040bae6693cd05a37268f3e6
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Fri Feb 5 21:21:06 2010 +0000
    
        teach X86MCInstLower to lower the MOV32r0 and MOV8r0
        pseudo instructions.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95433 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 8a7f3c694c409396d5afc89a011156d4ba0cf540
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Fri Feb 5 21:15:57 2010 +0000
    
        genericize helpers, use them for MOV16r0/MOV64r0
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95432 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 5c9facc0f5829c9a757001a9be72fe525a7092c6
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Fri Feb 5 21:13:48 2010 +0000
    
        factor code better in X86MCInstLower::Lower, teach it to
        lower the SETB* instructions.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95431 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 4e91ee7ed44cec2961c224a7658517bfdb571339
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Fri Feb 5 19:53:02 2010 +0000
    
        fix logical-select to invoke filecheck right, and fix hte instcombine
        xform it is checking to actually pass.  There is no need to match
        m_SelectCst<0, -1> since instcombine canonicalizes that into not(sext).
    
        Add matches for sext(not(x)) in addition to not(sext(x)).
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95420 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit bef7eae141f95e6f9bac2d89e32821aac60be254
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Fri Feb 5 19:37:31 2010 +0000
    
        implement the rest of the encoding types.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95414 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit e49d7f0238b69efa30030feaa7c0902de2d34372
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Fri Feb 5 19:24:13 2010 +0000
    
        move functions for decoding X86II values into the X86II namespace.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95410 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit e124253d75ebdf633ea46bfc88249f0d8816da80
    Author: Dan Gohman <gohman at apple.com>
    Date:   Fri Feb 5 19:24:11 2010 +0000
    
        Implement releaseMemory in CodeGenPrepare and free the BackEdges
        container data. This prevents it from holding onto dangling
        pointers and potentially behaving unpredictably.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95409 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 00da15e44575b6dd929c98ffcea255fd1e3c417f
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Fri Feb 5 19:20:30 2010 +0000
    
        constant propagate a method away.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95408 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit d288fa5c437772beb0e8fd80321f3d30483bec69
    Author: Dan Gohman <gohman at apple.com>
    Date:   Fri Feb 5 19:20:15 2010 +0000
    
        Use a SmallSetVector instead of a SetVector; this code showed up as a
        malloc caller in a profile.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95407 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 4cb61fd7b7f6ab2a46be75570f738b78d4759c7b
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Fri Feb 5 19:16:26 2010 +0000
    
        change getSizeOfImm and getBaseOpcodeFor to just take
        TSFlags directly instead of a TargetInstrDesc.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95405 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ee40acfedd0178837836456fd0be4056a490c481
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Fri Feb 5 19:04:37 2010 +0000
    
        add some more encodings.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95403 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 0444fea9072a78d761b68d00d7d65596a13a2439
    Author: Eric Christopher <echristo at apple.com>
    Date:   Fri Feb 5 19:04:06 2010 +0000
    
        Remove this code for now. I have a better idea and will rewrite with
        that in mind.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95402 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit aed0106212e26a122c13834c5a99aebcd94e7caa
    Author: Jeffrey Yasskin <jyasskin at google.com>
    Date:   Fri Feb 5 18:09:19 2010 +0000
    
        Make lit's gtest support honor config.environment.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95398 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit f4af5e911cadff4f2f5a01d8bace2adc5cadbaeb
    Author: Johnny Chen <johnny.chen at apple.com>
    Date:   Fri Feb 5 18:04:58 2010 +0000
    
        VMOVRRD and VMOVDRR both have Inst{7-6} = 0b00.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95397 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 56fbc4ede9610b426e5dbf62a5f7362082c2ce2e
    Author: Jeffrey Yasskin <jyasskin at google.com>
    Date:   Fri Feb 5 16:19:36 2010 +0000
    
        Move --march, --mcpu, and --mattr from JIT/TargetSelect.cpp to lli.cpp.
        llc.cpp also defined these flags, meaning that when I linked all of LLVM's
        libraries into a single shared library, llc crashed on startup with duplicate
        flag definitions.  This patch passes them through the EngineBuilder into
        JIT::selectTarget().
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95390 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 739d920a390fa32de22d3559c7f330e664b8cbed
    Author: Bill Wendling <isanbard at gmail.com>
    Date:   Fri Feb 5 11:21:05 2010 +0000
    
        Make test more fucused eliminating extraneous bits.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95384 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 3e9ffb3d5bf4f0694d95396cf9be6236eb7b7705
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Fri Feb 5 07:32:18 2010 +0000
    
        MC: Change default comment column to 40 characters.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95378 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit e1253ac260d7878f554e92d5faca350e05e3da1c
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Fri Feb 5 06:37:00 2010 +0000
    
        Fix test.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95373 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit f0216b2e36ecb4f9495a76c6742b5130fc28f554
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Fri Feb 5 06:16:07 2010 +0000
    
        implement the non-relocation forms of memory operands
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95368 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 1af931d655ccd22047e6f10b4bc87275099048d3
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Fri Feb 5 02:21:12 2010 +0000
    
        Handle tail call with byval arguments.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95351 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 9f1617ad56becb49ba3acd0f0277a852e747c7d4
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Fri Feb 5 02:18:40 2010 +0000
    
        start adding MRMDestMem, which requires memory form mod/rm encoding
        to start limping.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95350 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit cb61e493e8166c3c5fa2e9be00cf7c2258a0454c
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Fri Feb 5 01:53:19 2010 +0000
    
        Add a few more encodings, we can now encode all of:
    
        	pushl	%ebp
        	movl	%esp, %ebp
        	movl	$42, %eax
        	popl	%ebp
        	ret
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95344 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 14eaa6d49a9c27f5ca3568336f423dbd3a9a362b
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Fri Feb 5 01:27:11 2010 +0000
    
        When the scheduler unfold a load folding instruction it move some of the predecessors to the unfolded load. It decides what gets moved to the load by checking whether the new load is using the predecessor as an operand. The check neglects the cases whether the predecessor is a flagged scheduling unit.
        rdar://7604000
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95339 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 7b8b3190e0b394f680aec4a3a2bbeb8d9683f8c6
    Author: Bill Wendling <isanbard at gmail.com>
    Date:   Fri Feb 5 00:17:02 2010 +0000
    
        An empty global constant (one of size 0) may have a section immediately
        following it. However, the EmitGlobalConstant method wasn't emitting a body for
        the constant. The assembler doesn't like that. Before, we were generating this:
    
          .zerofill __DATA, __common, __cmd, 1, 3
    
        This fix puts us back to that semantic.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95336 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 4754ce2bbdbc22901c895e808f6d3b59fd0e6ca5
    Author: Bob Wilson <bob.wilson at apple.com>
    Date:   Thu Feb 4 23:32:37 2010 +0000
    
        Do not reassociate expressions with i1 type.  SimplifyCFG converts some
        short-circuited conditions to AND/OR expressions, and those expressions
        are often converted back to a short-circuited form in code gen.  The
        original source order may have been optimized to take advantage of the
        expected values, and if we reassociate them, we change the order and
        subvert that optimization.  Radar 7497329.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95333 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit d0ee4d055a7df10fd00e7e2c79f49150794dc84b
    Author: Evan Phoenix <evan at fallingsnow.net>
    Date:   Thu Feb 4 19:56:59 2010 +0000
    
        Disable external stubs for X86-32 and X86-64
    
        Instruction selection for X86 now can choose an instruction
        sequence that will fit any address of any symbol, no matter
        the pointer width. X86-64 uses a mov+call-via-reg sequence
        for this.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95323 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 6d58f1c83e473d7ef4bbe5eca61b44caf2ee9217
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Thu Feb 4 19:07:06 2010 +0000
    
        Fix typo Duncan noticed.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95322 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 7a89cf2a84a9742cb18541da4cf7c9256ae4f72c
    Author: Jakob Stoklund Olesen <stoklund at 2pi.dk>
    Date:   Thu Feb 4 18:48:20 2010 +0000
    
        Increase inliner thresholds by 25.
    
        This makes the inliner about as agressive as it was before my changes to the
        inliner cost calculations. These levels give the same performance and slightly
        smaller code than before.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95320 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 6858dd68e42d90b458b0b447612323bcaab6028c
    Author: Jakob Stoklund Olesen <stoklund at 2pi.dk>
    Date:   Thu Feb 4 18:46:28 2010 +0000
    
        Fix small bug in handling instructions with more than one implicitly defined operand.
    
        ProcessImplicitDefs would only mark one operand per instruction with <undef>.
        This fixed PR6086.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95319 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 224fafa77876e93609df4cbd2f1fc8189353f520
    Author: Benjamin Kramer <benny.kra at googlemail.com>
    Date:   Thu Feb 4 18:40:11 2010 +0000
    
        Get the LLVMC tests working with clang++ by removing the problematic CXXFLAG in lit.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95318 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 08c61aa2f10ad1819dcb72b9cf97e63e9ae1aad0
    Author: Benjamin Kramer <benny.kra at googlemail.com>
    Date:   Thu Feb 4 11:57:54 2010 +0000
    
        Apply property changes from PR6228.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95303 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 361dab7c6f2a1549ad87ace3fbfd8cb6845f7a4f
    Author: Edwin Török <edwintorok at gmail.com>
    Date:   Thu Feb 4 09:31:35 2010 +0000
    
        New flag for GenLibDeps, and llvm-config-perobjincl.
    
        This allows to show the explicit files that need to be built/linked to get an
        LLVM component.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95300 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 5856a4fae7c87dc2938c1442f4ce73e9117ed52e
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Thu Feb 4 07:32:01 2010 +0000
    
        move the PR6214 microoptzn to this file.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95299 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ec8ea91a09cc6dfaadb5c1c867467f1e4185e236
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Thu Feb 4 07:11:08 2010 +0000
    
        fix a broken archive that was breaking dejagnu only (not lit)
        after r95292
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95296 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 8b36ef7f8be0244c1f43d84eed43178991668089
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Thu Feb 4 06:47:24 2010 +0000
    
        Re-enable x86 tail call optimization.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95295 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit bd2bd23ea5f37c9bf362137e0fcab6ce798b9d37
    Author: Eric Christopher <echristo at apple.com>
    Date:   Thu Feb 4 06:41:27 2010 +0000
    
        Temporarily revert this since it appears to have caused a build
        failure.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95294 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit c102e823b361cdf9c0f7e0d95b3668e13617d7da
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Thu Feb 4 06:34:01 2010 +0000
    
        add support for the sparcv9-*-* target triple to turn on
        64-bit sparc codegen.  Patch by Nathan Keynes!
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95293 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 2d60cc5451bbcc875d8d0d4c42a3dc970a7469e8
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Thu Feb 4 06:19:43 2010 +0000
    
        From PR6228:
    
        "Attached patch removes the extra NUL bytes from the output and changes
        test/Archive/MacOSX.toc from a binary to a text file (removes
        svn:mime-type=application/octet-stream and adds svn:eol-style=native).  I can't
        figure out how to get SVN to include the new contents of the file in the patch
        so I'm attaching it separately."
    
        Patch by James Abbatiello!
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95292 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit fb6f779a5ff24d22b74bb396232ac84b9386d682
    Author: Eric Christopher <echristo at apple.com>
    Date:   Thu Feb 4 02:55:34 2010 +0000
    
        Rework constant expr and array handling for objectsize instcombining.
    
        Fix bugs where we would compute out of bounds as in bounds, and where
        we couldn't know that the linker could override the size of an array.
    
        Add a few new testcases, change existing testcase to use a private
        global array instead of extern.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95283 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit fa66ea30c2cf83a19157ec92b4e520f5cf4bd299
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Thu Feb 4 02:45:02 2010 +0000
    
        It's too risky to eliminate sext / zext of call results for tail call optimization even if the caller / callee attributes completely match. The callee may have been bitcast'ed (or otherwise lied about what it's doing).
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95282 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 9462c3a8c6cabfac5824aaf1274a210edaca3993
    Author: Dan Gohman <gohman at apple.com>
    Date:   Thu Feb 4 02:43:51 2010 +0000
    
        Change the argument to getIntegerSCEV to be an int64_t, rather
        than int. This will make it more convenient for LSR, which does
        a lot of things with int64_t offsets.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95281 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 5c9b1478e9781dfd689a7297d401f259f67c3d68
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Thu Feb 4 02:40:39 2010 +0000
    
        Indirect tail call has to go through a call preserved register since it's after callee register pops. X86 isel lowering is using EAX / R11 and it was somehow adding that to function live out. That prevented the real function return register from being added to the function live out list and bad things happen.
        This fixes 483.xalancbmk (with tail call opt).
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95280 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit d77df71803f0e9d49c876caa31f4ace2c4b4cd98
    Author: Sean Callanan <scallanan at apple.com>
    Date:   Thu Feb 4 01:43:08 2010 +0000
    
        Filled in a few new APIs for the enhanced
        disassembly library that provide access to
        instruction information, and fixed ambiguous
        wording in the comments for the header.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95274 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 0926ed7137ab99acade66f1c9bf746d040a2db27
    Author: Dan Gohman <gohman at apple.com>
    Date:   Thu Feb 4 01:42:13 2010 +0000
    
        Use a tab instead of space after .type, for consistency.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95272 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 40787dcb640de2fc69c0291e1a788c46d0ed3d78
    Author: Dale Johannesen <dalej at apple.com>
    Date:   Thu Feb 4 01:33:43 2010 +0000
    
        Rewrite FP constant handling in DEBUG_VALUE yet
        again, so it more or less handles long double.
        Restore \n removed in latest MC frenzy.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95271 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 5aa5f8dbf6127b2c4afe4f1bb15396e82fdca049
    Author: Victor Hernandez <vhernandez at apple.com>
    Date:   Thu Feb 4 01:13:08 2010 +0000
    
        Fix (and test) function-local metadata that occurs before the instruction that it refers to; fix is to not enumerate operands of function-local metadata until after all instructions have been enumerated
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95269 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 4fefacb214916e74d81d132fcb76a089e020499c
    Author: Eric Christopher <echristo at apple.com>
    Date:   Wed Feb 3 23:56:07 2010 +0000
    
        If we're dealing with a zero-length array, don't lower to any
        particular size, we just don't know what the length is yet.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95266 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 1bce8ccee05dd5340560bc330068e5d6e3602f99
    Author: Dale Johannesen <dalej at apple.com>
    Date:   Wed Feb 3 22:33:17 2010 +0000
    
        This test passes now on ppc darwin; if it doesn't pass
        on some other ppc say something on the list.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95265 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 07c1cb52549b6c95ce42c23893bff6764b6e7042
    Author: Dale Johannesen <dalej at apple.com>
    Date:   Wed Feb 3 22:29:02 2010 +0000
    
        This test passes now on ppc darwin, so reenable it.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95264 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit c09099dadac902f3e672e26c0831d6b2151d779f
    Author: Dale Johannesen <dalej at apple.com>
    Date:   Wed Feb 3 22:24:49 2010 +0000
    
        Debugging is now reenabled on PPC darwin, so reenable
        these tests (they pass).
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95263 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 777872cc6a319b8695bd62962aaeb9ebbf3d969e
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 3 21:57:59 2010 +0000
    
        enhance new encoder to support prefixes + RawFrm
        instructions with no operands.  It can now handle
    
        define void @test2() nounwind { ret void }
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95261 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 364fb537e4e3f3c4bb46d15a086b682a36bb3065
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 3 21:43:43 2010 +0000
    
        set up some infrastructure, some minor cleanups.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95260 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit a825a3149e613e5e42730fa790f9e39e5a9f635c
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Wed Feb 3 21:40:40 2010 +0000
    
        Speculatively disable x86 automatic tail call optimization while we track down a self-hosting issue.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95259 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 41aed3c15b65cdec29da235390b3e3cd7b11ad7a
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Wed Feb 3 21:39:04 2010 +0000
    
        Make test less fragile
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95258 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit fd2d81f36803ff0e9f0efdaea13b0276b49d7843
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 3 21:24:49 2010 +0000
    
        stub out a new X86 encoder, which can be tried with
        -enable-new-x86-encoder until its stable.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95256 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 1bb768cf0398615a2a6cbc4e98af77eefe960764
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 3 21:14:33 2010 +0000
    
        rename createX86MCCodeEmitter to more accurately reflect what it creates.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95254 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ae5bc0f4122457a67bbfcfddd89b063803e34e3d
    Author: Kevin Enderby <enderby at apple.com>
    Date:   Wed Feb 3 21:04:42 2010 +0000
    
        Added support for X86 instruction prefixes so llvm-mc can assemble them.  The
        Lock prefix, Repeat string operation prefixes and the Segment override prefixes.
        Also added versions of the move string and store string instructions without the
        repeat prefixes to X86InstrInfo.td. And finally marked the rep versions of
        move/store string records in X86InstrInfo.td as isCodeGenOnly = 1 so tblgen is
        happy building the disassembler files.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95252 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 2831d5d4aff7323c6526bfa99857dac2bf94295e
    Author: Devang Patel <dpatel at apple.com>
    Date:   Wed Feb 3 20:08:48 2010 +0000
    
        Emit appropriate expression to find virtual base offset.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95242 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 51ea0cc2933924feb130d52d071e5bdee8ed694b
    Author: Devang Patel <dpatel at apple.com>
    Date:   Wed Feb 3 19:57:19 2010 +0000
    
        Provide interface to identifiy artificial methods.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95240 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit b1af53a796f93066a34cdf4cf7b9371aa173c1c3
    Author: Jeffrey Yasskin <jyasskin at google.com>
    Date:   Wed Feb 3 19:18:04 2010 +0000
    
        r94686 changed all ModuleProvider parameters to Modules, which made the
        1-argument ExecutionEngine::create(Module*) ambiguous with the signature that
        used to be ExecutionEngine::create(ModuleProvider*, defaulted_params).  Fixed
        by removing the 1-argument create().  Fixes PR6221.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95236 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 819e4ea9858786a3a202642b179f4dffc0cde9c2
    Author: Jeffrey Yasskin <jyasskin at google.com>
    Date:   Wed Feb 3 18:49:55 2010 +0000
    
        Make docs less specific about their versions, at Chris's suggestion.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95231 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 2402ff84538dadd53e6f13f5ad9dd7c6bdfe0ef0
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Wed Feb 3 18:43:46 2010 +0000
    
        Add llvm_supports_darwin_and_target to DejaGNU as well, I'd almost forgotten it
        ever existed. :)
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95230 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 38bec178a30bdb19ad3197fcc0abd6b61fe72ee1
    Author: Jeffrey Yasskin <jyasskin at google.com>
    Date:   Wed Feb 3 18:23:23 2010 +0000
    
        Mention the version in the documentation index and link to the 2.6 docs, which
        is what most readers will actually be aiming for.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95229 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 0889414038faa0c5c8f1fd28db4391c7a1dfabad
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Wed Feb 3 18:18:30 2010 +0000
    
        llvm-mc: Add --show-inst option, for showing the MCInst inline with the assembly
        output.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95227 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 76fd987a802f86d0ca298812b63552a15b7f174d
    Author: Dan Gohman <gohman at apple.com>
    Date:   Wed Feb 3 17:27:31 2010 +0000
    
        Add "Author Date Id Revision" svn:keyword properties to these files, as
        is done with the other html files in doc, to hopefully keep strings like
        "Last modified" current.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95225 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 66b7149074808f51fd6365b509028ff862a05108
    Author: Bob Wilson <bob.wilson at apple.com>
    Date:   Wed Feb 3 17:23:56 2010 +0000
    
        Adjust the heuristics used to decide when SROA is likely to be profitable.
        The SRThreshold value makes perfect sense for checking if an entire aggregate
        should be promoted to a scalar integer, but it is not so good for splitting
        an aggregate into its separate elements.  A struct may contain a large embedded
        array along with some scalar fields that would benefit from being split apart
        by SROA.  Even if the total aggregate size is large, it may still be good to
        perform SROA.  Thus, the most important piece of this patch is simply moving
        the aggregate size comparison vs. SRThreshold so that it guards only the
        aggregate promotion.
    
        We have also been checking the number of elements to decide if an aggregate
        should be split up.  The limit of "SRThreshold/4" seemed rather arbitrary,
        and I don't think it's very useful to derive this limit from SRThreshold
        anyway.  I've collected some data showing that the current default limit of
        32 (since SRThreshold defaults to 128) is a reasonable cutoff for struct
        types.  One thing suggested by the data is that distinguishing between structs
        and arrays might be useful.  There are (obviously) a lot more large arrays
        than large structs (as measured by the number of elements and not the total
        size -- a large array inside a struct still counts as a single element given
        the way we do SROA right now).  Out of 8377 arrays where we successfully
        performed SROA while compiling a large set of benchmarks, only 16 of them had
        more than 8 elements.  And, for those 16 arrays, it's not at all clear that
        SROA was actually beneficial.  So, to offset the compile time cost of
        investigating more large structs for SROA, the patch lowers the limit on array
        elements to 8.
    
        This fixes Apple Radar 7563690.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95224 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit b692ce605e860ee4d6928eab7586d3cfc2302407
    Author: Garrison Venn <gvenn.cfe.dev at gmail.com>
    Date:   Wed Feb 3 12:00:02 2010 +0000
    
        Repository access test commit
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95221 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit b49b883b85ef0c4d56c3343a46bcbea6e4d09a3e
    Author: Zhongxing Xu <xuzhongxing at gmail.com>
    Date:   Wed Feb 3 09:05:21 2010 +0000
    
        Remove redundant declaration.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95213 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit b68773962f3210db4e2a3837197737c8eaa6e0ad
    Author: Zhongxing Xu <xuzhongxing at gmail.com>
    Date:   Wed Feb 3 09:04:11 2010 +0000
    
        Add constructors.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95212 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 1f506f73258301e6cfb4128a3cce5bf93380460a
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 3 06:42:38 2010 +0000
    
        reapply r95206, this time actually delete the code I'm replacing in the third stub case.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95209 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit cd96d73fe03dff21c9fe0bf9787fc34e37411e34
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 3 06:41:18 2010 +0000
    
        revert r95206, it is apparently causing bootstrap failure on i386-darwin9
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95208 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 7a1f1f72708b2ff83d4f5ea1df34e652a73e1ba0
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 3 06:28:13 2010 +0000
    
        print instruction encodings with the existing comment facilities,
        so that llvm-mc -show-encoding prints like this:
    
        	hlt                                                 ## encoding: [0xf4]
    
        instead of like this:
    
        	hlt
                             # encoding: [0xf4]
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95207 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit b8efb41ad3922cdd022a2eedc8bb5ee098e68b91
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 3 06:21:16 2010 +0000
    
        make the x86 backend emit darwin stubs through mcstreamer
        instead of textually.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95206 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit e550c4e717d5135efe0df7e679ec1e83b7ecc0f9
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 3 06:18:30 2010 +0000
    
        make MachineModuleInfoMachO hold non-const MCSymbol*'s instead
        of const ones.  non-const ones aren't very useful, because you can't
        even, say, emit them.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95205 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 73cdb9fff3e6e69e6429be28339d10ae0ba78d1a
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 3 05:55:08 2010 +0000
    
        change addPassesToEmitFile to return true on failure instead of its input,
        add -filetype=null for performance testing and remove -filetype=dynlib,
        which isn't planned to be implemented.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95202 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 73b9dcac300a4b4f5814fd628a774ecd2693b639
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Wed Feb 3 03:55:59 2010 +0000
    
        Revert 94937 and move the noreturn check to codegen.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95198 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit acfc18fbad20b8f2e402408648537a463f3cbb57
    Author: Sean Callanan <scallanan at apple.com>
    Date:   Wed Feb 3 03:46:41 2010 +0000
    
        Fixed the disassembler so it accepts multiple
        instructions on a single line.  Also made it a
        bit more forgiving when it reports errors.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95197 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 7550a4139b55d976e60bf2025e41e9a76d9bc6df
    Author: John McCall <rjmccall at apple.com>
    Date:   Wed Feb 3 03:42:44 2010 +0000
    
        Make APInt::countLeadingZerosSlowCase() treat the contents of padding bits
        as undefined.  Fixes an assertion in APFloat::toString noticed by Dale.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95196 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 4c2d02dcf909a29ad5776b8e320a3e896ec81d91
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Wed Feb 3 03:28:02 2010 +0000
    
        Allow all types of callee's to be tail called. But avoid automatic tailcall if the callee is a result of bitcast to avoid losing necessary zext / sext etc.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95195 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 7aec47e78037512575e13a5b31b059bb2ea02cf6
    Author: Jeffrey Yasskin <jyasskin at google.com>
    Date:   Wed Feb 3 02:11:49 2010 +0000
    
        Reconfigure with autoconf-2.60, and fix autoconf.ac to work with that version.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95191 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 5da1e50388dd0ba4a949dd5c559ffb6c9433abc1
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 3 01:49:49 2010 +0000
    
        don't emit \n's at the start of X86AsmPrinter::runOnMachineFunction,
        .o files don't like that.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95187 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 25137eb1159bc82bdf8a9b6c56a3bc1d05febd8a
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 3 01:46:05 2010 +0000
    
        privatize a bunch of methods and move \n printing into them.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95186 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ed2c379e4c3bf39afbdfe08b573f965a62063b45
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 3 01:41:03 2010 +0000
    
        rename printMachineInstruction -> EmitInstruction
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95184 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 0ee7ca20cd5c9b157c4a1ab9825d6c2f0ba99e96
    Author: Dale Johannesen <dalej at apple.com>
    Date:   Wed Feb 3 01:40:33 2010 +0000
    
        Reapply 95050 with a tweak to check the register class.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95183 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit dab48b4dbe274d58ffe036848efe3f3de25596eb
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 3 01:16:28 2010 +0000
    
        print instructions through the mcstreamer.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95181 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 74887bc2f8910a00660b4dfe55cbd2a3f5639681
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 3 01:15:03 2010 +0000
    
        emit instructions through the streamer.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95180 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 5099786d0b6e63912227de6fe21f1921bb8ca311
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 3 01:13:25 2010 +0000
    
        Finally eliminate printMCInst and send instructions through
        the streamer.  Demo:
    
        $ cat t.ll
        define i32 @test() nounwind {
          ret i32 42
        }
        $ llc t.ll -o -
        ...
        _test:
        	movl	$42, %eax
        	ret
        $ llc t.ll -o t.o -filetype=obj
        $ otool -tv t.o
        t.o:
        (__TEXT,__text) section
        _test:
        00000000	movl	$0x0000002a,%eax
        00000005	ret
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95179 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit f49ae3f1c237f37309d8b8d3c096c902e64156a7
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 3 01:09:55 2010 +0000
    
        rejigger the world so that EmitInstruction prints the \n at
        the end of the instruction instead of expecting the caller to
        do it.  This currently causes the asm-verbose instruction
        comments to be on the next line.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95178 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 89ef2563079e2c3e90116949105928b57eca6c97
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 3 01:00:52 2010 +0000
    
        sink handling of target-independent machine instrs (other
        than DEBUG_VALUE :(  ) into the target indep AsmPrinter.cpp
        file.   This allows elimination of the
        NO_ASM_WRITER_BOILERPLATE hack among other things.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95177 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit c38f1118b1fe7c43c8b4fe67dd920d50a574874e
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 3 00:48:53 2010 +0000
    
        make these less sensitive to asm verbose changes by disabling it for them.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95175 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit a43ec0f4625cfbff87cf1cad3e233d564fb5b79f
    Author: Dale Johannesen <dalej at apple.com>
    Date:   Wed Feb 3 00:36:40 2010 +0000
    
        Print FPImm a less kludgy way; APFloat.toString seems
        to have some problems anyway.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95171 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 4a7420b3f92907948e325b870253bb2215ee871b
    Author: Bob Wilson <bob.wilson at apple.com>
    Date:   Wed Feb 3 00:33:21 2010 +0000
    
        Fix some comment typos.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95170 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 07a7fb4dfc55877789e4ac89e8e15f7eb193a1c0
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 3 00:29:55 2010 +0000
    
        pass an instprinter into the AsmPrinter if it is available.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95168 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit b881efd98a3db73235b51fef4a67c8a27ab6c86d
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Feb 3 00:22:02 2010 +0000
    
        make any use of the "O" stream in asmprinter print to
        stderr if in filetype=obj mode.  This is a hack, and will
        live until dwarf emission and other random stuff that is
        not yet going through MCStreamer is upgraded.  It only
        impacts filetype=obj mode.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95166 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 23ce2ffb517fec9f017309966c12c1f79a92593e
    Author: Eric Christopher <echristo at apple.com>
    Date:   Wed Feb 3 00:21:58 2010 +0000
    
        Recommit this, looks like it wasn't the cause.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95165 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 455d28b90ab94ef472ed76178182626c18f36424
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Tue Feb 2 23:58:13 2010 +0000
    
        ByVal frame object size should be that of the byval argument, not the size of the type which is just a pointer. This is not known to break stuff but is wrong nevertheless.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95163 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 756d064ed2ce9da3f9ce4667a9bd3dd132312808
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 2 23:57:42 2010 +0000
    
        Hook up -filetype=obj through the MachO streamer.  Here's a demo:
    
        $ cat t.ll
        @g = global i32 42
        $ llc t.ll -o t.o -filetype=obj
        $ nm t.o
        00000000 D _g
    
        There is still a ton of work left.  Instructions are not being encoded
        yet apparently.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95162 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 21e1c2718234fa1657c0aeeea86b5dece6ce1d74
    Author: Jim Grosbach <grosbach at apple.com>
    Date:   Tue Feb 2 23:56:14 2010 +0000
    
        As of r79039, we still try to eliminate the frame pointer on leaf functions,
        even when -disable-fp-elim is specified.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95161 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 5f7db78a1e125e52592115b0c97029143fae537a
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Tue Feb 2 23:55:14 2010 +0000
    
        Revert 95130.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95160 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit dcbc37a6c5942a820f36cf6b66bdc041df414ce7
    Author: Dale Johannesen <dalej at apple.com>
    Date:   Tue Feb 2 23:54:23 2010 +0000
    
        Accept floating point immediates in DEBUG_VALUE.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95159 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit cc21f9123f818edf24d5b40c526dc02a6a2151a4
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Tue Feb 2 23:46:47 2010 +0000
    
        AsmParser/X86: Add temporary hack to allow parsing "sal". Eventually we need
        some mechanism for specifying alternative syntaxes, but I'm not sure what form
        that should take yet.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95158 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 5f6ea763bf9b8e0dd4f2d3698a5e29e8d2a5017a
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Tue Feb 2 23:46:36 2010 +0000
    
        AsmMatcherEmitter: Use stable_sort when reordering instructions, so that order
        is still deterministic even amongst ambiguous instructions (eventually ambiguous
        match orders will be a hard error, but we aren't there yet).
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95157 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 397cebe4eb9631eb73da640399ac802d76a412fb
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 2 23:45:17 2010 +0000
    
        use OwningPtr and factor code better.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95156 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit bc40c64e5548d1a6b93613dc50b487820d8e7d91
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 2 23:37:42 2010 +0000
    
        refactor code so that LLVMTargetMachine creates the asmstreamer and
        mccontext instead of having AsmPrinter do it.  This allows other
        types of MCStreamer's to be passed in.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95155 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit d334d70d6b78b9533b875b329aac174ffa922747
    Author: Eric Christopher <echristo at apple.com>
    Date:   Tue Feb 2 23:01:31 2010 +0000
    
        Hopefully temporarily revert this.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95154 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit b5696b523dbc5c8586a5222d5519fe820ee9424b
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 2 22:58:13 2010 +0000
    
        simplify getVerboseAsm
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95153 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 6b284d094e3805cf4d3dca8fbb91acbad84cf546
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 2 22:54:51 2010 +0000
    
        move handling of asm-verbose out of AsmPrinter.cpp into LLVMTargetMachine.cpp with the rest of the command line options.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95152 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit e80dc6079eaeaf314617975b9518414674af2cbd
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 2 22:37:42 2010 +0000
    
        remove dead #include, stupid symlinks.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95150 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit d8982c7f29ed5ead56d2b93cfaa728a50a3ed12c
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 2 22:36:29 2010 +0000
    
        remove the # TAILCALL markers, which was causing the to fail.
        It's unclear if the matcher is nondeterminstic of what here,
        but I'm getting matches without TAILCALL and some other hosts
        are getting matches with it.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95149 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 8622da039332c3928eb306e8317c8cd1a18d4809
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 2 22:31:11 2010 +0000
    
        Remove a bunch of stuff around the edges of the ELF writer.
        Now the only use of the ELF writer is the JIT, which won't be
        easy to fix in the short term. :( :(
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95148 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit c66b12bfe23a9469cfe8316dd99204cc94b4b5cf
    Author: Eric Christopher <echristo at apple.com>
    Date:   Tue Feb 2 22:29:26 2010 +0000
    
        Reformat my last patch slightly.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95147 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 049f71265b0a9dc1bf938c87b9d3c3b076e47835
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 2 22:13:21 2010 +0000
    
        tidy some targets.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95146 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit e3b4b0ba19b5001a565087800fd343cef5be9e39
    Author: Eric Christopher <echristo at apple.com>
    Date:   Tue Feb 2 22:10:43 2010 +0000
    
        Re-add strcmp and known size object size checking optimization.
    
        Passed bootstrap and nightly test run here.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95145 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ed3cf2287918962e1d0c7a4daf3817fef8700fb0
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 2 22:03:00 2010 +0000
    
        remove dead code.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95144 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit b84851fd840d1bc4d79d696b6e8679d3acbafcda
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Tue Feb 2 22:00:15 2010 +0000
    
        MCAssembler/Darwin: Add a test (on Darwin) that we assemble a bunch of
        instructions exactly like 'as', and produce equivalent .o files.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95143 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 062ed9b30fff92c004912477bb9255722f8835ed
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 2 21:55:58 2010 +0000
    
        detemplatize the ppc code emitter.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95142 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 669180b467a7ec704fd95d8d26251fbaffe3e1fd
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 2 21:52:03 2010 +0000
    
        remove dead code.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95141 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 050e1f2800742f0fe7dbc4cf416a49bb1f6ac773
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 2 21:49:29 2010 +0000
    
        add a definition for ID.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95140 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit d19fc96465d615f29b254a2a5bdb5a9a431b6dab
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 2 21:48:51 2010 +0000
    
        detemplatize ARM code emitter.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95138 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 85186c4e27f082dce8568ce347983481bce4607e
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Tue Feb 2 21:44:16 2010 +0000
    
        MCAsmParser/X86: Represent absolute memory operands as CodeGen does, with scale
        == 1.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95137 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 6776221b04b736cec359aace62501c512d2dc7a1
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Tue Feb 2 21:44:10 2010 +0000
    
        MCCodeEmitter/X86: Handle tied registers better when converting MCInst ->
        MCMachineInstr. This also fixes handling of tied registers for MRMSrcMem
        instructions.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95136 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit df557c865aaa18a337964f7cccf7973b12d9735a
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Tue Feb 2 21:44:01 2010 +0000
    
        MC/Mach-O: Set SOME_INSTRUCTIONS bit for sections.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95135 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit f9365bf724b4308e2bac368a2f29a02fe949ff0f
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 2 21:38:59 2010 +0000
    
        remove dead code.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95134 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit f393cd4958708c36c353f9179ee4f3324edc801c
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 2 21:35:47 2010 +0000
    
        detemplatize alpha code emission, it is now JIT specific.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95133 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit bb4e4e82f29f101e47c0d3fc42be85a82e993cad
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 2 21:31:47 2010 +0000
    
        eliminate all the dead addSimpleCodeEmitter implementations.
    
        eliminate random "code emitter" stuff in Alpha, except for
        the JIT path.  Next up, remove the template cruft.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95131 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 32abfae758e1d86d915f1f0e5aec20bea802d4fa
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Tue Feb 2 21:29:10 2010 +0000
    
        Pass callsite return type to TargetLowering::LowerCall and use that to check sibcall eligibility.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95130 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 818ad00b8aa8a10052e77c92c67f69f32b2356ba
    Author: Dan Gohman <gohman at apple.com>
    Date:   Tue Feb 2 21:11:22 2010 +0000
    
        Make DenseSet's erase pass on the return value rather than swallowing it.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95127 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit f3adb09481fcde8dd865a5a2fcb8201e3dac7b97
    Author: Dan Gohman <gohman at apple.com>
    Date:   Tue Feb 2 21:10:27 2010 +0000
    
        Fix function names in comments. Thanks Duncan!
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95126 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 138c76eb26da9c0d40033566d2a57f2d5510f1ba
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 2 21:06:45 2010 +0000
    
        eliminate FileModel::Model, just use CodeGenFileType.  The client
        of the code generator shouldn't care what object format a target
        uses.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95124 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 71f26cdad52675b2b0ef19c349d0f59cd27323ed
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 2 20:57:28 2010 +0000
    
        this apparently depends on the host somehow.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95122 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit f792e0305f7a44f12e12b65a89c101a43aeb687b
    Author: Bill Wendling <isanbard at gmail.com>
    Date:   Tue Feb 2 20:56:02 2010 +0000
    
        XFAIL for PPC Darwin.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95121 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 742d333e513f892dfe2e5d31d3e53008bf3176f7
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 2 20:41:39 2010 +0000
    
        disable this test for now.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95120 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit cfe96230d1779423b5f75664be0053fece155600
    Author: Sean Callanan <scallanan at apple.com>
    Date:   Tue Feb 2 20:20:30 2010 +0000
    
        ...and fixed the Makefile.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95119 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 29afd237bdf1618d1f9e82919bb9346b8e8f3833
    Author: Sean Callanan <scallanan at apple.com>
    Date:   Tue Feb 2 20:11:23 2010 +0000
    
        Renamed the ed directory to edis, as suggested
        yesterday.  This eliminates possible confusion
        about what exactly in this directory; the name
        is still short, though.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95118 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 63cb9e7fa1ca3ddf761bf5d1ea3a35711ca16689
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 2 19:41:23 2010 +0000
    
        remove the remnants of TargetMachOWriterInfo.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95114 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 6f6ee467bd3d1dd02b2dd8d95e90d1aad451fafb
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 2 19:38:14 2010 +0000
    
        Add a new top-level MachO.h file for manifest constants, fixing
        a layering violation from MC -> Target.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95113 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 982557e7ea0bb8dda5799323072c0e2ce7c5099d
    Author: Johnny Chen <johnny.chen at apple.com>
    Date:   Tue Feb 2 19:31:58 2010 +0000
    
        Added t2BFI (Bitfield Insert) entry for disassembler, with blank pattern field.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95112 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 368dfe8381c0b8bf62cd2f7c279af5917ceb24eb
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 2 19:23:55 2010 +0000
    
        remove PPCMachOWriterInfo.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95111 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 0b860df49af8a5ce36983931fe3c3473e318d037
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 2 19:14:27 2010 +0000
    
        eliminate all forms of addPassesToEmitMachineCode except
        the one used by the JIT.  Remove all forms of
        addPassesToEmitFileFinish except the one used by the static
        code generator.  Inline the remaining version of
        addPassesToEmitFileFinish into its only caller.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95109 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit c74cb6dfb1a37f36bf306ce88282c8478c40f062
    Author: Kevin Enderby <enderby at apple.com>
    Date:   Tue Feb 2 19:05:57 2010 +0000
    
        Added another version of the X86 assembler matcher test case.
        This test case is different subset of the full auto generated test case, and a
        larger subset that is in x86_32-bit.s (that set will encode correctly).  These
        instructions can pass though llvm-mc as it were a logical cat(1) and then
        reassemble to the same instruction.  It is useful as we bring up the parser and
        matcher so we don't break things that currently work.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95107 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit bf50076b6922bd5761ce8f827c44fd5395329dc7
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 2 19:03:39 2010 +0000
    
        remove dead code, we're requesting TargetMachine::AssemblyFile here.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95105 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 8184d24c93887f1d3eb9cbda7d7e8fa19e8c6344
    Author: Dale Johannesen <dalej at apple.com>
    Date:   Tue Feb 2 18:52:56 2010 +0000
    
        Test revert 95050; there's a good chance it's causing
        buildbot failure.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95103 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 545b1b1a9d368259e05f745840ebf091d0cad704
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 2 18:44:12 2010 +0000
    
        Inline addAssemblyEmitter into its one real caller and delete
        the -print-emitted-asm option.  The JIT shouldn't have to pull
        in the asmprinter.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95100 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit abebd2f6102df6dbf12b44e147132ca029a36018
    Author: Duncan Sands <baldrick at free.fr>
    Date:   Tue Feb 2 12:53:04 2010 +0000
    
        Adding missing methods for creating Add, Mul, Neg and Sub with NUW.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95086 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 8142256571dbba74bf0d1dc5dc3c696096dd185c
    Author: Zhongxing Xu <xuzhongxing at gmail.com>
    Date:   Tue Feb 2 07:05:31 2010 +0000
    
        Return value on every path.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95075 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit d4c74a63f9c6569b68b0c4dd086f3fbf2c8c5add
    Author: Zhongxing Xu <xuzhongxing at gmail.com>
    Date:   Tue Feb 2 06:33:32 2010 +0000
    
        simplify code.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95074 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 84aa735e88bb3f357f00f9a83f9e4d7bfb1440d2
    Author: Zhongxing Xu <xuzhongxing at gmail.com>
    Date:   Tue Feb 2 06:22:08 2010 +0000
    
        More logic correction: RemoveOverlap should always create new tree. Add a
        parameter to record whether changes actually happened.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95073 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 9eeca10a528f87882fcc1bdeeb267a008b97296c
    Author: Zhongxing Xu <xuzhongxing at gmail.com>
    Date:   Tue Feb 2 05:23:23 2010 +0000
    
        Add a lookup method to the IntervalMap. The difference from the original
        lookup is that if the lookup key is contained in the key, we return the data.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95070 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 32b86302fc0e3568bfdd453919443e7b3589d9d0
    Author: Devang Patel <dpatel at apple.com>
    Date:   Tue Feb 2 03:47:27 2010 +0000
    
        Apparently gdb is not amused by empty lines in pubtypes section.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95064 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit b36a8b11f1b7e8b451c805c554b357f9924d98d2
    Author: Devang Patel <dpatel at apple.com>
    Date:   Tue Feb 2 03:37:03 2010 +0000
    
        NULL terminate name in pubtypes sections.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95062 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 44e7bce35179730d599b3ae35096df04b0e79553
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 2 02:43:51 2010 +0000
    
        don't turn (A & (C0?-1:0)) | (B & ~(C0?-1:0)) ->  C0 ? A : B
        for vectors.  Codegen is generating awful code or segfaulting
        in various cases (e.g. PR6204).
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95058 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 06e4b56331b271118d56da0e64ea49ec9a3ecab2
    Author: Zhongxing Xu <xuzhongxing at gmail.com>
    Date:   Tue Feb 2 02:40:56 2010 +0000
    
        Fix a bunch of errors in the old logic.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95056 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit d9ba1ba9fcd7fcb040dcb3d216183d07dce285d9
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 2 02:26:54 2010 +0000
    
        fix a crash in loop unswitch on a loop invariant vector condition.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95055 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 8a64e3edd146c918912c07ea7cf95f1e103dcc88
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Feb 2 02:23:37 2010 +0000
    
        remove an unreduced testcase, rename another.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95054 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit f03020966b3492b238fe1262c062e7a7d9fc58b4
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Tue Feb 2 02:22:50 2010 +0000
    
        Perform sibcall in some cases when arguments are passes memory. Look for cases
        where callee's arguments are already in the caller's own caller's stack and
        they line up perfectly. e.g.
    
        extern int foo(int a, int b, int c);
    
        int bar(int a, int b, int c) {
          return foo(a, b, c);
        }
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95053 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit c8e0bbfc241381fdc3c8bdfa0c9e93b8b49d8f2e
    Author: Sean Callanan <scallanan at apple.com>
    Date:   Tue Feb 2 02:18:20 2010 +0000
    
        Removed an unnecessary class from the EDDisassembler
        implementation.  Also made sure that the register maps
        were created during disassembler initialization.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95051 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit c0d238a0dbb716040b1058342db54fe4eb7e652e
    Author: Dale Johannesen <dalej at apple.com>
    Date:   Tue Feb 2 02:08:02 2010 +0000
    
        Make local RA smarter about reusing input register of a copy
        as output.  Needed for (functional) correctness in inline asm,
        and should be generally beneficial.  7361612.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95050 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit e078aea60472fd4dcb96170350fe942c01f830af
    Author: Zhongxing Xu <xuzhongxing at gmail.com>
    Date:   Tue Feb 2 01:57:01 2010 +0000
    
        11.8p1: A nested class is a member and as such has the same access rights as
        any other member.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95047 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 03cd7a89d7f9c3e7114d25a513da4f15ba4e2dbf
    Author: Dan Gohman <gohman at apple.com>
    Date:   Tue Feb 2 01:44:02 2010 +0000
    
        LangRef.html says that inttoptr and ptrtoint always use zero-extension
        when the cast is extending.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95046 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 94974afa225f916cc1fc5d9aa7aa6b373cb235d9
    Author: Dan Gohman <gohman at apple.com>
    Date:   Tue Feb 2 01:41:39 2010 +0000
    
        Factor out alignof expression folding into a separate function and
        generalize it to handle more cases.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95045 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit c45b3aa1897a99f74fbb73038c8fd2995eb250bc
    Author: Dan Gohman <gohman at apple.com>
    Date:   Tue Feb 2 01:38:49 2010 +0000
    
        Various code simplifications.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95044 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 6eb9d10f94d819a320f61f8c961643758515dd50
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Tue Feb 2 01:12:20 2010 +0000
    
        Update CMake.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95041 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit d7e49f3f6b670e14a3ee8c4c6e5c72474e323d6a
    Author: Eric Christopher <echristo at apple.com>
    Date:   Tue Feb 2 00:51:45 2010 +0000
    
        Don't need to check the last argument since it'll always be bool. We also
        don't use TargetData here.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95040 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 3b60eab75e05595d7ec77de8b4f9bfaee8f3249d
    Author: Eric Christopher <echristo at apple.com>
    Date:   Tue Feb 2 00:13:06 2010 +0000
    
        More indentation/tabification fixes.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95036 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 4b27f221be15788393f00a22a602ebf169801bf1
    Author: Eric Christopher <echristo at apple.com>
    Date:   Tue Feb 2 00:06:55 2010 +0000
    
        Untabify previous commit.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95035 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ac567ab867a93e8ce46f5b56228314bedfcceba5
    Author: Sean Callanan <scallanan at apple.com>
    Date:   Tue Feb 2 00:04:46 2010 +0000
    
        Changed to Chris Lattner's suggested approach, which
        merely stubs out the blocks-based disassembly functions
        if the library wasn't built with blocks, which allows a
        constant .exports file and also properly deals with
        situations in which the compiler used to build a client
        is different from the compiler used to build the library.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95034 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 61aac7ef2bc97f1c04f0d7e826df89ffe4bb2559
    Author: Nate Begeman <natebegeman at mac.com>
    Date:   Mon Feb 1 23:56:58 2010 +0000
    
        Kill the Mach-O writer, and temporarily make filetype=obj an error.
        The MCStreamer based assemblers will take over for this functionality.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95033 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 3617f6aebcdb06b1465ba0165f9bc35d7207bbf7
    Author: Sean Callanan <scallanan at apple.com>
    Date:   Mon Feb 1 23:27:57 2010 +0000
    
        Fix for builds with separate source and build
        directories (like, oh, say, any multistage build)
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95028 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 9e99517c5996acc9ca1b774275515fea7fcf1525
    Author: Eric Christopher <echristo at apple.com>
    Date:   Mon Feb 1 23:25:03 2010 +0000
    
        Formatting.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95027 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 4a5f31df635d0c8d65f19d0cc32f6c3476836cc5
    Author: Johnny Chen <johnny.chen at apple.com>
    Date:   Mon Feb 1 23:06:04 2010 +0000
    
        MOVi16 should also be marked as a UnaryDP instruction, i.e., it doesn't have a
        Rn operand.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95025 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 4a9df81d4d00aea149cb8de9195b7322e3361200
    Author: Sean Callanan <scallanan at apple.com>
    Date:   Mon Feb 1 23:01:38 2010 +0000
    
        Updated to use the proper .exports file for the
        target platform, depending on whether the target
        supports the blocks API or not
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95024 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit d89e3fb6c3baedce21438f3cc3032aacb49a9088
    Author: Bill Wendling <isanbard at gmail.com>
    Date:   Mon Feb 1 22:51:23 2010 +0000
    
        Add "dump" method to IVUsersOneStride.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95022 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit aaaed409c8cfd5e9dbaa694a30d2b0a7500c595c
    Author: Dale Johannesen <dalej at apple.com>
    Date:   Mon Feb 1 22:46:05 2010 +0000
    
        Testcase for 94996 (PR 6157)
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95021 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 17e9fca94d44eb1bec5b7a39be5f2e1e63655773
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Mon Feb 1 22:40:09 2010 +0000
    
        Fix PR6196. GV callee may not be a function.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95017 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ba34ec2cabc28cde10a7ada59c5b52de0b4fe27c
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Mon Feb 1 22:32:42 2010 +0000
    
        Add test case for 95013.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95014 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 50a68ccb7108932f75967a0036a15638cbec3cd1
    Author: Mon P Wang <wangmp at apple.com>
    Date:   Mon Feb 1 22:15:09 2010 +0000
    
        Improve EXTRACT_VECTOR_ELT patch based on comments from Duncan
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95012 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 61e230d031189201840a17be52d44fa73e66067e
    Author: Sean Callanan <scallanan at apple.com>
    Date:   Mon Feb 1 21:57:50 2010 +0000
    
        Rollback on including blocks functionality in .exports
        because some platforms don't support blocks and then
        break because the symbols aren't present
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95011 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit a493aa499b18bb534004ab850caba29042d44cd0
    Author: Bob Wilson <bob.wilson at apple.com>
    Date:   Mon Feb 1 21:17:14 2010 +0000
    
        Add an option to GVN to remove all partially redundant loads.  This is currently
        disabled by default.  This divides the existing load PRE code into 2 phases:
        first it checks that it is safe to move the load to each of the predecessors
        where it is unavailable, and then if it is safe, the code is changed to move
        the load.  Radar 7571861.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95007 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit c4350840a22dd22fcae29ed124309d46ca107a3e
    Author: Duncan Sands <baldrick at free.fr>
    Date:   Mon Feb 1 20:57:35 2010 +0000
    
        Do an early exit when the result is known cheaply.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95002 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit e985e1fe58b689501fcd07947a0b9e288c275951
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Mon Feb 1 20:48:08 2010 +0000
    
        eliminate a bunch of pointless LLVMContext arguments.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95001 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 8abd8f0541a289c17536761bd5e236cf1fa280f8
    Author: Duncan Sands <baldrick at free.fr>
    Date:   Mon Feb 1 20:42:02 2010 +0000
    
        Fix typo "of" -> "or" and change the way a line was formatted to fit
        into 80 columns to match my artistic preferences.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95000 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 4f9385fc14a2cc39dc912c1f425a73f27d78f2a9
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Mon Feb 1 20:04:40 2010 +0000
    
        fix PR6195, a bug constant folding scalar -> vector compares.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94997 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit e1c3887e98f2b62b9a25b308619217fe19c41459
    Author: Dale Johannesen <dalej at apple.com>
    Date:   Mon Feb 1 19:54:53 2010 +0000
    
        fix PR 6157.  Testcase pending.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94996 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 356faaae39ef1499382bf50573537fa2bc463237
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Mon Feb 1 19:54:45 2010 +0000
    
        cleanups.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94995 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 03ad0a8bb6f3be3a2185ee63b83cbae9bf18f2b2
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Mon Feb 1 19:35:08 2010 +0000
    
        fix PR6197 - infinite recursion in ipsccp due to block addresses
    
        evaluateICmpRelation wasn't handling blockaddress.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94993 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 4762dd39a17dc7e9700bd0308ae4125be085a2c3
    Author: Mon P Wang <wangmp at apple.com>
    Date:   Mon Feb 1 19:03:18 2010 +0000
    
        Fixed a couple of optimization with EXTRACT_VECTOR_ELT that assumes the result
        type is the same as the element type of the vector.  EXTRACT_VECTOR_ELT can
        be used to extended the width of an integer type.  This fixes a bug for
        Generic/vector-casts.ll on a ppc750.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94990 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 32ec1a5d49759636247ef24827f42e9c66c026f3
    Author: Dan Gohman <gohman at apple.com>
    Date:   Mon Feb 1 19:00:32 2010 +0000
    
        Update this test for a trivial register allocation difference.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94989 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 45f1643e0c6fe92ec35ed81d12386372f14be6e3
    Author: Dan Gohman <gohman at apple.com>
    Date:   Mon Feb 1 18:27:38 2010 +0000
    
        Generalize target-independent folding rules for sizeof to handle more
        cases, and implement target-independent folding rules for alignof and
        offsetof. Also, reassociate reassociative operators when it leads to
        more folding.
    
        Generalize ScalarEvolution's isOffsetOf to recognize offsetof on
        arrays. Rename getAllocSizeExpr to getSizeOfExpr, and getFieldOffsetExpr
        to getOffsetOfExpr, for consistency with analagous ConstantExpr routines.
    
        Make the target-dependent folder promote GEP array indices to
        pointer-sized integers, to make implicit casting explicit and exposed
        to subsequent folding.
    
        And add a bunch of testcases for this new functionality, and a bunch
        of related existing functionality.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94987 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 2091359832897a7ba7769eeebf6e0ebc67c83867
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Mon Feb 1 18:11:34 2010 +0000
    
        fix rdar://7590304, a miscompilation of objc apps on arm.  The caller
        of objc message send was getting marked arm_apcscc, but the prototype
        isn't.  This is fine at runtime because objcmsgsend is implemented in
        assembly.  Only turn a mismatched caller and callee into 'unreachable'
        if the callee is a definition.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94986 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit e82dad6d1c3606ee017379967e31c385b4eb5750
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Mon Feb 1 18:04:58 2010 +0000
    
        fix rdar://7590304, an infinite loop in instcombine.  In the invoke
        case, instcombine can't zap the invoke for fear of changing the CFG.
        However, we have to do something to prevent the next iteration of
        instcombine from inserting another store -> undef before the invoke
        thereby getting into infinite iteration between dead store elim and
        store insertion.
    
        Just zap the callee to null, which will prevent the next iteration
        from doing anything.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94985 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 14cf1435c8c2e5f774127a1234c7f76079435e26
    Author: Bob Wilson <bob.wilson at apple.com>
    Date:   Mon Feb 1 17:41:44 2010 +0000
    
        Fix pr6198 by moving the isSized() check to an outer conditional.
        The testcase from pr6198 does not crash for me -- I don't know what's up with
        that -- so I'm not adding it to the tests.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94984 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 48f174e79a252d99bdc8aee2c821f6871dbbe0bc
    Author: Dan Gohman <gohman at apple.com>
    Date:   Mon Feb 1 16:38:14 2010 +0000
    
        Add a getNUWMul function.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94982 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 57c194af6e3725787f73ae1ffeb752906914ca5d
    Author: Dan Gohman <gohman at apple.com>
    Date:   Mon Feb 1 16:37:38 2010 +0000
    
        Add a generalized form of ConstantExpr::getOffsetOf which works for
        array types as well as struct types, and which accepts arbitrary
        Constant indicies.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94981 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 7269641c424bd8d0e0f6c22f6402521bd8dfad2a
    Author: Bruno Cardoso Lopes <bruno.cardoso at gmail.com>
    Date:   Mon Feb 1 12:16:39 2010 +0000
    
        MulOp is actually a Mips specific node, so do the match using Opcode. This fixes PR6192
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94977 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 9b5cef72a83cda3fc651e07c92fab7e83153333c
    Author: Zhongxing Xu <xuzhongxing at gmail.com>
    Date:   Mon Feb 1 10:43:31 2010 +0000
    
        Add an immutable interval map, prepared to be used by flat memory model
        in the analyzer. WIP.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94976 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 6c30767bed5a692acf43f4bb07f82e12e593a933
    Author: Sean Callanan <scallanan at apple.com>
    Date:   Mon Feb 1 09:02:24 2010 +0000
    
        Whoops, left some debugging code in that broke
        a buildbot.  Removed.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94975 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 95ba688843344ba4f811127dd4f7904f3c6cbcb0
    Author: Sean Callanan <scallanan at apple.com>
    Date:   Mon Feb 1 08:49:35 2010 +0000
    
        Added the enhanced disassembly library's implementation and
        fleshed out the .exports file.  I still have to fix several
        details of operand parsing, but the basic functionality is
        there and usable.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94974 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 0790256d8b2b86223eae754e8659630ec606ac88
    Author: Zhongxing Xu <xuzhongxing at gmail.com>
    Date:   Mon Feb 1 07:32:52 2010 +0000
    
        Simplify code. We can compare TNew with T in one batch.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94973 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ee5eee2923fa2b9b8c8b68559bce92b2838c74c1
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Mon Feb 1 02:13:39 2010 +0000
    
        Undo r94946 now all the tests are passing again.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94970 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 4cd00632df8334a9fcbce4f01160030cdb6e7ba4
    Author: Bruno Cardoso Lopes <bruno.cardoso at gmail.com>
    Date:   Mon Feb 1 02:03:24 2010 +0000
    
        Fix stack size bug while using o32 abi
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94969 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit fb62f2f3ab0bfdbf5598e586964736db2ad55da4
    Author: Johnny Chen <johnny.chen at apple.com>
    Date:   Sun Jan 31 11:22:28 2010 +0000
    
        For MVNr and MVNs, we need to set Inst{25} = 0 so as not to confuse the decoder.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94955 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 4489953fa201178eac3af8e19f04f58bdb3e2b28
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Sun Jan 31 07:28:44 2010 +0000
    
        Change TAILJMP's to be varargs and transfer implicit uses over from TCRETURN's. Otherwise the missing uses can make post-regalloc scheduling do bad things. This fixes 403.gcc.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94950 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit cf3892e990dfce6790ff57e7dccc9e5fb829b258
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Sun Jan 31 07:27:31 2010 +0000
    
        Fix a missing check from my last commit.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94949 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit a04696cdaaaebb88550de183439178e812c85e7f
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Sun Jan 31 06:44:49 2010 +0000
    
        Avoid recursive sibcall's.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94946 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit cf83c91bbd530f19054c51da0758e41a189a0251
    Author: Eli Friedman <eli.friedman at gmail.com>
    Date:   Sun Jan 31 04:55:32 2010 +0000
    
        Remove a completed item, add a couple new ones.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94945 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 8867dbd7ba85a07d11267561f58db7675c2af561
    Author: Eli Friedman <eli.friedman at gmail.com>
    Date:   Sun Jan 31 04:40:45 2010 +0000
    
        Remove test which is no longer relevant.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94944 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 5714a01e760ee1591da125c9fb4dfdd2df4a051d
    Author: Eli Friedman <eli.friedman at gmail.com>
    Date:   Sun Jan 31 04:29:12 2010 +0000
    
        Simplify/generalize the xor+add->sign-extend instcombine.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94943 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit e7fa5774587e56d1071348acdadd7569a4fa9092
    Author: Eli Friedman <eli.friedman at gmail.com>
    Date:   Sun Jan 31 02:30:23 2010 +0000
    
        Add a small transform: transform -(X<<Y) to (-X<<Y) when the shift has a single
        use and X is free to negate.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94941 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit c91dadab87396596808a85161727d7d966162c93
    Author: Sean Callanan <scallanan at apple.com>
    Date:   Sun Jan 31 02:28:18 2010 +0000
    
        Moved InstallLexer() from the X86-specific AsmLexer
        to the TargetAsmLexer class so that clients can
        actually use the TargetAsmLexer they get from a
        Target.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94940 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 5d40692b1b30ecd409a6bdc3d7bf4c433bf634ae
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Sun Jan 31 00:59:31 2010 +0000
    
        Do not mark no-return calls tail calls. It'll screw up special calls like longjmp and it doesn't make much sense for performance reason. If my logic is faulty, please let me know.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94937 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit cc3179860ceed01b85071c63c3686ad7dbbb3ec9
    Author: Bruno Cardoso Lopes <bruno.cardoso at gmail.com>
    Date:   Sat Jan 30 18:32:07 2010 +0000
    
        Fix PR6144. Reload GP before the emission of CALLSEQ_END to guarantee the right reload order
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94915 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 5c4cf9d40bb5d64470e410317fbad462a318a0a0
    Author: Bruno Cardoso Lopes <bruno.cardoso at gmail.com>
    Date:   Sat Jan 30 18:29:19 2010 +0000
    
        Fix mov.d out register by using the FFR register class directly
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94914 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 592196d5d01f44ad2929c06e0d2cda9b57d09168
    Author: Anton Korobeynikov <asl at math.spbu.ru>
    Date:   Sat Jan 30 14:08:12 2010 +0000
    
        Fix a gross typo: ARMv6+ may or may not support unaligned memory operations.
        Even if they are suported by the core, they can be disabled
        (this is just a configuration bit inside some register).
    
        Allow unaligned memops on darwin and conservatively disallow them otherwise.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94889 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit b79f9b62f198d1ae452da23bf7d5a9aea486c0c9
    Author: Bob Wilson <bob.wilson at apple.com>
    Date:   Sat Jan 30 04:42:39 2010 +0000
    
        Check alignment of loads when deciding whether it is safe to execute them
        unconditionally.  Besides checking the offset, also check that the underlying
        object is aligned as much as the load itself.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94875 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 0108c91d2ac699a4437e0ab1b1e1c5d15bc4f603
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Sat Jan 30 01:22:00 2010 +0000
    
        Allow more tailcall optimization: calls with inputs that are all passed in registers.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94873 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit bbbdf911a8e061b5bb0da8236af38ff309c3fdd8
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Sat Jan 30 01:16:15 2010 +0000
    
        Don't forget to transfer target flag when inserting a tailcall instruction.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94872 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit a24e103806f5cc8150d95a3d17c34f7b15a2ac54
    Author: Devang Patel <dpatel at apple.com>
    Date:   Sat Jan 30 01:08:30 2010 +0000
    
        Emit declaration DIE for the class static variables.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94870 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 827c600e36786c4cb41fae2e9b41a829c1a52c75
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Sat Jan 30 01:02:48 2010 +0000
    
        MC/X86 AsmParser: Handle absolute memory operands correctly. We were doing
        something totally broken and parsing them as immediates, but the .td file also
        had the wrong match class so things sortof worked. Except, that is, that we
        would parse
          movl $0, %eax
        as
          movl 0, %eax
        Feel free to guess how well that worked.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94869 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 23b9b1e20e2939687c01c26435ae27f9af28a201
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Sat Jan 30 01:02:37 2010 +0000
    
        AsmMatcher: Create operand classes before use, apparently records aren't visited
        in the order they were declared.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94868 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 5b5007f7ee0140eebeb7a41adcc32fead57e4569
    Author: Dale Johannesen <dalej at apple.com>
    Date:   Sat Jan 30 00:57:47 2010 +0000
    
        Fix a case where debug_value could affect codegen.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94866 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit da88458ae2e4520e5a57b8e4a1e478c25a2d231f
    Author: Bob Wilson <bob.wilson at apple.com>
    Date:   Sat Jan 30 00:41:10 2010 +0000
    
        Use more specific types to avoid casts.  No functionality change.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94863 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit df2bdbad3c28a03d5ac73599f1bf101fb2a3f71c
    Author: Bob Wilson <bob.wilson at apple.com>
    Date:   Sat Jan 30 00:40:23 2010 +0000
    
        Remove ARM-specific calling convention from this test.  Target data is
        needed for this test, but otherwise, there's nothing ARM-specific about
        it and no need to specify the calling convention.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94862 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 9a758cd460d0f29f9a7dfe3a0c15492f40c7b86b
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Sat Jan 30 00:24:12 2010 +0000
    
        X86.td: Refactor to bring operands that use print_pcrel_imm together.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94861 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 23f4491b48f762af658aa54cd0a1edaee9339ea9
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Sat Jan 30 00:24:06 2010 +0000
    
        FileCheck: When looking for "possible matches", only compare against the prefix
        line. Turns out edit_distance can be slow if the string we are scanning for
        happens to be quite large.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94860 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit f70705634a6eb03429eddab5e4cb6e43dfaa3fde
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Sat Jan 30 00:24:00 2010 +0000
    
        AsmMatcher/X86: Separate out sublass for memory operands that have no segment
        register, and use to cleanup a FIXME in X86AsmParser.cpp.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94859 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 943e7d9fa17371889cab42815cd698d942d81b73
    Author: Jakob Stoklund Olesen <stoklund at 2pi.dk>
    Date:   Fri Jan 29 23:54:14 2010 +0000
    
        Keep iterating over all uses when meeting a phi node in AllUsesOfValueWillTrapIfNull().
    
        This bug was exposed by my inliner cost changes in r94615, and caused failures
        of lencod on most architectures when building with LTO.
    
        This patch fixes lencod and 464.h264ref on x86-64 (and likely others).
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94858 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 2b50cf92f36da35ca33074783b5ecc1a556657c0
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Fri Jan 29 23:32:40 2010 +0000
    
        MC/X86: Add a nice X86 assembler matcher test case from Kevin Enderby.
         - This test case is auto generated, and has been verified to round-trip
           correctly through llvm-mc by checking the assembled .o file before and after
           piping through llvm-mc. It will be extended over time as the matcher grows
           support for more instructions.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94857 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 92411a8e37a8f1d29aec9d0531ff4ec2895f875f
    Author: Johnny Chen <johnny.chen at apple.com>
    Date:   Fri Jan 29 23:21:10 2010 +0000
    
        Modified encoding bits specification for VFP instructions.  In particular, the D
        bit (Inst{22}) and the M bit (Inst{5}) should be left unspecified.  For binary
        format instructions, Inst{6} and Inst{4} need to specified for proper decodings.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94855 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit e6069dd121294d238437705678bfef24e7cfd012
    Author: Dan Gohman <gohman at apple.com>
    Date:   Fri Jan 29 23:12:36 2010 +0000
    
        Print a comment next to "materializable" global values, to distinguish
        them from values that are not actually defined in the module.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94854 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit e7b6d2c6a6443d73a3f3f6d31faf4d57ec10655b
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Fri Jan 29 23:05:56 2010 +0000
    
        PPC is not ready for sibcall optimization.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94853 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 9aa401e14dca8c65d2fb4c82c43b1d9cbe8f1fbd
    Author: Bob Wilson <bob.wilson at apple.com>
    Date:   Fri Jan 29 22:39:21 2010 +0000
    
        Preserve load alignment in instcombine transformations.  I've been unable to
        create a testcase where this matters.  The select+load transformation only
        occurs when isSafeToLoadUnconditionally is true, and in those situations,
        instcombine also changes the underlying objects to be aligned.  This seems
        like a good idea regardless, and I've verified that it doesn't pessimize
        the subsequent realignment.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94850 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ccfec8175249ecc3b926755db90e916cfd806583
    Author: Dan Gohman <gohman at apple.com>
    Date:   Fri Jan 29 21:57:46 2010 +0000
    
        Minor code cleanup.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94848 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 833de98561fcf7f668d1a176eeee80f0c871b358
    Author: Dan Gohman <gohman at apple.com>
    Date:   Fri Jan 29 21:55:16 2010 +0000
    
        Skip whitespace when looking for a potential intended match.
        Before:
    
        <stdin>:94:1: note: possible intended match here
         movsd 4096(%rsi), %xmm0
        ^
    
        After:
        <stdin>:94:2: note: possible intended match here
         movsd 4096(%rsi), %xmm0
         ^
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94847 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 7786f1bdb609cac7e31b20efbcd2050674f0eee6
    Author: Dan Gohman <gohman at apple.com>
    Date:   Fri Jan 29 21:53:18 2010 +0000
    
        Fix the position of the caret in the FileCheck error message.
        Before:
    
        test/CodeGen/X86/lsr-reuse.ll:52:34: error: expected string not found in input
        ; CHECK: movsd -2048(%rsi), %xmm0
                                         ^
    
        After:
    
        test/CodeGen/X86/lsr-reuse.ll:52:10: error: expected string not found in input
        ; CHECK: movsd -2048(%rsi), %xmm0
                 ^
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94846 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 2e27257da571ae4897b9367dedb358da00d6c9b9
    Author: Junjie Gu <jgu222 at gmail.com>
    Date:   Fri Jan 29 21:34:26 2010 +0000
    
        Make sure the size is doubled (not 4x).
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94845 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 385d68b0ed46d8896662325493a245d1ec8c0dce
    Author: Sean Callanan <scallanan at apple.com>
    Date:   Fri Jan 29 21:21:44 2010 +0000
    
        Removed symbols from .exports that are not yet in
        the library.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94844 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 08ad58149cf43b916c44c4710c7fa27154285cca
    Author: Dale Johannesen <dalej at apple.com>
    Date:   Fri Jan 29 21:21:28 2010 +0000
    
        Add assertion to humor the paranoid.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94843 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit cb265567b7b4d8db906ca74b73235a4f5bdec1c6
    Author: Victor Hernandez <vhernandez at apple.com>
    Date:   Fri Jan 29 21:19:19 2010 +0000
    
        We were not writing bitcode for function-local metadata whose operands have been erased (making it not have any more function-local operands)
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94842 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit e0521734588adfaec93ccf7dffba127b014c3658
    Author: Eric Christopher <echristo at apple.com>
    Date:   Fri Jan 29 21:16:24 2010 +0000
    
        Revert my last couple of patches. They appear to have broken bison.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94841 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 2e0df3849e3ab8909485c1a17fa9c5cdea6269da
    Author: Jeffrey Yasskin <jyasskin at google.com>
    Date:   Fri Jan 29 21:11:04 2010 +0000
    
        Rename two IRReader.h functions to indicate that they return a Module
        that loads its contents lazily from bitcode.  I think these are the
        only remaining mis-named functions.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94840 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 30f1709250c8f855ac512cac5f0d806097957d60
    Author: Bob Wilson <bob.wilson at apple.com>
    Date:   Fri Jan 29 20:34:28 2010 +0000
    
        Use uint64_t instead of unsigned for offsets and sizes.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94835 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 2fea743797a4779b62b14d78a6537d59247e1e38
    Author: Dan Gohman <gohman at apple.com>
    Date:   Fri Jan 29 19:43:48 2010 +0000
    
        Add svn:ignore properties.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94833 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 5575c54de367c1991dde5e53127c3adf0fb75def
    Author: Bob Wilson <bob.wilson at apple.com>
    Date:   Fri Jan 29 19:19:08 2010 +0000
    
        Improve isSafeToLoadUnconditionally to recognize that GEPs with constant
        indices are safe if the result is known to be within the bounds of the
        underlying object.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94829 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit e472109fe15b02c2f6b264df4546367e9320f10f
    Author: Jeffrey Yasskin <jyasskin at google.com>
    Date:   Fri Jan 29 19:10:38 2010 +0000
    
        Belatedly document r85295 and r85330.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94825 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit d839e1a9792eff26a79c8baef8e1b34ab61b24bb
    Author: Devang Patel <dpatel at apple.com>
    Date:   Fri Jan 29 18:34:58 2010 +0000
    
        Add size and location info in DW_TAG_class_type descriptor.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94822 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 1126e04037ca1207fa56151f6c9c06fda8cfe1cc
    Author: Devang Patel <dpatel at apple.com>
    Date:   Fri Jan 29 18:30:57 2010 +0000
    
        Before inserting   llvm.dbg.declare intrinsic at the end of a basic block, check whether the basic block has a terminator or not.
        This API is used by clang and the test case is test/CodeGen/debug-info-crash.c in clang module.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94820 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 289c0564c911670f5c4e1826420e3fd820f582c0
    Author: Benjamin Kramer <benny.kra at googlemail.com>
    Date:   Fri Jan 29 15:19:06 2010 +0000
    
        Fix MSVC build.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94809 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 2b58d509ef83ef2d0c14f0d206fd39354a2ddc62
    Author: Benjamin Kramer <benny.kra at googlemail.com>
    Date:   Fri Jan 29 14:42:22 2010 +0000
    
        Convert some users of ftostr to raw_ostream.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94808 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 1b3c938a44e57ec75cbea9c4cf003a0016cfbd56
    Author: Benjamin Kramer <benny.kra at googlemail.com>
    Date:   Fri Jan 29 14:40:33 2010 +0000
    
        Use llvm::format instead of ftostr (which just calls sprintf).
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94807 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 273c038fca6dd89a242c42978f922d69770bd407
    Author: Duncan Sands <baldrick at free.fr>
    Date:   Fri Jan 29 09:45:26 2010 +0000
    
        Change the SREM case to match the logic in the IR version ComputeMaskedBits.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94805 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 4aa47bd2b13b887593399ebb4a8c18555e08ca13
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Fri Jan 29 06:45:59 2010 +0000
    
        Catch more trivial tail call opportunities: no inputs and output types match.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94804 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit a1deef01c49f252e0a4145459ec10c535637130e
    Author: Duncan Sands <baldrick at free.fr>
    Date:   Fri Jan 29 06:18:46 2010 +0000
    
        Having RHSKnownZero and RHSKnownOne be alternative names for KnownZero and KnownOne
        (via APInt &RHSKnownZero = KnownZero, etc) seems dangerous and confusing to me: it
        is easy not to notice this, and then wonder why KnownZero/RHSKnownZero changed
        underneath you when you modified RHSKnownZero/KnownZero etc.  So get rid of this.
        No intended functionality change (tested with "make check" + llvm-gcc bootstrap).
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94802 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit c852af1cafe657e4897e153d3a2bc10505b990ef
    Author: Duncan Sands <baldrick at free.fr>
    Date:   Fri Jan 29 06:18:37 2010 +0000
    
        It looks like the changes to the SRem logic of SimplifyDemandedUseBits
        (fix for PR6165) are needed here too.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94801 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 8c57220a2ef346d8d4cbc40d5533d3c9f094424c
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Fri Jan 29 03:22:19 2010 +0000
    
        FileCheck: Switch "possible match" calculation to use StringRef::edit_distance.
         - Thanks Doug, who is obviously less lazy than me!
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94795 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 8413ab7835e70bbd458a93be8239f1011e073031
    Author: Eric Christopher <echristo at apple.com>
    Date:   Fri Jan 29 01:37:11 2010 +0000
    
        Make strcpy_chk lower to strcpy if we have a safe size.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94783 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit c94c6dfca03fbe5ba2173cd79fb4e7d902d7ba90
    Author: Sean Callanan <scallanan at apple.com>
    Date:   Fri Jan 29 01:34:29 2010 +0000
    
        Quick fix to make the header file for the enhanced
        disassembly information have a better comment (and
        better guard macros).
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94781 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 442bd4e292c9bbfe2f34b0fc53f9e34d7fde07be
    Author: Sean Callanan <scallanan at apple.com>
    Date:   Fri Jan 29 01:30:01 2010 +0000
    
        Added a bare-bones Makefile to build the enhanced disassembly
        library as a static and a shared library.  Added dependencies
        so the target-specific enhanced disassembly info tables are
        built before the library.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94780 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 133eb9c346127f28c89966a9671de0ca96f629fe
    Author: Ted Kremenek <kremenek at apple.com>
    Date:   Fri Jan 29 01:10:55 2010 +0000
    
        Recognize 'add_executable' when analyzing CMake files.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94777 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 1aa2f8adbb477ffa51fb521676a2fd1293ba8143
    Author: Ted Kremenek <kremenek at apple.com>
    Date:   Fri Jan 29 01:10:25 2010 +0000
    
        Update CMake build.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94776 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 77fe12bf626a284d889283033322e1d1d3877454
    Author: Eric Christopher <echristo at apple.com>
    Date:   Fri Jan 29 01:09:57 2010 +0000
    
        Add constant support to object size handling and remove default
        lowering. We'll either figure it out, or not and be lowered by
        SelectionDAGBuild.
    
        Add test.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94775 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit f495802f3e81462b29e23c5e83902d3dca5f0fea
    Author: Bill Wendling <isanbard at gmail.com>
    Date:   Fri Jan 29 00:52:43 2010 +0000
    
        Generic reformatting and comment fixing. No functionality change.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94771 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 93bff173ea147f2b516677828f1f79edb171c29e
    Author: Bill Wendling <isanbard at gmail.com>
    Date:   Fri Jan 29 00:27:39 2010 +0000
    
        Add newline to debugging output, and fix some grammar-os in comment.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94765 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 323f7068c889952ac6a2700ef08c1af6ba3f9bc3
    Author: Sean Callanan <scallanan at apple.com>
    Date:   Fri Jan 29 00:21:04 2010 +0000
    
        Added a custom TableGen backend to support the
        enhanced disassembler, and the necessary makefile
        rules to build the table for X86.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94764 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 48539b5d4d4e6e17cf58179b2d2d6fc6e1f7c1d9
    Author: Victor Hernandez <vhernandez at apple.com>
    Date:   Fri Jan 29 00:01:35 2010 +0000
    
        mem2reg erases the dbg.declare intrinsics that it converts to dbg.val intrinsics
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94763 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 68d271623713a16ffe62a60edf32d7e3b6c2f275
    Author: Bill Wendling <isanbard at gmail.com>
    Date:   Thu Jan 28 21:51:40 2010 +0000
    
        Assign the ordering of SDNodes in a much less intrusive fashion. After the
        "visit*" method is called, take the newly created nodes, walk them in a DFS
        fashion, and if they don't have an ordering set, then give it one.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94757 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 1a12c56badd0733754baee7f7921b495509f9e53
    Author: Mikhail Glushenkov <foldr at codedgers.com>
    Date:   Thu Jan 28 18:19:36 2010 +0000
    
        Support some more options...
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94752 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit a64c74890ef37c607b3f1742abb5b1af65342afa
    Author: Dan Gohman <gohman at apple.com>
    Date:   Thu Jan 28 18:08:26 2010 +0000
    
        Remove the folding rule
          getelementptr (i8* inttoptr (i64 1 to i8*), i32 -1)
          to
          inttoptr (i64 0 to i8*)
        from the VMCore constant folder. It didn't handle sign-extension properly
        in the case where the source integer is smaller than a pointer size. And,
        it relied on an assumption about sizeof(i8).
    
        The Analysis constant folder still folds these kinds of things; it has
        access to TargetData, so it can do them right.
    
        Add a testcase which tests that the VMCore constant folder doesn't
        miscompile this, and that the Analysis folder does fold it.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94750 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 078a4063e384d3a21a14bc1af4c88aeacd4a1f72
    Author: Benjamin Kramer <benny.kra at googlemail.com>
    Date:   Thu Jan 28 18:04:38 2010 +0000
    
        Replace strcpy with memcpy when we have the length around anyway.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94746 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 41d0a0c1b36033c45a5fa74ec353842b2244b22a
    Author: Duncan Sands <baldrick at free.fr>
    Date:   Thu Jan 28 17:22:42 2010 +0000
    
        Fix PR6165.  The bug was that LHSKnownZero was being and'd with DemandedMask
        when it should have been and'd with LowBits.  Fix that and while there beef
        up the logic in the case of a negative LHS.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94745 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit fe53061bea27c4b222c548cf2b0e4428134e8bf0
    Author: Douglas Gregor <doug.gregor at gmail.com>
    Date:   Thu Jan 28 06:42:08 2010 +0000
    
        Add llvm::Program::ChangeStderrToBinary().
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94743 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 08b017ea9bd8cc8471b6dbd151402b73606f9057
    Author: Dan Gohman <gohman at apple.com>
    Date:   Thu Jan 28 06:32:46 2010 +0000
    
        Check Type::isSized before calling ScalarEvolution::getAllocSizeExpr,
        rather than after.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94742 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 89c402f35edafd7c2178d4ee99644669abd476a8
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Thu Jan 28 06:22:43 2010 +0000
    
        convert the last 3 targets to use EmitFunctionBody() now that
        it has before/end body hooks.
    
         lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp |   49 ++-----------
         lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp   |   87 ++++++------------------
         lib/Target/XCore/AsmPrinter/XCoreAsmPrinter.cpp |   56 +++------------
         test/CodeGen/XCore/ashr.ll                      |    2
         4 files changed, 48 insertions(+), 146 deletions(-)
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94741 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ca73d86620334381948d7d3d713e1b31701dec86
    Author: Dan Gohman <gohman at apple.com>
    Date:   Thu Jan 28 02:43:22 2010 +0000
    
        Make getAlignOf return an i64, for consistency with getSizeOf and
        getOffsetOf, and remove the comment about assuming i8 is byte-aligned,
        which is no longer applicable.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94738 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit d9ebe37839d32ce786dd7140bd559df444ac772d
    Author: Dan Gohman <gohman at apple.com>
    Date:   Thu Jan 28 02:15:55 2010 +0000
    
        Remove SCEVAllocSizeExpr and SCEVFieldOffsetExpr, and in their place
        use plain SCEVUnknowns with ConstantExpr::getSizeOf and
        ConstantExpr::getOffsetOf constants. This eliminates a bunch of
        special-case code.
    
        Also add code for pattern-matching these expressions, for clients that
        want to recognize them.
    
        Move ScalarEvolution's logic for expanding array and vector sizeof
        expressions into an element count times the element size, to expose
        the multiplication to subsequent folding, into the regular constant
        folder.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94737 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 117728fed8d10c94cf56f9cb5aa2d6e93f5143d1
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Thu Jan 28 01:58:58 2010 +0000
    
        add target hooks for emitting random gunk before and after the function body.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94732 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 0e64765c09c0f900518c9db8d1d116a1a7180e9d
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Thu Jan 28 01:57:22 2010 +0000
    
        Fix a bug introduced by r94490 where it created a X86ISD::CMP whose output type is different from its inputs.
        This fixes PR6146.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94731 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit bdbb81d0628e15b5a7ea2ae1c466bb283ab740ef
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Thu Jan 28 01:54:33 2010 +0000
    
        switch blackfin to the default runOnMachineFunction
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94729 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit b825faaddebc861ee06af5a50cef78e645275673
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Thu Jan 28 01:50:22 2010 +0000
    
        eliminate a now-useless class.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94728 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit d9df5d79183e13a0ce6915c184f47d7c01e72dc9
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Thu Jan 28 01:48:52 2010 +0000
    
        Switch MSP430, SPU, Sparc, and SystemZ to use EmitFunctionBody().
    
        Diffstat:
         6 files changed, 30 insertions(+), 284 deletions(-)
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94727 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit f59d57d36935e921c12785690477d3bfdba9d69d
    Author: Jim Grosbach <grosbach at apple.com>
    Date:   Thu Jan 28 01:45:32 2010 +0000
    
        Update of 94055 to track the IR level call site information via an intrinsic.
        This allows code gen and the exception table writer to cooperate to make sure
        landing pads are associated with the correct invoke locations.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94726 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit bf7dadf717673b9d494f9930f6618236feb2ce7f
    Author: Jeffrey Yasskin <jyasskin at google.com>
    Date:   Thu Jan 28 01:41:20 2010 +0000
    
        Record the death of ModuleProvier and GhostLinkage in the release notes and
        give upgrade instructions.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94723 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 57d849fe78589bb84ec82db82cdbcb6dc88207b4
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Thu Jan 28 01:28:58 2010 +0000
    
        Give AsmPrinter the most common expected implementation of
        runOnMachineFunction, and switch PPC to use EmitFunctionBody.
        The two ppc asmprinters now don't heave to define
        runOnMachineFunction.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94722 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 4e47dee4ccf9640938dd81cb93a9fd1ab26f5874
    Author: Jeffrey Yasskin <jyasskin at google.com>
    Date:   Thu Jan 28 01:14:43 2010 +0000
    
        Truncate the release notes so they're ready to accumulate notes for the 2.7 release.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94720 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit eb0602789a69e4764c70321424eb552a5d33d9cc
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Thu Jan 28 01:10:34 2010 +0000
    
        switch ARM to EmitFunctionBody().
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94719 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 07a24263e9daeb0d702fb8890e17347733327732
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Thu Jan 28 01:06:32 2010 +0000
    
        emit a 0 byte instead of a noop if a function is empty on darwin.
        "0" is nice and target independent.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94718 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit bea3e68096198f2d2b453b7e2f94303f61f587b0
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Thu Jan 28 01:02:27 2010 +0000
    
        Remove the argument from EmitJumpTableInfo, because it doesn't need it.
    
        Move the X86 implementation of function body emission up to
        AsmPrinter::EmitFunctionBody, which works by calling the virtual
        EmitInstruction method.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94716 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 692276d99e08f224f58ed5207ce4e8310137f72e
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Thu Jan 28 00:19:24 2010 +0000
    
        Drop the argument to AsmPrinter::EmitConstantPool and make it virtual.
        Overload it in the ARM backend to do nothing, since is does insane
        constant pool emission.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94708 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit c1b68d104bed6ca4fb4040a29b1cda52c2343e85
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Thu Jan 28 00:15:18 2010 +0000
    
        don't emit constant pools twice.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94706 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit b3c5f49d35d0468f92e6c02242cf6ef9dccbdb84
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Thu Jan 28 00:05:10 2010 +0000
    
        rename printVisibility to EmitVisibility and make it private,
        constify EmitLinkage.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94705 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit e12efcf52becf0152d0f58877fb0b6207b81d6ef
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Jan 27 23:58:11 2010 +0000
    
        switch ARM to use EmitFunctionHeader.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94703 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit df6c7e6ba3e6068ffd02540034da342e87a44e6d
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Jan 27 23:37:36 2010 +0000
    
        eliminate the ARMFunctionInfo::Align member, using
        MachineFunction::Alignment instead.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94701 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 0f0b5d27b3d7da40809549ea3163cad91b54ad34
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Jan 27 23:35:43 2010 +0000
    
        add a helper function for bumping up the alignment of a machine function.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94700 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit a9ae1a57883cc746c8ed9eedef5e8b5bb33a5c30
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Jan 27 23:26:37 2010 +0000
    
        switch blackfin to use EmitFunctionHeader.  BlackfinAsmPrinter.cpp
        is now less than 200 LOC!
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94699 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 9d5f9ea90027b7f170feda84b1d475ba9b861a15
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Jan 27 23:23:58 2010 +0000
    
        switch mips to use the shared EmitFunctionHeader() function
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94698 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 9926d38af912f56ed3d6e24d76ed9f73a0887395
    Author: Sean Callanan <scallanan at apple.com>
    Date:   Wed Jan 27 23:20:51 2010 +0000
    
        Changed constants to an enum so as not to pollute the
        global namespace needlessly.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94697 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit e6060faac72ff45287e952a53f7a58a4ac36cf9d
    Author: Sean Callanan <scallanan at apple.com>
    Date:   Wed Jan 27 23:03:46 2010 +0000
    
        Added a header file defining the externally-visible C API
        for the LLVM disassemblers.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94696 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit dfa3d94ab52cb5e551f740deaaaa1e5d2a7f8ad4
    Author: Dale Johannesen <dalej at apple.com>
    Date:   Wed Jan 27 22:12:36 2010 +0000
    
        If the only use of something is a DEBUG_VALUE, don't
        let that stop it from being deleted, and change the
        DEBUG_VALUE value to undef.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94694 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 02e6dd46f178a58440557dbfa41df4cc8ed88203
    Author: Dale Johannesen <dalej at apple.com>
    Date:   Wed Jan 27 22:11:16 2010 +0000
    
        Treat MO_REG 0 location as undefined in DEBUG_VALUE,
        per document.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94693 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 9dbdbe8bee1358d3435be1898374c48263fb00e5
    Author: Dan Gohman <gohman at apple.com>
    Date:   Wed Jan 27 22:06:46 2010 +0000
    
        Add an svn:ignore.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94692 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit f0c5a8634d4dade44fec9a1abc76b20c5f1a8fca
    Author: Victor Hernandez <vhernandez at apple.com>
    Date:   Wed Jan 27 22:03:03 2010 +0000
    
        Need to recurse for all operands of function-local metadata; and handle Instructions (which map to themselves)
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94691 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 662a0c306457aed9147f582e64ed3642d4aa7a8b
    Author: Bob Wilson <bob.wilson at apple.com>
    Date:   Wed Jan 27 22:01:02 2010 +0000
    
        Avoid creating redundant PHIs in SSAUpdater::GetValueInMiddleOfBlock.
        This was already being done in SSAUpdater::GetValueAtEndOfBlock so I've
        just changed SSAUpdater to check for existing PHIs in both places.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94690 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit dbf472700fa3dbfb9568126b52d28ada35b13ece
    Author: Ted Kremenek <kremenek at apple.com>
    Date:   Wed Jan 27 20:44:12 2010 +0000
    
        Update CMake build.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94687 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 752ff1fb26fc819498de04d342d496f146100f2a
    Author: Jeffrey Yasskin <jyasskin at google.com>
    Date:   Wed Jan 27 20:34:15 2010 +0000
    
        Kill ModuleProvider and ghost linkage by inverting the relationship between
        Modules and ModuleProviders. Because the "ModuleProvider" simply materializes
        GlobalValues now, and doesn't provide modules, it's renamed to
        "GVMaterializer". Code that used to need a ModuleProvider to materialize
        Functions can now materialize the Functions directly. Functions no longer use a
        magic linkage to record that they're materializable; they simply ask the
        GVMaterializer.
    
        Because the C ABI must never change, we can't remove LLVMModuleProviderRef or
        the functions that refer to it. Instead, because Module now exposes the same
        functionality ModuleProvider used to, we store a Module* in any
        LLVMModuleProviderRef and translate in the wrapper methods.  The bindings to
        other languages still use the ModuleProvider concept.  It would probably be
        worth some time to update them to follow the C++ more closely, but I don't
        intend to do it.
    
        Fixes http://llvm.org/PR5737 and http://llvm.org/PR5735.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94686 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 844446082c4a29f4c23e18ff5225890a3606a4c6
    Author: Benjamin Kramer <benny.kra at googlemail.com>
    Date:   Wed Jan 27 19:58:47 2010 +0000
    
        Don't bother with sprintf, just pass the Twine through.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94684 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit d238cc10f8fe9b9e568c76ed3943a48a0b2985a0
    Author: Benjamin Kramer <benny.kra at googlemail.com>
    Date:   Wed Jan 27 19:46:52 2010 +0000
    
        Use the less expensive getName function instead of getNameStr.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94683 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit bed204de2b223a441b1c4582ff813e5b664052c6
    Author: Chandler Carruth <chandlerc at gmail.com>
    Date:   Wed Jan 27 10:36:15 2010 +0000
    
        Quick fix to a test that is currently failing on every Linux build bot. No idea
        if this is the "correct" fix, but it seems a strict improvement.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94675 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit c93a316297a3545cbd6a8924a34e4370fe6d1905
    Author: Chandler Carruth <chandlerc at gmail.com>
    Date:   Wed Jan 27 10:27:10 2010 +0000
    
        Silence GCC warnings with asserts turned off. No functionality change.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94673 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit fbbb0b1faaf20465d85b540684eb90a7fe1d0178
    Author: Mikhail Glushenkov <foldr at codedgers.com>
    Date:   Wed Jan 27 10:13:28 2010 +0000
    
        Make SMDiagnostic::Print a const method.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94672 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 0b79bae89b28eb9a4ab4dc4ec6c62985e69a10d4
    Author: Mikhail Glushenkov <foldr at codedgers.com>
    Date:   Wed Jan 27 10:13:11 2010 +0000
    
        Trailing whitespace.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94671 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 47bc2f65663192c4d8ac781b685d94d7144f5cea
    Author: Duncan Sands <baldrick at free.fr>
    Date:   Wed Jan 27 10:08:08 2010 +0000
    
        Revert commit 94666 (ddunbar) [Suppress clang warning about unused arguments].
        It causes g++ to complain: unrecognized option '-Qunused-arguments'
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94670 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 118ed0eb33493ab604b6b24ad89e6348fd68195e
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Jan 27 07:21:55 2010 +0000
    
        add a new AsmPrinter::EmitFunctionEntryLabel virtual function,
        which allows targets to override function entry label emission.
        Use it to convert linux/ppc to use EmitFunctionHeader().
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94667 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit cdd25445c0cdfe9def326ff61b6dbe6ddac69b48
    Author: Daniel Dunbar <daniel at zuster.org>
    Date:   Wed Jan 27 07:10:10 2010 +0000
    
        Suppress clang warning about unused arguments.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94666 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit aac8d95fefc1f8efef19e0ca1e1d7f6f2575d6b8
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Wed Jan 27 06:25:16 2010 +0000
    
        Perform trivial tail call optimization for callees with "C" ABI. These are done
        even when -tailcallopt is not specified and it does not require changing ABI.
        First case is the most trivial one. Perform tail call optimization when both
        the caller and callee do not return values and when the callee does not take
        any input arguments.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94664 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit e453d94b9cedea849c6aec9fbfcbe395cadbde8f
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Jan 27 02:18:21 2010 +0000
    
        merge two ifs
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94650 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 78b48b61971bdb388971e9dd7473cc4661052159
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Jan 27 02:12:20 2010 +0000
    
        some cleanups.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94649 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit e347d24803b32d9b25ad30b1f604b63cc7606eb5
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Jan 27 02:04:20 2010 +0000
    
        no need to check for null
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94648 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit fe398973c7ced1a4af9a925bfeecbb6527a096d5
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Wed Jan 27 01:44:40 2010 +0000
    
        Remove a dead target hook.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94646 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 7bf770db031ef3e9348cc5db7d836d545ac0b1b7
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Jan 27 01:02:43 2010 +0000
    
        ppc/linux isn't ready for this and it was an accident that it was included.
        This should fix a bunch of linux buildbot failures.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94643 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 12dbb7096ea5f08cdce6099a28539ae9f217870b
    Author: Victor Hernandez <vhernandez at apple.com>
    Date:   Wed Jan 27 00:44:36 2010 +0000
    
        When converting dbg.declare to dbg.value, attach promoted store's debug metadata to dbg.value
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94634 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 25a2a85e32636a3c09169c9c25de7509404dac4c
    Author: Victor Hernandez <vhernandez at apple.com>
    Date:   Wed Jan 27 00:30:42 2010 +0000
    
        Linker needs to do deep-copy of function-local metadata to update references to function arguments
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94632 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 89cff97315984f1b30b2d2ca1470d684410d878f
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Jan 27 00:20:02 2010 +0000
    
        use existing basic block numbers instead of recomputing
        a new set of them.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94631 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit e0e44f66356645c49f1a3e9a6807f6828e9de5e7
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Wed Jan 27 00:17:20 2010 +0000
    
        Switch MSP430, CellSPU, SystemZ, Darwin/PPC, Alpha, and Sparc to
        EmitFunctionHeader:
    
        7 files changed, 16 insertions(+), 210 deletions(-)
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94630 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 6c55bfe437197d0d34edb6887da2a2dd29eb6abe
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Wed Jan 27 00:10:09 2010 +0000
    
        Clarify what -tailcallopt option actually do.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94628 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 8f240d49cb730fa95b7752aec624f14e26977443
    Author: Jim Grosbach <grosbach at apple.com>
    Date:   Wed Jan 27 00:07:20 2010 +0000
    
        Adjust setjmp instruction sequence to not need 32-bit alignment padding
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94627 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 8904bc5f834bde215cbaba8a898f739db1dfc673
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Wed Jan 27 00:07:07 2010 +0000
    
        Eliminate target hook IsEligibleForTailCallOptimization.
    
        Target independent isel should always pass along the "tail call" property. Change
        target hook LowerCall's parameter "isTailCall" into a refernce. If the target
        decides it's impossible to honor the tail call request, it should set isTailCall
        to false to make target independent isel happy.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94626 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit a0045f69c5b838f81cc0bf3a1c5512fe6b204988
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Wed Jan 27 00:00:57 2010 +0000
    
        Restore to pre-94570 state.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94625 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit b799bdfb839df00dd357b0f63ddce9086e2183ed
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Jan 26 23:53:39 2010 +0000
    
        mcize label emission for functions.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94624 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit a8174307f67b59afd8ba5355d05f0c8262554b31
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Jan 26 23:51:52 2010 +0000
    
        use EmitLinkage for functions as well as globals.  One output
        change is that we now use ".linkonce discard" for global variables
        instead of ".linkonce samesize".  These should be the same, just less
        strict.  If anyone is interested in mcizing MCSection for COFF targets,
        this should be easy to fix.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94623 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 31ffe0af9fac830a223c3a577ecac5bbaaecceae
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Jan 26 23:47:12 2010 +0000
    
        pull linkage emission code out to a new EmitLinkage function.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94621 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit d1e30988695b7a16e8e116395c951068a8ddbe0f
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Jan 26 23:41:48 2010 +0000
    
        rearrange some directives, no functionality change.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94620 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 7bca23ef9d02ce81b17c2964dd4411f71bb66481
    Author: Jeffrey Yasskin <jyasskin at google.com>
    Date:   Tue Jan 26 23:30:46 2010 +0000
    
        Roll r94484 (avoiding RTTI problems in tests) forward again in a way that isn't
        broken by setting CXXFLAGS on the command line.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94619 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 2548e91a283df66d482004ed3e973d2c381c5af7
    Author: Victor Hernandez <vhernandez at apple.com>
    Date:   Tue Jan 26 23:29:09 2010 +0000
    
        Avoid extra calls to MD->getNumOperands()
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94618 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 045d60450f7220d2f1446057058bd72bd6ed323d
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Tue Jan 26 23:28:40 2010 +0000
    
        Ignore 'forced' tailcall opt in fastisel mode.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94617 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 7c329dc12d3a5172ce163bf6e4cc84969f9c2e58
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Jan 26 23:26:29 2010 +0000
    
        remove a noop function.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94616 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit fcd69992ced3281fc9d0630806d30be2feaab5a2
    Author: Jakob Stoklund Olesen <stoklund at 2pi.dk>
    Date:   Tue Jan 26 23:21:56 2010 +0000
    
        Fix inline cost predictions with SCIENCE.
    
        After running a batch of measurements, it is clear that the inliner metrics
        need some adjustments:
    
        Own argument bonus:       20 -> 5
        Outgoing argument penalty: 0 -> 5
        Alloca bonus:             10 -> 5
        Constant instr bonus:      7 -> 5
        Dead successor bonus:     40 -> 5*(avg instrs/block)
    
        The new cost metrics are generaly 25 points higher than before, so we may need
        to move thresholds.
    
        With this change, InlineConstants::CallPenalty becomes a political correction:
    
        if (!isa<IntrinsicInst>(II) && !callIsSmall(CS.getCalledFunction()))
          NumInsts += InlineConstants::CallPenalty + CS.arg_size();
    
        The code size is accurately modelled by CS.arg_size(). CallPenalty is added
        because calls tend to take a long time, so it may not be worth it to inline a
        function with lots of calls.
    
        All of the political corrections are in the InlineConstants namespace:
        IndirectCallBonus, CallPenalty, LastCallToStaticBonus, ColdccPenalty,
        NoreturnPenalty.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94615 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 6af8d0c03c0957ea52590ac15a7deb2dbb5b3bab
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Jan 26 23:18:44 2010 +0000
    
        now that enough stuff is constified, move function header printing
        logic up from X86 into the common code.  The other targets will
        hopefully start using this soon.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94614 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 6139e33352f91d8deceac847e532bd56d69ee8d3
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Jan 26 23:18:02 2010 +0000
    
        constify a bunch of dwarf stuff now that the registerinfo method
        is constified.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94613 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 305c54bb02ce0ce0360b20d8562e299bc69dbd60
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Jan 26 23:15:09 2010 +0000
    
        constify a method argument.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94612 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 1082b75a14004f924335a44a7e6aae4d8d5957f7
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Tue Jan 26 23:13:04 2010 +0000
    
        Allow some automatic tailcall optimization without changing ABI.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94611 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit fd80f9ce1de542f63d4676bea34825b55da1ce64
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Tue Jan 26 23:07:57 2010 +0000
    
        Delete blank lines that bug me.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94610 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 36f987f0a6c1b88f47baec98947da0fa28c0fe34
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Jan 26 22:06:58 2010 +0000
    
        call emitconstantpool and emitjumptable like other targets.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94601 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 514f9f89c41d672737168b62f36f5835dc656161
    Author: Devang Patel <dpatel at apple.com>
    Date:   Tue Jan 26 22:03:41 2010 +0000
    
        Before existing NamedMDNode entry in the symbol table, remove any existing entry with the same name.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94600 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ce1f25476c67b572f4d82899a9ed693cf1115f9b
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Jan 26 21:53:08 2010 +0000
    
        emit jump table an alias ".set" directives through MCStreamer as
        assignments.
    
        .set x, a-b
    
        is the same as:
    
        x = a-b
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94596 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 268ec7835e66eda747bbda73b54366b3dde2665c
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Jan 26 21:51:43 2010 +0000
    
        fix CastInst::castIsValid to reject aggregate types, fixing PR6153:
    
        llvm-as: t.ll:1:25: error: invalid cast opcode for cast from '[4 x i8]' to '[1 x i32]'
        @x = constant [1 x i32] bitcast ([4 x i8] c"abcd" to [1 x i32])
                                ^
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94595 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit eec5843c809c182a12560f67c0d54aa86ef9e97b
    Author: Devang Patel <dpatel at apple.com>
    Date:   Tue Jan 26 21:42:58 2010 +0000
    
        Remve unnecessary include.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94594 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit cc04b87311d24f0b8b2d12a75fe442c06302aeb1
    Author: Devang Patel <dpatel at apple.com>
    Date:   Tue Jan 26 21:39:14 2010 +0000
    
        Use AssertingVH, just to be paranoid.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94593 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 68c3e203d9af2c4e1694235b02dd61fc2b5eb6cc
    Author: Jakob Stoklund Olesen <stoklund at 2pi.dk>
    Date:   Tue Jan 26 21:31:35 2010 +0000
    
        Revert test polarity to match comment and desired outcome. Remove undeserved bonus.
    
        A GEP with all constant indices is already considered free by
        analyzeBasicBlock(), so don't give it an extra bonus in
        CountCodeReductionForAlloca().
    
        This patch should remove a small positive bias toward inlining functions with
        variable-index GEPs, and remove a smaller negative bias from functions with
        all-constant index GEPs.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94591 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 822b6122a5b7a6fdf120ac8304381b601cb1f0ee
    Author: Jakob Stoklund Olesen <stoklund at 2pi.dk>
    Date:   Tue Jan 26 21:31:30 2010 +0000
    
        Remove dead code.
    
        Functions containing indirectbr are marked NeverInline by analyzeBasicBlock(),
        so there is no point in giving indirectbr special treatment in
        CountCodeReductionForConstant. It is never called.
    
        No functional change intended.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94590 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit b66489dcbe91da300bea69d18f8a086d7d503f5e
    Author: Jakob Stoklund Olesen <stoklund at 2pi.dk>
    Date:   Tue Jan 26 21:31:24 2010 +0000
    
        Skip calculation of ArgumentWeights if it will never be used.
    
        Save a few bytes by allocating the correct size vector.
    
        No functional change intended.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94589 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit e6e109bd42e8b8fd138f4daf95c30c5b48e6eafa
    Author: Devang Patel <dpatel at apple.com>
    Date:   Tue Jan 26 21:16:06 2010 +0000
    
        Emit DW_AT_containing_type attribute for a class if containing type is known.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94587 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit c8898d2736985e2a14e9cda816d7e640397cfeb1
    Author: Devang Patel <dpatel at apple.com>
    Date:   Tue Jan 26 21:14:59 2010 +0000
    
        Add extra element to composite type. This new element will be used to record c++ class that holds current class's vtable.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94586 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit c317dc5547141e68c337cfe885ee69b44fcb9a6b
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Jan 26 20:40:54 2010 +0000
    
        Eliminate SetDirective, and replace it with HasSetDirective.
        Default HasSetDirective to true, since most targets have it.
    
        The targets that claim to not have it probably do, or it is
        spelled differently. These include Blackfin, Mips, Alpha, and
        PIC16.  All of these except pic16 are normal ELF targets, so
        they almost certainly have it.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94585 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ca334f0696d794f91a2499b3c32843a2dab2a842
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Tue Jan 26 20:36:21 2010 +0000
    
        Delete dead code.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94583 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 7d5ae0ed3cb6222e90157ef381678efc6397134c
    Author: Rafael Espindola <rafael.espindola at gmail.com>
    Date:   Tue Jan 26 20:21:43 2010 +0000
    
        Emit .comm alignment in bytes but .align in powers of 2 for ARM ELF.
    
        Original patch by Sandeep Patel and updated by me.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94582 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 1b6a1a0319984ad0b8aa7a53c329e25258725e20
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Jan 26 20:20:43 2010 +0000
    
        eliminate MCAsmInfo::NeedsSet: we now just use .set on any platform
        that has it.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94581 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit e9644e95834edf5b112906b858222eca75621946
    Author: Chris Lattner <sabre at nondot.org>
    Date:   Tue Jan 26 20:17:34 2010 +0000
    
        don't set to the default value.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94580 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ab3cf043ce28d0236360938d71ada4f499d749c5
    Author: Junjie Gu <jgu222 at gmail.com>
    Date:   Tue Jan 26 19:45:17 2010 +0000
    
        test commit.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94578 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 3bbeaad4db989fd4f2a2fbaff3861a369b8e25de
    Author: Dan Gohman <gohman at apple.com>
    Date:   Tue Jan 26 19:25:59 2010 +0000
    
        -disable-output is no longer needed with -analyze.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94574 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 35640b2bfaf054ec644de402407dda59a2638d92
    Author: Dan Gohman <gohman at apple.com>
    Date:   Tue Jan 26 19:19:05 2010 +0000
    
        Make the unsigned-range code more consistent with the signed-range code,
        and clean up some loose ends.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94572 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 3cd6cea76a29447f5057207d07b486af197ae024
    Author: Evan Cheng <evan.cheng at apple.com>
    Date:   Tue Jan 26 19:04:47 2010 +0000
    
        Code refactoring, no functionality change.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94570 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 7590bb0e7d4de62df0993a8c7573b73d6509808f
    Author: Bob Wilson <bob.wilson at apple.com>
    Date:   Tue Jan 26 19:04:37 2010 +0000
    
        Revert 94484.  Re-disable unittests that need RTTI.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94569 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 897516339c2c8ed92066b170200b6a19a045f81f
    Author: Victor Hernandez <vhernandez at apple.com>
    Date:   Tue Jan 26 18:57:53 2010 +0000
    
        Switch AllocaDbgDeclares to SmallVector and don't leak DIFactory
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94567 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ba05500da36091ffa0c867831d779ca45a868685
    Author: Dan Gohman <gohman at apple.com>
    Date:   Tue Jan 26 18:32:54 2010 +0000
    
        Fix a typo in a comment that Duncan noticed.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94562 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 4a24bfd614af412601a08f9644de5f9e72eb827b
    Author: Dan Gohman <gohman at apple.com>
    Date:   Tue Jan 26 18:30:24 2010 +0000
    
        Remove SIL, DIL, and BPL from the GR8_NOREX allocation order also.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94560 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit dfb17221accd7197bc194888ae093f90a9636705
    Author: Dan Gohman <gohman at apple.com>
    Date:   Tue Jan 26 18:14:22 2010 +0000
    
        SIL, DIL, BPL, and SPL require a REX prefix.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94558 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit a2a8efbb47714fca780e31b4e3634bef578668b6
    Author: Dan Gohman <gohman at apple.com>
    Date:   Tue Jan 26 16:46:18 2010 +0000
    
        Rename ItCount to BECount, since it holds a backedge-taken count rather
        than an iteration count.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94549 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 135a294519f851b3b701846581e0cd586e036b55
    Author: Dan Gohman <gohman at apple.com>
    Date:   Tue Jan 26 16:04:20 2010 +0000
    
        Fix ICmpInst::makeConstantRange to use ConstantRange's API properly
        in the case of empty and full ranges.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94548 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 9c32772f586f832b770de187e6822091ee38bc63
    Author: Dan Gohman <gohman at apple.com>
    Date:   Tue Jan 26 15:56:18 2010 +0000
    
        Fix a typo that several people pointed out. Also, address the case of
        wrapping that Duncan pointed out.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94547 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit b690d9e8e1653bdf7a13e082918652f9448a01f1
    Author: Mikhail Glushenkov <foldr at codedgers.com>
    Date:   Tue Jan 26 14:55:44 2010 +0000
    
        Support -arch.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94546 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit ead5e4cce0b949bfecb15cd2bd3ae56ca195888a
    Author: Mikhail Glushenkov <foldr at codedgers.com>
    Date:   Tue Jan 26 14:55:30 2010 +0000
    
        Support for -iquote.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94545 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit b746f712542767bc7e4c3444793212ac0e3110f5
    Author: Mikhail Glushenkov <foldr at codedgers.com>
    Date:   Tue Jan 26 14:55:16 2010 +0000
    
        Better error message.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94544 91177308-0d34-0410-b5e6-96231b3b80d8
    
    commit 276fe43e5323899b7c9eadcc80477af0e2d75d32
    Author: Mikhail Glushenkov <foldr at codedgers.com>
    Date:   Tue Jan 26 14:55:04 2010 +0000
    
        Escape double quotes in 'help'.
    
        git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94543 91177308-0d34-0410-b5e6-96231b3b80d8

diff --git a/libclamav/c++/llvm/CMakeLists.txt b/libclamav/c++/llvm/CMakeLists.txt
index 74a95ea..9e76de1 100644
--- a/libclamav/c++/llvm/CMakeLists.txt
+++ b/libclamav/c++/llvm/CMakeLists.txt
@@ -45,6 +45,7 @@ Please clean the source directory.")
 endif()
 
 set(LLVM_ALL_TARGETS
+  MBlaze
   X86
   )
 
diff --git a/libclamav/c++/llvm/CREDITS.TXT b/libclamav/c++/llvm/CREDITS.TXT
index f6467ab..e58b85f 100644
--- a/libclamav/c++/llvm/CREDITS.TXT
+++ b/libclamav/c++/llvm/CREDITS.TXT
@@ -335,3 +335,8 @@ D: Bunches of stuff
 N: Bob Wilson
 E: bob.wilson at acm.org
 D: Advanced SIMD (NEON) support in the ARM backend
+
+N: Wesley Peck
+E: peckw at wesleypeck.com
+W: http://wesleypeck.com/
+D: MicroBlaze backend
diff --git a/libclamav/c++/llvm/Makefile b/libclamav/c++/llvm/Makefile
index 319bdcd..f5a9b33 100644
--- a/libclamav/c++/llvm/Makefile
+++ b/libclamav/c++/llvm/Makefile
@@ -30,8 +30,8 @@ ifeq ($(BUILD_DIRS_ONLY),1)
   DIRS := lib/System lib/Support utils
   OPTIONAL_DIRS :=
 else
-  DIRS := lib/System lib/Support utils lib/VMCore lib tools/llvm-config \
-          tools runtime docs unittests
+  DIRS := lib/System lib/Support utils lib/VMCore lib tools/llvm-shlib \
+          tools/llvm-config tools runtime docs unittests
   OPTIONAL_DIRS := projects bindings
 endif
 
@@ -43,12 +43,9 @@ EXTRA_DIST := test unittests llvm.spec include win32 Xcode
 
 include $(LEVEL)/Makefile.config
 
-# llvm-gcc4 doesn't need runtime libs.  llvm-gcc4 is the only supported one.
-# FIXME: Remove runtime entirely once we have an understanding of where
-# libprofile etc should go.
-#ifeq ($(LLVMGCC_MAJVERS),4)
-#  DIRS := $(filter-out runtime, $(DIRS))
-#endif
+ifneq ($(ENABLE_SHARED),1)
+  DIRS := $(filter-out tools/llvm-shlib, $(DIRS))
+endif
 
 ifeq ($(MAKECMDGOALS),libs-only)
   DIRS := $(filter-out tools runtime docs, $(DIRS))
diff --git a/libclamav/c++/llvm/Makefile.config.in b/libclamav/c++/llvm/Makefile.config.in
index 2cc69dc..1b61f09 100644
--- a/libclamav/c++/llvm/Makefile.config.in
+++ b/libclamav/c++/llvm/Makefile.config.in
@@ -76,14 +76,14 @@ endif
 
 LLVMMAKE := $(LLVM_SRC_ROOT)/make
 
-PROJ_bindir     := $(DESTDIR)$(PROJ_prefix)/bin
-PROJ_libdir     := $(DESTDIR)$(PROJ_prefix)/lib
-PROJ_datadir    := $(DESTDIR)$(PROJ_prefix)/share
-PROJ_docsdir    := $(DESTDIR)$(PROJ_prefix)/docs/llvm
-PROJ_etcdir     := $(DESTDIR)$(PROJ_prefix)/etc/llvm
-PROJ_includedir := $(DESTDIR)$(PROJ_prefix)/include
-PROJ_infodir    := $(DESTDIR)$(PROJ_prefix)/info
-PROJ_mandir     := $(DESTDIR)$(PROJ_prefix)/share/man
+PROJ_bindir     := $(PROJ_prefix)/bin
+PROJ_libdir     := $(PROJ_prefix)/lib
+PROJ_datadir    := $(PROJ_prefix)/share
+PROJ_docsdir    := $(PROJ_prefix)/docs/llvm
+PROJ_etcdir     := $(PROJ_prefix)/etc/llvm
+PROJ_includedir := $(PROJ_prefix)/include
+PROJ_infodir    := $(PROJ_prefix)/info
+PROJ_mandir     := $(PROJ_prefix)/share/man
 
 # Determine if we're on a unix type operating system
 LLVM_ON_UNIX:=@LLVM_ON_UNIX@
@@ -183,25 +183,21 @@ TARGETS_TO_BUILD=@TARGETS_TO_BUILD@
 # want to override the value set by configure.
 LLVMGCCDIR := @LLVMGCCDIR@
 
-# Determine the target for which LLVM should generate code.
-ifeq (@LLVMGCC_MAJVERS@,3)
-LLVMGCCARCH := @target@/3.4-llvm
-else
-LLVMGCCARCH := @target@/@LLVMGCC_VERSION@
-endif
-
-# Determine the path where the library executables are
-LLVMGCCLIBEXEC := @LLVMGCCLIBEXEC@
-
 # Full pathnames of LLVM C/C++ front-end 'cc1' and 'cc1plus' binaries:
 LLVMGCC  := @LLVMGCC@
 LLVMGXX  := @LLVMGXX@
 LLVMCC1  := @LLVMCC1@
 LLVMCC1PLUS := @LLVMCC1PLUS@
-LLVMGCC_VERSION := @LLVMGCC_VERSION@
-LLVMGCC_MAJVERS := @LLVMGCC_MAJVERS@
 LLVMGCC_LANGS := @LLVMGCC_LANGS@
 
+# Information on Clang, if configured.
+CLANGPATH := @CLANGPATH@
+CLANGXXPATH := @CLANGXXPATH@
+ENABLE_BUILT_CLANG := @ENABLE_BUILT_CLANG@
+
+# The LLVM capable compiler to use.
+LLVMCC_OPTION := @LLVMCC_OPTION@
+
 # Path to directory where object files should be stored during a build.
 # Set OBJ_ROOT to "." if you do not want to use a separate place for
 # object files.
@@ -266,6 +262,9 @@ ENABLE_THREADS := @ENABLE_THREADS@
 # Do we want to build with position independent code?
 ENABLE_PIC := @ENABLE_PIC@
 
+# Do we want to build a shared library and link the tools with it?
+ENABLE_SHARED := @ENABLE_SHARED@
+
 # Use -fvisibility-inlines-hidden?
 ENABLE_VISIBILITY_INLINES_HIDDEN := @ENABLE_VISIBILITY_INLINES_HIDDEN@
 
@@ -276,6 +275,9 @@ ENABLE_VISIBILITY_INLINES_HIDDEN := @ENABLE_VISIBILITY_INLINES_HIDDEN@
 # Enable JIT for this platform
 TARGET_HAS_JIT = @TARGET_HAS_JIT@
 
+# Environment variable to set to change the runtime shared library search path.
+SHLIBPATH_VAR = @SHLIBPATH_VAR@
+
 # Shared library extension for host platform.
 SHLIBEXT = @SHLIBEXT@
 
diff --git a/libclamav/c++/llvm/Makefile.rules b/libclamav/c++/llvm/Makefile.rules
index 761cc81..fcddd50 100644
--- a/libclamav/c++/llvm/Makefile.rules
+++ b/libclamav/c++/llvm/Makefile.rules
@@ -493,7 +493,27 @@ ExmplDir    := $(PROJ_OBJ_ROOT)/$(BuildMode)/examples
 LLVMLibDir  := $(LLVM_OBJ_ROOT)/$(BuildMode)/lib
 LLVMToolDir := $(LLVM_OBJ_ROOT)/$(BuildMode)/bin
 LLVMExmplDir:= $(LLVM_OBJ_ROOT)/$(BuildMode)/examples
-CFERuntimeLibDir := $(LLVMGCCDIR)/lib
+
+#--------------------------------------------------------------------
+# LLVM Capable Compiler
+#--------------------------------------------------------------------
+
+ifeq ($(LLVMCC_OPTION),llvm-gcc)
+  LLVMCC := $(LLVMGCC)
+  LLVMCXX := $(LLVMGXX)
+else
+  ifeq ($(LLVMCC_OPTION),clang)
+    ifneq ($(CLANGPATH),)
+      LLVMCC := $(CLANGPATH)
+      LLVMCXX := $(CLANGXXPATH)
+    else
+      ifeq ($(ENABLE_BUILT_CLANG),1)
+        LLVMCC := $(LLVMToolDir)/clang
+        LLVMCXX := $(LLVMToolDir)/clang++
+      endif
+    endif
+  endif
+endif
 
 #--------------------------------------------------------------------
 # Full Paths To Compiled Tools and Utilities
@@ -529,16 +549,6 @@ endif
 ifndef LBUGPOINT
 LBUGPOINT := $(LLVMToolDir)/bugpoint$(EXEEXT)
 endif
-ifndef LUPGRADE
-LUPGRADE := $(LLVMToolDir)/llvm-upgrade$(EXEEXT)
-endif
-ifeq ($(LLVMGCC_MAJVERS),3)
-LLVMGCCWITHPATH  := PATH="$(LLVMToolDir):$(PATH)" $(LLVMGCC)
-LLVMGXXWITHPATH  := PATH="$(LLVMToolDir):$(PATH)" $(LLVMGXX)
-else
-LLVMGCCWITHPATH  := $(LLVMGCC)
-LLVMGXXWITHPATH  := $(LLVMGXX)
-endif
 
 #--------------------------------------------------------------------
 # Adjust to user's request
@@ -613,11 +623,12 @@ endif
 ifneq ($(HOST_OS),Darwin)
 ifneq ($(DARWIN_MAJVERS),4)
 ifdef TOOLNAME
-ifdef EXAMPLE_TOOL
-  LD.Flags += $(RPATH) -Wl,$(ExmplDir) $(RDYNAMIC)
-else
-  LD.Flags += $(RPATH) -Wl,$(ToolDir) $(RDYNAMIC)
-endif
+  LD.Flags += $(RPATH) -Wl,'$$ORIGIN/../lib'
+  ifdef EXAMPLE_TOOL
+    LD.Flags += $(RPATH) -Wl,$(ExmplDir) $(RDYNAMIC)
+  else
+    LD.Flags += $(RPATH) -Wl,$(ToolDir) $(RDYNAMIC)
+  endif
 endif
 endif
 endif
@@ -710,14 +721,12 @@ else
                   $(TargetCommonOpts)  $(CompileCommonOpts) $(LD.Flags) $(Strip)
 endif
 
-BCCompile.C   = $(LLVMGCCWITHPATH) $(CPP.Flags) $(C.Flags) $(CFLAGS) \
-		$(CPPFLAGS) \
+BCCompile.C   = $(LLVMCC) $(CPP.Flags) $(C.Flags) $(CFLAGS) $(CPPFLAGS) \
                 $(TargetCommonOpts) $(CompileCommonOpts)
 Preprocess.C  = $(CC) $(CPP.Flags) $(C.Flags) $(CPPFLAGS) \
                 $(TargetCommonOpts) $(CompileCommonOpts) -E
 
-BCCompile.CXX = $(LLVMGXXWITHPATH) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) \
-		$(CPPFLAGS) \
+BCCompile.CXX = $(LLVMCXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) $(CPPFLAGS) \
                 $(TargetCommonOpts) $(CompileCommonOpts)
 
 ProgInstall   = $(INSTALL) $(Install.StripFlag) -m 0755
@@ -772,7 +781,7 @@ ObjectsBC := $(BaseNameSources:%=$(ObjDir)/%.bc)
 # in the file so they get built before dependencies
 #---------------------------------------------------------
 
-$(PROJ_bindir) $(PROJ_libdir) $(PROJ_includedir) $(PROJ_etcdir)::
+$(DESTDIR)$(PROJ_bindir) $(DESTDIR)$(PROJ_libdir) $(DESTDIR)$(PROJ_includedir) $(DESTDIR)$(PROJ_etcdir)::
 	$(Verb) $(MKDIR) $@
 
 # To create other directories, as needed, and timestamp their creation
@@ -895,22 +904,22 @@ install-local::
 uninstall-local::
 	$(Echo) UnInstall circumvented with NO_INSTALL
 else
-install-local:: $(PROJ_etcdir) $(CONFIG_FILES)
-	$(Echo) Installing Configuration Files To $(PROJ_etcdir)
+install-local:: $(DESTDIR)$(PROJ_etcdir) $(CONFIG_FILES)
+	$(Echo) Installing Configuration Files To $(DESTDIR)$(PROJ_etcdir)
 	$(Verb)for file in $(CONFIG_FILES); do \
           if test -f $(PROJ_OBJ_DIR)/$${file} ; then \
-            $(DataInstall) $(PROJ_OBJ_DIR)/$${file} $(PROJ_etcdir) ; \
+            $(DataInstall) $(PROJ_OBJ_DIR)/$${file} $(DESTDIR)$(PROJ_etcdir) ; \
           elif test -f $(PROJ_SRC_DIR)/$${file} ; then \
-            $(DataInstall) $(PROJ_SRC_DIR)/$${file} $(PROJ_etcdir) ; \
+            $(DataInstall) $(PROJ_SRC_DIR)/$${file} $(DESTDIR)$(PROJ_etcdir) ; \
           else \
             $(ECHO) Error: cannot find config file $${file}. ; \
           fi \
 	done
 
 uninstall-local::
-	$(Echo) Uninstalling Configuration Files From $(PROJ_etcdir)
+	$(Echo) Uninstalling Configuration Files From $(DESTDIR)$(PROJ_etcdir)
 	$(Verb)for file in $(CONFIG_FILES); do \
-	  $(RM) -f $(PROJ_etcdir)/$${file} ; \
+	  $(RM) -f $(DESTDIR)$(PROJ_etcdir)/$${file} ; \
 	done
 endif
 
@@ -952,11 +961,16 @@ $(LLVM_CONFIG):
 
 $(ToolDir)/$(strip $(TOOLNAME))$(EXEEXT): $(LLVM_CONFIG)
 
+ifeq ($(ENABLE_SHARED), 1)
+LLVMLibsOptions += -lLLVM-$(LLVMVersion)
+LLVMLibsPaths += $(LibDir)/libLLVM-$(LLVMVersion)$(SHLIBEXT)
+else
 LLVMLibsOptions += $(shell $(LLVM_CONFIG) --libs     $(LINK_COMPONENTS))
 LLVMLibsPaths   += $(LLVM_CONFIG) \
                    $(shell $(LLVM_CONFIG) --libfiles $(LINK_COMPONENTS))
 endif
 endif
+endif
 
 ###############################################################################
 # Library Build Rules: Four ways to build a library
@@ -971,12 +985,12 @@ endif
 #---------------------------------------------------------
 
 ifdef MODULE_NAME
-ifeq ($(strip $(LLVMGCC)),)
-$(warning Modules require llvm-gcc but no llvm-gcc is available ****)
+ifeq ($(strip $(LLVMCC)),)
+$(warning Modules require LLVM capable compiler but none is available ****)
 else
 
 Module     := $(LibDir)/$(MODULE_NAME).bc
-LinkModule := $(LLVMLD) -L$(CFERuntimeLibDir) -r
+LinkModule := $(LLVMLD) -r
 
 
 ifdef EXPORTED_SYMBOL_FILE
@@ -997,7 +1011,7 @@ endif
 ifdef BYTECODE_DESTINATION
 ModuleDestDir := $(BYTECODE_DESTINATION)
 else
-ModuleDestDir := $(PROJ_libdir)
+ModuleDestDir := $(DESTDIR)$(PROJ_libdir)
 endif
 
 ifdef NO_INSTALL
@@ -1076,17 +1090,17 @@ install-local::
 uninstall-local::
 	$(Echo) Uninstall circumvented with NO_INSTALL
 else
-DestSharedLib = $(PROJ_libdir)/lib$(LIBRARYNAME)$(SHLIBEXT)
+DestSharedLib = $(DESTDIR)$(PROJ_libdir)/lib$(LIBRARYNAME)$(SHLIBEXT)
 
 install-local:: $(DestSharedLib)
 
-$(DestSharedLib): $(LibName.SO) $(PROJ_libdir)
+$(DestSharedLib): $(LibName.SO) $(DESTDIR)$(PROJ_libdir)
 	$(Echo) Installing $(BuildMode) Shared Library $(DestSharedLib)
 	$(Verb) $(INSTALL) $(LibName.SO) $(DestSharedLib)
 
 uninstall-local::
 	$(Echo) Uninstalling $(BuildMode) Shared Library $(DestSharedLib)
-	-$(Verb) $(RM) -f $(PROJ_libdir)/lib$(LIBRARYNAME).*
+	-$(Verb) $(RM) -f $(DESTDIR)$(PROJ_libdir)/lib$(LIBRARYNAME).*
 endif
 endif
 
@@ -1097,15 +1111,14 @@ endif
 #   targets for building them.
 #---------------------------------------------------------
 ifdef BYTECODE_LIBRARY
-ifeq ($(strip $(LLVMGCC)),)
-$(warning Bytecode libraries require llvm-gcc which could not be found ****)
+ifeq ($(strip $(LLVMCC)),)
+$(warning Bytecode libraries require LLVM capable compiler but none is available ****)
 else
 
 all-local:: $(LibName.BCA)
 
 ifdef EXPORTED_SYMBOL_FILE
-BCLinkLib = $(LLVMLD) -L$(CFERuntimeLibDir) \
-                     -internalize-public-api-file=$(EXPORTED_SYMBOL_FILE)
+BCLinkLib = $(LLVMLD) -internalize-public-api-file=$(EXPORTED_SYMBOL_FILE)
 
 $(LibName.BCA): $(ObjectsBC) $(LibDir)/.dir $(LLVMLD) \
                 $(LLVMToolDir)/llvm-ar
@@ -1131,7 +1144,7 @@ endif
 ifdef BYTECODE_DESTINATION
 BytecodeDestDir := $(BYTECODE_DESTINATION)
 else
-BytecodeDestDir := $(PROJ_libdir)
+BytecodeDestDir := $(DESTDIR)$(PROJ_libdir)
 endif
 
 DestBytecodeLib = $(BytecodeDestDir)/lib$(LIBRARYNAME).bca
@@ -1162,11 +1175,13 @@ endif
 #   If neither BUILD_ARCHIVE or LOADABLE_MODULE are specified, default to
 #   building an archive.
 #---------------------------------------------------------
+ifndef NO_BUILD_ARCHIVE
 ifndef BUILD_ARCHIVE
 ifndef LOADABLE_MODULE
 BUILD_ARCHIVE = 1
 endif
 endif
+endif
 
 #---------------------------------------------------------
 # Archive Library Targets:
@@ -1194,13 +1209,13 @@ install-local::
 uninstall-local::
 	$(Echo) Uninstall circumvented with NO_INSTALL
 else
-DestArchiveLib := $(PROJ_libdir)/lib$(LIBRARYNAME).a
+DestArchiveLib := $(DESTDIR)$(PROJ_libdir)/lib$(LIBRARYNAME).a
 
 install-local:: $(DestArchiveLib)
 
-$(DestArchiveLib): $(LibName.A) $(PROJ_libdir)
+$(DestArchiveLib): $(LibName.A) $(DESTDIR)$(PROJ_libdir)
 	$(Echo) Installing $(BuildMode) Archive Library $(DestArchiveLib)
-	$(Verb) $(MKDIR) $(PROJ_libdir)
+	$(Verb) $(MKDIR) $(DESTDIR)$(PROJ_libdir)
 	$(Verb) $(INSTALL) $(LibName.A) $(DestArchiveLib)
 
 uninstall-local::
@@ -1300,11 +1315,11 @@ install-local::
 uninstall-local::
 	$(Echo) Uninstall circumvented with NO_INSTALL
 else
-DestTool = $(PROJ_bindir)/$(TOOLEXENAME)
+DestTool = $(DESTDIR)$(PROJ_bindir)/$(TOOLEXENAME)
 
 install-local:: $(DestTool)
 
-$(DestTool): $(ToolBuildPath) $(PROJ_bindir)
+$(DestTool): $(ToolBuildPath) $(DESTDIR)$(PROJ_bindir)
 	$(Echo) Installing $(BuildMode) $(DestTool)
 	$(Verb) $(ProgInstall) $(ToolBuildPath) $(DestTool)
 
@@ -1382,19 +1397,19 @@ BC_DEPEND_OPTIONS = -MMD -MP -MF "$(ObjDir)/$*.bc.d.tmp" \
 BC_DEPEND_MOVEFILE = then $(MV) -f "$(ObjDir)/$*.bc.d.tmp" "$(ObjDir)/$*.bc.d"; \
                      else $(RM) "$(ObjDir)/$*.bc.d.tmp"; exit 1; fi
 
-$(ObjDir)/%.ll: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMGXX)
+$(ObjDir)/%.ll: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
 	$(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)"
 	$(Verb) if $(BCCompile.CXX) $(BC_DEPEND_OPTIONS) \
                               $< -o $(ObjDir)/$*.ll -S -emit-llvm ; \
 	        $(BC_DEPEND_MOVEFILE)
 
-$(ObjDir)/%.ll: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMGXX)
+$(ObjDir)/%.ll: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
 	$(Echo) "Compiling $*.cc for $(BuildMode) build (bytecode)"
 	$(Verb) if $(BCCompile.CXX) $(BC_DEPEND_OPTIONS) \
                               $< -o $(ObjDir)/$*.ll -S -emit-llvm ; \
 	        $(BC_DEPEND_MOVEFILE)
 
-$(ObjDir)/%.ll: %.c $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMGCC)
+$(ObjDir)/%.ll: %.c $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCC)
 	$(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)"
 	$(Verb) if $(BCCompile.C) $(BC_DEPEND_OPTIONS) \
                               $< -o $(ObjDir)/$*.ll -S -emit-llvm ; \
@@ -1415,15 +1430,15 @@ $(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
 	$(Echo) "Compiling $*.c for $(BuildMode) build" $(PIC_FLAG)
 	$(Compile.C) $< -o $@
 
-$(ObjDir)/%.ll: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMGXX)
+$(ObjDir)/%.ll: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
 	$(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)"
 	$(BCCompile.CXX) $< -o $@ -S -emit-llvm
 
-$(ObjDir)/%.ll: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMGXX)
+$(ObjDir)/%.ll: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX)
 	$(Echo) "Compiling $*.cc for $(BuildMode) build (bytecode)"
 	$(BCCompile.CXX) $< -o $@ -S -emit-llvm
 
-$(ObjDir)/%.ll: %.c $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMGCC)
+$(ObjDir)/%.ll: %.c $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCC)
 	$(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)"
 	$(BCCompile.C) $< -o $@ -S -emit-llvm
 
@@ -1949,25 +1964,25 @@ uninstall-local::
 else
 install-local::
 	$(Echo) Installing include files
-	$(Verb) $(MKDIR) $(PROJ_includedir)
+	$(Verb) $(MKDIR) $(DESTDIR)$(PROJ_includedir)
 	$(Verb) if test -d "$(PROJ_SRC_ROOT)/include" ; then \
 	  cd $(PROJ_SRC_ROOT)/include && \
 	  for  hdr in `find . -type f '!' '(' -name '*~' \
 	      -o -name '.#*' -o -name '*.in' ')' -print | grep -v CVS | \
 	      grep -v .svn` ; do \
-	    instdir=`dirname "$(PROJ_includedir)/$$hdr"` ; \
+	    instdir=`dirname "$(DESTDIR)$(PROJ_includedir)/$$hdr"` ; \
 	    if test \! -d "$$instdir" ; then \
 	      $(EchoCmd) Making install directory $$instdir ; \
 	      $(MKDIR) $$instdir ;\
 	    fi ; \
-	    $(DataInstall) $$hdr $(PROJ_includedir)/$$hdr ; \
+	    $(DataInstall) $$hdr $(DESTDIR)$(PROJ_includedir)/$$hdr ; \
 	  done ; \
 	fi
 ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
 	$(Verb) if test -d "$(PROJ_OBJ_ROOT)/include" ; then \
 	  cd $(PROJ_OBJ_ROOT)/include && \
 	  for hdr in `find . -type f -print | grep -v CVS` ; do \
-	    $(DataInstall) $$hdr $(PROJ_includedir)/$$hdr ; \
+	    $(DataInstall) $$hdr $(DESTDIR)$(PROJ_includedir)/$$hdr ; \
 	  done ; \
 	fi
 endif
@@ -1979,10 +1994,10 @@ uninstall-local::
 	    $(RM) -f `find . -path '*/Internal' -prune -o '(' -type f \
 	      '!' '(' -name '*~' -o -name '.#*' \
         -o -name '*.in' ')' -print ')' | \
-        grep -v CVS | sed 's#^#$(PROJ_includedir)/#'` ; \
+        grep -v CVS | sed 's#^#$(DESTDIR)$(PROJ_includedir)/#'` ; \
 	  cd $(PROJ_SRC_ROOT)/include && \
 	    $(RM) -f `find . -path '*/Internal' -prune -o '(' -type f -name '*.in' \
-      -print ')' | sed 's#\.in$$##;s#^#$(PROJ_includedir)/#'` ; \
+      -print ')' | sed 's#\.in$$##;s#^#$(DESTDIR)$(PROJ_includedir)/#'` ; \
 	fi
 endif
 endif
diff --git a/libclamav/c++/llvm/README.txt b/libclamav/c++/llvm/README.txt
index 7388752..8b118db 100644
--- a/libclamav/c++/llvm/README.txt
+++ b/libclamav/c++/llvm/README.txt
@@ -10,3 +10,6 @@ the license agreement found in LICENSE.txt.
 
 Please see the HTML documentation provided in docs/index.html for further
 assistance with LLVM.
+
+If you're writing a package for LLVM, see docs/Packaging.html for our
+suggestions.
\ No newline at end of file
diff --git a/libclamav/c++/llvm/autoconf/ExportMap.map b/libclamav/c++/llvm/autoconf/ExportMap.map
index 43e310e..17b185f 100644
--- a/libclamav/c++/llvm/autoconf/ExportMap.map
+++ b/libclamav/c++/llvm/autoconf/ExportMap.map
@@ -1,4 +1,7 @@
 {
 	global: main;
+		__progname;
+		environ;
+
 	local: *;
 };
diff --git a/libclamav/c++/llvm/autoconf/configure.ac b/libclamav/c++/llvm/autoconf/configure.ac
index df47343..05f59d9 100644
--- a/libclamav/c++/llvm/autoconf/configure.ac
+++ b/libclamav/c++/llvm/autoconf/configure.ac
@@ -80,6 +80,7 @@ do
       llvm-tv)      AC_CONFIG_SUBDIRS([projects/llvm-tv])   ;;
       llvm-poolalloc) AC_CONFIG_SUBDIRS([projects/llvm-poolalloc]) ;;
       poolalloc)    AC_CONFIG_SUBDIRS([projects/poolalloc]) ;;
+      safecode)     AC_CONFIG_SUBDIRS([projects/safecode]) ;;
       llvm-kernel)  AC_CONFIG_SUBDIRS([projects/llvm-kernel]) ;;
       *)
         AC_MSG_WARN([Unknown project (${i}) won't be configured automatically])
@@ -184,7 +185,7 @@ AC_CACHE_CHECK([type of operating system we're going to host on],
     llvm_cv_link_all_option="-Wl,--whole-archive"
     llvm_cv_no_link_all_option="-Wl,--no-whole-archive"
     llvm_cv_os_type="Haiku"
-    llvm_cv_platform_type="Unix" ;;  
+    llvm_cv_platform_type="Unix" ;;
   *-unknown-eabi*)
     llvm_cv_link_all_option="-Wl,--whole-archive"
     llvm_cv_no_link_all_option="-Wl,--no-whole-archive"
@@ -236,7 +237,7 @@ AC_CACHE_CHECK([type of operating system we're going to target],
   *-*-mingw*)
     llvm_cv_target_os_type="MingW" ;;
   *-*-haiku*)
-    llvm_cv_target_os_type="Haiku" ;;  
+    llvm_cv_target_os_type="Haiku" ;;
   *-unknown-eabi*)
     llvm_cv_target_os_type="Freestanding" ;;
   *)
@@ -291,6 +292,7 @@ AC_CACHE_CHECK([target architecture],[llvm_cv_target_arch],
   msp430-*)               llvm_cv_target_arch="MSP430" ;;
   s390x-*)                llvm_cv_target_arch="SystemZ" ;;
   bfin-*)                 llvm_cv_target_arch="Blackfin" ;;
+  mblaze-*)               llvm_cv_target_arch="MBlaze" ;;
   *)                      llvm_cv_target_arch="Unknown" ;;
 esac])
 
@@ -427,6 +429,7 @@ else
     MSP430)      AC_SUBST(TARGET_HAS_JIT,0) ;;
     SystemZ)     AC_SUBST(TARGET_HAS_JIT,0) ;;
     Blackfin)    AC_SUBST(TARGET_HAS_JIT,0) ;;
+    MBlaze)      AC_SUBST(TARGET_HAS_JIT,0) ;;
     *)           AC_SUBST(TARGET_HAS_JIT,0) ;;
   esac
 fi
@@ -470,6 +473,18 @@ esac
 AC_DEFINE_UNQUOTED([ENABLE_PIC],$ENABLE_PIC,
                    [Define if position independent code is enabled])
 
+dnl Allow building a shared library and linking tools against it.
+AC_ARG_ENABLE(shared,
+  AS_HELP_STRING([--enable-shared],
+                 [Build a shared library and link tools against it (default is NO)]),,
+                 enableval=default)
+case "$enableval" in
+  yes) AC_SUBST(ENABLE_SHARED,[1]) ;;
+  no)  AC_SUBST(ENABLE_SHARED,[0]) ;;
+  default) AC_SUBST(ENABLE_SHARED,[0]) ;;
+  *) AC_MSG_ERROR([Invalid setting for --enable-shared. Use "yes" or "no"]) ;;
+esac
+
 dnl Allow specific targets to be specified for building (or not)
 TARGETS_TO_BUILD=""
 AC_ARG_ENABLE([targets],AS_HELP_STRING([--enable-targets],
@@ -481,7 +496,7 @@ if test "$enableval" = host-only ; then
   enableval=host
 fi
 case "$enableval" in
-  all) TARGETS_TO_BUILD="X86 Sparc PowerPC Alpha ARM Mips CellSPU PIC16 XCore MSP430 SystemZ Blackfin CBackend MSIL CppBackend" ;;
+  all) TARGETS_TO_BUILD="X86 Sparc PowerPC Alpha ARM Mips CellSPU PIC16 XCore MSP430 SystemZ Blackfin CBackend MSIL CppBackend MBlaze" ;;
   *)for a_target in `echo $enableval|sed -e 's/,/ /g' ` ; do
       case "$a_target" in
         x86)      TARGETS_TO_BUILD="X86 $TARGETS_TO_BUILD" ;;
@@ -500,6 +515,7 @@ case "$enableval" in
         cbe)      TARGETS_TO_BUILD="CBackend $TARGETS_TO_BUILD" ;;
         msil)     TARGETS_TO_BUILD="MSIL $TARGETS_TO_BUILD" ;;
         cpp)      TARGETS_TO_BUILD="CppBackend $TARGETS_TO_BUILD" ;;
+        mblaze)   TARGETS_TO_BUILD="MBlaze $TARGETS_TO_BUILD" ;;
         host) case "$llvm_cv_target_arch" in
             x86)         TARGETS_TO_BUILD="X86 $TARGETS_TO_BUILD" ;;
             x86_64)      TARGETS_TO_BUILD="X86 $TARGETS_TO_BUILD" ;;
@@ -508,6 +524,7 @@ case "$enableval" in
             Alpha)       TARGETS_TO_BUILD="Alpha $TARGETS_TO_BUILD" ;;
             ARM)         TARGETS_TO_BUILD="ARM $TARGETS_TO_BUILD" ;;
             Mips)        TARGETS_TO_BUILD="Mips $TARGETS_TO_BUILD" ;;
+            MBlaze)      TARGETS_TO_BUILD="MBlaze $TARGETS_TO_BUILD" ;;
             CellSPU|SPU) TARGETS_TO_BUILD="CellSPU $TARGETS_TO_BUILD" ;;
             PIC16)       TARGETS_TO_BUILD="PIC16 $TARGETS_TO_BUILD" ;;
             XCore)       TARGETS_TO_BUILD="XCore $TARGETS_TO_BUILD" ;;
@@ -612,6 +629,56 @@ if test -n "$LLVMGXX" && test -z "$LLVMGCC"; then
    AC_MSG_ERROR([Invalid llvm-gcc. Use --with-llvmgcc when --with-llvmgxx is used]);
 fi
 
+dnl Allow a specific Clang compiler to be used with this LLVM config.
+AC_ARG_WITH(clang,
+  AS_HELP_STRING([--with-clang],
+    [Specify location of clang compiler (default is --with-built-clang)]),
+    [],[with_clang=default])
+
+dnl Enable use of the built Clang.
+AC_ARG_WITH(built-clang,
+  AS_HELP_STRING([--with-built-clang],
+    [Use the compiled Clang as the LLVM compiler (default=check)]),
+    [],[with_built_clang=check])
+
+dnl Select the Clang compiler option.
+dnl
+dnl If --with-clang is given, always honor that; otherwise honor
+dnl --with-built-clang, or check if we have the clang sources.
+AC_MSG_CHECKING([clang compiler])
+WITH_CLANGPATH=""
+WITH_BUILT_CLANG=0
+if test "$with_clang" != "default"; then
+   WITH_CLANGPATH="$with_clang"
+   if ! test -x "$WITH_CLANGPATH"; then
+     AC_MSG_ERROR([invalid --with-clang, path does not specify an executable])
+   fi
+elif test "$with_built_clang" = "yes"; then
+   WITH_BUILT_CLANG=1
+elif test "$with_built_clang" = "no"; then
+   WITH_BUILT_CLANG=0
+else
+   if test "$with_built_clang" != "check"; then
+      AC_MSG_ERROR([invalid value for --with-built-clang.])
+   fi
+
+   if test -f ${srcdir}/tools/clang/README.txt; then
+     WITH_BUILT_CLANG=1
+   fi
+fi
+
+if ! test -z "$WITH_CLANGPATH"; then
+   AC_MSG_RESULT([$WITH_CLANGPATH])
+   WITH_CLANGXXPATH=`"$WITH_CLANGPATH" --print-prog-name=clang++`
+elif test "$WITH_BUILT_CLANG" = "1"; then
+   AC_MSG_RESULT([built])
+else
+   AC_MSG_RESULT([none])
+fi
+AC_SUBST(CLANGPATH,$WITH_CLANGPATH)
+AC_SUBST(CLANGXXPATH,$WITH_CLANGXXPATH)
+AC_SUBST(ENABLE_BUILT_CLANG,$WITH_BUILT_CLANG)
+
 dnl Override the option to use for optimized builds.
 AC_ARG_WITH(optimize-option,
   AS_HELP_STRING([--with-optimize-option],
@@ -947,6 +1014,29 @@ else
   AC_SUBST(LLVMGXXCOMMAND,$LLVMGXXCOMMAND)
 fi
 
+dnl Select the LLVM capable compiler to use, we default to using llvm-gcc if
+dnl found, otherwise clang if available.
+AC_ARG_WITH(llvmcc,
+  AS_HELP_STRING([--with-llvmcc=<name>],
+    [Choose the LLVM capable compiler to use (llvm-gcc, clang, or none; default=check)]),
+    [],[with_llvmcc=check])
+AC_MSG_CHECKING([LLVM capable compiler])
+if test "$with_llvmcc" != "check"; then
+   if (test "$with_llvmcc" != "llvm-gcc" &&
+       test "$with_llvmcc" != "clang" &&
+       test "$with_llvmcc" != "none"); then
+      AC_MSG_ERROR([invalid value for --with-llvmcc, expected 'llvm-gcc', 'clang', or 'none'.])
+   fi
+   WITH_LLVMCC="$with_llvmcc"
+elif test -n "$LLVMGCC"; then
+   WITH_LLVMCC=llvm-gcc
+elif test -n "$WITH_CLANGPATH" || test "$WITH_BUILT_CLANG" -ne "0"; then
+   WITH_LLVMCC=clang
+else
+   WITH_LLVMCC=none
+fi
+AC_MSG_RESULT([$WITH_LLVMCC])
+AC_SUBST(LLVMCC_OPTION,$WITH_LLVMCC)
 
 AC_MSG_CHECKING([tool compatibility])
 
@@ -995,7 +1085,7 @@ fi
 dnl Tool compatibility is okay if we make it here.
 AC_MSG_RESULT([ok])
 
-dnl Check optional compiler flags. 
+dnl Check optional compiler flags.
 AC_MSG_CHECKING([optional compiler flags])
 CXX_FLAG_CHECK(NO_VARIADIC_MACROS, [-Wno-variadic-macros])
 CXX_FLAG_CHECK(NO_MISSING_FIELD_INITIALIZERS, [-Wno-missing-field-initializers])
@@ -1251,12 +1341,6 @@ if test "$llvm_cv_llvmgcc_sanity" = "yes" ; then
   AC_SUBST(LLVMCC1PLUS,$llvmcc1pluspath)
   llvmgccdir=`echo "$llvmcc1path" | sed 's,/libexec/.*,,'`
   AC_SUBST(LLVMGCCDIR,$llvmgccdir)
-  llvmgcclibexec=`echo "$llvmcc1path" | sed 's,/cc1,,'`
-  AC_SUBST(LLVMGCCLIBEXEC,$llvmgcclibexec)
-  llvmgccversion=[`"$LLVMGCC" -dumpversion 2>&1 | sed 's/^\([0-9.]*\).*/\1/'`]
-  llvmgccmajvers=[`echo $llvmgccversion | sed 's/^\([0-9]\).*/\1/'`]
-  AC_SUBST(LLVMGCC_VERSION,$llvmgccversion)
-  AC_SUBST(LLVMGCC_MAJVERS,$llvmgccmajvers)
   llvmgcclangs=[`"$LLVMGCC" -v --help 2>&1 | grep '^Configured with:' | sed 's/^.*--enable-languages=\([^ ]*\).*/\1/'`]
   AC_SUBST(LLVMGCC_LANGS,$llvmgcclangs)
   AC_MSG_RESULT([ok])
@@ -1266,6 +1350,10 @@ dnl Propagate the shared library extension that the libltdl checks did to
 dnl the Makefiles so we can use it there too
 AC_SUBST(SHLIBEXT,$libltdl_cv_shlibext)
 
+dnl Propagate the run-time library path variable that the libltdl
+dnl checks found to the Makefiles so we can use it there too
+AC_SUBST(SHLIBPATH_VAR,$libltdl_cv_shlibpath_var)
+
 # Translate the various configuration directories and other basic
 # information into substitutions that will end up in Makefile.config.in
 # that these configured values can be used by the makefiles
@@ -1276,7 +1364,7 @@ eval LLVM_PREFIX="${prefix}";
 eval LLVM_BINDIR="${prefix}/bin";
 eval LLVM_LIBDIR="${prefix}/lib";
 eval LLVM_DATADIR="${prefix}/share/llvm";
-eval LLVM_DOCSDIR="${prefix}/docs/llvm";
+eval LLVM_DOCSDIR="${prefix}/share/doc/llvm";
 eval LLVM_ETCDIR="${prefix}/etc/llvm";
 eval LLVM_INCLUDEDIR="${prefix}/include";
 eval LLVM_INFODIR="${prefix}/info";
diff --git a/libclamav/c++/llvm/autoconf/m4/huge_val.m4 b/libclamav/c++/llvm/autoconf/m4/huge_val.m4
index fd94c11..5fffbfc 100644
--- a/libclamav/c++/llvm/autoconf/m4/huge_val.m4
+++ b/libclamav/c++/llvm/autoconf/m4/huge_val.m4
@@ -5,6 +5,7 @@
 AC_DEFUN([AC_HUGE_VAL_CHECK],[
   AC_CACHE_CHECK([for HUGE_VAL sanity], [ac_cv_huge_val_sanity],[
     AC_LANG_PUSH([C++])
+    ac_save_CXXFLAGS=$CXXFLAGS
     CXXFLAGS=-pedantic
     AC_RUN_IFELSE(
       AC_LANG_PROGRAM(
@@ -12,6 +13,7 @@ AC_DEFUN([AC_HUGE_VAL_CHECK],[
         [double x = HUGE_VAL; return x != x; ]),
       [ac_cv_huge_val_sanity=yes],[ac_cv_huge_val_sanity=no],
       [ac_cv_huge_val_sanity=yes])
+    CXXFLAGS=$ac_save_CXXFLAGS
     AC_LANG_POP([C++])
     ])
   AC_SUBST(HUGE_VAL_SANITY,$ac_cv_huge_val_sanity)
diff --git a/libclamav/c++/llvm/configure b/libclamav/c++/llvm/configure
index e07043a..e1e5dab 100755
--- a/libclamav/c++/llvm/configure
+++ b/libclamav/c++/llvm/configure
@@ -616,11 +616,9 @@ LLVM_DATADIR
 LLVM_LIBDIR
 LLVM_BINDIR
 LLVM_PREFIX
+SHLIBPATH_VAR
 SHLIBEXT
 LLVMGCC_LANGS
-LLVMGCC_MAJVERS
-LLVMGCC_VERSION
-LLVMGCCLIBEXEC
 LLVMGCCDIR
 LLVMCC1PLUS
 LLVMCC1
@@ -631,6 +629,7 @@ USE_OPROFILE
 USE_UDIS86
 NO_MISSING_FIELD_INITIALIZERS
 NO_VARIADIC_MACROS
+LLVMCC_OPTION
 LLVMGXX
 LLVMGCC
 LLVMGXXCOMMAND
@@ -689,12 +688,16 @@ ENABLE_LLVMC_DYNAMIC
 BINUTILS_INCDIR
 EXTRA_OPTIONS
 OPTIMIZE_OPTION
+ENABLE_BUILT_CLANG
+CLANGXXPATH
+CLANGPATH
 ENABLE_CBE_PRINTF_A
 LLVM_ENUM_DISASSEMBLERS
 LLVM_ENUM_ASM_PARSERS
 LLVM_ENUM_ASM_PRINTERS
 LLVM_ENUM_TARGETS
 TARGETS_TO_BUILD
+ENABLE_SHARED
 ENABLE_PIC
 ENABLE_THREADS
 ENABLE_DOXYGEN
@@ -796,11 +799,14 @@ enable_jit
 enable_doxygen
 enable_threads
 enable_pic
+enable_shared
 enable_targets
 enable_cbe_printf_a
 with_llvmgccdir
 with_llvmgcc
 with_llvmgxx
+with_clang
+with_built_clang
 with_optimize_option
 with_extra_options
 enable_bindings
@@ -816,6 +822,7 @@ enable_llvmc_dynamic
 enable_llvmc_dynamic_plugins
 with_tclinclude
 enable_ltdl_install
+with_llvmcc
 with_udis86
 with_oprofile
 '
@@ -842,6 +849,7 @@ projects/llvm-java
 projects/llvm-tv
 projects/llvm-poolalloc
 projects/poolalloc
+projects/safecode
 projects/llvm-kernel'
 
 # Initialize some variables set by options.
@@ -1473,6 +1481,8 @@ Optional Features:
   --enable-threads        Use threads if available (default is YES)
   --enable-pic            Build LLVM with Position Independent Code (default
                           is YES)
+  --enable-shared         Build a shared library and link tools against it
+                          (default is NO)
   --enable-targets        Build specific host targets: all or
                           target1,target2,... Valid targets are: host, x86,
                           x86_64, sparc, powerpc, alpha, arm, mips, spu,
@@ -1498,6 +1508,10 @@ Optional Packages:
                           searches PATH)
   --with-llvmgxx          Specify location of llvm-g++ driver (default
                           searches PATH)
+  --with-clang            Specify location of clang compiler (default is
+                          --with-built-clang)
+  --with-built-clang      Use the compiled Clang as the LLVM compiler
+                          (default=check)
   --with-optimize-option  Select the compiler options to use for optimized
                           builds
   --with-extra-options    Specify additional options to compile LLVM with
@@ -1514,6 +1528,8 @@ Optional Packages:
   --with-binutils-include Specify path to binutils/include/ containing
                           plugin-api.h file for gold plugin.
   --with-tclinclude       directory where tcl headers are
+  --with-llvmcc=<name>    Choose the LLVM capable compiler to use (llvm-gcc,
+                          clang, or none; default=check)
   --with-udis86=<path>    Use udis86 external x86 disassembler library
   --with-oprofile=<prefix>
                           Tell OProfile >= 0.9.4 how to symbolize JIT output
@@ -2523,6 +2539,8 @@ subdirs="$subdirs projects/sample"
  ;;
       poolalloc)    subdirs="$subdirs projects/poolalloc"
  ;;
+      safecode)     subdirs="$subdirs projects/safecode"
+ ;;
       llvm-kernel)  subdirs="$subdirs projects/llvm-kernel"
  ;;
       *)
@@ -2853,6 +2871,7 @@ else
   msp430-*)               llvm_cv_target_arch="MSP430" ;;
   s390x-*)                llvm_cv_target_arch="SystemZ" ;;
   bfin-*)                 llvm_cv_target_arch="Blackfin" ;;
+  mblaze-*)               llvm_cv_target_arch="MBlaze" ;;
   *)                      llvm_cv_target_arch="Unknown" ;;
 esac
 fi
@@ -4746,6 +4765,8 @@ else
  ;;
     Blackfin)    TARGET_HAS_JIT=0
  ;;
+    MBlaze)      TARGET_HAS_JIT=0
+ ;;
     *)           TARGET_HAS_JIT=0
  ;;
   esac
@@ -4812,6 +4833,23 @@ cat >>confdefs.h <<_ACEOF
 _ACEOF
 
 
+# Check whether --enable-shared was given.
+if test "${enable_shared+set}" = set; then :
+  enableval=$enable_shared;
+else
+  enableval=default
+fi
+
+case "$enableval" in
+  yes) ENABLE_SHARED=1
+ ;;
+  no)  ENABLE_SHARED=0
+ ;;
+  default) ENABLE_SHARED=0
+ ;;
+  *) as_fn_error "Invalid setting for --enable-shared. Use \"yes\" or \"no\"" "$LINENO" 5 ;;
+esac
+
 TARGETS_TO_BUILD=""
 # Check whether --enable-targets was given.
 if test "${enable_targets+set}" = set; then :
@@ -4824,7 +4862,7 @@ if test "$enableval" = host-only ; then
   enableval=host
 fi
 case "$enableval" in
-  all) TARGETS_TO_BUILD="X86 Sparc PowerPC Alpha ARM Mips CellSPU PIC16 XCore MSP430 SystemZ Blackfin CBackend MSIL CppBackend" ;;
+  all) TARGETS_TO_BUILD="X86 Sparc PowerPC Alpha ARM Mips CellSPU PIC16 XCore MSP430 SystemZ Blackfin CBackend MSIL CppBackend MBlaze" ;;
   *)for a_target in `echo $enableval|sed -e 's/,/ /g' ` ; do
       case "$a_target" in
         x86)      TARGETS_TO_BUILD="X86 $TARGETS_TO_BUILD" ;;
@@ -4843,6 +4881,7 @@ case "$enableval" in
         cbe)      TARGETS_TO_BUILD="CBackend $TARGETS_TO_BUILD" ;;
         msil)     TARGETS_TO_BUILD="MSIL $TARGETS_TO_BUILD" ;;
         cpp)      TARGETS_TO_BUILD="CppBackend $TARGETS_TO_BUILD" ;;
+        mblaze)   TARGETS_TO_BUILD="MBlaze $TARGETS_TO_BUILD" ;;
         host) case "$llvm_cv_target_arch" in
             x86)         TARGETS_TO_BUILD="X86 $TARGETS_TO_BUILD" ;;
             x86_64)      TARGETS_TO_BUILD="X86 $TARGETS_TO_BUILD" ;;
@@ -4851,6 +4890,7 @@ case "$enableval" in
             Alpha)       TARGETS_TO_BUILD="Alpha $TARGETS_TO_BUILD" ;;
             ARM)         TARGETS_TO_BUILD="ARM $TARGETS_TO_BUILD" ;;
             Mips)        TARGETS_TO_BUILD="Mips $TARGETS_TO_BUILD" ;;
+            MBlaze)      TARGETS_TO_BUILD="MBlaze $TARGETS_TO_BUILD" ;;
             CellSPU|SPU) TARGETS_TO_BUILD="CellSPU $TARGETS_TO_BUILD" ;;
             PIC16)       TARGETS_TO_BUILD="PIC16 $TARGETS_TO_BUILD" ;;
             XCore)       TARGETS_TO_BUILD="XCore $TARGETS_TO_BUILD" ;;
@@ -4972,6 +5012,65 @@ if test -n "$LLVMGXX" && test -z "$LLVMGCC"; then
 fi
 
 
+# Check whether --with-clang was given.
+if test "${with_clang+set}" = set; then :
+  withval=$with_clang;
+else
+  with_clang=default
+fi
+
+
+
+# Check whether --with-built-clang was given.
+if test "${with_built_clang+set}" = set; then :
+  withval=$with_built_clang;
+else
+  with_built_clang=check
+fi
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking clang compiler" >&5
+$as_echo_n "checking clang compiler... " >&6; }
+WITH_CLANGPATH=""
+WITH_BUILT_CLANG=0
+if test "$with_clang" != "default"; then
+   WITH_CLANGPATH="$with_clang"
+   if ! test -x "$WITH_CLANGPATH"; then
+     as_fn_error "invalid --with-clang, path does not specify an executable" "$LINENO" 5
+   fi
+elif test "$with_built_clang" = "yes"; then
+   WITH_BUILT_CLANG=1
+elif test "$with_built_clang" = "no"; then
+   WITH_BUILT_CLANG=0
+else
+   if test "$with_built_clang" != "check"; then
+      as_fn_error "invalid value for --with-built-clang." "$LINENO" 5
+   fi
+
+   if test -f ${srcdir}/tools/clang/README.txt; then
+     WITH_BUILT_CLANG=1
+   fi
+fi
+
+if ! test -z "$WITH_CLANGPATH"; then
+   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $WITH_CLANGPATH" >&5
+$as_echo "$WITH_CLANGPATH" >&6; }
+   WITH_CLANGXXPATH=`"$WITH_CLANGPATH" --print-prog-name=clang++`
+elif test "$WITH_BUILT_CLANG" = "1"; then
+   { $as_echo "$as_me:${as_lineno-$LINENO}: result: built" >&5
+$as_echo "built" >&6; }
+else
+   { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5
+$as_echo "none" >&6; }
+fi
+CLANGPATH=$WITH_CLANGPATH
+
+CLANGXXPATH=$WITH_CLANGXXPATH
+
+ENABLE_BUILT_CLANG=$WITH_BUILT_CLANG
+
+
+
 # Check whether --with-optimize-option was given.
 if test "${with_optimize_option+set}" = set; then :
   withval=$with_optimize_option;
@@ -9445,7 +9544,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 9448 "configure"
+#line 9547 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -9915,6 +10014,34 @@ else
 fi
 
 
+# Check whether --with-llvmcc was given.
+if test "${with_llvmcc+set}" = set; then :
+  withval=$with_llvmcc;
+else
+  with_llvmcc=check
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking LLVM capable compiler" >&5
+$as_echo_n "checking LLVM capable compiler... " >&6; }
+if test "$with_llvmcc" != "check"; then
+   if (test "$with_llvmcc" != "llvm-gcc" &&
+       test "$with_llvmcc" != "clang" &&
+       test "$with_llvmcc" != "none"); then
+      as_fn_error "invalid value for --with-llvmcc, expected 'llvm-gcc', 'clang', or 'none'." "$LINENO" 5
+   fi
+   WITH_LLVMCC="$with_llvmcc"
+elif test -n "$LLVMGCC"; then
+   WITH_LLVMCC=llvm-gcc
+elif test -n "$WITH_CLANGPATH" || test "$WITH_BUILT_CLANG" -ne "0"; then
+   WITH_LLVMCC=clang
+else
+   WITH_LLVMCC=none
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $WITH_LLVMCC" >&5
+$as_echo "$WITH_LLVMCC" >&6; }
+LLVMCC_OPTION=$WITH_LLVMCC
+
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking tool compatibility" >&5
 $as_echo_n "checking tool compatibility... " >&6; }
 
@@ -11298,6 +11425,7 @@ ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
 ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 
+    ac_save_CXXFLAGS=$CXXFLAGS
     CXXFLAGS=-pedantic
     if test "$cross_compiling" = yes; then :
   ac_cv_huge_val_sanity=yes
@@ -11322,6 +11450,7 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
   conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
+    CXXFLAGS=$ac_save_CXXFLAGS
     ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -12384,15 +12513,6 @@ $as_echo_n "checking llvm-gcc component support... " >&6; }
   llvmgccdir=`echo "$llvmcc1path" | sed 's,/libexec/.*,,'`
   LLVMGCCDIR=$llvmgccdir
 
-  llvmgcclibexec=`echo "$llvmcc1path" | sed 's,/cc1,,'`
-  LLVMGCCLIBEXEC=$llvmgcclibexec
-
-  llvmgccversion=`"$LLVMGCC" -dumpversion 2>&1 | sed 's/^\([0-9.]*\).*/\1/'`
-  llvmgccmajvers=`echo $llvmgccversion | sed 's/^\([0-9]\).*/\1/'`
-  LLVMGCC_VERSION=$llvmgccversion
-
-  LLVMGCC_MAJVERS=$llvmgccmajvers
-
   llvmgcclangs=`"$LLVMGCC" -v --help 2>&1 | grep '^Configured with:' | sed 's/^.*--enable-languages=\([^ ]*\).*/\1/'`
   LLVMGCC_LANGS=$llvmgcclangs
 
@@ -12403,6 +12523,9 @@ fi
 SHLIBEXT=$libltdl_cv_shlibext
 
 
+SHLIBPATH_VAR=$libltdl_cv_shlibpath_var
+
+
 # Translate the various configuration directories and other basic
 # information into substitutions that will end up in Makefile.config.in
 # that these configured values can be used by the makefiles
@@ -12413,7 +12536,7 @@ eval LLVM_PREFIX="${prefix}";
 eval LLVM_BINDIR="${prefix}/bin";
 eval LLVM_LIBDIR="${prefix}/lib";
 eval LLVM_DATADIR="${prefix}/share/llvm";
-eval LLVM_DOCSDIR="${prefix}/docs/llvm";
+eval LLVM_DOCSDIR="${prefix}/share/doc/llvm";
 eval LLVM_ETCDIR="${prefix}/etc/llvm";
 eval LLVM_INCLUDEDIR="${prefix}/include";
 eval LLVM_INFODIR="${prefix}/info";
diff --git a/libclamav/c++/llvm/docs/AliasAnalysis.html b/libclamav/c++/llvm/docs/AliasAnalysis.html
deleted file mode 100644
index ebf6386..0000000
--- a/libclamav/c++/llvm/docs/AliasAnalysis.html
+++ /dev/null
@@ -1,956 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-                      "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-  <title>LLVM Alias Analysis Infrastructure</title>
-  <link rel="stylesheet" href="llvm.css" type="text/css">
-</head>
-<body>
-
-<div class="doc_title">
-  LLVM Alias Analysis Infrastructure
-</div>
-
-<ol>
-  <li><a href="#introduction">Introduction</a></li>
-
-  <li><a href="#overview"><tt>AliasAnalysis</tt> Class Overview</a>
-    <ul>
-    <li><a href="#pointers">Representation of Pointers</a></li>
-    <li><a href="#alias">The <tt>alias</tt> method</a></li>
-    <li><a href="#ModRefInfo">The <tt>getModRefInfo</tt> methods</a></li>
-    <li><a href="#OtherItfs">Other useful <tt>AliasAnalysis</tt> methods</a></li>
-    </ul>
-  </li>
-
-  <li><a href="#writingnew">Writing a new <tt>AliasAnalysis</tt> Implementation</a>
-    <ul>
-    <li><a href="#passsubclasses">Different Pass styles</a></li>
-    <li><a href="#requiredcalls">Required initialization calls</a></li>
-    <li><a href="#interfaces">Interfaces which may be specified</a></li>
-    <li><a href="#chaining"><tt>AliasAnalysis</tt> chaining behavior</a></li>
-    <li><a href="#updating">Updating analysis results for transformations</a></li>
-    <li><a href="#implefficiency">Efficiency Issues</a></li>
-    </ul>
-  </li>
-
-  <li><a href="#using">Using alias analysis results</a>
-    <ul>
-    <li><a href="#memdep">Using the <tt>MemoryDependenceAnalysis</tt> Pass</a></li>
-    <li><a href="#ast">Using the <tt>AliasSetTracker</tt> class</a></li>
-    <li><a href="#direct">Using the <tt>AliasAnalysis</tt> interface directly</a></li>
-    </ul>
-  </li>
-
-  <li><a href="#exist">Existing alias analysis implementations and clients</a>
-    <ul>
-    <li><a href="#impls">Available <tt>AliasAnalysis</tt> implementations</a></li>
-    <li><a href="#aliasanalysis-xforms">Alias analysis driven transformations</a></li>
-    <li><a href="#aliasanalysis-debug">Clients for debugging and evaluation of
-    implementations</a></li>
-    </ul>
-  </li>
-  <li><a href="#memdep">Memory Dependence Analysis</a></li>
-</ol>
-
-<div class="doc_author">
-  <p>Written by <a href="mailto:sabre at nondot.org">Chris Lattner</a></p>
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="introduction">Introduction</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>Alias Analysis (aka Pointer Analysis) is a class of techniques which attempt
-to determine whether or not two pointers ever can point to the same object in
-memory.  There are many different algorithms for alias analysis and many
-different ways of classifying them: flow-sensitive vs flow-insensitive,
-context-sensitive vs context-insensitive, field-sensitive vs field-insensitive,
-unification-based vs subset-based, etc.  Traditionally, alias analyses respond
-to a query with a <a href="#MustMayNo">Must, May, or No</a> alias response,
-indicating that two pointers always point to the same object, might point to the
-same object, or are known to never point to the same object.</p>
-
-<p>The LLVM <a
-href="http://llvm.org/doxygen/classllvm_1_1AliasAnalysis.html"><tt>AliasAnalysis</tt></a>
-class is the primary interface used by clients and implementations of alias
-analyses in the LLVM system.  This class is the common interface between clients
-of alias analysis information and the implementations providing it, and is
-designed to support a wide range of implementations and clients (but currently
-all clients are assumed to be flow-insensitive).  In addition to simple alias
-analysis information, this class exposes Mod/Ref information from those
-implementations which can provide it, allowing for powerful analyses and
-transformations to work well together.</p>
-
-<p>This document contains information necessary to successfully implement this
-interface, use it, and to test both sides.  It also explains some of the finer
-points about what exactly results mean.  If you feel that something is unclear
-or should be added, please <a href="mailto:sabre at nondot.org">let me
-know</a>.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="overview"><tt>AliasAnalysis</tt> Class Overview</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>The <a
-href="http://llvm.org/doxygen/classllvm_1_1AliasAnalysis.html"><tt>AliasAnalysis</tt></a>
-class defines the interface that the various alias analysis implementations
-should support.  This class exports two important enums: <tt>AliasResult</tt>
-and <tt>ModRefResult</tt> which represent the result of an alias query or a
-mod/ref query, respectively.</p>
-
-<p>The <tt>AliasAnalysis</tt> interface exposes information about memory,
-represented in several different ways.  In particular, memory objects are
-represented as a starting address and size, and function calls are represented
-as the actual <tt>call</tt> or <tt>invoke</tt> instructions that performs the
-call.  The <tt>AliasAnalysis</tt> interface also exposes some helper methods
-which allow you to get mod/ref information for arbitrary instructions.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="pointers">Representation of Pointers</a>
-</div>
-
-<div class="doc_text">
-
-<p>Most importantly, the <tt>AliasAnalysis</tt> class provides several methods
-which are used to query whether or not two memory objects alias, whether
-function calls can modify or read a memory object, etc.  For all of these
-queries, memory objects are represented as a pair of their starting address (a
-symbolic LLVM <tt>Value*</tt>) and a static size.</p>
-
-<p>Representing memory objects as a starting address and a size is critically
-important for correct Alias Analyses.  For example, consider this (silly, but
-possible) C code:</p>
-
-<div class="doc_code">
-<pre>
-int i;
-char C[2];
-char A[10]; 
-/* ... */
-for (i = 0; i != 10; ++i) {
-  C[0] = A[i];          /* One byte store */
-  C[1] = A[9-i];        /* One byte store */
-}
-</pre>
-</div>
-
-<p>In this case, the <tt>basicaa</tt> pass will disambiguate the stores to
-<tt>C[0]</tt> and <tt>C[1]</tt> because they are accesses to two distinct
-locations one byte apart, and the accesses are each one byte.  In this case, the
-LICM pass can use store motion to remove the stores from the loop.  In
-constrast, the following code:</p>
-
-<div class="doc_code">
-<pre>
-int i;
-char C[2];
-char A[10]; 
-/* ... */
-for (i = 0; i != 10; ++i) {
-  ((short*)C)[0] = A[i];  /* Two byte store! */
-  C[1] = A[9-i];          /* One byte store */
-}
-</pre>
-</div>
-
-<p>In this case, the two stores to C do alias each other, because the access to
-the <tt>&amp;C[0]</tt> element is a two byte access.  If size information wasn't
-available in the query, even the first case would have to conservatively assume
-that the accesses alias.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="alias">The <tt>alias</tt> method</a>
-</div>
-  
-<div class="doc_text">
-The <tt>alias</tt> method is the primary interface used to determine whether or
-not two memory objects alias each other.  It takes two memory objects as input
-and returns MustAlias, MayAlias, or NoAlias as appropriate.
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="MustMayNo">Must, May, and No Alias Responses</a>
-</div>
-
-<div class="doc_text">
-<p>The NoAlias response is used when the two pointers refer to distinct objects,
-regardless of whether the pointers compare equal.  For example, freed pointers
-don't alias any pointers that were allocated afterwards.  As a degenerate case,
-pointers returned by malloc(0) have no bytes for an object, and are considered
-NoAlias even when malloc returns the same pointer.  The same rule applies to
-NULL pointers.</p>
-
-<p>The MayAlias response is used whenever the two pointers might refer to the
-same object.  If the two memory objects overlap, but do not start at the same
-location, return MayAlias.</p>
-
-<p>The MustAlias response may only be returned if the two memory objects are
-guaranteed to always start at exactly the same location. A MustAlias response
-implies that the pointers compare equal.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="ModRefInfo">The <tt>getModRefInfo</tt> methods</a>
-</div>
-
-<div class="doc_text">
-
-<p>The <tt>getModRefInfo</tt> methods return information about whether the
-execution of an instruction can read or modify a memory location.  Mod/Ref
-information is always conservative: if an instruction <b>might</b> read or write
-a location, ModRef is returned.</p>
-
-<p>The <tt>AliasAnalysis</tt> class also provides a <tt>getModRefInfo</tt>
-method for testing dependencies between function calls.  This method takes two
-call sites (CS1 &amp; CS2), returns NoModRef if the two calls refer to disjoint
-memory locations, Ref if CS1 reads memory written by CS2, Mod if CS1 writes to
-memory read or written by CS2, or ModRef if CS1 might read or write memory
-accessed by CS2.  Note that this relation is not commutative.</p>
-
-</div>
-
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="OtherItfs">Other useful <tt>AliasAnalysis</tt> methods</a>
-</div>
-
-<div class="doc_text">
-
-<p>
-Several other tidbits of information are often collected by various alias
-analysis implementations and can be put to good use by various clients.
-</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  The <tt>pointsToConstantMemory</tt> method
-</div>
-
-<div class="doc_text">
-
-<p>The <tt>pointsToConstantMemory</tt> method returns true if and only if the
-analysis can prove that the pointer only points to unchanging memory locations
-(functions, constant global variables, and the null pointer).  This information
-can be used to refine mod/ref information: it is impossible for an unchanging
-memory location to be modified.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="simplemodref">The <tt>doesNotAccessMemory</tt> and
-  <tt>onlyReadsMemory</tt> methods</a>
-</div>
-
-<div class="doc_text">
-
-<p>These methods are used to provide very simple mod/ref information for
-function calls.  The <tt>doesNotAccessMemory</tt> method returns true for a
-function if the analysis can prove that the function never reads or writes to
-memory, or if the function only reads from constant memory.  Functions with this
-property are side-effect free and only depend on their input arguments, allowing
-them to be eliminated if they form common subexpressions or be hoisted out of
-loops.  Many common functions behave this way (e.g., <tt>sin</tt> and
-<tt>cos</tt>) but many others do not (e.g., <tt>acos</tt>, which modifies the
-<tt>errno</tt> variable).</p>
-
-<p>The <tt>onlyReadsMemory</tt> method returns true for a function if analysis
-can prove that (at most) the function only reads from non-volatile memory.
-Functions with this property are side-effect free, only depending on their input
-arguments and the state of memory when they are called.  This property allows
-calls to these functions to be eliminated and moved around, as long as there is
-no store instruction that changes the contents of memory.  Note that all
-functions that satisfy the <tt>doesNotAccessMemory</tt> method also satisfies
-<tt>onlyReadsMemory</tt>.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="writingnew">Writing a new <tt>AliasAnalysis</tt> Implementation</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>Writing a new alias analysis implementation for LLVM is quite
-straight-forward.  There are already several implementations that you can use
-for examples, and the following information should help fill in any details.
-For a examples, take a look at the <a href="#impls">various alias analysis
-implementations</a> included with LLVM.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="passsubclasses">Different Pass styles</a>
-</div>
-
-<div class="doc_text">
-
-<p>The first step to determining what type of <a
-href="WritingAnLLVMPass.html">LLVM pass</a> you need to use for your Alias
-Analysis.  As is the case with most other analyses and transformations, the
-answer should be fairly obvious from what type of problem you are trying to
-solve:</p>
-
-<ol>
-  <li>If you require interprocedural analysis, it should be a
-      <tt>Pass</tt>.</li>
-  <li>If you are a function-local analysis, subclass <tt>FunctionPass</tt>.</li>
-  <li>If you don't need to look at the program at all, subclass 
-      <tt>ImmutablePass</tt>.</li>
-</ol>
-
-<p>In addition to the pass that you subclass, you should also inherit from the
-<tt>AliasAnalysis</tt> interface, of course, and use the
-<tt>RegisterAnalysisGroup</tt> template to register as an implementation of
-<tt>AliasAnalysis</tt>.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="requiredcalls">Required initialization calls</a>
-</div>
-
-<div class="doc_text">
-
-<p>Your subclass of <tt>AliasAnalysis</tt> is required to invoke two methods on
-the <tt>AliasAnalysis</tt> base class: <tt>getAnalysisUsage</tt> and
-<tt>InitializeAliasAnalysis</tt>.  In particular, your implementation of
-<tt>getAnalysisUsage</tt> should explicitly call into the
-<tt>AliasAnalysis::getAnalysisUsage</tt> method in addition to doing any
-declaring any pass dependencies your pass has.  Thus you should have something
-like this:</p>
-
-<div class="doc_code">
-<pre>
-void getAnalysisUsage(AnalysisUsage &amp;AU) const {
-  AliasAnalysis::getAnalysisUsage(AU);
-  <i>// declare your dependencies here.</i>
-}
-</pre>
-</div>
-
-<p>Additionally, your must invoke the <tt>InitializeAliasAnalysis</tt> method
-from your analysis run method (<tt>run</tt> for a <tt>Pass</tt>,
-<tt>runOnFunction</tt> for a <tt>FunctionPass</tt>, or <tt>InitializePass</tt>
-for an <tt>ImmutablePass</tt>).  For example (as part of a <tt>Pass</tt>):</p>
-
-<div class="doc_code">
-<pre>
-bool run(Module &amp;M) {
-  InitializeAliasAnalysis(this);
-  <i>// Perform analysis here...</i>
-  return false;
-}
-</pre>
-</div>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="interfaces">Interfaces which may be specified</a>
-</div>
-
-<div class="doc_text">
-
-<p>All of the <a
-href="/doxygen/classllvm_1_1AliasAnalysis.html"><tt>AliasAnalysis</tt></a>
-virtual methods default to providing <a href="#chaining">chaining</a> to another
-alias analysis implementation, which ends up returning conservatively correct
-information (returning "May" Alias and "Mod/Ref" for alias and mod/ref queries
-respectively).  Depending on the capabilities of the analysis you are
-implementing, you just override the interfaces you can improve.</p>
-
-</div>
-
-
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="chaining"><tt>AliasAnalysis</tt> chaining behavior</a>
-</div>
-
-<div class="doc_text">
-
-<p>With only two special exceptions (the <tt><a
-href="#basic-aa">basicaa</a></tt> and <a href="#no-aa"><tt>no-aa</tt></a>
-passes) every alias analysis pass chains to another alias analysis
-implementation (for example, the user can specify "<tt>-basicaa -ds-aa
--anders-aa -licm</tt>" to get the maximum benefit from the three alias
-analyses).  The alias analysis class automatically takes care of most of this
-for methods that you don't override.  For methods that you do override, in code
-paths that return a conservative MayAlias or Mod/Ref result, simply return
-whatever the superclass computes.  For example:</p>
-
-<div class="doc_code">
-<pre>
-AliasAnalysis::AliasResult alias(const Value *V1, unsigned V1Size,
-                                 const Value *V2, unsigned V2Size) {
-  if (...)
-    return NoAlias;
-  ...
-
-  <i>// Couldn't determine a must or no-alias result.</i>
-  return AliasAnalysis::alias(V1, V1Size, V2, V2Size);
-}
-</pre>
-</div>
-
-<p>In addition to analysis queries, you must make sure to unconditionally pass
-LLVM <a href="#updating">update notification</a> methods to the superclass as
-well if you override them, which allows all alias analyses in a change to be
-updated.</p>
-
-</div>
-
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="updating">Updating analysis results for transformations</a>
-</div>
-
-<div class="doc_text">
-<p>
-Alias analysis information is initially computed for a static snapshot of the
-program, but clients will use this information to make transformations to the
-code.  All but the most trivial forms of alias analysis will need to have their
-analysis results updated to reflect the changes made by these transformations.
-</p>
-
-<p>
-The <tt>AliasAnalysis</tt> interface exposes two methods which are used to
-communicate program changes from the clients to the analysis implementations.
-Various alias analysis implementations should use these methods to ensure that
-their internal data structures are kept up-to-date as the program changes (for
-example, when an instruction is deleted), and clients of alias analysis must be
-sure to call these interfaces appropriately.
-</p>
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">The <tt>deleteValue</tt> method</div>
-
-<div class="doc_text">
-The <tt>deleteValue</tt> method is called by transformations when they remove an
-instruction or any other value from the program (including values that do not
-use pointers).  Typically alias analyses keep data structures that have entries
-for each value in the program.  When this method is called, they should remove
-any entries for the specified value, if they exist.
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">The <tt>copyValue</tt> method</div>
-
-<div class="doc_text">
-The <tt>copyValue</tt> method is used when a new value is introduced into the
-program.  There is no way to introduce a value into the program that did not
-exist before (this doesn't make sense for a safe compiler transformation), so
-this is the only way to introduce a new value.  This method indicates that the
-new value has exactly the same properties as the value being copied.
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">The <tt>replaceWithNewValue</tt> method</div>
-
-<div class="doc_text">
-This method is a simple helper method that is provided to make clients easier to
-use.  It is implemented by copying the old analysis information to the new
-value, then deleting the old value.  This method cannot be overridden by alias
-analysis implementations.
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="implefficiency">Efficiency Issues</a>
-</div>
-
-<div class="doc_text">
-
-<p>From the LLVM perspective, the only thing you need to do to provide an
-efficient alias analysis is to make sure that alias analysis <b>queries</b> are
-serviced quickly.  The actual calculation of the alias analysis results (the
-"run" method) is only performed once, but many (perhaps duplicate) queries may
-be performed.  Because of this, try to move as much computation to the run
-method as possible (within reason).</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="using">Using alias analysis results</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>There are several different ways to use alias analysis results.  In order of
-preference, these are...</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="memdep">Using the <tt>MemoryDependenceAnalysis</tt> Pass</a>
-</div>
-
-<div class="doc_text">
-
-<p>The <tt>memdep</tt> pass uses alias analysis to provide high-level dependence
-information about memory-using instructions.  This will tell you which store
-feeds into a load, for example.  It uses caching and other techniques to be
-efficient, and is used by Dead Store Elimination, GVN, and memcpy optimizations.
-</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="ast">Using the <tt>AliasSetTracker</tt> class</a>
-</div>
-
-<div class="doc_text">
-
-<p>Many transformations need information about alias <b>sets</b> that are active
-in some scope, rather than information about pairwise aliasing.  The <tt><a
-href="/doxygen/classllvm_1_1AliasSetTracker.html">AliasSetTracker</a></tt> class
-is used to efficiently build these Alias Sets from the pairwise alias analysis
-information provided by the <tt>AliasAnalysis</tt> interface.</p>
-
-<p>First you initialize the AliasSetTracker by using the "<tt>add</tt>" methods
-to add information about various potentially aliasing instructions in the scope
-you are interested in.  Once all of the alias sets are completed, your pass
-should simply iterate through the constructed alias sets, using the
-<tt>AliasSetTracker</tt> <tt>begin()</tt>/<tt>end()</tt> methods.</p>
-
-<p>The <tt>AliasSet</tt>s formed by the <tt>AliasSetTracker</tt> are guaranteed
-to be disjoint, calculate mod/ref information and volatility for the set, and
-keep track of whether or not all of the pointers in the set are Must aliases.
-The AliasSetTracker also makes sure that sets are properly folded due to call
-instructions, and can provide a list of pointers in each set.</p>
-
-<p>As an example user of this, the <a href="/doxygen/structLICM.html">Loop
-Invariant Code Motion</a> pass uses <tt>AliasSetTracker</tt>s to calculate alias
-sets for each loop nest.  If an <tt>AliasSet</tt> in a loop is not modified,
-then all load instructions from that set may be hoisted out of the loop.  If any
-alias sets are stored to <b>and</b> are must alias sets, then the stores may be
-sunk to outside of the loop, promoting the memory location to a register for the
-duration of the loop nest.  Both of these transformations only apply if the
-pointer argument is loop-invariant.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  The AliasSetTracker implementation
-</div>
-
-<div class="doc_text">
-
-<p>The AliasSetTracker class is implemented to be as efficient as possible.  It
-uses the union-find algorithm to efficiently merge AliasSets when a pointer is
-inserted into the AliasSetTracker that aliases multiple sets.  The primary data
-structure is a hash table mapping pointers to the AliasSet they are in.</p>
-
-<p>The AliasSetTracker class must maintain a list of all of the LLVM Value*'s
-that are in each AliasSet.  Since the hash table already has entries for each
-LLVM Value* of interest, the AliasesSets thread the linked list through these
-hash-table nodes to avoid having to allocate memory unnecessarily, and to make
-merging alias sets extremely efficient (the linked list merge is constant time).
-</p>
-
-<p>You shouldn't need to understand these details if you are just a client of
-the AliasSetTracker, but if you look at the code, hopefully this brief
-description will help make sense of why things are designed the way they
-are.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="direct">Using the <tt>AliasAnalysis</tt> interface directly</a>
-</div>
-
-<div class="doc_text">
-
-<p>If neither of these utility class are what your pass needs, you should use
-the interfaces exposed by the <tt>AliasAnalysis</tt> class directly.  Try to use
-the higher-level methods when possible (e.g., use mod/ref information instead of
-the <a href="#alias"><tt>alias</tt></a> method directly if possible) to get the
-best precision and efficiency.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="exist">Existing alias analysis implementations and clients</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>If you're going to be working with the LLVM alias analysis infrastructure,
-you should know what clients and implementations of alias analysis are
-available.  In particular, if you are implementing an alias analysis, you should
-be aware of the <a href="#aliasanalysis-debug">the clients</a> that are useful
-for monitoring and evaluating different implementations.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="impls">Available <tt>AliasAnalysis</tt> implementations</a>
-</div>
-
-<div class="doc_text">
-
-<p>This section lists the various implementations of the <tt>AliasAnalysis</tt>
-interface.  With the exception of the <a href="#no-aa"><tt>-no-aa</tt></a> and
-<a href="#basic-aa"><tt>-basicaa</tt></a> implementations, all of these <a
-href="#chaining">chain</a> to other alias analysis implementations.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="no-aa">The <tt>-no-aa</tt> pass</a>
-</div>
-
-<div class="doc_text">
-
-<p>The <tt>-no-aa</tt> pass is just like what it sounds: an alias analysis that
-never returns any useful information.  This pass can be useful if you think that
-alias analysis is doing something wrong and are trying to narrow down a
-problem.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="basic-aa">The <tt>-basicaa</tt> pass</a>
-</div>
-
-<div class="doc_text">
-
-<p>The <tt>-basicaa</tt> pass is the default LLVM alias analysis.  It is an
-aggressive local analysis that "knows" many important facts:</p>
-
-<ul>
-<li>Distinct globals, stack allocations, and heap allocations can never
-    alias.</li>
-<li>Globals, stack allocations, and heap allocations never alias the null
-    pointer.</li>
-<li>Different fields of a structure do not alias.</li>
-<li>Indexes into arrays with statically differing subscripts cannot alias.</li>
-<li>Many common standard C library functions <a
-    href="#simplemodref">never access memory or only read memory</a>.</li>
-<li>Pointers that obviously point to constant globals
-    "<tt>pointToConstantMemory</tt>".</li>
-<li>Function calls can not modify or references stack allocations if they never
-    escape from the function that allocates them (a common case for automatic
-    arrays).</li>
-</ul>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="globalsmodref">The <tt>-globalsmodref-aa</tt> pass</a>
-</div>
-
-<div class="doc_text">
-
-<p>This pass implements a simple context-sensitive mod/ref and alias analysis
-for internal global variables that don't "have their address taken".  If a
-global does not have its address taken, the pass knows that no pointers alias
-the global.  This pass also keeps track of functions that it knows never access
-memory or never read memory.  This allows certain optimizations (e.g. GVN) to
-eliminate call instructions entirely.
-</p>
-
-<p>The real power of this pass is that it provides context-sensitive mod/ref 
-information for call instructions.  This allows the optimizer to know that 
-calls to a function do not clobber or read the value of the global, allowing 
-loads and stores to be eliminated.</p>
-
-<p>Note that this pass is somewhat limited in its scope (only support 
-non-address taken globals), but is very quick analysis.</p>
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="anders-aa">The <tt>-anders-aa</tt> pass</a>
-</div>
-
-<div class="doc_text">
-
-<p>The <tt>-anders-aa</tt> pass implements the well-known "Andersen's algorithm"
-for interprocedural alias analysis.  This algorithm is a subset-based,
-flow-insensitive, context-insensitive, and field-insensitive alias analysis that
-is widely believed to be fairly precise.  Unfortunately, this algorithm is also
-O(N<sup>3</sup>).  The LLVM implementation currently does not implement any of
-the refinements (such as "online cycle elimination" or "offline variable
-substitution") to improve its efficiency, so it can be quite slow in common
-cases.
-</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="steens-aa">The <tt>-steens-aa</tt> pass</a>
-</div>
-
-<div class="doc_text">
-
-<p>The <tt>-steens-aa</tt> pass implements a variation on the well-known
-"Steensgaard's algorithm" for interprocedural alias analysis.  Steensgaard's
-algorithm is a unification-based, flow-insensitive, context-insensitive, and
-field-insensitive alias analysis that is also very scalable (effectively linear
-time).</p>
-
-<p>The LLVM <tt>-steens-aa</tt> pass implements a "speculatively
-field-<b>sensitive</b>" version of Steensgaard's algorithm using the Data
-Structure Analysis framework.  This gives it substantially more precision than
-the standard algorithm while maintaining excellent analysis scalability.</p>
-
-<p>Note that <tt>-steens-aa</tt> is available in the optional "poolalloc"
-module, it is not part of the LLVM core.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="ds-aa">The <tt>-ds-aa</tt> pass</a>
-</div>
-
-<div class="doc_text">
-
-<p>The <tt>-ds-aa</tt> pass implements the full Data Structure Analysis
-algorithm.  Data Structure Analysis is a modular unification-based,
-flow-insensitive, context-<b>sensitive</b>, and speculatively
-field-<b>sensitive</b> alias analysis that is also quite scalable, usually at
-O(n*log(n)).</p>
-
-<p>This algorithm is capable of responding to a full variety of alias analysis
-queries, and can provide context-sensitive mod/ref information as well.  The
-only major facility not implemented so far is support for must-alias
-information.</p>
-
-<p>Note that <tt>-ds-aa</tt> is available in the optional "poolalloc"
-module, it is not part of the LLVM core.</p>
-
-</div>
-
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="aliasanalysis-xforms">Alias analysis driven transformations</a>
-</div>
-
-<div class="doc_text">
-LLVM includes several alias-analysis driven transformations which can be used
-with any of the implementations above.
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="adce">The <tt>-adce</tt> pass</a>
-</div>
-
-<div class="doc_text">
-
-<p>The <tt>-adce</tt> pass, which implements Aggressive Dead Code Elimination
-uses the <tt>AliasAnalysis</tt> interface to delete calls to functions that do
-not have side-effects and are not used.</p>
-
-</div>
-
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="licm">The <tt>-licm</tt> pass</a>
-</div>
-
-<div class="doc_text">
-
-<p>The <tt>-licm</tt> pass implements various Loop Invariant Code Motion related
-transformations.  It uses the <tt>AliasAnalysis</tt> interface for several
-different transformations:</p>
-
-<ul>
-<li>It uses mod/ref information to hoist or sink load instructions out of loops
-if there are no instructions in the loop that modifies the memory loaded.</li>
-
-<li>It uses mod/ref information to hoist function calls out of loops that do not
-write to memory and are loop-invariant.</li>
-
-<li>If uses alias information to promote memory objects that are loaded and
-stored to in loops to live in a register instead.  It can do this if there are
-no may aliases to the loaded/stored memory location.</li>
-</ul>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="argpromotion">The <tt>-argpromotion</tt> pass</a>
-</div>
-
-<div class="doc_text">
-<p>
-The <tt>-argpromotion</tt> pass promotes by-reference arguments to be passed in
-by-value instead.  In particular, if pointer arguments are only loaded from it
-passes in the value loaded instead of the address to the function.  This pass
-uses alias information to make sure that the value loaded from the argument
-pointer is not modified between the entry of the function and any load of the
-pointer.</p>
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="gvn">The <tt>-gvn</tt>, <tt>-memcpyopt</tt>, and <tt>-dse</tt>
-     passes</a>
-</div>
-
-<div class="doc_text">
-
-<p>These passes use AliasAnalysis information to reason about loads and stores.
-</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="aliasanalysis-debug">Clients for debugging and evaluation of
-  implementations</a>
-</div>
-
-<div class="doc_text">
-
-<p>These passes are useful for evaluating the various alias analysis
-implementations.  You can use them with commands like '<tt>opt -anders-aa -ds-aa
--aa-eval foo.bc -disable-output -stats</tt>'.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="print-alias-sets">The <tt>-print-alias-sets</tt> pass</a>
-</div>
-
-<div class="doc_text">
-
-<p>The <tt>-print-alias-sets</tt> pass is exposed as part of the
-<tt>opt</tt> tool to print out the Alias Sets formed by the <a
-href="#ast"><tt>AliasSetTracker</tt></a> class.  This is useful if you're using
-the <tt>AliasSetTracker</tt> class.  To use it, use something like:</p>
-
-<div class="doc_code">
-<pre>
-% opt -ds-aa -print-alias-sets -disable-output
-</pre>
-</div>
-
-</div>
-
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="count-aa">The <tt>-count-aa</tt> pass</a>
-</div>
-
-<div class="doc_text">
-
-<p>The <tt>-count-aa</tt> pass is useful to see how many queries a particular
-pass is making and what responses are returned by the alias analysis.  As an
-example,</p>
-
-<div class="doc_code">
-<pre>
-% opt -basicaa -count-aa -ds-aa -count-aa -licm
-</pre>
-</div>
-
-<p>will print out how many queries (and what responses are returned) by the
-<tt>-licm</tt> pass (of the <tt>-ds-aa</tt> pass) and how many queries are made
-of the <tt>-basicaa</tt> pass by the <tt>-ds-aa</tt> pass.  This can be useful
-when debugging a transformation or an alias analysis implementation.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="aa-eval">The <tt>-aa-eval</tt> pass</a>
-</div>
-
-<div class="doc_text">
-
-<p>The <tt>-aa-eval</tt> pass simply iterates through all pairs of pointers in a
-function and asks an alias analysis whether or not the pointers alias.  This
-gives an indication of the precision of the alias analysis.  Statistics are
-printed indicating the percent of no/may/must aliases found (a more precise
-algorithm will have a lower number of may aliases).</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="memdep">Memory Dependence Analysis</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>If you're just looking to be a client of alias analysis information, consider
-using the Memory Dependence Analysis interface instead.  MemDep is a lazy, 
-caching layer on top of alias analysis that is able to answer the question of
-what preceding memory operations a given instruction depends on, either at an
-intra- or inter-block level.  Because of its laziness and caching 
-policy, using MemDep can be a significant performance win over accessing alias
-analysis directly.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-
-<hr>
-<address>
-  <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
-  src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS"></a>
-  <a href="http://validator.w3.org/check/referer"><img
-  src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
-
-  <a href="mailto:sabre at nondot.org">Chris Lattner</a><br>
-  <a href="http://llvm.org">LLVM Compiler Infrastructure</a><br>
-  Last modified: $Date$
-</address>
-
-</body>
-</html>
diff --git a/libclamav/c++/llvm/docs/BitCodeFormat.html b/libclamav/c++/llvm/docs/BitCodeFormat.html
deleted file mode 100644
index f1ddefd..0000000
--- a/libclamav/c++/llvm/docs/BitCodeFormat.html
+++ /dev/null
@@ -1,1163 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-                      "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-  <title>LLVM Bitcode File Format</title>
-  <link rel="stylesheet" href="llvm.css" type="text/css">
-</head>
-<body>
-<div class="doc_title"> LLVM Bitcode File Format </div>
-<ol>
-  <li><a href="#abstract">Abstract</a></li>
-  <li><a href="#overview">Overview</a></li>
-  <li><a href="#bitstream">Bitstream Format</a>
-    <ol>
-    <li><a href="#magic">Magic Numbers</a></li>
-    <li><a href="#primitives">Primitives</a></li>
-    <li><a href="#abbrevid">Abbreviation IDs</a></li>
-    <li><a href="#blocks">Blocks</a></li>
-    <li><a href="#datarecord">Data Records</a></li>
-    <li><a href="#abbreviations">Abbreviations</a></li>
-    <li><a href="#stdblocks">Standard Blocks</a></li>
-    </ol>
-  </li>
-  <li><a href="#wrapper">Bitcode Wrapper Format</a>
-  </li>
-  <li><a href="#llvmir">LLVM IR Encoding</a>
-    <ol>
-    <li><a href="#basics">Basics</a></li>
-    <li><a href="#MODULE_BLOCK">MODULE_BLOCK Contents</a></li>
-    <li><a href="#PARAMATTR_BLOCK">PARAMATTR_BLOCK Contents</a></li>
-    <li><a href="#TYPE_BLOCK">TYPE_BLOCK Contents</a></li>
-    <li><a href="#CONSTANTS_BLOCK">CONSTANTS_BLOCK Contents</a></li>
-    <li><a href="#FUNCTION_BLOCK">FUNCTION_BLOCK Contents</a></li>
-    <li><a href="#TYPE_SYMTAB_BLOCK">TYPE_SYMTAB_BLOCK Contents</a></li>
-    <li><a href="#VALUE_SYMTAB_BLOCK">VALUE_SYMTAB_BLOCK Contents</a></li>
-    <li><a href="#METADATA_BLOCK">METADATA_BLOCK Contents</a></li>
-    <li><a href="#METADATA_ATTACHMENT">METADATA_ATTACHMENT Contents</a></li>
-    </ol>
-  </li>
-</ol>
-<div class="doc_author">
-  <p>Written by <a href="mailto:sabre at nondot.org">Chris Lattner</a>
-  and <a href="http://www.reverberate.org">Joshua Haberman</a>.
-</p>
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"> <a name="abstract">Abstract</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>This document describes the LLVM bitstream file format and the encoding of
-the LLVM IR into it.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"> <a name="overview">Overview</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>
-What is commonly known as the LLVM bitcode file format (also, sometimes
-anachronistically known as bytecode) is actually two things: a <a 
-href="#bitstream">bitstream container format</a>
-and an <a href="#llvmir">encoding of LLVM IR</a> into the container format.</p>
-
-<p>
-The bitstream format is an abstract encoding of structured data, very
-similar to XML in some ways.  Like XML, bitstream files contain tags, and nested
-structures, and you can parse the file without having to understand the tags.
-Unlike XML, the bitstream format is a binary encoding, and unlike XML it
-provides a mechanism for the file to self-describe "abbreviations", which are
-effectively size optimizations for the content.</p>
-
-<p>LLVM IR files may be optionally embedded into a <a 
-href="#wrapper">wrapper</a> structure that makes it easy to embed extra data
-along with LLVM IR files.</p>
-
-<p>This document first describes the LLVM bitstream format, describes the
-wrapper format, then describes the record structure used by LLVM IR files.
-</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"> <a name="bitstream">Bitstream Format</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>
-The bitstream format is literally a stream of bits, with a very simple
-structure.  This structure consists of the following concepts:
-</p>
-
-<ul>
-<li>A "<a href="#magic">magic number</a>" that identifies the contents of
-    the stream.</li>
-<li>Encoding <a href="#primitives">primitives</a> like variable bit-rate
-    integers.</li> 
-<li><a href="#blocks">Blocks</a>, which define nested content.</li> 
-<li><a href="#datarecord">Data Records</a>, which describe entities within the
-    file.</li> 
-<li>Abbreviations, which specify compression optimizations for the file.</li> 
-</ul>
-
-<p>Note that the <a 
-href="CommandGuide/html/llvm-bcanalyzer.html">llvm-bcanalyzer</a> tool can be
-used to dump and inspect arbitrary bitstreams, which is very useful for
-understanding the encoding.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="magic">Magic Numbers</a>
-</div>
-
-<div class="doc_text">
-
-<p>The first two bytes of a bitcode file are 'BC' (0x42, 0x43).
-The second two bytes are an application-specific magic number.  Generic
-bitcode tools can look at only the first two bytes to verify the file is
-bitcode, while application-specific programs will want to look at all four.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="primitives">Primitives</a>
-</div>
-
-<div class="doc_text">
-
-<p>
-A bitstream literally consists of a stream of bits, which are read in order
-starting with the least significant bit of each byte.  The stream is made up of a
-number of primitive values that encode a stream of unsigned integer values.
-These integers are encoded in two ways: either as <a href="#fixedwidth">Fixed
-Width Integers</a> or as <a href="#variablewidth">Variable Width
-Integers</a>.
-</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection"> <a name="fixedwidth">Fixed Width Integers</a>
-</div>
-
-<div class="doc_text">
-
-<p>Fixed-width integer values have their low bits emitted directly to the file.
-   For example, a 3-bit integer value encodes 1 as 001.  Fixed width integers
-   are used when there are a well-known number of options for a field.  For
-   example, boolean values are usually encoded with a 1-bit wide integer. 
-</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection"> <a name="variablewidth">Variable Width
-Integers</a></div>
-
-<div class="doc_text">
-
-<p>Variable-width integer (VBR) values encode values of arbitrary size,
-optimizing for the case where the values are small.  Given a 4-bit VBR field,
-any 3-bit value (0 through 7) is encoded directly, with the high bit set to
-zero.  Values larger than N-1 bits emit their bits in a series of N-1 bit
-chunks, where all but the last set the high bit.</p>
-
-<p>For example, the value 27 (0x1B) is encoded as 1011 0011 when emitted as a
-vbr4 value.  The first set of four bits indicates the value 3 (011) with a
-continuation piece (indicated by a high bit of 1).  The next word indicates a
-value of 24 (011 << 3) with no continuation.  The sum (3+24) yields the value
-27.
-</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection"> <a name="char6">6-bit characters</a></div>
-
-<div class="doc_text">
-
-<p>6-bit characters encode common characters into a fixed 6-bit field.  They
-represent the following characters with the following 6-bit values:</p>
-
-<div class="doc_code">
-<pre>
-'a' .. 'z' &mdash;  0 .. 25
-'A' .. 'Z' &mdash; 26 .. 51
-'0' .. '9' &mdash; 52 .. 61
-       '.' &mdash; 62
-       '_' &mdash; 63
-</pre>
-</div>
-
-<p>This encoding is only suitable for encoding characters and strings that
-consist only of the above characters.  It is completely incapable of encoding
-characters not in the set.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection"> <a name="wordalign">Word Alignment</a></div>
-
-<div class="doc_text">
-
-<p>Occasionally, it is useful to emit zero bits until the bitstream is a
-multiple of 32 bits.  This ensures that the bit position in the stream can be
-represented as a multiple of 32-bit words.</p>
-
-</div>
-
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="abbrevid">Abbreviation IDs</a>
-</div>
-
-<div class="doc_text">
-
-<p>
-A bitstream is a sequential series of <a href="#blocks">Blocks</a> and
-<a href="#datarecord">Data Records</a>.  Both of these start with an
-abbreviation ID encoded as a fixed-bitwidth field.  The width is specified by
-the current block, as described below.  The value of the abbreviation ID
-specifies either a builtin ID (which have special meanings, defined below) or
-one of the abbreviation IDs defined for the current block by the stream itself.
-</p>
-
-<p>
-The set of builtin abbrev IDs is:
-</p>
-
-<ul>
-<li><tt>0 - <a href="#END_BLOCK">END_BLOCK</a></tt> &mdash; This abbrev ID marks
-    the end of the current block.</li>
-<li><tt>1 - <a href="#ENTER_SUBBLOCK">ENTER_SUBBLOCK</a></tt> &mdash; This
-    abbrev ID marks the beginning of a new block.</li>
-<li><tt>2 - <a href="#DEFINE_ABBREV">DEFINE_ABBREV</a></tt> &mdash; This defines
-    a new abbreviation.</li>
-<li><tt>3 - <a href="#UNABBREV_RECORD">UNABBREV_RECORD</a></tt> &mdash; This ID
-    specifies the definition of an unabbreviated record.</li>
-</ul>
-
-<p>Abbreviation IDs 4 and above are defined by the stream itself, and specify
-an <a href="#abbrev_records">abbreviated record encoding</a>.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="blocks">Blocks</a>
-</div>
-
-<div class="doc_text">
-
-<p>
-Blocks in a bitstream denote nested regions of the stream, and are identified by
-a content-specific id number (for example, LLVM IR uses an ID of 12 to represent
-function bodies).  Block IDs 0-7 are reserved for <a href="#stdblocks">standard blocks</a>
-whose meaning is defined by Bitcode; block IDs 8 and greater are
-application specific. Nested blocks capture the hierarchical structure of the data
-encoded in it, and various properties are associated with blocks as the file is
-parsed.  Block definitions allow the reader to efficiently skip blocks
-in constant time if the reader wants a summary of blocks, or if it wants to
-efficiently skip data it does not understand.  The LLVM IR reader uses this
-mechanism to skip function bodies, lazily reading them on demand.
-</p>
-
-<p>
-When reading and encoding the stream, several properties are maintained for the
-block.  In particular, each block maintains:
-</p>
-
-<ol>
-<li>A current abbrev id width.  This value starts at 2 at the beginning of
-    the stream, and is set every time a
-    block record is entered.  The block entry specifies the abbrev id width for
-    the body of the block.</li>
-
-<li>A set of abbreviations.  Abbreviations may be defined within a block, in
-    which case they are only defined in that block (neither subblocks nor
-    enclosing blocks see the abbreviation).  Abbreviations can also be defined
-    inside a <tt><a href="#BLOCKINFO">BLOCKINFO</a></tt> block, in which case
-    they are defined in all blocks that match the ID that the BLOCKINFO block is
-    describing.
-</li>
-</ol>
-
-<p>
-As sub blocks are entered, these properties are saved and the new sub-block has
-its own set of abbreviations, and its own abbrev id width.  When a sub-block is
-popped, the saved values are restored.
-</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection"> <a name="ENTER_SUBBLOCK">ENTER_SUBBLOCK
-Encoding</a></div>
-
-<div class="doc_text">
-
-<p><tt>[ENTER_SUBBLOCK, blockid<sub>vbr8</sub>, newabbrevlen<sub>vbr4</sub>,
-     &lt;align32bits&gt;, blocklen<sub>32</sub>]</tt></p>
-
-<p>
-The <tt>ENTER_SUBBLOCK</tt> abbreviation ID specifies the start of a new block
-record.  The <tt>blockid</tt> value is encoded as an 8-bit VBR identifier, and
-indicates the type of block being entered, which can be
-a <a href="#stdblocks">standard block</a> or an application-specific block.
-The <tt>newabbrevlen</tt> value is a 4-bit VBR, which specifies the abbrev id
-width for the sub-block.  The <tt>blocklen</tt> value is a 32-bit aligned value
-that specifies the size of the subblock in 32-bit words. This value allows the
-reader to skip over the entire block in one jump.
-</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection"> <a name="END_BLOCK">END_BLOCK
-Encoding</a></div>
-
-<div class="doc_text">
-
-<p><tt>[END_BLOCK, &lt;align32bits&gt;]</tt></p>
-
-<p>
-The <tt>END_BLOCK</tt> abbreviation ID specifies the end of the current block
-record.  Its end is aligned to 32-bits to ensure that the size of the block is
-an even multiple of 32-bits.
-</p>
-
-</div>
-
-
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="datarecord">Data Records</a>
-</div>
-
-<div class="doc_text">
-<p>
-Data records consist of a record code and a number of (up to) 64-bit
-integer values.  The interpretation of the code and values is
-application specific and may vary between different block types.
-Records can be encoded either using an unabbrev record, or with an
-abbreviation.  In the LLVM IR format, for example, there is a record
-which encodes the target triple of a module.  The code is
-<tt>MODULE_CODE_TRIPLE</tt>, and the values of the record are the
-ASCII codes for the characters in the string.
-</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection"> <a name="UNABBREV_RECORD">UNABBREV_RECORD
-Encoding</a></div>
-
-<div class="doc_text">
-
-<p><tt>[UNABBREV_RECORD, code<sub>vbr6</sub>, numops<sub>vbr6</sub>,
-       op0<sub>vbr6</sub>, op1<sub>vbr6</sub>, ...]</tt></p>
-
-<p>
-An <tt>UNABBREV_RECORD</tt> provides a default fallback encoding, which is both
-completely general and extremely inefficient.  It can describe an arbitrary
-record by emitting the code and operands as VBRs.
-</p>
-
-<p>
-For example, emitting an LLVM IR target triple as an unabbreviated record
-requires emitting the <tt>UNABBREV_RECORD</tt> abbrevid, a vbr6 for the
-<tt>MODULE_CODE_TRIPLE</tt> code, a vbr6 for the length of the string, which is
-equal to the number of operands, and a vbr6 for each character.  Because there
-are no letters with values less than 32, each letter would need to be emitted as
-at least a two-part VBR, which means that each letter would require at least 12
-bits.  This is not an efficient encoding, but it is fully general.
-</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection"> <a name="abbrev_records">Abbreviated Record
-Encoding</a></div>
-
-<div class="doc_text">
-
-<p><tt>[&lt;abbrevid&gt;, fields...]</tt></p>
-
-<p>
-An abbreviated record is a abbreviation id followed by a set of fields that are
-encoded according to the <a href="#abbreviations">abbreviation definition</a>.
-This allows records to be encoded significantly more densely than records
-encoded with the <tt><a href="#UNABBREV_RECORD">UNABBREV_RECORD</a></tt> type,
-and allows the abbreviation types to be specified in the stream itself, which
-allows the files to be completely self describing.  The actual encoding of
-abbreviations is defined below.
-</p>
-
-<p>The record code, which is the first field of an abbreviated record,
-may be encoded in the abbreviation definition (as a literal
-operand) or supplied in the abbreviated record (as a Fixed or VBR
-operand value).</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="abbreviations">Abbreviations</a>
-</div>
-
-<div class="doc_text">
-<p>
-Abbreviations are an important form of compression for bitstreams.  The idea is
-to specify a dense encoding for a class of records once, then use that encoding
-to emit many records.  It takes space to emit the encoding into the file, but
-the space is recouped (hopefully plus some) when the records that use it are
-emitted.
-</p>
-
-<p>
-Abbreviations can be determined dynamically per client, per file. Because the
-abbreviations are stored in the bitstream itself, different streams of the same
-format can contain different sets of abbreviations according to the needs
-of the specific stream.
-As a concrete example, LLVM IR files usually emit an abbreviation
-for binary operators.  If a specific LLVM module contained no or few binary
-operators, the abbreviation does not need to be emitted.
-</p>
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection"><a name="DEFINE_ABBREV">DEFINE_ABBREV
- Encoding</a></div>
-
-<div class="doc_text">
-
-<p><tt>[DEFINE_ABBREV, numabbrevops<sub>vbr5</sub>, abbrevop0, abbrevop1,
- ...]</tt></p>
-
-<p>
-A <tt>DEFINE_ABBREV</tt> record adds an abbreviation to the list of currently
-defined abbreviations in the scope of this block.  This definition only exists
-inside this immediate block &mdash; it is not visible in subblocks or enclosing
-blocks.  Abbreviations are implicitly assigned IDs sequentially starting from 4
-(the first application-defined abbreviation ID).  Any abbreviations defined in a
-<tt>BLOCKINFO</tt> record for the particular block type
-receive IDs first, in order, followed by any
-abbreviations defined within the block itself.  Abbreviated data records
-reference this ID to indicate what abbreviation they are invoking.
-</p>
-
-<p>
-An abbreviation definition consists of the <tt>DEFINE_ABBREV</tt> abbrevid
-followed by a VBR that specifies the number of abbrev operands, then the abbrev
-operands themselves.  Abbreviation operands come in three forms.  They all start
-with a single bit that indicates whether the abbrev operand is a literal operand
-(when the bit is 1) or an encoding operand (when the bit is 0).
-</p>
-
-<ol>
-<li>Literal operands &mdash; <tt>[1<sub>1</sub>, litvalue<sub>vbr8</sub>]</tt>
-&mdash; Literal operands specify that the value in the result is always a single
-specific value.  This specific value is emitted as a vbr8 after the bit
-indicating that it is a literal operand.</li>
-<li>Encoding info without data &mdash; <tt>[0<sub>1</sub>,
- encoding<sub>3</sub>]</tt> &mdash; Operand encodings that do not have extra
- data are just emitted as their code.
-</li>
-<li>Encoding info with data &mdash; <tt>[0<sub>1</sub>, encoding<sub>3</sub>,
-value<sub>vbr5</sub>]</tt> &mdash; Operand encodings that do have extra data are
-emitted as their code, followed by the extra data.
-</li>
-</ol>
-
-<p>The possible operand encodings are:</p>
-
-<ul>
-<li>Fixed (code 1): The field should be emitted as
-    a <a href="#fixedwidth">fixed-width value</a>, whose width is specified by
-    the operand's extra data.</li>
-<li>VBR (code 2): The field should be emitted as
-    a <a href="#variablewidth">variable-width value</a>, whose width is
-    specified by the operand's extra data.</li>
-<li>Array (code 3): This field is an array of values.  The array operand
-    has no extra data, but expects another operand to follow it, indicating
-    the element type of the array.  When reading an array in an abbreviated
-    record, the first integer is a vbr6 that indicates the array length,
-    followed by the encoded elements of the array.  An array may only occur as
-    the last operand of an abbreviation (except for the one final operand that
-    gives the array's type).</li>
-<li>Char6 (code 4): This field should be emitted as
-    a <a href="#char6">char6-encoded value</a>.  This operand type takes no
-    extra data. Char6 encoding is normally used as an array element type.
-    </li>
-<li>Blob (code 5): This field is emitted as a vbr6, followed by padding to a
-    32-bit boundary (for alignment) and an array of 8-bit objects.  The array of
-    bytes is further followed by tail padding to ensure that its total length is
-    a multiple of 4 bytes.  This makes it very efficient for the reader to
-    decode the data without having to make a copy of it: it can use a pointer to
-    the data in the mapped in file and poke directly at it.  A blob may only
-    occur as the last operand of an abbreviation.</li>
-</ul>
-
-<p>
-For example, target triples in LLVM modules are encoded as a record of the
-form <tt>[TRIPLE, 'a', 'b', 'c', 'd']</tt>.  Consider if the bitstream emitted
-the following abbrev entry:
-</p>
-
-<div class="doc_code">
-<pre>
-[0, Fixed, 4]
-[0, Array]
-[0, Char6]
-</pre>
-</div>
-
-<p>
-When emitting a record with this abbreviation, the above entry would be emitted
-as:
-</p>
-
-<div class="doc_code">
-<p>
-<tt>[4<sub>abbrevwidth</sub>, 2<sub>4</sub>, 4<sub>vbr6</sub>, 0<sub>6</sub>,
-1<sub>6</sub>, 2<sub>6</sub>, 3<sub>6</sub>]</tt>
-</p>
-</div>
-
-<p>These values are:</p>
-
-<ol>
-<li>The first value, 4, is the abbreviation ID for this abbreviation.</li>
-<li>The second value, 2, is the record code for <tt>TRIPLE</tt> records within LLVM IR file <tt>MODULE_BLOCK</tt> blocks.</li>
-<li>The third value, 4, is the length of the array.</li>
-<li>The rest of the values are the char6 encoded values
-    for <tt>"abcd"</tt>.</li>
-</ol>
-
-<p>
-With this abbreviation, the triple is emitted with only 37 bits (assuming a
-abbrev id width of 3).  Without the abbreviation, significantly more space would
-be required to emit the target triple.  Also, because the <tt>TRIPLE</tt> value
-is not emitted as a literal in the abbreviation, the abbreviation can also be
-used for any other string value.
-</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="stdblocks">Standard Blocks</a>
-</div>
-
-<div class="doc_text">
-
-<p>
-In addition to the basic block structure and record encodings, the bitstream
-also defines specific built-in block types.  These block types specify how the
-stream is to be decoded or other metadata.  In the future, new standard blocks
-may be added.  Block IDs 0-7 are reserved for standard blocks.
-</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection"><a name="BLOCKINFO">#0 - BLOCKINFO
-Block</a></div>
-
-<div class="doc_text">
-
-<p>
-The <tt>BLOCKINFO</tt> block allows the description of metadata for other
-blocks.  The currently specified records are:
-</p>
-
-<div class="doc_code">
-<pre>
-[SETBID (#1), blockid]
-[DEFINE_ABBREV, ...]
-[BLOCKNAME, ...name...]
-[SETRECORDNAME, RecordID, ...name...]
-</pre>
-</div>
-
-<p>
-The <tt>SETBID</tt> record (code 1) indicates which block ID is being
-described.  <tt>SETBID</tt> records can occur multiple times throughout the
-block to change which block ID is being described.  There must be
-a <tt>SETBID</tt> record prior to any other records.
-</p>
-
-<p>
-Standard <tt>DEFINE_ABBREV</tt> records can occur inside <tt>BLOCKINFO</tt>
-blocks, but unlike their occurrence in normal blocks, the abbreviation is
-defined for blocks matching the block ID we are describing, <i>not</i> the
-<tt>BLOCKINFO</tt> block itself.  The abbreviations defined
-in <tt>BLOCKINFO</tt> blocks receive abbreviation IDs as described
-in <tt><a href="#DEFINE_ABBREV">DEFINE_ABBREV</a></tt>.
-</p>
-
-<p>The <tt>BLOCKNAME</tt> record (code 2) can optionally occur in this block.  The elements of
-the record are the bytes of the string name of the block.  llvm-bcanalyzer can use
-this to dump out bitcode files symbolically.</p>
-
-<p>The <tt>SETRECORDNAME</tt> record (code 3) can also optionally occur in this block.  The
-first operand value is a record ID number, and the rest of the elements of the record are
-the bytes for the string name of the record.  llvm-bcanalyzer can use
-this to dump out bitcode files symbolically.</p>
-
-<p>
-Note that although the data in <tt>BLOCKINFO</tt> blocks is described as
-"metadata," the abbreviations they contain are essential for parsing records
-from the corresponding blocks.  It is not safe to skip them.
-</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"> <a name="wrapper">Bitcode Wrapper Format</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>
-Bitcode files for LLVM IR may optionally be wrapped in a simple wrapper
-structure.  This structure contains a simple header that indicates the offset
-and size of the embedded BC file.  This allows additional information to be
-stored alongside the BC file.  The structure of this file header is:
-</p>
-
-<div class="doc_code">
-<p>
-<tt>[Magic<sub>32</sub>, Version<sub>32</sub>, Offset<sub>32</sub>,
-Size<sub>32</sub>, CPUType<sub>32</sub>]</tt>
-</p>
-</div>
-
-<p>
-Each of the fields are 32-bit fields stored in little endian form (as with
-the rest of the bitcode file fields).  The Magic number is always
-<tt>0x0B17C0DE</tt> and the version is currently always <tt>0</tt>.  The Offset
-field is the offset in bytes to the start of the bitcode stream in the file, and
-the Size field is the size in bytes of the stream. CPUType is a target-specific
-value that can be used to encode the CPU of the target.
-</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"> <a name="llvmir">LLVM IR Encoding</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>
-LLVM IR is encoded into a bitstream by defining blocks and records.  It uses
-blocks for things like constant pools, functions, symbol tables, etc.  It uses
-records for things like instructions, global variable descriptors, type
-descriptions, etc.  This document does not describe the set of abbreviations
-that the writer uses, as these are fully self-described in the file, and the
-reader is not allowed to build in any knowledge of this.
-</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="basics">Basics</a>
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection"><a name="ir_magic">LLVM IR Magic Number</a></div>
-
-<div class="doc_text">
-
-<p>
-The magic number for LLVM IR files is:
-</p>
-
-<div class="doc_code">
-<p>
-<tt>[0x0<sub>4</sub>, 0xC<sub>4</sub>, 0xE<sub>4</sub>, 0xD<sub>4</sub>]</tt>
-</p>
-</div>
-
-<p>
-When combined with the bitcode magic number and viewed as bytes, this is
-<tt>"BC&nbsp;0xC0DE"</tt>.
-</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection"><a name="ir_signed_vbr">Signed VBRs</a></div>
-
-<div class="doc_text">
-
-<p>
-<a href="#variablewidth">Variable Width Integer</a> encoding is an efficient way to
-encode arbitrary sized unsigned values, but is an extremely inefficient for
-encoding signed values, as signed values are otherwise treated as maximally large
-unsigned values.
-</p>
-
-<p>
-As such, signed VBR values of a specific width are emitted as follows:
-</p>
-
-<ul>
-<li>Positive values are emitted as VBRs of the specified width, but with their
-    value shifted left by one.</li>
-<li>Negative values are emitted as VBRs of the specified width, but the negated
-    value is shifted left by one, and the low bit is set.</li>
-</ul>
-
-<p>
-With this encoding, small positive and small negative values can both
-be emitted efficiently. Signed VBR encoding is used in
-<tt>CST_CODE_INTEGER</tt> and <tt>CST_CODE_WIDE_INTEGER</tt> records
-within <tt>CONSTANTS_BLOCK</tt> blocks.
-</p>
-
-</div>
-
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection"><a name="ir_blocks">LLVM IR Blocks</a></div>
-
-<div class="doc_text">
-
-<p>
-LLVM IR is defined with the following blocks:
-</p>
-
-<ul>
-<li>8  &mdash; <a href="#MODULE_BLOCK"><tt>MODULE_BLOCK</tt></a> &mdash; This is the top-level block that
-    contains the entire module, and describes a variety of per-module
-    information.</li>
-<li>9  &mdash; <a href="#PARAMATTR_BLOCK"><tt>PARAMATTR_BLOCK</tt></a> &mdash; This enumerates the parameter
-    attributes.</li>
-<li>10 &mdash; <a href="#TYPE_BLOCK"><tt>TYPE_BLOCK</tt></a> &mdash; This describes all of the types in
-    the module.</li>
-<li>11 &mdash; <a href="#CONSTANTS_BLOCK"><tt>CONSTANTS_BLOCK</tt></a> &mdash; This describes constants for a
-    module or function.</li>
-<li>12 &mdash; <a href="#FUNCTION_BLOCK"><tt>FUNCTION_BLOCK</tt></a> &mdash; This describes a function
-    body.</li>
-<li>13 &mdash; <a href="#TYPE_SYMTAB_BLOCK"><tt>TYPE_SYMTAB_BLOCK</tt></a> &mdash; This describes the type symbol
-    table.</li>
-<li>14 &mdash; <a href="#VALUE_SYMTAB_BLOCK"><tt>VALUE_SYMTAB_BLOCK</tt></a> &mdash; This describes a value symbol
-    table.</li>
-<li>15 &mdash; <a href="#METADATA_BLOCK"><tt>METADATA_BLOCK</tt></a> &mdash; This describes metadata items.</li>
-<li>16 &mdash; <a href="#METADATA_ATTACHMENT"><tt>METADATA_ATTACHMENT</tt></a> &mdash; This contains records associating metadata with function instruction values.</li>
-</ul>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="MODULE_BLOCK">MODULE_BLOCK Contents</a>
-</div>
-
-<div class="doc_text">
-
-<p>The <tt>MODULE_BLOCK</tt> block (id 8) is the top-level block for LLVM
-bitcode files, and each bitcode file must contain exactly one. In
-addition to records (described below) containing information
-about the module, a <tt>MODULE_BLOCK</tt> block may contain the
-following sub-blocks:
-</p>
-
-<ul>
-<li><a href="#BLOCKINFO"><tt>BLOCKINFO</tt></a></li>
-<li><a href="#PARAMATTR_BLOCK"><tt>PARAMATTR_BLOCK</tt></a></li>
-<li><a href="#TYPE_BLOCK"><tt>TYPE_BLOCK</tt></a></li>
-<li><a href="#TYPE_SYMTAB_BLOCK"><tt>TYPE_SYMTAB_BLOCK</tt></a></li>
-<li><a href="#VALUE_SYMTAB_BLOCK"><tt>VALUE_SYMTAB_BLOCK</tt></a></li>
-<li><a href="#CONSTANTS_BLOCK"><tt>CONSTANTS_BLOCK</tt></a></li>
-<li><a href="#FUNCTION_BLOCK"><tt>FUNCTION_BLOCK</tt></a></li>
-<li><a href="#METADATA_BLOCK"><tt>METADATA_BLOCK</tt></a></li>
-</ul>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection"><a name="MODULE_CODE_VERSION">MODULE_CODE_VERSION Record</a>
-</div>
-
-<div class="doc_text">
-
-<p><tt>[VERSION, version#]</tt></p>
-
-<p>The <tt>VERSION</tt> record (code 1) contains a single value
-indicating the format version. Only version 0 is supported at this
-time.</p>
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection"><a name="MODULE_CODE_TRIPLE">MODULE_CODE_TRIPLE Record</a>
-</div>
-
-<div class="doc_text">
-<p><tt>[TRIPLE, ...string...]</tt></p>
-
-<p>The <tt>TRIPLE</tt> record (code 2) contains a variable number of
-values representing the bytes of the <tt>target triple</tt>
-specification string.</p>
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection"><a name="MODULE_CODE_DATALAYOUT">MODULE_CODE_DATALAYOUT Record</a>
-</div>
-
-<div class="doc_text">
-<p><tt>[DATALAYOUT, ...string...]</tt></p>
-
-<p>The <tt>DATALAYOUT</tt> record (code 3) contains a variable number of
-values representing the bytes of the <tt>target datalayout</tt>
-specification string.</p>
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection"><a name="MODULE_CODE_ASM">MODULE_CODE_ASM Record</a>
-</div>
-
-<div class="doc_text">
-<p><tt>[ASM, ...string...]</tt></p>
-
-<p>The <tt>ASM</tt> record (code 4) contains a variable number of
-values representing the bytes of <tt>module asm</tt> strings, with
-individual assembly blocks separated by newline (ASCII 10) characters.</p>
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection"><a name="MODULE_CODE_SECTIONNAME">MODULE_CODE_SECTIONNAME Record</a>
-</div>
-
-<div class="doc_text">
-<p><tt>[SECTIONNAME, ...string...]</tt></p>
-
-<p>The <tt>SECTIONNAME</tt> record (code 5) contains a variable number
-of values representing the bytes of a single section name
-string. There should be one <tt>SECTIONNAME</tt> record for each
-section name referenced (e.g., in global variable or function
-<tt>section</tt> attributes) within the module. These records can be
-referenced by the 1-based index in the <i>section</i> fields of
-<tt>GLOBALVAR</tt> or <tt>FUNCTION</tt> records.</p>
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection"><a name="MODULE_CODE_DEPLIB">MODULE_CODE_DEPLIB Record</a>
-</div>
-
-<div class="doc_text">
-<p><tt>[DEPLIB, ...string...]</tt></p>
-
-<p>The <tt>DEPLIB</tt> record (code 6) contains a variable number of
-values representing the bytes of a single dependent library name
-string, one of the libraries mentioned in a <tt>deplibs</tt>
-declaration.  There should be one <tt>DEPLIB</tt> record for each
-library name referenced.</p>
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection"><a name="MODULE_CODE_GLOBALVAR">MODULE_CODE_GLOBALVAR Record</a>
-</div>
-
-<div class="doc_text">
-<p><tt>[GLOBALVAR, pointer type, isconst, initid, linkage, alignment, section, visibility, threadlocal]</tt></p>
-
-<p>The <tt>GLOBALVAR</tt> record (code 7) marks the declaration or
-definition of a global variable. The operand fields are:</p>
-
-<ul>
-<li><i>pointer type</i>: The type index of the pointer type used to point to
-this global variable</li>
-
-<li><i>isconst</i>: Non-zero if the variable is treated as constant within
-the module, or zero if it is not</li>
-
-<li><i>initid</i>: If non-zero, the value index of the initializer for this
-variable, plus 1.</li>
-
-<li><a name="linkage"><i>linkage</i></a>: An encoding of the linkage
-type for this variable:
-  <ul>
-    <li><tt>external</tt>: code 0</li>
-    <li><tt>weak</tt>: code 1</li>
-    <li><tt>appending</tt>: code 2</li>
-    <li><tt>internal</tt>: code 3</li>
-    <li><tt>linkonce</tt>: code 4</li>
-    <li><tt>dllimport</tt>: code 5</li>
-    <li><tt>dllexport</tt>: code 6</li>
-    <li><tt>extern_weak</tt>: code 7</li>
-    <li><tt>common</tt>: code 8</li>
-    <li><tt>private</tt>: code 9</li>
-    <li><tt>weak_odr</tt>: code 10</li>
-    <li><tt>linkonce_odr</tt>: code 11</li>
-    <li><tt>available_externally</tt>: code 12</li>
-    <li><tt>linker_private</tt>: code 13</li>
-  </ul>
-</li>
-
-<li><i>alignment</i>: The logarithm base 2 of the variable's requested
-alignment, plus 1</li>
-
-<li><i>section</i>: If non-zero, the 1-based section index in the
-table of <a href="#MODULE_CODE_SECTIONNAME">MODULE_CODE_SECTIONNAME</a>
-entries.</li>
-
-<li><a name="visibility"><i>visibility</i></a>: If present, an
-encoding of the visibility of this variable:
-  <ul>
-    <li><tt>default</tt>: code 0</li>
-    <li><tt>hidden</tt>: code 1</li>
-    <li><tt>protected</tt>: code 2</li>
-  </ul>
-</li>
-
-<li><i>threadlocal</i>: If present and non-zero, indicates that the variable
-is <tt>thread_local</tt></li>
-
-</ul>
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection"><a name="MODULE_CODE_FUNCTION">MODULE_CODE_FUNCTION Record</a>
-</div>
-
-<div class="doc_text">
-
-<p><tt>[FUNCTION, type, callingconv, isproto, linkage, paramattr, alignment, section, visibility, gc]</tt></p>
-
-<p>The <tt>FUNCTION</tt> record (code 8) marks the declaration or
-definition of a function. The operand fields are:</p>
-
-<ul>
-<li><i>type</i>: The type index of the function type describing this function</li>
-
-<li><i>callingconv</i>: The calling convention number:
-  <ul>
-    <li><tt>ccc</tt>: code 0</li>
-    <li><tt>fastcc</tt>: code 8</li>
-    <li><tt>coldcc</tt>: code 9</li>
-    <li><tt>x86_stdcallcc</tt>: code 64</li>
-    <li><tt>x86_fastcallcc</tt>: code 65</li>
-    <li><tt>arm_apcscc</tt>: code 66</li>
-    <li><tt>arm_aapcscc</tt>: code 67</li>
-    <li><tt>arm_aapcs_vfpcc</tt>: code 68</li>
-  </ul>
-</li>
-
-<li><i>isproto</i>: Non-zero if this entry represents a declaration
-rather than a definition</li>
-
-<li><i>linkage</i>: An encoding of the <a href="#linkage">linkage type</a>
-for this function</li>
-
-<li><i>paramattr</i>: If nonzero, the 1-based parameter attribute index
-into the table of <a href="#PARAMATTR_CODE_ENTRY">PARAMATTR_CODE_ENTRY</a>
-entries.</li>
-
-<li><i>alignment</i>: The logarithm base 2 of the function's requested
-alignment, plus 1</li>
-
-<li><i>section</i>: If non-zero, the 1-based section index in the
-table of <a href="#MODULE_CODE_SECTIONNAME">MODULE_CODE_SECTIONNAME</a>
-entries.</li>
-
-<li><i>visibility</i>: An encoding of the <a href="#visibility">visibility</a>
-    of this function</li>
-
-<li><i>gc</i>: If present and nonzero, the 1-based garbage collector
-index in the table of
-<a href="#MODULE_CODE_GCNAME">MODULE_CODE_GCNAME</a> entries.</li>
-</ul>
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection"><a name="MODULE_CODE_ALIAS">MODULE_CODE_ALIAS Record</a>
-</div>
-
-<div class="doc_text">
-
-<p><tt>[ALIAS, alias type, aliasee val#, linkage, visibility]</tt></p>
-
-<p>The <tt>ALIAS</tt> record (code 9) marks the definition of an
-alias. The operand fields are</p>
-
-<ul>
-<li><i>alias type</i>: The type index of the alias</li>
-
-<li><i>aliasee val#</i>: The value index of the aliased value</li>
-
-<li><i>linkage</i>: An encoding of the <a href="#linkage">linkage type</a>
-for this alias</li>
-
-<li><i>visibility</i>: If present, an encoding of the
-<a href="#visibility">visibility</a> of the alias</li>
-
-</ul>
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection"><a name="MODULE_CODE_PURGEVALS">MODULE_CODE_PURGEVALS Record</a>
-</div>
-
-<div class="doc_text">
-<p><tt>[PURGEVALS, numvals]</tt></p>
-
-<p>The <tt>PURGEVALS</tt> record (code 10) resets the module-level
-value list to the size given by the single operand value. Module-level
-value list items are added by <tt>GLOBALVAR</tt>, <tt>FUNCTION</tt>,
-and <tt>ALIAS</tt> records.  After a <tt>PURGEVALS</tt> record is seen,
-new value indices will start from the given <i>numvals</i> value.</p>
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection"><a name="MODULE_CODE_GCNAME">MODULE_CODE_GCNAME Record</a>
-</div>
-
-<div class="doc_text">
-<p><tt>[GCNAME, ...string...]</tt></p>
-
-<p>The <tt>GCNAME</tt> record (code 11) contains a variable number of
-values representing the bytes of a single garbage collector name
-string. There should be one <tt>GCNAME</tt> record for each garbage
-collector name referenced in function <tt>gc</tt> attributes within
-the module. These records can be referenced by 1-based index in the <i>gc</i>
-fields of <tt>FUNCTION</tt> records.</p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="PARAMATTR_BLOCK">PARAMATTR_BLOCK Contents</a>
-</div>
-
-<div class="doc_text">
-
-<p>The <tt>PARAMATTR_BLOCK</tt> block (id 9) ...
-</p>
-
-</div>
-
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection"><a name="PARAMATTR_CODE_ENTRY">PARAMATTR_CODE_ENTRY Record</a>
-</div>
-
-<div class="doc_text">
-
-<p><tt>[ENTRY, paramidx0, attr0, paramidx1, attr1...]</tt></p>
-
-<p>The <tt>ENTRY</tt> record (code 1) ...
-</p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="TYPE_BLOCK">TYPE_BLOCK Contents</a>
-</div>
-
-<div class="doc_text">
-
-<p>The <tt>TYPE_BLOCK</tt> block (id 10) ...
-</p>
-
-</div>
-
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="CONSTANTS_BLOCK">CONSTANTS_BLOCK Contents</a>
-</div>
-
-<div class="doc_text">
-
-<p>The <tt>CONSTANTS_BLOCK</tt> block (id 11) ...
-</p>
-
-</div>
-
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="FUNCTION_BLOCK">FUNCTION_BLOCK Contents</a>
-</div>
-
-<div class="doc_text">
-
-<p>The <tt>FUNCTION_BLOCK</tt> block (id 12) ...
-</p>
-
-<p>In addition to the record types described below, a
-<tt>FUNCTION_BLOCK</tt> block may contain the following sub-blocks:
-</p>
-
-<ul>
-<li><a href="#CONSTANTS_BLOCK"><tt>CONSTANTS_BLOCK</tt></a></li>
-<li><a href="#VALUE_SYMTAB_BLOCK"><tt>VALUE_SYMTAB_BLOCK</tt></a></li>
-<li><a href="#METADATA_ATTACHMENT"><tt>METADATA_ATTACHMENT</tt></a></li>
-</ul>
-
-</div>
-
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="TYPE_SYMTAB_BLOCK">TYPE_SYMTAB_BLOCK Contents</a>
-</div>
-
-<div class="doc_text">
-
-<p>The <tt>TYPE_SYMTAB_BLOCK</tt> block (id 13) ...
-</p>
-
-</div>
-
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="VALUE_SYMTAB_BLOCK">VALUE_SYMTAB_BLOCK Contents</a>
-</div>
-
-<div class="doc_text">
-
-<p>The <tt>VALUE_SYMTAB_BLOCK</tt> block (id 14) ... 
-</p>
-
-</div>
-
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="METADATA_BLOCK">METADATA_BLOCK Contents</a>
-</div>
-
-<div class="doc_text">
-
-<p>The <tt>METADATA_BLOCK</tt> block (id 15) ...
-</p>
-
-</div>
-
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="METADATA_ATTACHMENT">METADATA_ATTACHMENT Contents</a>
-</div>
-
-<div class="doc_text">
-
-<p>The <tt>METADATA_ATTACHMENT</tt> block (id 16) ...
-</p>
-
-</div>
-
-
-<!-- *********************************************************************** -->
-<hr>
-<address> <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
- src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS"></a>
-<a href="http://validator.w3.org/check/referer"><img
- src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
- <a href="mailto:sabre at nondot.org">Chris Lattner</a><br>
-<a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
-Last modified: $Date$
-</address>
-</body>
-</html>
diff --git a/libclamav/c++/llvm/docs/Bugpoint.html b/libclamav/c++/llvm/docs/Bugpoint.html
deleted file mode 100644
index bf75b5b..0000000
--- a/libclamav/c++/llvm/docs/Bugpoint.html
+++ /dev/null
@@ -1,250 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" 
-                      "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-  <title>LLVM bugpoint tool: design and usage</title>
-  <link rel="stylesheet" href="llvm.css" type="text/css">
-</head>
-
-<div class="doc_title">
-  LLVM bugpoint tool: design and usage
-</div>
-
-<ul>
-  <li><a href="#desc">Description</a></li>
-  <li><a href="#design">Design Philosophy</a>
-  <ul>
-    <li><a href="#autoselect">Automatic Debugger Selection</a></li>
-    <li><a href="#crashdebug">Crash debugger</a></li>
-    <li><a href="#codegendebug">Code generator debugger</a></li>
-    <li><a href="#miscompilationdebug">Miscompilation debugger</a></li>
-  </ul></li>
-  <li><a href="#advice">Advice for using <tt>bugpoint</tt></a></li>
-</ul>
-
-<div class="doc_author">
-<p>Written by <a href="mailto:sabre at nondot.org">Chris Lattner</a></p>
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-<a name="desc">Description</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p><tt>bugpoint</tt> narrows down the source of problems in LLVM tools and
-passes.  It can be used to debug three types of failures: optimizer crashes,
-miscompilations by optimizers, or bad native code generation (including problems
-in the static and JIT compilers).  It aims to reduce large test cases to small,
-useful ones.  For example, if <tt>opt</tt> crashes while optimizing a
-file, it will identify the optimization (or combination of optimizations) that
-causes the crash, and reduce the file down to a small example which triggers the
-crash.</p>
-
-<p>For detailed case scenarios, such as debugging <tt>opt</tt>,
-<tt>llvm-ld</tt>, or one of the LLVM code generators, see <a
-href="HowToSubmitABug.html">How To Submit a Bug Report document</a>.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-<a name="design">Design Philosophy</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p><tt>bugpoint</tt> is designed to be a useful tool without requiring any
-hooks into the LLVM infrastructure at all.  It works with any and all LLVM
-passes and code generators, and does not need to "know" how they work.  Because
-of this, it may appear to do stupid things or miss obvious
-simplifications.  <tt>bugpoint</tt> is also designed to trade off programmer
-time for computer time in the compiler-debugging process; consequently, it may
-take a long period of (unattended) time to reduce a test case, but we feel it
-is still worth it. Note that <tt>bugpoint</tt> is generally very quick unless
-debugging a miscompilation where each test of the program (which requires 
-executing it) takes a long time.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="autoselect">Automatic Debugger Selection</a>
-</div>
-
-<div class="doc_text">
-
-<p><tt>bugpoint</tt> reads each <tt>.bc</tt> or <tt>.ll</tt> file specified on
-the command line and links them together into a single module, called the test
-program.  If any LLVM passes are specified on the command line, it runs these
-passes on the test program.  If any of the passes crash, or if they produce
-malformed output (which causes the verifier to abort), <tt>bugpoint</tt> starts
-the <a href="#crashdebug">crash debugger</a>.</p>
-
-<p>Otherwise, if the <tt>-output</tt> option was not specified,
-<tt>bugpoint</tt> runs the test program with the C backend (which is assumed to
-generate good code) to generate a reference output.  Once <tt>bugpoint</tt> has
-a reference output for the test program, it tries executing it with the
-selected code generator.  If the selected code generator crashes,
-<tt>bugpoint</tt> starts the <a href="#crashdebug">crash debugger</a> on the
-code generator.  Otherwise, if the resulting output differs from the reference
-output, it assumes the difference resulted from a code generator failure, and
-starts the <a href="#codegendebug">code generator debugger</a>.</p>
-
-<p>Finally, if the output of the selected code generator matches the reference
-output, <tt>bugpoint</tt> runs the test program after all of the LLVM passes
-have been applied to it.  If its output differs from the reference output, it
-assumes the difference resulted from a failure in one of the LLVM passes, and
-enters the <a href="#miscompilationdebug">miscompilation debugger</a>.
-Otherwise, there is no problem <tt>bugpoint</tt> can debug.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="crashdebug">Crash debugger</a>
-</div>
-
-<div class="doc_text">
-
-<p>If an optimizer or code generator crashes, <tt>bugpoint</tt> will try as hard
-as it can to reduce the list of passes (for optimizer crashes) and the size of
-the test program.  First, <tt>bugpoint</tt> figures out which combination of
-optimizer passes triggers the bug. This is useful when debugging a problem
-exposed by <tt>opt</tt>, for example, because it runs over 38 passes.</p>
-
-<p>Next, <tt>bugpoint</tt> tries removing functions from the test program, to
-reduce its size.  Usually it is able to reduce a test program to a single
-function, when debugging intraprocedural optimizations.  Once the number of
-functions has been reduced, it attempts to delete various edges in the control
-flow graph, to reduce the size of the function as much as possible.  Finally,
-<tt>bugpoint</tt> deletes any individual LLVM instructions whose absence does
-not eliminate the failure.  At the end, <tt>bugpoint</tt> should tell you what
-passes crash, give you a bitcode file, and give you instructions on how to
-reproduce the failure with <tt>opt</tt> or <tt>llc</tt>.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="codegendebug">Code generator debugger</a>
-</div>
-
-<div class="doc_text">
-
-<p>The code generator debugger attempts to narrow down the amount of code that
-is being miscompiled by the selected code generator.  To do this, it takes the
-test program and partitions it into two pieces: one piece which it compiles
-with the C backend (into a shared object), and one piece which it runs with
-either the JIT or the static LLC compiler.  It uses several techniques to
-reduce the amount of code pushed through the LLVM code generator, to reduce the
-potential scope of the problem.  After it is finished, it emits two bitcode
-files (called "test" [to be compiled with the code generator] and "safe" [to be
-compiled with the C backend], respectively), and instructions for reproducing
-the problem.  The code generator debugger assumes that the C backend produces
-good code.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="miscompilationdebug">Miscompilation debugger</a>
-</div>
-
-<div class="doc_text">
-
-<p>The miscompilation debugger works similarly to the code generator debugger.
-It works by splitting the test program into two pieces, running the
-optimizations specified on one piece, linking the two pieces back together, and
-then executing the result.  It attempts to narrow down the list of passes to
-the one (or few) which are causing the miscompilation, then reduce the portion
-of the test program which is being miscompiled.  The miscompilation debugger
-assumes that the selected code generator is working properly.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="advice">Advice for using bugpoint</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<tt>bugpoint</tt> can be a remarkably useful tool, but it sometimes works in
-non-obvious ways.  Here are some hints and tips:<p>
-
-<ol>
-<li>In the code generator and miscompilation debuggers, <tt>bugpoint</tt> only
-    works with programs that have deterministic output.  Thus, if the program
-    outputs <tt>argv[0]</tt>, the date, time, or any other "random" data,
-    <tt>bugpoint</tt> may misinterpret differences in these data, when output,
-    as the result of a miscompilation.  Programs should be temporarily modified
-    to disable outputs that are likely to vary from run to run.
-
-<li>In the code generator and miscompilation debuggers, debugging will go
-    faster if you manually modify the program or its inputs to reduce the
-    runtime, but still exhibit the problem.
-
-<li><tt>bugpoint</tt> is extremely useful when working on a new optimization:
-    it helps track down regressions quickly.  To avoid having to relink
-    <tt>bugpoint</tt> every time you change your optimization however, have
-    <tt>bugpoint</tt> dynamically load your optimization with the
-    <tt>-load</tt> option.
-
-<li><p><tt>bugpoint</tt> can generate a lot of output and run for a long period
-    of time.  It is often useful to capture the output of the program to file.
-    For example, in the C shell, you can run:</p>
-
-<div class="doc_code">
-<p><tt>bugpoint  ... |&amp; tee bugpoint.log</tt></p>
-</div>
-
-    <p>to get a copy of <tt>bugpoint</tt>'s output in the file
-    <tt>bugpoint.log</tt>, as well as on your terminal.</p>
-
-<li><tt>bugpoint</tt> cannot debug problems with the LLVM linker. If
-    <tt>bugpoint</tt> crashes before you see its "All input ok" message,
-    you might try <tt>llvm-link -v</tt> on the same set of input files. If
-    that also crashes, you may be experiencing a linker bug.
-
-<li><tt>bugpoint</tt> is useful for proactively finding bugs in LLVM. 
-    Invoking <tt>bugpoint</tt> with the <tt>-find-bugs</tt> option will cause
-    the list of specified optimizations to be randomized and applied to the 
-    program. This process will repeat until a bug is found or the user
-    kills <tt>bugpoint</tt>.
-
-<li><p><tt>bugpoint</tt> does not understand the <tt>-O</tt> option
-    that is used to specify optimization level to <tt>opt</tt>. You
-    can use e.g.</p>
-
-<div class="doc_code">
-<p><tt>opt -O2 -debug-pass=Arguments foo.bc -disable-output</tt></p>
-</div>
-
-    <p>to get a list of passes that are used with <tt>-O2</tt> and
-    then pass this list to <tt>bugpoint</tt>.</p>
-    
-</ol>
-
-</div>
-
-<!-- *********************************************************************** -->
-
-<hr>
-<address>
-  <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
-  src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS"></a>
-  <a href="http://validator.w3.org/check/referer"><img
-  src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
-
-  <a href="mailto:sabre at nondot.org">Chris Lattner</a><br>
-  <a href="http://llvm.org">LLVM Compiler Infrastructure</a><br>
-  Last modified: $Date$
-</address>
-
-</body>
-</html>
diff --git a/libclamav/c++/llvm/docs/CFEBuildInstrs.html b/libclamav/c++/llvm/docs/CFEBuildInstrs.html
deleted file mode 100644
index ed2f295..0000000
--- a/libclamav/c++/llvm/docs/CFEBuildInstrs.html
+++ /dev/null
@@ -1,29 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-                      "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
-  <link rel="stylesheet" href="llvm.css" type="text/css" media="screen">
-  <title>Building the LLVM C/C++ Front-End</title>
-  <meta HTTP-EQUIV="REFRESH" CONTENT="3; URL=GCCFEBuildInstrs.html">
-</head>
-<body>
-<div class="doc_title">
-This page has moved <a href="GCCFEBuildInstrs.html">here</A>.
-</div>
-
-<!-- *********************************************************************** -->
-
-<hr>
-<address>
-  <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
-  src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS"></a>
-  <a href="http://validator.w3.org/check/referer"><img
-  src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
-
-  <a href="http://llvm.org">LLVM Compiler Infrastructure</a><br>
-  Last modified: $Date: 2008-02-13 17:46:10 +0100 (Wed, 13 Feb 2008) $
-</address>
-
-</body>
-</html>
diff --git a/libclamav/c++/llvm/docs/CMake.html b/libclamav/c++/llvm/docs/CMake.html
deleted file mode 100644
index 40a2cec..0000000
--- a/libclamav/c++/llvm/docs/CMake.html
+++ /dev/null
@@ -1,384 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-                      "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-  <title>Building LLVM with CMake</title>
-  <link rel="stylesheet" href="llvm.css" type="text/css">
-</head>
-
-<div class="doc_title">
-  Building LLVM with CMake
-</div>
-
-<ul>
-  <li><a href="#intro">Introduction</a></li>
-  <li><a href="#quickstart">Quick start</a></li>
-  <li><a href="#usage">Basic CMake usage</a>
-  <li><a href="#options">Options and variables</a>
-    <ul>
-    <li><a href="#freccmake">Frequently-used CMake variables</a></li>
-    <li><a href="#llvmvars">LLVM-specific variables</a></li>
-  </ul></li>
-  <li><a href="#testing">Executing the test suite</a>
-  <li><a href="#cross">Cross compiling</a>
-  <li><a href="#embedding">Embedding LLVM in your project</a>
-  <li><a href="#specifics">Compiler/Platform specific topics</a>
-    <ul>
-    <li><a href="#msvc">Microsoft Visual C++</a></li>
-  </ul></li>
-</ul>
-
-<div class="doc_author">
-<p>Written by <a href="mailto:ofv at wanadoo.es">Oscar Fuentes</a></p>
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-<a name="intro">Introduction</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-  <p><a href="http://www.cmake.org/">CMake</a> is a cross-platform
-    build-generator tool. CMake does not build the project, it generates
-    the files needed by your build tool (GNU make, Visual Studio, etc) for
-    building LLVM.</p>
-
-  <p>If you are really anxious about getting a functional LLVM build,
-    go to the <a href="#quickstart">Quick start</a> section. If you
-    are a CMake novice, start on <a href="#usage">Basic CMake
-      usage</a> and then go back to the <a href="#quickstart">Quick
-      start</a> once you know what you are
-    doing. The <a href="#options">Options and variables</a> section
-    is a reference for customizing your build. If you already have
-    experience with CMake, this is the recommended starting point.
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-<a name="quickstart">Quick start</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p> We use here the command-line, non-interactive CMake interface </p>
-
-<ol>
-
-  <li><p><a href="http://www.cmake.org/cmake/resources/software.html">Download</a>
-      and install CMake. Version 2.6.2 is the minimum required.</p>
-
-  <li><p>Open a shell. Your development tools must be reachable from this
-      shell through the PATH environment variable.</p>
-
-  <li><p>Create a directory for containing the build. It is not
-      supported to build LLVM on the source directory. cd to this
-      directory:</p>
-    <div class="doc_code">
-      <p><tt>mkdir mybuilddir</tt></p>
-      <p><tt>cd mybuilddir</tt></p>
-    </div>
-
-  <li><p>Execute this command on the shell
-      replacing <i>path/to/llvm/source/root</i> with the path to the
-      root of your LLVM source tree:</p>
-    <div class="doc_code">
-      <p><tt>cmake path/to/llvm/source/root</tt></p>
-    </div>
-
-    <p>CMake will detect your development environment, perform a
-      series of test and generate the files required for building
-      LLVM. CMake will use default values for all build
-      parameters. See the <a href="#options">Options and variables</a>
-      section for fine-tuning your build</p>
-
-    <p>This can fail if CMake can't detect your toolset, or if it
-      thinks that the environment is not sane enough. On this case
-      make sure that the toolset that you intend to use is the only
-      one reachable from the shell and that the shell itself is the
-      correct one for you development environment. CMake will refuse
-      to build MinGW makefiles if you have a POSIX shell reachable
-      through the PATH environment variable, for instance. You can
-      force CMake to use a given build tool, see
-      the <a href="#usage">Usage</a> section.</p>
-
-</ol>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="usage">Basic CMake usage</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-  <p>This section explains basic aspects of CMake, mostly for
-    explaining those options which you may need on your day-to-day
-    usage.</p>
-
-  <p>CMake comes with extensive documentation in the form of html
-    files and on the cmake executable itself. Execute <i>cmake
-    --help</i> for further help options.</p>
-
-  <p>CMake requires to know for which build tool it shall generate
-    files (GNU make, Visual Studio, Xcode, etc). If not specified on
-    the command line, it tries to guess it based on you
-    environment. Once identified the build tool, CMake uses the
-    corresponding <i>Generator</i> for creating files for your build
-    tool. You can explicitly specify the generator with the command
-    line option <i>-G "Name of the generator"</i>. For knowing the
-    available generators on your platform, execute</p>
-
-    <div class="doc_code">
-      <p><tt>cmake --help</tt></p>
-    </div>
-
-    <p>This will list the generator's names at the end of the help
-      text. Generator's names are case-sensitive. Example:</p>
-
-    <div class="doc_code">
-      <p><tt>cmake -G "Visual Studio 8 2005" path/to/llvm/source/root</tt></p>
-    </div>
-
-    <p>For a given development platform there can be more than one
-      adequate generator. If you use Visual Studio "NMake Makefiles"
-      is a generator you can use for building with NMake. By default,
-      CMake chooses the more specific generator supported by your
-      development environment. If you want an alternative generator,
-      you must tell this to CMake with the <i>-G</i> option.</p>
-
-    <p>TODO: explain variables and cache. Move explanation here from
-      #options section.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="options">Options and variables</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-  <p>Variables customize how the build will be generated. Options are
-    boolean variables, with possible values ON/OFF. Options and
-    variables are defined on the CMake command line like this:</p>
-
-  <div class="doc_code">
-    <p><tt>cmake -DVARIABLE=value path/to/llvm/source</tt></p>
-  </div>
-
-  <p>You can set a variable after the initial CMake invocation for
-    changing its value. You can also undefine a variable:</p>
-
-  <div class="doc_code">
-    <p><tt>cmake -UVARIABLE path/to/llvm/source</tt></p>
-  </div>
-
-  <p>Variables are stored on the CMake cache. This is a file
-    named <tt>CMakeCache.txt</tt> on the root of the build
-    directory. Do not hand-edit it.</p>
-
-  <p>Variables are listed here appending its type after a colon. It is
-    correct to write the variable and the type on the CMake command
-    line:</p>
-
-  <div class="doc_code">
-    <p><tt>cmake -DVARIABLE:TYPE=value path/to/llvm/source</tt></p>
-  </div>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="freccmake">Frequently-used CMake variables</a>
-</div>
-
-<div class="doc_text">
-
-<p>Here are listed some of the CMake variables that are used often,
-  along with a brief explanation and LLVM-specific notes. For full
-  documentation, check the CMake docs or execute <i>cmake
-  --help-variable VARIABLE_NAME</i>.</p>
-
-<dl>
-  <dt><b>CMAKE_BUILD_TYPE</b>:STRING</dt>
-
-  <dd>Sets the build type for <i>make</i> based generators. Possible
-    values are Release, Debug, RelWithDebInfo and MinSizeRel. On
-    systems like Visual Studio the user sets the build type with the IDE
-    settings.</dd>
-
-  <dt><b>CMAKE_INSTALL_PREFIX</b>:PATH</dt>
-  <dd>Path where LLVM will be installed if "make install" is invoked
-    or the "INSTALL" target is built.</dd>
-
-  <dt><b>LLVM_LIBDIR_SUFFIX</b>:STRING</dt>
-  <dd>Extra suffix to append to the directory where libraries are to
-    be installed. On a 64-bit architecture, one could use
-    -DLLVM_LIBDIR_SUFFIX=64 to install libraries to /usr/lib64.</dd>
-
-  <dt><b>CMAKE_C_FLAGS</b>:STRING</dt>
-  <dd>Extra flags to use when compiling C source files.</dd>
-
-  <dt><b>CMAKE_CXX_FLAGS</b>:STRING</dt>
-  <dd>Extra flags to use when compiling C++ source files.</dd>
-
-  <dt><b>BUILD_SHARED_LIBS</b>:BOOL</dt>
-  <dd>Flag indicating is shared libraries will be built. Its default
-    value is OFF. Shared libraries are not supported on Windows and
-    not recommended in the other OSes.</dd>
-</dl>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="llvmvars">LLVM-specific variables</a>
-</div>
-
-<div class="doc_text">
-
-<dl>
-  <dt><b>LLVM_TARGETS_TO_BUILD</b>:STRING</dt>
-  <dd>Semicolon-separated list of targets to build, or <i>all</i> for
-    building all targets. Case-sensitive. For Visual C++ defaults
-    to <i>X86</i>. On the other cases defaults to <i>all</i>. Example:
-    <i>-DLLVM_TARGETS_TO_BUILD="X86;PowerPC;Alpha"</i>.</dd>
-
-  <dt><b>LLVM_BUILD_TOOLS</b>:BOOL</dt>
-  <dd>Build LLVM tools. Defaults to ON. Targets for building each tool
-    are generated in any case. You can build an tool separately by
-    invoking its target. For example, you can build <i>llvm-as</i>
-    with a makefile-based system executing <i>make llvm-as</i> on the
-    root of your build directory.</dd>
-
-  <dt><b>LLVM_BUILD_EXAMPLES</b>:BOOL</dt>
-  <dd>Build LLVM examples. Defaults to OFF. Targets for building each
-    example are generated in any case. See documentation
-    for <i>LLVM_BUILD_TOOLS</i> above for more details.</dd>
-
-  <dt><b>LLVM_ENABLE_THREADS</b>:BOOL</dt>
-  <dd>Build with threads support, if available. Defaults to ON.</dd>
-
-  <dt><b>LLVM_ENABLE_ASSERTIONS</b>:BOOL</dt>
-  <dd>Enables code assertions. Defaults to OFF if and only if
-    CMAKE_BUILD_TYPE is <i>Release</i>.</dd>
-
-  <dt><b>LLVM_ENABLE_PIC</b>:BOOL</dt>
-  <dd>Add the <i>-fPIC</i> flag for the compiler command-line, if the
-    compiler supports this flag. Some systems, like Windows, do not
-    need this flag. Defaults to ON.</dd>
-
-  <dt><b>LLVM_ENABLE_WARNINGS</b>:BOOL</dt>
-  <dd>Enable all compiler warnings. Defaults to ON.</dd>
-
-  <dt><b>LLVM_ENABLE_PEDANTIC</b>:BOOL</dt>
-  <dd>Enable pedantic mode. This disable compiler specific extensions, is
-    possible. Defaults to ON.</dd>
-
-  <dt><b>LLVM_ENABLE_WERROR</b>:BOOL</dt>
-  <dd>Stop and fail build, if a compiler warning is
-    triggered. Defaults to OFF.</dd>
-
-  <dt><b>LLVM_BUILD_32_BITS</b>:BOOL</dt>
-  <dd>Build 32-bits executables and libraries on 64-bits systems. This
-    option is available only on some 64-bits unix systems. Defaults to
-    OFF.</dd>
-
-  <dt><b>LLVM_TARGET_ARCH</b>:STRING</dt>
-  <dd>LLVM target to use for native code generation. This is required
-    for JIT generation. It defaults to "host", meaning that it shall
-    pick the architecture of the machine where LLVM is being built. If
-    you are cross-compiling, set it to the target architecture
-    name.</dd>
-
-  <dt><b>LLVM_TABLEGEN</b>:STRING</dt>
-  <dd>Full path to a native TableGen executable (usually
-    named <i>tblgen</i>). This is intented for cross-compiling: if the
-    user sets this variable, no native TableGen will be created.</dd>
-</dl>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="testing">Executing the test suite</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>LLVM testing is not supported on Visual Studio.</p>
-
-<p>TODO</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="cross">Cross compiling</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>See <a href="http://www.vtk.org/Wiki/CMake_Cross_Compiling">this
-    wiki page</a> for generic instructions on how to cross-compile
-    with CMake. It goes into detailed explanations and may seem
-    daunting, but it is not. On the wiki page there are several
-    examples including toolchain files. Go directly to
-    <a href="http://www.vtk.org/Wiki/CMake_Cross_Compiling#Information_how_to_set_up_various_cross_compiling_toolchains">this
-    section</a> for a quick solution.</p>
-
-<p>Also see the <a href="#llvmvars">LLVM-specific variables</a>
-  section for variables used when cross-compiling.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="embedding">Embedding LLVM in your project</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>TODO</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="specifics">Compiler/Platform specific topics</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>Notes for specific compilers and/or platforms.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-
-<hr>
-<address>
-  <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
-  src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS"></a>
-  <a href="http://validator.w3.org/check/referer"><img
-  src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
-
-  <a href="mailto:ofv at wanadoo.es">Oscar Fuentes</a><br>
-  <a href="http://llvm.org">LLVM Compiler Infrastructure</a><br>
-  Last modified: $Date: 2008-12-31 03:59:36 +0100 (Wed, 31 Dec 2008) $
-</address>
-
-</body>
-</html>
diff --git a/libclamav/c++/llvm/docs/CodeGenerator.html b/libclamav/c++/llvm/docs/CodeGenerator.html
deleted file mode 100644
index 4c87efa..0000000
--- a/libclamav/c++/llvm/docs/CodeGenerator.html
+++ /dev/null
@@ -1,2123 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-                      "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-  <meta http-equiv="content-type" content="text/html; charset=utf-8">
-  <title>The LLVM Target-Independent Code Generator</title>
-  <link rel="stylesheet" href="llvm.css" type="text/css">
-</head>
-<body>
-
-<div class="doc_title">
-  The LLVM Target-Independent Code Generator
-</div>
-
-<ol>
-  <li><a href="#introduction">Introduction</a>
-    <ul>
-      <li><a href="#required">Required components in the code generator</a></li>
-      <li><a href="#high-level-design">The high-level design of the code
-          generator</a></li>
-      <li><a href="#tablegen">Using TableGen for target description</a></li>
-    </ul>
-  </li>
-  <li><a href="#targetdesc">Target description classes</a>
-    <ul>
-      <li><a href="#targetmachine">The <tt>TargetMachine</tt> class</a></li>
-      <li><a href="#targetdata">The <tt>TargetData</tt> class</a></li>
-      <li><a href="#targetlowering">The <tt>TargetLowering</tt> class</a></li>
-      <li><a href="#targetregisterinfo">The <tt>TargetRegisterInfo</tt> class</a></li>
-      <li><a href="#targetinstrinfo">The <tt>TargetInstrInfo</tt> class</a></li>
-      <li><a href="#targetframeinfo">The <tt>TargetFrameInfo</tt> class</a></li>
-      <li><a href="#targetsubtarget">The <tt>TargetSubtarget</tt> class</a></li>
-      <li><a href="#targetjitinfo">The <tt>TargetJITInfo</tt> class</a></li>
-    </ul>
-  </li>
-  <li><a href="#codegendesc">Machine code description classes</a>
-    <ul>
-    <li><a href="#machineinstr">The <tt>MachineInstr</tt> class</a></li>
-    <li><a href="#machinebasicblock">The <tt>MachineBasicBlock</tt>
-                                     class</a></li>
-    <li><a href="#machinefunction">The <tt>MachineFunction</tt> class</a></li>
-    </ul>
-  </li>
-  <li><a href="#codegenalgs">Target-independent code generation algorithms</a>
-    <ul>
-    <li><a href="#instselect">Instruction Selection</a>
-      <ul>
-      <li><a href="#selectiondag_intro">Introduction to SelectionDAGs</a></li>
-      <li><a href="#selectiondag_process">SelectionDAG Code Generation
-                                          Process</a></li>
-      <li><a href="#selectiondag_build">Initial SelectionDAG
-                                        Construction</a></li>
-      <li><a href="#selectiondag_legalize_types">SelectionDAG LegalizeTypes Phase</a></li>
-      <li><a href="#selectiondag_legalize">SelectionDAG Legalize Phase</a></li>
-      <li><a href="#selectiondag_optimize">SelectionDAG Optimization
-                                           Phase: the DAG Combiner</a></li>
-      <li><a href="#selectiondag_select">SelectionDAG Select Phase</a></li>
-      <li><a href="#selectiondag_sched">SelectionDAG Scheduling and Formation
-                                        Phase</a></li>
-      <li><a href="#selectiondag_future">Future directions for the
-                                         SelectionDAG</a></li>
-      </ul></li>
-     <li><a href="#liveintervals">Live Intervals</a>
-       <ul>
-       <li><a href="#livevariable_analysis">Live Variable Analysis</a></li>
-       <li><a href="#liveintervals_analysis">Live Intervals Analysis</a></li>
-       </ul></li>
-    <li><a href="#regalloc">Register Allocation</a>
-      <ul>
-      <li><a href="#regAlloc_represent">How registers are represented in
-                                        LLVM</a></li>
-      <li><a href="#regAlloc_howTo">Mapping virtual registers to physical
-                                    registers</a></li>
-      <li><a href="#regAlloc_twoAddr">Handling two address instructions</a></li>
-      <li><a href="#regAlloc_ssaDecon">The SSA deconstruction phase</a></li>
-      <li><a href="#regAlloc_fold">Instruction folding</a></li>
-      <li><a href="#regAlloc_builtIn">Built in register allocators</a></li>
-      </ul></li>
-    <li><a href="#codeemit">Code Emission</a>
-        <ul>
-        <li><a href="#codeemit_asm">Generating Assembly Code</a></li>
-        <li><a href="#codeemit_bin">Generating Binary Machine Code</a></li>
-        </ul></li>
-    </ul>
-  </li>
-  <li><a href="#targetimpls">Target-specific Implementation Notes</a>
-    <ul>
-    <li><a href="#tailcallopt">Tail call optimization</a></li>
-    <li><a href="#x86">The X86 backend</a></li>
-    <li><a href="#ppc">The PowerPC backend</a>
-      <ul>
-      <li><a href="#ppc_abi">LLVM PowerPC ABI</a></li>
-      <li><a href="#ppc_frame">Frame Layout</a></li>
-      <li><a href="#ppc_prolog">Prolog/Epilog</a></li>
-      <li><a href="#ppc_dynamic">Dynamic Allocation</a></li>
-      </ul></li>
-    </ul></li>
-
-</ol>
-
-<div class="doc_author">
-  <p>Written by <a href="mailto:sabre at nondot.org">Chris Lattner</a>,
-                <a href="mailto:isanbard at gmail.com">Bill Wendling</a>,
-                <a href="mailto:pronesto at gmail.com">Fernando Magno Quintao
-                                                    Pereira</a> and
-                <a href="mailto:jlaskey at mac.com">Jim Laskey</a></p>
-</div>
-
-<div class="doc_warning">
-  <p>Warning: This is a work in progress.</p>
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="introduction">Introduction</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>The LLVM target-independent code generator is a framework that provides a
-   suite of reusable components for translating the LLVM internal representation
-   to the machine code for a specified target&mdash;either in assembly form
-   (suitable for a static compiler) or in binary machine code format (usable for
-   a JIT compiler). The LLVM target-independent code generator consists of five
-   main components:</p>
-
-<ol>
-  <li><a href="#targetdesc">Abstract target description</a> interfaces which
-      capture important properties about various aspects of the machine,
-      independently of how they will be used.  These interfaces are defined in
-      <tt>include/llvm/Target/</tt>.</li>
-
-  <li>Classes used to represent the <a href="#codegendesc">machine code</a>
-      being generated for a target.  These classes are intended to be abstract
-      enough to represent the machine code for <i>any</i> target machine.  These
-      classes are defined in <tt>include/llvm/CodeGen/</tt>.</li>
-
-  <li><a href="#codegenalgs">Target-independent algorithms</a> used to implement
-      various phases of native code generation (register allocation, scheduling,
-      stack frame representation, etc).  This code lives
-      in <tt>lib/CodeGen/</tt>.</li>
-
-  <li><a href="#targetimpls">Implementations of the abstract target description
-      interfaces</a> for particular targets.  These machine descriptions make
-      use of the components provided by LLVM, and can optionally provide custom
-      target-specific passes, to build complete code generators for a specific
-      target.  Target descriptions live in <tt>lib/Target/</tt>.</li>
-
-  <li><a href="#jit">The target-independent JIT components</a>.  The LLVM JIT is
-      completely target independent (it uses the <tt>TargetJITInfo</tt>
-      structure to interface for target-specific issues.  The code for the
-      target-independent JIT lives in <tt>lib/ExecutionEngine/JIT</tt>.</li>
-</ol>
-
-<p>Depending on which part of the code generator you are interested in working
-   on, different pieces of this will be useful to you.  In any case, you should
-   be familiar with the <a href="#targetdesc">target description</a>
-   and <a href="#codegendesc">machine code representation</a> classes.  If you
-   want to add a backend for a new target, you will need
-   to <a href="#targetimpls">implement the target description</a> classes for
-   your new target and understand the <a href="LangRef.html">LLVM code
-   representation</a>.  If you are interested in implementing a
-   new <a href="#codegenalgs">code generation algorithm</a>, it should only
-   depend on the target-description and machine code representation classes,
-   ensuring that it is portable.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
- <a name="required">Required components in the code generator</a>
-</div>
-
-<div class="doc_text">
-
-<p>The two pieces of the LLVM code generator are the high-level interface to the
-   code generator and the set of reusable components that can be used to build
-   target-specific backends.  The two most important interfaces
-   (<a href="#targetmachine"><tt>TargetMachine</tt></a>
-   and <a href="#targetdata"><tt>TargetData</tt></a>) are the only ones that are
-   required to be defined for a backend to fit into the LLVM system, but the
-   others must be defined if the reusable code generator components are going to
-   be used.</p>
-
-<p>This design has two important implications.  The first is that LLVM can
-   support completely non-traditional code generation targets.  For example, the
-   C backend does not require register allocation, instruction selection, or any
-   of the other standard components provided by the system.  As such, it only
-   implements these two interfaces, and does its own thing.  Another example of
-   a code generator like this is a (purely hypothetical) backend that converts
-   LLVM to the GCC RTL form and uses GCC to emit machine code for a target.</p>
-
-<p>This design also implies that it is possible to design and implement
-   radically different code generators in the LLVM system that do not make use
-   of any of the built-in components.  Doing so is not recommended at all, but
-   could be required for radically different targets that do not fit into the
-   LLVM machine description model: FPGAs for example.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
- <a name="high-level-design">The high-level design of the code generator</a>
-</div>
-
-<div class="doc_text">
-
-<p>The LLVM target-independent code generator is designed to support efficient
-   and quality code generation for standard register-based microprocessors.
-   Code generation in this model is divided into the following stages:</p>
-
-<ol>
-  <li><b><a href="#instselect">Instruction Selection</a></b> &mdash; This phase
-      determines an efficient way to express the input LLVM code in the target
-      instruction set.  This stage produces the initial code for the program in
-      the target instruction set, then makes use of virtual registers in SSA
-      form and physical registers that represent any required register
-      assignments due to target constraints or calling conventions.  This step
-      turns the LLVM code into a DAG of target instructions.</li>
-
-  <li><b><a href="#selectiondag_sched">Scheduling and Formation</a></b> &mdash;
-      This phase takes the DAG of target instructions produced by the
-      instruction selection phase, determines an ordering of the instructions,
-      then emits the instructions
-      as <tt><a href="#machineinstr">MachineInstr</a></tt>s with that ordering.
-      Note that we describe this in the <a href="#instselect">instruction
-      selection section</a> because it operates on
-      a <a href="#selectiondag_intro">SelectionDAG</a>.</li>
-
-  <li><b><a href="#ssamco">SSA-based Machine Code Optimizations</a></b> &mdash;
-      This optional stage consists of a series of machine-code optimizations
-      that operate on the SSA-form produced by the instruction selector.
-      Optimizations like modulo-scheduling or peephole optimization work
-      here.</li>
-
-  <li><b><a href="#regalloc">Register Allocation</a></b> &mdash; The target code
-      is transformed from an infinite virtual register file in SSA form to the
-      concrete register file used by the target.  This phase introduces spill
-      code and eliminates all virtual register references from the program.</li>
-
-  <li><b><a href="#proepicode">Prolog/Epilog Code Insertion</a></b> &mdash; Once
-      the machine code has been generated for the function and the amount of
-      stack space required is known (used for LLVM alloca's and spill slots),
-      the prolog and epilog code for the function can be inserted and "abstract
-      stack location references" can be eliminated.  This stage is responsible
-      for implementing optimizations like frame-pointer elimination and stack
-      packing.</li>
-
-  <li><b><a href="#latemco">Late Machine Code Optimizations</a></b> &mdash;
-      Optimizations that operate on "final" machine code can go here, such as
-      spill code scheduling and peephole optimizations.</li>
-
-  <li><b><a href="#codeemit">Code Emission</a></b> &mdash; The final stage
-      actually puts out the code for the current function, either in the target
-      assembler format or in machine code.</li>
-</ol>
-
-<p>The code generator is based on the assumption that the instruction selector
-   will use an optimal pattern matching selector to create high-quality
-   sequences of native instructions.  Alternative code generator designs based
-   on pattern expansion and aggressive iterative peephole optimization are much
-   slower.  This design permits efficient compilation (important for JIT
-   environments) and aggressive optimization (used when generating code offline)
-   by allowing components of varying levels of sophistication to be used for any
-   step of compilation.</p>
-
-<p>In addition to these stages, target implementations can insert arbitrary
-   target-specific passes into the flow.  For example, the X86 target uses a
-   special pass to handle the 80x87 floating point stack architecture.  Other
-   targets with unusual requirements can be supported with custom passes as
-   needed.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
- <a name="tablegen">Using TableGen for target description</a>
-</div>
-
-<div class="doc_text">
-
-<p>The target description classes require a detailed description of the target
-   architecture.  These target descriptions often have a large amount of common
-   information (e.g., an <tt>add</tt> instruction is almost identical to a
-   <tt>sub</tt> instruction).  In order to allow the maximum amount of
-   commonality to be factored out, the LLVM code generator uses
-   the <a href="TableGenFundamentals.html">TableGen</a> tool to describe big
-   chunks of the target machine, which allows the use of domain-specific and
-   target-specific abstractions to reduce the amount of repetition.</p>
-
-<p>As LLVM continues to be developed and refined, we plan to move more and more
-   of the target description to the <tt>.td</tt> form.  Doing so gives us a
-   number of advantages.  The most important is that it makes it easier to port
-   LLVM because it reduces the amount of C++ code that has to be written, and
-   the surface area of the code generator that needs to be understood before
-   someone can get something working.  Second, it makes it easier to change
-   things. In particular, if tables and other things are all emitted
-   by <tt>tblgen</tt>, we only need a change in one place (<tt>tblgen</tt>) to
-   update all of the targets to a new interface.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="targetdesc">Target description classes</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>The LLVM target description classes (located in the
-   <tt>include/llvm/Target</tt> directory) provide an abstract description of
-   the target machine independent of any particular client.  These classes are
-   designed to capture the <i>abstract</i> properties of the target (such as the
-   instructions and registers it has), and do not incorporate any particular
-   pieces of code generation algorithms.</p>
-
-<p>All of the target description classes (except the
-   <tt><a href="#targetdata">TargetData</a></tt> class) are designed to be
-   subclassed by the concrete target implementation, and have virtual methods
-   implemented.  To get to these implementations, the
-   <tt><a href="#targetmachine">TargetMachine</a></tt> class provides accessors
-   that should be implemented by the target.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="targetmachine">The <tt>TargetMachine</tt> class</a>
-</div>
-
-<div class="doc_text">
-
-<p>The <tt>TargetMachine</tt> class provides virtual methods that are used to
-   access the target-specific implementations of the various target description
-   classes via the <tt>get*Info</tt> methods (<tt>getInstrInfo</tt>,
-   <tt>getRegisterInfo</tt>, <tt>getFrameInfo</tt>, etc.).  This class is
-   designed to be specialized by a concrete target implementation
-   (e.g., <tt>X86TargetMachine</tt>) which implements the various virtual
-   methods.  The only required target description class is
-   the <a href="#targetdata"><tt>TargetData</tt></a> class, but if the code
-   generator components are to be used, the other interfaces should be
-   implemented as well.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="targetdata">The <tt>TargetData</tt> class</a>
-</div>
-
-<div class="doc_text">
-
-<p>The <tt>TargetData</tt> class is the only required target description class,
-   and it is the only class that is not extensible (you cannot derived a new
-   class from it).  <tt>TargetData</tt> specifies information about how the
-   target lays out memory for structures, the alignment requirements for various
-   data types, the size of pointers in the target, and whether the target is
-   little-endian or big-endian.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="targetlowering">The <tt>TargetLowering</tt> class</a>
-</div>
-
-<div class="doc_text">
-
-<p>The <tt>TargetLowering</tt> class is used by SelectionDAG based instruction
-   selectors primarily to describe how LLVM code should be lowered to
-   SelectionDAG operations.  Among other things, this class indicates:</p>
-
-<ul>
-  <li>an initial register class to use for various <tt>ValueType</tt>s,</li>
-
-  <li>which operations are natively supported by the target machine,</li>
-
-  <li>the return type of <tt>setcc</tt> operations,</li>
-
-  <li>the type to use for shift amounts, and</li>
-
-  <li>various high-level characteristics, like whether it is profitable to turn
-      division by a constant into a multiplication sequence</li>
-</ul>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="targetregisterinfo">The <tt>TargetRegisterInfo</tt> class</a>
-</div>
-
-<div class="doc_text">
-
-<p>The <tt>TargetRegisterInfo</tt> class is used to describe the register file
-   of the target and any interactions between the registers.</p>
-
-<p>Registers in the code generator are represented in the code generator by
-   unsigned integers.  Physical registers (those that actually exist in the
-   target description) are unique small numbers, and virtual registers are
-   generally large.  Note that register #0 is reserved as a flag value.</p>
-
-<p>Each register in the processor description has an associated
-   <tt>TargetRegisterDesc</tt> entry, which provides a textual name for the
-   register (used for assembly output and debugging dumps) and a set of aliases
-   (used to indicate whether one register overlaps with another).</p>
-
-<p>In addition to the per-register description, the <tt>TargetRegisterInfo</tt>
-   class exposes a set of processor specific register classes (instances of the
-   <tt>TargetRegisterClass</tt> class).  Each register class contains sets of
-   registers that have the same properties (for example, they are all 32-bit
-   integer registers).  Each SSA virtual register created by the instruction
-   selector has an associated register class.  When the register allocator runs,
-   it replaces virtual registers with a physical register in the set.</p>
-
-<p>The target-specific implementations of these classes is auto-generated from
-   a <a href="TableGenFundamentals.html">TableGen</a> description of the
-   register file.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="targetinstrinfo">The <tt>TargetInstrInfo</tt> class</a>
-</div>
-
-<div class="doc_text">
-
-<p>The <tt>TargetInstrInfo</tt> class is used to describe the machine
-   instructions supported by the target. It is essentially an array of
-   <tt>TargetInstrDescriptor</tt> objects, each of which describes one
-   instruction the target supports. Descriptors define things like the mnemonic
-   for the opcode, the number of operands, the list of implicit register uses
-   and defs, whether the instruction has certain target-independent properties
-   (accesses memory, is commutable, etc), and holds any target-specific
-   flags.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="targetframeinfo">The <tt>TargetFrameInfo</tt> class</a>
-</div>
-
-<div class="doc_text">
-
-<p>The <tt>TargetFrameInfo</tt> class is used to provide information about the
-   stack frame layout of the target. It holds the direction of stack growth, the
-   known stack alignment on entry to each function, and the offset to the local
-   area.  The offset to the local area is the offset from the stack pointer on
-   function entry to the first location where function data (local variables,
-   spill locations) can be stored.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="targetsubtarget">The <tt>TargetSubtarget</tt> class</a>
-</div>
-
-<div class="doc_text">
-
-<p>The <tt>TargetSubtarget</tt> class is used to provide information about the
-   specific chip set being targeted.  A sub-target informs code generation of
-   which instructions are supported, instruction latencies and instruction
-   execution itinerary; i.e., which processing units are used, in what order,
-   and for how long.</p>
-
-</div>
-
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="targetjitinfo">The <tt>TargetJITInfo</tt> class</a>
-</div>
-
-<div class="doc_text">
-
-<p>The <tt>TargetJITInfo</tt> class exposes an abstract interface used by the
-   Just-In-Time code generator to perform target-specific activities, such as
-   emitting stubs.  If a <tt>TargetMachine</tt> supports JIT code generation, it
-   should provide one of these objects through the <tt>getJITInfo</tt>
-   method.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="codegendesc">Machine code description classes</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>At the high-level, LLVM code is translated to a machine specific
-   representation formed out of
-   <a href="#machinefunction"><tt>MachineFunction</tt></a>,
-   <a href="#machinebasicblock"><tt>MachineBasicBlock</tt></a>,
-   and <a href="#machineinstr"><tt>MachineInstr</tt></a> instances (defined
-   in <tt>include/llvm/CodeGen</tt>).  This representation is completely target
-   agnostic, representing instructions in their most abstract form: an opcode
-   and a series of operands.  This representation is designed to support both an
-   SSA representation for machine code, as well as a register allocated, non-SSA
-   form.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="machineinstr">The <tt>MachineInstr</tt> class</a>
-</div>
-
-<div class="doc_text">
-
-<p>Target machine instructions are represented as instances of the
-   <tt>MachineInstr</tt> class.  This class is an extremely abstract way of
-   representing machine instructions.  In particular, it only keeps track of an
-   opcode number and a set of operands.</p>
-
-<p>The opcode number is a simple unsigned integer that only has meaning to a
-   specific backend.  All of the instructions for a target should be defined in
-   the <tt>*InstrInfo.td</tt> file for the target. The opcode enum values are
-   auto-generated from this description.  The <tt>MachineInstr</tt> class does
-   not have any information about how to interpret the instruction (i.e., what
-   the semantics of the instruction are); for that you must refer to the
-   <tt><a href="#targetinstrinfo">TargetInstrInfo</a></tt> class.</p> 
-
-<p>The operands of a machine instruction can be of several different types: a
-   register reference, a constant integer, a basic block reference, etc.  In
-   addition, a machine operand should be marked as a def or a use of the value
-   (though only registers are allowed to be defs).</p>
-
-<p>By convention, the LLVM code generator orders instruction operands so that
-   all register definitions come before the register uses, even on architectures
-   that are normally printed in other orders.  For example, the SPARC add
-   instruction: "<tt>add %i1, %i2, %i3</tt>" adds the "%i1", and "%i2" registers
-   and stores the result into the "%i3" register.  In the LLVM code generator,
-   the operands should be stored as "<tt>%i3, %i1, %i2</tt>": with the
-   destination first.</p>
-
-<p>Keeping destination (definition) operands at the beginning of the operand
-   list has several advantages.  In particular, the debugging printer will print
-   the instruction like this:</p>
-
-<div class="doc_code">
-<pre>
-%r3 = add %i1, %i2
-</pre>
-</div>
-
-<p>Also if the first operand is a def, it is easier to <a href="#buildmi">create
-   instructions</a> whose only def is the first operand.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="buildmi">Using the <tt>MachineInstrBuilder.h</tt> functions</a>
-</div>
-
-<div class="doc_text">
-
-<p>Machine instructions are created by using the <tt>BuildMI</tt> functions,
-   located in the <tt>include/llvm/CodeGen/MachineInstrBuilder.h</tt> file.  The
-   <tt>BuildMI</tt> functions make it easy to build arbitrary machine
-   instructions.  Usage of the <tt>BuildMI</tt> functions look like this:</p>
-
-<div class="doc_code">
-<pre>
-// Create a 'DestReg = mov 42' (rendered in X86 assembly as 'mov DestReg, 42')
-// instruction.  The '1' specifies how many operands will be added.
-MachineInstr *MI = BuildMI(X86::MOV32ri, 1, DestReg).addImm(42);
-
-// Create the same instr, but insert it at the end of a basic block.
-MachineBasicBlock &amp;MBB = ...
-BuildMI(MBB, X86::MOV32ri, 1, DestReg).addImm(42);
-
-// Create the same instr, but insert it before a specified iterator point.
-MachineBasicBlock::iterator MBBI = ...
-BuildMI(MBB, MBBI, X86::MOV32ri, 1, DestReg).addImm(42);
-
-// Create a 'cmp Reg, 0' instruction, no destination reg.
-MI = BuildMI(X86::CMP32ri, 2).addReg(Reg).addImm(0);
-// Create an 'sahf' instruction which takes no operands and stores nothing.
-MI = BuildMI(X86::SAHF, 0);
-
-// Create a self looping branch instruction.
-BuildMI(MBB, X86::JNE, 1).addMBB(&amp;MBB);
-</pre>
-</div>
-
-<p>The key thing to remember with the <tt>BuildMI</tt> functions is that you
-   have to specify the number of operands that the machine instruction will
-   take.  This allows for efficient memory allocation.  You also need to specify
-   if operands default to be uses of values, not definitions.  If you need to
-   add a definition operand (other than the optional destination register), you
-   must explicitly mark it as such:</p>
-
-<div class="doc_code">
-<pre>
-MI.addReg(Reg, RegState::Define);
-</pre>
-</div>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="fixedregs">Fixed (preassigned) registers</a>
-</div>
-
-<div class="doc_text">
-
-<p>One important issue that the code generator needs to be aware of is the
-   presence of fixed registers.  In particular, there are often places in the
-   instruction stream where the register allocator <em>must</em> arrange for a
-   particular value to be in a particular register.  This can occur due to
-   limitations of the instruction set (e.g., the X86 can only do a 32-bit divide
-   with the <tt>EAX</tt>/<tt>EDX</tt> registers), or external factors like
-   calling conventions.  In any case, the instruction selector should emit code
-   that copies a virtual register into or out of a physical register when
-   needed.</p>
-
-<p>For example, consider this simple LLVM example:</p>
-
-<div class="doc_code">
-<pre>
-define i32 @test(i32 %X, i32 %Y) {
-  %Z = udiv i32 %X, %Y
-  ret i32 %Z
-}
-</pre>
-</div>
-
-<p>The X86 instruction selector produces this machine code for the <tt>div</tt>
-   and <tt>ret</tt> (use "<tt>llc X.bc -march=x86 -print-machineinstrs</tt>" to
-   get this):</p>
-
-<div class="doc_code">
-<pre>
-;; Start of div
-%EAX = mov %reg1024           ;; Copy X (in reg1024) into EAX
-%reg1027 = sar %reg1024, 31
-%EDX = mov %reg1027           ;; Sign extend X into EDX
-idiv %reg1025                 ;; Divide by Y (in reg1025)
-%reg1026 = mov %EAX           ;; Read the result (Z) out of EAX
-
-;; Start of ret
-%EAX = mov %reg1026           ;; 32-bit return value goes in EAX
-ret
-</pre>
-</div>
-
-<p>By the end of code generation, the register allocator has coalesced the
-   registers and deleted the resultant identity moves producing the following
-   code:</p>
-
-<div class="doc_code">
-<pre>
-;; X is in EAX, Y is in ECX
-mov %EAX, %EDX
-sar %EDX, 31
-idiv %ECX
-ret 
-</pre>
-</div>
-
-<p>This approach is extremely general (if it can handle the X86 architecture, it
-   can handle anything!) and allows all of the target specific knowledge about
-   the instruction stream to be isolated in the instruction selector.  Note that
-   physical registers should have a short lifetime for good code generation, and
-   all physical registers are assumed dead on entry to and exit from basic
-   blocks (before register allocation).  Thus, if you need a value to be live
-   across basic block boundaries, it <em>must</em> live in a virtual
-   register.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="ssa">Machine code in SSA form</a>
-</div>
-
-<div class="doc_text">
-
-<p><tt>MachineInstr</tt>'s are initially selected in SSA-form, and are
-   maintained in SSA-form until register allocation happens.  For the most part,
-   this is trivially simple since LLVM is already in SSA form; LLVM PHI nodes
-   become machine code PHI nodes, and virtual registers are only allowed to have
-   a single definition.</p>
-
-<p>After register allocation, machine code is no longer in SSA-form because
-   there are no virtual registers left in the code.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="machinebasicblock">The <tt>MachineBasicBlock</tt> class</a>
-</div>
-
-<div class="doc_text">
-
-<p>The <tt>MachineBasicBlock</tt> class contains a list of machine instructions
-   (<tt><a href="#machineinstr">MachineInstr</a></tt> instances).  It roughly
-   corresponds to the LLVM code input to the instruction selector, but there can
-   be a one-to-many mapping (i.e. one LLVM basic block can map to multiple
-   machine basic blocks). The <tt>MachineBasicBlock</tt> class has a
-   "<tt>getBasicBlock</tt>" method, which returns the LLVM basic block that it
-   comes from.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="machinefunction">The <tt>MachineFunction</tt> class</a>
-</div>
-
-<div class="doc_text">
-
-<p>The <tt>MachineFunction</tt> class contains a list of machine basic blocks
-   (<tt><a href="#machinebasicblock">MachineBasicBlock</a></tt> instances).  It
-   corresponds one-to-one with the LLVM function input to the instruction
-   selector.  In addition to a list of basic blocks,
-   the <tt>MachineFunction</tt> contains a a <tt>MachineConstantPool</tt>,
-   a <tt>MachineFrameInfo</tt>, a <tt>MachineFunctionInfo</tt>, and a
-   <tt>MachineRegisterInfo</tt>.  See
-   <tt>include/llvm/CodeGen/MachineFunction.h</tt> for more information.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="codegenalgs">Target-independent code generation algorithms</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>This section documents the phases described in the
-   <a href="#high-level-design">high-level design of the code generator</a>.
-   It explains how they work and some of the rationale behind their design.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="instselect">Instruction Selection</a>
-</div>
-
-<div class="doc_text">
-
-<p>Instruction Selection is the process of translating LLVM code presented to
-   the code generator into target-specific machine instructions.  There are
-   several well-known ways to do this in the literature.  LLVM uses a
-   SelectionDAG based instruction selector.</p>
-
-<p>Portions of the DAG instruction selector are generated from the target
-   description (<tt>*.td</tt>) files.  Our goal is for the entire instruction
-   selector to be generated from these <tt>.td</tt> files, though currently
-   there are still things that require custom C++ code.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="selectiondag_intro">Introduction to SelectionDAGs</a>
-</div>
-
-<div class="doc_text">
-
-<p>The SelectionDAG provides an abstraction for code representation in a way
-   that is amenable to instruction selection using automatic techniques
-   (e.g. dynamic-programming based optimal pattern matching selectors). It is
-   also well-suited to other phases of code generation; in particular,
-   instruction scheduling (SelectionDAG's are very close to scheduling DAGs
-   post-selection).  Additionally, the SelectionDAG provides a host
-   representation where a large variety of very-low-level (but
-   target-independent) <a href="#selectiondag_optimize">optimizations</a> may be
-   performed; ones which require extensive information about the instructions
-   efficiently supported by the target.</p>
-
-<p>The SelectionDAG is a Directed-Acyclic-Graph whose nodes are instances of the
-   <tt>SDNode</tt> class.  The primary payload of the <tt>SDNode</tt> is its
-   operation code (Opcode) that indicates what operation the node performs and
-   the operands to the operation.  The various operation node types are
-   described at the top of the <tt>include/llvm/CodeGen/SelectionDAGNodes.h</tt>
-   file.</p>
-
-<p>Although most operations define a single value, each node in the graph may
-   define multiple values.  For example, a combined div/rem operation will
-   define both the dividend and the remainder. Many other situations require
-   multiple values as well.  Each node also has some number of operands, which
-   are edges to the node defining the used value.  Because nodes may define
-   multiple values, edges are represented by instances of the <tt>SDValue</tt>
-   class, which is a <tt>&lt;SDNode, unsigned&gt;</tt> pair, indicating the node
-   and result value being used, respectively.  Each value produced by
-   an <tt>SDNode</tt> has an associated <tt>MVT</tt> (Machine Value Type)
-   indicating what the type of the value is.</p>
-
-<p>SelectionDAGs contain two different kinds of values: those that represent
-   data flow and those that represent control flow dependencies.  Data values
-   are simple edges with an integer or floating point value type.  Control edges
-   are represented as "chain" edges which are of type <tt>MVT::Other</tt>.
-   These edges provide an ordering between nodes that have side effects (such as
-   loads, stores, calls, returns, etc).  All nodes that have side effects should
-   take a token chain as input and produce a new one as output.  By convention,
-   token chain inputs are always operand #0, and chain results are always the
-   last value produced by an operation.</p>
-
-<p>A SelectionDAG has designated "Entry" and "Root" nodes.  The Entry node is
-   always a marker node with an Opcode of <tt>ISD::EntryToken</tt>.  The Root
-   node is the final side-effecting node in the token chain. For example, in a
-   single basic block function it would be the return node.</p>
-
-<p>One important concept for SelectionDAGs is the notion of a "legal" vs.
-   "illegal" DAG.  A legal DAG for a target is one that only uses supported
-   operations and supported types.  On a 32-bit PowerPC, for example, a DAG with
-   a value of type i1, i8, i16, or i64 would be illegal, as would a DAG that
-   uses a SREM or UREM operation.  The
-   <a href="#selectinodag_legalize_types">legalize types</a> and
-   <a href="#selectiondag_legalize">legalize operations</a> phases are
-   responsible for turning an illegal DAG into a legal DAG.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="selectiondag_process">SelectionDAG Instruction Selection Process</a>
-</div>
-
-<div class="doc_text">
-
-<p>SelectionDAG-based instruction selection consists of the following steps:</p>
-
-<ol>
-  <li><a href="#selectiondag_build">Build initial DAG</a> &mdash; This stage
-      performs a simple translation from the input LLVM code to an illegal
-      SelectionDAG.</li>
-
-  <li><a href="#selectiondag_optimize">Optimize SelectionDAG</a> &mdash; This
-      stage performs simple optimizations on the SelectionDAG to simplify it,
-      and recognize meta instructions (like rotates
-      and <tt>div</tt>/<tt>rem</tt> pairs) for targets that support these meta
-      operations.  This makes the resultant code more efficient and
-      the <a href="#selectiondag_select">select instructions from DAG</a> phase
-      (below) simpler.</li>
-
-  <li><a href="#selectiondag_legalize_types">Legalize SelectionDAG Types</a>
-      &mdash; This stage transforms SelectionDAG nodes to eliminate any types
-      that are unsupported on the target.</li>
-
-  <li><a href="#selectiondag_optimize">Optimize SelectionDAG</a> &mdash; The
-      SelectionDAG optimizer is run to clean up redundancies exposed by type
-      legalization.</li>
-
-  <li><a href="#selectiondag_legalize">Legalize SelectionDAG Types</a> &mdash;
-      This stage transforms SelectionDAG nodes to eliminate any types that are
-      unsupported on the target.</li>
-
-  <li><a href="#selectiondag_optimize">Optimize SelectionDAG</a> &mdash; The
-      SelectionDAG optimizer is run to eliminate inefficiencies introduced by
-      operation legalization.</li>
-
-  <li><a href="#selectiondag_select">Select instructions from DAG</a> &mdash;
-      Finally, the target instruction selector matches the DAG operations to
-      target instructions.  This process translates the target-independent input
-      DAG into another DAG of target instructions.</li>
-
-  <li><a href="#selectiondag_sched">SelectionDAG Scheduling and Formation</a>
-      &mdash; The last phase assigns a linear order to the instructions in the
-      target-instruction DAG and emits them into the MachineFunction being
-      compiled.  This step uses traditional prepass scheduling techniques.</li>
-</ol>
-
-<p>After all of these steps are complete, the SelectionDAG is destroyed and the
-   rest of the code generation passes are run.</p>
-
-<p>One great way to visualize what is going on here is to take advantage of a
-   few LLC command line options.  The following options pop up a window
-   displaying the SelectionDAG at specific times (if you only get errors printed
-   to the console while using this, you probably
-   <a href="ProgrammersManual.html#ViewGraph">need to configure your system</a>
-   to add support for it).</p>
-
-<ul>
-  <li><tt>-view-dag-combine1-dags</tt> displays the DAG after being built,
-      before the first optimization pass.</li>
-
-  <li><tt>-view-legalize-dags</tt> displays the DAG before Legalization.</li>
-
-  <li><tt>-view-dag-combine2-dags</tt> displays the DAG before the second
-      optimization pass.</li>
-
-  <li><tt>-view-isel-dags</tt> displays the DAG before the Select phase.</li>
-
-  <li><tt>-view-sched-dags</tt> displays the DAG before Scheduling.</li>
-</ul>
-
-<p>The <tt>-view-sunit-dags</tt> displays the Scheduler's dependency graph.
-   This graph is based on the final SelectionDAG, with nodes that must be
-   scheduled together bundled into a single scheduling-unit node, and with
-   immediate operands and other nodes that aren't relevant for scheduling
-   omitted.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="selectiondag_build">Initial SelectionDAG Construction</a>
-</div>
-
-<div class="doc_text">
-
-<p>The initial SelectionDAG is na&iuml;vely peephole expanded from the LLVM
-   input by the <tt>SelectionDAGLowering</tt> class in the
-   <tt>lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp</tt> file.  The intent of
-   this pass is to expose as much low-level, target-specific details to the
-   SelectionDAG as possible.  This pass is mostly hard-coded (e.g. an
-   LLVM <tt>add</tt> turns into an <tt>SDNode add</tt> while a
-   <tt>getelementptr</tt> is expanded into the obvious arithmetic). This pass
-   requires target-specific hooks to lower calls, returns, varargs, etc.  For
-   these features, the <tt><a href="#targetlowering">TargetLowering</a></tt>
-   interface is used.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="selectiondag_legalize_types">SelectionDAG LegalizeTypes Phase</a>
-</div>
-
-<div class="doc_text">
-
-<p>The Legalize phase is in charge of converting a DAG to only use the types
-   that are natively supported by the target.</p>
-
-<p>There are two main ways of converting values of unsupported scalar types to
-   values of supported types: converting small types to larger types
-   ("promoting"), and breaking up large integer types into smaller ones
-   ("expanding").  For example, a target might require that all f32 values are
-   promoted to f64 and that all i1/i8/i16 values are promoted to i32.  The same
-   target might require that all i64 values be expanded into pairs of i32
-   values.  These changes can insert sign and zero extensions as needed to make
-   sure that the final code has the same behavior as the input.</p>
-
-<p>There are two main ways of converting values of unsupported vector types to
-   value of supported types: splitting vector types, multiple times if
-   necessary, until a legal type is found, and extending vector types by adding
-   elements to the end to round them out to legal types ("widening").  If a
-   vector gets split all the way down to single-element parts with no supported
-   vector type being found, the elements are converted to scalars
-   ("scalarizing").</p>
-
-<p>A target implementation tells the legalizer which types are supported (and
-   which register class to use for them) by calling the
-   <tt>addRegisterClass</tt> method in its TargetLowering constructor.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="selectiondag_legalize">SelectionDAG Legalize Phase</a>
-</div>
-
-<div class="doc_text">
-
-<p>The Legalize phase is in charge of converting a DAG to only use the
-   operations that are natively supported by the target.</p>
-
-<p>Targets often have weird constraints, such as not supporting every operation
-   on every supported datatype (e.g. X86 does not support byte conditional moves
-   and PowerPC does not support sign-extending loads from a 16-bit memory
-   location).  Legalize takes care of this by open-coding another sequence of
-   operations to emulate the operation ("expansion"), by promoting one type to a
-   larger type that supports the operation ("promotion"), or by using a
-   target-specific hook to implement the legalization ("custom").</p>
-
-<p>A target implementation tells the legalizer which operations are not
-   supported (and which of the above three actions to take) by calling the
-   <tt>setOperationAction</tt> method in its <tt>TargetLowering</tt>
-   constructor.</p>
-
-<p>Prior to the existence of the Legalize passes, we required that every target
-   <a href="#selectiondag_optimize">selector</a> supported and handled every
-   operator and type even if they are not natively supported.  The introduction
-   of the Legalize phases allows all of the canonicalization patterns to be
-   shared across targets, and makes it very easy to optimize the canonicalized
-   code because it is still in the form of a DAG.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="selectiondag_optimize">SelectionDAG Optimization Phase: the DAG
-  Combiner</a>
-</div>
-
-<div class="doc_text">
-
-<p>The SelectionDAG optimization phase is run multiple times for code
-   generation, immediately after the DAG is built and once after each
-   legalization.  The first run of the pass allows the initial code to be
-   cleaned up (e.g. performing optimizations that depend on knowing that the
-   operators have restricted type inputs).  Subsequent runs of the pass clean up
-   the messy code generated by the Legalize passes, which allows Legalize to be
-   very simple (it can focus on making code legal instead of focusing on
-   generating <em>good</em> and legal code).</p>
-
-<p>One important class of optimizations performed is optimizing inserted sign
-   and zero extension instructions.  We currently use ad-hoc techniques, but
-   could move to more rigorous techniques in the future.  Here are some good
-   papers on the subject:</p>
-
-<p>"<a href="http://www.eecs.harvard.edu/~nr/pubs/widen-abstract.html">Widening
-   integer arithmetic</a>"<br>
-   Kevin Redwine and Norman Ramsey<br>
-   International Conference on Compiler Construction (CC) 2004</p>
-
-<p>"<a href="http://portal.acm.org/citation.cfm?doid=512529.512552">Effective
-   sign extension elimination</a>"<br>
-   Motohiro Kawahito, Hideaki Komatsu, and Toshio Nakatani<br>
-   Proceedings of the ACM SIGPLAN 2002 Conference on Programming Language Design
-   and Implementation.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="selectiondag_select">SelectionDAG Select Phase</a>
-</div>
-
-<div class="doc_text">
-
-<p>The Select phase is the bulk of the target-specific code for instruction
-   selection.  This phase takes a legal SelectionDAG as input, pattern matches
-   the instructions supported by the target to this DAG, and produces a new DAG
-   of target code.  For example, consider the following LLVM fragment:</p>
-
-<div class="doc_code">
-<pre>
-%t1 = add float %W, %X
-%t2 = mul float %t1, %Y
-%t3 = add float %t2, %Z
-</pre>
-</div>
-
-<p>This LLVM code corresponds to a SelectionDAG that looks basically like
-   this:</p>
-
-<div class="doc_code">
-<pre>
-(fadd:f32 (fmul:f32 (fadd:f32 W, X), Y), Z)
-</pre>
-</div>
-
-<p>If a target supports floating point multiply-and-add (FMA) operations, one of
-   the adds can be merged with the multiply.  On the PowerPC, for example, the
-   output of the instruction selector might look like this DAG:</p>
-
-<div class="doc_code">
-<pre>
-(FMADDS (FADDS W, X), Y, Z)
-</pre>
-</div>
-
-<p>The <tt>FMADDS</tt> instruction is a ternary instruction that multiplies its
-first two operands and adds the third (as single-precision floating-point
-numbers).  The <tt>FADDS</tt> instruction is a simple binary single-precision
-add instruction.  To perform this pattern match, the PowerPC backend includes
-the following instruction definitions:</p>
-
-<div class="doc_code">
-<pre>
-def FMADDS : AForm_1&lt;59, 29,
-                    (ops F4RC:$FRT, F4RC:$FRA, F4RC:$FRC, F4RC:$FRB),
-                    "fmadds $FRT, $FRA, $FRC, $FRB",
-                    [<b>(set F4RC:$FRT, (fadd (fmul F4RC:$FRA, F4RC:$FRC),
-                                           F4RC:$FRB))</b>]&gt;;
-def FADDS : AForm_2&lt;59, 21,
-                    (ops F4RC:$FRT, F4RC:$FRA, F4RC:$FRB),
-                    "fadds $FRT, $FRA, $FRB",
-                    [<b>(set F4RC:$FRT, (fadd F4RC:$FRA, F4RC:$FRB))</b>]&gt;;
-</pre>
-</div>
-
-<p>The portion of the instruction definition in bold indicates the pattern used
-   to match the instruction.  The DAG operators
-   (like <tt>fmul</tt>/<tt>fadd</tt>) are defined in
-   the <tt>lib/Target/TargetSelectionDAG.td</tt> file.  "<tt>F4RC</tt>" is the
-   register class of the input and result values.</p>
-
-<p>The TableGen DAG instruction selector generator reads the instruction
-   patterns in the <tt>.td</tt> file and automatically builds parts of the
-   pattern matching code for your target.  It has the following strengths:</p>
-
-<ul>
-  <li>At compiler-compiler time, it analyzes your instruction patterns and tells
-      you if your patterns make sense or not.</li>
-
-  <li>It can handle arbitrary constraints on operands for the pattern match.  In
-      particular, it is straight-forward to say things like "match any immediate
-      that is a 13-bit sign-extended value".  For examples, see the
-      <tt>immSExt16</tt> and related <tt>tblgen</tt> classes in the PowerPC
-      backend.</li>
-
-  <li>It knows several important identities for the patterns defined.  For
-      example, it knows that addition is commutative, so it allows the
-      <tt>FMADDS</tt> pattern above to match "<tt>(fadd X, (fmul Y, Z))</tt>" as
-      well as "<tt>(fadd (fmul X, Y), Z)</tt>", without the target author having
-      to specially handle this case.</li>
-
-  <li>It has a full-featured type-inferencing system.  In particular, you should
-      rarely have to explicitly tell the system what type parts of your patterns
-      are.  In the <tt>FMADDS</tt> case above, we didn't have to tell
-      <tt>tblgen</tt> that all of the nodes in the pattern are of type 'f32'.
-      It was able to infer and propagate this knowledge from the fact that
-      <tt>F4RC</tt> has type 'f32'.</li>
-
-  <li>Targets can define their own (and rely on built-in) "pattern fragments".
-      Pattern fragments are chunks of reusable patterns that get inlined into
-      your patterns during compiler-compiler time.  For example, the integer
-      "<tt>(not x)</tt>" operation is actually defined as a pattern fragment
-      that expands as "<tt>(xor x, -1)</tt>", since the SelectionDAG does not
-      have a native '<tt>not</tt>' operation.  Targets can define their own
-      short-hand fragments as they see fit.  See the definition of
-      '<tt>not</tt>' and '<tt>ineg</tt>' for examples.</li>
-
-  <li>In addition to instructions, targets can specify arbitrary patterns that
-      map to one or more instructions using the 'Pat' class.  For example, the
-      PowerPC has no way to load an arbitrary integer immediate into a register
-      in one instruction. To tell tblgen how to do this, it defines:
-      <br>
-      <br>
-<div class="doc_code">
-<pre>
-// Arbitrary immediate support.  Implement in terms of LIS/ORI.
-def : Pat&lt;(i32 imm:$imm),
-          (ORI (LIS (HI16 imm:$imm)), (LO16 imm:$imm))&gt;;
-</pre>
-</div>
-      <br>
-      If none of the single-instruction patterns for loading an immediate into a
-      register match, this will be used.  This rule says "match an arbitrary i32
-      immediate, turning it into an <tt>ORI</tt> ('or a 16-bit immediate') and
-      an <tt>LIS</tt> ('load 16-bit immediate, where the immediate is shifted to
-      the left 16 bits') instruction".  To make this work, the
-      <tt>LO16</tt>/<tt>HI16</tt> node transformations are used to manipulate
-      the input immediate (in this case, take the high or low 16-bits of the
-      immediate).</li>
-
-  <li>While the system does automate a lot, it still allows you to write custom
-      C++ code to match special cases if there is something that is hard to
-      express.</li>
-</ul>
-
-<p>While it has many strengths, the system currently has some limitations,
-   primarily because it is a work in progress and is not yet finished:</p>
-
-<ul>
-  <li>Overall, there is no way to define or match SelectionDAG nodes that define
-      multiple values (e.g. <tt>SMUL_LOHI</tt>, <tt>LOAD</tt>, <tt>CALL</tt>,
-      etc).  This is the biggest reason that you currently still <em>have
-      to</em> write custom C++ code for your instruction selector.</li>
-
-  <li>There is no great way to support matching complex addressing modes yet.
-      In the future, we will extend pattern fragments to allow them to define
-      multiple values (e.g. the four operands of the <a href="#x86_memory">X86
-      addressing mode</a>, which are currently matched with custom C++ code).
-      In addition, we'll extend fragments so that a fragment can match multiple
-      different patterns.</li>
-
-  <li>We don't automatically infer flags like isStore/isLoad yet.</li>
-
-  <li>We don't automatically generate the set of supported registers and
-      operations for the <a href="#selectiondag_legalize">Legalizer</a>
-      yet.</li>
-
-  <li>We don't have a way of tying in custom legalized nodes yet.</li>
-</ul>
-
-<p>Despite these limitations, the instruction selector generator is still quite
-   useful for most of the binary and logical operations in typical instruction
-   sets.  If you run into any problems or can't figure out how to do something,
-   please let Chris know!</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="selectiondag_sched">SelectionDAG Scheduling and Formation Phase</a>
-</div>
-
-<div class="doc_text">
-
-<p>The scheduling phase takes the DAG of target instructions from the selection
-   phase and assigns an order.  The scheduler can pick an order depending on
-   various constraints of the machines (i.e. order for minimal register pressure
-   or try to cover instruction latencies).  Once an order is established, the
-   DAG is converted to a list
-   of <tt><a href="#machineinstr">MachineInstr</a></tt>s and the SelectionDAG is
-   destroyed.</p>
-
-<p>Note that this phase is logically separate from the instruction selection
-   phase, but is tied to it closely in the code because it operates on
-   SelectionDAGs.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="selectiondag_future">Future directions for the SelectionDAG</a>
-</div>
-
-<div class="doc_text">
-
-<ol>
-  <li>Optional function-at-a-time selection.</li>
-
-  <li>Auto-generate entire selector from <tt>.td</tt> file.</li>
-</ol>
-
-</div>
- 
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="ssamco">SSA-based Machine Code Optimizations</a>
-</div>
-<div class="doc_text"><p>To Be Written</p></div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="liveintervals">Live Intervals</a>
-</div>
-
-<div class="doc_text">
-
-<p>Live Intervals are the ranges (intervals) where a variable is <i>live</i>.
-   They are used by some <a href="#regalloc">register allocator</a> passes to
-   determine if two or more virtual registers which require the same physical
-   register are live at the same point in the program (i.e., they conflict).
-   When this situation occurs, one virtual register must be <i>spilled</i>.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="livevariable_analysis">Live Variable Analysis</a>
-</div>
-
-<div class="doc_text">
-
-<p>The first step in determining the live intervals of variables is to calculate
-   the set of registers that are immediately dead after the instruction (i.e.,
-   the instruction calculates the value, but it is never used) and the set of
-   registers that are used by the instruction, but are never used after the
-   instruction (i.e., they are killed). Live variable information is computed
-   for each <i>virtual</i> register and <i>register allocatable</i> physical
-   register in the function.  This is done in a very efficient manner because it
-   uses SSA to sparsely compute lifetime information for virtual registers
-   (which are in SSA form) and only has to track physical registers within a
-   block.  Before register allocation, LLVM can assume that physical registers
-   are only live within a single basic block.  This allows it to do a single,
-   local analysis to resolve physical register lifetimes within each basic
-   block. If a physical register is not register allocatable (e.g., a stack
-   pointer or condition codes), it is not tracked.</p>
-
-<p>Physical registers may be live in to or out of a function. Live in values are
-   typically arguments in registers. Live out values are typically return values
-   in registers. Live in values are marked as such, and are given a dummy
-   "defining" instruction during live intervals analysis. If the last basic
-   block of a function is a <tt>return</tt>, then it's marked as using all live
-   out values in the function.</p>
-
-<p><tt>PHI</tt> nodes need to be handled specially, because the calculation of
-   the live variable information from a depth first traversal of the CFG of the
-   function won't guarantee that a virtual register used by the <tt>PHI</tt>
-   node is defined before it's used. When a <tt>PHI</tt> node is encountered,
-   only the definition is handled, because the uses will be handled in other
-   basic blocks.</p>
-
-<p>For each <tt>PHI</tt> node of the current basic block, we simulate an
-   assignment at the end of the current basic block and traverse the successor
-   basic blocks. If a successor basic block has a <tt>PHI</tt> node and one of
-   the <tt>PHI</tt> node's operands is coming from the current basic block, then
-   the variable is marked as <i>alive</i> within the current basic block and all
-   of its predecessor basic blocks, until the basic block with the defining
-   instruction is encountered.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="liveintervals_analysis">Live Intervals Analysis</a>
-</div>
-
-<div class="doc_text">
-
-<p>We now have the information available to perform the live intervals analysis
-   and build the live intervals themselves.  We start off by numbering the basic
-   blocks and machine instructions.  We then handle the "live-in" values.  These
-   are in physical registers, so the physical register is assumed to be killed
-   by the end of the basic block.  Live intervals for virtual registers are
-   computed for some ordering of the machine instructions <tt>[1, N]</tt>.  A
-   live interval is an interval <tt>[i, j)</tt>, where <tt>1 &lt;= i &lt;= j
-   &lt; N</tt>, for which a variable is live.</p>
-
-<p><i><b>More to come...</b></i></p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="regalloc">Register Allocation</a>
-</div>
-
-<div class="doc_text">
-
-<p>The <i>Register Allocation problem</i> consists in mapping a program
-   <i>P<sub>v</sub></i>, that can use an unbounded number of virtual registers,
-   to a program <i>P<sub>p</sub></i> that contains a finite (possibly small)
-   number of physical registers. Each target architecture has a different number
-   of physical registers. If the number of physical registers is not enough to
-   accommodate all the virtual registers, some of them will have to be mapped
-   into memory. These virtuals are called <i>spilled virtuals</i>.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-
-<div class="doc_subsubsection">
-  <a name="regAlloc_represent">How registers are represented in LLVM</a>
-</div>
-
-<div class="doc_text">
-
-<p>In LLVM, physical registers are denoted by integer numbers that normally
-   range from 1 to 1023. To see how this numbering is defined for a particular
-   architecture, you can read the <tt>GenRegisterNames.inc</tt> file for that
-   architecture. For instance, by
-   inspecting <tt>lib/Target/X86/X86GenRegisterNames.inc</tt> we see that the
-   32-bit register <tt>EAX</tt> is denoted by 15, and the MMX register
-   <tt>MM0</tt> is mapped to 48.</p>
-
-<p>Some architectures contain registers that share the same physical location. A
-   notable example is the X86 platform. For instance, in the X86 architecture,
-   the registers <tt>EAX</tt>, <tt>AX</tt> and <tt>AL</tt> share the first eight
-   bits. These physical registers are marked as <i>aliased</i> in LLVM. Given a
-   particular architecture, you can check which registers are aliased by
-   inspecting its <tt>RegisterInfo.td</tt> file. Moreover, the method
-   <tt>TargetRegisterInfo::getAliasSet(p_reg)</tt> returns an array containing
-   all the physical registers aliased to the register <tt>p_reg</tt>.</p>
-
-<p>Physical registers, in LLVM, are grouped in <i>Register Classes</i>.
-   Elements in the same register class are functionally equivalent, and can be
-   interchangeably used. Each virtual register can only be mapped to physical
-   registers of a particular class. For instance, in the X86 architecture, some
-   virtuals can only be allocated to 8 bit registers.  A register class is
-   described by <tt>TargetRegisterClass</tt> objects.  To discover if a virtual
-   register is compatible with a given physical, this code can be used:</p>
-
-<div class="doc_code">
-<pre>
-bool RegMapping_Fer::compatible_class(MachineFunction &amp;mf,
-                                      unsigned v_reg,
-                                      unsigned p_reg) {
-  assert(TargetRegisterInfo::isPhysicalRegister(p_reg) &amp;&amp;
-         "Target register must be physical");
-  const TargetRegisterClass *trc = mf.getRegInfo().getRegClass(v_reg);
-  return trc-&gt;contains(p_reg);
-}
-</pre>
-</div>
-
-<p>Sometimes, mostly for debugging purposes, it is useful to change the number
-   of physical registers available in the target architecture. This must be done
-   statically, inside the <tt>TargetRegsterInfo.td</tt> file. Just <tt>grep</tt>
-   for <tt>RegisterClass</tt>, the last parameter of which is a list of
-   registers. Just commenting some out is one simple way to avoid them being
-   used. A more polite way is to explicitly exclude some registers from
-   the <i>allocation order</i>. See the definition of the <tt>GR8</tt> register
-   class in <tt>lib/Target/X86/X86RegisterInfo.td</tt> for an example of this.
-   </p>
-
-<p>Virtual registers are also denoted by integer numbers. Contrary to physical
-   registers, different virtual registers never share the same number. The
-   smallest virtual register is normally assigned the number 1024. This may
-   change, so, in order to know which is the first virtual register, you should
-   access <tt>TargetRegisterInfo::FirstVirtualRegister</tt>. Any register whose
-   number is greater than or equal
-   to <tt>TargetRegisterInfo::FirstVirtualRegister</tt> is considered a virtual
-   register. Whereas physical registers are statically defined in
-   a <tt>TargetRegisterInfo.td</tt> file and cannot be created by the
-   application developer, that is not the case with virtual registers.  In order
-   to create new virtual registers, use the
-   method <tt>MachineRegisterInfo::createVirtualRegister()</tt>. This method
-   will return a virtual register with the highest code.</p>
-
-<p>Before register allocation, the operands of an instruction are mostly virtual
-   registers, although physical registers may also be used. In order to check if
-   a given machine operand is a register, use the boolean
-   function <tt>MachineOperand::isRegister()</tt>. To obtain the integer code of
-   a register, use <tt>MachineOperand::getReg()</tt>. An instruction may define
-   or use a register. For instance, <tt>ADD reg:1026 := reg:1025 reg:1024</tt>
-   defines the registers 1024, and uses registers 1025 and 1026. Given a
-   register operand, the method <tt>MachineOperand::isUse()</tt> informs if that
-   register is being used by the instruction. The
-   method <tt>MachineOperand::isDef()</tt> informs if that registers is being
-   defined.</p>
-
-<p>We will call physical registers present in the LLVM bitcode before register
-   allocation <i>pre-colored registers</i>. Pre-colored registers are used in
-   many different situations, for instance, to pass parameters of functions
-   calls, and to store results of particular instructions. There are two types
-   of pre-colored registers: the ones <i>implicitly</i> defined, and
-   those <i>explicitly</i> defined. Explicitly defined registers are normal
-   operands, and can be accessed
-   with <tt>MachineInstr::getOperand(int)::getReg()</tt>.  In order to check
-   which registers are implicitly defined by an instruction, use
-   the <tt>TargetInstrInfo::get(opcode)::ImplicitDefs</tt>,
-   where <tt>opcode</tt> is the opcode of the target instruction. One important
-   difference between explicit and implicit physical registers is that the
-   latter are defined statically for each instruction, whereas the former may
-   vary depending on the program being compiled. For example, an instruction
-   that represents a function call will always implicitly define or use the same
-   set of physical registers. To read the registers implicitly used by an
-   instruction,
-   use <tt>TargetInstrInfo::get(opcode)::ImplicitUses</tt>. Pre-colored
-   registers impose constraints on any register allocation algorithm. The
-   register allocator must make sure that none of them is been overwritten by
-   the values of virtual registers while still alive.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-
-<div class="doc_subsubsection">
-  <a name="regAlloc_howTo">Mapping virtual registers to physical registers</a>
-</div>
-
-<div class="doc_text">
-
-<p>There are two ways to map virtual registers to physical registers (or to
-   memory slots). The first way, that we will call <i>direct mapping</i>, is
-   based on the use of methods of the classes <tt>TargetRegisterInfo</tt>,
-   and <tt>MachineOperand</tt>. The second way, that we will call <i>indirect
-   mapping</i>, relies on the <tt>VirtRegMap</tt> class in order to insert loads
-   and stores sending and getting values to and from memory.</p>
-
-<p>The direct mapping provides more flexibility to the developer of the register
-   allocator; however, it is more error prone, and demands more implementation
-   work.  Basically, the programmer will have to specify where load and store
-   instructions should be inserted in the target function being compiled in
-   order to get and store values in memory. To assign a physical register to a
-   virtual register present in a given operand,
-   use <tt>MachineOperand::setReg(p_reg)</tt>. To insert a store instruction,
-   use <tt>TargetRegisterInfo::storeRegToStackSlot(...)</tt>, and to insert a
-   load instruction, use <tt>TargetRegisterInfo::loadRegFromStackSlot</tt>.</p>
-
-<p>The indirect mapping shields the application developer from the complexities
-   of inserting load and store instructions. In order to map a virtual register
-   to a physical one, use <tt>VirtRegMap::assignVirt2Phys(vreg, preg)</tt>.  In
-   order to map a certain virtual register to memory,
-   use <tt>VirtRegMap::assignVirt2StackSlot(vreg)</tt>. This method will return
-   the stack slot where <tt>vreg</tt>'s value will be located.  If it is
-   necessary to map another virtual register to the same stack slot,
-   use <tt>VirtRegMap::assignVirt2StackSlot(vreg, stack_location)</tt>. One
-   important point to consider when using the indirect mapping, is that even if
-   a virtual register is mapped to memory, it still needs to be mapped to a
-   physical register. This physical register is the location where the virtual
-   register is supposed to be found before being stored or after being
-   reloaded.</p>
-
-<p>If the indirect strategy is used, after all the virtual registers have been
-   mapped to physical registers or stack slots, it is necessary to use a spiller
-   object to place load and store instructions in the code. Every virtual that
-   has been mapped to a stack slot will be stored to memory after been defined
-   and will be loaded before being used. The implementation of the spiller tries
-   to recycle load/store instructions, avoiding unnecessary instructions. For an
-   example of how to invoke the spiller,
-   see <tt>RegAllocLinearScan::runOnMachineFunction</tt>
-   in <tt>lib/CodeGen/RegAllocLinearScan.cpp</tt>.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="regAlloc_twoAddr">Handling two address instructions</a>
-</div>
-
-<div class="doc_text">
-
-<p>With very rare exceptions (e.g., function calls), the LLVM machine code
-   instructions are three address instructions. That is, each instruction is
-   expected to define at most one register, and to use at most two registers.
-   However, some architectures use two address instructions. In this case, the
-   defined register is also one of the used register. For instance, an
-   instruction such as <tt>ADD %EAX, %EBX</tt>, in X86 is actually equivalent
-   to <tt>%EAX = %EAX + %EBX</tt>.</p>
-
-<p>In order to produce correct code, LLVM must convert three address
-   instructions that represent two address instructions into true two address
-   instructions. LLVM provides the pass <tt>TwoAddressInstructionPass</tt> for
-   this specific purpose. It must be run before register allocation takes
-   place. After its execution, the resulting code may no longer be in SSA
-   form. This happens, for instance, in situations where an instruction such
-   as <tt>%a = ADD %b %c</tt> is converted to two instructions such as:</p>
-
-<div class="doc_code">
-<pre>
-%a = MOVE %b
-%a = ADD %a %c
-</pre>
-</div>
-
-<p>Notice that, internally, the second instruction is represented as
-   <tt>ADD %a[def/use] %c</tt>. I.e., the register operand <tt>%a</tt> is both
-   used and defined by the instruction.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="regAlloc_ssaDecon">The SSA deconstruction phase</a>
-</div>
-
-<div class="doc_text">
-
-<p>An important transformation that happens during register allocation is called
-   the <i>SSA Deconstruction Phase</i>. The SSA form simplifies many analyses
-   that are performed on the control flow graph of programs. However,
-   traditional instruction sets do not implement PHI instructions. Thus, in
-   order to generate executable code, compilers must replace PHI instructions
-   with other instructions that preserve their semantics.</p>
-
-<p>There are many ways in which PHI instructions can safely be removed from the
-   target code. The most traditional PHI deconstruction algorithm replaces PHI
-   instructions with copy instructions. That is the strategy adopted by
-   LLVM. The SSA deconstruction algorithm is implemented
-   in <tt>lib/CodeGen/PHIElimination.cpp</tt>. In order to invoke this pass, the
-   identifier <tt>PHIEliminationID</tt> must be marked as required in the code
-   of the register allocator.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="regAlloc_fold">Instruction folding</a>
-</div>
-
-<div class="doc_text">
-
-<p><i>Instruction folding</i> is an optimization performed during register
-   allocation that removes unnecessary copy instructions. For instance, a
-   sequence of instructions such as:</p>
-
-<div class="doc_code">
-<pre>
-%EBX = LOAD %mem_address
-%EAX = COPY %EBX
-</pre>
-</div>
-
-<p>can be safely substituted by the single instruction:</p>
-
-<div class="doc_code">
-<pre>
-%EAX = LOAD %mem_address
-</pre>
-</div>
-
-<p>Instructions can be folded with
-   the <tt>TargetRegisterInfo::foldMemoryOperand(...)</tt> method. Care must be
-   taken when folding instructions; a folded instruction can be quite different
-   from the original
-   instruction. See <tt>LiveIntervals::addIntervalsForSpills</tt>
-   in <tt>lib/CodeGen/LiveIntervalAnalysis.cpp</tt> for an example of its
-   use.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-
-<div class="doc_subsubsection">
-  <a name="regAlloc_builtIn">Built in register allocators</a>
-</div>
-
-<div class="doc_text">
-
-<p>The LLVM infrastructure provides the application developer with three
-   different register allocators:</p>
-
-<ul>
-  <li><i>Simple</i> &mdash; This is a very simple implementation that does not
-      keep values in registers across instructions. This register allocator
-      immediately spills every value right after it is computed, and reloads all
-      used operands from memory to temporary registers before each
-      instruction.</li>
-
-  <li><i>Local</i> &mdash; This register allocator is an improvement on the
-      <i>Simple</i> implementation. It allocates registers on a basic block
-      level, attempting to keep values in registers and reusing registers as
-      appropriate.</li>
-
-  <li><i>Linear Scan</i> &mdash; <i>The default allocator</i>. This is the
-      well-know linear scan register allocator. Whereas the
-      <i>Simple</i> and <i>Local</i> algorithms use a direct mapping
-      implementation technique, the <i>Linear Scan</i> implementation
-      uses a spiller in order to place load and stores.</li>
-</ul>
-
-<p>The type of register allocator used in <tt>llc</tt> can be chosen with the
-   command line option <tt>-regalloc=...</tt>:</p>
-
-<div class="doc_code">
-<pre>
-$ llc -regalloc=simple file.bc -o sp.s;
-$ llc -regalloc=local file.bc -o lc.s;
-$ llc -regalloc=linearscan file.bc -o ln.s;
-</pre>
-</div>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="proepicode">Prolog/Epilog Code Insertion</a>
-</div>
-<div class="doc_text"><p>To Be Written</p></div>
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="latemco">Late Machine Code Optimizations</a>
-</div>
-<div class="doc_text"><p>To Be Written</p></div>
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="codeemit">Code Emission</a>
-</div>
-<div class="doc_text"><p>To Be Written</p></div>
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="codeemit_asm">Generating Assembly Code</a>
-</div>
-<div class="doc_text"><p>To Be Written</p></div>
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="codeemit_bin">Generating Binary Machine Code</a>
-</div>
-
-<div class="doc_text">
-   <p>For the JIT or <tt>.o</tt> file writer</p>
-</div>
-
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="targetimpls">Target-specific Implementation Notes</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>This section of the document explains features or design decisions that are
-   specific to the code generator for a particular target.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="tailcallopt">Tail call optimization</a>
-</div>
-
-<div class="doc_text">
-
-<p>Tail call optimization, callee reusing the stack of the caller, is currently
-   supported on x86/x86-64 and PowerPC. It is performed if:</p>
-
-<ul>
-  <li>Caller and callee have the calling convention <tt>fastcc</tt>.</li>
-
-  <li>The call is a tail call - in tail position (ret immediately follows call
-      and ret uses value of call or is void).</li>
-
-  <li>Option <tt>-tailcallopt</tt> is enabled.</li>
-
-  <li>Platform specific constraints are met.</li>
-</ul>
-
-<p>x86/x86-64 constraints:</p>
-
-<ul>
-  <li>No variable argument lists are used.</li>
-
-  <li>On x86-64 when generating GOT/PIC code only module-local calls (visibility
-  = hidden or protected) are supported.</li>
-</ul>
-
-<p>PowerPC constraints:</p>
-
-<ul>
-  <li>No variable argument lists are used.</li>
-
-  <li>No byval parameters are used.</li>
-
-  <li>On ppc32/64 GOT/PIC only module-local calls (visibility = hidden or protected) are supported.</li>
-</ul>
-
-<p>Example:</p>
-
-<p>Call as <tt>llc -tailcallopt test.ll</tt>.</p>
-
-<div class="doc_code">
-<pre>
-declare fastcc i32 @tailcallee(i32 inreg %a1, i32 inreg %a2, i32 %a3, i32 %a4)
-
-define fastcc i32 @tailcaller(i32 %in1, i32 %in2) {
-  %l1 = add i32 %in1, %in2
-  %tmp = tail call fastcc i32 @tailcallee(i32 %in1 inreg, i32 %in2 inreg, i32 %in1, i32 %l1)
-  ret i32 %tmp
-}
-</pre>
-</div>
-
-<p>Implications of <tt>-tailcallopt</tt>:</p>
-
-<p>To support tail call optimization in situations where the callee has more
-   arguments than the caller a 'callee pops arguments' convention is used. This
-   currently causes each <tt>fastcc</tt> call that is not tail call optimized
-   (because one or more of above constraints are not met) to be followed by a
-   readjustment of the stack. So performance might be worse in such cases.</p>
-
-</div>
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="x86">The X86 backend</a>
-</div>
-
-<div class="doc_text">
-
-<p>The X86 code generator lives in the <tt>lib/Target/X86</tt> directory.  This
-   code generator is capable of targeting a variety of x86-32 and x86-64
-   processors, and includes support for ISA extensions such as MMX and SSE.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="x86_tt">X86 Target Triples supported</a>
-</div>
-
-<div class="doc_text">
-
-<p>The following are the known target triples that are supported by the X86
-   backend.  This is not an exhaustive list, and it would be useful to add those
-   that people test.</p>
-
-<ul>
-  <li><b>i686-pc-linux-gnu</b> &mdash; Linux</li>
-
-  <li><b>i386-unknown-freebsd5.3</b> &mdash; FreeBSD 5.3</li>
-
-  <li><b>i686-pc-cygwin</b> &mdash; Cygwin on Win32</li>
-
-  <li><b>i686-pc-mingw32</b> &mdash; MingW on Win32</li>
-
-  <li><b>i386-pc-mingw32msvc</b> &mdash; MingW crosscompiler on Linux</li>
-
-  <li><b>i686-apple-darwin*</b> &mdash; Apple Darwin on X86</li>
-
-  <li><b>x86_64-unknown-linux-gnu</b> &mdash; Linux</li>
-</ul>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="x86_cc">X86 Calling Conventions supported</a>
-</div>
-
-
-<div class="doc_text">
-
-<p>The following target-specific calling conventions are known to backend:</p>
-
-<ul>
-  <li><b>x86_StdCall</b> &mdash; stdcall calling convention seen on Microsoft
-      Windows platform (CC ID = 64).</li>
-
-  <li><b>x86_FastCall</b> &mdash; fastcall calling convention seen on Microsoft
-      Windows platform (CC ID = 65).</li>
-</ul>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="x86_memory">Representing X86 addressing modes in MachineInstrs</a>
-</div>
-
-<div class="doc_text">
-
-<p>The x86 has a very flexible way of accessing memory.  It is capable of
-   forming memory addresses of the following expression directly in integer
-   instructions (which use ModR/M addressing):</p>
-
-<div class="doc_code">
-<pre>
-SegmentReg: Base + [1,2,4,8] * IndexReg + Disp32
-</pre>
-</div>
-
-<p>In order to represent this, LLVM tracks no less than 5 operands for each
-   memory operand of this form.  This means that the "load" form of
-   '<tt>mov</tt>' has the following <tt>MachineOperand</tt>s in this order:</p>
-
-<div class="doc_code">
-<pre>
-Index:        0     |    1        2       3           4          5
-Meaning:   DestReg, | BaseReg,  Scale, IndexReg, Displacement Segment
-OperandTy: VirtReg, | VirtReg, UnsImm, VirtReg,   SignExtImm  PhysReg
-</pre>
-</div>
-
-<p>Stores, and all other instructions, treat the four memory operands in the
-   same way and in the same order.  If the segment register is unspecified
-   (regno = 0), then no segment override is generated.  "Lea" operations do not
-   have a segment register specified, so they only have 4 operands for their
-   memory reference.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="x86_memory">X86 address spaces supported</a>
-</div>
-
-<div class="doc_text">
-
-<p>x86 has an experimental feature which provides
-   the ability to perform loads and stores to different address spaces
-   via the x86 segment registers.  A segment override prefix byte on an
-   instruction causes the instruction's memory access to go to the specified
-   segment.  LLVM address space 0 is the default address space, which includes
-   the stack, and any unqualified memory accesses in a program.  Address spaces
-   1-255 are currently reserved for user-defined code.  The GS-segment is
-   represented by address space 256, while the FS-segment is represented by 
-   address space 257. Other x86 segments have yet to be allocated address space
-   numbers.</p>
-
-<p>While these address spaces may seem similar to TLS via the
-   <tt>thread_local</tt> keyword, and often use the same underlying hardware,
-   there are some fundamental differences.</p>
-
-<p>The <tt>thread_local</tt> keyword applies to global variables and
-   specifies that they are to be allocated in thread-local memory. There are
-   no type qualifiers involved, and these variables can be pointed to with
-   normal pointers and accessed with normal loads and stores.
-   The <tt>thread_local</tt> keyword is target-independent at the LLVM IR
-   level (though LLVM doesn't yet have implementations of it for some
-   configurations).<p>
-
-<p>Special address spaces, in contrast, apply to static types. Every
-   load and store has a particular address space in its address operand type,
-   and this is what determines which address space is accessed.
-   LLVM ignores these special address space qualifiers on global variables,
-   and does not provide a way to directly allocate storage in them.
-   At the LLVM IR level, the behavior of these special address spaces depends
-   in part on the underlying OS or runtime environment, and they are specific
-   to x86 (and LLVM doesn't yet handle them correctly in some cases).</p>
-
-<p>Some operating systems and runtime environments use (or may in the future
-   use) the FS/GS-segment registers for various low-level purposes, so care
-   should be taken when considering them.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="x86_names">Instruction naming</a>
-</div>
-
-<div class="doc_text">
-
-<p>An instruction name consists of the base name, a default operand size, and a
-   a character per operand with an optional special size. For example:</p>
-
-<div class="doc_code">
-<pre>
-ADD8rr      -&gt; add, 8-bit register, 8-bit register
-IMUL16rmi   -&gt; imul, 16-bit register, 16-bit memory, 16-bit immediate
-IMUL16rmi8  -&gt; imul, 16-bit register, 16-bit memory, 8-bit immediate
-MOVSX32rm16 -&gt; movsx, 32-bit register, 16-bit memory
-</pre>
-</div>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="ppc">The PowerPC backend</a>
-</div>
-
-<div class="doc_text">
-
-<p>The PowerPC code generator lives in the lib/Target/PowerPC directory.  The
-   code generation is retargetable to several variations or <i>subtargets</i> of
-   the PowerPC ISA; including ppc32, ppc64 and altivec.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="ppc_abi">LLVM PowerPC ABI</a>
-</div>
-
-<div class="doc_text">
-
-<p>LLVM follows the AIX PowerPC ABI, with two deviations. LLVM uses a PC
-   relative (PIC) or static addressing for accessing global values, so no TOC
-   (r2) is used. Second, r31 is used as a frame pointer to allow dynamic growth
-   of a stack frame.  LLVM takes advantage of having no TOC to provide space to
-   save the frame pointer in the PowerPC linkage area of the caller frame.
-   Other details of PowerPC ABI can be found at <a href=
-   "http://developer.apple.com/documentation/DeveloperTools/Conceptual/LowLevelABI/Articles/32bitPowerPC.html"
-   >PowerPC ABI.</a> Note: This link describes the 32 bit ABI.  The 64 bit ABI
-   is similar except space for GPRs are 8 bytes wide (not 4) and r13 is reserved
-   for system use.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="ppc_frame">Frame Layout</a>
-</div>
-
-<div class="doc_text">
-
-<p>The size of a PowerPC frame is usually fixed for the duration of a
-   function's invocation.  Since the frame is fixed size, all references
-   into the frame can be accessed via fixed offsets from the stack pointer.  The
-   exception to this is when dynamic alloca or variable sized arrays are
-   present, then a base pointer (r31) is used as a proxy for the stack pointer
-   and stack pointer is free to grow or shrink.  A base pointer is also used if
-   llvm-gcc is not passed the -fomit-frame-pointer flag. The stack pointer is
-   always aligned to 16 bytes, so that space allocated for altivec vectors will
-   be properly aligned.</p>
-
-<p>An invocation frame is laid out as follows (low memory at top);</p>
-
-<table class="layout">
-  <tr>
-    <td>Linkage<br><br></td>
-  </tr>
-  <tr>
-    <td>Parameter area<br><br></td>
-  </tr>
-  <tr>
-    <td>Dynamic area<br><br></td>
-  </tr>
-  <tr>
-    <td>Locals area<br><br></td>
-  </tr>
-  <tr>
-    <td>Saved registers area<br><br></td>
-  </tr>
-  <tr style="border-style: none hidden none hidden;">
-    <td><br></td>
-  </tr>
-  <tr>
-    <td>Previous Frame<br><br></td>
-  </tr>
-</table>
-
-<p>The <i>linkage</i> area is used by a callee to save special registers prior
-   to allocating its own frame.  Only three entries are relevant to LLVM. The
-   first entry is the previous stack pointer (sp), aka link.  This allows
-   probing tools like gdb or exception handlers to quickly scan the frames in
-   the stack.  A function epilog can also use the link to pop the frame from the
-   stack.  The third entry in the linkage area is used to save the return
-   address from the lr register. Finally, as mentioned above, the last entry is
-   used to save the previous frame pointer (r31.)  The entries in the linkage
-   area are the size of a GPR, thus the linkage area is 24 bytes long in 32 bit
-   mode and 48 bytes in 64 bit mode.</p>
-
-<p>32 bit linkage area</p>
-
-<table class="layout">
-  <tr>
-    <td>0</td>
-    <td>Saved SP (r1)</td>
-  </tr>
-  <tr>
-    <td>4</td>
-    <td>Saved CR</td>
-  </tr>
-  <tr>
-    <td>8</td>
-    <td>Saved LR</td>
-  </tr>
-  <tr>
-    <td>12</td>
-    <td>Reserved</td>
-  </tr>
-  <tr>
-    <td>16</td>
-    <td>Reserved</td>
-  </tr>
-  <tr>
-    <td>20</td>
-    <td>Saved FP (r31)</td>
-  </tr>
-</table>
-
-<p>64 bit linkage area</p>
-
-<table class="layout">
-  <tr>
-    <td>0</td>
-    <td>Saved SP (r1)</td>
-  </tr>
-  <tr>
-    <td>8</td>
-    <td>Saved CR</td>
-  </tr>
-  <tr>
-    <td>16</td>
-    <td>Saved LR</td>
-  </tr>
-  <tr>
-    <td>24</td>
-    <td>Reserved</td>
-  </tr>
-  <tr>
-    <td>32</td>
-    <td>Reserved</td>
-  </tr>
-  <tr>
-    <td>40</td>
-    <td>Saved FP (r31)</td>
-  </tr>
-</table>
-
-<p>The <i>parameter area</i> is used to store arguments being passed to a callee
-   function.  Following the PowerPC ABI, the first few arguments are actually
-   passed in registers, with the space in the parameter area unused.  However,
-   if there are not enough registers or the callee is a thunk or vararg
-   function, these register arguments can be spilled into the parameter area.
-   Thus, the parameter area must be large enough to store all the parameters for
-   the largest call sequence made by the caller.  The size must also be
-   minimally large enough to spill registers r3-r10.  This allows callees blind
-   to the call signature, such as thunks and vararg functions, enough space to
-   cache the argument registers.  Therefore, the parameter area is minimally 32
-   bytes (64 bytes in 64 bit mode.)  Also note that since the parameter area is
-   a fixed offset from the top of the frame, that a callee can access its spilt
-   arguments using fixed offsets from the stack pointer (or base pointer.)</p>
-
-<p>Combining the information about the linkage, parameter areas and alignment. A
-   stack frame is minimally 64 bytes in 32 bit mode and 128 bytes in 64 bit
-   mode.</p>
-
-<p>The <i>dynamic area</i> starts out as size zero.  If a function uses dynamic
-   alloca then space is added to the stack, the linkage and parameter areas are
-   shifted to top of stack, and the new space is available immediately below the
-   linkage and parameter areas.  The cost of shifting the linkage and parameter
-   areas is minor since only the link value needs to be copied.  The link value
-   can be easily fetched by adding the original frame size to the base pointer.
-   Note that allocations in the dynamic space need to observe 16 byte
-   alignment.</p>
-
-<p>The <i>locals area</i> is where the llvm compiler reserves space for local
-   variables.</p>
-
-<p>The <i>saved registers area</i> is where the llvm compiler spills callee
-   saved registers on entry to the callee.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="ppc_prolog">Prolog/Epilog</a>
-</div>
-
-<div class="doc_text">
-
-<p>The llvm prolog and epilog are the same as described in the PowerPC ABI, with
-   the following exceptions.  Callee saved registers are spilled after the frame
-   is created.  This allows the llvm epilog/prolog support to be common with
-   other targets.  The base pointer callee saved register r31 is saved in the
-   TOC slot of linkage area.  This simplifies allocation of space for the base
-   pointer and makes it convenient to locate programatically and during
-   debugging.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="ppc_dynamic">Dynamic Allocation</a>
-</div>
-
-<div class="doc_text">
-
-<p><i>TODO - More to come.</i></p>
-
-</div>
-
-
-<!-- *********************************************************************** -->
-<hr>
-<address>
-  <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
-  src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS"></a>
-  <a href="http://validator.w3.org/check/referer"><img
-  src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
-
-  <a href="mailto:sabre at nondot.org">Chris Lattner</a><br>
-  <a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
-  Last modified: $Date$
-</address>
-
-</body>
-</html>
diff --git a/libclamav/c++/llvm/docs/CodingStandards.html b/libclamav/c++/llvm/docs/CodingStandards.html
deleted file mode 100644
index ee9443d..0000000
--- a/libclamav/c++/llvm/docs/CodingStandards.html
+++ /dev/null
@@ -1,1353 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-                      "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-  <link rel="stylesheet" href="llvm.css" type="text/css">
-  <title>LLVM Coding Standards</title>
-</head>
-<body>
-
-<div class="doc_title">
-  LLVM Coding Standards
-</div>
-
-<ol>
-  <li><a href="#introduction">Introduction</a></li>
-  <li><a href="#mechanicalissues">Mechanical Source Issues</a>
-    <ol>
-      <li><a href="#sourceformating">Source Code Formatting</a>
-        <ol>
-          <li><a href="#scf_commenting">Commenting</a></li>
-          <li><a href="#scf_commentformat">Comment Formatting</a></li>
-          <li><a href="#scf_includes"><tt>#include</tt> Style</a></li>
-          <li><a href="#scf_codewidth">Source Code Width</a></li>
-          <li><a href="#scf_spacestabs">Use Spaces Instead of Tabs</a></li>
-          <li><a href="#scf_indentation">Indent Code Consistently</a></li>
-        </ol></li>
-      <li><a href="#compilerissues">Compiler Issues</a>
-        <ol>
-          <li><a href="#ci_warningerrors">Treat Compiler Warnings Like
-              Errors</a></li>
-          <li><a href="#ci_portable_code">Write Portable Code</a></li>
-          <li><a href="#ci_class_struct">Use of class/struct Keywords</a></li>
-        </ol></li>
-    </ol></li>
-  <li><a href="#styleissues">Style Issues</a>
-    <ol>
-      <li><a href="#macro">The High Level Issues</a>
-        <ol>
-          <li><a href="#hl_module">A Public Header File <b>is</b> a
-              Module</a></li>
-          <li><a href="#hl_dontinclude">#include as Little as Possible</a></li>
-          <li><a href="#hl_privateheaders">Keep "internal" Headers
-              Private</a></li>
-          <li><a href="#hl_earlyexit">Use Early Exits and 'continue' to Simplify
-              Code</a></li>
-          <li><a href="#hl_else_after_return">Don't use "else" after a
-              return</a></li>
-          <li><a href="#hl_predicateloops">Turn Predicate Loops into Predicate
-              Functions</a></li>
-        </ol></li>
-      <li><a href="#micro">The Low Level Issues</a>
-        <ol>
-          <li><a href="#ll_assert">Assert Liberally</a></li>
-          <li><a href="#ll_ns_std">Do not use 'using namespace std'</a></li>
-          <li><a href="#ll_virtual_anch">Provide a virtual method anchor for
-              classes in headers</a></li>
-          <li><a href="#ll_end">Don't evaluate end() every time through a
-              loop</a></li>
-          <li><a href="#ll_iostream"><tt>#include &lt;iostream&gt;</tt> is
-              <em>forbidden</em></a></li>
-          <li><a href="#ll_avoidendl">Avoid <tt>std::endl</tt></a></li>
-          <li><a href="#ll_raw_ostream">Use <tt>raw_ostream</tt></a</li>
-        </ol></li>
-        
-      <li><a href="#nano">Microscopic Details</a>
-        <ol>
-          <li><a href="#micro_spaceparen">Spaces Before Parentheses</a></li>
-          <li><a href="#micro_preincrement">Prefer Preincrement</a></li>
-          <li><a href="#micro_namespaceindent">Namespace Indentation</a></li>
-          <li><a href="#micro_anonns">Anonymous Namespaces</a></li>
-        </ol></li>
-
-        
-    </ol></li>
-  <li><a href="#seealso">See Also</a></li>
-</ol>
-
-<div class="doc_author">
-  <p>Written by <a href="mailto:sabre at nondot.org">Chris Lattner</a></p>
-</div>
-
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="introduction">Introduction</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>This document attempts to describe a few coding standards that are being used
-in the LLVM source tree.  Although no coding standards should be regarded as
-absolute requirements to be followed in all instances, coding standards can be
-useful.</p>
-
-<p>This document intentionally does not prescribe fixed standards for religious
-issues such as brace placement and space usage.  For issues like this, follow
-the golden rule:</p>
-
-<blockquote>
-
-<p><b><a name="goldenrule">If you are adding a significant body of source to a
-project, feel free to use whatever style you are most comfortable with.  If you
-are extending, enhancing, or bug fixing already implemented code, use the style
-that is already being used so that the source is uniform and easy to
-follow.</a></b></p>
-
-</blockquote>
-
-<p>The ultimate goal of these guidelines is the increase readability and
-maintainability of our common source base. If you have suggestions for topics to
-be included, please mail them to <a
-href="mailto:sabre at nondot.org">Chris</a>.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="mechanicalissues">Mechanical Source Issues</a>
-</div>
-<!-- *********************************************************************** -->
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="sourceformating">Source Code Formatting</a>
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="scf_commenting">Commenting</a>
-</div>
-
-<div class="doc_text">
-
-<p>Comments are one critical part of readability and maintainability.  Everyone
-knows they should comment, so should you.  When writing comments, write them as
-English prose, which means they should use proper capitalization, punctuation,
-etc.  Although we all should probably
-comment our code more than we do, there are a few very critical places that
-documentation is very useful:</p>
-
-<b>File Headers</b>
-
-<p>Every source file should have a header on it that describes the basic 
-purpose of the file.  If a file does not have a header, it should not be 
-checked into Subversion.  Most source trees will probably have a standard
-file header format.  The standard format for the LLVM source tree looks like
-this:</p>
-
-<div class="doc_code">
-<pre>
-//===-- llvm/Instruction.h - Instruction class definition -------*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file contains the declaration of the Instruction class, which is the
-// base class for all of the VM instructions.
-//
-//===----------------------------------------------------------------------===//
-</pre>
-</div>
-
-<p>A few things to note about this particular format:  The "<tt>-*- C++
--*-</tt>" string on the first line is there to tell Emacs that the source file
-is a C++ file, not a C file (Emacs assumes .h files are C files by default).
-Note that this tag is not necessary in .cpp files.  The name of the file is also
-on the first line, along with a very short description of the purpose of the
-file.  This is important when printing out code and flipping though lots of
-pages.</p>
-
-<p>The next section in the file is a concise note that defines the license
-that the file is released under.  This makes it perfectly clear what terms the
-source code can be distributed under and should not be modified in any way.</p>
-
-<p>The main body of the description does not have to be very long in most cases.
-Here it's only two lines.  If an algorithm is being implemented or something
-tricky is going on, a reference to the paper where it is published should be
-included, as well as any notes or "gotchas" in the code to watch out for.</p>
-
-<b>Class overviews</b>
-
-<p>Classes are one fundamental part of a good object oriented design.  As such,
-a class definition should have a comment block that explains what the class is
-used for... if it's not obvious.  If it's so completely obvious your grandma
-could figure it out, it's probably safe to leave it out.  Naming classes
-something sane goes a long ways towards avoiding writing documentation.</p>
-
-
-<b>Method information</b>
-
-<p>Methods defined in a class (as well as any global functions) should also be
-documented properly.  A quick note about what it does any a description of the
-borderline behaviour is all that is necessary here (unless something
-particularly tricky or insideous is going on).  The hope is that people can
-figure out how to use your interfaces without reading the code itself... that is
-the goal metric.</p>
-
-<p>Good things to talk about here are what happens when something unexpected
-happens: does the method return null?  Abort?  Format your hard disk?</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="scf_commentformat">Comment Formatting</a>
-</div>
-
-<div class="doc_text">
-
-<p>In general, prefer C++ style (<tt>//</tt>) comments.  They take less space,
-require less typing, don't have nesting problems, etc.  There are a few cases
-when it is useful to use C style (<tt>/* */</tt>) comments however:</p>
-
-<ol>
-  <li>When writing a C code: Obviously if you are writing C code, use C style
-      comments.</li>
-  <li>When writing a header file that may be <tt>#include</tt>d by a C source
-      file.</li>
-  <li>When writing a source file that is used by a tool that only accepts C
-      style comments.</li>
-</ol>
-
-<p>To comment out a large block of code, use <tt>#if 0</tt> and <tt>#endif</tt>.
-These nest properly and are better behaved in general than C style comments.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="scf_includes"><tt>#include</tt> Style</a>
-</div>
-
-<div class="doc_text">
-
-<p>Immediately after the <a href="#scf_commenting">header file comment</a> (and
-include guards if working on a header file), the <a
-href="#hl_dontinclude">minimal</a> list of <tt>#include</tt>s required by the
-file should be listed.  We prefer these <tt>#include</tt>s to be listed in this
-order:</p>
-
-<ol>
-  <li><a href="#mmheader">Main Module header</a></li>
-  <li><a href="#hl_privateheaders">Local/Private Headers</a></li>
-  <li><tt>llvm/*</tt></li>
-  <li><tt>llvm/Analysis/*</tt></li>
-  <li><tt>llvm/Assembly/*</tt></li>
-  <li><tt>llvm/Bytecode/*</tt></li>
-  <li><tt>llvm/CodeGen/*</tt></li>
-  <li>...</li>
-  <li><tt>Support/*</tt></li>
-  <li><tt>Config/*</tt></li>
-  <li>System <tt>#includes</tt></li>
-</ol>
-
-<p>... and each category should be sorted by name.</p>
-
-<p><a name="mmheader">The "Main Module Header"</a> file applies to .cpp file
-which implement an interface defined by a .h file.  This <tt>#include</tt>
-should always be included <b>first</b> regardless of where it lives on the file
-system.  By including a header file first in the .cpp files that implement the
-interfaces, we ensure that the header does not have any hidden dependencies
-which are not explicitly #included in the header, but should be.  It is also a
-form of documentation in the .cpp file to indicate where the interfaces it
-implements are defined.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="scf_codewidth">Source Code Width</a>
-</div>
-
-<div class="doc_text">
-
-<p>Write your code to fit within 80 columns of text.  This helps those of us who
-like to print out code and look at your code in an xterm without resizing
-it.</p>
-
-<p>The longer answer is that there must be some limit to the width of the code
-in order to reasonably allow developers to have multiple files side-by-side in
-windows on a modest display.  If you are going to pick a width limit, it is
-somewhat arbitrary but you might as well pick something standard.  Going with
-90 columns (for example) instead of 80 columns wouldn't add any significant 
-value and would be detrimental to printing out code.  Also many other projects
-have standardized on 80 columns, so some people have already configured their
-editors for it (vs something else, like 90 columns).</p>
-
-<p>This is one of many contentious issues in coding standards, but is not up
-for debate.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="scf_spacestabs">Use Spaces Instead of Tabs</a>
-</div>
-
-<div class="doc_text">
-
-<p>In all cases, prefer spaces to tabs in source files.  People have different
-preferred indentation levels, and different styles of indentation that they
-like... this is fine.  What isn't is that different editors/viewers expand tabs
-out to different tab stops.  This can cause your code to look completely
-unreadable, and it is not worth dealing with.</p>
-
-<p>As always, follow the <a href="#goldenrule">Golden Rule</a> above: follow the
-style of existing code if your are modifying and extending it.  If you like four
-spaces of indentation, <b>DO NOT</b> do that in the middle of a chunk of code
-with two spaces of indentation.  Also, do not reindent a whole source file: it
-makes for incredible diffs that are absolutely worthless.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="scf_indentation">Indent Code Consistently</a>
-</div>
-
-<div class="doc_text">
-
-<p>Okay, your first year of programming you were told that indentation is
-important.  If you didn't believe and internalize this then, now is the time.
-Just do it.</p>
-
-</div>
-
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="compilerissues">Compiler Issues</a>
-</div>
-
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="ci_warningerrors">Treat Compiler Warnings Like Errors</a>
-</div>
-
-<div class="doc_text">
-
-<p>If your code has compiler warnings in it, something is wrong: you aren't
-casting values correctly, your have "questionable" constructs in your code, or
-you are doing something legitimately wrong.  Compiler warnings can cover up
-legitimate errors in output and make dealing with a translation unit
-difficult.</p>
-
-<p>It is not possible to prevent all warnings from all compilers, nor is it
-desirable.  Instead, pick a standard compiler (like <tt>gcc</tt>) that provides
-a good thorough set of warnings, and stick to them.  At least in the case of
-<tt>gcc</tt>, it is possible to work around any spurious errors by changing the
-syntax of the code slightly.  For example, an warning that annoys me occurs when
-I write code like this:</p>
-
-<div class="doc_code">
-<pre>
-if (V = getValue()) {
-  ...
-}
-</pre>
-</div>
-
-<p><tt>gcc</tt> will warn me that I probably want to use the <tt>==</tt>
-operator, and that I probably mistyped it.  In most cases, I haven't, and I
-really don't want the spurious errors.  To fix this particular problem, I
-rewrite the code like this:</p>
-
-<div class="doc_code">
-<pre>
-if ((V = getValue())) {
-  ...
-}
-</pre>
-</div>
-
-<p>...which shuts <tt>gcc</tt> up.  Any <tt>gcc</tt> warning that annoys you can
-be fixed by massaging the code appropriately.</p>
-
-<p>These are the <tt>gcc</tt> warnings that I prefer to enable: <tt>-Wall
--Winline -W -Wwrite-strings -Wno-unused</tt></p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="ci_portable_code">Write Portable Code</a>
-</div>
-
-<div class="doc_text">
-
-<p>In almost all cases, it is possible and within reason to write completely
-portable code.  If there are cases where it isn't possible to write portable
-code, isolate it behind a well defined (and well documented) interface.</p>
-
-<p>In practice, this means that you shouldn't assume much about the host
-compiler, including its support for "high tech" features like partial
-specialization of templates.  If these features are used, they should only be
-an implementation detail of a library which has a simple exposed API.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-<a name="ci_class_struct">Use of <tt>class</tt> and <tt>struct</tt> Keywords</a>
-</div>
-<div class="doc_text">
-
-<p>In C++, the <tt>class</tt> and <tt>struct</tt> keywords can be used almost
-interchangeably. The only difference is when they are used to declare a class:
-<tt>class</tt> makes all members private by default while <tt>struct</tt> makes
-all members public by default.</p>
-
-<p>Unfortunately, not all compilers follow the rules and some will generate
-different symbols based on whether <tt>class</tt> or <tt>struct</tt> was used to
-declare the symbol.  This can lead to problems at link time.</p> 
-
-<p>So, the rule for LLVM is to always use the <tt>class</tt> keyword, unless
-<b>all</b> members are public and the type is a C++ "POD" type, in which case 
-<tt>struct</tt> is allowed.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="styleissues">Style Issues</a>
-</div>
-<!-- *********************************************************************** -->
-
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="macro">The High Level Issues</a>
-</div>
-<!-- ======================================================================= -->
-
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="hl_module">A Public Header File <b>is</b> a Module</a>
-</div>
-
-<div class="doc_text">
-
-<p>C++ doesn't do too well in the modularity department.  There is no real
-encapsulation or data hiding (unless you use expensive protocol classes), but it
-is what we have to work with.  When you write a public header file (in the LLVM
-source tree, they live in the top level "include" directory), you are defining a
-module of functionality.</p>
-
-<p>Ideally, modules should be completely independent of each other, and their
-header files should only include the absolute minimum number of headers
-possible. A module is not just a class, a function, or a namespace: <a
-href="http://www.cuj.com/articles/2000/0002/0002c/0002c.htm">it's a collection
-of these</a> that defines an interface.  This interface may be several
-functions, classes or data structures, but the important issue is how they work
-together.</p>
-
-<p>In general, a module should be implemented with one or more <tt>.cpp</tt>
-files.  Each of these <tt>.cpp</tt> files should include the header that defines
-their interface first.  This ensure that all of the dependences of the module
-header have been properly added to the module header itself, and are not
-implicit.  System headers should be included after user headers for a
-translation unit.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="hl_dontinclude"><tt>#include</tt> as Little as Possible</a>
-</div>
-
-<div class="doc_text">
-
-<p><tt>#include</tt> hurts compile time performance.  Don't do it unless you
-have to, especially in header files.</p>
-
-<p>But wait, sometimes you need to have the definition of a class to use it, or
-to inherit from it.  In these cases go ahead and <tt>#include</tt> that header
-file.  Be aware however that there are many cases where you don't need to have
-the full definition of a class.  If you are using a pointer or reference to a
-class, you don't need the header file.  If you are simply returning a class
-instance from a prototyped function or method, you don't need it.  In fact, for
-most cases, you simply don't need the definition of a class... and not
-<tt>#include</tt>'ing speeds up compilation.</p>
-
-<p>It is easy to try to go too overboard on this recommendation, however.  You
-<b>must</b> include all of the header files that you are using -- you can 
-include them either directly
-or indirectly (through another header file).  To make sure that you don't
-accidentally forget to include a header file in your module header, make sure to
-include your module header <b>first</b> in the implementation file (as mentioned
-above).  This way there won't be any hidden dependencies that you'll find out
-about later...</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="hl_privateheaders">Keep "internal" Headers Private</a>
-</div>
-
-<div class="doc_text">
-
-<p>Many modules have a complex implementation that causes them to use more than
-one implementation (<tt>.cpp</tt>) file.  It is often tempting to put the
-internal communication interface (helper classes, extra functions, etc) in the
-public module header file.  Don't do this.</p>
-
-<p>If you really need to do something like this, put a private header file in
-the same directory as the source files, and include it locally.  This ensures
-that your private interface remains private and undisturbed by outsiders.</p>
-
-<p>Note however, that it's okay to put extra implementation methods a public
-class itself... just make them private (or protected), and all is well.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="hl_earlyexit">Use Early Exits and 'continue' to Simplify Code</a>
-</div>
-
-<div class="doc_text">
-
-<p>When reading code, keep in mind how much state and how many previous
-decisions have to be remembered by the reader to understand a block of code.
-Aim to reduce indentation where possible when it doesn't make it more difficult
-to understand the code.  One great way to do this is by making use of early
-exits and the 'continue' keyword in long loops.  As an example of using an early
-exit from a function, consider this "bad" code:</p>
-
-<div class="doc_code">
-<pre>
-Value *DoSomething(Instruction *I) {
-  if (!isa&lt;TerminatorInst&gt;(I) &amp;&amp;
-      I-&gt;hasOneUse() &amp;&amp; SomeOtherThing(I)) {
-    ... some long code ....
-  }
-  
-  return 0;
-}
-</pre>
-</div>
-
-<p>This code has several problems if the body of the 'if' is large.  When you're
-looking at the top of the function, it isn't immediately clear that this
-<em>only</em> does interesting things with non-terminator instructions, and only
-applies to things with the other predicates.  Second, it is relatively difficult
-to describe (in comments) why these predicates are important because the if
-statement makes it difficult to lay out the comments.  Third, when you're deep
-within the body of the code, it is indented an extra level.   Finally, when
-reading the top of the function, it isn't clear what the result is if the
-predicate isn't true, you have to read to the end of the function to know that
-it returns null.</p>
-
-<p>It is much preferred to format the code like this:</p>
-
-<div class="doc_code">
-<pre>
-Value *DoSomething(Instruction *I) {
-  // Terminators never need 'something' done to them because, ... 
-  if (isa&lt;TerminatorInst&gt;(I))
-    return 0;
-
-  // We conservatively avoid transforming instructions with multiple uses
-  // because goats like cheese.
-  if (!I-&gt;hasOneUse())
-    return 0;
-
-  // This is really just here for example.
-  if (!SomeOtherThing(I))
-    return 0;
-    
-  ... some long code ....
-}
-</pre>
-</div>
-
-<p>This fixes these problems.  A similar problem frequently happens in for
-loops.  A silly example is something like this:</p>
-
-<div class="doc_code">
-<pre>
-  for (BasicBlock::iterator II = BB-&gt;begin(), E = BB-&gt;end(); II != E; ++II) {
-    if (BinaryOperator *BO = dyn_cast&lt;BinaryOperator&gt;(II)) {
-      Value *LHS = BO-&gt;getOperand(0);
-      Value *RHS = BO-&gt;getOperand(1);
-      if (LHS != RHS) {
-        ...
-      }
-    }
-  }
-</pre>
-</div>
-
-<p>When you have very very small loops, this sort of structure is fine, but if
-it exceeds more than 10-15 lines, it becomes difficult for people to read and
-understand at a glance.
-The problem with this sort of code is that it gets very nested very quickly,
-meaning that the reader of the code has to keep a lot of context in their brain
-to remember what is going immediately on in the loop, because they don't know
-if/when the if conditions will have elses etc.  It is strongly preferred to
-structure the loop like this:</p>
-
-<div class="doc_code">
-<pre>
-  for (BasicBlock::iterator II = BB-&gt;begin(), E = BB-&gt;end(); II != E; ++II) {
-    BinaryOperator *BO = dyn_cast&lt;BinaryOperator&gt;(II);
-    if (!BO) continue;
-    
-    Value *LHS = BO-&gt;getOperand(0);
-    Value *RHS = BO-&gt;getOperand(1);
-    if (LHS == RHS) continue;
-  }
-</pre>
-</div>
-
-<p>This has all the benefits of using early exits from functions: it reduces
-nesting of the loop, it makes it easier to describe why the conditions are true,
-and it makes it obvious to the reader that there is no "else" coming up that
-they have to push context into their brain for.  If a loop is large, this can
-be a big understandability win.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="hl_else_after_return">Don't use "else" after a return</a>
-</div>
-
-<div class="doc_text">
-
-<p>For similar reasons above (reduction of indentation and easier reading),
-   please do not use "else" or "else if" after something that interrupts
-   control flow like return, break, continue, goto, etc.  For example, this is
-   "bad":</p>
-   
-<div class="doc_code">
-<pre>
-  case 'J': {
-    if (Signed) {
-      Type = Context.getsigjmp_bufType();
-      if (Type.isNull()) {
-        Error = ASTContext::GE_Missing_sigjmp_buf;
-        return QualType();
-      } else {
-        break;
-      }
-    } else {
-      Type = Context.getjmp_bufType();
-      if (Type.isNull()) {
-        Error = ASTContext::GE_Missing_jmp_buf;
-        return QualType();
-      } else {
-        break;
-      }
-    }
-  }
-  }
-</pre>
-</div>
-
-<p>It is better to write this something like:</p>
-
-<div class="doc_code">
-<pre>
-  case 'J':
-    if (Signed) {
-      Type = Context.getsigjmp_bufType();
-      if (Type.isNull()) {
-        Error = ASTContext::GE_Missing_sigjmp_buf;
-        return QualType();
-      }
-    } else {
-      Type = Context.getjmp_bufType();
-      if (Type.isNull()) {
-        Error = ASTContext::GE_Missing_jmp_buf;
-        return QualType();
-      }
-    }
-    break;
-</pre>
-</div>
-
-<p>Or better yet (in this case), as:</p>
-
-<div class="doc_code">
-<pre>
-  case 'J':
-    if (Signed)
-      Type = Context.getsigjmp_bufType();
-    else
-      Type = Context.getjmp_bufType();
-    
-    if (Type.isNull()) {
-      Error = Signed ? ASTContext::GE_Missing_sigjmp_buf :
-                       ASTContext::GE_Missing_jmp_buf;
-      return QualType();
-    }
-    break;
-</pre>
-</div>
-
-<p>The idea is to reduce indentation and the amount of code you have to keep
-   track of when reading the code.</p>
-              
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="hl_predicateloops">Turn Predicate Loops into Predicate Functions</a>
-</div>
-
-<div class="doc_text">
-
-<p>It is very common to write small loops that just compute a boolean
-   value.  There are a number of ways that people commonly write these, but an
-   example of this sort of thing is:</p>
-   
-<div class="doc_code">
-<pre>
-  <b>bool FoundFoo = false;</b>
-  for (unsigned i = 0, e = BarList.size(); i != e; ++i)
-    if (BarList[i]-&gt;isFoo()) {
-      <b>FoundFoo = true;</b>
-      break;
-    }
-    
-  <b>if (FoundFoo) {</b>
-    ...
-  }
-</pre>
-</div>
-
-<p>This sort of code is awkward to write, and is almost always a bad sign.
-Instead of this sort of loop, we strongly prefer to use a predicate function
-(which may be <a href="#micro_anonns">static</a>) that uses
-<a href="#hl_earlyexit">early exits</a> to compute the predicate.  We prefer
-the code to be structured like this:
-</p>
-
-
-<div class="doc_code">
-<pre>
-/// ListContainsFoo - Return true if the specified list has an element that is
-/// a foo.
-static bool ListContainsFoo(const std::vector&lt;Bar*&gt; &amp;List) {
-  for (unsigned i = 0, e = List.size(); i != e; ++i)
-    if (List[i]-&gt;isFoo())
-      return true;
-  return false;
-}
-...
-
-  <b>if (ListContainsFoo(BarList)) {</b>
-    ...
-  }
-</pre>
-</div>
-
-<p>There are many reasons for doing this: it reduces indentation and factors out
-code which can often be shared by other code that checks for the same predicate.
-More importantly, it <em>forces you to pick a name</em> for the function, and
-forces you to write a comment for it.  In this silly example, this doesn't add
-much value.  However, if the condition is complex, this can make it a lot easier
-for the reader to understand the code that queries for this predicate.  Instead
-of being faced with the in-line details of how we check to see if the BarList
-contains a foo, we can trust the function name and continue reading with better
-locality.</p>
-
-</div>
-
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="micro">The Low Level Issues</a>
-</div>
-<!-- ======================================================================= -->
-
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="ll_assert">Assert Liberally</a>
-</div>
-
-<div class="doc_text">
-
-<p>Use the "<tt>assert</tt>" function to its fullest.  Check all of your
-preconditions and assumptions, you never know when a bug (not necessarily even
-yours) might be caught early by an assertion, which reduces debugging time
-dramatically.  The "<tt>&lt;cassert&gt;</tt>" header file is probably already
-included by the header files you are using, so it doesn't cost anything to use
-it.</p>
-
-<p>To further assist with debugging, make sure to put some kind of error message
-in the assertion statement (which is printed if the assertion is tripped). This
-helps the poor debugging make sense of why an assertion is being made and
-enforced, and hopefully what to do about it.  Here is one complete example:</p>
-
-<div class="doc_code">
-<pre>
-inline Value *getOperand(unsigned i) { 
-  assert(i &lt; Operands.size() &amp;&amp; "getOperand() out of range!");
-  return Operands[i]; 
-}
-</pre>
-</div>
-
-<p>Here are some examples:</p>
-
-<div class="doc_code">
-<pre>
-assert(Ty-&gt;isPointerType() &amp;&amp; "Can't allocate a non pointer type!");
-
-assert((Opcode == Shl || Opcode == Shr) &amp;&amp; "ShiftInst Opcode invalid!");
-
-assert(idx &lt; getNumSuccessors() &amp;&amp; "Successor # out of range!");
-
-assert(V1.getType() == V2.getType() &amp;&amp; "Constant types must be identical!");
-
-assert(isa&lt;PHINode&gt;(Succ-&gt;front()) &amp;&amp; "Only works on PHId BBs!");
-</pre>
-</div>
-
-<p>You get the idea...</p>
-
-<p>Please be aware when adding assert statements that not all compilers are aware of
-the semantics of the assert.  In some places, asserts are used to indicate a piece of
-code that should not be reached.  These are typically of the form:</p>
-
-<div class="doc_code">
-<pre>
-assert(0 &amp;&amp; "Some helpful error message");
-</pre>
-</div>
-
-<p>When used in a function that returns a value, they should be followed with a return
-statement and a comment indicating that this line is never reached.  This will prevent
-a compiler which is unable to deduce that the assert statement never returns from
-generating a warning.</p>
-
-<div class="doc_code">
-<pre>
-assert(0 &amp;&amp; "Some helpful error message");
-// Not reached
-return 0;
-</pre>
-</div>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="ll_ns_std">Do not use '<tt>using namespace std</tt>'</a>
-</div>
-
-<div class="doc_text">
-<p>In LLVM, we prefer to explicitly prefix all identifiers from the standard
-namespace with an "<tt>std::</tt>" prefix, rather than rely on
-"<tt>using namespace std;</tt>".</p>
-
-<p> In header files, adding a '<tt>using namespace XXX</tt>' directive pollutes
-the namespace of any source file that <tt>#include</tt>s the header.  This is
-clearly a bad thing.</p>
-
-<p>In implementation files (e.g. .cpp files), the rule is more of a stylistic
-rule, but is still important.  Basically, using explicit namespace prefixes
-makes the code <b>clearer</b>, because it is immediately obvious what facilities
-are being used and where they are coming from, and <b>more portable</b>, because
-namespace clashes cannot occur between LLVM code and other namespaces.  The
-portability rule is important because different standard library implementations
-expose different symbols (potentially ones they shouldn't), and future revisions
-to the C++ standard will add more symbols to the <tt>std</tt> namespace.  As
-such, we never use '<tt>using namespace std;</tt>' in LLVM.</p>
-
-<p>The exception to the general rule (i.e. it's not an exception for
-the <tt>std</tt> namespace) is for implementation files.  For example, all of
-the code in the LLVM project implements code that lives in the 'llvm' namespace.
-As such, it is ok, and actually clearer, for the .cpp files to have a '<tt>using
-namespace llvm</tt>' directive at their top, after the <tt>#include</tt>s.  The
-general form of this rule is that any .cpp file that implements code in any
-namespace may use that namespace (and its parents'), but should not use any
-others.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="ll_virtual_anch">Provide a virtual method anchor for classes
-  in headers</a>
-</div>
-
-<div class="doc_text">
-
-<p>If a class is defined in a header file and has a v-table (either it has 
-virtual methods or it derives from classes with virtual methods), it must 
-always have at least one out-of-line virtual method in the class.  Without 
-this, the compiler will copy the vtable and RTTI into every <tt>.o</tt> file
-that <tt>#include</tt>s the header, bloating <tt>.o</tt> file sizes and
-increasing link times.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="ll_end">Don't evaluate end() every time through a loop</a>
-</div>
-
-<div class="doc_text">
-
-<p>Because C++ doesn't have a standard "foreach" loop (though it can be emulated
-with macros and may be coming in C++'0x) we end up writing a lot of loops that
-manually iterate from begin to end on a variety of containers or through other
-data structures.  One common mistake is to write a loop in this style:</p>
-
-<div class="doc_code">
-<pre>
-  BasicBlock *BB = ...
-  for (BasicBlock::iterator I = BB->begin(); I != <b>BB->end()</b>; ++I)
-     ... use I ...
-</pre>
-</div>
-
-<p>The problem with this construct is that it evaluates "<tt>BB->end()</tt>"
-every time through the loop.  Instead of writing the loop like this, we strongly
-prefer loops to be written so that they evaluate it once before the loop starts.
-A convenient way to do this is like so:</p>
-
-<div class="doc_code">
-<pre>
-  BasicBlock *BB = ...
-  for (BasicBlock::iterator I = BB->begin(), E = <b>BB->end()</b>; I != E; ++I)
-     ... use I ...
-</pre>
-</div>
-
-<p>The observant may quickly point out that these two loops may have different
-semantics: if the container (a basic block in this case) is being mutated, then
-"<tt>BB->end()</tt>" may change its value every time through the loop and the
-second loop may not in fact be correct.  If you actually do depend on this
-behavior, please write the loop in the first form and add a comment indicating
-that you did it intentionally.</p>
-
-<p>Why do we prefer the second form (when correct)?  Writing the loop in the
-first form has two problems: First it may be less efficient than evaluating it
-at the start of the loop.  In this case, the cost is probably minor: a few extra
-loads every time through the loop.  However, if the base expression is more
-complex, then the cost can rise quickly.  I've seen loops where the end
-expression was actually something like: "<tt>SomeMap[x]->end()</tt>" and map
-lookups really aren't cheap.  By writing it in the second form consistently, you
-eliminate the issue entirely and don't even have to think about it.</p>
-
-<p>The second (even bigger) issue is that writing the loop in the first form
-hints to the reader that the loop is mutating the container (a fact that a
-comment would handily confirm!).  If you write the loop in the second form, it
-is immediately obvious without even looking at the body of the loop that the
-container isn't being modified, which makes it easier to read the code and
-understand what it does.</p>
-
-<p>While the second form of the loop is a few extra keystrokes, we do strongly
-prefer it.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="ll_iostream"><tt>#include &lt;iostream&gt;</tt> is forbidden</a>
-</div>
-
-<div class="doc_text">
-
-<p>The use of <tt>#include &lt;iostream&gt;</tt> in library files is
-hereby <b><em>forbidden</em></b>. The primary reason for doing this is to
-support clients using LLVM libraries as part of larger systems. In particular,
-we statically link LLVM into some dynamic libraries. Even if LLVM isn't used,
-the static c'tors are run whenever an application start up that uses the dynamic
-library. There are two problems with this:</p>
-
-<ol>
-  <li>The time to run the static c'tors impacts startup time of
-      applications&mdash;a critical time for GUI apps.</li>
-  <li>The static c'tors cause the app to pull many extra pages of memory off the
-      disk: both the code for the static c'tors in each <tt>.o</tt> file and the
-      small amount of data that gets touched. In addition, touched/dirty pages
-      put more pressure on the VM system on low-memory machines.</li>
-</ol>
-
-<p>Note that using the other stream headers (<tt>&lt;sstream&gt;</tt> for
-example) is not problematic in this regard (just <tt>&lt;iostream&gt;</tt>).
-However, raw_ostream provides various APIs that are better performing for almost
-every use than std::ostream style APIs, so you should just use it for new
-code.</p>
-
-<p><b>New code should always
-use <a href="#ll_raw_ostream"><tt>raw_ostream</tt></a> for writing, or
-the <tt>llvm::MemoryBuffer</tt> API for reading files.</b></p>
-
-</div>
-
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="ll_avoidendl">Avoid <tt>std::endl</tt></a>
-</div>
-
-<div class="doc_text">
-
-<p>The <tt>std::endl</tt> modifier, when used with iostreams outputs a newline
-to the output stream specified.  In addition to doing this, however, it also
-flushes the output stream.  In other words, these are equivalent:</p>
-
-<div class="doc_code">
-<pre>
-std::cout &lt;&lt; std::endl;
-std::cout &lt;&lt; '\n' &lt;&lt; std::flush;
-</pre>
-</div>
-
-<p>Most of the time, you probably have no reason to flush the output stream, so
-it's better to use a literal <tt>'\n'</tt>.</p>
-
-</div>
-
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="ll_raw_ostream">Use <tt>raw_ostream</tt></a>
-</div>
-
-<div class="doc_text">
-
-<p>LLVM includes a lightweight, simple, and efficient stream implementation
-in <tt>llvm/Support/raw_ostream.h</tt> which provides all of the common features
-of <tt>std::ostream</tt>.  All new code should use <tt>raw_ostream</tt> instead
-of <tt>ostream</tt>.</p>
-
-<p>Unlike <tt>std::ostream</tt>, <tt>raw_ostream</tt> is not a template and can
-be forward declared as <tt>class raw_ostream</tt>.  Public headers should
-generally not include the <tt>raw_ostream</tt> header, but use forward
-declarations and constant references to <tt>raw_ostream</tt> instances.</p>
-
-</div>
-
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="nano">Microscopic Details</a>
-</div>
-<!-- ======================================================================= -->
-
-<p>This section describes preferred low-level formatting guidelines along with
-reasoning on why we prefer them.</p>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="micro_spaceparen">Spaces Before Parentheses</a>
-</div>
-
-<div class="doc_text">
-
-<p>We prefer to put a space before a parentheses only in control flow
-statements, but not in normal function call expressions and function-like
-macros.  For example, this is good:</p>
-
-<div class="doc_code">
-<pre>
-  <b>if (</b>x) ...
-  <b>for (</b>i = 0; i != 100; ++i) ...
-  <b>while (</b>llvm_rocks) ...
-
-  <b>somefunc(</b>42);
-  <b><a href="#ll_assert">assert</a>(</b>3 != 4 &amp;&amp; "laws of math are failing me");
-  
-  a = <b>foo(</b>42, 92) + <b>bar(</b>x);
-  </pre>
-</div>
-
-<p>... and this is bad:</p>
-
-<div class="doc_code">
-<pre>
-  <b>if(</b>x) ...
-  <b>for(</b>i = 0; i != 100; ++i) ...
-  <b>while(</b>llvm_rocks) ...
-
-  <b>somefunc (</b>42);
-  <b><a href="#ll_assert">assert</a> (</b>3 != 4 &amp;&amp; "laws of math are failing me");
-  
-  a = <b>foo (</b>42, 92) + <b>bar (</b>x);
-</pre>
-</div>
-
-<p>The reason for doing this is not completely arbitrary.  This style makes
-   control flow operators stand out more, and makes expressions flow better. The
-   function call operator binds very tightly as a postfix operator.  Putting
-   a space after a function name (as in the last example) makes it appear that
-   the code might bind the arguments of the left-hand-side of a binary operator
-   with the argument list of a function and the name of the right side.  More
-   specifically, it is easy to misread the "a" example as:</p>
-   
-<div class="doc_code">
-<pre>
-  a = foo <b>(</b>(42, 92) + bar<b>)</b> (x);
-</pre>
-</div>
-
-<p>... when skimming through the code.  By avoiding a space in a function, we
-avoid this misinterpretation.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="micro_preincrement">Prefer Preincrement</a>
-</div>
-
-<div class="doc_text">
-
-<p>Hard fast rule: Preincrement (<tt>++X</tt>) may be no slower than
-postincrement (<tt>X++</tt>) and could very well be a lot faster than it.  Use
-preincrementation whenever possible.</p>
-
-<p>The semantics of postincrement include making a copy of the value being
-incremented, returning it, and then preincrementing the "work value".  For
-primitive types, this isn't a big deal... but for iterators, it can be a huge
-issue (for example, some iterators contains stack and set objects in them...
-copying an iterator could invoke the copy ctor's of these as well).  In general,
-get in the habit of always using preincrement, and you won't have a problem.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="micro_namespaceindent">Namespace Indentation</a>
-</div>
-
-<div class="doc_text">
-
-<p>
-In general, we strive to reduce indentation where ever possible.  This is useful
-because we want code to <a href="#scf_codewidth">fit into 80 columns</a> without
-wrapping horribly, but also because it makes it easier to understand the code.
-Namespaces are a funny thing: they are often large, and we often desire to put
-lots of stuff into them (so they can be large).  Other times they are tiny,
-because they just hold an enum or something similar.  In order to balance this,
-we use different approaches for small versus large namespaces.  
-</p>
-
-<p>
-If a namespace definition is small and <em>easily</em> fits on a screen (say,
-less than 35 lines of code), then you should indent its body.  Here's an
-example:
-</p>
-
-<div class="doc_code">
-<pre>
-namespace llvm {
-  namespace X86 {
-    /// RelocationType - An enum for the x86 relocation codes. Note that
-    /// the terminology here doesn't follow x86 convention - word means
-    /// 32-bit and dword means 64-bit.
-    enum RelocationType {
-      /// reloc_pcrel_word - PC relative relocation, add the relocated value to
-      /// the value already in memory, after we adjust it for where the PC is.
-      reloc_pcrel_word = 0,
-
-      /// reloc_picrel_word - PIC base relative relocation, add the relocated
-      /// value to the value already in memory, after we adjust it for where the
-      /// PIC base is.
-      reloc_picrel_word = 1,
-      
-      /// reloc_absolute_word, reloc_absolute_dword - Absolute relocation, just
-      /// add the relocated value to the value already in memory.
-      reloc_absolute_word = 2,
-      reloc_absolute_dword = 3
-    };
-  }
-}
-</pre>
-</div>
-
-<p>Since the body is small, indenting adds value because it makes it very clear
-where the namespace starts and ends, and it is easy to take the whole thing in
-in one "gulp" when reading the code.  If the blob of code in the namespace is
-larger (as it typically is in a header in the llvm or clang namespaces), do not
-indent the code, and add a comment indicating what namespace is being closed.
-For example:</p>
-
-<div class="doc_code">
-<pre>
-namespace llvm {
-namespace knowledge {
-
-/// Grokable - This class represents things that Smith can have an intimate
-/// understanding of and contains the data associated with it.
-class Grokable {
-...
-public:
-  explicit Grokable() { ... }
-  virtual ~Grokable() = 0;
-  
-  ...
-
-};
-
-} // end namespace knowledge
-} // end namespace llvm
-</pre>
-</div>
-
-<p>Because the class is large, we don't expect that the reader can easily
-understand the entire concept in a glance, and the end of the file (where the
-namespaces end) may be a long ways away from the place they open.  As such,
-indenting the contents of the namespace doesn't add any value, and detracts from
-the readability of the class.  In these cases it is best to <em>not</em> indent
-the contents of the namespace.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="micro_anonns">Anonymous Namespaces</a>
-</div>
-
-<div class="doc_text">
-
-<p>After talking about namespaces in general, you may be wondering about
-anonymous namespaces in particular.
-Anonymous namespaces are a great language feature that tells the C++ compiler
-that the contents of the namespace are only visible within the current
-translation unit, allowing more aggressive optimization and eliminating the
-possibility of symbol name collisions.  Anonymous namespaces are to C++ as 
-"static" is to C functions and global variables.  While "static" is available
-in C++, anonymous namespaces are more general: they can make entire classes
-private to a file.</p>
-
-<p>The problem with anonymous namespaces is that they naturally want to
-encourage indentation of their body, and they reduce locality of reference: if
-you see a random function definition in a C++ file, it is easy to see if it is
-marked static, but seeing if it is in an anonymous namespace requires scanning
-a big chunk of the file.</p>
-
-<p>Because of this, we have a simple guideline: make anonymous namespaces as
-small as possible, and only use them for class declarations.  For example, this
-is good:</p>
-
-<div class="doc_code">
-<pre>
-<b>namespace {</b>
-  class StringSort {
-  ...
-  public:
-    StringSort(...)
-    bool operator&lt;(const char *RHS) const;
-  };
-<b>} // end anonymous namespace</b>
-
-static void Helper() { 
-  ... 
-}
-
-bool StringSort::operator&lt;(const char *RHS) const {
-  ...
-}
-
-</pre>
-</div>
-
-<p>This is bad:</p>
-
-
-<div class="doc_code">
-<pre>
-<b>namespace {</b>
-class StringSort {
-...
-public:
-  StringSort(...)
-  bool operator&lt;(const char *RHS) const;
-};
-
-void Helper() { 
-  ... 
-}
-
-bool StringSort::operator&lt;(const char *RHS) const {
-  ...
-}
-
-<b>} // end anonymous namespace</b>
-
-</pre>
-</div>
-
-
-<p>This is bad specifically because if you're looking at "Helper" in the middle
-of a large C++ file, that you have no immediate way to tell if it is local to
-the file.  When it is marked static explicitly, this is immediately obvious.
-Also, there is no reason to enclose the definition of "operator&lt;" in the
-namespace just because it was declared there.
-</p>
-
-</div>
-
-
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="seealso">See Also</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>A lot of these comments and recommendations have been culled for other
-sources.  Two particularly important books for our work are:</p>
-
-<ol>
-
-<li><a href="http://www.amazon.com/Effective-Specific-Addison-Wesley-Professional-Computing/dp/0321334876">Effective
-C++</a> by Scott Meyers.  Also 
-interesting and useful are "More Effective C++" and "Effective STL" by the same
-author.</li>
-
-<li>Large-Scale C++ Software Design by John Lakos</li>
-
-</ol>
-
-<p>If you get some free time, and you haven't read them: do so, you might learn
-something.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-
-<hr>
-<address>
-  <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
-  src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS"></a>
-  <a href="http://validator.w3.org/check/referer"><img
-  src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
-
-  <a href="mailto:sabre at nondot.org">Chris Lattner</a><br>
-  <a href="http://llvm.org">LLVM Compiler Infrastructure</a><br>
-  Last modified: $Date$
-</address>
-
-</body>
-</html>
diff --git a/libclamav/c++/llvm/docs/CommandGuide/FileCheck.pod b/libclamav/c++/llvm/docs/CommandGuide/FileCheck.pod
deleted file mode 100644
index 32516ad..0000000
--- a/libclamav/c++/llvm/docs/CommandGuide/FileCheck.pod
+++ /dev/null
@@ -1,245 +0,0 @@
-
-=pod
-
-=head1 NAME
-
-FileCheck - Flexible pattern matching file verifier
-
-=head1 SYNOPSIS
-
-B<FileCheck> I<match-filename> [I<--check-prefix=XXX>] [I<--strict-whitespace>]
-
-=head1 DESCRIPTION
-
-B<FileCheck> reads two files (one from standard input, and one specified on the
-command line) and uses one to verify the other.  This behavior is particularly
-useful for the testsuite, which wants to verify that the output of some tool
-(e.g. llc) contains the expected information (for example, a movsd from esp or
-whatever is interesting).  This is similar to using grep, but it is optimized
-for matching multiple different inputs in one file in a specific order.
-
-The I<match-filename> file specifies the file that contains the patterns to
-match.  The file to verify is always read from standard input.
-
-=head1 OPTIONS
-
-=over
-
-=item B<--help>
-
-Print a summary of command line options.
-
-=item B<--check-prefix> I<prefix>
-
-FileCheck searches the contents of I<match-filename> for patterns to match.  By
-default, these patterns are prefixed with "CHECK:".  If you'd like to use a
-different prefix (e.g. because the same input file is checking multiple
-different tool or options), the B<--check-prefix> argument allows you to specify
-a specific prefix to match.
-
-=item B<--strict-whitespace>
-
-By default, FileCheck canonicalizes input horizontal whitespace (spaces and
-tabs) which causes it to ignore these differences (a space will match a tab).
-The --strict-whitespace argument disables this behavior.
-
-=item B<-version>
-
-Show the version number of this program.
-
-=back
-
-=head1 EXIT STATUS
-
-If B<FileCheck> verifies that the file matches the expected contents, it exits
-with 0.  Otherwise, if not, or if an error occurs, it will exit with a non-zero
-value.
-
-=head1 TUTORIAL
-
-FileCheck is typically used from LLVM regression tests, being invoked on the RUN
-line of the test.  A simple example of using FileCheck from a RUN line looks
-like this:
-
-  ; RUN: llvm-as < %s | llc -march=x86-64 | FileCheck %s
-
-This syntax says to pipe the current file ("%s") into llvm-as, pipe that into
-llc, then pipe the output of llc into FileCheck.  This means that FileCheck will
-be verifying its standard input (the llc output) against the filename argument
-specified (the original .ll file specified by "%s").  To see how this works,
-lets look at the rest of the .ll file (after the RUN line):
-
-  define void @sub1(i32* %p, i32 %v) {
-  entry:
-  ; <b>CHECK: sub1:</b>
-  ; <b>CHECK: subl</b>
-          %0 = tail call i32 @llvm.atomic.load.sub.i32.p0i32(i32* %p, i32 %v)
-          ret void
-  }
-  
-  define void @inc4(i64* %p) {
-  entry:
-  ; <b>CHECK: inc4:</b>
-  ; <b>CHECK: incq</b>
-          %0 = tail call i64 @llvm.atomic.load.add.i64.p0i64(i64* %p, i64 1)
-          ret void
-  }
-
-Here you can see some "CHECK:" lines specified in comments.  Now you can see
-how the file is piped into llvm-as, then llc, and the machine code output is
-what we are verifying.  FileCheck checks the machine code output to verify that
-it matches what the "CHECK:" lines specify.
-
-The syntax of the CHECK: lines is very simple: they are fixed strings that
-must occur in order.  FileCheck defaults to ignoring horizontal whitespace
-differences (e.g. a space is allowed to match a tab) but otherwise, the contents
-of the CHECK: line is required to match some thing in the test file exactly.
-
-One nice thing about FileCheck (compared to grep) is that it allows merging
-test cases together into logical groups.  For example, because the test above
-is checking for the "sub1:" and "inc4:" labels, it will not match unless there
-is a "subl" in between those labels.  If it existed somewhere else in the file,
-that would not count: "grep subl" matches if subl exists anywhere in the
-file.
-
-
-
-=head2 The FileCheck -check-prefix option
-
-The FileCheck -check-prefix option allows multiple test configurations to be
-driven from one .ll file.  This is useful in many circumstances, for example,
-testing different architectural variants with llc.  Here's a simple example:
-
-  ; RUN: llvm-as < %s | llc -mtriple=i686-apple-darwin9 -mattr=sse41 \
-  ; RUN:              | <b>FileCheck %s -check-prefix=X32</b>
-  ; RUN: llvm-as < %s | llc -mtriple=x86_64-apple-darwin9 -mattr=sse41 \
-  ; RUN:              | <b>FileCheck %s -check-prefix=X64</b>
-
-  define <4 x i32> @pinsrd_1(i32 %s, <4 x i32> %tmp) nounwind {
-          %tmp1 = insertelement <4 x i32>; %tmp, i32 %s, i32 1
-          ret <4 x i32> %tmp1
-  ; <b>X32:</b> pinsrd_1:
-  ; <b>X32:</b>    pinsrd $1, 4(%esp), %xmm0
-  
-  ; <b>X64:</b> pinsrd_1:
-  ; <b>X64:</b>    pinsrd $1, %edi, %xmm0
-  }
-
-In this case, we're testing that we get the expected code generation with
-both 32-bit and 64-bit code generation.
-
-
-
-=head2 The "CHECK-NEXT:" directive
-
-Sometimes you want to match lines and would like to verify that matches
-happen on exactly consequtive lines with no other lines in between them.  In
-this case, you can use CHECK: and CHECK-NEXT: directives to specify this.  If
-you specified a custom check prefix, just use "<PREFIX>-NEXT:".  For
-example, something like this works as you'd expect:
-
-  define void @t2(<2 x double>* %r, <2 x double&gt;* %A, double %B) {
-	%tmp3 = load <2 x double&gt;* %A, align 16
-	%tmp7 = insertelement <2 x double&gt; undef, double %B, i32 0
-	%tmp9 = shufflevector <2 x double&gt; %tmp3,
-                              <2 x double&gt; %tmp7,
-                              <2 x i32&gt; < i32 0, i32 2 &gt;
-	store <2 x double&gt; %tmp9, <2 x double&gt;* %r, align 16
-	ret void
-        
-  ; <b>CHECK:</b> t2:
-  ; <b>CHECK:</b> 	movl	8(%esp), %eax
-  ; <b>CHECK-NEXT:</b> 	movapd	(%eax), %xmm0
-  ; <b>CHECK-NEXT:</b> 	movhpd	12(%esp), %xmm0
-  ; <b>CHECK-NEXT:</b> 	movl	4(%esp), %eax
-  ; <b>CHECK-NEXT:</b> 	movapd	%xmm0, (%eax)
-  ; <b>CHECK-NEXT:</b> 	ret
-  }
-
-CHECK-NEXT: directives reject the input unless there is exactly one newline
-between it an the previous directive.  A CHECK-NEXT cannot be the first
-directive in a file.
-
-
-
-=head2 The "CHECK-NOT:" directive
-
-The CHECK-NOT: directive is used to verify that a string doesn't occur
-between two matches (or the first match and the beginning of the file).  For
-example, to verify that a load is removed by a transformation, a test like this
-can be used:
-
-  define i8 @coerce_offset0(i32 %V, i32* %P) {
-    store i32 %V, i32* %P
-   
-    %P2 = bitcast i32* %P to i8*
-    %P3 = getelementptr i8* %P2, i32 2
-
-    %A = load i8* %P3
-    ret i8 %A
-  ; <b>CHECK:</b> @coerce_offset0
-  ; <b>CHECK-NOT:</b> load
-  ; <b>CHECK:</b> ret i8
-  }
-
-
-
-=head2 FileCheck Pattern Matching Syntax
-
-The CHECK: and CHECK-NOT: directives both take a pattern to match.  For most
-uses of FileCheck, fixed string matching is perfectly sufficient.  For some
-things, a more flexible form of matching is desired.  To support this, FileCheck
-allows you to specify regular expressions in matching strings, surrounded by
-double braces: B<{{yourregex}}>.  Because we want to use fixed string
-matching for a majority of what we do, FileCheck has been designed to support
-mixing and matching fixed string matching with regular expressions.  This allows
-you to write things like this:
-
-  ; CHECK: movhpd	<b>{{[0-9]+}}</b>(%esp), <b>{{%xmm[0-7]}}</b>
-
-In this case, any offset from the ESP register will be allowed, and any xmm
-register will be allowed.
-
-Because regular expressions are enclosed with double braces, they are
-visually distinct, and you don't need to use escape characters within the double
-braces like you would in C.  In the rare case that you want to match double
-braces explicitly from the input, you can use something ugly like
-B<{{[{][{]}}> as your pattern.
-
-
-
-=head2 FileCheck Variables
-
-It is often useful to match a pattern and then verify that it occurs again
-later in the file.  For codegen tests, this can be useful to allow any register,
-but verify that that register is used consistently later.  To do this, FileCheck
-allows named variables to be defined and substituted into patterns.  Here is a
-simple example:
-
-  ; CHECK: test5:
-  ; CHECK:    notw	<b>[[REGISTER:%[a-z]+]]</b>
-  ; CHECK:    andw	{{.*}}<b>[[REGISTER]]</b>
-
-The first check line matches a regex (<tt>%[a-z]+</tt>) and captures it into
-the variables "REGISTER".  The second line verifies that whatever is in REGISTER
-occurs later in the file after an "andw".  FileCheck variable references are
-always contained in <tt>[[ ]]</tt> pairs, are named, and their names can be
-formed with the regex "<tt>[a-zA-Z_][a-zA-Z0-9_]*</tt>".  If a colon follows the
-name, then it is a definition of the variable, if not, it is a use.
-
-FileCheck variables can be defined multiple times, and uses always get the
-latest value.  Note that variables are all read at the start of a "CHECK" line
-and are all defined at the end.  This means that if you have something like
-"<tt>CHECK: [[XYZ:.*]]x[[XYZ]]<tt>" that the check line will read the previous
-value of the XYZ variable and define a new one after the match is performed.  If
-you need to do something like this you can probably take advantage of the fact
-that FileCheck is not actually line-oriented when it matches, this allows you to
-define two separate CHECK lines that match on the same line.
-
-
-
-=head1 AUTHORS
-
-Maintained by The LLVM Team (L<http://llvm.org>).
-
-=cut
diff --git a/libclamav/c++/llvm/docs/CommandGuide/Makefile b/libclamav/c++/llvm/docs/CommandGuide/Makefile
deleted file mode 100644
index 3b65183..0000000
--- a/libclamav/c++/llvm/docs/CommandGuide/Makefile
+++ /dev/null
@@ -1,103 +0,0 @@
-##===- docs/CommandGuide/Makefile --------------------------*- Makefile -*-===##
-# 
-#                     The LLVM Compiler Infrastructure
-#
-# This file is distributed under the University of Illinois Open Source
-# License. See LICENSE.TXT for details.
-# 
-##===----------------------------------------------------------------------===##
-
-ifdef BUILD_FOR_WEBSITE
-# This special case is for keeping the CommandGuide on the LLVM web site
-# up to date automatically as the documents are checked in. It must build
-# the POD files to HTML only and keep them in the src directories. It must also
-# build in an unconfigured tree, hence the ifdef. To use this, run
-# make -s BUILD_FOR_WEBSITE=1 inside the cvs commit script.
-SRC_DOC_DIR=
-DST_HTML_DIR=html/
-DST_MAN_DIR=man/man1/
-DST_PS_DIR=ps/
-
-# If we are in BUILD_FOR_WEBSITE mode, default to the all target.
-all:: html man ps
-
-clean:
-	rm -f pod2htm*.*~~ $(HTML) $(MAN) $(PS)
-
-# To create other directories, as needed, and timestamp their creation
-%/.dir:
-	-mkdir $* > /dev/null
-	date > $@
-
-else
-
-# Otherwise, if not in BUILD_FOR_WEBSITE mode, use the project info.
-LEVEL := ../..
-include $(LEVEL)/Makefile.common
-
-SRC_DOC_DIR=$(PROJ_SRC_DIR)/
-DST_HTML_DIR=$(PROJ_OBJ_DIR)/
-DST_MAN_DIR=$(PROJ_OBJ_DIR)/
-DST_PS_DIR=$(PROJ_OBJ_DIR)/
-
-endif
-
-
-POD  := $(wildcard $(SRC_DOC_DIR)*.pod)
-HTML := $(patsubst $(SRC_DOC_DIR)%.pod, $(DST_HTML_DIR)%.html, $(POD))
-MAN  := $(patsubst $(SRC_DOC_DIR)%.pod, $(DST_MAN_DIR)%.1, $(POD))
-PS   := $(patsubst $(SRC_DOC_DIR)%.pod, $(DST_PS_DIR)%.ps, $(POD))
-
-# The set of man pages we will not install
-NO_INSTALL_MANS = $(DST_MAN_DIR)FileCheck.1
-
-# The set of man pages that we will install
-INSTALL_MANS = $(filter-out $(NO_INSTALL_MANS), $(MAN))
-
-.SUFFIXES:
-.SUFFIXES: .html .pod .1 .ps
-
-$(DST_HTML_DIR)%.html: %.pod $(DST_HTML_DIR)/.dir
-	pod2html --css=manpage.css --htmlroot=. \
-	  --podpath=. --noindex --infile=$< --outfile=$@ --title=$*
-
-$(DST_MAN_DIR)%.1: %.pod $(DST_MAN_DIR)/.dir
-	pod2man --release=CVS --center="LLVM Command Guide" $< $@
-
-$(DST_PS_DIR)%.ps: $(DST_MAN_DIR)%.1 $(DST_PS_DIR)/.dir
-	groff -Tps -man $< > $@
-
-
-html: $(HTML)
-man: $(MAN)
-ps: $(PS)
-
-EXTRA_DIST := $(POD) index.html
-
-clean-local::
-	$(Verb) $(RM) -f pod2htm*.*~~ $(HTML) $(MAN) $(PS)
-
-HTML_DIR := $(PROJ_docsdir)/html/CommandGuide
-MAN_DIR  := $(PROJ_mandir)/man1
-PS_DIR   := $(PROJ_docsdir)/ps
-
-install-local:: $(HTML) $(INSTALL_MANS) $(PS)
-	$(Echo) Installing HTML CommandGuide Documentation
-	$(Verb) $(MKDIR) $(HTML_DIR)
-	$(Verb) $(DataInstall) $(HTML) $(HTML_DIR)
-	$(Verb) $(DataInstall) $(PROJ_SRC_DIR)/index.html $(HTML_DIR)
-	$(Verb) $(DataInstall) $(PROJ_SRC_DIR)/manpage.css $(HTML_DIR)
-	$(Echo) Installing MAN CommandGuide Documentation
-	$(Verb) $(MKDIR) $(MAN_DIR)
-	$(Verb) $(DataInstall) $(INSTALL_MANS) $(MAN_DIR)
-	$(Echo) Installing PS CommandGuide Documentation
-	$(Verb) $(MKDIR) $(PS_DIR)
-	$(Verb) $(DataInstall) $(PS) $(PS_DIR)
-
-uninstall-local::
-	$(Echo) Uninstalling CommandGuide Documentation
-	$(Verb) $(RM) -rf $(HTML_DIR) $(MAN_DIR) $(PS_DIR)
-
-printvars::
-	$(Echo) "POD            : " '$(POD)'
-	$(Echo) "HTML           : " '$(HTML)'
diff --git a/libclamav/c++/llvm/docs/CommandGuide/bugpoint.pod b/libclamav/c++/llvm/docs/CommandGuide/bugpoint.pod
deleted file mode 100644
index 204ea4d..0000000
--- a/libclamav/c++/llvm/docs/CommandGuide/bugpoint.pod
+++ /dev/null
@@ -1,167 +0,0 @@
-=pod
-
-=head1 NAME
-
-bugpoint - automatic test case reduction tool
-
-=head1 SYNOPSIS
-
-B<bugpoint> [I<options>] [I<input LLVM ll/bc files>] [I<LLVM passes>] B<--args>
-I<program arguments>
-
-=head1 DESCRIPTION
-
-B<bugpoint> narrows down the source of problems in LLVM tools and passes.  It
-can be used to debug three types of failures: optimizer crashes, miscompilations
-by optimizers, or bad native code generation (including problems in the static
-and JIT compilers).  It aims to reduce large test cases to small, useful ones.
-For more information on the design and inner workings of B<bugpoint>, as well as
-advice for using bugpoint, see F<llvm/docs/Bugpoint.html> in the LLVM
-distribution.
-
-=head1 OPTIONS
-
-=over 
-
-=item B<--additional-so> F<library>
-
-Load the dynamic shared object F<library> into the test program whenever it is
-run.  This is useful if you are debugging programs which depend on non-LLVM
-libraries (such as the X or curses libraries) to run.
-
-=item B<--append-exit-code>=I<{true,false}>
-
-Append the test programs exit code to the output file so that a change in exit
-code is considered a test failure. Defaults to false.
-
-=item B<--args> I<program args>
-
-Pass all arguments specified after -args to the test program whenever it runs.
-Note that if any of the I<program args> start with a '-', you should use:
-
-    bugpoint [bugpoint args] --args -- [program args]
-
-The "--" right after the B<--args> option tells B<bugpoint> to consider any
-options starting with C<-> to be part of the B<--args> option, not as options to
-B<bugpoint> itself.
-
-=item B<--tool-args> I<tool args>
-
-Pass all arguments specified after --tool-args to the LLVM tool under test
-(B<llc>, B<lli>, etc.) whenever it runs.  You should use this option in the
-following way:
-
-    bugpoint [bugpoint args] --tool-args -- [tool args]
-
-The "--" right after the B<--tool-args> option tells B<bugpoint> to consider any
-options starting with C<-> to be part of the B<--tool-args> option, not as
-options to B<bugpoint> itself. (See B<--args>, above.)
-
-=item B<--safe-tool-args> I<tool args>
-
-Pass all arguments specified after B<--safe-tool-args> to the "safe" execution
-tool.
-
-=item B<--gcc-tool-args> I<gcc tool args>
-
-Pass all arguments specified after B<--gcc-tool-args> to the invocation of
-B<gcc>.
-
-=item B<--disable-{dce,simplifycfg}>
-
-Do not run the specified passes to clean up and reduce the size of the test
-program. By default, B<bugpoint> uses these passes internally when attempting to
-reduce test programs.  If you're trying to find a bug in one of these passes,
-B<bugpoint> may crash.
-
-=item B<--enable-valgrind>
-
-Use valgrind to find faults in the optimization phase. This will allow
-bugpoint to find otherwise asymptomatic problems caused by memory
-mis-management.
-
-=item B<-find-bugs>
-
-Continually randomize the specified passes and run them on the test program
-until a bug is found or the user kills B<bugpoint>. 
-
-=item B<--help>
-
-Print a summary of command line options.
-
-=item B<--input> F<filename>
-
-Open F<filename> and redirect the standard input of the test program, whenever
-it runs, to come from that file.
-
-=item B<--load> F<plugin>
-
-Load the dynamic object F<plugin> into B<bugpoint> itself.  This object should
-register new optimization passes.  Once loaded, the object will add new command
-line options to enable various optimizations.  To see the new complete list of
-optimizations, use the B<--help> and B<--load> options together; for example:
-
-    bugpoint --load myNewPass.so --help
-
-=item B<--mlimit> F<megabytes>
-
-Specifies an upper limit on memory usage of the optimization and codegen. Set
-to zero to disable the limit.
-
-=item B<--output> F<filename>
-
-Whenever the test program produces output on its standard output stream, it
-should match the contents of F<filename> (the "reference output"). If you
-do not use this option, B<bugpoint> will attempt to generate a reference output
-by compiling the program with the "safe" backend and running it.
-
-=item B<--profile-info-file> F<filename>
-
-Profile file loaded by B<--profile-loader>.
-
-=item B<--run-{int,jit,llc,cbe,custom}>
-
-Whenever the test program is compiled, B<bugpoint> should generate code for it
-using the specified code generator.  These options allow you to choose the
-interpreter, the JIT compiler, the static native code compiler, the C
-backend, or a custom command (see B<--exec-command>) respectively.
-
-=item B<--safe-{llc,cbe,custom}>
-
-When debugging a code generator, B<bugpoint> should use the specified code
-generator as the "safe" code generator. This is a known-good code generator
-used to generate the "reference output" if it has not been provided, and to
-compile portions of the program that as they are excluded from the testcase.
-These options allow you to choose the
-static native code compiler, the C backend, or a custom command,
-(see B<--exec-command>) respectively. The interpreter and the JIT backends
-cannot currently be used as the "safe" backends.
-
-=item B<--exec-command> I<command>
-
-This option defines the command to use with the B<--run-custom> and
-B<--safe-custom> options to execute the bitcode testcase. This can
-be useful for cross-compilation.
-
-=item B<--safe-path> I<path>
-
-This option defines the path to the command to execute with the
-B<--safe-{int,jit,llc,cbe,custom}>
-option.
-
-=back
-
-=head1 EXIT STATUS
-
-If B<bugpoint> succeeds in finding a problem, it will exit with 0.  Otherwise,
-if an error occurs, it will exit with a non-zero value.
-
-=head1 SEE ALSO
-
-L<opt|opt>
-
-=head1 AUTHOR
-
-Maintained by the LLVM Team (L<http://llvm.org>).
-
-=cut
diff --git a/libclamav/c++/llvm/docs/CommandGuide/html/manpage.css b/libclamav/c++/llvm/docs/CommandGuide/html/manpage.css
deleted file mode 100644
index b200343..0000000
--- a/libclamav/c++/llvm/docs/CommandGuide/html/manpage.css
+++ /dev/null
@@ -1,256 +0,0 @@
-/* Based on http://www.perldoc.com/css/perldoc.css */
-
- at import url("../llvm.css");
-
-body { font-family: Arial,Helvetica; }
-
-blockquote { margin: 10pt;  }
-
-h1, a { color: #336699; }
-
-
-/*** Top menu style ****/
-.mmenuon { 
- font-family: Arial,Helvetica; font-weight: bold; text-decoration: none;
- color: #ff6600; font-size: 10pt;
- }
-.mmenuoff { 
- font-family: Arial,Helvetica; font-weight: bold; text-decoration: none;
- color: #ffffff; font-size: 10pt;
-}	  
-.cpyright {
- font-family: Arial,Helvetica; font-weight: bold; text-decoration: none;
- color: #ffffff; font-size: xx-small;
-}
-.cpyrightText {
- font-family: Arial,Helvetica; font-weight: bold; text-decoration: none;
- color: #ffffff; font-size: xx-small;
-}
-.sections { 
- font-family: Arial,Helvetica; font-weight: bold; text-decoration: none;
- color: #336699; font-size: 11pt;
-}	 
-.dsections { 
- font-family: Arial,Helvetica; font-weight: bold; text-decoration: none;
- color: #336699; font-size: 12pt;
-}	
-.slink { 
- font-family: Arial,Helvetica; font-weight: normal; text-decoration: none;
- color: #000000; font-size: 9pt;
-}	 
-
-.slink2 { font-family: Arial,Helvetica; text-decoration: none; color: #336699; }	 
-
-.maintitle { 
- font-family: Arial,Helvetica; font-weight: bold; text-decoration: none;
- color: #336699; font-size: 18pt;
-}	 
-.dblArrow {
- font-family: Arial,Helvetica; font-weight: bold; text-decoration: none;
- color: #336699; font-size: small;
-}
-.menuSec {
- font-family: Arial,Helvetica; font-weight: bold; text-decoration: none;
- color: #336699; font-size: small;
-}
-
-.newstext {
- font-family: Arial,Helvetica; font-size: small;
-}
-
-.linkmenu {
- font-family: Arial,Helvetica; color: #000000; font-weight: bold;
- text-decoration: none;
-}
-
-P {
- font-family: Arial,Helvetica;
-}
-
-PRE {
-    font-size: 10pt;
-}
-.quote { 
- font-family: Times; text-decoration: none;
- color: #000000; font-size: 9pt; font-style: italic;
-}	
-.smstd { font-family: Arial,Helvetica; color: #000000; font-size: x-small; } 
-.std { font-family: Arial,Helvetica; color: #000000; } 
-.meerkatTitle { 
- font-family: sans-serif; font-size: x-small;  color: black;    }
-
-.meerkatDescription { font-family: sans-serif; font-size: 10pt; color: black }
-.meerkatCategory { 
- font-family: sans-serif; font-size: 9pt; font-weight: bold; font-style: italic; 
- color: brown; }
-.meerkatChannel { 
- font-family: sans-serif; font-size: 9pt; font-style: italic; color: brown; }
-.meerkatDate { font-family: sans-serif; font-size: xx-small; color: #336699; }
-
-.tocTitle {
- font-family: Arial,Helvetica; font-weight: bold; text-decoration: none;
- color: #333333; font-size: 10pt;
-}
-
-.toc-item {
- font-family: Arial,Helvetica; font-weight: bold; 
- color: #336699; font-size: 10pt; text-decoration: underline;
-}
-
-.perlVersion {
- font-family: Arial,Helvetica; font-weight: bold; 
- color: #336699; font-size: 10pt; text-decoration: none;
-}
-
-.podTitle {
- font-family: Arial,Helvetica; font-weight: bold; text-decoration: none;
- color: #000000;
-}
-
-.docTitle {
- font-family: Arial,Helvetica; font-weight: bold; text-decoration: none;
- color: #000000; font-size: 10pt;
-}
-.dotDot {
- font-family: Arial,Helvetica; font-weight: bold; 
- color: #000000; font-size: 9pt;
-}
-
-.docSec {
- font-family: Arial,Helvetica; font-weight: normal; 
- color: #333333; font-size: 9pt;
-}
-.docVersion {
- font-family: Arial,Helvetica; font-weight: bold; text-decoration: none;
- color: #336699; font-size: 10pt;
-}
-
-.docSecs-on {
- font-family: Arial,Helvetica; font-weight: normal; text-decoration: none;
- color: #ff0000; font-size: 10pt;
-}
-.docSecs-off {
- font-family: Arial,Helvetica; font-weight: normal; text-decoration: none;
- color: #333333; font-size: 10pt;
-}
-
-h2 {
- font-family: Arial,Helvetica; font-weight: bold; text-decoration: none;
- color: #336699; font-size: medium;
-}
-h1 {
- font-family: Verdana,Arial,Helvetica; font-weight: bold; text-decoration: none;
- color: #336699; font-size: large;
-}
-
-DL {
- font-family: Arial,Helvetica; font-weight: normal; text-decoration: none;
- color: #333333; font-size: 10pt;
-}
-
-UL > LI > A {
- font-family: Arial,Helvetica; font-weight: bold;
- color: #336699; font-size: 10pt;
-}
-
-.moduleInfo {
- font-family: Arial,Helvetica; font-weight: bold; text-decoration: none;
- color: #333333; font-size: 11pt;
-}
-
-.moduleInfoSec {
- font-family: Arial,Helvetica; font-weight: bold; text-decoration: none;
- color: #336699; font-size: 10pt;
-}
-
-.moduleInfoVal {
- font-family: Arial,Helvetica; font-weight: normal; text-decoration: underline;
- color: #000000; font-size: 10pt;
-}
-
-.cpanNavTitle {
- font-family: Arial,Helvetica; font-weight: bold; 
- color: #ffffff; font-size: 10pt;
-}
-.cpanNavLetter {
- font-family: Arial,Helvetica; font-weight: bold; text-decoration: none; 
- color: #333333; font-size: 9pt;
-}
-.cpanCat {
- font-family: Arial,Helvetica; font-weight: bold; text-decoration: none; 
- color: #336699; font-size: 9pt;
-}
-
-.bttndrkblue-bkgd-top {
-	background-color: #225688;
-	background-image: url(/global/mvc_objects/images/bttndrkblue_bgtop.gif);
-}
-.bttndrkblue-bkgd-left {
-	background-color: #225688;
-	background-image: url(/global/mvc_objects/images/bttndrkblue_bgleft.gif);
-}
-.bttndrkblue-bkgd {
-	padding-top: 0px;
-	padding-bottom: 0px;
-	margin-bottom: 0px;
-	margin-top: 0px;
-	background-repeat: no-repeat;
-	background-color: #225688;
-	background-image: url(/global/mvc_objects/images/bttndrkblue_bgmiddle.gif);
-	vertical-align: top;
-}
-.bttndrkblue-bkgd-right {
-	background-color: #225688;
-	background-image: url(/global/mvc_objects/images/bttndrkblue_bgright.gif);
-}
-.bttndrkblue-bkgd-bottom {
-	background-color: #225688;
-	background-image: url(/global/mvc_objects/images/bttndrkblue_bgbottom.gif);
-}
-.bttndrkblue-text a {
-	color: #ffffff;
-	text-decoration: none;
-}
-a.bttndrkblue-text:hover {
-	color: #ffDD3C;
-	text-decoration: none;
-}
-.bg-ltblue {
-	background-color: #f0f5fa;
-} 
-
-.border-left-b {
-	background: #f0f5fa url(/i/corner-leftline.gif) repeat-y;
-} 
-
-.border-right-b {
-	background: #f0f5fa url(/i/corner-rightline.gif) repeat-y;
-} 
-
-.border-top-b {
-	background: #f0f5fa url(/i/corner-topline.gif) repeat-x;
-} 
-
-.border-bottom-b {
-	background: #f0f5fa url(/i/corner-botline.gif) repeat-x;
-} 
-
-.border-right-w {
-	background: #ffffff url(/i/corner-rightline.gif) repeat-y;
-} 
-
-.border-top-w {
-	background: #ffffff url(/i/corner-topline.gif) repeat-x;
-} 
-
-.border-bottom-w {
-	background: #ffffff url(/i/corner-botline.gif) repeat-x;
-} 
-
-.bg-white {
-	background-color: #ffffff;
-} 
-
-.border-left-w {
-	background: #ffffff url(/i/corner-leftline.gif) repeat-y;
-} 
diff --git a/libclamav/c++/llvm/docs/CommandGuide/index.html b/libclamav/c++/llvm/docs/CommandGuide/index.html
deleted file mode 100644
index 9516d07..0000000
--- a/libclamav/c++/llvm/docs/CommandGuide/index.html
+++ /dev/null
@@ -1,155 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-                      "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-  <title>LLVM Command Guide</title>
-  <link rel="stylesheet" href="/docs/llvm.css" type="text/css">
-</head>
-<body>
-
-<div class="doc_title">
-  LLVM Command Guide
-</div>
-
-<div class="doc_text">
-
-<p>These documents are HTML versions of the <a href="man/man1/">man pages</a>
-for all of the LLVM tools.  These pages describe how to use the LLVM commands
-and what their options are.  Note that these pages do not describe all of the
-options available for all tools.  To get a complete listing, pass the
-<tt>--help</tt> (general options) or <tt>--help-hidden</tt> (general+debugging
-options) arguments to the tool you are interested in.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="basic">Basic Commands</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<ul>
-
-<li><a href="/cmds/llvm-as.html"><b>llvm-as</b></a> -
-    assemble a human-readable .ll file into bytecode</li>
-
-<li><a href="/cmds/llvm-dis.html"><b>llvm-dis</b></a> -
-    disassemble a bytecode file into a human-readable .ll file</li>
-
-<li><a href="/cmds/opt.html"><b>opt</b></a> -
-    run a series of LLVM-to-LLVM optimizations on a bytecode file</li>
-
-<li><a href="/cmds/llc.html"><b>llc</b></a> -
-    generate native machine code for a bytecode file</li>
-
-<li><a href="/cmds/lli.html"><b>lli</b></a> -
-    directly run a program compiled to bytecode using a JIT compiler or
-    interpreter</li>
-
-<li><a href="/cmds/llvm-link.html"><b>llvm-link</b></a> -
-    link several bytecode files into one</li>
-
-<li><a href="/cmds/llvm-ar.html"><b>llvm-ar</b></a> -
-    archive bytecode files</li>
-
-<li><a href="/cmds/llvm-ranlib.html"><b>llvm-ranlib</b></a> -
-    create an index for archives made with llvm-ar</li>
-
-<li><a href="/cmds/llvm-nm.html"><b>llvm-nm</b></a> -
-    print out the names and types of symbols in a bytecode file</li>
-
-<li><a href="/cmds/llvm-prof.html"><b>llvm-prof</b></a> -
-    format raw `<tt>llvmprof.out</tt>' data into a human-readable report</li>
-
-<li><a href="/cmds/llvm-ld.html"><b>llvm-ld</b></a> -
-    general purpose linker with loadable runtime optimization support</li>
-
-<li><a href="/cmds/llvm-config.html"><b>llvm-config</b></a> -
-    print out LLVM compilation options, libraries, etc. as configured</li>
-
-<li><a href="/cmds/llvmc.html"><b>llvmc</b></a> -
-    a generic customizable compiler driver</li>
-
-</ul>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="frontend">C and C++ Front-end Commands</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-<ul>
-
-<li><a href="/cmds/llvmgcc.html"><b>llvm-gcc</b></a> -
-    GCC-based C front-end for LLVM
-
-<li><a href="/cmds/llvmgxx.html"><b>llvm-g++</b></a> -
-    GCC-based C++ front-end for LLVM</li>
-
-</ul>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="debug">Debugging Tools</a>
-</div>
-<!-- *********************************************************************** -->
-
-
-<div class="doc_text">
-
-<ul>
-
-<li><a href="/cmds/bugpoint.html"><b>bugpoint</b></a> -
-    automatic test-case reducer</li>
-
-<li><a href="/cmds/llvm-extract.html"><b>llvm-extract</b></a> -
-    extract a function from an LLVM bytecode file</li>
-
-<li><a href="/cmds/llvm-bcanalyzer.html"><b>llvm-bcanalyzer</b></a> -
-    bytecode analyzer (analyzes the binary encoding itself, not the program it
-    represents)</li>
-
-</ul>
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="internal">Internal Tools</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-<ul>
-
-<li><a href="/cmds/FileCheck.html"><b>FileCheck</b></a> -
-    Flexible file verifier used extensively by the testing harness</li>
-<li><a href="/cmds/tblgen.html"><b>tblgen</b></a> -
-    target description reader and generator</li>
-<li><a href="/cmds/lit.html"><b>lit</b></a> -
-    LLVM Integrated Tester, for running tests</li>
-
-</ul>
-</div>
-
-<!-- *********************************************************************** -->
-
-<hr>
-<address>
-  <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
-  src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS"></a>
-  <a href="http://validator.w3.org/check/referer"><img
-  src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
-
-  <a href="http://llvm.org">LLVM Compiler Infrastructure</a><br>
-  Last modified: $Date$
-</address>
-
-</body>
-</html>
diff --git a/libclamav/c++/llvm/docs/CommandGuide/lit.pod b/libclamav/c++/llvm/docs/CommandGuide/lit.pod
deleted file mode 100644
index 72d9d2b..0000000
--- a/libclamav/c++/llvm/docs/CommandGuide/lit.pod
+++ /dev/null
@@ -1,354 +0,0 @@
-=pod
-
-=head1 NAME
-
-lit - LLVM Integrated Tester
-
-=head1 SYNOPSIS
-
-B<lit> [I<options>] [I<tests>]
-
-=head1 DESCRIPTION
-
-B<lit> is a portable tool for executing LLVM and Clang style test suites,
-summarizing their results, and providing indication of failures. B<lit> is
-designed to be a lightweight testing tool with as simple a user interface as
-possible.
-
-B<lit> should be run with one or more I<tests> to run specified on the command
-line. Tests can be either individual test files or directories to search for
-tests (see L<"TEST DISCOVERY">).
-
-Each specified test will be executed (potentially in parallel) and once all
-tests have been run B<lit> will print summary information on the number of tests
-which passed or failed (see L<"TEST STATUS RESULTS">). The B<lit> program will
-execute with a non-zero exit code if any tests fail.
-
-By default B<lit> will use a succinct progress display and will only print
-summary information for test failures. See L<"OUTPUT OPTIONS"> for options
-controlling the B<lit> progress display and output.
-
-B<lit> also includes a number of options for controlling how tests are exected
-(specific features may depend on the particular test format). See L<"EXECUTION
-OPTIONS"> for more information.
-
-Finally, B<lit> also supports additional options for only running a subset of
-the options specified on the command line, see L<"SELECTION OPTIONS"> for
-more information.
-
-Users interested in the B<lit> architecture or designing a B<lit> testing
-implementation should see L<"LIT ARCHITECTURE">
-
-=head1 GENERAL OPTIONS
-
-=over
-
-=item B<-h>, B<--help>
-
-Show the B<lit> help message.
-
-=item B<-j> I<N>, B<--threads>=I<N>
-
-Run I<N> tests in parallel. By default, this is automatically chosen to match
-the number of detected available CPUs.
-
-=item B<--config-prefix>=I<NAME>
-
-Search for I<NAME.cfg> and I<NAME.site.cfg> when searching for test suites,
-instead of I<lit.cfg> and I<lit.site.cfg>.
-
-=item B<--param> I<NAME>, B<--param> I<NAME>=I<VALUE>
-
-Add a user defined parameter I<NAME> with the given I<VALUE> (or the empty
-string if not given). The meaning and use of these parameters is test suite
-dependent.
-
-=back 
-
-=head1 OUTPUT OPTIONS
-
-=over
-
-=item B<-q>, B<--quiet>
-
-Suppress any output except for test failures.
-
-=item B<-s>, B<--succinct>
-
-Show less output, for example don't show information on tests that pass.
-
-=item B<-v>, B<--verbose>
-
-Show more information on test failures, for example the entire test output
-instead of just the test result.
-
-=item B<--no-progress-bar>
-
-Do not use curses based progress bar.
-
-=back 
-
-=head1 EXECUTION OPTIONS
-
-=over
-
-=item B<--path>=I<PATH>
-
-Specify an addition I<PATH> to use when searching for executables in tests.
-
-=item B<--vg>
-
-Run individual tests under valgrind (using the memcheck tool). The
-I<--error-exitcode> argument for valgrind is used so that valgrind failures will
-cause the program to exit with a non-zero status.
-
-=item B<--vg-arg>=I<ARG>
-
-When I<--vg> is used, specify an additional argument to pass to valgrind itself.
-
-=item B<--time-tests>
-
-Track the wall time individual tests take to execute and includes the results in
-the summary output. This is useful for determining which tests in a test suite
-take the most time to execute. Note that this option is most useful with I<-j
-1>.
-
-=back
-
-=head1 SELECTION OPTIONS
-
-=over
-
-=item B<--max-tests>=I<N>
-
-Run at most I<N> tests and then terminate.
-
-=item B<--max-time>=I<N>
-
-Spend at most I<N> seconds (approximately) running tests and then terminate.
-
-=item B<--shuffle>
-
-Run the tests in a random order.
-
-=back
-
-=head1 ADDITIONAL OPTIONS
-
-=over
-
-=item B<--debug>
-
-Run B<lit> in debug mode, for debugging configuration issues and B<lit> itself.
-
-=item B<--show-suites>
-
-List the discovered test suites as part of the standard output.
-
-=item B<--no-tcl-as-sh>
-
-Run Tcl scripts internally (instead of converting to shell scripts).
-
-=item B<--repeat>=I<N>
-
-Run each test I<N> times. Currently this is primarily useful for timing tests,
-other results are not collated in any reasonable fashion.
-
-=back
-
-=head1 EXIT STATUS
-
-B<lit> will exit with an exit code of 1 if there are any FAIL or XPASS
-results. Otherwise, it will exit with the status 0. Other exit codes used for
-non-test related failures (for example a user error or an internal program
-error).
-
-=head1 TEST DISCOVERY
-
-The inputs passed to B<lit> can be either individual tests, or entire
-directories or hierarchies of tests to run. When B<lit> starts up, the first
-thing it does is convert the inputs into a complete list of tests to run as part
-of I<test discovery>.
-
-In the B<lit> model, every test must exist inside some I<test suite>. B<lit>
-resolves the inputs specified on the command line to test suites by searching
-upwards from the input path until it finds a I<lit.cfg> or I<lit.site.cfg>
-file. These files serve as both a marker of test suites and as configuration
-files which B<lit> loads in order to understand how to find and run the tests
-inside the test suite.
-
-Once B<lit> has mapped the inputs into test suites it traverses the list of
-inputs adding tests for individual files and recursively searching for tests in
-directories.
-
-This behavior makes it easy to specify a subset of tests to run, while still
-allowing the test suite configuration to control exactly how tests are
-interpreted. In addition, B<lit> always identifies tests by the test suite they
-are in, and their relative path inside the test suite. For appropriately
-configured projects, this allows B<lit> to provide convenient and flexible
-support for out-of-tree builds.
-
-=head1 TEST STATUS RESULTS
-
-Each test ultimately produces one of the following six results:
-
-=over
-
-=item B<PASS>
-
-The test succeeded.
-
-=item B<XFAIL>
-
-The test failed, but that is expected. This is used for test formats which allow
-specifying that a test does not currently work, but wish to leave it in the test
-suite.
-
-=item B<XPASS>
-
-The test succeeded, but it was expected to fail. This is used for tests which
-were specified as expected to fail, but are now succeeding (generally because
-the feautre they test was broken and has been fixed).
-
-=item B<FAIL>
-
-The test failed.
-
-=item B<UNRESOLVED>
-
-The test result could not be determined. For example, this occurs when the test
-could not be run, the test itself is invalid, or the test was interrupted.
-
-=item B<UNSUPPORTED>
-
-The test is not supported in this environment. This is used by test formats
-which can report unsupported tests.
-
-=back
-
-Depending on the test format tests may produce additional information about
-their status (generally only for failures). See the L<Output|"LIT OUTPUT">
-section for more information.
-
-=head1 LIT INFRASTRUCTURE
-
-This section describes the B<lit> testing architecture for users interested in
-creating a new B<lit> testing implementation, or extending an existing one.
-
-B<lit> proper is primarily an infrastructure for discovering and running
-arbitrary tests, and to expose a single convenient interface to these
-tests. B<lit> itself doesn't know how to run tests, rather this logic is
-defined by I<test suites>.
-
-=head2 TEST SUITES
-
-As described in L<"TEST DISCOVERY">, tests are always located inside a I<test
-suite>. Test suites serve to define the format of the tests they contain, the
-logic for finding those tests, and any additional information to run the tests.
-
-B<lit> identifies test suites as directories containing I<lit.cfg> or
-I<lit.site.cfg> files (see also B<--config-prefix>. Test suites are initially
-discovered by recursively searching up the directory hierarchy for all the input
-files passed on the command line. You can use B<--show-suites> to display the
-discovered test suites at startup.
-
-Once a test suite is discovered, its config file is loaded. Config files
-themselves are just Python modules which will be executed. When the config file
-is executed, two important global variables are predefined:
-
-=over
-
-=item B<lit>
-
-The global B<lit> configuration object (a I<LitConfig> instance), which defines
-the builtin test formats, global configuration parameters, and other helper
-routines for implementing test configurations.
-
-=item B<config>
-
-This is the config object (a I<TestingConfig> instance) for the test suite,
-which the config file is expected to populate. The following variables are also
-available on the I<config> object, some of which must be set by the config and
-others are optional or predefined:
-
-B<name> I<[required]> The name of the test suite, for use in reports and
-diagnostics.
-
-B<test_format> I<[required]> The test format object which will be used to
-discover and run tests in the test suite. Generally this will be a builtin test
-format available from the I<lit.formats> module.
-
-B<test_src_root> The filesystem path to the test suite root. For out-of-dir
-builds this is the directory that will be scanned for tests.
-
-B<test_exec_root> For out-of-dir builds, the path to the test suite root inside
-the object directory. This is where tests will be run and temporary output files
-places.
-
-B<environment> A dictionary representing the environment to use when executing
-tests in the suite.
-
-B<suffixes> For B<lit> test formats which scan directories for tests, this
-variable as a list of suffixes to identify test files. Used by: I<ShTest>,
-I<TclTest>.
-
-B<substitutions> For B<lit> test formats which substitute variables into a test
-script, the list of substitutions to perform. Used by: I<ShTest>, I<TclTest>.
-
-B<unsupported> Mark an unsupported directory, all tests within it will be
-reported as unsupported. Used by: I<ShTest>, I<TclTest>.
-
-B<parent> The parent configuration, this is the config object for the directory
-containing the test suite, or None.
-
-B<on_clone> The config is actually cloned for every subdirectory inside a test
-suite, to allow local configuration on a per-directory basis. The I<on_clone>
-variable can be set to a Python function which will be called whenever a
-configuration is cloned (for a subdirectory). The function should takes three
-arguments: (1) the parent configuration, (2) the new configuration (which the
-I<on_clone> function will generally modify), and (3) the test path to the new
-directory being scanned.
-
-=back
-
-=head2 TEST DISCOVERY
-
-Once test suites are located, B<lit> recursively traverses the source directory
-(following I<test_src_root>) looking for tests. When B<lit> enters a
-sub-directory, it first checks to see if a nest test suite is defined in that
-directory. If so, it loads that test suite recursively, otherwise it
-instantiates a local test config for the directory (see L<"LOCAL CONFIGURATION
-FILES">).
-
-Tests are identified by the test suite they are contained within, and the
-relative path inside that suite. Note that the relative path may not refer to an
-actual file on disk; some test formats (such as I<GoogleTest>) define "virtual
-tests" which have a path that contains both the path to the actual test file and
-a subpath to identify the virtual test.
-
-=head2 LOCAL CONFIGURATION FILES
-
-When B<lit> loads a subdirectory in a test suite, it instantiates a local test
-configuration by cloning the configuration for the parent direction -- the root
-of this configuration chain will always be a test suite. Once the test
-configuration is cloned B<lit> checks for a I<lit.local.cfg> file in the
-subdirectory. If present, this file will be loaded and can be used to specialize
-the configuration for each individual directory. This facility can be used to
-define subdirectories of optional tests, or to change other configuration
-parameters -- for example, to change the test format, or the suffixes which
-identify test files.
-
-=head2 LIT EXAMPLE TESTS
-
-The B<lit> distribution contains several example implementations of test suites
-in the I<ExampleTests> directory.
-
-=head1 SEE ALSO
-
-L<valgrind(1)>
-
-=head1 AUTHOR
-
-Written by Daniel Dunbar and maintained by the LLVM Team (L<http://llvm.org>).
-
-=cut
diff --git a/libclamav/c++/llvm/docs/CommandGuide/llc.pod b/libclamav/c++/llvm/docs/CommandGuide/llc.pod
deleted file mode 100644
index 8adfb68..0000000
--- a/libclamav/c++/llvm/docs/CommandGuide/llc.pod
+++ /dev/null
@@ -1,193 +0,0 @@
-=pod
-
-=head1 NAME
-
-llc - LLVM static compiler
-
-=head1 SYNOPSIS
-
-B<llc> [I<options>] [I<filename>]
-
-=head1 DESCRIPTION
-
-The B<llc> command compiles LLVM source inputs into assembly language for a
-specified architecture.  The assembly language output can then be passed through
-a native assembler and linker to generate a native executable.
-
-The choice of architecture for the output assembly code is automatically
-determined from the input file, unless the B<-march> option is used to override
-the default.
-
-=head1 OPTIONS
-
-If I<filename> is - or omitted, B<llc> reads from standard input.  Otherwise, it
-will from I<filename>.  Inputs can be in either the LLVM assembly language
-format (.ll) or the LLVM bitcode format (.bc).
-
-If the B<-o> option is omitted, then B<llc> will send its output to standard
-output if the input is from standard input.  If the B<-o> option specifies -,
-then the output will also be sent to standard output.
-
-If no B<-o> option is specified and an input file other than - is specified,
-then B<llc> creates the output filename by taking the input filename,
-removing any existing F<.bc> extension, and adding a F<.s> suffix.
-
-Other B<llc> options are as follows:
-
-=head2 End-user Options
-
-=over
-
-=item B<--help>
-
-Print a summary of command line options.
-
-=item B<-O>=I<uint>
-
-Generate code at different optimization levels. These correspond to the I<-O0>,
-I<-O1>, I<-O2>, I<-O3>, and I<-O4> optimization levels used by B<llvm-gcc> and
-B<clang>.
-
-=item B<-mtriple>=I<target triple>
-
-Override the target triple specified in the input file with the specified
-string.
-
-=item B<-march>=I<arch>
-
-Specify the architecture for which to generate assembly, overriding the target
-encoded in the input file.  See the output of B<llc --help> for a list of
-valid architectures.  By default this is inferred from the target triple or
-autodetected to the current architecture.
-
-=item B<-mcpu>=I<cpuname>
-
-Specify a specific chip in the current architecture to generate code for.
-By default this is inferred from the target triple and autodetected to 
-the current architecture.  For a list of available CPUs, use:
-B<llvm-as E<lt> /dev/null | llc -march=xyz -mcpu=help>
-
-=item B<-mattr>=I<a1,+a2,-a3,...>
-
-Override or control specific attributes of the target, such as whether SIMD
-operations are enabled or not.  The default set of attributes is set by the
-current CPU.  For a list of available attributes, use:
-B<llvm-as E<lt> /dev/null | llc -march=xyz -mattr=help>
-
-=item B<--disable-fp-elim>
-
-Disable frame pointer elimination optimization.
-
-=item B<--disable-excess-fp-precision>
-
-Disable optimizations that may produce excess precision for floating point.
-Note that this option can dramatically slow down code on some systems
-(e.g. X86).
-
-=item B<--enable-unsafe-fp-math>
-
-Enable optimizations that make unsafe assumptions about IEEE math (e.g. that
-addition is associative) or may not work for all input ranges.  These
-optimizations allow the code generator to make use of some instructions which
-would otherwise not be usable (such as fsin on X86).
-
-=item B<--enable-correct-eh-support>
-
-Instruct the B<lowerinvoke> pass to insert code for correct exception handling
-support.  This is expensive and is by default omitted for efficiency.
-
-=item B<--stats>
-
-Print statistics recorded by code-generation passes.
-
-=item B<--time-passes>
-
-Record the amount of time needed for each pass and print a report to standard
-error.
-
-=item B<--load>=F<dso_path>
-
-Dynamically load F<dso_path> (a path to a dynamically shared object) that
-implements an LLVM target. This will permit the target name to be used with the
-B<-march> option so that code can be generated for that target.
-
-=back
-
-=head2 Tuning/Configuration Options
-
-=over
-
-=item B<--print-machineinstrs>
-
-Print generated machine code between compilation phases (useful for debugging).
-
-=item B<--regalloc>=I<allocator>
-
-Specify the register allocator to use. The default I<allocator> is I<local>.
-Valid register allocators are:
-
-=over
-
-=item I<simple>
-
-Very simple "always spill" register allocator
-
-=item I<local>
-
-Local register allocator
-
-=item I<linearscan>
-
-Linear scan global register allocator
-
-=item I<iterativescan>
-
-Iterative scan global register allocator
-
-=back
-
-=item B<--spiller>=I<spiller>
-
-Specify the spiller to use for register allocators that support it.  Currently
-this option is used only by the linear scan register allocator. The default
-I<spiller> is I<local>.  Valid spillers are:
-
-=over
-
-=item I<simple>
-
-Simple spiller
-
-=item I<local>
-
-Local spiller
-
-=back
-
-=back
-
-=head2 Intel IA-32-specific Options
-
-=over
-
-=item B<--x86-asm-syntax=att|intel>
-
-Specify whether to emit assembly code in AT&T syntax (the default) or intel
-syntax.
-
-=back
-
-=head1 EXIT STATUS
-
-If B<llc> succeeds, it will exit with 0.  Otherwise, if an error occurs,
-it will exit with a non-zero value.
-
-=head1 SEE ALSO
-
-L<lli|lli>
-
-=head1 AUTHORS
-
-Maintained by the LLVM Team (L<http://llvm.org>).
-
-=cut
diff --git a/libclamav/c++/llvm/docs/CommandGuide/lli.pod b/libclamav/c++/llvm/docs/CommandGuide/lli.pod
deleted file mode 100644
index e9fdf74..0000000
--- a/libclamav/c++/llvm/docs/CommandGuide/lli.pod
+++ /dev/null
@@ -1,216 +0,0 @@
-=pod
-
-=head1 NAME
-
-lli - directly execute programs from LLVM bitcode
-
-=head1 SYNOPSIS
-
-B<lli> [I<options>] [I<filename>] [I<program args>]
-
-=head1 DESCRIPTION
-
-B<lli> directly executes programs in LLVM bitcode format.  It takes a program
-in LLVM bitcode format and executes it using a just-in-time compiler, if one is
-available for the current architecture, or an interpreter.  B<lli> takes all of
-the same code generator options as L<llc|llc>, but they are only effective when
-B<lli> is using the just-in-time compiler.
-
-If I<filename> is not specified, then B<lli> reads the LLVM bitcode for the
-program from standard input.
-
-The optional I<args> specified on the command line are passed to the program as
-arguments.
-
-=head1 GENERAL OPTIONS
-
-=over
-
-=item B<-fake-argv0>=I<executable>
-
-Override the C<argv[0]> value passed into the executing program.
-
-=item B<-force-interpreter>=I<{false,true}>
-
-If set to true, use the interpreter even if a just-in-time compiler is available
-for this architecture. Defaults to false.
-
-=item B<-help>
-
-Print a summary of command line options.
-
-=item B<-load>=I<puginfilename>
-
-Causes B<lli> to load the plugin (shared object) named I<pluginfilename> and use
-it for optimization.
-
-=item B<-stats>
-
-Print statistics from the code-generation passes. This is only meaningful for
-the just-in-time compiler, at present.
-
-=item B<-time-passes>
-
-Record the amount of time needed for each code-generation pass and print it to
-standard error.
-
-=item B<-version>
-
-Print out the version of B<lli> and exit without doing anything else.
-
-=back 
-
-=head1 TARGET OPTIONS
-
-=over 
-
-=item B<-mtriple>=I<target triple>
-
-Override the target triple specified in the input bitcode file with the 
-specified string.  This may result in a crash if you pick an
-architecture which is not compatible with the current system.
-
-=item B<-march>=I<arch>
-
-Specify the architecture for which to generate assembly, overriding the target
-encoded in the bitcode file.  See the output of B<llc --help> for a list of
-valid architectures.  By default this is inferred from the target triple or
-autodetected to the current architecture.
-
-=item B<-mcpu>=I<cpuname>
-
-Specify a specific chip in the current architecture to generate code for.
-By default this is inferred from the target triple and autodetected to 
-the current architecture.  For a list of available CPUs, use:
-B<llvm-as E<lt> /dev/null | llc -march=xyz -mcpu=help>
-
-=item B<-mattr>=I<a1,+a2,-a3,...>
-
-Override or control specific attributes of the target, such as whether SIMD
-operations are enabled or not.  The default set of attributes is set by the
-current CPU.  For a list of available attributes, use:
-B<llvm-as E<lt> /dev/null | llc -march=xyz -mattr=help>
-
-=back
-
-
-=head1 FLOATING POINT OPTIONS
-
-=over 
-
-=item B<-disable-excess-fp-precision>
-
-Disable optimizations that may increase floating point precision.
-
-=item B<-enable-finite-only-fp-math>
-
-Enable optimizations that assumes only finite floating point math. That is,
-there is no NAN or Inf values.
-
-=item B<-enable-unsafe-fp-math>
-
-Causes B<lli> to enable optimizations that may decrease floating point
-precision.
-
-=item B<-soft-float>
-
-Causes B<lli> to generate software floating point library calls instead of
-equivalent hardware instructions.
-
-=back
-
-=head1 CODE GENERATION OPTIONS
-
-=over
-
-=item B<-code-model>=I<model>
-
-Choose the code model from:
-
-    default: Target default code model
-    small: Small code model
-    kernel: Kernel code model
-    medium: Medium code model
-    large: Large code model
-
-=item B<-disable-post-RA-scheduler>
-
-Disable scheduling after register allocation.
-
-=item B<-disable-spill-fusing>
-
-Disable fusing of spill code into instructions.
-
-=item B<-enable-correct-eh-support> 
-
-Make the -lowerinvoke pass insert expensive, but correct, EH code.
-
-=item B<-enable-eh> 
-
-Exception handling should be emitted.
-
-=item B<-join-liveintervals> 
-
-Coalesce copies (default=true).
-
-=item B<-nozero-initialized-in-bss>
-Don't place zero-initialized symbols into the BSS section.
-
-=item B<-pre-RA-sched>=I<scheduler>
-
-Instruction schedulers available (before register allocation):
-
-    =default: Best scheduler for the target 
-    =none: No scheduling: breadth first sequencing 
-    =simple: Simple two pass scheduling: minimize critical path and maximize processor utilization 
-    =simple-noitin: Simple two pass scheduling: Same as simple except using generic latency 
-    =list-burr: Bottom-up register reduction list scheduling 
-    =list-tdrr: Top-down register reduction list scheduling 
-    =list-td: Top-down list scheduler -print-machineinstrs - Print generated machine code
-
-=item B<-regalloc>=I<allocator>
-
-Register allocator to use: (default = linearscan)
-
-    =bigblock: Big-block register allocator 
-    =linearscan: linear scan register allocator =local -   local register allocator 
-    =simple: simple register allocator 
-
-=item B<-relocation-model>=I<model> 
-
-Choose relocation model from:
-
-    =default: Target default relocation model 
-    =static: Non-relocatable code =pic -   Fully relocatable, position independent code 
-    =dynamic-no-pic: Relocatable external references, non-relocatable code 
-
-=item B<-spiller>
-
-Spiller to use: (default: local) 
-
-    =simple: simple spiller 
-    =local: local spiller 
-
-=item B<-x86-asm-syntax>=I<syntax>
-
-Choose style of code to emit from X86 backend: 
-
-    =att: Emit AT&T-style assembly 
-    =intel: Emit Intel-style assembly
-
-=back
-
-=head1 EXIT STATUS
-
-If B<lli> fails to load the program, it will exit with an exit code of 1.
-Otherwise, it will return the exit code of the program it executes.
-
-=head1 SEE ALSO
-
-L<llc|llc>
-
-=head1 AUTHOR
-
-Maintained by the LLVM Team (L<http://llvm.org>).
-
-=cut
diff --git a/libclamav/c++/llvm/docs/CommandGuide/llvm-ar.pod b/libclamav/c++/llvm/docs/CommandGuide/llvm-ar.pod
deleted file mode 100644
index 63ba43f..0000000
--- a/libclamav/c++/llvm/docs/CommandGuide/llvm-ar.pod
+++ /dev/null
@@ -1,406 +0,0 @@
-=pod
-
-=head1 NAME
-
-llvm-ar - LLVM archiver
-
-=head1 SYNOPSIS
-
-B<llvm-ar> [-]{dmpqrtx}[Rabfikouz] [relpos] [count] <archive> [files...]
-
-
-=head1 DESCRIPTION
-
-The B<llvm-ar> command is similar to the common Unix utility, C<ar>. It 
-archives several files together into a single file. The intent for this is
-to produce archive libraries by LLVM bitcode that can be linked into an
-LLVM program. However, the archive can contain any kind of file. By default,
-B<llvm-ar> generates a symbol table that makes linking faster because
-only the symbol table needs to be consulted, not each individual file member
-of the archive. 
-
-The B<llvm-ar> command can be used to I<read> both SVR4 and BSD style archive
-files. However, it cannot be used to write them.  While the B<llvm-ar> command 
-produces files that are I<almost> identical to the format used by other C<ar> 
-implementations, it has two significant departures in order to make the 
-archive appropriate for LLVM. The first departure is that B<llvm-ar> only
-uses BSD4.4 style long path names (stored immediately after the header) and
-never contains a string table for long names. The second departure is that the
-symbol table is formated for efficient construction of an in-memory data
-structure that permits rapid (red-black tree) lookups. Consequently, archives 
-produced with B<llvm-ar> usually won't be readable or editable with any
-C<ar> implementation or useful for linking.  Using the C<f> modifier to flatten
-file names will make the archive readable by other C<ar> implementations
-but not for linking because the symbol table format for LLVM is unique. If an
-SVR4 or BSD style archive is used with the C<r> (replace) or C<q> (quick
-update) operations, the archive will be reconstructed in LLVM format. This 
-means that the string table will be dropped (in deference to BSD 4.4 long names)
-and an LLVM symbol table will be added (by default). The system symbol table
-will be retained.
-
-Here's where B<llvm-ar> departs from previous C<ar> implementations:
-
-=over
-
-=item I<Symbol Table>
-
-Since B<llvm-ar> is intended to archive bitcode files, the symbol table
-won't make much sense to anything but LLVM. Consequently, the symbol table's
-format has been simplified. It consists simply of a sequence of pairs
-of a file member index number as an LSB 4byte integer and a null-terminated 
-string.
-
-=item I<Long Paths>
-
-Some C<ar> implementations (SVR4) use a separate file member to record long
-path names (> 15 characters). B<llvm-ar> takes the BSD 4.4 and Mac OS X 
-approach which is to simply store the full path name immediately preceding
-the data for the file. The path name is null terminated and may contain the
-slash (/) character. 
-
-=item I<Compression>
-
-B<llvm-ar> can compress the members of an archive to save space. The 
-compression used depends on what's available on the platform and what choices
-the LLVM Compressor utility makes. It generally favors bzip2 but will select
-between "no compression" or bzip2 depending on what makes sense for the
-file's content.
-
-=item I<Directory Recursion>
-
-Most C<ar> implementations do not recurse through directories but simply
-ignore directories if they are presented to the program in the F<files> 
-option. B<llvm-ar>, however, can recurse through directory structures and
-add all the files under a directory, if requested.
-
-=item I<TOC Verbose Output>
-
-When B<llvm-ar> prints out the verbose table of contents (C<tv> option), it
-precedes the usual output with a character indicating the basic kind of 
-content in the file. A blank means the file is a regular file. A 'Z' means
-the file is compressed. A 'B' means the file is an LLVM bitcode file. An
-'S' means the file is the symbol table.
-
-=back
-
-=head1 OPTIONS
-
-The options to B<llvm-ar> are compatible with other C<ar> implementations.
-However, there are a few modifiers (F<zR>) that are not found in other
-C<ar>s. The options to B<llvm-ar> specify a single basic operation to 
-perform on the archive, a variety of modifiers for that operation, the
-name of the archive file, and an optional list of file names. These options
-are used to determine how B<llvm-ar> should process the archive file.
-
-The Operations and Modifiers are explained in the sections below. The minimal
-set of options is at least one operator and the name of the archive. Typically
-archive files end with a C<.a> suffix, but this is not required. Following
-the F<archive-name> comes a list of F<files> that indicate the specific members
-of the archive to operate on. If the F<files> option is not specified, it
-generally means either "none" or "all" members, depending on the operation.
-
-=head2 Operations
-
-=over
-
-=item d
-
-Delete files from the archive. No modifiers are applicable to this operation.
-The F<files> options specify which members should be removed from the
-archive. It is not an error if a specified file does not appear in the archive.
-If no F<files> are specified, the archive is not modified.
-
-=item m[abi]
-
-Move files from one location in the archive to another. The F<a>, F<b>, and 
-F<i> modifiers apply to this operation. The F<files> will all be moved
-to the location given by the modifiers. If no modifiers are used, the files
-will be moved to the end of the archive. If no F<files> are specified, the
-archive is not modified.
-
-=item p[k]
-
-Print files to the standard output. The F<k> modifier applies to this
-operation. This operation simply prints the F<files> indicated to the
-standard output. If no F<files> are specified, the entire archive is printed.
-Printing bitcode files is ill-advised as they might confuse your terminal
-settings. The F<p> operation never modifies the archive.
-
-=item q[Rfz]
-
-Quickly append files to the end of the archive. The F<R>, F<f>, and F<z>
-modifiers apply to this operation.  This operation quickly adds the 
-F<files> to the archive without checking for duplicates that should be 
-removed first. If no F<files> are specified, the archive is not modified. 
-Because of the way that B<llvm-ar> constructs the archive file, its dubious 
-whether the F<q> operation is any faster than the F<r> operation.
-
-=item r[Rabfuz]
-
-Replace or insert file members. The F<R>, F<a>, F<b>, F<f>, F<u>, and F<z>
-modifiers apply to this operation. This operation will replace existing
-F<files> or insert them at the end of the archive if they do not exist. If no
-F<files> are specified, the archive is not modified.
-
-=item t[v]
-
-Print the table of contents. Without any modifiers, this operation just prints
-the names of the members to the standard output. With the F<v> modifier,
-B<llvm-ar> also prints out the file type (B=bitcode, Z=compressed, S=symbol
-table, blank=regular file), the permission mode, the owner and group, the
-size, and the date. If any F<files> are specified, the listing is only for
-those files. If no F<files> are specified, the table of contents for the
-whole archive is printed.
-
-=item x[oP]
-
-Extract archive members back to files. The F<o> modifier applies to this
-operation. This operation retrieves the indicated F<files> from the archive 
-and writes them back to the operating system's file system. If no 
-F<files> are specified, the entire archive is extract. 
-
-=back
-
-=head2 Modifiers (operation specific)
-
-The modifiers below are specific to certain operations. See the Operations
-section (above) to determine which modifiers are applicable to which operations.
-
-=over
-
-=item [a] 
-
-When inserting or moving member files, this option specifies the destination of
-the new files as being C<a>fter the F<relpos> member. If F<relpos> is not found,
-the files are placed at the end of the archive.
-
-=item [b] 
-
-When inserting or moving member files, this option specifies the destination of
-the new files as being C<b>efore the F<relpos> member. If F<relpos> is not 
-found, the files are placed at the end of the archive. This modifier is 
-identical to the the F<i> modifier.
-
-=item [f] 
-
-Normally, B<llvm-ar> stores the full path name to a file as presented to it on
-the command line. With this option, truncated (15 characters max) names are
-used. This ensures name compatibility with older versions of C<ar> but may also
-thwart correct extraction of the files (duplicates may overwrite). If used with
-the F<R> option, the directory recursion will be performed but the file names
-will all be C<f>lattened to simple file names.
-
-=item [i] 
-
-A synonym for the F<b> option.
-
-=item [k] 
-
-Normally, B<llvm-ar> will not print the contents of bitcode files when the 
-F<p> operation is used. This modifier defeats the default and allows the 
-bitcode members to be printed.
-
-=item [N] 
-
-This option is ignored by B<llvm-ar> but provided for compatibility.
-
-=item [o] 
-
-When extracting files, this option will cause B<llvm-ar> to preserve the
-original modification times of the files it writes. 
-
-=item [P] 
-
-use full path names when matching
-
-=item [R]
-
-This modifier instructions the F<r> option to recursively process directories.
-Without F<R>, directories are ignored and only those F<files> that refer to
-files will be added to the archive. When F<R> is used, any directories specified
-with F<files> will be scanned (recursively) to find files to be added to the
-archive. Any file whose name begins with a dot will not be added.
-
-=item [u] 
-
-When replacing existing files in the archive, only replace those files that have
-a time stamp than the time stamp of the member in the archive.
-
-=item [z] 
-
-When inserting or replacing any file in the archive, compress the file first.
-This
-modifier is safe to use when (previously) compressed bitcode files are added to
-the archive; the compressed bitcode files will not be doubly compressed.
-
-=back
-
-=head2 Modifiers (generic)
-
-The modifiers below may be applied to any operation.
-
-=over
-
-=item [c]
-
-For all operations, B<llvm-ar> will always create the archive if it doesn't 
-exist. Normally, B<llvm-ar> will print a warning message indicating that the
-archive is being created. Using this modifier turns off that warning.
-
-=item [s]
-
-This modifier requests that an archive index (or symbol table) be added to the
-archive. This is the default mode of operation. The symbol table will contain
-all the externally visible functions and global variables defined by all the
-bitcode files in the archive. Using this modifier is more efficient that using
-L<llvm-ranlib|llvm-ranlib> which also creates the symbol table.
-
-=item [S]
-
-This modifier is the opposite of the F<s> modifier. It instructs B<llvm-ar> to
-not build the symbol table. If both F<s> and F<S> are used, the last modifier to
-occur in the options will prevail. 
-
-=item [v]
-
-This modifier instructs B<llvm-ar> to be verbose about what it is doing. Each
-editing operation taken against the archive will produce a line of output saying
-what is being done.
-
-=back
-
-=head1 STANDARDS
-
-The B<llvm-ar> utility is intended to provide a superset of the IEEE Std 1003.2
-(POSIX.2) functionality for C<ar>. B<llvm-ar> can read both SVR4 and BSD4.4 (or
-Mac OS X) archives. If the C<f> modifier is given to the C<x> or C<r> operations
-then B<llvm-ar> will write SVR4 compatible archives. Without this modifier, 
-B<llvm-ar> will write BSD4.4 compatible archives that have long names
-immediately after the header and indicated using the "#1/ddd" notation for the
-name in the header.
-
-=head1 FILE FORMAT
-
-The file format for LLVM Archive files is similar to that of BSD 4.4 or Mac OSX
-archive files. In fact, except for the symbol table, the C<ar> commands on those
-operating systems should be able to read LLVM archive files. The details of the
-file format follow.
-
-Each archive begins with the archive magic number which is the eight printable
-characters "!<arch>\n" where \n represents the newline character (0x0A). 
-Following the magic number, the file is composed of even length members that 
-begin with an archive header and end with a \n padding character if necessary 
-(to make the length even). Each file member is composed of a header (defined 
-below), an optional newline-terminated "long file name" and the contents of 
-the file. 
-
-The fields of the header are described in the items below. All fields of the
-header contain only ASCII characters, are left justified and are right padded 
-with space characters.
-
-=over
-
-=item name - char[16]
-
-This field of the header provides the name of the archive member. If the name is
-longer than 15 characters or contains a slash (/) character, then this field
-contains C<#1/nnn> where C<nnn> provides the length of the name and the C<#1/>
-is literal.  In this case, the actual name of the file is provided in the C<nnn>
-bytes immediately following the header. If the name is 15 characters or less, it
-is contained directly in this field and terminated with a slash (/) character.
-
-=item date - char[12]
-
-This field provides the date of modification of the file in the form of a
-decimal encoded number that provides the number of seconds since the epoch 
-(since 00:00:00 Jan 1, 1970) per Posix specifications.
-
-=item uid - char[6]
-
-This field provides the user id of the file encoded as a decimal ASCII string.
-This field might not make much sense on non-Unix systems. On Unix, it is the
-same value as the st_uid field of the stat structure returned by the stat(2)
-operating system call.
-
-=item gid - char[6]
-
-This field provides the group id of the file encoded as a decimal ASCII string.
-This field might not make much sense on non-Unix systems. On Unix, it is the
-same value as the st_gid field of the stat structure returned by the stat(2)
-operating system call.
-
-=item mode - char[8]
-
-This field provides the access mode of the file encoded as an octal ASCII 
-string. This field might not make much sense on non-Unix systems. On Unix, it 
-is the same value as the st_mode field of the stat structure returned by the 
-stat(2) operating system call.
-
-=item size - char[10]
-
-This field provides the size of the file, in bytes, encoded as a decimal ASCII
-string. If the size field is negative (starts with a minus sign, 0x02D), then
-the archive member is stored in compressed form. The first byte of the archive
-member's data indicates the compression type used. A value of 0 (0x30) indicates
-that no compression was used. A value of 2 (0x32) indicates that bzip2
-compression was used.
-
-=item fmag - char[2]
-
-This field is the archive file member magic number. Its content is always the
-two characters back tick (0x60) and newline (0x0A). This provides some measure 
-utility in identifying archive files that have been corrupted.
-
-=back 
-
-The LLVM symbol table has the special name "#_LLVM_SYM_TAB_#". It is presumed
-that no regular archive member file will want this name. The LLVM symbol table 
-is simply composed of a sequence of triplets: byte offset, length of symbol, 
-and the symbol itself. Symbols are not null or newline terminated. Here are 
-the details on each of these items:
-
-=over
-
-=item offset - vbr encoded 32-bit integer
-
-The offset item provides the offset into the archive file where the bitcode
-member is stored that is associated with the symbol. The offset value is 0
-based at the start of the first "normal" file member. To derive the actual
-file offset of the member, you must add the number of bytes occupied by the file
-signature (8 bytes) and the symbol tables. The value of this item is encoded
-using variable bit rate encoding to reduce the size of the symbol table.
-Variable bit rate encoding uses the high bit (0x80) of each byte to indicate 
-if there are more bytes to follow. The remaining 7 bits in each byte carry bits
-from the value. The final byte does not have the high bit set.
-
-=item length - vbr encoded 32-bit integer
-
-The length item provides the length of the symbol that follows. Like this
-I<offset> item, the length is variable bit rate encoded.
-
-=item symbol - character array
-
-The symbol item provides the text of the symbol that is associated with the
-I<offset>. The symbol is not terminated by any character. Its length is provided
-by the I<length> field. Note that is allowed (but unwise) to use non-printing
-characters (even 0x00) in the symbol. This allows for multiple encodings of 
-symbol names.
-
-=back
-
-=head1 EXIT STATUS
-
-If B<llvm-ar> succeeds, it will exit with 0.  A usage error, results
-in an exit code of 1. A hard (file system typically) error results in an
-exit code of 2. Miscellaneous or unknown errors result in an
-exit code of 3.
-
-=head1 SEE ALSO
-
-L<llvm-ranlib|llvm-ranlib>, ar(1)
-
-=head1 AUTHORS
-
-Maintained by the LLVM Team (L<http://llvm.org>).
-
-=cut
diff --git a/libclamav/c++/llvm/docs/CommandGuide/llvm-as.pod b/libclamav/c++/llvm/docs/CommandGuide/llvm-as.pod
deleted file mode 100644
index 045a924..0000000
--- a/libclamav/c++/llvm/docs/CommandGuide/llvm-as.pod
+++ /dev/null
@@ -1,77 +0,0 @@
-=pod
-
-=head1 NAME
-
-llvm-as - LLVM assembler
-
-=head1 SYNOPSIS
-
-B<llvm-as> [I<options>] [I<filename>]
-
-=head1 DESCRIPTION
-
-B<llvm-as> is the LLVM assembler.  It reads a file containing human-readable
-LLVM assembly language, translates it to LLVM bitcode, and writes the result
-into a file or to standard output.
-
-If F<filename> is omitted or is C<->, then B<llvm-as> reads its input from
-standard input.
-
-If an output file is not specified with the B<-o> option, then
-B<llvm-as> sends its output to a file or standard output by following
-these rules:
-
-=over 
-
-=item *
-
-If the input is standard input, then the output is standard output.
-
-=item *
-
-If the input is a file that ends with C<.ll>, then the output file is of
-the same name, except that the suffix is changed to C<.bc>.
-
-=item *
-
-If the input is a file that does not end with the C<.ll> suffix, then the
-output file has the same name as the input file, except that the C<.bc>
-suffix is appended.
-
-=back
-
-=head1 OPTIONS
-
-=over
-
-=item B<-f>
-
-Enable binary output on terminals.  Normally, B<llvm-as> will refuse to
-write raw bitcode output if the output stream is a terminal. With this option,
-B<llvm-as> will write raw bitcode regardless of the output device.
-
-=item B<--help>
-
-Print a summary of command line options.
-
-=item B<-o> F<filename>
-
-Specify the output file name.  If F<filename> is C<->, then B<llvm-as>
-sends its output to standard output.
-
-=back
-
-=head1 EXIT STATUS
-
-If B<llvm-as> succeeds, it will exit with 0.  Otherwise, if an error
-occurs, it will exit with a non-zero value.
-
-=head1 SEE ALSO
-
-L<llvm-dis|llvm-dis>, L<gccas|gccas>
-
-=head1 AUTHORS
-
-Maintained by the LLVM Team (L<http://llvm.org>).
-
-=cut
diff --git a/libclamav/c++/llvm/docs/CommandGuide/llvm-bcanalyzer.pod b/libclamav/c++/llvm/docs/CommandGuide/llvm-bcanalyzer.pod
deleted file mode 100644
index f60b513..0000000
--- a/libclamav/c++/llvm/docs/CommandGuide/llvm-bcanalyzer.pod
+++ /dev/null
@@ -1,315 +0,0 @@
-=pod
-
-=head1 NAME
-
-llvm-bcanalyzer - LLVM bitcode analyzer
-
-=head1 SYNOPSIS
-
-B<llvm-bcanalyzer> [I<options>] [F<filename>]
-
-=head1 DESCRIPTION
-
-The B<llvm-bcanalyzer> command is a small utility for analyzing bitcode files.
-The tool reads a bitcode file (such as generated with the B<llvm-as> tool) and
-produces a statistical report on the contents of the bitcode file.  The tool
-can also dump a low level but human readable version of the bitcode file. 
-This tool is probably not of much interest or utility except for those working 
-directly with the bitcode file format. Most LLVM users can just ignore
-this tool.
-
-If F<filename> is omitted or is C<->, then B<llvm-bcanalyzer> reads its input 
-from standard input. This is useful for combining the tool into a pipeline.
-Output is written to the standard output.
-
-=head1 OPTIONS
-
-=over
-
-=item B<-nodetails>
-
-Causes B<llvm-bcanalyzer> to abbreviate its output by writing out only a module 
-level summary. The details for individual functions are not displayed.
-
-=item B<-dump>
-
-Causes B<llvm-bcanalyzer> to dump the bitcode in a human readable format. This 
-format is significantly different from LLVM assembly and provides details about 
-the encoding of the bitcode file.
-
-=item B<-verify>
-
-Causes B<llvm-bcanalyzer> to verify the module produced by reading the 
-bitcode. This ensures that the statistics generated are based on a consistent
-module.
-
-=item B<--help>
-
-Print a summary of command line options.
-
-=back
-
-=head1 EXIT STATUS
-
-If B<llvm-bcanalyzer> succeeds, it will exit with 0.  Otherwise, if an error
-occurs, it will exit with a non-zero value, usually 1.
-
-=head1 SUMMARY OUTPUT DEFINITIONS
-
-The following items are always printed by llvm-bcanalyzer. They comprize the
-summary output.
-
-=over
-
-=item B<Bitcode Analysis Of Module>
-
-This just provides the name of the module for which bitcode analysis is being
-generated.
-
-=item B<Bitcode Version Number>
-
-The bitcode version (not LLVM version) of the file read by the analyzer.
-
-=item B<File Size>
-
-The size, in bytes, of the entire bitcode file.
-
-=item B<Module Bytes>
-
-The size, in bytes, of the module block. Percentage is relative to File Size.
-
-=item B<Function Bytes>
-
-The size, in bytes, of all the function blocks. Percentage is relative to File
-Size.
-
-=item B<Global Types Bytes>
-
-The size, in bytes, of the Global Types Pool. Percentage is relative to File
-Size. This is the size of the definitions of all types in the bitcode file.
-
-=item B<Constant Pool Bytes>
-
-The size, in bytes, of the Constant Pool Blocks Percentage is relative to File
-Size.
-
-=item B<Module Globals Bytes>
-
-Ths size, in bytes, of the Global Variable Definitions and their initializers.
-Percentage is relative to File Size.
-
-=item B<Instruction List Bytes>
-
-The size, in bytes, of all the instruction lists in all the functions.
-Percentage is relative to File Size. Note that this value is also included in
-the Function Bytes.
-
-=item B<Compaction Table Bytes>
-
-The size, in bytes, of all the compaction tables in all the functions.
-Percentage is relative to File Size. Note that this value is also included in
-the Function Bytes.
-
-=item B<Symbol Table Bytes>
-
-The size, in bytes, of all the symbol tables in all the functions. Percentage is
-relative to File Size. Note that this value is also included in the Function
-Bytes.
-
-=item B<Dependent Libraries Bytes>
-
-The size, in bytes, of the list of dependent libraries in the module. Percentage
-is relative to File Size. Note that this value is also included in the Module
-Global Bytes.
-
-=item B<Number Of Bitcode Blocks>
-
-The total number of blocks of any kind in the bitcode file.
-
-=item B<Number Of Functions>
-
-The total number of function definitions in the bitcode file.
-
-=item B<Number Of Types>
-
-The total number of types defined in the Global Types Pool.
-
-=item B<Number Of Constants>
-
-The total number of constants (of any type) defined in the Constant Pool.
-
-=item B<Number Of Basic Blocks>
-
-The total number of basic blocks defined in all functions in the bitcode file.
-
-=item B<Number Of Instructions>
-
-The total number of instructions defined in all functions in the bitcode file.
-
-=item B<Number Of Long Instructions>
-
-The total number of long instructions defined in all functions in the bitcode
-file. Long instructions are those taking greater than 4 bytes. Typically long
-instructions are GetElementPtr with several indices, PHI nodes, and calls to
-functions with large numbers of arguments.
-
-=item B<Number Of Operands>
-
-The total number of operands used in all instructions in the bitcode file.
-
-=item B<Number Of Compaction Tables>
-
-The total number of compaction tables in all functions in the bitcode file.
-
-=item B<Number Of Symbol Tables>
-
-The total number of symbol tables in all functions in the bitcode file.
-
-=item B<Number Of Dependent Libs>
-
-The total number of dependent libraries found in the bitcode file.
-
-=item B<Total Instruction Size>
-
-The total size of the instructions in all functions in the bitcode file.
-
-=item B<Average Instruction Size>
-
-The average number of bytes per instruction across all functions in the bitcode
-file. This value is computed by dividing Total Instruction Size by Number Of
-Instructions.
-
-=item B<Maximum Type Slot Number>
-
-The maximum value used for a type's slot number. Larger slot number values take 
-more bytes to encode.
-
-=item B<Maximum Value Slot Number>
-
-The maximum value used for a value's slot number. Larger slot number values take 
-more bytes to encode.
-
-=item B<Bytes Per Value>
-
-The average size of a Value definition (of any type). This is computed by
-dividing File Size by the total number of values of any type.
-
-=item B<Bytes Per Global>
-
-The average size of a global definition (constants and global variables).
-
-=item B<Bytes Per Function>
-
-The average number of bytes per function definition. This is computed by
-dividing Function Bytes by Number Of Functions.
-
-=item B<# of VBR 32-bit Integers>
-
-The total number of 32-bit integers encoded using the Variable Bit Rate
-encoding scheme.
-
-=item B<# of VBR 64-bit Integers>
-
-The total number of 64-bit integers encoded using the Variable Bit Rate encoding
-scheme.
-
-=item B<# of VBR Compressed Bytes>
-
-The total number of bytes consumed by the 32-bit and 64-bit integers that use
-the Variable Bit Rate encoding scheme.
-
-=item B<# of VBR Expanded Bytes>
-
-The total number of bytes that would have been consumed by the 32-bit and 64-bit
-integers had they not been compressed with the Variable Bit Rage encoding
-scheme.
-
-=item B<Bytes Saved With VBR>
-
-The total number of bytes saved by using the Variable Bit Rate encoding scheme.
-The percentage is relative to # of VBR Expanded Bytes.
-
-=back
-
-=head1 DETAILED OUTPUT DEFINITIONS
-
-The following definitions occur only if the -nodetails option was not given.
-The detailed output provides additional information on a per-function basis.
-
-=over
-
-=item B<Type>
-
-The type signature of the function.
-
-=item B<Byte Size>
-
-The total number of bytes in the function's block.
-
-=item B<Basic Blocks>
-
-The number of basic blocks defined by the function.
-
-=item B<Instructions>
-
-The number of instructions defined by the function.
-
-=item B<Long Instructions>
-
-The number of instructions using the long instruction format in the function.
-
-=item B<Operands>
-
-The number of operands used by all instructions in the function.
-
-=item B<Instruction Size>
-
-The number of bytes consumed by instructions in the function.
-
-=item B<Average Instruction Size>
-
-The average number of bytes consumed by the instructions in the funtion. This
-value is computed by dividing Instruction Size by Instructions.
-
-=item B<Bytes Per Instruction>
-
-The average number of bytes used by the function per instruction. This value is
-computed by dividing Byte Size by Instructions. Note that this is not the same
-as Average Instruction Size. It computes a number relative to the total function
-size not just the size of the instruction list.
-
-=item B<Number of VBR 32-bit Integers>
-
-The total number of 32-bit integers found in this function (for any use).
-
-=item B<Number of VBR 64-bit Integers>
-
-The total number of 64-bit integers found in this function (for any use).
-
-=item B<Number of VBR Compressed Bytes>
-
-The total number of bytes in this function consumed by the 32-bit and 64-bit 
-integers that use the Variable Bit Rate encoding scheme.
-
-=item B<Number of VBR Expanded Bytes>
-
-The total number of bytes in this function that would have been consumed by 
-the 32-bit and 64-bit integers had they not been compressed with the Variable 
-Bit Rate encoding scheme.
-
-=item B<Bytes Saved With VBR>
-
-The total number of bytes saved in this function by using the Variable Bit 
-Rate encoding scheme. The percentage is relative to # of VBR Expanded Bytes.
-
-=back
-
-=head1 SEE ALSO
-
-L<llvm-dis|llvm-dis>, L<http://llvm.org/docs/BitCodeFormat.html>
-
-=head1 AUTHORS
-
-Maintained by the LLVM Team (L<http://llvm.org>).
-
-=cut
diff --git a/libclamav/c++/llvm/docs/CommandGuide/llvm-config.pod b/libclamav/c++/llvm/docs/CommandGuide/llvm-config.pod
deleted file mode 100644
index 06f10de..0000000
--- a/libclamav/c++/llvm/docs/CommandGuide/llvm-config.pod
+++ /dev/null
@@ -1,131 +0,0 @@
-=pod
-
-=head1 NAME
-
-llvm-config - Print LLVM compilation options
-
-=head1 SYNOPSIS
-
-B<llvm-config> I<option> [I<components>...]
-
-=head1 DESCRIPTION
-
-B<llvm-config> makes it easier to build applications that use LLVM.  It can
-print the compiler flags, linker flags and object libraries needed to link
-against LLVM.
-
-=head1 EXAMPLES
-
-To link against the JIT:
-
-  g++ `llvm-config --cxxflags` -o HowToUseJIT.o -c HowToUseJIT.cpp
-  g++ `llvm-config --ldflags` -o HowToUseJIT HowToUseJIT.o \
-      `llvm-config --libs engine bcreader scalaropts`
-
-=head1 OPTIONS
-
-=over
-
-=item B<--version>
-
-Print the version number of LLVM.
-
-=item B<--help>
-
-Print a summary of B<llvm-config> arguments.
-
-=item B<--prefix>
-
-Print the installation prefix for LLVM.
-
-=item B<--src-root>
-
-Print the source root from which LLVM was built.
-
-=item B<--obj-root>
-
-Print the object root used to build LLVM.
-
-=item B<--bindir>
-
-Print the installation directory for LLVM binaries.
-
-=item B<--includedir>
-
-Print the installation directory for LLVM headers.
-
-=item B<--libdir>
-
-Print the installation directory for LLVM libraries.
-
-=item B<--cxxflags>
-
-Print the C++ compiler flags needed to use LLVM headers.
-
-=item B<--ldflags>
-
-Print the flags needed to link against LLVM libraries.
-
-=item B<--libs>
-
-Print all the libraries needed to link against the specified LLVM
-I<components>, including any dependencies.
-
-=item B<--libnames>
-
-Similar to B<--libs>, but prints the bare filenames of the libraries
-without B<-l> or pathnames.  Useful for linking against a not-yet-installed
-copy of LLVM.
-
-=item B<--libfiles>
-
-Similar to B<--libs>, but print the full path to each library file.  This is
-useful when creating makefile dependencies, to ensure that a tool is relinked if
-any library it uses changes.
-
-=item B<--components>
-
-Print all valid component names.
-
-=item B<--targets-built>
-
-Print the component names for all targets supported by this copy of LLVM.
-
-=item B<--build-mode>
-
-Print the build mode used when LLVM was built (e.g. Debug or Release)
-
-=back
-
-=head1 COMPONENTS
-
-To print a list of all available components, run B<llvm-config
---components>.  In most cases, components correspond directly to LLVM
-libraries.  Useful "virtual" components include:
-
-=over
-
-=item B<all>
-
-Includes all LLVM libaries.  The default if no components are specified.
-
-=item B<backend>
-
-Includes either a native backend or the C backend.
-
-=item B<engine>
-
-Includes either a native JIT or the bitcode interpreter.
-
-=back
-
-=head1 EXIT STATUS
-
-If B<llvm-config> succeeds, it will exit with 0.  Otherwise, if an error
-occurs, it will exit with a non-zero value.
-
-=head1 AUTHORS
-
-Maintained by the LLVM Team (L<http://llvm.org>).
-
-=cut
diff --git a/libclamav/c++/llvm/docs/CommandGuide/llvm-dis.pod b/libclamav/c++/llvm/docs/CommandGuide/llvm-dis.pod
deleted file mode 100644
index 2b83290..0000000
--- a/libclamav/c++/llvm/docs/CommandGuide/llvm-dis.pod
+++ /dev/null
@@ -1,60 +0,0 @@
-=pod
-
-=head1 NAME
-
-llvm-dis - LLVM disassembler
-
-=head1 SYNOPSIS
-
-B<llvm-dis> [I<options>] [I<filename>]
-
-=head1 DESCRIPTION
-
-The B<llvm-dis> command is the LLVM disassembler.  It takes an LLVM
-bitcode file and converts it into human-readable LLVM assembly language.
-
-If filename is omitted or specified as C<->, B<llvm-dis> reads its
-input from standard input.
-
-If the input is being read from standard input, then B<llvm-dis>
-will send its output to standard output by default.  Otherwise, the
-output will be written to a file named after the input file, with
-a C<.ll> suffix added (any existing C<.bc> suffix will first be
-removed).  You can override the choice of output file using the
-B<-o> option.
-
-=head1 OPTIONS
-
-=over
-
-=item B<-f>
-
-Enable binary output on terminals.  Normally, B<llvm-dis> will refuse to
-write raw bitcode output if the output stream is a terminal. With this option,
-B<llvm-dis> will write raw bitcode regardless of the output device.
-
-=item B<--help>
-
-Print a summary of command line options.
-
-=item B<-o> F<filename>
-
-Specify the output file name.  If F<filename> is -, then the output is sent
-to standard output.
-
-=back
-
-=head1 EXIT STATUS
-
-If B<llvm-dis> succeeds, it will exit with 0.  Otherwise, if an error
-occurs, it will exit with a non-zero value.
-
-=head1 SEE ALSO
-
-L<llvm-as|llvm-as>
-
-=head1 AUTHORS
-
-Maintained by the LLVM Team (L<http://llvm.org>).
-
-=cut
diff --git a/libclamav/c++/llvm/docs/CommandGuide/llvm-extract.pod b/libclamav/c++/llvm/docs/CommandGuide/llvm-extract.pod
deleted file mode 100644
index 02f38ad..0000000
--- a/libclamav/c++/llvm/docs/CommandGuide/llvm-extract.pod
+++ /dev/null
@@ -1,73 +0,0 @@
-=pod
-
-=head1 NAME
-
-llvm-extract - extract a function from an LLVM module
-
-=head1 SYNOPSIS
-
-B<llvm-extract> [I<options>] B<--func> I<function-name> [I<filename>]
-
-=head1 DESCRIPTION
-
-The B<llvm-extract> command takes the name of a function and extracts it from
-the specified LLVM bitcode file.  It is primarily used as a debugging tool to
-reduce test cases from larger programs that are triggering a bug.
-
-In addition to extracting the bitcode of the specified function,
-B<llvm-extract> will also remove unreachable global variables, prototypes, and
-unused types.
-
-The B<llvm-extract> command reads its input from standard input if filename is
-omitted or if filename is -.  The output is always written to standard output,
-unless the B<-o> option is specified (see below).
-
-=head1 OPTIONS
-
-=over
-
-=item B<-f>
-
-Enable binary output on terminals.  Normally, B<llvm-extract> will refuse to
-write raw bitcode output if the output stream is a terminal. With this option,
-B<llvm-extract> will write raw bitcode regardless of the output device.
-
-=item B<--func> I<function-name>
-
-Extract the function named I<function-name> from the LLVM bitcode. May be
-specified multiple times to extract multiple functions at once.
-
-=item B<--glob> I<global-name>
-
-Extract the global variable named I<global-name> from the LLVM bitcode. May be
-specified multiple times to extract multiple global variables at once.
-
-=item B<--help>
-
-Print a summary of command line options.
-
-=item B<-o> I<filename>
-
-Specify the output filename.  If filename is "-" (the default), then
-B<llvm-extract> sends its output to standard output.
-
-=item B<-S>
-
-Write output in LLVM intermediate language (instead of bitcode).
-
-=back
-
-=head1 EXIT STATUS
-
-If B<llvm-extract> succeeds, it will exit with 0.  Otherwise, if an error
-occurs, it will exit with a non-zero value.
-
-=head1 SEE ALSO
-
-L<bugpoint|bugpoint>
-
-=head1 AUTHORS
-
-Maintained by the LLVM Team (L<http://llvm.org>).
-
-=cut
diff --git a/libclamav/c++/llvm/docs/CommandGuide/llvm-ld.pod b/libclamav/c++/llvm/docs/CommandGuide/llvm-ld.pod
deleted file mode 100644
index 536ab0f..0000000
--- a/libclamav/c++/llvm/docs/CommandGuide/llvm-ld.pod
+++ /dev/null
@@ -1,234 +0,0 @@
-=pod
-
-=head1 NAME
-
-llvm-ld - LLVM linker
-
-=head1 SYNOPSIS
-
-B<llvm-ld> <options> <files>
-
-=head1 DESCRIPTION
-
-The B<llvm-ld> tool takes a set of LLVM bitcode files and links them
-together into a single LLVM bitcode file.  The output bitcode file can be
-another bitcode file or an executable bitcode program.  Using additional
-options, B<llvm-ld> is able to produce native code executables.
-
-The B<llvm-ld> tool is the main linker for LLVM. It is used to link together
-the output of LLVM front-end compilers and run "link time" optimizations (mostly
-the inter-procedural kind).
-
-The B<llvm-ld> tools attempts to mimic the interface provided by the default
-system linker so that it can act as a I<drop-in> replacement.
-
-=head2 Search Order
-
-When looking for objects specified on the command line, B<llvm-ld> will search 
-for the object first in the current directory and then in the directory 
-specified by the B<LLVM_LIB_SEARCH_PATH> environment variable.  If it cannot 
-find the object, it fails.
-
-When looking for a library specified with the B<-l> option, B<llvm-ld> first
-attempts to load a file with that name from the current directory.  If that
-fails, it looks for libI<library>.bc, libI<library>.a, or libI<library>.I<shared
-library extension>, in that order, in each directory added to the library search
-path with the B<-L> option.  These directories are searched in the order they
-are specified.  If the library cannot be located, then B<llvm-ld> looks in the
-directory specified by the B<LLVM_LIB_SEARCH_PATH> environment variable.  If it
-does not find a library there, it fails.
-
-The I<shared library extension> may be I<.so>, I<.dyld>, I<.dll>, or something
-different, depending upon the system.
-
-The B<-L> option is global.  It does not matter where it is specified in the
-list of command line arguments; the directory is simply added to the search path
-and is applied to all libraries, preceding or succeeding, in the command line.
-
-=head2 Link order
-
-All object and bitcode files are linked first in the order they were 
-specified on the command line.  All library files are linked next.  
-Some libraries may not be linked into the object program; see below.
-
-=head2 Library Linkage
-
-Object files and static bitcode objects are always linked into the output
-file.  Library archives (.a files) load only the objects within the archive
-that define symbols needed by the output file.  Hence, libraries should be
-listed after the object files and libraries which need them; otherwise, the
-library may not be linked in, and the dependent library will not have its
-undefined symbols defined.
-
-=head2 Native code generation
-
-The B<llvm-ld> program has limited support for native code generation, when
-using the B<-native> or B<-native-cbe> options. Native code generation is
-performed by converting the linked bitcode into native assembly (.s) or C code
-and running the system compiler (typically gcc) on the result.
-
-=head1 OPTIONS
-
-=head2 General Options
-
-=over 
-
-=item B<-help>
-
-Print a summary of command line options.
-
-=item B<-v>
-
-Specifies verbose mode. In this mode the linker will print additional
-information about the actions it takes, programs it executes, etc. 
-
-=item B<-stats>
-
-Print statistics.
-
-=item B<-time-passes>
-
-Record the amount of time needed for each pass and print it to standard
-error.
-
-=back 
-
-=head2 Input/Output Options
-
-=over
-
-=item B<-o> F<filename>
-
-This overrides the default output file and specifies the name of the file that
-should be generated by the linker. By default, B<llvm-ld> generates a file named
-F<a.out> for compatibility with B<ld>. The output will be written to
-F<filename>.
-
-=item B<-b> F<filename>
-
-This option can be used to override the output bitcode file name. By default, 
-the name of the bitcode output file is one more ".bc" suffix added to the name 
-specified by B<-o filename> option.
-
-=item B<-l>F<name>
-
-This option specifies the F<name> of a library to search when resolving symbols
-for the program. Only the base name should be specified as F<name>, without a
-F<lib> prefix or any suffix. 
-
-=item B<-L>F<Path>
-
-This option tells B<llvm-ld> to look in F<Path> to find any library subsequently
-specified with the B<-l> option. The paths will be searched in the order in
-which they are specified on the command line. If the library is still not found,
-a small set of system specific directories will also be searched. Note that
-libraries specified with the B<-l> option that occur I<before> any B<-L> options
-will not search the paths given by the B<-L> options following it.
-
-=item B<-link-as-library>
-
-Link the bitcode files together as a library, not an executable. In this mode,
-undefined symbols will be permitted.
-
-=item B<-r>
-
-An alias for -link-as-library.
-
-=item B<-native>
-
-Generate a native machine code executable.
-
-When generating native executables, B<llvm-ld> first checks for a bitcode
-version of the library and links it in, if necessary.  If the library is
-missing, B<llvm-ld> skips it.  Then, B<llvm-ld> links in the same
-libraries as native code.
-
-In this way, B<llvm-ld> should be able to link in optimized bitcode
-subsets of common libraries and then link in any part of the library that
-hasn't been converted to bitcode.
-
-=item B<-native-cbe>
-
-Generate a native machine code executable with the LLVM C backend.
-      
-This option is identical to the B<-native> option, but uses the
-C backend to generate code for the program instead of an LLVM native
-code generator.
-
-=back
-
-=head2 Optimization Options
-
-=over 
-
-=item B<-disable-inlining>
-
-Do not run the inlining pass. Functions will not be inlined into other
-functions.
-
-=item B<-disable-opt>
-
-Completely disable optimization.
-
-=item B<-disable-internalize>
-
-Do not mark all symbols as internal.
-
-=item B<-verify-each>
-
-Run the verification pass after each of the passes to verify intermediate
-results.
-
-=item B<-strip-all>
-
-Strip all debug and symbol information from the executable to make it smaller.
-
-=item B<-strip-debug>
-
-Strip all debug information from the executable to make it smaller.
-
-=item B<-s>
-
-An alias for B<-strip-all>.
-
-=item B<-S>
-
-An alias for B<-strip-debug>.
-
-=item B<-export-dynamic>
-
-An alias for B<-disable-internalize>
-
-=item B<-post-link-opt>F<Path>
-
-Run post-link optimization program. After linking is completed a bitcode file
-will be generated. It will be passed to the program specified by F<Path> as the
-first argument. The second argument to the program will be the name of a
-temporary file into which the program should place its optimized output. For
-example, the "no-op optimization" would be a simple shell script:
-
-    #!/bin/bash
-    cp $1 $2
-
-=back
-
-=head1 EXIT STATUS
-
-If B<llvm-ld> succeeds, it will exit with 0 return code.  If an error occurs,
-it will exit with a non-zero return code.
-
-=head1 ENVIRONMENT
-
-The C<LLVM_LIB_SEARCH_PATH> environment variable is used to find bitcode
-libraries. Any paths specified in this variable will be searched after the C<-L>
-options.
-
-=head1 SEE ALSO
-
-L<llvm-link|llvm-link>
-
-=head1 AUTHORS
-
-Maintained by the LLVM Team (L<http://llvm.org>).
-
-=cut
diff --git a/libclamav/c++/llvm/docs/CommandGuide/llvm-link.pod b/libclamav/c++/llvm/docs/CommandGuide/llvm-link.pod
deleted file mode 100644
index e1a1267..0000000
--- a/libclamav/c++/llvm/docs/CommandGuide/llvm-link.pod
+++ /dev/null
@@ -1,79 +0,0 @@
-=pod
-
-=head1 NAME
-
-llvm-link - LLVM linker
-
-=head1 SYNOPSIS
-
-B<llvm-link> [I<options>] I<filename ...>
-
-=head1 DESCRIPTION
-
-B<llvm-link> takes several LLVM bitcode files and links them together into a
-single LLVM bitcode file.  It writes the output file to standard output, unless
-the B<-o> option is used to specify a filename.
-
-B<llvm-link> attempts to load the input files from the current directory.  If
-that fails, it looks for each file in each of the directories specified by the
-B<-L> options on the command line.  The library search paths are global; each
-one is searched for every input file if necessary.  The directories are searched
-in the order they were specified on the command line.
-
-=head1 OPTIONS
-
-=over
-
-=item B<-L> F<directory>
-
-Add the specified F<directory> to the library search path.  When looking for
-libraries, B<llvm-link> will look in path name for libraries.  This option can be
-specified multiple times; B<llvm-link> will search inside these directories in
-the order in which they were specified on the command line.
-
-=item B<-f>
-
-Enable binary output on terminals.  Normally, B<llvm-link> will refuse to
-write raw bitcode output if the output stream is a terminal. With this option,
-B<llvm-link> will write raw bitcode regardless of the output device.
-
-=item B<-o> F<filename>
-
-Specify the output file name.  If F<filename> is C<->, then B<llvm-link> will
-write its output to standard output.
-
-=item B<-S>
-
-Write output in LLVM intermediate language (instead of bitcode).
-
-=item B<-d>
-
-If specified, B<llvm-link> prints a human-readable version of the output
-bitcode file to standard error.
-
-=item B<--help>
-
-Print a summary of command line options.
-
-=item B<-v>
-
-Verbose mode.  Print information about what B<llvm-link> is doing.  This
-typically includes a message for each bitcode file linked in and for each
-library found.
-
-=back
-
-=head1 EXIT STATUS
-
-If B<llvm-link> succeeds, it will exit with 0.  Otherwise, if an error
-occurs, it will exit with a non-zero value.
-
-=head1 SEE ALSO
-
-L<gccld|gccld>
-
-=head1 AUTHORS
-
-Maintained by the LLVM Team (L<http://llvm.org>).
-
-=cut
diff --git a/libclamav/c++/llvm/docs/CommandGuide/llvm-nm.pod b/libclamav/c++/llvm/docs/CommandGuide/llvm-nm.pod
deleted file mode 100644
index 995ac08..0000000
--- a/libclamav/c++/llvm/docs/CommandGuide/llvm-nm.pod
+++ /dev/null
@@ -1,122 +0,0 @@
-=pod
-
-=head1 NAME
-
-llvm-nm - list LLVM bitcode file's symbol table
-
-=head1 SYNOPSIS
-
-B<llvm-nm> [I<options>] [I<filenames...>]
-
-=head1 DESCRIPTION
-
-The B<llvm-nm> utility lists the names of symbols from the LLVM bitcode files,
-or B<ar> archives containing LLVM bitcode files, named on the command line.
-Each symbol is listed along with some simple information about its provenance.
-If no file name is specified, or I<-> is used as a file name, B<llvm-nm> will
-process a bitcode file on its standard input stream.
-
-B<llvm-nm>'s default output format is the traditional BSD B<nm> output format.
-Each such output record consists of an (optional) 8-digit hexadecimal address,
-followed by a type code character, followed by a name, for each symbol. One
-record is printed per line; fields are separated by spaces. When the address is
-omitted, it is replaced by 8 spaces.
-
-Type code characters currently supported, and their meanings, are as follows:
-
-=over
-
-=item U
-
-Named object is referenced but undefined in this bitcode file
-
-=item C
-
-Common (multiple definitions link together into one def)
-
-=item W
-
-Weak reference (multiple definitions link together into zero or one definitions)
-
-=item t
-
-Local function (text) object
-
-=item T
-
-Global function (text) object
-
-=item d
-
-Local data object
-
-=item D
-
-Global data object
-
-=item ?
-
-Something unrecognizable
-
-=back
-
-Because LLVM bitcode files typically contain objects that are not considered to
-have addresses until they are linked into an executable image or dynamically
-compiled "just-in-time", B<llvm-nm> does not print an address for any symbol,
-even symbols which are defined in the bitcode file.
-
-=head1 OPTIONS
-
-=over
-
-=item B<-P>
-
-Use POSIX.2 output format. Alias for B<--format=posix>.
-
-=item B<-B>    (default)
-
-Use BSD output format. Alias for B<--format=bsd>.
-
-=item B<--help>
-
-Print a summary of command-line options and their meanings.
-
-=item B<--defined-only>
-
-Print only symbols defined in this bitcode file (as opposed to
-symbols which may be referenced by objects in this file, but not
-defined in this file.)
-
-=item B<--extern-only>, B<-g>
-
-Print only symbols whose definitions are external; that is, accessible
-from other bitcode files.
-
-=item B<--undefined-only>, B<-u>
-
-Print only symbols referenced but not defined in this bitcode file.
-
-=item B<--format=>I<fmt>, B<-f>
-
-Select an output format; I<fmt> may be I<sysv>, I<posix>, or I<bsd>. The
-default is I<bsd>.
-
-=back
-
-=head1 BUGS
-
-B<llvm-nm> cannot demangle C++ mangled names, like GNU B<nm> can.
-
-=head1 EXIT STATUS
-
-B<llvm-nm> exits with an exit code of zero.
-
-=head1 SEE ALSO
-
-L<llvm-dis|llvm-dis>, ar(1), nm(1)
-
-=head1 AUTHOR
-
-Maintained by the LLVM Team (L<http://llvm.org>).
-
-=cut
diff --git a/libclamav/c++/llvm/docs/CommandGuide/llvm-prof.pod b/libclamav/c++/llvm/docs/CommandGuide/llvm-prof.pod
deleted file mode 100644
index 381387d..0000000
--- a/libclamav/c++/llvm/docs/CommandGuide/llvm-prof.pod
+++ /dev/null
@@ -1,57 +0,0 @@
-=pod
-
-=head1 NAME
-
-llvm-prof - print execution profile of LLVM program
-
-=head1 SYNOPSIS
-
-B<llvm-prof> [I<options>] [I<bitcode file>] [I<llvmprof.out>]
-
-=head1 DESCRIPTION
-
-The B<llvm-prof> tool reads in an F<llvmprof.out> file (which can
-optionally use a specific file with the third program argument), a bitcode file
-for the program, and produces a human readable report, suitable for determining
-where the program hotspots are.
-
-This program is often used in conjunction with the F<utils/profile.pl>
-script.  This script automatically instruments a program, runs it with the JIT,
-then runs B<llvm-prof> to format a report.  To get more information about
-F<utils/profile.pl>, execute it with the B<--help> option.
-
-=head1 OPTIONS
-
-=over
-
-=item B<--annotated-llvm> or B<-A>
-
-In addition to the normal report printed, print out the code for the
-program, annotated with execution frequency information. This can be
-particularly useful when trying to visualize how frequently basic blocks
-are executed.  This is most useful with basic block profiling
-information or better.
-
-=item B<--print-all-code>
-
-Using this option enables the B<--annotated-llvm> option, but it
-prints the entire module, instead of just the most commonly executed
-functions.
-
-=item B<--time-passes>
-
-Record the amount of time needed for each pass and print it to standard
-error.
-
-=back
-
-=head1 EXIT STATUS
-
-B<llvm-prof> returns 1 if it cannot load the bitcode file or the profile
-information. Otherwise, it exits with zero.
-
-=head1 AUTHOR
-
-B<llvm-prof> is maintained by the LLVM Team (L<http://llvm.org>).
-
-=cut
diff --git a/libclamav/c++/llvm/docs/CommandGuide/llvm-ranlib.pod b/libclamav/c++/llvm/docs/CommandGuide/llvm-ranlib.pod
deleted file mode 100644
index 130edb0..0000000
--- a/libclamav/c++/llvm/docs/CommandGuide/llvm-ranlib.pod
+++ /dev/null
@@ -1,52 +0,0 @@
-=pod
-
-=head1 NAME
-
-llvm-ranlib - Generate index for LLVM archive
-
-=head1 SYNOPSIS
-
-B<llvm-ranlib> [--version] [--help] <archive-file>
-
-=head1 DESCRIPTION
-
-The B<llvm-ranlib> command is similar to the common Unix utility, C<ranlib>. It
-adds or updates the symbol table in an LLVM archive file. Note that using the
-B<llvm-ar> modifier F<s> is usually more efficient than running B<llvm-ranlib>
-which is only provided only for completness and compatibility. Unlike other 
-implementations of C<ranlib>, B<llvm-ranlib> indexes LLVM bitcode files, not
-native object modules. You can list the contents of the symbol table with the
-C<llvm-nm -s> command.
-
-=head1 OPTIONS
-
-=over
-
-=item F<archive-file>
-
-Specifies the archive-file to which the symbol table is added or updated.
-
-=item F<--version>
-
-Print the version of B<llvm-ranlib> and exit without building a symbol table.
-
-=item F<--help>
-
-Print usage help for B<llvm-ranlib> and exit without building a symbol table.
-
-=back
-
-=head1 EXIT STATUS
-
-If B<llvm-ranlib> succeeds, it will exit with 0.  If an error occurs, a non-zero
-exit code will be returned.
-
-=head1 SEE ALSO
-
-L<llvm-ar|llvm-ar>, ranlib(1)
-
-=head1 AUTHORS
-
-Maintained by the LLVM Team (L<http://llvm.org>).
-
-=cut
diff --git a/libclamav/c++/llvm/docs/CommandGuide/llvmc.pod b/libclamav/c++/llvm/docs/CommandGuide/llvmc.pod
deleted file mode 100644
index e5e0651..0000000
--- a/libclamav/c++/llvm/docs/CommandGuide/llvmc.pod
+++ /dev/null
@@ -1,190 +0,0 @@
-=pod
-
-=head1 NAME
-
-llvmc - The LLVM Compiler Driver (WIP)
-
-=head1 SYNOPSIS
-
-B<llvmc> [I<options>] I<filenames...>
-
-=head1 DESCRIPTION
-
-B<llvmc> is a configurable driver for invoking other LLVM (and non-LLVM) tools
-in order to compile, optimize and link software for multiple languages. For
-those familiar with FSF's B<gcc> tool, it is very similar.  Please note that
-B<llvmc> is considered an experimental tool.
-
-=head1 OPTIONS
-
-=head2 Built-in Options
-
-LLVMC has some built-in options that can't be overridden in the
-configuration libraries.
-
-=over
-
-=item B<-o> I<filename>
-
-Output file name.
-
-=item B<-x> I<language>
-
-Specify the language of the following input files until the next B<-x>
-option.
-
-=item B<-load> I<plugin_name>
-
-Load the specified plugin DLL. Example:
-S<-load $LLVM_DIR/Release/lib/LLVMCSimple.so>.
-
-=item B<-v> or B<--verbose>
-
-Enable verbose mode, i.e. print out all executed commands.
-
-=item B<--check-graph>
-
-Check the compilation for common errors like mismatched output/input language
-names, multiple default edges and cycles. Because of plugins, these checks can't
-be performed at compile-time. Exit with code zero if no errors were found, and
-return the number of found errors otherwise. Hidden option, useful for debugging
-LLVMC plugins.
-
-=item B<--view-graph>
-
-Show a graphical representation of the compilation graph and exit. Requires that
-you have I<dot> and I<gv> programs installed. Hidden option, useful for
-debugging LLVMC plugins.
-
-=item B<--write-graph>
-
-Write a I<compilation-graph.dot> file in the current directory with the
-compilation graph description in Graphviz format (identical to the file used by
-the B<--view-graph> option). The B<-o> option can be used to set the output file
-name. Hidden option, useful for debugging LLVMC plugins.
-
-=item B<--save-temps>
-
-Write temporary files to the current directory and do not delete them on
-exit. This option can also take an argument: the I<--save-temps=obj> switch will
-write files into the directory specified with the I<-o> option. The
-I<--save-temps=cwd> and I<--save-temps> switches are both synonyms for the
-default behaviour.
-
-=item B<--temp-dir> I<directory>
-
-Store temporary files in the given directory. This directory is deleted on exit
-unless I<--save-temps> is specified. If I<--save-temps=obj> is also specified,
-I<--temp-dir> is given the precedence.
-
-=item B<--help>
-
-Print a summary of command-line options and exit.
-
-=item B<--help-hidden>
-
-Print a summary of command-line options and exit. Print help even for
-options intended for developers.
-
-=item B<--version>
-
-Print version information and exit.
-
-=item B<@>I<file>
-
-Read command-line options from I<file>. The options read are inserted
-in place of the original @I<file> option. If I<file> does not exist, or
-cannot be read, then the option will be treated literally, and not
-removed.
-
-Options in I<file> are separated by whitespace. A whitespace character
-may be included in an option by surrounding the entire option in
-either single or double quotes. Any character (including a backslash)
-may be included by prefixing the character to be included with a
-backslash. The file may itself contain additional @I<file> options;
-any such options will be processed recursively.
-
-
-=back
-
-
-=head2 Control Options
-
-By default, LLVMC is built with some standard configuration libraries
-that define the following options:
-
-=over
-
-=item B<-clang>
-
-Use Clang instead of llvm-gcc.
-
-=item B<-opt>
-
-Enable optimization passes with B<opt>. To pass options to the B<opt> program
-use the B<-Wo,> option.
-
-=item B<-I> I<directory>
-
-Add a directory to the header file search path.
-
-=item B<-L> I<directory>
-
-Add I<directory> to the library search path.
-
-=item B<-F> I<directory>
-
-Add I<directory> to the framework search path.
-
-=item B<-l>I<name>
-
-Link in the library libI<name>.[bc | a | so].  This library should
-be a bitcode library.
-
-=item B<-framework> I<name>
-
-Link in the library libI<name>.[bc | a | so].  This library should
-be a bitcode library.
-
-=item B<-emit-llvm>
-
-Output LLVM bitcode (with B<-c>) or assembly (with B<-S>) instead of native
-object (or assembly).  If B<-emit-llvm> is given without either B<-c> or B<-S>
-it has no effect.
-
-=item B<-Wa>
-
-Pass options to assembler.
-
-=item B<-Wl>
-
-Pass options to linker.
-
-=item B<-Wo>
-
-Pass options to opt.
-
-=item B<-Wllc>
-
-Pass options to llc (code generator).
-
-=back
-
-=head1 EXIT STATUS
-
-If B<llvmc> succeeds, it will exit with code 0.  Otherwise, if an
-error occurs, it will exit with a non-zero value. If one of the
-compilation tools returns a non-zero status, pending actions will be
-discarded and B<llvmc> will return the same result code as the failing
-compilation tool.
-
-=head1 SEE ALSO
-
-L<llvm-gcc|llvmgcc>, L<llvm-g++|llvmgxx>, L<llvm-as|llvm-as>,
-L<llvm-dis|llvm-dis>, L<llc|llc>, L<llvm-link|llvm-link>
-
-=head1 AUTHORS
-
-Maintained by the LLVM Team (L<http://llvm.org>).
-
-=cut
diff --git a/libclamav/c++/llvm/docs/CommandGuide/llvmgcc.pod b/libclamav/c++/llvm/docs/CommandGuide/llvmgcc.pod
deleted file mode 100644
index 9892ca7..0000000
--- a/libclamav/c++/llvm/docs/CommandGuide/llvmgcc.pod
+++ /dev/null
@@ -1,76 +0,0 @@
-=pod
-
-=head1 NAME
-
-llvm-gcc - LLVM C front-end
-
-=head1 SYNOPSIS
-
-B<llvm-gcc> [I<options>] I<filename>
-
-=head1 DESCRIPTION
-
-The B<llvm-gcc> command is the LLVM C front end.  It is a modified
-version of gcc that compiles C/ObjC programs into native objects, LLVM
-bitcode or LLVM assembly language, depending upon the options.
-
-By default, B<llvm-gcc> compiles to native objects just like GCC does. If the
-B<-emit-llvm> and B<-c> options are given then it will generate LLVM bitcode files
-instead. If B<-emit-llvm> and B<-S> are given, then it will generate LLVM
-assembly.
-
-Being derived from the GNU Compiler Collection, B<llvm-gcc> has many
-of gcc's features and accepts most of gcc's options.  It handles a
-number of gcc's extensions to the C programming language.  See the gcc
-documentation for details.
-
-=head1 OPTIONS
-
-=over
-
-=item B<--help>
-
-Print a summary of command line options.
-
-=item B<-o> I<filename>
-
-Specify the output file to be I<filename>.
-
-=item B<-I> I<directory>
-
-Add a directory to the header file search path.  This option can be
-repeated.
-
-=item B<-L> I<directory>
-
-Add I<directory> to the library search path.  This option can be
-repeated.
-
-=item B<-l>I<name>
-
-Link in the library libI<name>.[bc | a | so].  This library should
-be a bitcode library.
-
-=item B<-emit-llvm>
-
-Make the output be LLVM bitcode (with B<-c>) or assembly (with B<-s>) instead
-of native object (or assembly).  If B<-emit-llvm> is given without either B<-c>
-or B<-S> it has no effect.
-
-=back
-
-=head1 EXIT STATUS
-
-If B<llvm-gcc> succeeds, it will exit with 0.  Otherwise, if an error
-occurs, it will exit with a non-zero value.
-
-=head1 SEE ALSO
-
-L<llvm-g++|llvmgxx>
-
-=head1 AUTHORS
-
-Maintained by the LLVM Team (L<http://llvm.org>).
-
-=cut
-
diff --git a/libclamav/c++/llvm/docs/CommandGuide/llvmgxx.pod b/libclamav/c++/llvm/docs/CommandGuide/llvmgxx.pod
deleted file mode 100644
index 64b670e..0000000
--- a/libclamav/c++/llvm/docs/CommandGuide/llvmgxx.pod
+++ /dev/null
@@ -1,85 +0,0 @@
-=pod
-
-=head1 NAME
-
-llvm-g++ - LLVM C++ front-end
-
-=head1 SYNOPSIS
-
-B<llvm-g++> [I<options>] I<filename>
-
-=head1 DESCRIPTION
-
-The B<llvm-g++> command is the LLVM C++ front end.  It is a modified
-version of g++ that compiles C++/ObjC++ programs into native code, 
-LLVM bitcode or assembly language, depending upon the options.
-
-By default, B<llvm-g++> compiles to native objects just like GCC does. If the
-B<-emit-llvm> option is given then it will generate LLVM bitcode files instead.
-If B<-S> (assembly) is also given, then it will generate LLVM assembly. 
-
-Being derived from the GNU Compiler Collection, B<llvm-g++> has many
-of g++'s features and accepts most of g++'s options.  It handles a
-number of g++'s extensions to the C++ programming language.
-
-=head1 OPTIONS
-
-=over
-
-=item B<--help>
-
-Print a summary of command line options.
-
-=item B<-S>
-
-Do not generate an LLVM bitcode file.  Rather, compile the source
-file into an LLVM assembly language file.
-
-=item B<-c>
-
-Do not generate a linked executable.  Rather, compile the source
-file into an LLVM bitcode file.  This bitcode file can then be
-linked with other bitcode files later on to generate a full LLVM
-executable.
-
-=item B<-o> I<filename>
-
-Specify the output file to be I<filename>.
-
-=item B<-I> I<directory>
-
-Add a directory to the header file search path.  This option can be
-repeated.
-
-=item B<-L> I<directory>
-
-Add I<directory> to the library search path.  This option can be
-repeated.
-
-=item B<-l>I<name>
-
-Link in the library libI<name>.[bc | a | so].  This library should
-be a bitcode library.
-
-=item B<-emit-llvm>
-
-Make the output be LLVM bitcode (or assembly) instead of native object (or
-assembly).
-
-=back
-
-=head1 EXIT STATUS
-
-If B<llvm-g++> succeeds, it will exit with 0.  Otherwise, if an error
-occurs, it will exit with a non-zero value.
-
-=head1 SEE ALSO
-
-L<llvm-gcc|llvmgcc>
-
-=head1 AUTHORS
-
-Maintained by the LLVM Team (L<http://llvm.org>).
-
-=cut
-
diff --git a/libclamav/c++/llvm/docs/CommandGuide/manpage.css b/libclamav/c++/llvm/docs/CommandGuide/manpage.css
deleted file mode 100644
index c922564..0000000
--- a/libclamav/c++/llvm/docs/CommandGuide/manpage.css
+++ /dev/null
@@ -1,256 +0,0 @@
-/* Based on http://www.perldoc.com/css/perldoc.css */
-
- at import url("../llvm.css");
-
-body { font-family: Arial,Helvetica; }
-
-blockquote { margin: 10pt;  }
-
-h1, a { color: #336699; }
-
-
-/*** Top menu style ****/
-.mmenuon { 
- font-family: Arial,Helvetica; font-weight: bold; text-decoration: none;
- color: #ff6600; font-size: 10pt;
-}
-.mmenuoff { 
- font-family: Arial,Helvetica; font-weight: bold; text-decoration: none;
- color: #ffffff; font-size: 10pt;
-}	  
-.cpyright {
- font-family: Arial,Helvetica; font-weight: bold; text-decoration: none;
- color: #ffffff; font-size: xx-small;
-}
-.cpyrightText {
- font-family: Arial,Helvetica; font-weight: bold; text-decoration: none;
- color: #ffffff; font-size: xx-small;
-}
-.sections { 
- font-family: Arial,Helvetica; font-weight: bold; text-decoration: none;
- color: #336699; font-size: 11pt;
-}	 
-.dsections { 
- font-family: Arial,Helvetica; font-weight: bold; text-decoration: none;
- color: #336699; font-size: 12pt;
-}	
-.slink { 
- font-family: Arial,Helvetica; font-weight: normal; text-decoration: none;
- color: #000000; font-size: 9pt;
-}	 
-
-.slink2 { font-family: Arial,Helvetica; text-decoration: none; color: #336699; }	 
-
-.maintitle { 
- font-family: Arial,Helvetica; font-weight: bold; text-decoration: none;
- color: #336699; font-size: 18pt;
-}	 
-.dblArrow {
- font-family: Arial,Helvetica; font-weight: bold; text-decoration: none;
- color: #336699; font-size: small;
-}
-.menuSec {
- font-family: Arial,Helvetica; font-weight: bold; text-decoration: none;
- color: #336699; font-size: small;
-}
-
-.newstext {
- font-family: Arial,Helvetica; font-size: small;
-}
-
-.linkmenu {
- font-family: Arial,Helvetica; color: #000000; font-weight: bold;
- text-decoration: none;
-}
-
-P {
- font-family: Arial,Helvetica;
-}
-
-PRE {
-    font-size: 10pt;
-}
-.quote { 
- font-family: Times; text-decoration: none;
- color: #000000; font-size: 9pt; font-style: italic;
-}	
-.smstd { font-family: Arial,Helvetica; color: #000000; font-size: x-small; } 
-.std { font-family: Arial,Helvetica; color: #000000; } 
-.meerkatTitle { 
- font-family: sans-serif; font-size: x-small;  color: black;    }
-
-.meerkatDescription { font-family: sans-serif; font-size: 10pt; color: black }
-.meerkatCategory { 
- font-family: sans-serif; font-size: 9pt; font-weight: bold; font-style: italic; 
- color: brown; }
-.meerkatChannel { 
- font-family: sans-serif; font-size: 9pt; font-style: italic; color: brown; }
-.meerkatDate { font-family: sans-serif; font-size: xx-small; color: #336699; }
-
-.tocTitle {
- font-family: Arial,Helvetica; font-weight: bold; text-decoration: none;
- color: #333333; font-size: 10pt;
-}
-
-.toc-item {
- font-family: Arial,Helvetica; font-weight: bold; 
- color: #336699; font-size: 10pt; text-decoration: underline;
-}
-
-.perlVersion {
- font-family: Arial,Helvetica; font-weight: bold; 
- color: #336699; font-size: 10pt; text-decoration: none;
-}
-
-.podTitle {
- font-family: Arial,Helvetica; font-weight: bold; text-decoration: none;
- color: #000000;
-}
-
-.docTitle {
- font-family: Arial,Helvetica; font-weight: bold; text-decoration: none;
- color: #000000; font-size: 10pt;
-}
-.dotDot {
- font-family: Arial,Helvetica; font-weight: bold; 
- color: #000000; font-size: 9pt;
-}
-
-.docSec {
- font-family: Arial,Helvetica; font-weight: normal; 
- color: #333333; font-size: 9pt;
-}
-.docVersion {
- font-family: Arial,Helvetica; font-weight: bold; text-decoration: none;
- color: #336699; font-size: 10pt;
-}
-
-.docSecs-on {
- font-family: Arial,Helvetica; font-weight: normal; text-decoration: none;
- color: #ff0000; font-size: 10pt;
-}
-.docSecs-off {
- font-family: Arial,Helvetica; font-weight: normal; text-decoration: none;
- color: #333333; font-size: 10pt;
-}
-
-h2 {
- font-family: Arial,Helvetica; font-weight: bold; text-decoration: none;
- color: #336699; font-size: medium;
-}
-h1 {
- font-family: Verdana,Arial,Helvetica; font-weight: bold; text-decoration: none;
- color: #336699; font-size: large;
-}
-
-DL {
- font-family: Arial,Helvetica; font-weight: normal; text-decoration: none;
- color: #333333; font-size: 10pt;
-}
-
-UL > LI > A {
- font-family: Arial,Helvetica; font-weight: bold;
- color: #336699; font-size: 10pt;
-}
-
-.moduleInfo {
- font-family: Arial,Helvetica; font-weight: bold; text-decoration: none;
- color: #333333; font-size: 11pt;
-}
-
-.moduleInfoSec {
- font-family: Arial,Helvetica; font-weight: bold; text-decoration: none;
- color: #336699; font-size: 10pt;
-}
-
-.moduleInfoVal {
- font-family: Arial,Helvetica; font-weight: normal; text-decoration: underline;
- color: #000000; font-size: 10pt;
-}
-
-.cpanNavTitle {
- font-family: Arial,Helvetica; font-weight: bold; 
- color: #ffffff; font-size: 10pt;
-}
-.cpanNavLetter {
- font-family: Arial,Helvetica; font-weight: bold; text-decoration: none; 
- color: #333333; font-size: 9pt;
-}
-.cpanCat {
- font-family: Arial,Helvetica; font-weight: bold; text-decoration: none; 
- color: #336699; font-size: 9pt;
-}
-
-.bttndrkblue-bkgd-top {
-	background-color: #225688;
-	background-image: url(/global/mvc_objects/images/bttndrkblue_bgtop.gif);
-}
-.bttndrkblue-bkgd-left {
-	background-color: #225688;
-	background-image: url(/global/mvc_objects/images/bttndrkblue_bgleft.gif);
-}
-.bttndrkblue-bkgd {
-	padding-top: 0px;
-	padding-bottom: 0px;
-	margin-bottom: 0px;
-	margin-top: 0px;
-	background-repeat: no-repeat;
-	background-color: #225688;
-	background-image: url(/global/mvc_objects/images/bttndrkblue_bgmiddle.gif);
-	vertical-align: top;
-}
-.bttndrkblue-bkgd-right {
-	background-color: #225688;
-	background-image: url(/global/mvc_objects/images/bttndrkblue_bgright.gif);
-}
-.bttndrkblue-bkgd-bottom {
-	background-color: #225688;
-	background-image: url(/global/mvc_objects/images/bttndrkblue_bgbottom.gif);
-}
-.bttndrkblue-text a {
-	color: #ffffff;
-	text-decoration: none;
-}
-a.bttndrkblue-text:hover {
-	color: #ffDD3C;
-	text-decoration: none;
-}
-.bg-ltblue {
-	background-color: #f0f5fa;
-} 
-
-.border-left-b {
-	background: #f0f5fa url(/i/corner-leftline.gif) repeat-y;
-} 
-
-.border-right-b {
-	background: #f0f5fa url(/i/corner-rightline.gif) repeat-y;
-} 
-
-.border-top-b {
-	background: #f0f5fa url(/i/corner-topline.gif) repeat-x;
-} 
-
-.border-bottom-b {
-	background: #f0f5fa url(/i/corner-botline.gif) repeat-x;
-} 
-
-.border-right-w {
-	background: #ffffff url(/i/corner-rightline.gif) repeat-y;
-} 
-
-.border-top-w {
-	background: #ffffff url(/i/corner-topline.gif) repeat-x;
-} 
-
-.border-bottom-w {
-	background: #ffffff url(/i/corner-botline.gif) repeat-x;
-} 
-
-.bg-white {
-	background-color: #ffffff;
-} 
-
-.border-left-w {
-	background: #ffffff url(/i/corner-leftline.gif) repeat-y;
-} 
diff --git a/libclamav/c++/llvm/docs/CommandGuide/opt.pod b/libclamav/c++/llvm/docs/CommandGuide/opt.pod
deleted file mode 100644
index d1d1db5..0000000
--- a/libclamav/c++/llvm/docs/CommandGuide/opt.pod
+++ /dev/null
@@ -1,143 +0,0 @@
-=pod
-
-=head1 NAME
-
-opt - LLVM optimizer
-
-=head1 SYNOPSIS
-
-B<opt> [I<options>] [I<filename>]
-
-=head1 DESCRIPTION
-
-The B<opt> command is the modular LLVM optimizer and analyzer.  It takes LLVM 
-source files as input, runs the specified optimizations or analyses on it, and then
-outputs the optimized file or the analysis results.  The function of 
-B<opt> depends on whether the B<-analyze> option is given. 
-
-When B<-analyze> is specified, B<opt> performs various analyses of the input
-source.  It will usually print the results on standard output, but in a few
-cases, it will print output to standard error or generate a file with the
-analysis output, which is usually done when the output is meant for another
-program.
-
-While B<-analyze> is I<not> given, B<opt> attempts to produce an optimized 
-output file.  The optimizations available via B<opt> depend upon what 
-libraries were linked into it as well as any additional libraries that have 
-been loaded with the B<-load> option.  Use the B<-help> option to determine 
-what optimizations you can use.
-
-If I<filename> is omitted from the command line or is I<->, B<opt> reads its
-input from standard input. Inputs can be in either the LLVM assembly language
-format (.ll) or the LLVM bitcode format (.bc).
-
-If an output filename is not specified with the B<-o> option, B<opt>
-writes its output to the standard output.
-
-=head1 OPTIONS
-
-=over
-
-=item B<-f>
-
-Enable binary output on terminals.  Normally, B<opt> will refuse to
-write raw bitcode output if the output stream is a terminal. With this option,
-B<opt> will write raw bitcode regardless of the output device.
-
-=item B<-help>
-
-Print a summary of command line options. 
-
-=item B<-o> I<filename>
-
-Specify the output filename.
-
-=item B<-S>
-
-Write output in LLVM intermediate language (instead of bitcode).
-
-=item B<-{passname}>
-
-B<opt> provides the ability to run any of LLVM's optimization or analysis passes
-in any order. The B<-help> option lists all the passes available. The order in
-which the options occur on the command line are the order in which they are
-executed (within pass constraints). 
-
-=item B<-std-compile-opts>
-
-This is short hand for a standard list of I<compile time optimization> passes.
-This is typically used to optimize the output from the llvm-gcc front end. It
-might be useful for other front end compilers as well. To discover the full set
-of options available, use the following command:
-
-   llvm-as < /dev/null | opt -std-compile-opts -disable-output -debug-pass=Arguments
-
-=item B<-disable-inlining>
-
-This option is only meaningful when B<-std-compile-opts> is given. It simply
-removes the inlining pass from the standard list.
-
-=item B<-disable-opt>
-
-This option is only meaningful when B<-std-compile-opts> is given. It disables
-most, but not all, of the B<-std-compile-opts>. The ones that remain are
-B<-verify>, B<-lower-setjmp>, and B<-funcresolve>.
-
-=item B<-strip-debug>
-
-This option causes opt to strip debug information from the module before 
-applying other optimizations. It is essentially the same as B<-strip> but it
-ensures that stripping of debug information is done first.
-
-=item B<-verify-each>
-
-This option causes opt to add a verify pass after every pass otherwise specified
-on the command line (including B<-verify>).  This is useful for cases where it 
-is suspected that a pass is creating an invalid module but it is not clear which
-pass is doing it. The combination of B<-std-compile-opts> and B<-verify-each>
-can quickly track down this kind of problem.
-
-=item B<-profile-info-file> I<filename>
-
-Specify the name of the file loaded by the -profile-loader option.
-
-=item B<-stats>
-
-Print statistics.
-
-=item B<-time-passes>
-
-Record the amount of time needed for each pass and print it to standard
-error.
-
-=item B<-debug>
-
-If this is a debug build, this option will enable debug printouts
-from passes which use the I<DEBUG()> macro.  See the B<LLVM Programmer's
-Manual>, section I<#DEBUG> for more information.
-
-=item B<-load>=I<plugin>
-
-Load the dynamic object I<plugin>.  This object should register new optimization
-or analysis passes. Once loaded, the object will add new command line options to
-enable various optimizations or analyses.  To see the new complete list of 
-optimizations, use the B<-help> and B<-load> options together. For example:
-
-   opt -load=plugin.so -help
-
-=item B<-p>
-
-Print module after each transformation.
-
-=back
-
-=head1 EXIT STATUS
-
-If B<opt> succeeds, it will exit with 0.  Otherwise, if an error
-occurs, it will exit with a non-zero value.
-
-=head1 AUTHORS
-
-Maintained by the LLVM Team (L<http://llvm.org>).
-
-=cut
diff --git a/libclamav/c++/llvm/docs/CommandGuide/tblgen.pod b/libclamav/c++/llvm/docs/CommandGuide/tblgen.pod
deleted file mode 100644
index c8244af..0000000
--- a/libclamav/c++/llvm/docs/CommandGuide/tblgen.pod
+++ /dev/null
@@ -1,115 +0,0 @@
-
-=pod
-
-=head1 NAME
-
-tblgen - Target Description To C++ Code Generator
-
-=head1 SYNOPSIS
-
-B<tblgen> [I<options>] [I<filename>]
-
-=head1 DESCRIPTION
-
-B<tblgen> translates from target description (.td) files into C++ code that can
-be included in the definition of an LLVM target library. Most users of LLVM will
-not need to use this program. It is only for assisting with writing an LLVM
-target backend.
-
-The input and output of B<tblgen> is beyond the scope of this short
-introduction. Please see the I<CodeGeneration> page in the LLVM documentation.
-
-The F<filename> argument specifies the name of a Target Description (.td) file
-to read as input.
-
-=head1 OPTIONS
-
-=over
-
-=item B<--help>
-
-Print a summary of command line options.
-
-=item B<-o> F<filename>
-
-Specify the output file name.  If F<filename> is C<->, then B<tblgen>
-sends its output to standard output.
-
-=item B<-I> F<directory>
-
-Specify where to find other target description files for inclusion. The
-F<directory> value should be a full or partial path to a directory that contains
-target description files.
-
-=item B<-asmwriternum> F<N>
-
-Make -gen-asm-writer emit assembly writer number F<N>.
-
-=item B<-class> F<class Name>
-
-Print the enumeration list for this class.
-
-=item B<-print-records>
-
-Print all records to standard output (default).
-
-=item B<-print-enums>
-
-Print enumeration values for a class
-
-=item B<-gen-emitter>
-
-Generate machine code emitter.
-
-=item B<-gen-register-enums>
-
-Generate the enumeration values for all registers.
-
-=item B<-gen-register-desc>
-
-Generate a register info description for each register.
-
-=item B<-gen-register-desc-header>
-
-Generate a register info description header for each register.
-
-=item B<-gen-instr-enums>
-
-Generate enumeration values for instructions.
-
-=item B<-gen-instr-desc>
-
-Generate instruction descriptions.
-
-=item B<-gen-asm-writer>
-
-Generate the assembly writer.
-
-=item B<-gen-dag-isel>
-
-Generate a DAG (Directed Acycle Graph) instruction selector.
-
-=item B<-gen-subtarget>
-
-Generate subtarget enumerations.
-
-=item B<-gen-intrinsic>
-
-Generate intrinsic information.
-
-=item B<-version>
-
-Show the version number of this program.
-
-=back
-
-=head1 EXIT STATUS
-
-If B<tblgen> succeeds, it will exit with 0.  Otherwise, if an error
-occurs, it will exit with a non-zero value.
-
-=head1 AUTHORS
-
-Maintained by The LLVM Team (L<http://llvm.org>).
-
-=cut
diff --git a/libclamav/c++/llvm/docs/CommandLine.html b/libclamav/c++/llvm/docs/CommandLine.html
deleted file mode 100644
index cefb6f8..0000000
--- a/libclamav/c++/llvm/docs/CommandLine.html
+++ /dev/null
@@ -1,1979 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-                      "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-  <title>CommandLine 2.0 Library Manual</title>
-  <link rel="stylesheet" href="llvm.css" type="text/css">
-</head>
-<body>
-
-<div class="doc_title">
-  CommandLine 2.0 Library Manual
-</div>
-
-<ol>
-  <li><a href="#introduction">Introduction</a></li>
-
-  <li><a href="#quickstart">Quick Start Guide</a>
-    <ol>
-      <li><a href="#bool">Boolean Arguments</a></li>
-      <li><a href="#alias">Argument Aliases</a></li>
-      <li><a href="#onealternative">Selecting an alternative from a
-                                    set of possibilities</a></li>
-      <li><a href="#namedalternatives">Named alternatives</a></li>
-      <li><a href="#list">Parsing a list of options</a></li>
-      <li><a href="#bits">Collecting options as a set of flags</a></li>
-      <li><a href="#description">Adding freeform text to help output</a></li>
-    </ol></li>
-
-  <li><a href="#referenceguide">Reference Guide</a>
-    <ol>
-      <li><a href="#positional">Positional Arguments</a>
-        <ul>
-        <li><a href="#--">Specifying positional options with hyphens</a></li>
-        <li><a href="#getPosition">Determining absolute position with
-          getPosition</a></li>
-        <li><a href="#cl::ConsumeAfter">The <tt>cl::ConsumeAfter</tt>
-             modifier</a></li>
-        </ul></li>
-
-      <li><a href="#storage">Internal vs External Storage</a></li>
-
-      <li><a href="#attributes">Option Attributes</a></li>
-
-      <li><a href="#modifiers">Option Modifiers</a>
-        <ul>
-        <li><a href="#hiding">Hiding an option from <tt>--help</tt>
-            output</a></li>
-        <li><a href="#numoccurrences">Controlling the number of occurrences
-                                     required and allowed</a></li>
-        <li><a href="#valrequired">Controlling whether or not a value must be
-                                   specified</a></li>
-        <li><a href="#formatting">Controlling other formatting options</a></li>
-        <li><a href="#misc">Miscellaneous option modifiers</a></li>
-        <li><a href="#response">Response files</a></li>
-        </ul></li>
-
-      <li><a href="#toplevel">Top-Level Classes and Functions</a>
-        <ul>
-        <li><a href="#cl::ParseCommandLineOptions">The
-            <tt>cl::ParseCommandLineOptions</tt> function</a></li>
-        <li><a href="#cl::ParseEnvironmentOptions">The
-            <tt>cl::ParseEnvironmentOptions</tt> function</a></li>
-        <li><a href="#cl::SetVersionPrinter">The <tt>cl::SetVersionPrinter</tt>
-          function</a></li>
-        <li><a href="#cl::opt">The <tt>cl::opt</tt> class</a></li>
-        <li><a href="#cl::list">The <tt>cl::list</tt> class</a></li>
-        <li><a href="#cl::bits">The <tt>cl::bits</tt> class</a></li>
-        <li><a href="#cl::alias">The <tt>cl::alias</tt> class</a></li>
-        <li><a href="#cl::extrahelp">The <tt>cl::extrahelp</tt> class</a></li>
-        </ul></li>
-
-      <li><a href="#builtinparsers">Builtin parsers</a>
-        <ul>
-        <li><a href="#genericparser">The Generic <tt>parser&lt;t&gt;</tt>
-            parser</a></li>
-        <li><a href="#boolparser">The <tt>parser&lt;bool&gt;</tt>
-            specialization</a></li>
-        <li><a href="#boolOrDefaultparser">The <tt>parser&lt;boolOrDefault&gt;</tt>
-            specialization</a></li>
-        <li><a href="#stringparser">The <tt>parser&lt;string&gt;</tt>
-            specialization</a></li>
-        <li><a href="#intparser">The <tt>parser&lt;int&gt;</tt>
-            specialization</a></li>
-        <li><a href="#doubleparser">The <tt>parser&lt;double&gt;</tt> and
-            <tt>parser&lt;float&gt;</tt> specializations</a></li>
-        </ul></li>
-    </ol></li>
-  <li><a href="#extensionguide">Extension Guide</a>
-    <ol>
-      <li><a href="#customparser">Writing a custom parser</a></li>
-      <li><a href="#explotingexternal">Exploiting external storage</a></li>
-      <li><a href="#dynamicopts">Dynamically adding command line
-          options</a></li>
-    </ol></li>
-</ol>
-
-<div class="doc_author">
-  <p>Written by <a href="mailto:sabre at nondot.org">Chris Lattner</a></p>
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="introduction">Introduction</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>This document describes the CommandLine argument processing library.  It will
-show you how to use it, and what it can do.  The CommandLine library uses a
-declarative approach to specifying the command line options that your program
-takes.  By default, these options declarations implicitly hold the value parsed
-for the option declared (of course this <a href="#storage">can be
-changed</a>).</p>
-
-<p>Although there are a <b>lot</b> of command line argument parsing libraries
-out there in many different languages, none of them fit well with what I needed.
-By looking at the features and problems of other libraries, I designed the
-CommandLine library to have the following features:</p>
-
-<ol>
-<li>Speed: The CommandLine library is very quick and uses little resources.  The
-parsing time of the library is directly proportional to the number of arguments
-parsed, not the the number of options recognized.  Additionally, command line
-argument values are captured transparently into user defined global variables,
-which can be accessed like any other variable (and with the same
-performance).</li>
-
-<li>Type Safe: As a user of CommandLine, you don't have to worry about
-remembering the type of arguments that you want (is it an int?  a string? a
-bool? an enum?) and keep casting it around.  Not only does this help prevent
-error prone constructs, it also leads to dramatically cleaner source code.</li>
-
-<li>No subclasses required: To use CommandLine, you instantiate variables that
-correspond to the arguments that you would like to capture, you don't subclass a
-parser.  This means that you don't have to write <b>any</b> boilerplate
-code.</li>
-
-<li>Globally accessible: Libraries can specify command line arguments that are
-automatically enabled in any tool that links to the library.  This is possible
-because the application doesn't have to keep a list of arguments to pass to
-the parser.  This also makes supporting <a href="#dynamicopts">dynamically
-loaded options</a> trivial.</li>
-
-<li>Cleaner: CommandLine supports enum and other types directly, meaning that
-there is less error and more security built into the library.  You don't have to
-worry about whether your integral command line argument accidentally got
-assigned a value that is not valid for your enum type.</li>
-
-<li>Powerful: The CommandLine library supports many different types of
-arguments, from simple <a href="#boolparser">boolean flags</a> to <a
-href="#cl::opt">scalars arguments</a> (<a href="#stringparser">strings</a>, <a
-href="#intparser">integers</a>, <a href="#genericparser">enums</a>, <a
-href="#doubleparser">doubles</a>), to <a href="#cl::list">lists of
-arguments</a>.  This is possible because CommandLine is...</li>
-
-<li>Extensible: It is very simple to add a new argument type to CommandLine.
-Simply specify the parser that you want to use with the command line option when
-you declare it.  <a href="#customparser">Custom parsers</a> are no problem.</li>
-
-<li>Labor Saving: The CommandLine library cuts down on the amount of grunt work
-that you, the user, have to do.  For example, it automatically provides a
-<tt>--help</tt> option that shows the available command line options for your
-tool.  Additionally, it does most of the basic correctness checking for
-you.</li>
-
-<li>Capable: The CommandLine library can handle lots of different forms of
-options often found in real programs.  For example, <a
-href="#positional">positional</a> arguments, <tt>ls</tt> style <a
-href="#cl::Grouping">grouping</a> options (to allow processing '<tt>ls
--lad</tt>' naturally), <tt>ld</tt> style <a href="#cl::Prefix">prefix</a>
-options (to parse '<tt>-lmalloc -L/usr/lib</tt>'), and <a
-href="#cl::ConsumeAfter">interpreter style options</a>.</li>
-
-</ol>
-
-<p>This document will hopefully let you jump in and start using CommandLine in
-your utility quickly and painlessly.  Additionally it should be a simple
-reference manual to figure out how stuff works.  If it is failing in some area
-(or you want an extension to the library), nag the author, <a
-href="mailto:sabre at nondot.org">Chris Lattner</a>.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="quickstart">Quick Start Guide</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>This section of the manual runs through a simple CommandLine'ification of a
-basic compiler tool.  This is intended to show you how to jump into using the
-CommandLine library in your own program, and show you some of the cool things it
-can do.</p>
-
-<p>To start out, you need to include the CommandLine header file into your
-program:</p>
-
-<div class="doc_code"><pre>
-  #include "llvm/Support/CommandLine.h"
-</pre></div>
-
-<p>Additionally, you need to add this as the first line of your main
-program:</p>
-
-<div class="doc_code"><pre>
-int main(int argc, char **argv) {
-  <a href="#cl::ParseCommandLineOptions">cl::ParseCommandLineOptions</a>(argc, argv);
-  ...
-}
-</pre></div>
-
-<p>... which actually parses the arguments and fills in the variable
-declarations.</p>
-
-<p>Now that you are ready to support command line arguments, we need to tell the
-system which ones we want, and what type of arguments they are.  The CommandLine
-library uses a declarative syntax to model command line arguments with the
-global variable declarations that capture the parsed values.  This means that
-for every command line option that you would like to support, there should be a
-global variable declaration to capture the result.  For example, in a compiler,
-we would like to support the Unix-standard '<tt>-o &lt;filename&gt;</tt>' option
-to specify where to put the output.  With the CommandLine library, this is
-represented like this:</p>
-
-<a name="value_desc_example"></a>
-<div class="doc_code"><pre>
-<a href="#cl::opt">cl::opt</a>&lt;string&gt; OutputFilename("<i>o</i>", <a href="#cl::desc">cl::desc</a>("<i>Specify output filename</i>"), <a href="#cl::value_desc">cl::value_desc</a>("<i>filename</i>"));
-</pre></div>
-
-<p>This declares a global variable "<tt>OutputFilename</tt>" that is used to
-capture the result of the "<tt>o</tt>" argument (first parameter).  We specify
-that this is a simple scalar option by using the "<tt><a
-href="#cl::opt">cl::opt</a></tt>" template (as opposed to the <a
-href="#list">"<tt>cl::list</tt> template</a>), and tell the CommandLine library
-that the data type that we are parsing is a string.</p>
-
-<p>The second and third parameters (which are optional) are used to specify what
-to output for the "<tt>--help</tt>" option.  In this case, we get a line that
-looks like this:</p>
-
-<div class="doc_code"><pre>
-USAGE: compiler [options]
-
-OPTIONS:
-  -help             - display available options (--help-hidden for more)
-  <b>-o &lt;filename&gt;     - Specify output filename</b>
-</pre></div>
-
-<p>Because we specified that the command line option should parse using the
-<tt>string</tt> data type, the variable declared is automatically usable as a
-real string in all contexts that a normal C++ string object may be used.  For
-example:</p>
-
-<div class="doc_code"><pre>
-  ...
-  std::ofstream Output(OutputFilename.c_str());
-  if (Output.good()) ...
-  ...
-</pre></div>
-
-<p>There are many different options that you can use to customize the command
-line option handling library, but the above example shows the general interface
-to these options.  The options can be specified in any order, and are specified
-with helper functions like <a href="#cl::desc"><tt>cl::desc(...)</tt></a>, so
-there are no positional dependencies to remember.  The available options are
-discussed in detail in the <a href="#referenceguide">Reference Guide</a>.</p>
-
-<p>Continuing the example, we would like to have our compiler take an input
-filename as well as an output filename, but we do not want the input filename to
-be specified with a hyphen (ie, not <tt>-filename.c</tt>).  To support this
-style of argument, the CommandLine library allows for <a
-href="#positional">positional</a> arguments to be specified for the program.
-These positional arguments are filled with command line parameters that are not
-in option form.  We use this feature like this:</p>
-
-<div class="doc_code"><pre>
-<a href="#cl::opt">cl::opt</a>&lt;string&gt; InputFilename(<a href="#cl::Positional">cl::Positional</a>, <a href="#cl::desc">cl::desc</a>("<i>&lt;input file&gt;</i>"), <a href="#cl::init">cl::init</a>("<i>-</i>"));
-</pre></div>
-
-<p>This declaration indicates that the first positional argument should be
-treated as the input filename.  Here we use the <tt><a
-href="#cl::init">cl::init</a></tt> option to specify an initial value for the
-command line option, which is used if the option is not specified (if you do not
-specify a <tt><a href="#cl::init">cl::init</a></tt> modifier for an option, then
-the default constructor for the data type is used to initialize the value).
-Command line options default to being optional, so if we would like to require
-that the user always specify an input filename, we would add the <tt><a
-href="#cl::Required">cl::Required</a></tt> flag, and we could eliminate the
-<tt><a href="#cl::init">cl::init</a></tt> modifier, like this:</p>
-
-<div class="doc_code"><pre>
-<a href="#cl::opt">cl::opt</a>&lt;string&gt; InputFilename(<a href="#cl::Positional">cl::Positional</a>, <a href="#cl::desc">cl::desc</a>("<i>&lt;input file&gt;</i>"), <b><a href="#cl::Required">cl::Required</a></b>);
-</pre></div>
-
-<p>Again, the CommandLine library does not require the options to be specified
-in any particular order, so the above declaration is equivalent to:</p>
-
-<div class="doc_code"><pre>
-<a href="#cl::opt">cl::opt</a>&lt;string&gt; InputFilename(<a href="#cl::Positional">cl::Positional</a>, <a href="#cl::Required">cl::Required</a>, <a href="#cl::desc">cl::desc</a>("<i>&lt;input file&gt;</i>"));
-</pre></div>
-
-<p>By simply adding the <tt><a href="#cl::Required">cl::Required</a></tt> flag,
-the CommandLine library will automatically issue an error if the argument is not
-specified, which shifts all of the command line option verification code out of
-your application into the library.  This is just one example of how using flags
-can alter the default behaviour of the library, on a per-option basis.  By
-adding one of the declarations above, the <tt>--help</tt> option synopsis is now
-extended to:</p>
-
-<div class="doc_code"><pre>
-USAGE: compiler [options] <b>&lt;input file&gt;</b>
-
-OPTIONS:
-  -help             - display available options (--help-hidden for more)
-  -o &lt;filename&gt;     - Specify output filename
-</pre></div>
-
-<p>... indicating that an input filename is expected.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="bool">Boolean Arguments</a>
-</div>
-
-<div class="doc_text">
-
-<p>In addition to input and output filenames, we would like the compiler example
-to support three boolean flags: "<tt>-f</tt>" to force writing binary output to
-a terminal, "<tt>--quiet</tt>" to enable quiet mode, and "<tt>-q</tt>" for
-backwards compatibility with some of our users.  We can support these by
-declaring options of boolean type like this:</p>
-
-<div class="doc_code"><pre>
-<a href="#cl::opt">cl::opt</a>&lt;bool&gt; Force ("<i>f</i>", <a href="#cl::desc">cl::desc</a>("<i>Enable binary output on terminals</i>"));
-<a href="#cl::opt">cl::opt</a>&lt;bool&gt; Quiet ("<i>quiet</i>", <a href="#cl::desc">cl::desc</a>("<i>Don't print informational messages</i>"));
-<a href="#cl::opt">cl::opt</a>&lt;bool&gt; Quiet2("<i>q</i>", <a href="#cl::desc">cl::desc</a>("<i>Don't print informational messages</i>"), <a href="#cl::Hidden">cl::Hidden</a>);
-</pre></div>
-
-<p>This does what you would expect: it declares three boolean variables
-("<tt>Force</tt>", "<tt>Quiet</tt>", and "<tt>Quiet2</tt>") to recognize these
-options.  Note that the "<tt>-q</tt>" option is specified with the "<a
-href="#cl::Hidden"><tt>cl::Hidden</tt></a>" flag.  This modifier prevents it
-from being shown by the standard "<tt>--help</tt>" output (note that it is still
-shown in the "<tt>--help-hidden</tt>" output).</p>
-
-<p>The CommandLine library uses a <a href="#builtinparsers">different parser</a>
-for different data types.  For example, in the string case, the argument passed
-to the option is copied literally into the content of the string variable... we
-obviously cannot do that in the boolean case, however, so we must use a smarter
-parser.  In the case of the boolean parser, it allows no options (in which case
-it assigns the value of true to the variable), or it allows the values
-"<tt>true</tt>" or "<tt>false</tt>" to be specified, allowing any of the
-following inputs:</p>
-
-<div class="doc_code"><pre>
- compiler -f          # No value, 'Force' == true
- compiler -f=true     # Value specified, 'Force' == true
- compiler -f=TRUE     # Value specified, 'Force' == true
- compiler -f=FALSE    # Value specified, 'Force' == false
-</pre></div>
-
-<p>... you get the idea.  The <a href="#boolparser">bool parser</a> just turns
-the string values into boolean values, and rejects things like '<tt>compiler
--f=foo</tt>'.  Similarly, the <a href="#doubleparser">float</a>, <a
-href="#doubleparser">double</a>, and <a href="#intparser">int</a> parsers work
-like you would expect, using the '<tt>strtol</tt>' and '<tt>strtod</tt>' C
-library calls to parse the string value into the specified data type.</p>
-
-<p>With the declarations above, "<tt>compiler --help</tt>" emits this:</p>
-
-<div class="doc_code"><pre>
-USAGE: compiler [options] &lt;input file&gt;
-
-OPTIONS:
-  <b>-f     - Enable binary output on terminals</b>
-  -o     - Override output filename
-  <b>-quiet - Don't print informational messages</b>
-  -help  - display available options (--help-hidden for more)
-</pre></div>
-
-<p>and "<tt>compiler --help-hidden</tt>" prints this:</p>
-
-<div class="doc_code"><pre>
-USAGE: compiler [options] &lt;input file&gt;
-
-OPTIONS:
-  -f     - Enable binary output on terminals
-  -o     - Override output filename
-  <b>-q     - Don't print informational messages</b>
-  -quiet - Don't print informational messages
-  -help  - display available options (--help-hidden for more)
-</pre></div>
-
-<p>This brief example has shown you how to use the '<tt><a
-href="#cl::opt">cl::opt</a></tt>' class to parse simple scalar command line
-arguments.  In addition to simple scalar arguments, the CommandLine library also
-provides primitives to support CommandLine option <a href="#alias">aliases</a>,
-and <a href="#list">lists</a> of options.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="alias">Argument Aliases</a>
-</div>
-
-<div class="doc_text">
-
-<p>So far, the example works well, except for the fact that we need to check the
-quiet condition like this now:</p>
-
-<div class="doc_code"><pre>
-...
-  if (!Quiet &amp;&amp; !Quiet2) printInformationalMessage(...);
-...
-</pre></div>
-
-<p>... which is a real pain!  Instead of defining two values for the same
-condition, we can use the "<tt><a href="#cl::alias">cl::alias</a></tt>" class to make the "<tt>-q</tt>"
-option an <b>alias</b> for the "<tt>-quiet</tt>" option, instead of providing
-a value itself:</p>
-
-<div class="doc_code"><pre>
-<a href="#cl::opt">cl::opt</a>&lt;bool&gt; Force ("<i>f</i>", <a href="#cl::desc">cl::desc</a>("<i>Overwrite output files</i>"));
-<a href="#cl::opt">cl::opt</a>&lt;bool&gt; Quiet ("<i>quiet</i>", <a href="#cl::desc">cl::desc</a>("<i>Don't print informational messages</i>"));
-<a href="#cl::alias">cl::alias</a>     QuietA("<i>q</i>", <a href="#cl::desc">cl::desc</a>("<i>Alias for -quiet</i>"), <a href="#cl::aliasopt">cl::aliasopt</a>(Quiet));
-</pre></div>
-
-<p>The third line (which is the only one we modified from above) defines a
-"<tt>-q</tt>" alias that updates the "<tt>Quiet</tt>" variable (as specified by
-the <tt><a href="#cl::aliasopt">cl::aliasopt</a></tt> modifier) whenever it is
-specified.  Because aliases do not hold state, the only thing the program has to
-query is the <tt>Quiet</tt> variable now.  Another nice feature of aliases is
-that they automatically hide themselves from the <tt>-help</tt> output
-(although, again, they are still visible in the <tt>--help-hidden
-output</tt>).</p>
-
-<p>Now the application code can simply use:</p>
-
-<div class="doc_code"><pre>
-...
-  if (!Quiet) printInformationalMessage(...);
-...
-</pre></div>
-
-<p>... which is much nicer!  The "<tt><a href="#cl::alias">cl::alias</a></tt>"
-can be used to specify an alternative name for any variable type, and has many
-uses.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="onealternative">Selecting an alternative from a set of
-  possibilities</a>
-</div>
-
-<div class="doc_text">
-
-<p>So far we have seen how the CommandLine library handles builtin types like
-<tt>std::string</tt>, <tt>bool</tt> and <tt>int</tt>, but how does it handle
-things it doesn't know about, like enums or '<tt>int*</tt>'s?</p>
-
-<p>The answer is that it uses a table-driven generic parser (unless you specify
-your own parser, as described in the <a href="#extensionguide">Extension
-Guide</a>).  This parser maps literal strings to whatever type is required, and
-requires you to tell it what this mapping should be.</p>
-
-<p>Let's say that we would like to add four optimization levels to our
-optimizer, using the standard flags "<tt>-g</tt>", "<tt>-O0</tt>",
-"<tt>-O1</tt>", and "<tt>-O2</tt>".  We could easily implement this with boolean
-options like above, but there are several problems with this strategy:</p>
-
-<ol>
-<li>A user could specify more than one of the options at a time, for example,
-"<tt>compiler -O3 -O2</tt>".  The CommandLine library would not be able to
-catch this erroneous input for us.</li>
-
-<li>We would have to test 4 different variables to see which ones are set.</li>
-
-<li>This doesn't map to the numeric levels that we want... so we cannot easily
-see if some level &gt;= "<tt>-O1</tt>" is enabled.</li>
-
-</ol>
-
-<p>To cope with these problems, we can use an enum value, and have the
-CommandLine library fill it in with the appropriate level directly, which is
-used like this:</p>
-
-<div class="doc_code"><pre>
-enum OptLevel {
-  g, O1, O2, O3
-};
-
-<a href="#cl::opt">cl::opt</a>&lt;OptLevel&gt; OptimizationLevel(<a href="#cl::desc">cl::desc</a>("<i>Choose optimization level:</i>"),
-  <a href="#cl::values">cl::values</a>(
-    clEnumVal(g , "<i>No optimizations, enable debugging</i>"),
-    clEnumVal(O1, "<i>Enable trivial optimizations</i>"),
-    clEnumVal(O2, "<i>Enable default optimizations</i>"),
-    clEnumVal(O3, "<i>Enable expensive optimizations</i>"),
-   clEnumValEnd));
-
-...
-  if (OptimizationLevel &gt;= O2) doPartialRedundancyElimination(...);
-...
-</pre></div>
-
-<p>This declaration defines a variable "<tt>OptimizationLevel</tt>" of the
-"<tt>OptLevel</tt>" enum type.  This variable can be assigned any of the values
-that are listed in the declaration (Note that the declaration list must be
-terminated with the "<tt>clEnumValEnd</tt>" argument!).  The CommandLine
-library enforces
-that the user can only specify one of the options, and it ensure that only valid
-enum values can be specified.  The "<tt>clEnumVal</tt>" macros ensure that the
-command line arguments matched the enum values.  With this option added, our
-help output now is:</p>
-
-<div class="doc_code"><pre>
-USAGE: compiler [options] &lt;input file&gt;
-
-OPTIONS:
-  <b>Choose optimization level:
-    -g          - No optimizations, enable debugging
-    -O1         - Enable trivial optimizations
-    -O2         - Enable default optimizations
-    -O3         - Enable expensive optimizations</b>
-  -f            - Enable binary output on terminals
-  -help         - display available options (--help-hidden for more)
-  -o &lt;filename&gt; - Specify output filename
-  -quiet        - Don't print informational messages
-</pre></div>
-
-<p>In this case, it is sort of awkward that flag names correspond directly to
-enum names, because we probably don't want a enum definition named "<tt>g</tt>"
-in our program.  Because of this, we can alternatively write this example like
-this:</p>
-
-<div class="doc_code"><pre>
-enum OptLevel {
-  Debug, O1, O2, O3
-};
-
-<a href="#cl::opt">cl::opt</a>&lt;OptLevel&gt; OptimizationLevel(<a href="#cl::desc">cl::desc</a>("<i>Choose optimization level:</i>"),
-  <a href="#cl::values">cl::values</a>(
-   clEnumValN(Debug, "g", "<i>No optimizations, enable debugging</i>"),
-    clEnumVal(O1        , "<i>Enable trivial optimizations</i>"),
-    clEnumVal(O2        , "<i>Enable default optimizations</i>"),
-    clEnumVal(O3        , "<i>Enable expensive optimizations</i>"),
-   clEnumValEnd));
-
-...
-  if (OptimizationLevel == Debug) outputDebugInfo(...);
-...
-</pre></div>
-
-<p>By using the "<tt>clEnumValN</tt>" macro instead of "<tt>clEnumVal</tt>", we
-can directly specify the name that the flag should get.  In general a direct
-mapping is nice, but sometimes you can't or don't want to preserve the mapping,
-which is when you would use it.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="namedalternatives">Named Alternatives</a>
-</div>
-
-<div class="doc_text">
-
-<p>Another useful argument form is a named alternative style.  We shall use this
-style in our compiler to specify different debug levels that can be used.
-Instead of each debug level being its own switch, we want to support the
-following options, of which only one can be specified at a time:
-"<tt>--debug-level=none</tt>", "<tt>--debug-level=quick</tt>",
-"<tt>--debug-level=detailed</tt>".  To do this, we use the exact same format as
-our optimization level flags, but we also specify an option name.  For this
-case, the code looks like this:</p>
-
-<div class="doc_code"><pre>
-enum DebugLev {
-  nodebuginfo, quick, detailed
-};
-
-// Enable Debug Options to be specified on the command line
-<a href="#cl::opt">cl::opt</a>&lt;DebugLev&gt; DebugLevel("<i>debug_level</i>", <a href="#cl::desc">cl::desc</a>("<i>Set the debugging level:</i>"),
-  <a href="#cl::values">cl::values</a>(
-    clEnumValN(nodebuginfo, "none", "<i>disable debug information</i>"),
-     clEnumVal(quick,               "<i>enable quick debug information</i>"),
-     clEnumVal(detailed,            "<i>enable detailed debug information</i>"),
-    clEnumValEnd));
-</pre></div>
-
-<p>This definition defines an enumerated command line variable of type "<tt>enum
-DebugLev</tt>", which works exactly the same way as before.  The difference here
-is just the interface exposed to the user of your program and the help output by
-the "<tt>--help</tt>" option:</p>
-
-<div class="doc_code"><pre>
-USAGE: compiler [options] &lt;input file&gt;
-
-OPTIONS:
-  Choose optimization level:
-    -g          - No optimizations, enable debugging
-    -O1         - Enable trivial optimizations
-    -O2         - Enable default optimizations
-    -O3         - Enable expensive optimizations
-  <b>-debug_level  - Set the debugging level:
-    =none       - disable debug information
-    =quick      - enable quick debug information
-    =detailed   - enable detailed debug information</b>
-  -f            - Enable binary output on terminals
-  -help         - display available options (--help-hidden for more)
-  -o &lt;filename&gt; - Specify output filename
-  -quiet        - Don't print informational messages
-</pre></div>
-
-<p>Again, the only structural difference between the debug level declaration and
-the optimization level declaration is that the debug level declaration includes
-an option name (<tt>"debug_level"</tt>), which automatically changes how the
-library processes the argument.  The CommandLine library supports both forms so
-that you can choose the form most appropriate for your application.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="list">Parsing a list of options</a>
-</div>
-
-<div class="doc_text">
-
-<p>Now that we have the standard run-of-the-mill argument types out of the way,
-lets get a little wild and crazy.  Lets say that we want our optimizer to accept
-a <b>list</b> of optimizations to perform, allowing duplicates.  For example, we
-might want to run: "<tt>compiler -dce -constprop -inline -dce -strip</tt>".  In
-this case, the order of the arguments and the number of appearances is very
-important.  This is what the "<tt><a href="#cl::list">cl::list</a></tt>"
-template is for.  First, start by defining an enum of the optimizations that you
-would like to perform:</p>
-
-<div class="doc_code"><pre>
-enum Opts {
-  // 'inline' is a C++ keyword, so name it 'inlining'
-  dce, constprop, inlining, strip
-};
-</pre></div>
-
-<p>Then define your "<tt><a href="#cl::list">cl::list</a></tt>" variable:</p>
-
-<div class="doc_code"><pre>
-<a href="#cl::list">cl::list</a>&lt;Opts&gt; OptimizationList(<a href="#cl::desc">cl::desc</a>("<i>Available Optimizations:</i>"),
-  <a href="#cl::values">cl::values</a>(
-    clEnumVal(dce               , "<i>Dead Code Elimination</i>"),
-    clEnumVal(constprop         , "<i>Constant Propagation</i>"),
-   clEnumValN(inlining, "<i>inline</i>", "<i>Procedure Integration</i>"),
-    clEnumVal(strip             , "<i>Strip Symbols</i>"),
-  clEnumValEnd));
-</pre></div>
-
-<p>This defines a variable that is conceptually of the type
-"<tt>std::vector&lt;enum Opts&gt;</tt>".  Thus, you can access it with standard
-vector methods:</p>
-
-<div class="doc_code"><pre>
-  for (unsigned i = 0; i != OptimizationList.size(); ++i)
-    switch (OptimizationList[i])
-       ...
-</pre></div>
-
-<p>... to iterate through the list of options specified.</p>
-
-<p>Note that the "<tt><a href="#cl::list">cl::list</a></tt>" template is
-completely general and may be used with any data types or other arguments that
-you can use with the "<tt><a href="#cl::opt">cl::opt</a></tt>" template.  One
-especially useful way to use a list is to capture all of the positional
-arguments together if there may be more than one specified.  In the case of a
-linker, for example, the linker takes several '<tt>.o</tt>' files, and needs to
-capture them into a list.  This is naturally specified as:</p>
-
-<div class="doc_code"><pre>
-...
-<a href="#cl::list">cl::list</a>&lt;std::string&gt; InputFilenames(<a href="#cl::Positional">cl::Positional</a>, <a href="#cl::desc">cl::desc</a>("&lt;Input files&gt;"), <a href="#cl::OneOrMore">cl::OneOrMore</a>);
-...
-</pre></div>
-
-<p>This variable works just like a "<tt>vector&lt;string&gt;</tt>" object.  As
-such, accessing the list is simple, just like above.  In this example, we used
-the <tt><a href="#cl::OneOrMore">cl::OneOrMore</a></tt> modifier to inform the
-CommandLine library that it is an error if the user does not specify any
-<tt>.o</tt> files on our command line.  Again, this just reduces the amount of
-checking we have to do.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="bits">Collecting options as a set of flags</a>
-</div>
-
-<div class="doc_text">
-
-<p>Instead of collecting sets of options in a list, it is also possible to
-gather information for enum values in a <b>bit vector</b>.  The represention used by
-the <a href="#bits"><tt>cl::bits</tt></a> class is an <tt>unsigned</tt>
-integer.  An enum value is represented by a 0/1 in the enum's ordinal value bit
-position. 1 indicating that the enum was specified, 0 otherwise.  As each
-specified value is parsed, the resulting enum's bit is set in the option's bit
-vector:</p>
-
-<div class="doc_code"><pre>
-  <i>bits</i> |= 1 << (unsigned)<i>enum</i>;
-</pre></div>
-
-<p>Options that are specified multiple times are redundant.  Any instances after
-the first are discarded.</p>
-
-<p>Reworking the above list example, we could replace <a href="#list">
-<tt>cl::list</tt></a> with <a href="#bits"><tt>cl::bits</tt></a>:</p>
-
-<div class="doc_code"><pre>
-<a href="#cl::bits">cl::bits</a>&lt;Opts&gt; OptimizationBits(<a href="#cl::desc">cl::desc</a>("<i>Available Optimizations:</i>"),
-  <a href="#cl::values">cl::values</a>(
-    clEnumVal(dce               , "<i>Dead Code Elimination</i>"),
-    clEnumVal(constprop         , "<i>Constant Propagation</i>"),
-   clEnumValN(inlining, "<i>inline</i>", "<i>Procedure Integration</i>"),
-    clEnumVal(strip             , "<i>Strip Symbols</i>"),
-  clEnumValEnd));
-</pre></div>
-
-<p>To test to see if <tt>constprop</tt> was specified, we can use the
-<tt>cl:bits::isSet</tt> function:</p>
-
-<div class="doc_code"><pre>
-  if (OptimizationBits.isSet(constprop)) {
-    ...
-  }
-</pre></div>
-
-<p>It's also possible to get the raw bit vector using the
-<tt>cl::bits::getBits</tt> function:</p>
-
-<div class="doc_code"><pre>
-  unsigned bits = OptimizationBits.getBits();
-</pre></div>
-
-<p>Finally, if external storage is used, then the location specified must be of
-<b>type</b> <tt>unsigned</tt>. In all other ways a <a
-href="#bits"><tt>cl::bits</tt></a> option is equivalent to a <a
-href="#list"> <tt>cl::list</tt></a> option.</p>
-
-</div>
-
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="description">Adding freeform text to help output</a>
-</div>
-
-<div class="doc_text">
-
-<p>As our program grows and becomes more mature, we may decide to put summary
-information about what it does into the help output.  The help output is styled
-to look similar to a Unix <tt>man</tt> page, providing concise information about
-a program.  Unix <tt>man</tt> pages, however often have a description about what
-the program does.  To add this to your CommandLine program, simply pass a third
-argument to the <a
-href="#cl::ParseCommandLineOptions"><tt>cl::ParseCommandLineOptions</tt></a>
-call in main.  This additional argument is then printed as the overview
-information for your program, allowing you to include any additional information
-that you want.  For example:</p>
-
-<div class="doc_code"><pre>
-int main(int argc, char **argv) {
-  <a href="#cl::ParseCommandLineOptions">cl::ParseCommandLineOptions</a>(argc, argv, " CommandLine compiler example\n\n"
-                              "  This program blah blah blah...\n");
-  ...
-}
-</pre></div>
-
-<p>would yield the help output:</p>
-
-<div class="doc_code"><pre>
-<b>OVERVIEW: CommandLine compiler example
-
-  This program blah blah blah...</b>
-
-USAGE: compiler [options] &lt;input file&gt;
-
-OPTIONS:
-  ...
-  -help             - display available options (--help-hidden for more)
-  -o &lt;filename&gt;     - Specify output filename
-</pre></div>
-
-</div>
-
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="referenceguide">Reference Guide</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>Now that you know the basics of how to use the CommandLine library, this
-section will give you the detailed information you need to tune how command line
-options work, as well as information on more "advanced" command line option
-processing capabilities.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="positional">Positional Arguments</a>
-</div>
-
-<div class="doc_text">
-
-<p>Positional arguments are those arguments that are not named, and are not
-specified with a hyphen.  Positional arguments should be used when an option is
-specified by its position alone.  For example, the standard Unix <tt>grep</tt>
-tool takes a regular expression argument, and an optional filename to search
-through (which defaults to standard input if a filename is not specified).
-Using the CommandLine library, this would be specified as:</p>
-
-<div class="doc_code"><pre>
-<a href="#cl::opt">cl::opt</a>&lt;string&gt; Regex   (<a href="#cl::Positional">cl::Positional</a>, <a href="#cl::desc">cl::desc</a>("<i>&lt;regular expression&gt;</i>"), <a href="#cl::Required">cl::Required</a>);
-<a href="#cl::opt">cl::opt</a>&lt;string&gt; Filename(<a href="#cl::Positional">cl::Positional</a>, <a href="#cl::desc">cl::desc</a>("<i>&lt;input file&gt;</i>"), <a href="#cl::init">cl::init</a>("<i>-</i>"));
-</pre></div>
-
-<p>Given these two option declarations, the <tt>--help</tt> output for our grep
-replacement would look like this:</p>
-
-<div class="doc_code"><pre>
-USAGE: spiffygrep [options] <b>&lt;regular expression&gt; &lt;input file&gt;</b>
-
-OPTIONS:
-  -help - display available options (--help-hidden for more)
-</pre></div>
-
-<p>... and the resultant program could be used just like the standard
-<tt>grep</tt> tool.</p>
-
-<p>Positional arguments are sorted by their order of construction.  This means
-that command line options will be ordered according to how they are listed in a
-.cpp file, but will not have an ordering defined if the positional arguments
-are defined in multiple .cpp files.  The fix for this problem is simply to
-define all of your positional arguments in one .cpp file.</p>
-
-</div>
-
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="--">Specifying positional options with hyphens</a>
-</div>
-
-<div class="doc_text">
-
-<p>Sometimes you may want to specify a value to your positional argument that
-starts with a hyphen (for example, searching for '<tt>-foo</tt>' in a file).  At
-first, you will have trouble doing this, because it will try to find an argument
-named '<tt>-foo</tt>', and will fail (and single quotes will not save you).
-Note that the system <tt>grep</tt> has the same problem:</p>
-
-<div class="doc_code"><pre>
-  $ spiffygrep '-foo' test.txt
-  Unknown command line argument '-foo'.  Try: spiffygrep --help'
-
-  $ grep '-foo' test.txt
-  grep: illegal option -- f
-  grep: illegal option -- o
-  grep: illegal option -- o
-  Usage: grep -hblcnsviw pattern file . . .
-</pre></div>
-
-<p>The solution for this problem is the same for both your tool and the system
-version: use the '<tt>--</tt>' marker.  When the user specifies '<tt>--</tt>' on
-the command line, it is telling the program that all options after the
-'<tt>--</tt>' should be treated as positional arguments, not options.  Thus, we
-can use it like this:</p>
-
-<div class="doc_code"><pre>
-  $ spiffygrep -- -foo test.txt
-    ...output...
-</pre></div>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="getPosition">Determining absolute position with getPosition()</a>
-</div>
-<div class="doc_text">
-  <p>Sometimes an option can affect or modify the meaning of another option. For
-  example, consider <tt>gcc</tt>'s <tt>-x LANG</tt> option. This tells
-  <tt>gcc</tt> to ignore the suffix of subsequent positional arguments and force
-  the file to be interpreted as if it contained source code in language
-  <tt>LANG</tt>. In order to handle this properly, you need to know the
-  absolute position of each argument, especially those in lists, so their
-  interaction(s) can be applied correctly. This is also useful for options like
-  <tt>-llibname</tt> which is actually a positional argument that starts with
-  a dash.</p>
-  <p>So, generally, the problem is that you have two <tt>cl::list</tt> variables
-  that interact in some way. To ensure the correct interaction, you can use the
-  <tt>cl::list::getPosition(optnum)</tt> method. This method returns the
-  absolute position (as found on the command line) of the <tt>optnum</tt>
-  item in the <tt>cl::list</tt>.</p>
-  <p>The idiom for usage is like this:</p>
-
-  <div class="doc_code"><pre>
-  static cl::list&lt;std::string&gt; Files(cl::Positional, cl::OneOrMore);
-  static cl::list&lt;std::string&gt; Libraries("l", cl::ZeroOrMore);
-
-  int main(int argc, char**argv) {
-    // ...
-    std::vector&lt;std::string&gt;::iterator fileIt = Files.begin();
-    std::vector&lt;std::string&gt;::iterator libIt  = Libraries.begin();
-    unsigned libPos = 0, filePos = 0;
-    while ( 1 ) {
-      if ( libIt != Libraries.end() )
-        libPos = Libraries.getPosition( libIt - Libraries.begin() );
-      else
-        libPos = 0;
-      if ( fileIt != Files.end() )
-        filePos = Files.getPosition( fileIt - Files.begin() );
-      else
-        filePos = 0;
-
-      if ( filePos != 0 &amp;&amp; (libPos == 0 || filePos &lt; libPos) ) {
-        // Source File Is next
-        ++fileIt;
-      }
-      else if ( libPos != 0 &amp;&amp; (filePos == 0 || libPos &lt; filePos) ) {
-        // Library is next
-        ++libIt;
-      }
-      else
-        break; // we're done with the list
-    }
-  }</pre></div>
-
-  <p>Note that, for compatibility reasons, the <tt>cl::opt</tt> also supports an
-  <tt>unsigned getPosition()</tt> option that will provide the absolute position
-  of that option. You can apply the same approach as above with a
-  <tt>cl::opt</tt> and a <tt>cl::list</tt> option as you can with two lists.</p>
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="cl::ConsumeAfter">The <tt>cl::ConsumeAfter</tt> modifier</a>
-</div>
-
-<div class="doc_text">
-
-<p>The <tt>cl::ConsumeAfter</tt> <a href="#formatting">formatting option</a> is
-used to construct programs that use "interpreter style" option processing.  With
-this style of option processing, all arguments specified after the last
-positional argument are treated as special interpreter arguments that are not
-interpreted by the command line argument.</p>
-
-<p>As a concrete example, lets say we are developing a replacement for the
-standard Unix Bourne shell (<tt>/bin/sh</tt>).  To run <tt>/bin/sh</tt>, first
-you specify options to the shell itself (like <tt>-x</tt> which turns on trace
-output), then you specify the name of the script to run, then you specify
-arguments to the script.  These arguments to the script are parsed by the Bourne
-shell command line option processor, but are not interpreted as options to the
-shell itself.  Using the CommandLine library, we would specify this as:</p>
-
-<div class="doc_code"><pre>
-<a href="#cl::opt">cl::opt</a>&lt;string&gt; Script(<a href="#cl::Positional">cl::Positional</a>, <a href="#cl::desc">cl::desc</a>("<i>&lt;input script&gt;</i>"), <a href="#cl::init">cl::init</a>("-"));
-<a href="#cl::list">cl::list</a>&lt;string&gt;  Argv(<a href="#cl::ConsumeAfter">cl::ConsumeAfter</a>, <a href="#cl::desc">cl::desc</a>("<i>&lt;program arguments&gt;...</i>"));
-<a href="#cl::opt">cl::opt</a>&lt;bool&gt;    Trace("<i>x</i>", <a href="#cl::desc">cl::desc</a>("<i>Enable trace output</i>"));
-</pre></div>
-
-<p>which automatically provides the help output:</p>
-
-<div class="doc_code"><pre>
-USAGE: spiffysh [options] <b>&lt;input script&gt; &lt;program arguments&gt;...</b>
-
-OPTIONS:
-  -help - display available options (--help-hidden for more)
-  <b>-x    - Enable trace output</b>
-</pre></div>
-
-<p>At runtime, if we run our new shell replacement as `<tt>spiffysh -x test.sh
--a -x -y bar</tt>', the <tt>Trace</tt> variable will be set to true, the
-<tt>Script</tt> variable will be set to "<tt>test.sh</tt>", and the
-<tt>Argv</tt> list will contain <tt>["-a", "-x", "-y", "bar"]</tt>, because they
-were specified after the last positional argument (which is the script
-name).</p>
-
-<p>There are several limitations to when <tt>cl::ConsumeAfter</tt> options can
-be specified.  For example, only one <tt>cl::ConsumeAfter</tt> can be specified
-per program, there must be at least one <a href="#positional">positional
-argument</a> specified, there must not be any <a href="#cl::list">cl::list</a>
-positional arguments, and the <tt>cl::ConsumeAfter</tt> option should be a <a
-href="#cl::list">cl::list</a> option.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="storage">Internal vs External Storage</a>
-</div>
-
-<div class="doc_text">
-
-<p>By default, all command line options automatically hold the value that they
-parse from the command line.  This is very convenient in the common case,
-especially when combined with the ability to define command line options in the
-files that use them.  This is called the internal storage model.</p>
-
-<p>Sometimes, however, it is nice to separate the command line option processing
-code from the storage of the value parsed.  For example, lets say that we have a
-'<tt>-debug</tt>' option that we would like to use to enable debug information
-across the entire body of our program.  In this case, the boolean value
-controlling the debug code should be globally accessible (in a header file, for
-example) yet the command line option processing code should not be exposed to
-all of these clients (requiring lots of .cpp files to #include
-<tt>CommandLine.h</tt>).</p>
-
-<p>To do this, set up your .h file with your option, like this for example:</p>
-
-<div class="doc_code">
-<pre>
-<i>// DebugFlag.h - Get access to the '-debug' command line option
-//
-
-// DebugFlag - This boolean is set to true if the '-debug' command line option
-// is specified.  This should probably not be referenced directly, instead, use
-// the DEBUG macro below.
-//</i>
-extern bool DebugFlag;
-
-<i>// DEBUG macro - This macro should be used by code to emit debug information.
-// In the '-debug' option is specified on the command line, and if this is a
-// debug build, then the code specified as the option to the macro will be
-// executed.  Otherwise it will not be.</i>
-<span class="doc_hilite">#ifdef NDEBUG
-#define DEBUG(X)
-#else
-#define DEBUG(X)</span> do { if (DebugFlag) { X; } } while (0)
-<span class="doc_hilite">#endif</span>
-</pre>
-</div>
-
-<p>This allows clients to blissfully use the <tt>DEBUG()</tt> macro, or the
-<tt>DebugFlag</tt> explicitly if they want to.  Now we just need to be able to
-set the <tt>DebugFlag</tt> boolean when the option is set.  To do this, we pass
-an additional argument to our command line argument processor, and we specify
-where to fill in with the <a href="#cl::location">cl::location</a>
-attribute:</p>
-
-<div class="doc_code">
-<pre>
-bool DebugFlag;                  <i>// the actual value</i>
-static <a href="#cl::opt">cl::opt</a>&lt;bool, true&gt;       <i>// The parser</i>
-Debug("<i>debug</i>", <a href="#cl::desc">cl::desc</a>("<i>Enable debug output</i>"), <a href="#cl::Hidden">cl::Hidden</a>, <a href="#cl::location">cl::location</a>(DebugFlag));
-</pre>
-</div>
-
-<p>In the above example, we specify "<tt>true</tt>" as the second argument to
-the <tt><a href="#cl::opt">cl::opt</a></tt> template, indicating that the
-template should not maintain a copy of the value itself.  In addition to this,
-we specify the <tt><a href="#cl::location">cl::location</a></tt> attribute, so
-that <tt>DebugFlag</tt> is automatically set.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="attributes">Option Attributes</a>
-</div>
-
-<div class="doc_text">
-
-<p>This section describes the basic attributes that you can specify on
-options.</p>
-
-<ul>
-
-<li>The option name attribute (which is required for all options, except <a
-href="#positional">positional options</a>) specifies what the option name is.
-This option is specified in simple double quotes:
-
-<pre>
-<a href="#cl::opt">cl::opt</a>&lt;<b>bool</b>&gt; Quiet("<i>quiet</i>");
-</pre>
-
-</li>
-
-<li><a name="cl::desc">The <b><tt>cl::desc</tt></b></a> attribute specifies a
-description for the option to be shown in the <tt>--help</tt> output for the
-program.</li>
-
-<li><a name="cl::value_desc">The <b><tt>cl::value_desc</tt></b></a> attribute
-specifies a string that can be used to fine tune the <tt>--help</tt> output for
-a command line option.  Look <a href="#value_desc_example">here</a> for an
-example.</li>
-
-<li><a name="cl::init">The <b><tt>cl::init</tt></b></a> attribute specifies an
-initial value for a <a href="#cl::opt">scalar</a> option.  If this attribute is
-not specified then the command line option value defaults to the value created
-by the default constructor for the type. <b>Warning</b>: If you specify both
-<b><tt>cl::init</tt></b> and <b><tt>cl::location</tt></b> for an option,
-you must specify <b><tt>cl::location</tt></b> first, so that when the
-command-line parser sees <b><tt>cl::init</tt></b>, it knows where to put the
-initial value. (You will get an error at runtime if you don't put them in
-the right order.)</li>
-
-<li><a name="cl::location">The <b><tt>cl::location</tt></b></a> attribute where
-to store the value for a parsed command line option if using external storage.
-See the section on <a href="#storage">Internal vs External Storage</a> for more
-information.</li>
-
-<li><a name="cl::aliasopt">The <b><tt>cl::aliasopt</tt></b></a> attribute
-specifies which option a <tt><a href="#cl::alias">cl::alias</a></tt> option is
-an alias for.</li>
-
-<li><a name="cl::values">The <b><tt>cl::values</tt></b></a> attribute specifies
-the string-to-value mapping to be used by the generic parser.  It takes a
-<b>clEnumValEnd terminated</b> list of (option, value, description) triplets
-that
-specify the option name, the value mapped to, and the description shown in the
-<tt>--help</tt> for the tool.  Because the generic parser is used most
-frequently with enum values, two macros are often useful:
-
-<ol>
-
-<li><a name="clEnumVal">The <b><tt>clEnumVal</tt></b></a> macro is used as a
-nice simple way to specify a triplet for an enum.  This macro automatically
-makes the option name be the same as the enum name.  The first option to the
-macro is the enum, the second is the description for the command line
-option.</li>
-
-<li><a name="clEnumValN">The <b><tt>clEnumValN</tt></b></a> macro is used to
-specify macro options where the option name doesn't equal the enum name.  For
-this macro, the first argument is the enum value, the second is the flag name,
-and the second is the description.</li>
-
-</ol>
-
-You will get a compile time error if you try to use cl::values with a parser
-that does not support it.</li>
-
-<li><a name="cl::multi_val">The <b><tt>cl::multi_val</tt></b></a>
-attribute specifies that this option takes has multiple values
-(example: <tt>-sectalign segname sectname sectvalue</tt>). This
-attribute takes one unsigned argument - the number of values for the
-option. This attribute is valid only on <tt>cl::list</tt> options (and
-will fail with compile error if you try to use it with other option
-types). It is allowed to use all of the usual modifiers on
-multi-valued options (besides <tt>cl::ValueDisallowed</tt>,
-obviously).</li>
-
-</ul>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="modifiers">Option Modifiers</a>
-</div>
-
-<div class="doc_text">
-
-<p>Option modifiers are the flags and expressions that you pass into the
-constructors for <tt><a href="#cl::opt">cl::opt</a></tt> and <tt><a
-href="#cl::list">cl::list</a></tt>.  These modifiers give you the ability to
-tweak how options are parsed and how <tt>--help</tt> output is generated to fit
-your application well.</p>
-
-<p>These options fall into five main categories:</p>
-
-<ol>
-<li><a href="#hiding">Hiding an option from <tt>--help</tt> output</a></li>
-<li><a href="#numoccurrences">Controlling the number of occurrences
-                             required and allowed</a></li>
-<li><a href="#valrequired">Controlling whether or not a value must be
-                           specified</a></li>
-<li><a href="#formatting">Controlling other formatting options</a></li>
-<li><a href="#misc">Miscellaneous option modifiers</a></li>
-</ol>
-
-<p>It is not possible to specify two options from the same category (you'll get
-a runtime error) to a single option, except for options in the miscellaneous
-category.  The CommandLine library specifies defaults for all of these settings
-that are the most useful in practice and the most common, which mean that you
-usually shouldn't have to worry about these.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="hiding">Hiding an option from <tt>--help</tt> output</a>
-</div>
-
-<div class="doc_text">
-
-<p>The <tt>cl::NotHidden</tt>, <tt>cl::Hidden</tt>, and
-<tt>cl::ReallyHidden</tt> modifiers are used to control whether or not an option
-appears in the <tt>--help</tt> and <tt>--help-hidden</tt> output for the
-compiled program:</p>
-
-<ul>
-
-<li><a name="cl::NotHidden">The <b><tt>cl::NotHidden</tt></b></a> modifier
-(which is the default for <tt><a href="#cl::opt">cl::opt</a></tt> and <tt><a
-href="#cl::list">cl::list</a></tt> options) indicates the option is to appear
-in both help listings.</li>
-
-<li><a name="cl::Hidden">The <b><tt>cl::Hidden</tt></b></a> modifier (which is the
-default for <tt><a href="#cl::alias">cl::alias</a></tt> options) indicates that
-the option should not appear in the <tt>--help</tt> output, but should appear in
-the <tt>--help-hidden</tt> output.</li>
-
-<li><a name="cl::ReallyHidden">The <b><tt>cl::ReallyHidden</tt></b></a> modifier
-indicates that the option should not appear in any help output.</li>
-
-</ul>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="numoccurrences">Controlling the number of occurrences required and
-  allowed</a>
-</div>
-
-<div class="doc_text">
-
-<p>This group of options is used to control how many time an option is allowed
-(or required) to be specified on the command line of your program.  Specifying a
-value for this setting allows the CommandLine library to do error checking for
-you.</p>
-
-<p>The allowed values for this option group are:</p>
-
-<ul>
-
-<li><a name="cl::Optional">The <b><tt>cl::Optional</tt></b></a> modifier (which
-is the default for the <tt><a href="#cl::opt">cl::opt</a></tt> and <tt><a
-href="#cl::alias">cl::alias</a></tt> classes) indicates that your program will
-allow either zero or one occurrence of the option to be specified.</li>
-
-<li><a name="cl::ZeroOrMore">The <b><tt>cl::ZeroOrMore</tt></b></a> modifier
-(which is the default for the <tt><a href="#cl::list">cl::list</a></tt> class)
-indicates that your program will allow the option to be specified zero or more
-times.</li>
-
-<li><a name="cl::Required">The <b><tt>cl::Required</tt></b></a> modifier
-indicates that the specified option must be specified exactly one time.</li>
-
-<li><a name="cl::OneOrMore">The <b><tt>cl::OneOrMore</tt></b></a> modifier
-indicates that the option must be specified at least one time.</li>
-
-<li>The <b><tt>cl::ConsumeAfter</tt></b> modifier is described in the <a
-href="#positional">Positional arguments section</a>.</li>
-
-</ul>
-
-<p>If an option is not specified, then the value of the option is equal to the
-value specified by the <tt><a href="#cl::init">cl::init</a></tt> attribute.  If
-the <tt><a href="#cl::init">cl::init</a></tt> attribute is not specified, the
-option value is initialized with the default constructor for the data type.</p>
-
-<p>If an option is specified multiple times for an option of the <tt><a
-href="#cl::opt">cl::opt</a></tt> class, only the last value will be
-retained.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="valrequired">Controlling whether or not a value must be specified</a>
-</div>
-
-<div class="doc_text">
-
-<p>This group of options is used to control whether or not the option allows a
-value to be present.  In the case of the CommandLine library, a value is either
-specified with an equal sign (e.g. '<tt>-index-depth=17</tt>') or as a trailing
-string (e.g. '<tt>-o a.out</tt>').</p>
-
-<p>The allowed values for this option group are:</p>
-
-<ul>
-
-<li><a name="cl::ValueOptional">The <b><tt>cl::ValueOptional</tt></b></a> modifier
-(which is the default for <tt>bool</tt> typed options) specifies that it is
-acceptable to have a value, or not.  A boolean argument can be enabled just by
-appearing on the command line, or it can have an explicit '<tt>-foo=true</tt>'.
-If an option is specified with this mode, it is illegal for the value to be
-provided without the equal sign.  Therefore '<tt>-foo true</tt>' is illegal.  To
-get this behavior, you must use the <a
-href="#cl::ValueRequired">cl::ValueRequired</a> modifier.</li>
-
-<li><a name="cl::ValueRequired">The <b><tt>cl::ValueRequired</tt></b></a> modifier
-(which is the default for all other types except for <a
-href="#onealternative">unnamed alternatives using the generic parser</a>)
-specifies that a value must be provided.  This mode informs the command line
-library that if an option is not provides with an equal sign, that the next
-argument provided must be the value.  This allows things like '<tt>-o
-a.out</tt>' to work.</li>
-
-<li><a name="cl::ValueDisallowed">The <b><tt>cl::ValueDisallowed</tt></b></a>
-modifier (which is the default for <a href="#onealternative">unnamed
-alternatives using the generic parser</a>) indicates that it is a runtime error
-for the user to specify a value.  This can be provided to disallow users from
-providing options to boolean options (like '<tt>-foo=true</tt>').</li>
-
-</ul>
-
-<p>In general, the default values for this option group work just like you would
-want them to.  As mentioned above, you can specify the <a
-href="#cl::ValueDisallowed">cl::ValueDisallowed</a> modifier to a boolean
-argument to restrict your command line parser.  These options are mostly useful
-when <a href="#extensionguide">extending the library</a>.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="formatting">Controlling other formatting options</a>
-</div>
-
-<div class="doc_text">
-
-<p>The formatting option group is used to specify that the command line option
-has special abilities and is otherwise different from other command line
-arguments.  As usual, you can only specify one of these arguments at most.</p>
-
-<ul>
-
-<li><a name="cl::NormalFormatting">The <b><tt>cl::NormalFormatting</tt></b></a>
-modifier (which is the default all options) specifies that this option is
-"normal".</li>
-
-<li><a name="cl::Positional">The <b><tt>cl::Positional</tt></b></a> modifier
-specifies that this is a positional argument that does not have a command line
-option associated with it.  See the <a href="#positional">Positional
-Arguments</a> section for more information.</li>
-
-<li>The <b><a href="#cl::ConsumeAfter"><tt>cl::ConsumeAfter</tt></a></b> modifier
-specifies that this option is used to capture "interpreter style" arguments.  See <a href="#cl::ConsumeAfter">this section for more information</a>.</li>
-
-<li><a name="cl::Prefix">The <b><tt>cl::Prefix</tt></b></a> modifier specifies
-that this option prefixes its value.  With 'Prefix' options, the equal sign does
-not separate the value from the option name specified. Instead, the value is
-everything after the prefix, including any equal sign if present. This is useful
-for processing odd arguments like <tt>-lmalloc</tt> and <tt>-L/usr/lib</tt> in a
-linker tool or <tt>-DNAME=value</tt> in a compiler tool.   Here, the
-'<tt>l</tt>', '<tt>D</tt>' and '<tt>L</tt>' options are normal string (or list)
-options, that have the <b><tt><a href="#cl::Prefix">cl::Prefix</a></tt></b>
-modifier added to allow the CommandLine library to recognize them.  Note that
-<b><tt><a href="#cl::Prefix">cl::Prefix</a></tt></b> options must not have the
-<b><tt><a href="#cl::ValueDisallowed">cl::ValueDisallowed</a></tt></b> modifier
-specified.</li>
-
-<li><a name="cl::Grouping">The <b><tt>cl::Grouping</tt></b></a> modifier is used
-to implement Unix-style tools (like <tt>ls</tt>) that have lots of single letter
-arguments, but only require a single dash.  For example, the '<tt>ls -labF</tt>'
-command actually enables four different options, all of which are single
-letters.  Note that <b><tt><a href="#cl::Grouping">cl::Grouping</a></tt></b>
-options cannot have values.</li>
-
-</ul>
-
-<p>The CommandLine library does not restrict how you use the <b><tt><a
-href="#cl::Prefix">cl::Prefix</a></tt></b> or <b><tt><a
-href="#cl::Grouping">cl::Grouping</a></tt></b> modifiers, but it is possible to
-specify ambiguous argument settings.  Thus, it is possible to have multiple
-letter options that are prefix or grouping options, and they will still work as
-designed.</p>
-
-<p>To do this, the CommandLine library uses a greedy algorithm to parse the
-input option into (potentially multiple) prefix and grouping options.  The
-strategy basically looks like this:</p>
-
-<div class="doc_code"><tt>parse(string OrigInput) {</tt>
-
-<ol>
-<li><tt>string input = OrigInput;</tt>
-<li><tt>if (isOption(input)) return getOption(input).parse();</tt>&nbsp;&nbsp;&nbsp;&nbsp;<i>// Normal option</i>
-<li><tt>while (!isOption(input) &amp;&amp; !input.empty()) input.pop_back();</tt>&nbsp;&nbsp;&nbsp;&nbsp;<i>// Remove the last letter</i>
-<li><tt>if (input.empty()) return error();</tt>&nbsp;&nbsp;&nbsp;&nbsp;<i>// No matching option</i>
-<li><tt>if (getOption(input).isPrefix())<br>
-&nbsp;&nbsp;return getOption(input).parse(input);</tt>
-<li><tt>while (!input.empty()) {&nbsp;&nbsp;&nbsp;&nbsp;<i>// Must be grouping options</i><br>
-&nbsp;&nbsp;getOption(input).parse();<br>
-&nbsp;&nbsp;OrigInput.erase(OrigInput.begin(), OrigInput.begin()+input.length());<br>
-&nbsp;&nbsp;input = OrigInput;<br>
-&nbsp;&nbsp;while (!isOption(input) &amp;&amp; !input.empty()) input.pop_back();<br>
-}</tt>
-<li><tt>if (!OrigInput.empty()) error();</tt></li>
-</ol>
-
-<p><tt>}</tt></p>
-</div>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="misc">Miscellaneous option modifiers</a>
-</div>
-
-<div class="doc_text">
-
-<p>The miscellaneous option modifiers are the only flags where you can specify
-more than one flag from the set: they are not mutually exclusive.  These flags
-specify boolean properties that modify the option.</p>
-
-<ul>
-
-<li><a name="cl::CommaSeparated">The <b><tt>cl::CommaSeparated</tt></b></a> modifier
-indicates that any commas specified for an option's value should be used to
-split the value up into multiple values for the option.  For example, these two
-options are equivalent when <tt>cl::CommaSeparated</tt> is specified:
-"<tt>-foo=a -foo=b -foo=c</tt>" and "<tt>-foo=a,b,c</tt>".  This option only
-makes sense to be used in a case where the option is allowed to accept one or
-more values (i.e. it is a <a href="#cl::list">cl::list</a> option).</li>
-
-<li><a name="cl::PositionalEatsArgs">The
-<b><tt>cl::PositionalEatsArgs</tt></b></a> modifier (which only applies to
-positional arguments, and only makes sense for lists) indicates that positional
-argument should consume any strings after it (including strings that start with
-a "-") up until another recognized positional argument.  For example, if you
-have two "eating" positional arguments, "<tt>pos1</tt>" and "<tt>pos2</tt>", the
-string "<tt>-pos1 -foo -bar baz -pos2 -bork</tt>" would cause the "<tt>-foo -bar
--baz</tt>" strings to be applied to the "<tt>-pos1</tt>" option and the
-"<tt>-bork</tt>" string to be applied to the "<tt>-pos2</tt>" option.</li>
-
-<li><a name="cl::Sink">The <b><tt>cl::Sink</tt></b></a> modifier is
-used to handle unknown options. If there is at least one option with
-<tt>cl::Sink</tt> modifier specified, the parser passes
-unrecognized option strings to it as values instead of signaling an
-error. As with <tt>cl::CommaSeparated</tt>, this modifier
-only makes sense with a <a href="#cl::list">cl::list</a> option.</li>
-
-</ul>
-
-<p>So far, these are the only three miscellaneous option modifiers.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="response">Response files</a>
-</div>
-
-<div class="doc_text">
-
-<p>Some systems, such as certain variants of Microsoft Windows and
-some older Unices have a relatively low limit on command-line
-length. It is therefore customary to use the so-called 'response
-files' to circumvent this restriction. These files are mentioned on
-the command-line (using the "@file") syntax. The program reads these
-files and inserts the contents into argv, thereby working around the
-command-line length limits. Response files are enabled by an optional
-fourth argument to
-<a href="#cl::ParseEnvironmentOptions"><tt>cl::ParseEnvironmentOptions</tt></a>
-and
-<a href="#cl::ParseCommandLineOptions"><tt>cl::ParseCommandLineOptions</tt></a>.
-</p>
-
-</div>
-
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="toplevel">Top-Level Classes and Functions</a>
-</div>
-
-<div class="doc_text">
-
-<p>Despite all of the built-in flexibility, the CommandLine option library
-really only consists of one function (<a
-href="#cl::ParseCommandLineOptions"><tt>cl::ParseCommandLineOptions</tt></a>)
-and three main classes: <a href="#cl::opt"><tt>cl::opt</tt></a>, <a
-href="#cl::list"><tt>cl::list</tt></a>, and <a
-href="#cl::alias"><tt>cl::alias</tt></a>.  This section describes these three
-classes in detail.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="cl::ParseCommandLineOptions">The <tt>cl::ParseCommandLineOptions</tt>
-  function</a>
-</div>
-
-<div class="doc_text">
-
-<p>The <tt>cl::ParseCommandLineOptions</tt> function is designed to be called
-directly from <tt>main</tt>, and is used to fill in the values of all of the
-command line option variables once <tt>argc</tt> and <tt>argv</tt> are
-available.</p>
-
-<p>The <tt>cl::ParseCommandLineOptions</tt> function requires two parameters
-(<tt>argc</tt> and <tt>argv</tt>), but may also take an optional third parameter
-which holds <a href="#description">additional extra text</a> to emit when the
-<tt>--help</tt> option is invoked, and a fourth boolean parameter that enables
-<a href="#response">response files</a>.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="cl::ParseEnvironmentOptions">The <tt>cl::ParseEnvironmentOptions</tt>
-  function</a>
-</div>
-
-<div class="doc_text">
-
-<p>The <tt>cl::ParseEnvironmentOptions</tt> function has mostly the same effects
-as <a
-href="#cl::ParseCommandLineOptions"><tt>cl::ParseCommandLineOptions</tt></a>,
-except that it is designed to take values for options from an environment
-variable, for those cases in which reading the command line is not convenient or
-desired. It fills in the values of all the command line option variables just
-like <a
-href="#cl::ParseCommandLineOptions"><tt>cl::ParseCommandLineOptions</tt></a>
-does.</p>
-
-<p>It takes four parameters: the name of the program (since <tt>argv</tt> may
-not be available, it can't just look in <tt>argv[0]</tt>), the name of the
-environment variable to examine, the optional
-<a href="#description">additional extra text</a> to emit when the
-<tt>--help</tt> option is invoked, and the boolean
-switch that controls whether <a href="#response">response files</a>
-should be read.</p>
-
-<p><tt>cl::ParseEnvironmentOptions</tt> will break the environment
-variable's value up into words and then process them using
-<a href="#cl::ParseCommandLineOptions"><tt>cl::ParseCommandLineOptions</tt></a>.
-<b>Note:</b> Currently <tt>cl::ParseEnvironmentOptions</tt> does not support
-quoting, so an environment variable containing <tt>-option "foo bar"</tt> will
-be parsed as three words, <tt>-option</tt>, <tt>"foo</tt>, and <tt>bar"</tt>,
-which is different from what you would get from the shell with the same
-input.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="cl::SetVersionPrinter">The <tt>cl::SetVersionPrinter</tt>
-  function</a>
-</div>
-
-<div class="doc_text">
-
-<p>The <tt>cl::SetVersionPrinter</tt> function is designed to be called
-directly from <tt>main</tt> and <i>before</i>
-<tt>cl::ParseCommandLineOptions</tt>. Its use is optional. It simply arranges
-for a function to be called in response to the <tt>--version</tt> option instead
-of having the <tt>CommandLine</tt> library print out the usual version string
-for LLVM. This is useful for programs that are not part of LLVM but wish to use
-the <tt>CommandLine</tt> facilities. Such programs should just define a small
-function that takes no arguments and returns <tt>void</tt> and that prints out
-whatever version information is appropriate for the program. Pass the address
-of that function to <tt>cl::SetVersionPrinter</tt> to arrange for it to be
-called when the <tt>--version</tt> option is given by the user.</p>
-
-</div>
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="cl::opt">The <tt>cl::opt</tt> class</a>
-</div>
-
-<div class="doc_text">
-
-<p>The <tt>cl::opt</tt> class is the class used to represent scalar command line
-options, and is the one used most of the time.  It is a templated class which
-can take up to three arguments (all except for the first have default values
-though):</p>
-
-<div class="doc_code"><pre>
-<b>namespace</b> cl {
-  <b>template</b> &lt;<b>class</b> DataType, <b>bool</b> ExternalStorage = <b>false</b>,
-            <b>class</b> ParserClass = parser&lt;DataType&gt; &gt;
-  <b>class</b> opt;
-}
-</pre></div>
-
-<p>The first template argument specifies what underlying data type the command
-line argument is, and is used to select a default parser implementation.  The
-second template argument is used to specify whether the option should contain
-the storage for the option (the default) or whether external storage should be
-used to contain the value parsed for the option (see <a href="#storage">Internal
-vs External Storage</a> for more information).</p>
-
-<p>The third template argument specifies which parser to use.  The default value
-selects an instantiation of the <tt>parser</tt> class based on the underlying
-data type of the option.  In general, this default works well for most
-applications, so this option is only used when using a <a
-href="#customparser">custom parser</a>.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="cl::list">The <tt>cl::list</tt> class</a>
-</div>
-
-<div class="doc_text">
-
-<p>The <tt>cl::list</tt> class is the class used to represent a list of command
-line options.  It too is a templated class which can take up to three
-arguments:</p>
-
-<div class="doc_code"><pre>
-<b>namespace</b> cl {
-  <b>template</b> &lt;<b>class</b> DataType, <b>class</b> Storage = <b>bool</b>,
-            <b>class</b> ParserClass = parser&lt;DataType&gt; &gt;
-  <b>class</b> list;
-}
-</pre></div>
-
-<p>This class works the exact same as the <a
-href="#cl::opt"><tt>cl::opt</tt></a> class, except that the second argument is
-the <b>type</b> of the external storage, not a boolean value.  For this class,
-the marker type '<tt>bool</tt>' is used to indicate that internal storage should
-be used.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="cl::bits">The <tt>cl::bits</tt> class</a>
-</div>
-
-<div class="doc_text">
-
-<p>The <tt>cl::bits</tt> class is the class used to represent a list of command
-line options in the form of a bit vector.  It is also a templated class which
-can take up to three arguments:</p>
-
-<div class="doc_code"><pre>
-<b>namespace</b> cl {
-  <b>template</b> &lt;<b>class</b> DataType, <b>class</b> Storage = <b>bool</b>,
-            <b>class</b> ParserClass = parser&lt;DataType&gt; &gt;
-  <b>class</b> bits;
-}
-</pre></div>
-
-<p>This class works the exact same as the <a
-href="#cl::opt"><tt>cl::lists</tt></a> class, except that the second argument
-must be of <b>type</b> <tt>unsigned</tt> if external storage is used.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="cl::alias">The <tt>cl::alias</tt> class</a>
-</div>
-
-<div class="doc_text">
-
-<p>The <tt>cl::alias</tt> class is a nontemplated class that is used to form
-aliases for other arguments.</p>
-
-<div class="doc_code"><pre>
-<b>namespace</b> cl {
-  <b>class</b> alias;
-}
-</pre></div>
-
-<p>The <a href="#cl::aliasopt"><tt>cl::aliasopt</tt></a> attribute should be
-used to specify which option this is an alias for.  Alias arguments default to
-being <a href="#cl::Hidden">Hidden</a>, and use the aliased options parser to do
-the conversion from string to data.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="cl::extrahelp">The <tt>cl::extrahelp</tt> class</a>
-</div>
-
-<div class="doc_text">
-
-<p>The <tt>cl::extrahelp</tt> class is a nontemplated class that allows extra
-help text to be printed out for the <tt>--help</tt> option.</p>
-
-<div class="doc_code"><pre>
-<b>namespace</b> cl {
-  <b>struct</b> extrahelp;
-}
-</pre></div>
-
-<p>To use the extrahelp, simply construct one with a <tt>const char*</tt>
-parameter to the constructor. The text passed to the constructor will be printed
-at the bottom of the help message, verbatim. Note that multiple
-<tt>cl::extrahelp</tt> <b>can</b> be used, but this practice is discouraged. If
-your tool needs to print additional help information, put all that help into a
-single <tt>cl::extrahelp</tt> instance.</p>
-<p>For example:</p>
-<div class="doc_code"><pre>
-  cl::extrahelp("\nADDITIONAL HELP:\n\n  This is the extra help\n");
-</pre></div>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="builtinparsers">Builtin parsers</a>
-</div>
-
-<div class="doc_text">
-
-<p>Parsers control how the string value taken from the command line is
-translated into a typed value, suitable for use in a C++ program.  By default,
-the CommandLine library uses an instance of <tt>parser&lt;type&gt;</tt> if the
-command line option specifies that it uses values of type '<tt>type</tt>'.
-Because of this, custom option processing is specified with specializations of
-the '<tt>parser</tt>' class.</p>
-
-<p>The CommandLine library provides the following builtin parser
-specializations, which are sufficient for most applications. It can, however,
-also be extended to work with new data types and new ways of interpreting the
-same data.  See the <a href="#customparser">Writing a Custom Parser</a> for more
-details on this type of library extension.</p>
-
-<ul>
-
-<li><a name="genericparser">The <b>generic <tt>parser&lt;t&gt;</tt> parser</b></a>
-can be used to map strings values to any data type, through the use of the <a
-href="#cl::values">cl::values</a> property, which specifies the mapping
-information.  The most common use of this parser is for parsing enum values,
-which allows you to use the CommandLine library for all of the error checking to
-make sure that only valid enum values are specified (as opposed to accepting
-arbitrary strings).  Despite this, however, the generic parser class can be used
-for any data type.</li>
-
-<li><a name="boolparser">The <b><tt>parser&lt;bool&gt;</tt> specialization</b></a>
-is used to convert boolean strings to a boolean value.  Currently accepted
-strings are "<tt>true</tt>", "<tt>TRUE</tt>", "<tt>True</tt>", "<tt>1</tt>",
-"<tt>false</tt>", "<tt>FALSE</tt>", "<tt>False</tt>", and "<tt>0</tt>".</li>
-
-<li><a name="boolOrDefaultparser">The <b><tt>parser&lt;boolOrDefault&gt;</tt>
- specialization</b></a> is used for cases where the value is boolean,
-but we also need to know whether the option was specified at all.  boolOrDefault
-is an enum with 3 values, BOU_UNSET, BOU_TRUE and BOU_FALSE.  This parser accepts
-the same strings as <b><tt>parser&lt;bool&gt;</tt></b>.</li>
-
-<li><a name="stringparser">The <b><tt>parser&lt;string&gt;</tt>
-specialization</b></a> simply stores the parsed string into the string value
-specified.  No conversion or modification of the data is performed.</li>
-
-<li><a name="intparser">The <b><tt>parser&lt;int&gt;</tt> specialization</b></a>
-uses the C <tt>strtol</tt> function to parse the string input.  As such, it will
-accept a decimal number (with an optional '+' or '-' prefix) which must start
-with a non-zero digit.  It accepts octal numbers, which are identified with a
-'<tt>0</tt>' prefix digit, and hexadecimal numbers with a prefix of
-'<tt>0x</tt>' or '<tt>0X</tt>'.</li>
-
-<li><a name="doubleparser">The <b><tt>parser&lt;double&gt;</tt></b></a> and
-<b><tt>parser&lt;float&gt;</tt> specializations</b> use the standard C
-<tt>strtod</tt> function to convert floating point strings into floating point
-values.  As such, a broad range of string formats is supported, including
-exponential notation (ex: <tt>1.7e15</tt>) and properly supports locales.
-</li>
-
-</ul>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="extensionguide">Extension Guide</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>Although the CommandLine library has a lot of functionality built into it
-already (as discussed previously), one of its true strengths lie in its
-extensibility.  This section discusses how the CommandLine library works under
-the covers and illustrates how to do some simple, common, extensions.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="customparser">Writing a custom parser</a>
-</div>
-
-<div class="doc_text">
-
-<p>One of the simplest and most common extensions is the use of a custom parser.
-As <a href="#builtinparsers">discussed previously</a>, parsers are the portion
-of the CommandLine library that turns string input from the user into a
-particular parsed data type, validating the input in the process.</p>
-
-<p>There are two ways to use a new parser:</p>
-
-<ol>
-
-<li>
-
-<p>Specialize the <a href="#genericparser"><tt>cl::parser</tt></a> template for
-your custom data type.<p>
-
-<p>This approach has the advantage that users of your custom data type will
-automatically use your custom parser whenever they define an option with a value
-type of your data type.  The disadvantage of this approach is that it doesn't
-work if your fundamental data type is something that is already supported.</p>
-
-</li>
-
-<li>
-
-<p>Write an independent class, using it explicitly from options that need
-it.</p>
-
-<p>This approach works well in situations where you would line to parse an
-option using special syntax for a not-very-special data-type.  The drawback of
-this approach is that users of your parser have to be aware that they are using
-your parser instead of the builtin ones.</p>
-
-</li>
-
-</ol>
-
-<p>To guide the discussion, we will discuss a custom parser that accepts file
-sizes, specified with an optional unit after the numeric size.  For example, we
-would like to parse "102kb", "41M", "1G" into the appropriate integer value.  In
-this case, the underlying data type we want to parse into is
-'<tt>unsigned</tt>'.  We choose approach #2 above because we don't want to make
-this the default for all <tt>unsigned</tt> options.</p>
-
-<p>To start out, we declare our new <tt>FileSizeParser</tt> class:</p>
-
-<div class="doc_code"><pre>
-<b>struct</b> FileSizeParser : <b>public</b> cl::basic_parser&lt;<b>unsigned</b>&gt; {
-  <i>// parse - Return true on error.</i>
-  <b>bool</b> parse(cl::Option &amp;O, <b>const char</b> *ArgName, <b>const</b> std::string &amp;ArgValue,
-             <b>unsigned</b> &amp;Val);
-};
-</pre></div>
-
-<p>Our new class inherits from the <tt>cl::basic_parser</tt> template class to
-fill in the default, boiler plate code for us.  We give it the data type that
-we parse into, the last argument to the <tt>parse</tt> method, so that clients of
-our custom parser know what object type to pass in to the parse method.  (Here we
-declare that we parse into '<tt>unsigned</tt>' variables.)</p>
-
-<p>For most purposes, the only method that must be implemented in a custom
-parser is the <tt>parse</tt> method.  The <tt>parse</tt> method is called
-whenever the option is invoked, passing in the option itself, the option name,
-the string to parse, and a reference to a return value.  If the string to parse
-is not well-formed, the parser should output an error message and return true.
-Otherwise it should return false and set '<tt>Val</tt>' to the parsed value.  In
-our example, we implement <tt>parse</tt> as:</p>
-
-<div class="doc_code"><pre>
-<b>bool</b> FileSizeParser::parse(cl::Option &amp;O, <b>const char</b> *ArgName,
-                           <b>const</b> std::string &amp;Arg, <b>unsigned</b> &amp;Val) {
-  <b>const char</b> *ArgStart = Arg.c_str();
-  <b>char</b> *End;
-
-  <i>// Parse integer part, leaving 'End' pointing to the first non-integer char</i>
-  Val = (unsigned)strtol(ArgStart, &amp;End, 0);
-
-  <b>while</b> (1) {
-    <b>switch</b> (*End++) {
-    <b>case</b> 0: <b>return</b> false;   <i>// No error</i>
-    <b>case</b> 'i':               <i>// Ignore the 'i' in KiB if people use that</i>
-    <b>case</b> 'b': <b>case</b> 'B':     <i>// Ignore B suffix</i>
-      <b>break</b>;
-
-    <b>case</b> 'g': <b>case</b> 'G': Val *= 1024*1024*1024; <b>break</b>;
-    <b>case</b> 'm': <b>case</b> 'M': Val *= 1024*1024;      <b>break</b>;
-    <b>case</b> 'k': <b>case</b> 'K': Val *= 1024;           <b>break</b>;
-
-    default:
-      <i>// Print an error message if unrecognized character!</i>
-      <b>return</b> O.error("'" + Arg + "' value invalid for file size argument!");
-    }
-  }
-}
-</pre></div>
-
-<p>This function implements a very simple parser for the kinds of strings we are
-interested in.  Although it has some holes (it allows "<tt>123KKK</tt>" for
-example), it is good enough for this example.  Note that we use the option
-itself to print out the error message (the <tt>error</tt> method always returns
-true) in order to get a nice error message (shown below).  Now that we have our
-parser class, we can use it like this:</p>
-
-<div class="doc_code"><pre>
-<b>static</b> <a href="#cl::opt">cl::opt</a>&lt;<b>unsigned</b>, <b>false</b>, FileSizeParser&gt;
-MFS(<i>"max-file-size"</i>, <a href="#cl::desc">cl::desc</a>(<i>"Maximum file size to accept"</i>),
-    <a href="#cl::value_desc">cl::value_desc</a>("<i>size</i>"));
-</pre></div>
-
-<p>Which adds this to the output of our program:</p>
-
-<div class="doc_code"><pre>
-OPTIONS:
-  -help                 - display available options (--help-hidden for more)
-  ...
-  <b>-max-file-size=&lt;size&gt; - Maximum file size to accept</b>
-</pre></div>
-
-<p>And we can test that our parse works correctly now (the test program just
-prints out the max-file-size argument value):</p>
-
-<div class="doc_code"><pre>
-$ ./test
-MFS: 0
-$ ./test -max-file-size=123MB
-MFS: 128974848
-$ ./test -max-file-size=3G
-MFS: 3221225472
-$ ./test -max-file-size=dog
--max-file-size option: 'dog' value invalid for file size argument!
-</pre></div>
-
-<p>It looks like it works.  The error message that we get is nice and helpful,
-and we seem to accept reasonable file sizes.  This wraps up the "custom parser"
-tutorial.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="explotingexternal">Exploiting external storage</a>
-</div>
-
-<div class="doc_text">
-  <p>Several of the LLVM libraries define static <tt>cl::opt</tt> instances that
-  will automatically be included in any program that links with that library.
-  This is a feature. However, sometimes it is necessary to know the value of the
-  command line option outside of the library. In these cases the library does or
-  should provide an external storage location that is accessible to users of the
-  library. Examples of this include the <tt>llvm::DebugFlag</tt> exported by the
-  <tt>lib/Support/Debug.cpp</tt> file and the <tt>llvm::TimePassesIsEnabled</tt>
-  flag exported by the <tt>lib/VMCore/Pass.cpp</tt> file.</p>
-
-<p>TODO: complete this section</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="dynamicopts">Dynamically adding command line options</a>
-</div>
-
-<div class="doc_text">
-
-<p>TODO: fill in this section</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-
-<hr>
-<address>
-  <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
-  src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS"></a>
-  <a href="http://validator.w3.org/check/referer"><img
-  src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
-
-  <a href="mailto:sabre at nondot.org">Chris Lattner</a><br>
-  <a href="http://llvm.org">LLVM Compiler Infrastructure</a><br>
-  Last modified: $Date$
-</address>
-
-</body>
-</html>
diff --git a/libclamav/c++/llvm/docs/CompilerDriver.html b/libclamav/c++/llvm/docs/CompilerDriver.html
deleted file mode 100644
index 5f5788c..0000000
--- a/libclamav/c++/llvm/docs/CompilerDriver.html
+++ /dev/null
@@ -1,756 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-<meta name="generator" content="Docutils 0.5: http://docutils.sourceforge.net/" />
-<title>Customizing LLVMC: Reference Manual</title>
-<link rel="stylesheet" href="llvm.css" type="text/css" />
-</head>
-<body>
-<div class="document" id="customizing-llvmc-reference-manual">
-<h1 class="title">Customizing LLVMC: Reference Manual</h1>
-
-<!-- This file was automatically generated by rst2html.
-Please do not edit directly!
-The ReST source lives in the directory 'tools/llvmc/doc'. -->
-<div class="contents topic" id="contents">
-<p class="topic-title first">Contents</p>
-<ul class="simple">
-<li><a class="reference internal" href="#introduction" id="id8">Introduction</a></li>
-<li><a class="reference internal" href="#compiling-with-llvmc" id="id9">Compiling with LLVMC</a></li>
-<li><a class="reference internal" href="#predefined-options" id="id10">Predefined options</a></li>
-<li><a class="reference internal" href="#compiling-llvmc-plugins" id="id11">Compiling LLVMC plugins</a></li>
-<li><a class="reference internal" href="#compiling-standalone-llvmc-based-drivers" id="id12">Compiling standalone LLVMC-based drivers</a></li>
-<li><a class="reference internal" href="#customizing-llvmc-the-compilation-graph" id="id13">Customizing LLVMC: the compilation graph</a></li>
-<li><a class="reference internal" href="#describing-options" id="id14">Describing options</a><ul>
-<li><a class="reference internal" href="#external-options" id="id15">External options</a></li>
-</ul>
-</li>
-<li><a class="reference internal" href="#conditional-evaluation" id="id16">Conditional evaluation</a></li>
-<li><a class="reference internal" href="#writing-a-tool-description" id="id17">Writing a tool description</a><ul>
-<li><a class="reference internal" href="#id5" id="id18">Actions</a></li>
-</ul>
-</li>
-<li><a class="reference internal" href="#language-map" id="id19">Language map</a></li>
-<li><a class="reference internal" href="#option-preprocessor" id="id20">Option preprocessor</a></li>
-<li><a class="reference internal" href="#more-advanced-topics" id="id21">More advanced topics</a><ul>
-<li><a class="reference internal" href="#hooks-and-environment-variables" id="id22">Hooks and environment variables</a></li>
-<li><a class="reference internal" href="#how-plugins-are-loaded" id="id23">How plugins are loaded</a></li>
-<li><a class="reference internal" href="#debugging" id="id24">Debugging</a></li>
-<li><a class="reference internal" href="#conditioning-on-the-executable-name" id="id25">Conditioning on the executable name</a></li>
-</ul>
-</li>
-</ul>
-</div>
-<div class="doc_author">
-<p>Written by <a href="mailto:foldr at codedgers.com">Mikhail Glushenkov</a></p>
-</div><div class="section" id="introduction">
-<h1><a class="toc-backref" href="#id8">Introduction</a></h1>
-<p>LLVMC is a generic compiler driver, designed to be customizable and
-extensible. It plays the same role for LLVM as the <tt class="docutils literal"><span class="pre">gcc</span></tt> program
-does for GCC - LLVMC's job is essentially to transform a set of input
-files into a set of targets depending on configuration rules and user
-options. What makes LLVMC different is that these transformation rules
-are completely customizable - in fact, LLVMC knows nothing about the
-specifics of transformation (even the command-line options are mostly
-not hard-coded) and regards the transformation structure as an
-abstract graph. The structure of this graph is completely determined
-by plugins, which can be either statically or dynamically linked. This
-makes it possible to easily adapt LLVMC for other purposes - for
-example, as a build tool for game resources.</p>
-<p>Because LLVMC employs <a class="reference external" href="http://llvm.org/docs/TableGenFundamentals.html">TableGen</a> as its configuration language, you
-need to be familiar with it to customize LLVMC.</p>
-</div>
-<div class="section" id="compiling-with-llvmc">
-<h1><a class="toc-backref" href="#id9">Compiling with LLVMC</a></h1>
-<p>LLVMC tries hard to be as compatible with <tt class="docutils literal"><span class="pre">gcc</span></tt> as possible,
-although there are some small differences. Most of the time, however,
-you shouldn't be able to notice them:</p>
-<pre class="literal-block">
-$ # This works as expected:
-$ llvmc -O3 -Wall hello.cpp
-$ ./a.out
-hello
-</pre>
-<p>One nice feature of LLVMC is that one doesn't have to distinguish between
-different compilers for different languages (think <tt class="docutils literal"><span class="pre">g++</span></tt> vs.  <tt class="docutils literal"><span class="pre">gcc</span></tt>) - the
-right toolchain is chosen automatically based on input language names (which
-are, in turn, determined from file extensions). If you want to force files
-ending with &quot;.c&quot; to compile as C++, use the <tt class="docutils literal"><span class="pre">-x</span></tt> option, just like you would
-do it with <tt class="docutils literal"><span class="pre">gcc</span></tt>:</p>
-<pre class="literal-block">
-$ # hello.c is really a C++ file
-$ llvmc -x c++ hello.c
-$ ./a.out
-hello
-</pre>
-<p>On the other hand, when using LLVMC as a linker to combine several C++
-object files you should provide the <tt class="docutils literal"><span class="pre">--linker</span></tt> option since it's
-impossible for LLVMC to choose the right linker in that case:</p>
-<pre class="literal-block">
-$ llvmc -c hello.cpp
-$ llvmc hello.o
-[A lot of link-time errors skipped]
-$ llvmc --linker=c++ hello.o
-$ ./a.out
-hello
-</pre>
-<p>By default, LLVMC uses <tt class="docutils literal"><span class="pre">llvm-gcc</span></tt> to compile the source code. It is also
-possible to choose the <tt class="docutils literal"><span class="pre">clang</span></tt> compiler with the <tt class="docutils literal"><span class="pre">-clang</span></tt> option.</p>
-</div>
-<div class="section" id="predefined-options">
-<h1><a class="toc-backref" href="#id10">Predefined options</a></h1>
-<p>LLVMC has some built-in options that can't be overridden in the
-configuration libraries:</p>
-<ul class="simple">
-<li><tt class="docutils literal"><span class="pre">-o</span> <span class="pre">FILE</span></tt> - Output file name.</li>
-<li><tt class="docutils literal"><span class="pre">-x</span> <span class="pre">LANGUAGE</span></tt> - Specify the language of the following input files
-until the next -x option.</li>
-<li><tt class="docutils literal"><span class="pre">-load</span> <span class="pre">PLUGIN_NAME</span></tt> - Load the specified plugin DLL. Example:
-<tt class="docutils literal"><span class="pre">-load</span> <span class="pre">$LLVM_DIR/Release/lib/LLVMCSimple.so</span></tt>.</li>
-<li><tt class="docutils literal"><span class="pre">-v</span></tt> - Enable verbose mode, i.e. print out all executed commands.</li>
-<li><tt class="docutils literal"><span class="pre">--save-temps</span></tt> - Write temporary files to the current directory and do not
-delete them on exit. This option can also take an argument: the
-<tt class="docutils literal"><span class="pre">--save-temps=obj</span></tt> switch will write files into the directory specified with
-the <tt class="docutils literal"><span class="pre">-o</span></tt> option. The <tt class="docutils literal"><span class="pre">--save-temps=cwd</span></tt> and <tt class="docutils literal"><span class="pre">--save-temps</span></tt> switches are
-both synonyms for the default behaviour.</li>
-<li><tt class="docutils literal"><span class="pre">--temp-dir</span> <span class="pre">DIRECTORY</span></tt> - Store temporary files in the given directory. This
-directory is deleted on exit unless <tt class="docutils literal"><span class="pre">--save-temps</span></tt> is specified. If
-<tt class="docutils literal"><span class="pre">--save-temps=obj</span></tt> is also specified, <tt class="docutils literal"><span class="pre">--temp-dir</span></tt> is given the
-precedence.</li>
-<li><tt class="docutils literal"><span class="pre">--check-graph</span></tt> - Check the compilation for common errors like mismatched
-output/input language names, multiple default edges and cycles. Because of
-plugins, these checks can't be performed at compile-time. Exit with code zero
-if no errors were found, and return the number of found errors
-otherwise. Hidden option, useful for debugging LLVMC plugins.</li>
-<li><tt class="docutils literal"><span class="pre">--view-graph</span></tt> - Show a graphical representation of the compilation graph
-and exit. Requires that you have <tt class="docutils literal"><span class="pre">dot</span></tt> and <tt class="docutils literal"><span class="pre">gv</span></tt> programs installed. Hidden
-option, useful for debugging LLVMC plugins.</li>
-<li><tt class="docutils literal"><span class="pre">--write-graph</span></tt> - Write a <tt class="docutils literal"><span class="pre">compilation-graph.dot</span></tt> file in the current
-directory with the compilation graph description in Graphviz format (identical
-to the file used by the <tt class="docutils literal"><span class="pre">--view-graph</span></tt> option). The <tt class="docutils literal"><span class="pre">-o</span></tt> option can be
-used to set the output file name. Hidden option, useful for debugging LLVMC
-plugins.</li>
-<li><tt class="docutils literal"><span class="pre">--help</span></tt>, <tt class="docutils literal"><span class="pre">--help-hidden</span></tt>, <tt class="docutils literal"><span class="pre">--version</span></tt> - These options have
-their standard meaning.</li>
-</ul>
-</div>
-<div class="section" id="compiling-llvmc-plugins">
-<h1><a class="toc-backref" href="#id11">Compiling LLVMC plugins</a></h1>
-<p>It's easiest to start working on your own LLVMC plugin by copying the
-skeleton project which lives under <tt class="docutils literal"><span class="pre">$LLVMC_DIR/plugins/Simple</span></tt>:</p>
-<pre class="literal-block">
-$ cd $LLVMC_DIR/plugins
-$ cp -r Simple MyPlugin
-$ cd MyPlugin
-$ ls
-Makefile PluginMain.cpp Simple.td
-</pre>
-<p>As you can see, our basic plugin consists of only two files (not
-counting the build script). <tt class="docutils literal"><span class="pre">Simple.td</span></tt> contains TableGen
-description of the compilation graph; its format is documented in the
-following sections. <tt class="docutils literal"><span class="pre">PluginMain.cpp</span></tt> is just a helper file used to
-compile the auto-generated C++ code produced from TableGen source. It
-can also contain hook definitions (see <a class="reference internal" href="#hooks">below</a>).</p>
-<p>The first thing that you should do is to change the <tt class="docutils literal"><span class="pre">LLVMC_PLUGIN</span></tt>
-variable in the <tt class="docutils literal"><span class="pre">Makefile</span></tt> to avoid conflicts (since this variable
-is used to name the resulting library):</p>
-<pre class="literal-block">
-LLVMC_PLUGIN=MyPlugin
-</pre>
-<p>It is also a good idea to rename <tt class="docutils literal"><span class="pre">Simple.td</span></tt> to something less
-generic:</p>
-<pre class="literal-block">
-$ mv Simple.td MyPlugin.td
-</pre>
-<p>To build your plugin as a dynamic library, just <tt class="docutils literal"><span class="pre">cd</span></tt> to its source
-directory and run <tt class="docutils literal"><span class="pre">make</span></tt>. The resulting file will be called
-<tt class="docutils literal"><span class="pre">plugin_llvmc_$(LLVMC_PLUGIN).$(DLL_EXTENSION)</span></tt> (in our case,
-<tt class="docutils literal"><span class="pre">plugin_llvmc_MyPlugin.so</span></tt>). This library can be then loaded in with the
-<tt class="docutils literal"><span class="pre">-load</span></tt> option. Example:</p>
-<pre class="literal-block">
-$ cd $LLVMC_DIR/plugins/Simple
-$ make
-$ llvmc -load $LLVM_DIR/Release/lib/plugin_llvmc_Simple.so
-</pre>
-</div>
-<div class="section" id="compiling-standalone-llvmc-based-drivers">
-<h1><a class="toc-backref" href="#id12">Compiling standalone LLVMC-based drivers</a></h1>
-<p>By default, the <tt class="docutils literal"><span class="pre">llvmc</span></tt> executable consists of a driver core plus several
-statically linked plugins (<tt class="docutils literal"><span class="pre">Base</span></tt> and <tt class="docutils literal"><span class="pre">Clang</span></tt> at the moment). You can
-produce a standalone LLVMC-based driver executable by linking the core with your
-own plugins. The recommended way to do this is by starting with the provided
-<tt class="docutils literal"><span class="pre">Skeleton</span></tt> example (<tt class="docutils literal"><span class="pre">$LLVMC_DIR/example/Skeleton</span></tt>):</p>
-<pre class="literal-block">
-$ cd $LLVMC_DIR/example/
-$ cp -r Skeleton mydriver
-$ cd mydriver
-$ vim Makefile
-[...]
-$ make
-</pre>
-<p>If you're compiling LLVM with different source and object directories, then you
-must perform the following additional steps before running <tt class="docutils literal"><span class="pre">make</span></tt>:</p>
-<pre class="literal-block">
-# LLVMC_SRC_DIR = $LLVM_SRC_DIR/tools/llvmc/
-# LLVMC_OBJ_DIR = $LLVM_OBJ_DIR/tools/llvmc/
-$ cp $LLVMC_SRC_DIR/example/mydriver/Makefile \
-  $LLVMC_OBJ_DIR/example/mydriver/
-$ cd $LLVMC_OBJ_DIR/example/mydriver
-$ make
-</pre>
-<p>Another way to do the same thing is by using the following command:</p>
-<pre class="literal-block">
-$ cd $LLVMC_DIR
-$ make LLVMC_BUILTIN_PLUGINS=MyPlugin LLVMC_BASED_DRIVER_NAME=mydriver
-</pre>
-<p>This works with both srcdir == objdir and srcdir != objdir, but assumes that the
-plugin source directory was placed under <tt class="docutils literal"><span class="pre">$LLVMC_DIR/plugins</span></tt>.</p>
-<p>Sometimes, you will want a 'bare-bones' version of LLVMC that has no
-built-in plugins. It can be compiled with the following command:</p>
-<pre class="literal-block">
-$ cd $LLVMC_DIR
-$ make LLVMC_BUILTIN_PLUGINS=&quot;&quot;
-</pre>
-</div>
-<div class="section" id="customizing-llvmc-the-compilation-graph">
-<h1><a class="toc-backref" href="#id13">Customizing LLVMC: the compilation graph</a></h1>
-<p>Each TableGen configuration file should include the common
-definitions:</p>
-<pre class="literal-block">
-include &quot;llvm/CompilerDriver/Common.td&quot;
-</pre>
-<p>Internally, LLVMC stores information about possible source
-transformations in form of a graph. Nodes in this graph represent
-tools, and edges between two nodes represent a transformation path. A
-special &quot;root&quot; node is used to mark entry points for the
-transformations. LLVMC also assigns a weight to each edge (more on
-this later) to choose between several alternative edges.</p>
-<p>The definition of the compilation graph (see file
-<tt class="docutils literal"><span class="pre">plugins/Base/Base.td</span></tt> for an example) is just a list of edges:</p>
-<pre class="literal-block">
-def CompilationGraph : CompilationGraph&lt;[
-    Edge&lt;&quot;root&quot;, &quot;llvm_gcc_c&quot;&gt;,
-    Edge&lt;&quot;root&quot;, &quot;llvm_gcc_assembler&quot;&gt;,
-    ...
-
-    Edge&lt;&quot;llvm_gcc_c&quot;, &quot;llc&quot;&gt;,
-    Edge&lt;&quot;llvm_gcc_cpp&quot;, &quot;llc&quot;&gt;,
-    ...
-
-    OptionalEdge&lt;&quot;llvm_gcc_c&quot;, &quot;opt&quot;, (case (switch_on &quot;opt&quot;),
-                                      (inc_weight))&gt;,
-    OptionalEdge&lt;&quot;llvm_gcc_cpp&quot;, &quot;opt&quot;, (case (switch_on &quot;opt&quot;),
-                                              (inc_weight))&gt;,
-    ...
-
-    OptionalEdge&lt;&quot;llvm_gcc_assembler&quot;, &quot;llvm_gcc_cpp_linker&quot;,
-        (case (input_languages_contain &quot;c++&quot;), (inc_weight),
-              (or (parameter_equals &quot;linker&quot;, &quot;g++&quot;),
-                  (parameter_equals &quot;linker&quot;, &quot;c++&quot;)), (inc_weight))&gt;,
-    ...
-
-    ]&gt;;
-</pre>
-<p>As you can see, the edges can be either default or optional, where
-optional edges are differentiated by an additional <tt class="docutils literal"><span class="pre">case</span></tt> expression
-used to calculate the weight of this edge. Notice also that we refer
-to tools via their names (as strings). This makes it possible to add
-edges to an existing compilation graph in plugins without having to
-know about all tool definitions used in the graph.</p>
-<p>The default edges are assigned a weight of 1, and optional edges get a
-weight of 0 + 2*N where N is the number of tests that evaluated to
-true in the <tt class="docutils literal"><span class="pre">case</span></tt> expression. It is also possible to provide an
-integer parameter to <tt class="docutils literal"><span class="pre">inc_weight</span></tt> and <tt class="docutils literal"><span class="pre">dec_weight</span></tt> - in this case,
-the weight is increased (or decreased) by the provided value instead
-of the default 2. It is also possible to change the default weight of
-an optional edge by using the <tt class="docutils literal"><span class="pre">default</span></tt> clause of the <tt class="docutils literal"><span class="pre">case</span></tt>
-construct.</p>
-<p>When passing an input file through the graph, LLVMC picks the edge
-with the maximum weight. To avoid ambiguity, there should be only one
-default edge between two nodes (with the exception of the root node,
-which gets a special treatment - there you are allowed to specify one
-default edge <em>per language</em>).</p>
-<p>When multiple plugins are loaded, their compilation graphs are merged
-together. Since multiple edges that have the same end nodes are not
-allowed (i.e. the graph is not a multigraph), an edge defined in
-several plugins will be replaced by the definition from the plugin
-that was loaded last. Plugin load order can be controlled by using the
-plugin priority feature described above.</p>
-<p>To get a visual representation of the compilation graph (useful for
-debugging), run <tt class="docutils literal"><span class="pre">llvmc</span> <span class="pre">--view-graph</span></tt>. You will need <tt class="docutils literal"><span class="pre">dot</span></tt> and
-<tt class="docutils literal"><span class="pre">gsview</span></tt> installed for this to work properly.</p>
-</div>
-<div class="section" id="describing-options">
-<h1><a class="toc-backref" href="#id14">Describing options</a></h1>
-<p>Command-line options that the plugin supports are defined by using an
-<tt class="docutils literal"><span class="pre">OptionList</span></tt>:</p>
-<pre class="literal-block">
-def Options : OptionList&lt;[
-(switch_option &quot;E&quot;, (help &quot;Help string&quot;)),
-(alias_option &quot;quiet&quot;, &quot;q&quot;)
-...
-]&gt;;
-</pre>
-<p>As you can see, the option list is just a list of DAGs, where each DAG
-is an option description consisting of the option name and some
-properties. A plugin can define more than one option list (they are
-all merged together in the end), which can be handy if one wants to
-separate option groups syntactically.</p>
-<ul>
-<li><p class="first">Possible option types:</p>
-<blockquote>
-<ul class="simple">
-<li><tt class="docutils literal"><span class="pre">switch_option</span></tt> - a simple boolean switch without arguments, for example
-<tt class="docutils literal"><span class="pre">-O2</span></tt> or <tt class="docutils literal"><span class="pre">-time</span></tt>. At most one occurrence is allowed.</li>
-<li><tt class="docutils literal"><span class="pre">parameter_option</span></tt> - option that takes one argument, for example
-<tt class="docutils literal"><span class="pre">-std=c99</span></tt>. It is also allowed to use spaces instead of the equality
-sign: <tt class="docutils literal"><span class="pre">-std</span> <span class="pre">c99</span></tt>. At most one occurrence is allowed.</li>
-<li><tt class="docutils literal"><span class="pre">parameter_list_option</span></tt> - same as the above, but more than one option
-occurence is allowed.</li>
-<li><tt class="docutils literal"><span class="pre">prefix_option</span></tt> - same as the parameter_option, but the option name and
-argument do not have to be separated. Example: <tt class="docutils literal"><span class="pre">-ofile</span></tt>. This can be also
-specified as <tt class="docutils literal"><span class="pre">-o</span> <span class="pre">file</span></tt>; however, <tt class="docutils literal"><span class="pre">-o=file</span></tt> will be parsed incorrectly
-(<tt class="docutils literal"><span class="pre">=file</span></tt> will be interpreted as option value). At most one occurrence is
-allowed.</li>
-<li><tt class="docutils literal"><span class="pre">prefix_list_option</span></tt> - same as the above, but more than one occurence of
-the option is allowed; example: <tt class="docutils literal"><span class="pre">-lm</span> <span class="pre">-lpthread</span></tt>.</li>
-<li><tt class="docutils literal"><span class="pre">alias_option</span></tt> - a special option type for creating aliases. Unlike other
-option types, aliases are not allowed to have any properties besides the
-aliased option name. Usage example: <tt class="docutils literal"><span class="pre">(alias_option</span> <span class="pre">&quot;preprocess&quot;,</span> <span class="pre">&quot;E&quot;)</span></tt></li>
-</ul>
-</blockquote>
-</li>
-<li><p class="first">Possible option properties:</p>
-<blockquote>
-<ul class="simple">
-<li><tt class="docutils literal"><span class="pre">help</span></tt> - help string associated with this option. Used for <tt class="docutils literal"><span class="pre">--help</span></tt>
-output.</li>
-<li><tt class="docutils literal"><span class="pre">required</span></tt> - this option must be specified exactly once (or, in case of
-the list options without the <tt class="docutils literal"><span class="pre">multi_val</span></tt> property, at least
-once). Incompatible with <tt class="docutils literal"><span class="pre">zero_or_one</span></tt> and <tt class="docutils literal"><span class="pre">one_or_more</span></tt>.</li>
-<li><tt class="docutils literal"><span class="pre">one_or_more</span></tt> - the option must be specified at least one time. Useful
-only for list options in conjunction with <tt class="docutils literal"><span class="pre">multi_val</span></tt>; for ordinary lists
-it is synonymous with <tt class="docutils literal"><span class="pre">required</span></tt>. Incompatible with <tt class="docutils literal"><span class="pre">required</span></tt> and
-<tt class="docutils literal"><span class="pre">zero_or_one</span></tt>.</li>
-<li><tt class="docutils literal"><span class="pre">optional</span></tt> - the option can be specified zero or one times. Useful only
-for list options in conjunction with <tt class="docutils literal"><span class="pre">multi_val</span></tt>. Incompatible with
-<tt class="docutils literal"><span class="pre">required</span></tt> and <tt class="docutils literal"><span class="pre">one_or_more</span></tt>.</li>
-<li><tt class="docutils literal"><span class="pre">hidden</span></tt> - the description of this option will not appear in
-the <tt class="docutils literal"><span class="pre">--help</span></tt> output (but will appear in the <tt class="docutils literal"><span class="pre">--help-hidden</span></tt>
-output).</li>
-<li><tt class="docutils literal"><span class="pre">really_hidden</span></tt> - the option will not be mentioned in any help
-output.</li>
-<li><tt class="docutils literal"><span class="pre">comma_separated</span></tt> - Indicates that any commas specified for an option's
-value should be used to split the value up into multiple values for the
-option. This property is valid only for list options. In conjunction with
-<tt class="docutils literal"><span class="pre">forward_value</span></tt> can be used to implement option forwarding in style of
-gcc's <tt class="docutils literal"><span class="pre">-Wa,</span></tt>.</li>
-<li><tt class="docutils literal"><span class="pre">multi_val</span> <span class="pre">n</span></tt> - this option takes <em>n</em> arguments (can be useful in some
-special cases). Usage example: <tt class="docutils literal"><span class="pre">(parameter_list_option</span> <span class="pre">&quot;foo&quot;,</span> <span class="pre">(multi_val</span>
-<span class="pre">3))</span></tt>; the command-line syntax is '-foo a b c'. Only list options can have
-this attribute; you can, however, use the <tt class="docutils literal"><span class="pre">one_or_more</span></tt>, <tt class="docutils literal"><span class="pre">optional</span></tt>
-and <tt class="docutils literal"><span class="pre">required</span></tt> properties.</li>
-<li><tt class="docutils literal"><span class="pre">init</span></tt> - this option has a default value, either a string (if it is a
-parameter), or a boolean (if it is a switch; as in C++, boolean constants
-are called <tt class="docutils literal"><span class="pre">true</span></tt> and <tt class="docutils literal"><span class="pre">false</span></tt>). List options can't have <tt class="docutils literal"><span class="pre">init</span></tt>
-attribute.
-Usage examples: <tt class="docutils literal"><span class="pre">(switch_option</span> <span class="pre">&quot;foo&quot;,</span> <span class="pre">(init</span> <span class="pre">true))</span></tt>; <tt class="docutils literal"><span class="pre">(prefix_option</span>
-<span class="pre">&quot;bar&quot;,</span> <span class="pre">(init</span> <span class="pre">&quot;baz&quot;))</span></tt>.</li>
-<li><tt class="docutils literal"><span class="pre">extern</span></tt> - this option is defined in some other plugin, see <a class="reference internal" href="#extern">below</a>.</li>
-</ul>
-</blockquote>
-</li>
-</ul>
-<div class="section" id="external-options">
-<span id="extern"></span><h2><a class="toc-backref" href="#id15">External options</a></h2>
-<p>Sometimes, when linking several plugins together, one plugin needs to
-access options defined in some other plugin. Because of the way
-options are implemented, such options must be marked as
-<tt class="docutils literal"><span class="pre">extern</span></tt>. This is what the <tt class="docutils literal"><span class="pre">extern</span></tt> option property is
-for. Example:</p>
-<pre class="literal-block">
-...
-(switch_option &quot;E&quot;, (extern))
-...
-</pre>
-<p>If an external option has additional attributes besides 'extern', they are
-ignored. See also the section on plugin <a class="reference internal" href="#priorities">priorities</a>.</p>
-</div>
-</div>
-<div class="section" id="conditional-evaluation">
-<span id="case"></span><h1><a class="toc-backref" href="#id16">Conditional evaluation</a></h1>
-<p>The 'case' construct is the main means by which programmability is
-achieved in LLVMC. It can be used to calculate edge weights, program
-actions and modify the shell commands to be executed. The 'case'
-expression is designed after the similarly-named construct in
-functional languages and takes the form <tt class="docutils literal"><span class="pre">(case</span> <span class="pre">(test_1),</span> <span class="pre">statement_1,</span>
-<span class="pre">(test_2),</span> <span class="pre">statement_2,</span> <span class="pre">...</span> <span class="pre">(test_N),</span> <span class="pre">statement_N)</span></tt>. The statements
-are evaluated only if the corresponding tests evaluate to true.</p>
-<p>Examples:</p>
-<pre class="literal-block">
-// Edge weight calculation
-
-// Increases edge weight by 5 if &quot;-A&quot; is provided on the
-// command-line, and by 5 more if &quot;-B&quot; is also provided.
-(case
-    (switch_on &quot;A&quot;), (inc_weight 5),
-    (switch_on &quot;B&quot;), (inc_weight 5))
-
-
-// Tool command line specification
-
-// Evaluates to &quot;cmdline1&quot; if the option &quot;-A&quot; is provided on the
-// command line; to &quot;cmdline2&quot; if &quot;-B&quot; is provided;
-// otherwise to &quot;cmdline3&quot;.
-
-(case
-    (switch_on &quot;A&quot;), &quot;cmdline1&quot;,
-    (switch_on &quot;B&quot;), &quot;cmdline2&quot;,
-    (default), &quot;cmdline3&quot;)
-</pre>
-<p>Note the slight difference in 'case' expression handling in contexts
-of edge weights and command line specification - in the second example
-the value of the <tt class="docutils literal"><span class="pre">&quot;B&quot;</span></tt> switch is never checked when switch <tt class="docutils literal"><span class="pre">&quot;A&quot;</span></tt> is
-enabled, and the whole expression always evaluates to <tt class="docutils literal"><span class="pre">&quot;cmdline1&quot;</span></tt> in
-that case.</p>
-<p>Case expressions can also be nested, i.e. the following is legal:</p>
-<pre class="literal-block">
-(case (switch_on &quot;E&quot;), (case (switch_on &quot;o&quot;), ..., (default), ...)
-      (default), ...)
-</pre>
-<p>You should, however, try to avoid doing that because it hurts
-readability. It is usually better to split tool descriptions and/or
-use TableGen inheritance instead.</p>
-<ul class="simple">
-<li>Possible tests are:<ul>
-<li><tt class="docutils literal"><span class="pre">switch_on</span></tt> - Returns true if a given command-line switch is provided by
-the user. Can be given a list as argument, in that case <tt class="docutils literal"><span class="pre">(switch_on</span> <span class="pre">[&quot;foo&quot;,</span>
-<span class="pre">&quot;bar&quot;,</span> <span class="pre">&quot;baz&quot;])</span></tt> is equivalent to <tt class="docutils literal"><span class="pre">(and</span> <span class="pre">(switch_on</span> <span class="pre">&quot;foo&quot;),</span> <span class="pre">(switch_on</span>
-<span class="pre">&quot;bar&quot;),</span> <span class="pre">(switch_on</span> <span class="pre">&quot;baz&quot;))</span></tt>.
-Example: <tt class="docutils literal"><span class="pre">(switch_on</span> <span class="pre">&quot;opt&quot;)</span></tt>.</li>
-<li><tt class="docutils literal"><span class="pre">any_switch_on</span></tt> - Given a list of switch options, returns true if any of
-the switches is turned on.
-Example: <tt class="docutils literal"><span class="pre">(any_switch_on</span> <span class="pre">[&quot;foo&quot;,</span> <span class="pre">&quot;bar&quot;,</span> <span class="pre">&quot;baz&quot;])</span></tt> is equivalent to <tt class="docutils literal"><span class="pre">(or</span>
-<span class="pre">(switch_on</span> <span class="pre">&quot;foo&quot;),</span> <span class="pre">(switch_on</span> <span class="pre">&quot;bar&quot;),</span> <span class="pre">(switch_on</span> <span class="pre">&quot;baz&quot;))</span></tt>.</li>
-<li><tt class="docutils literal"><span class="pre">parameter_equals</span></tt> - Returns true if a command-line parameter equals
-a given value.
-Example: <tt class="docutils literal"><span class="pre">(parameter_equals</span> <span class="pre">&quot;W&quot;,</span> <span class="pre">&quot;all&quot;)</span></tt>.</li>
-<li><tt class="docutils literal"><span class="pre">element_in_list</span></tt> - Returns true if a command-line parameter
-list contains a given value.
-Example: <tt class="docutils literal"><span class="pre">(element_in_list</span> <span class="pre">&quot;l&quot;,</span> <span class="pre">&quot;pthread&quot;)</span></tt>.</li>
-<li><tt class="docutils literal"><span class="pre">input_languages_contain</span></tt> - Returns true if a given language
-belongs to the current input language set.
-Example: <tt class="docutils literal"><span class="pre">(input_languages_contain</span> <span class="pre">&quot;c++&quot;)</span></tt>.</li>
-<li><tt class="docutils literal"><span class="pre">in_language</span></tt> - Evaluates to true if the input file language is equal to
-the argument. At the moment works only with <tt class="docutils literal"><span class="pre">cmd_line</span></tt> and <tt class="docutils literal"><span class="pre">actions</span></tt> (on
-non-join nodes).
-Example: <tt class="docutils literal"><span class="pre">(in_language</span> <span class="pre">&quot;c++&quot;)</span></tt>.</li>
-<li><tt class="docutils literal"><span class="pre">not_empty</span></tt> - Returns true if a given option (which should be either a
-parameter or a parameter list) is set by the user. Like <tt class="docutils literal"><span class="pre">switch_on</span></tt>, can
-be also given a list as argument.
-Example: <tt class="docutils literal"><span class="pre">(not_empty</span> <span class="pre">&quot;o&quot;)</span></tt>.</li>
-<li><tt class="docutils literal"><span class="pre">any_not_empty</span></tt> - Returns true if <tt class="docutils literal"><span class="pre">not_empty</span></tt> returns true for any of
-the options in the list.
-Example: <tt class="docutils literal"><span class="pre">(any_not_empty</span> <span class="pre">[&quot;foo&quot;,</span> <span class="pre">&quot;bar&quot;,</span> <span class="pre">&quot;baz&quot;])</span></tt> is equivalent to <tt class="docutils literal"><span class="pre">(or</span>
-<span class="pre">(not_empty</span> <span class="pre">&quot;foo&quot;),</span> <span class="pre">(not_empty</span> <span class="pre">&quot;bar&quot;),</span> <span class="pre">(not_empty</span> <span class="pre">&quot;baz&quot;))</span></tt>.</li>
-<li><tt class="docutils literal"><span class="pre">empty</span></tt> - The opposite of <tt class="docutils literal"><span class="pre">not_empty</span></tt>. Equivalent to <tt class="docutils literal"><span class="pre">(not</span> <span class="pre">(not_empty</span>
-<span class="pre">X))</span></tt>. Provided for convenience. Can be given a list as argument.</li>
-<li><tt class="docutils literal"><span class="pre">any_not_empty</span></tt> - Returns true if <tt class="docutils literal"><span class="pre">not_empty</span></tt> returns true for any of
-the options in the list.
-Example: <tt class="docutils literal"><span class="pre">(any_empty</span> <span class="pre">[&quot;foo&quot;,</span> <span class="pre">&quot;bar&quot;,</span> <span class="pre">&quot;baz&quot;])</span></tt> is equivalent to <tt class="docutils literal"><span class="pre">(not</span> <span class="pre">(and</span>
-<span class="pre">(not_empty</span> <span class="pre">&quot;foo&quot;),</span> <span class="pre">(not_empty</span> <span class="pre">&quot;bar&quot;),</span> <span class="pre">(not_empty</span> <span class="pre">&quot;baz&quot;)))</span></tt>.</li>
-<li><tt class="docutils literal"><span class="pre">single_input_file</span></tt> - Returns true if there was only one input file
-provided on the command-line. Used without arguments:
-<tt class="docutils literal"><span class="pre">(single_input_file)</span></tt>.</li>
-<li><tt class="docutils literal"><span class="pre">multiple_input_files</span></tt> - Equivalent to <tt class="docutils literal"><span class="pre">(not</span> <span class="pre">(single_input_file))</span></tt> (the
-case of zero input files is considered an error).</li>
-<li><tt class="docutils literal"><span class="pre">default</span></tt> - Always evaluates to true. Should always be the last
-test in the <tt class="docutils literal"><span class="pre">case</span></tt> expression.</li>
-<li><tt class="docutils literal"><span class="pre">and</span></tt> - A standard binary logical combinator that returns true iff all of
-its arguments return true. Used like this: <tt class="docutils literal"><span class="pre">(and</span> <span class="pre">(test1),</span> <span class="pre">(test2),</span>
-<span class="pre">...</span> <span class="pre">(testN))</span></tt>. Nesting of <tt class="docutils literal"><span class="pre">and</span></tt> and <tt class="docutils literal"><span class="pre">or</span></tt> is allowed, but not
-encouraged.</li>
-<li><tt class="docutils literal"><span class="pre">or</span></tt> - A binary logical combinator that returns true iff any of its
-arguments returns true. Example: <tt class="docutils literal"><span class="pre">(or</span> <span class="pre">(test1),</span> <span class="pre">(test2),</span> <span class="pre">...</span> <span class="pre">(testN))</span></tt>.</li>
-<li><tt class="docutils literal"><span class="pre">not</span></tt> - Standard unary logical combinator that negates its
-argument. Example: <tt class="docutils literal"><span class="pre">(not</span> <span class="pre">(or</span> <span class="pre">(test1),</span> <span class="pre">(test2),</span> <span class="pre">...</span> <span class="pre">(testN)))</span></tt>.</li>
-</ul>
-</li>
-</ul>
-</div>
-<div class="section" id="writing-a-tool-description">
-<h1><a class="toc-backref" href="#id17">Writing a tool description</a></h1>
-<p>As was said earlier, nodes in the compilation graph represent tools,
-which are described separately. A tool definition looks like this
-(taken from the <tt class="docutils literal"><span class="pre">include/llvm/CompilerDriver/Tools.td</span></tt> file):</p>
-<pre class="literal-block">
-def llvm_gcc_cpp : Tool&lt;[
-    (in_language &quot;c++&quot;),
-    (out_language &quot;llvm-assembler&quot;),
-    (output_suffix &quot;bc&quot;),
-    (cmd_line &quot;llvm-g++ -c $INFILE -o $OUTFILE -emit-llvm&quot;),
-    (sink)
-    ]&gt;;
-</pre>
-<p>This defines a new tool called <tt class="docutils literal"><span class="pre">llvm_gcc_cpp</span></tt>, which is an alias for
-<tt class="docutils literal"><span class="pre">llvm-g++</span></tt>. As you can see, a tool definition is just a list of
-properties; most of them should be self-explanatory. The <tt class="docutils literal"><span class="pre">sink</span></tt>
-property means that this tool should be passed all command-line
-options that aren't mentioned in the option list.</p>
-<p>The complete list of all currently implemented tool properties follows.</p>
-<ul class="simple">
-<li>Possible tool properties:<ul>
-<li><tt class="docutils literal"><span class="pre">in_language</span></tt> - input language name. Can be either a string or a
-list, in case the tool supports multiple input languages.</li>
-<li><tt class="docutils literal"><span class="pre">out_language</span></tt> - output language name. Multiple output languages are not
-allowed.</li>
-<li><tt class="docutils literal"><span class="pre">output_suffix</span></tt> - output file suffix. Can also be changed
-dynamically, see documentation on actions.</li>
-<li><tt class="docutils literal"><span class="pre">cmd_line</span></tt> - the actual command used to run the tool. You can
-use <tt class="docutils literal"><span class="pre">$INFILE</span></tt> and <tt class="docutils literal"><span class="pre">$OUTFILE</span></tt> variables, output redirection
-with <tt class="docutils literal"><span class="pre">&gt;</span></tt>, hook invocations (<tt class="docutils literal"><span class="pre">$CALL</span></tt>), environment variables
-(via <tt class="docutils literal"><span class="pre">$ENV</span></tt>) and the <tt class="docutils literal"><span class="pre">case</span></tt> construct.</li>
-<li><tt class="docutils literal"><span class="pre">join</span></tt> - this tool is a &quot;join node&quot; in the graph, i.e. it gets a
-list of input files and joins them together. Used for linkers.</li>
-<li><tt class="docutils literal"><span class="pre">sink</span></tt> - all command-line options that are not handled by other
-tools are passed to this tool.</li>
-<li><tt class="docutils literal"><span class="pre">actions</span></tt> - A single big <tt class="docutils literal"><span class="pre">case</span></tt> expression that specifies how
-this tool reacts on command-line options (described in more detail
-<a class="reference internal" href="#actions">below</a>).</li>
-</ul>
-</li>
-</ul>
-<div class="section" id="id5">
-<span id="actions"></span><h2><a class="toc-backref" href="#id18">Actions</a></h2>
-<p>A tool often needs to react to command-line options, and this is
-precisely what the <tt class="docutils literal"><span class="pre">actions</span></tt> property is for. The next example
-illustrates this feature:</p>
-<pre class="literal-block">
-def llvm_gcc_linker : Tool&lt;[
-    (in_language &quot;object-code&quot;),
-    (out_language &quot;executable&quot;),
-    (output_suffix &quot;out&quot;),
-    (cmd_line &quot;llvm-gcc $INFILE -o $OUTFILE&quot;),
-    (join),
-    (actions (case (not_empty &quot;L&quot;), (forward &quot;L&quot;),
-                   (not_empty &quot;l&quot;), (forward &quot;l&quot;),
-                   (not_empty &quot;dummy&quot;),
-                             [(append_cmd &quot;-dummy1&quot;), (append_cmd &quot;-dummy2&quot;)])
-    ]&gt;;
-</pre>
-<p>The <tt class="docutils literal"><span class="pre">actions</span></tt> tool property is implemented on top of the omnipresent
-<tt class="docutils literal"><span class="pre">case</span></tt> expression. It associates one or more different <em>actions</em>
-with given conditions - in the example, the actions are <tt class="docutils literal"><span class="pre">forward</span></tt>,
-which forwards a given option unchanged, and <tt class="docutils literal"><span class="pre">append_cmd</span></tt>, which
-appends a given string to the tool execution command. Multiple actions
-can be associated with a single condition by using a list of actions
-(used in the example to append some dummy options). The same <tt class="docutils literal"><span class="pre">case</span></tt>
-construct can also be used in the <tt class="docutils literal"><span class="pre">cmd_line</span></tt> property to modify the
-tool command line.</p>
-<p>The &quot;join&quot; property used in the example means that this tool behaves
-like a linker.</p>
-<p>The list of all possible actions follows.</p>
-<ul>
-<li><p class="first">Possible actions:</p>
-<blockquote>
-<ul class="simple">
-<li><tt class="docutils literal"><span class="pre">append_cmd</span></tt> - Append a string to the tool invocation command.
-Example: <tt class="docutils literal"><span class="pre">(case</span> <span class="pre">(switch_on</span> <span class="pre">&quot;pthread&quot;),</span> <span class="pre">(append_cmd</span> <span class="pre">&quot;-lpthread&quot;))</span></tt>.</li>
-<li><tt class="docutils literal"><span class="pre">error</span></tt> - Exit with error.
-Example: <tt class="docutils literal"><span class="pre">(error</span> <span class="pre">&quot;Mixing</span> <span class="pre">-c</span> <span class="pre">and</span> <span class="pre">-S</span> <span class="pre">is</span> <span class="pre">not</span> <span class="pre">allowed!&quot;)</span></tt>.</li>
-<li><tt class="docutils literal"><span class="pre">warning</span></tt> - Print a warning.
-Example: <tt class="docutils literal"><span class="pre">(warning</span> <span class="pre">&quot;Specifying</span> <span class="pre">both</span> <span class="pre">-O1</span> <span class="pre">and</span> <span class="pre">-O2</span> <span class="pre">is</span> <span class="pre">meaningless!&quot;)</span></tt>.</li>
-<li><tt class="docutils literal"><span class="pre">forward</span></tt> - Forward the option unchanged.
-Example: <tt class="docutils literal"><span class="pre">(forward</span> <span class="pre">&quot;Wall&quot;)</span></tt>.</li>
-<li><tt class="docutils literal"><span class="pre">forward_as</span></tt> - Change the option's name, but forward the argument
-unchanged.
-Example: <tt class="docutils literal"><span class="pre">(forward_as</span> <span class="pre">&quot;O0&quot;,</span> <span class="pre">&quot;--disable-optimization&quot;)</span></tt>.</li>
-<li><tt class="docutils literal"><span class="pre">forward_value</span></tt> - Forward only option's value. Cannot be used with switch
-options (since they don't have values), but works fine with lists.
-Example: <tt class="docutils literal"><span class="pre">(forward_value</span> <span class="pre">&quot;Wa,&quot;)</span></tt>.</li>
-<li><tt class="docutils literal"><span class="pre">forward_transformed_value</span></tt> - As above, but applies a hook to the
-option's value before forwarding (see <a class="reference internal" href="#hooks">below</a>). When
-<tt class="docutils literal"><span class="pre">forward_transformed_value</span></tt> is applied to a list
-option, the hook must have signature
-<tt class="docutils literal"><span class="pre">std::string</span> <span class="pre">hooks::HookName</span> <span class="pre">(const</span> <span class="pre">std::vector&lt;std::string&gt;&amp;)</span></tt>.
-Example: <tt class="docutils literal"><span class="pre">(forward_transformed_value</span> <span class="pre">&quot;m&quot;,</span> <span class="pre">&quot;ConvertToMAttr&quot;)</span></tt>.</li>
-<li><tt class="docutils literal"><span class="pre">output_suffix</span></tt> - Modify the output suffix of this tool.
-Example: <tt class="docutils literal"><span class="pre">(output_suffix</span> <span class="pre">&quot;i&quot;)</span></tt>.</li>
-<li><tt class="docutils literal"><span class="pre">stop_compilation</span></tt> - Stop compilation after this tool processes its
-input. Used without arguments.
-Example: <tt class="docutils literal"><span class="pre">(stop_compilation)</span></tt>.</li>
-</ul>
-</blockquote>
-</li>
-</ul>
-</div>
-</div>
-<div class="section" id="language-map">
-<h1><a class="toc-backref" href="#id19">Language map</a></h1>
-<p>If you are adding support for a new language to LLVMC, you'll need to
-modify the language map, which defines mappings from file extensions
-to language names. It is used to choose the proper toolchain(s) for a
-given input file set. Language map definition looks like this:</p>
-<pre class="literal-block">
-def LanguageMap : LanguageMap&lt;
-    [LangToSuffixes&lt;&quot;c++&quot;, [&quot;cc&quot;, &quot;cp&quot;, &quot;cxx&quot;, &quot;cpp&quot;, &quot;CPP&quot;, &quot;c++&quot;, &quot;C&quot;]&gt;,
-     LangToSuffixes&lt;&quot;c&quot;, [&quot;c&quot;]&gt;,
-     ...
-    ]&gt;;
-</pre>
-<p>For example, without those definitions the following command wouldn't work:</p>
-<pre class="literal-block">
-$ llvmc hello.cpp
-llvmc: Unknown suffix: cpp
-</pre>
-<p>The language map entries are needed only for the tools that are linked from the
-root node. Since a tool can't have multiple output languages, for inner nodes of
-the graph the input and output languages should match. This is enforced at
-compile-time.</p>
-</div>
-<div class="section" id="option-preprocessor">
-<h1><a class="toc-backref" href="#id20">Option preprocessor</a></h1>
-<p>It is sometimes useful to run error-checking code before processing the
-compilation graph. For example, if optimization options &quot;-O1&quot; and &quot;-O2&quot; are
-implemented as switches, we might want to output a warning if the user invokes
-the driver with both of these options enabled.</p>
-<p>The <tt class="docutils literal"><span class="pre">OptionPreprocessor</span></tt> feature is reserved specially for these
-occasions. Example (adapted from the built-in Base plugin):</p>
-<pre class="literal-block">
-def Preprocess : OptionPreprocessor&lt;
-(case (not (any_switch_on [&quot;O0&quot;, &quot;O1&quot;, &quot;O2&quot;, &quot;O3&quot;])),
-           (set_option &quot;O2&quot;),
-      (and (switch_on &quot;O3&quot;), (any_switch_on [&quot;O0&quot;, &quot;O1&quot;, &quot;O2&quot;])),
-           (unset_option [&quot;O0&quot;, &quot;O1&quot;, &quot;O2&quot;]),
-      (and (switch_on &quot;O2&quot;), (any_switch_on [&quot;O0&quot;, &quot;O1&quot;])),
-           (unset_option [&quot;O0&quot;, &quot;O1&quot;]),
-      (and (switch_on &quot;O1&quot;), (switch_on &quot;O0&quot;)),
-           (unset_option &quot;O0&quot;))
-&gt;;
-</pre>
-<p>Here, <tt class="docutils literal"><span class="pre">OptionPreprocessor</span></tt> is used to unset all spurious <tt class="docutils literal"><span class="pre">-O</span></tt> options so
-that they are not forwarded to the compiler. If no optimization options are
-specified, <tt class="docutils literal"><span class="pre">-O2</span></tt> is enabled.</p>
-<p><tt class="docutils literal"><span class="pre">OptionPreprocessor</span></tt> is basically a single big <tt class="docutils literal"><span class="pre">case</span></tt> expression, which is
-evaluated only once right after the plugin is loaded. The only allowed actions
-in <tt class="docutils literal"><span class="pre">OptionPreprocessor</span></tt> are <tt class="docutils literal"><span class="pre">error</span></tt>, <tt class="docutils literal"><span class="pre">warning</span></tt>, and two special actions:
-<tt class="docutils literal"><span class="pre">unset_option</span></tt> and <tt class="docutils literal"><span class="pre">set_option</span></tt>. As their names suggest, they can be used to
-set or unset a given option. To set an option with <tt class="docutils literal"><span class="pre">set_option</span></tt>, use the
-two-argument form: <tt class="docutils literal"><span class="pre">(set_option</span> <span class="pre">&quot;parameter&quot;,</span> <span class="pre">VALUE)</span></tt>. Here, <tt class="docutils literal"><span class="pre">VALUE</span></tt> can be
-either a string, a string list, or a boolean constant.</p>
-<p>For convenience, <tt class="docutils literal"><span class="pre">set_option</span></tt> and <tt class="docutils literal"><span class="pre">unset_option</span></tt> also work on lists. That
-is, instead of <tt class="docutils literal"><span class="pre">[(unset_option</span> <span class="pre">&quot;A&quot;),</span> <span class="pre">(unset_option</span> <span class="pre">&quot;B&quot;)]</span></tt> you can use
-<tt class="docutils literal"><span class="pre">(unset_option</span> <span class="pre">[&quot;A&quot;,</span> <span class="pre">&quot;B&quot;])</span></tt>. Obviously, <tt class="docutils literal"><span class="pre">(set_option</span> <span class="pre">[&quot;A&quot;,</span> <span class="pre">&quot;B&quot;])</span></tt> is valid
-only if both <tt class="docutils literal"><span class="pre">A</span></tt> and <tt class="docutils literal"><span class="pre">B</span></tt> are switches.</p>
-</div>
-<div class="section" id="more-advanced-topics">
-<h1><a class="toc-backref" href="#id21">More advanced topics</a></h1>
-<div class="section" id="hooks-and-environment-variables">
-<span id="hooks"></span><h2><a class="toc-backref" href="#id22">Hooks and environment variables</a></h2>
-<p>Normally, LLVMC executes programs from the system <tt class="docutils literal"><span class="pre">PATH</span></tt>. Sometimes,
-this is not sufficient: for example, we may want to specify tool paths
-or names in the configuration file. This can be easily achieved via
-the hooks mechanism. To write your own hooks, just add their
-definitions to the <tt class="docutils literal"><span class="pre">PluginMain.cpp</span></tt> or drop a <tt class="docutils literal"><span class="pre">.cpp</span></tt> file into the
-your plugin directory. Hooks should live in the <tt class="docutils literal"><span class="pre">hooks</span></tt> namespace
-and have the signature <tt class="docutils literal"><span class="pre">std::string</span> <span class="pre">hooks::MyHookName</span> <span class="pre">([const</span> <span class="pre">char*</span>
-<span class="pre">Arg0</span> <span class="pre">[</span> <span class="pre">const</span> <span class="pre">char*</span> <span class="pre">Arg2</span> <span class="pre">[,</span> <span class="pre">...]]])</span></tt>. They can be used from the
-<tt class="docutils literal"><span class="pre">cmd_line</span></tt> tool property:</p>
-<pre class="literal-block">
-(cmd_line &quot;$CALL(MyHook)/path/to/file -o $CALL(AnotherHook)&quot;)
-</pre>
-<p>To pass arguments to hooks, use the following syntax:</p>
-<pre class="literal-block">
-(cmd_line &quot;$CALL(MyHook, 'Arg1', 'Arg2', 'Arg # 3')/path/to/file -o1 -o2&quot;)
-</pre>
-<p>It is also possible to use environment variables in the same manner:</p>
-<pre class="literal-block">
-(cmd_line &quot;$ENV(VAR1)/path/to/file -o $ENV(VAR2)&quot;)
-</pre>
-<p>To change the command line string based on user-provided options use
-the <tt class="docutils literal"><span class="pre">case</span></tt> expression (documented <a class="reference internal" href="#case">above</a>):</p>
-<pre class="literal-block">
-(cmd_line
-  (case
-    (switch_on &quot;E&quot;),
-       &quot;llvm-g++ -E -x c $INFILE -o $OUTFILE&quot;,
-    (default),
-       &quot;llvm-g++ -c -x c $INFILE -o $OUTFILE -emit-llvm&quot;))
-</pre>
-</div>
-<div class="section" id="how-plugins-are-loaded">
-<span id="priorities"></span><h2><a class="toc-backref" href="#id23">How plugins are loaded</a></h2>
-<p>It is possible for LLVMC plugins to depend on each other. For example,
-one can create edges between nodes defined in some other plugin. To
-make this work, however, that plugin should be loaded first. To
-achieve this, the concept of plugin priority was introduced. By
-default, every plugin has priority zero; to specify the priority
-explicitly, put the following line in your plugin's TableGen file:</p>
-<pre class="literal-block">
-def Priority : PluginPriority&lt;$PRIORITY_VALUE&gt;;
-# Where PRIORITY_VALUE is some integer &gt; 0
-</pre>
-<p>Plugins are loaded in order of their (increasing) priority, starting
-with 0. Therefore, the plugin with the highest priority value will be
-loaded last.</p>
-</div>
-<div class="section" id="debugging">
-<h2><a class="toc-backref" href="#id24">Debugging</a></h2>
-<p>When writing LLVMC plugins, it can be useful to get a visual view of
-the resulting compilation graph. This can be achieved via the command
-line option <tt class="docutils literal"><span class="pre">--view-graph</span></tt>. This command assumes that <a class="reference external" href="http://www.graphviz.org/">Graphviz</a> and
-<a class="reference external" href="http://pages.cs.wisc.edu/~ghost/">Ghostview</a> are installed. There is also a <tt class="docutils literal"><span class="pre">--write-graph</span></tt> option that
-creates a Graphviz source file (<tt class="docutils literal"><span class="pre">compilation-graph.dot</span></tt>) in the
-current directory.</p>
-<p>Another useful <tt class="docutils literal"><span class="pre">llvmc</span></tt> option is <tt class="docutils literal"><span class="pre">--check-graph</span></tt>. It checks the
-compilation graph for common errors like mismatched output/input
-language names, multiple default edges and cycles. These checks can't
-be performed at compile-time because the plugins can load code
-dynamically. When invoked with <tt class="docutils literal"><span class="pre">--check-graph</span></tt>, <tt class="docutils literal"><span class="pre">llvmc</span></tt> doesn't
-perform any compilation tasks and returns the number of encountered
-errors as its status code.</p>
-</div>
-<div class="section" id="conditioning-on-the-executable-name">
-<h2><a class="toc-backref" href="#id25">Conditioning on the executable name</a></h2>
-<p>For now, the executable name (the value passed to the driver in <tt class="docutils literal"><span class="pre">argv[0]</span></tt>) is
-accessible only in the C++ code (i.e. hooks). Use the following code:</p>
-<pre class="literal-block">
-namespace llvmc {
-extern const char* ProgramName;
-}
-
-namespace hooks {
-
-std::string MyHook() {
-//...
-if (strcmp(ProgramName, &quot;mydriver&quot;) == 0) {
-   //...
-
-}
-
-} // end namespace hooks
-</pre>
-<p>In general, you're encouraged not to make the behaviour dependent on the
-executable file name, and use command-line switches instead. See for example how
-the <tt class="docutils literal"><span class="pre">Base</span></tt> plugin behaves when it needs to choose the correct linker options
-(think <tt class="docutils literal"><span class="pre">g++</span></tt> vs. <tt class="docutils literal"><span class="pre">gcc</span></tt>).</p>
-<hr />
-<address>
-<a href="http://jigsaw.w3.org/css-validator/check/referer">
-<img src="http://jigsaw.w3.org/css-validator/images/vcss-blue"
-   alt="Valid CSS" /></a>
-<a href="http://validator.w3.org/check?uri=referer">
-<img src="http://www.w3.org/Icons/valid-xhtml10-blue"
-   alt="Valid XHTML 1.0 Transitional"/></a>
-
-<a href="mailto:foldr at codedgers.com">Mikhail Glushenkov</a><br />
-<a href="http://llvm.org">LLVM Compiler Infrastructure</a><br />
-
-Last modified: $Date: 2008-12-11 11:34:48 -0600 (Thu, 11 Dec 2008) $
-</address></div>
-</div>
-</div>
-</body>
-</html>
diff --git a/libclamav/c++/llvm/docs/CompilerDriverTutorial.html b/libclamav/c++/llvm/docs/CompilerDriverTutorial.html
deleted file mode 100644
index 317b1d1..0000000
--- a/libclamav/c++/llvm/docs/CompilerDriverTutorial.html
+++ /dev/null
@@ -1,126 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-<meta name="generator" content="Docutils 0.5: http://docutils.sourceforge.net/" />
-<title>Tutorial - Using LLVMC</title>
-<link rel="stylesheet" href="llvm.css" type="text/css" />
-</head>
-<body>
-<div class="document" id="tutorial-using-llvmc">
-<h1 class="title">Tutorial - Using LLVMC</h1>
-
-<!-- This file was automatically generated by rst2html.
-Please do not edit directly!
-The ReST source lives in the directory 'tools/llvmc/doc'. -->
-<div class="contents topic" id="contents">
-<p class="topic-title first">Contents</p>
-<ul class="simple">
-<li><a class="reference internal" href="#introduction" id="id1">Introduction</a></li>
-<li><a class="reference internal" href="#compiling-with-llvmc" id="id2">Compiling with LLVMC</a></li>
-<li><a class="reference internal" href="#using-llvmc-to-generate-toolchain-drivers" id="id3">Using LLVMC to generate toolchain drivers</a></li>
-</ul>
-</div>
-<div class="doc_author">
-<p>Written by <a href="mailto:foldr at codedgers.com">Mikhail Glushenkov</a></p>
-</div><div class="section" id="introduction">
-<h1><a class="toc-backref" href="#id1">Introduction</a></h1>
-<p>LLVMC is a generic compiler driver, which plays the same role for LLVM
-as the <tt class="docutils literal"><span class="pre">gcc</span></tt> program does for GCC - the difference being that LLVMC
-is designed to be more adaptable and easier to customize. Most of
-LLVMC functionality is implemented via plugins, which can be loaded
-dynamically or compiled in. This tutorial describes the basic usage
-and configuration of LLVMC.</p>
-</div>
-<div class="section" id="compiling-with-llvmc">
-<h1><a class="toc-backref" href="#id2">Compiling with LLVMC</a></h1>
-<p>In general, LLVMC tries to be command-line compatible with <tt class="docutils literal"><span class="pre">gcc</span></tt> as
-much as possible, so most of the familiar options work:</p>
-<pre class="literal-block">
-$ llvmc -O3 -Wall hello.cpp
-$ ./a.out
-hello
-</pre>
-<p>This will invoke <tt class="docutils literal"><span class="pre">llvm-g++</span></tt> under the hood (you can see which
-commands are executed by using the <tt class="docutils literal"><span class="pre">-v</span></tt> option). For further help on
-command-line LLVMC usage, refer to the <tt class="docutils literal"><span class="pre">llvmc</span> <span class="pre">--help</span></tt> output.</p>
-</div>
-<div class="section" id="using-llvmc-to-generate-toolchain-drivers">
-<h1><a class="toc-backref" href="#id3">Using LLVMC to generate toolchain drivers</a></h1>
-<p>LLVMC plugins are written mostly using <a class="reference external" href="http://llvm.org/docs/TableGenFundamentals.html">TableGen</a>, so you need to
-be familiar with it to get anything done.</p>
-<p>Start by compiling <tt class="docutils literal"><span class="pre">example/Simple</span></tt>, which is a primitive wrapper for
-<tt class="docutils literal"><span class="pre">gcc</span></tt>:</p>
-<pre class="literal-block">
-$ cd $LLVM_DIR/tools/llvmc
-$ cp -r example/Simple plugins/Simple
-
-  # NB: A less verbose way to compile standalone LLVMC-based drivers is
-  # described in the reference manual.
-
-$ make LLVMC_BASED_DRIVER_NAME=mygcc LLVMC_BUILTIN_PLUGINS=Simple
-$ cat &gt; hello.c
-[...]
-$ mygcc hello.c
-$ ./hello.out
-Hello
-</pre>
-<p>Here we link our plugin with the LLVMC core statically to form an executable
-file called <tt class="docutils literal"><span class="pre">mygcc</span></tt>. It is also possible to build our plugin as a dynamic
-library to be loaded by the <tt class="docutils literal"><span class="pre">llvmc</span></tt> executable (or any other LLVMC-based
-standalone driver); this is described in the reference manual.</p>
-<p>Contents of the file <tt class="docutils literal"><span class="pre">Simple.td</span></tt> look like this:</p>
-<pre class="literal-block">
-// Include common definitions
-include &quot;llvm/CompilerDriver/Common.td&quot;
-
-// Tool descriptions
-def gcc : Tool&lt;
-[(in_language &quot;c&quot;),
- (out_language &quot;executable&quot;),
- (output_suffix &quot;out&quot;),
- (cmd_line &quot;gcc $INFILE -o $OUTFILE&quot;),
- (sink)
-]&gt;;
-
-// Language map
-def LanguageMap : LanguageMap&lt;[LangToSuffixes&lt;&quot;c&quot;, [&quot;c&quot;]&gt;]&gt;;
-
-// Compilation graph
-def CompilationGraph : CompilationGraph&lt;[Edge&lt;&quot;root&quot;, &quot;gcc&quot;&gt;]&gt;;
-</pre>
-<p>As you can see, this file consists of three parts: tool descriptions,
-language map, and the compilation graph definition.</p>
-<p>At the heart of LLVMC is the idea of a compilation graph: vertices in
-this graph are tools, and edges represent a transformation path
-between two tools (for example, assembly source produced by the
-compiler can be transformed into executable code by an assembler). The
-compilation graph is basically a list of edges; a special node named
-<tt class="docutils literal"><span class="pre">root</span></tt> is used to mark graph entry points.</p>
-<p>Tool descriptions are represented as property lists: most properties
-in the example above should be self-explanatory; the <tt class="docutils literal"><span class="pre">sink</span></tt> property
-means that all options lacking an explicit description should be
-forwarded to this tool.</p>
-<p>The <tt class="docutils literal"><span class="pre">LanguageMap</span></tt> associates a language name with a list of suffixes
-and is used for deciding which toolchain corresponds to a given input
-file.</p>
-<p>To learn more about LLVMC customization, refer to the reference
-manual and plugin source code in the <tt class="docutils literal"><span class="pre">plugins</span></tt> directory.</p>
-<hr />
-<address>
-<a href="http://jigsaw.w3.org/css-validator/check/referer">
-<img src="http://jigsaw.w3.org/css-validator/images/vcss-blue"
-   alt="Valid CSS" /></a>
-<a href="http://validator.w3.org/check?uri=referer">
-<img src="http://www.w3.org/Icons/valid-xhtml10-blue"
-   alt="Valid XHTML 1.0 Transitional"/></a>
-
-<a href="mailto:foldr at codedgers.com">Mikhail Glushenkov</a><br />
-<a href="http://llvm.org">LLVM Compiler Infrastructure</a><br />
-
-Last modified: $Date: 2008-12-11 11:34:48 -0600 (Thu, 11 Dec 2008) $
-</address></div>
-</div>
-</body>
-</html>
diff --git a/libclamav/c++/llvm/docs/CompilerWriterInfo.html b/libclamav/c++/llvm/docs/CompilerWriterInfo.html
deleted file mode 100644
index 5d071f7..0000000
--- a/libclamav/c++/llvm/docs/CompilerWriterInfo.html
+++ /dev/null
@@ -1,263 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" 
-                      "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-  <title>Architecture/platform information for compiler writers</title>
-  <link rel="stylesheet" href="llvm.css" type="text/css">
-</head>
-
-<body>
-
-<div class="doc_title">
-  Architecture/platform information for compiler writers
-</div>
-
-<div class="doc_warning">
-  <p>Note: This document is a work-in-progress.  Additions and clarifications
-  are welcome.</p>
-</div>
-
-<ol>
-  <li><a href="#hw">Hardware</a>
-  <ol>
-    <li><a href="#alpha">Alpha</a></li>
-    <li><a href="#arm">ARM</a></li>
-    <li><a href="#ia64">Itanium</a></li>
-    <li><a href="#mips">MIPS</a></li>
-    <li><a href="#ppc">PowerPC</a></li>
-    <li><a href="#sparc">SPARC</a></li>
-    <li><a href="#x86">X86</a></li>
-    <li><a href="#other">Other lists</a></li>
-  </ol></li>
-  <li><a href="#abi">Application Binary Interface (ABI)</a>
-  <ol>
-    <li><a href="#linux">Linux</a></li>
-    <li><a href="#osx">OS X</a></li>
-  </ol></li>
-  <li><a href="#misc">Miscellaneous resources</a></li>
-</ol>
-
-<div class="doc_author">
-  <p>Compiled by <a href="http://misha.brukman.net">Misha Brukman</a></p>
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="hw">Hardware</a></div>
-<!-- *********************************************************************** -->
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="alpha">Alpha</a></div>
-
-<div class="doc_text">
-<ul>
-<li><a
-href="http://ftp.digital.com/pub/Digital/info/semiconductor/literature/dsc-library.html">Alpha manuals</a> 
-</li>
-</ul>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="arm">ARM</a></div>
-
-<div class="doc_text">
-<ul>
-<li><a href="http://www.arm.com/documentation/">ARM documentation</a> 
-(<a href="http://www.arm.com/documentation/ARMProcessor_Cores/">Processor
-Cores</a>)</li>
-<li><a href="http://www.arm.com/products/DevTools/ABI.html">ABI</a></li>
-</ul>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="ia64">Itanium (ia64)</a></div>
-
-<div class="doc_text">
-<ul>
-<li><a
-href="http://developer.intel.com/design/itanium2/documentation.htm">Itanium documentation</a> 
-</li>
-</ul>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="mips">MIPS</a></div>
-
-<div class="doc_text">
-<ul>
-<li><a
-href="http://mips.com/content/Documentation/MIPSDocumentation/ProcessorArchitecture/doclibrary">MIPS
-Processor Architecture</a></li>
-</ul>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="ppc">PowerPC</a></div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">IBM - Official manuals and docs</div>
-
-<div class="doc_text">
-
-<ul>
-<li><a
-href="http://www-106.ibm.com/developerworks/eserver/articles/archguide.html">PowerPC
-Architecture Book</a>
-<ul>
-  <li>Book I: <a
-  href="http://www-106.ibm.com/developerworks/eserver/pdfs/archpub1.pdf">PowerPC
-  User Instruction Set Architecture</a></li>
-  <li>Book II: <a
-  href="http://www-106.ibm.com/developerworks/eserver/pdfs/archpub2.pdf">PowerPC
-  Virtual Environment Architecture</a></li>
-  <li>Book III: <a
-  href="http://www-106.ibm.com/developerworks/eserver/pdfs/archpub3.pdf">PowerPC
-  Operating Environment Architecture</a></li>
-</ul></li>
-<li><a
-href="http://www-3.ibm.com/chips/techlib/techlib.nsf/techdocs/852569B20050FF7785256996007558C6">PowerPC
-Compiler Writer's Guide</a></li>
-<li><A
-href="http://www-3.ibm.com/chips/techlib/techlib.nsf/products/PowerPC">PowerPC
-Processor Manuals</a></li>
-<li><a
-href="http://www-106.ibm.com/developerworks/linux/library/l-powarch/">Intro to
-PowerPC architecture</a></li>
-<li><a href="http://publibn.boulder.ibm.com/doc_link/en_US/a_doc_lib/aixassem/alangref/alangreftfrm.htm">IBM AIX/5L for POWER Assembly reference</a></li>
-</ul>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">Other documents, collections, notes</div>
-
-<div class="doc_text">
-
-<ul>
-<li><a href="http://penguinppc.org/dev/#library">PowerPC ABI documents</a></li>
-<li><a href="http://gcc.gnu.org/ml/gcc-patches/2003-09/msg00997.html">PowerPC64
-alignment of long doubles (from GCC)</a></li>
-<li><a href="http://sources.redhat.com/ml/binutils/2002-04/msg00573.html">Long
-branch stubs for powerpc64-linux (from binutils)</a></li>
-</ul>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="sparc">SPARC</a></div>
-
-<div class="doc_text">
-
-<ul>
-<li><a href="http://www.sparc.org/resource.htm">SPARC resources</a></li>
-<li><a href="http://www.sparc.org/standards.html">SPARC standards</a></li>
-</ul>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="x86">X86</a></div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">AMD - Official manuals and docs</div>
-
-<div class="doc_text">
-<ul>
-<li><a
-href="http://www.amd.com/us-en/Processors/TechnicalResources/0,,30_182_739,00.html">AMD processor manuals</a></li>
-<li><a href="http://www.x86-64.org/documentation">X86-64 ABI</a></li>
-</ul>
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">Intel - Official manuals and docs</div>
-
-<div class="doc_text">
-<ul>
-<li><a
-href="http://developer.intel.com/design/pentium4/manuals/index_new.htm">IA-32
-manuals</a></li>
-<li><a
-href="http://www.intel.com/design/itanium/documentation.htm?iid=ipp_srvr_proc_itanium2+techdocs">Intel
-Itanium documentation</a></li>
-</ul>
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">Other x86-specific information</div>
-
-<div class="doc_text">
-<ul>
-<li><a href="http://www.agner.org/assem/calling_conventions.pdf">Calling
-conventions for different C++ compilers and operating systems</a></li>
-</ul>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="other">Other relevant lists</a></div>
-
-<div class="doc_text">
-
-<ul>
-<li><a href="http://gcc.gnu.org/readings.html">GCC reading list</a></li>
-</ul>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="abi">ABI</a></div>
-<!-- *********************************************************************** -->
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="linux">Linux</a></div>
-
-<div class="doc_text">
-<ol>
-<li><a href="http://www.linuxbase.org/spec/ELF/ppc64/">PowerPC 64-bit ELF ABI
-Supplement</a></li>
-</ol>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="osx">OS X</a></div>
-
-<div class="doc_text">
-<ol>
-<li><a
-href="http://developer.apple.com/documentation/Darwin/RuntimeArchitecture-date.html">Mach-O
-Runtime Architecture</a></li>
-<li><a href="http://www.unsanity.org/archives/000044.php">Notes on Mach-O
-ABI</a></li>
-</ol>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="misc">Miscellaneous resources</a></div>
-<!-- *********************************************************************** -->
-
-<ul>
-<li><a
-href="http://www.nondot.org/sabre/os/articles/ExecutableFileFormats/">Executable
-File Format library</a></li>
-<li><a href="http://gcc.gnu.org/projects/prefetch.html">GCC prefetch project</a>
-page has a good survey of the prefetching capabilities of a variety of modern
-processors.</li>
-</ul>
-
-<!-- *********************************************************************** -->
-
-<hr>
-<address>
-  <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
-  src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS"></a>
-  <a href="http://validator.w3.org/check/referer"><img
-  src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
-
-  <a href="http://misha.brukman.net">Misha Brukman</a><br>
-  <a href="http://llvm.org">LLVM Compiler Infrastructure</a><br>
-  Last modified: $Date$
-</address>
-
-</body>
-</html>
diff --git a/libclamav/c++/llvm/docs/DebuggingJITedCode.html b/libclamav/c++/llvm/docs/DebuggingJITedCode.html
deleted file mode 100644
index 92570f4..0000000
--- a/libclamav/c++/llvm/docs/DebuggingJITedCode.html
+++ /dev/null
@@ -1,171 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-                      "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-  <title>Debugging JITed Code With GDB</title>
-  <link rel="stylesheet" href="llvm.css" type="text/css">
-</head>
-<body>
-
-<div class="doc_title">Debugging JITed Code With GDB</div>
-<ol>
-  <li><a href="#introduction">Introduction</a></li>
-  <li><a href="#quickstart">Quickstart</a></li>
-  <li><a href="#example">Example with clang and lli</a></li>
-</ol>
-<div class="doc_author">Written by Reid Kleckner</div>
-
-<!--=========================================================================-->
-<div class="doc_section"><a name="introduction">Introduction</a></div>
-<!--=========================================================================-->
-<div class="doc_text">
-
-<p>Without special runtime support, debugging dynamically generated code with
-GDB (as well as most debuggers) can be quite painful.  Debuggers generally read
-debug information from the object file of the code, but for JITed code, there is
-no such file to look for.
-</p>
-
-<p>Depending on the architecture, this can impact the debugging experience in
-different ways.  For example, on most 32-bit x86 architectures, you can simply
-compile with -fno-omit-framepointer for GCC and -fdisable-fp-elim for LLVM.
-When GDB creates a backtrace, it can properly unwind the stack, but the stack
-frames owned by JITed code have ??'s instead of the appropriate symbol name.
-However, on Linux x86_64 in particular, GDB relies on the DWARF CFA debug
-information to unwind the stack, so even if you compile your program to leave
-the frame pointer untouched, GDB will usually be unable to unwind the stack past
-any JITed code stack frames.
-</p>
-
-<p>In order to communicate the necessary debug info to GDB, an interface for
-registering JITed code with debuggers has been designed and implemented for
-GDB and LLVM.  At a high level, whenever LLVM generates new machine code, it
-also generates an object file in memory containing the debug information.  LLVM
-then adds the object file to the global list of object files and calls a special
-function (__jit_debug_register_code) marked noinline that GDB knows about.  When
-GDB attaches to a process, it puts a breakpoint in this function and loads all
-of the object files in the global list.  When LLVM calls the registration
-function, GDB catches the breakpoint signal, loads the new object file from
-LLVM's memory, and resumes the execution.  In this way, GDB can get the
-necessary debug information.
-</p>
-
-<p>At the time of this writing, LLVM only supports architectures that use ELF
-object files and it only generates symbols and DWARF CFA information.  However,
-it would be easy to add more information to the object file, so we don't need to
-coordinate with GDB to get better debug information.
-</p>
-</div>
-
-<!--=========================================================================-->
-<div class="doc_section"><a name="quickstart">Quickstart</a></div>
-<!--=========================================================================-->
-<div class="doc_text">
-
-<p>In order to debug code JITed by LLVM, you need to install a recent version
-of GDB.  The interface was added on 2009-08-19, so you need a snapshot of GDB
-more recent than that.  Either download a snapshot of GDB or checkout CVS as
-instructed <a href="http://www.gnu.org/software/gdb/current/">here</a>.  Here
-are the commands for doing a checkout and building the code:
-</p>
-
-<pre class="doc_code">
-$ cvs -z 3 -d :pserver:anoncvs at sourceware.org:/cvs/src co gdb
-$ mv src gdb   # You probably don't want this checkout called "src".
-$ cd gdb
-$ ./configure --prefix="$GDB_INSTALL"
-$ make
-$ make install
-</pre>
-
-<p>You can then use -jit-emit-debug in the LLVM command line arguments to enable
-the interface.
-</p>
-</div>
-
-<!--=========================================================================-->
-<div class="doc_section"><a name="example">Example with clang and lli</a></div>
-<!--=========================================================================-->
-<div class="doc_text">
-
-<p>For example, consider debugging running lli on the following C code in
-foo.c:
-</p>
-
-<pre class="doc_code">
-#include &lt;stdio.h&gt;
-
-void foo() {
-    printf("%d\n", *(int*)NULL);  // Crash here
-}
-
-void bar() {
-    foo();
-}
-
-void baz() {
-    bar();
-}
-
-int main(int argc, char **argv) {
-    baz();
-}
-</pre>
-
-<p>Here are the commands to run that application under GDB and print the stack
-trace at the crash:
-</p>
-
-<pre class="doc_code">
-# Compile foo.c to bitcode.  You can use either clang or llvm-gcc with this
-# command line.  Both require -fexceptions, or the calls are all marked
-# 'nounwind' which disables DWARF CFA info.
-$ clang foo.c -fexceptions -emit-llvm -c -o foo.bc
-
-# Run foo.bc under lli with -jit-emit-debug.  If you built lli in debug mode,
-# -jit-emit-debug defaults to true.
-$ $GDB_INSTALL/gdb --args lli -jit-emit-debug foo.bc
-...
-
-# Run the code.
-(gdb) run
-Starting program: /tmp/gdb/lli -jit-emit-debug foo.bc
-[Thread debugging using libthread_db enabled]
-
-Program received signal SIGSEGV, Segmentation fault.
-0x00007ffff7f55164 in foo ()
-
-# Print the backtrace, this time with symbols instead of ??.
-(gdb) bt
-#0  0x00007ffff7f55164 in foo ()
-#1  0x00007ffff7f550f9 in bar ()
-#2  0x00007ffff7f55099 in baz ()
-#3  0x00007ffff7f5502a in main ()
-#4  0x00000000007c0225 in llvm::JIT::runFunction(llvm::Function*,
-    std::vector&lt;llvm::GenericValue,
-    std::allocator&lt;llvm::GenericValue&gt; &gt; const&) ()
-#5  0x00000000007d6d98 in
-    llvm::ExecutionEngine::runFunctionAsMain(llvm::Function*,
-    std::vector&lt;std::string,
-    std::allocator&lt;std::string&gt; &gt; const&, char const* const*) ()
-#6  0x00000000004dab76 in main ()
-</pre>
-</div>
-
-<p>As you can see, GDB can correctly unwind the stack and has the appropriate
-function names.
-</p>
-
-<!-- *********************************************************************** -->
-<hr>
-<address>
-  <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
-  src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS"></a>
-  <a href="http://validator.w3.org/check/referer"><img
-  src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
-  <a href="mailto:reid.kleckner at gmail.com">Reid Kleckner</a><br>
-  <a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
-  Last modified: $Date: 2009-01-01 23:10:51 -0800 (Thu, 01 Jan 2009) $
-</address>
-</body>
-</html>
diff --git a/libclamav/c++/llvm/docs/DeveloperPolicy.html b/libclamav/c++/llvm/docs/DeveloperPolicy.html
deleted file mode 100644
index b11e48b..0000000
--- a/libclamav/c++/llvm/docs/DeveloperPolicy.html
+++ /dev/null
@@ -1,607 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-                      "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-  <title>LLVM Developer Policy</title>
-  <link rel="stylesheet" href="llvm.css" type="text/css">
-</head>
-<body>
-      
-<div class="doc_title">LLVM Developer Policy</div>
-<ol>
-  <li><a href="#introduction">Introduction</a></li>
-  <li><a href="#policies">Developer Policies</a>
-  <ol>
-    <li><a href="#informed">Stay Informed</a></li>
-    <li><a href="#patches">Making a Patch</a></li>
-    <li><a href="#reviews">Code Reviews</a></li>
-    <li><a href="#owners">Code Owners</a></li>
-    <li><a href="#testcases">Test Cases</a></li>
-    <li><a href="#quality">Quality</a></li>
-    <li><a href="#commitaccess">Obtaining Commit Access</a></li>
-    <li><a href="#newwork">Making a Major Change</a></li>
-    <li><a href="#incremental">Incremental Development</a></li>
-    <li><a href="#attribution">Attribution of Changes</a></li>
-  </ol></li>
-  <li><a href="#clp">Copyright, License, and Patents</a>
-  <ol>
-    <li><a href="#copyright">Copyright</a></li>
-    <li><a href="#license">License</a></li>
-    <li><a href="#patents">Patents</a></li>
-    <li><a href="#devagree">Developer Agreements</a></li>
-  </ol></li>
-</ol>
-<div class="doc_author">Written by the LLVM Oversight Team</div>
-
-<!--=========================================================================-->
-<div class="doc_section"><a name="introduction">Introduction</a></div>
-<!--=========================================================================-->
-<div class="doc_text">
-<p>This document contains the LLVM Developer Policy which defines the project's
-   policy towards developers and their contributions. The intent of this policy
-   is to eliminate miscommunication, rework, and confusion that might arise from
-   the distributed nature of LLVM's development.  By stating the policy in clear
-   terms, we hope each developer can know ahead of time what to expect when
-   making LLVM contributions.</p>
-<p>This policy is also designed to accomplish the following objectives:</p>
-
-<ol>
-  <li>Attract both users and developers to the LLVM project.</li>
-
-  <li>Make life as simple and easy for contributors as possible.</li>
-
-  <li>Keep the top of Subversion trees as stable as possible.</li>
-</ol>
-  
-<p>This policy is aimed at frequent contributors to LLVM. People interested in
-   contributing one-off patches can do so in an informal way by sending them to
-   the
-   <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits">llvm-commits
-   mailing list</a> and engaging another developer to see it through the
-   process.</p>
-</div>
-
-<!--=========================================================================-->
-<div class="doc_section"><a name="policies">Developer Policies</a></div>
-<!--=========================================================================-->
-<div class="doc_text">
-<p>This section contains policies that pertain to frequent LLVM developers.  We
-   always welcome <a href="#patches">one-off patches</a> from people who do not
-   routinely contribute to LLVM, but we expect more from frequent contributors
-   to keep the system as efficient as possible for everyone.  Frequent LLVM
-   contributors are expected to meet the following requirements in order for
-   LLVM to maintain a high standard of quality.<p>
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsection"> <a name="informed">Stay Informed</a> </div>
-<div class="doc_text">
-<p>Developers should stay informed by reading at least the 
-   <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">llvmdev</a> email
-  list.  If you are doing anything more than just casual work on LLVM, it is
-  suggested that you also subscribe to the
-  <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits">llvm-commits</a>
-  list and pay attention to changes being made by others.</p>
-
-<p>We recommend that active developers register an email account with 
-   <a href="http://llvm.org/bugs/">LLVM Bugzilla</a> and preferably subscribe to
-   the <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs">llvm-bugs</a>
-   email list to keep track of bugs and enhancements occurring in LLVM.</p>
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsection"> <a name="patches">Making a Patch</a></div>
-
-<div class="doc_text">
-<p>When making a patch for review, the goal is to make it as easy for the
-   reviewer to read it as possible.  As such, we recommend that you:</p>
-
-<ol>
-  <li>Make your patch against the Subversion trunk, not a branch, and not an old
-      version of LLVM.  This makes it easy to apply the patch.  For information
-      on how to check out SVN trunk, please see the <a
-      href="GettingStarted.html#checkout">Getting Started Guide</a>.</li>
-        
-  <li>Similarly, patches should be submitted soon after they are generated.  Old
-      patches may not apply correctly if the underlying code changes between the
-      time the patch was created and the time it is applied.</li>
-
-  <li>Patches should be made with this command:
-<div class="doc_code">
-<pre>
-svn diff
-</pre>
-</div>
-      or with the utility <tt>utils/mkpatch</tt>, which makes it easy to read
-      the diff.</li>
-
-  <li>Patches should not include differences in generated code such as the code
-      generated by <tt>autoconf</tt> or <tt>tblgen</tt>. The
-      <tt>utils/mkpatch</tt> utility takes care of this for you.</li>
-</ol>
-  
-<p>When sending a patch to a mailing list, it is a good idea to send it as an
-   <em>attachment</em> to the message, not embedded into the text of the
-   message.  This ensures that your mailer will not mangle the patch when it
-   sends it (e.g. by making whitespace changes or by wrapping lines).</p>
-
-<p><em>For Thunderbird users:</em> Before submitting a patch, please open 
-   <em>Preferences &#8594; Advanced &#8594; General &#8594; Config Editor</em>,
-   find the key <tt>mail.content_disposition_type</tt>, and set its value to
-   <tt>1</tt>. Without this setting, Thunderbird sends your attachment using
-   <tt>Content-Disposition: inline</tt> rather than <tt>Content-Disposition:
-   attachment</tt>. Apple Mail gamely displays such a file inline, making it
-   difficult to work with for reviewers using that program.</p>
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsection"> <a name="reviews">Code Reviews</a></div>
-<div class="doc_text">
-<p>LLVM has a code review policy. Code review is one way to increase the quality
-   of software. We generally follow these policies:</p>
-
-<ol>
-  <li>All developers are required to have significant changes reviewed before
-      they are committed to the repository.</li>
-
-  <li>Code reviews are conducted by email, usually on the llvm-commits
-      list.</li>
-
-  <li>Code can be reviewed either before it is committed or after.  We expect
-      major changes to be reviewed before being committed, but smaller changes
-      (or changes where the developer owns the component) can be reviewed after
-      commit.</li>
-
-  <li>The developer responsible for a code change is also responsible for making
-      all necessary review-related changes.</li>
-
-  <li>Code review can be an iterative process, which continues until the patch
-      is ready to be committed.</li>
-</ol>
-  
-<p>Developers should participate in code reviews as both reviewers and
-   reviewees. If someone is kind enough to review your code, you should return
-   the favor for someone else.  Note that anyone is welcome to review and give
-   feedback on a patch, but only people with Subversion write access can approve
-   it.</p>
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsection"> <a name="owners">Code Owners</a></div>
-<div class="doc_text">
-
-<p>The LLVM Project relies on two features of its process to maintain rapid
-   development in addition to the high quality of its source base: the
-   combination of code review plus post-commit review for trusted maintainers.
-   Having both is a great way for the project to take advantage of the fact that
-   most people do the right thing most of the time, and only commit patches
-   without pre-commit review when they are confident they are right.</p>
-     
-<p>The trick to this is that the project has to guarantee that all patches that
-   are committed are reviewed after they go in: you don't want everyone to
-   assume someone else will review it, allowing the patch to go unreviewed.  To
-   solve this problem, we have a notion of an 'owner' for a piece of the code.
-   The sole responsibility of a code owner is to ensure that a commit to their
-   area of the code is appropriately reviewed, either by themself or by someone
-   else.  The current code owners are:</p>
-  
-<ol>
-  <li><b>Evan Cheng</b>: Code generator and all targets.</li>
-
-  <li><b>Doug Gregor</b>: Clang Basic, Lex, Parse, and Sema Libraries.</li>
-
-  <li><b>Anton Korobeynikov</b>: Exception handling, debug information, and
-      Windows codegen.</li>
-
-  <li><b>Ted Kremenek</b>: Clang Static Analyzer.</li>
-
-  <li><b>Chris Lattner</b>: Everything not covered by someone else.</li>
-  
-  <li><b>Duncan Sands</b>: llvm-gcc 4.2.</li>
-</ol>
-  
-<p>Note that code ownership is completely different than reviewers: anyone can
-   review a piece of code, and we welcome code review from anyone who is
-   interested.  Code owners are the "last line of defense" to guarantee that all
-   patches that are committed are actually reviewed.</p>
-
-<p>Being a code owner is a somewhat unglamorous position, but it is incredibly
-   important for the ongoing success of the project.  Because people get busy,
-   interests change, and unexpected things happen, code ownership is purely
-   opt-in, and anyone can choose to resign their "title" at any time. For now,
-   we do not have an official policy on how one gets elected to be a code
-   owner.</p>
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsection"> <a name="testcases">Test Cases</a></div>
-<div class="doc_text">
-<p>Developers are required to create test cases for any bugs fixed and any new
-   features added.  Some tips for getting your testcase approved:</p>
-
-<ol>
-  <li>All feature and regression test cases are added to the 
-      <tt>llvm/test</tt> directory. The appropriate sub-directory should be
-      selected (see the <a href="TestingGuide.html">Testing Guide</a> for
-      details).</li>
-
-  <li>Test cases should be written in <a href="LangRef.html">LLVM assembly
-      language</a> unless the feature or regression being tested requires
-      another language (e.g. the bug being fixed or feature being implemented is
-      in the llvm-gcc C++ front-end, in which case it must be written in
-      C++).</li>
-
-  <li>Test cases, especially for regressions, should be reduced as much as
-      possible, by <a href="Bugpoint.html">bugpoint</a> or manually. It is
-      unacceptable to place an entire failing program into <tt>llvm/test</tt> as
-      this creates a <i>time-to-test</i> burden on all developers. Please keep
-      them short.</li>
-</ol>
-  
-<p>Note that llvm/test is designed for regression and small feature tests
-   only. More extensive test cases (e.g., entire applications, benchmarks, etc)
-   should be added to the <tt>llvm-test</tt> test suite.  The llvm-test suite is
-   for coverage (correctness, performance, etc) testing, not feature or
-   regression testing.</p>
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsection"> <a name="quality">Quality</a></div>
-<div class="doc_text">
-<p>The minimum quality standards that any change must satisfy before being
-   committed to the main development branch are:</p>
-
-<ol>
-  <li>Code must adhere to the <a href="CodingStandards.html">LLVM Coding
-      Standards</a>.</li>
-
-  <li>Code must compile cleanly (no errors, no warnings) on at least one
-      platform.</li>
-
-  <li>Bug fixes and new features should <a href="#testcases">include a
-      testcase</a> so we know if the fix/feature ever regresses in the
-      future.</li>
-
-  <li>Code must pass the dejagnu (<tt>llvm/test</tt>) test suite.</li>
-
-  <li>The code must not cause regressions on a reasonable subset of llvm-test,
-      where "reasonable" depends on the contributor's judgement and the scope of
-      the change (more invasive changes require more testing). A reasonable
-      subset might be something like
-      "<tt>llvm-test/MultiSource/Benchmarks</tt>".</li>
-</ol>
-
-<p>Additionally, the committer is responsible for addressing any problems found
-   in the future that the change is responsible for.  For example:</p>
-
-<ul>
-  <li>The code should compile cleanly on all supported platforms.</li>
-
-  <li>The changes should not cause any correctness regressions in the
-      <tt>llvm-test</tt> suite and must not cause any major performance
-      regressions.</li>
-
-  <li>The change set should not cause performance or correctness regressions for
-      the LLVM tools.</li>
-
-  <li>The changes should not cause performance or correctness regressions in
-      code compiled by LLVM on all applicable targets.</li>
-
-  <li>You are expected to address any <a href="http://llvm.org/bugs/">bugzilla
-      bugs</a> that result from your change.</li>
-</ul>
-  
-<p>We prefer for this to be handled before submission but understand that it
-   isn't possible to test all of this for every submission.  Our build bots and
-   nightly testing infrastructure normally finds these problems.  A good rule of
-   thumb is to check the nightly testers for regressions the day after your
-   change.  Build bots will directly email you if a group of commits that
-   included yours caused a failure.  You are expected to check the build bot
-   messages to see if they are your fault and, if so, fix the breakage.</p>
-
-<p>Commits that violate these quality standards (e.g. are very broken) may be
-   reverted. This is necessary when the change blocks other developers from
-   making progress. The developer is welcome to re-commit the change after the
-   problem has been fixed.</p>
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsection">
-  <a name="commitaccess">Obtaining Commit Access</a></div>
-<div class="doc_text">
-
-<p>We grant commit access to contributors with a track record of submitting high
-   quality patches.  If you would like commit access, please send an email to
-   <a href="mailto:sabre at nondot.org">Chris</a> with the following
-   information:</p>
-
-<ol>
-  <li>The user name you want to commit with, e.g. "hacker".</li>
-
-  <li>The full name and email address you want message to llvm-commits to come
-      from, e.g. "J. Random Hacker &lt;hacker at yoyodyne.com&gt;".</li>
-
-  <li>A "password hash" of the password you want to use, e.g. "2ACR96qjUqsyM".  
-      Note that you don't ever tell us what your password is, you just give it
-      to us in an encrypted form.  To get this, run "htpasswd" (a utility that
-      comes with apache) in crypt mode (often enabled with "-d"), or find a web
-      page that will do it for you.</li>
-</ol>
-
-<p>Once you've been granted commit access, you should be able to check out an
-   LLVM tree with an SVN URL of "https://username@llvm.org/..." instead of the
-   normal anonymous URL of "http://llvm.org/...".  The first time you commit
-   you'll have to type in your password.  Note that you may get a warning from
-   SVN about an untrusted key, you can ignore this.  To verify that your commit
-   access works, please do a test commit (e.g. change a comment or add a blank
-   line).  Your first commit to a repository may require the autogenerated email
-   to be approved by a mailing list.  This is normal, and will be done when
-   the mailing list owner has time.</p>
-
-<p>If you have recently been granted commit access, these policies apply:</p>
-
-<ol>
-  <li>You are granted <i>commit-after-approval</i> to all parts of LLVM.  To get
-      approval, submit a <a href="#patches">patch</a> to
-      <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits">llvm-commits</a>.
-      When approved you may commit it yourself.</li>
-
-  <li>You are allowed to commit patches without approval which you think are
-      obvious. This is clearly a subjective decision &mdash; we simply expect
-      you to use good judgement.  Examples include: fixing build breakage,
-      reverting obviously broken patches, documentation/comment changes, any
-      other minor changes.</li>
-
-  <li>You are allowed to commit patches without approval to those portions of
-      LLVM that you have contributed or maintain (i.e., have been assigned
-      responsibility for), with the proviso that such commits must not break the
-      build.  This is a "trust but verify" policy and commits of this nature are
-      reviewed after they are committed.</li>
-
-  <li>Multiple violations of these policies or a single egregious violation may
-      cause commit access to be revoked.</li>
-</ol>
-
-<p>In any case, your changes are still subject to <a href="#reviews">code
-   review</a> (either before or after they are committed, depending on the
-   nature of the change).  You are encouraged to review other peoples' patches
-   as well, but you aren't required to.</p>
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsection"> <a name="newwork">Making a Major Change</a></div>
-<div class="doc_text">
-<p>When a developer begins a major new project with the aim of contributing it
-   back to LLVM, s/he should inform the community with an email to
-   the <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">llvmdev</a>
-   email list, to the extent possible. The reason for this is to:
-
-<ol>
-  <li>keep the community informed about future changes to LLVM, </li>
-
-  <li>avoid duplication of effort by preventing multiple parties working on the
-      same thing and not knowing about it, and</li>
-
-  <li>ensure that any technical issues around the proposed work are discussed
-      and resolved before any significant work is done.</li>
-</ol>
-  
-<p>The design of LLVM is carefully controlled to ensure that all the pieces fit
-   together well and are as consistent as possible. If you plan to make a major
-   change to the way LLVM works or want to add a major new extension, it is a
-   good idea to get consensus with the development community before you start
-   working on it.</p>
-  
-<p>Once the design of the new feature is finalized, the work itself should be
-   done as a series of <a href="#incremental">incremental changes</a>, not as a
-   long-term development branch.</p>
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsection"> <a name="incremental">Incremental Development</a>
-</div>
-<div class="doc_text">
-<p>In the LLVM project, we do all significant changes as a series of incremental
-   patches.  We have a strong dislike for huge changes or long-term development
-   branches.  Long-term development branches have a number of drawbacks:</p>
-
-<ol>
-  <li>Branches must have mainline merged into them periodically.  If the branch
-      development and mainline development occur in the same pieces of code,
-      resolving merge conflicts can take a lot of time.</li>
-
-  <li>Other people in the community tend to ignore work on branches.</li>
-
-  <li>Huge changes (produced when a branch is merged back onto mainline) are
-      extremely difficult to <a href="#reviews">code review</a>.</li>
-
-  <li>Branches are not routinely tested by our nightly tester
-      infrastructure.</li>
-
-  <li>Changes developed as monolithic large changes often don't work until the
-      entire set of changes is done.  Breaking it down into a set of smaller
-      changes increases the odds that any of the work will be committed to the
-      main repository.</li>
-</ol>    
-  
-<p>To address these problems, LLVM uses an incremental development style and we
-   require contributors to follow this practice when making a large/invasive
-   change.  Some tips:</p>
-
-<ul>
-  <li>Large/invasive changes usually have a number of secondary changes that are
-      required before the big change can be made (e.g. API cleanup, etc).  These
-      sorts of changes can often be done before the major change is done,
-      independently of that work.</li>
-
-  <li>The remaining inter-related work should be decomposed into unrelated sets
-      of changes if possible.  Once this is done, define the first increment and
-      get consensus on what the end goal of the change is.</li>
-
-  <li>Each change in the set can be stand alone (e.g. to fix a bug), or part of
-      a planned series of changes that works towards the development goal.</li>
-    
-  <li>Each change should be kept as small as possible. This simplifies your work
-      (into a logical progression), simplifies code review and reduces the
-      chance that you will get negative feedback on the change. Small increments
-      also facilitate the maintenance of a high quality code base.</li>
-
-  <li>Often, an independent precursor to a big change is to add a new API and
-      slowly migrate clients to use the new API.  Each change to use the new API
-      is often "obvious" and can be committed without review.  Once the new API
-      is in place and used, it is much easier to replace the underlying
-      implementation of the API.  This implementation change is logically
-      separate from the API change.</li>
-</ul>
-  
-<p>If you are interested in making a large change, and this scares you, please
-   make sure to first <a href="#newwork">discuss the change/gather consensus</a>
-   then ask about the best way to go about making the change.</p>
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsection"><a name="attribution">Attribution of 
-Changes</a></div>
-<div class="doc_text">
-<p>We believe in correct attribution of contributions to their contributors.
-   However, we do not want the source code to be littered with random
-   attributions "this code written by J. Random Hacker" (this is noisy and
-   distracting).  In practice, the revision control system keeps a perfect
-   history of who changed what, and the CREDITS.txt file describes higher-level
-   contributions.  If you commit a patch for someone else, please say "patch
-   contributed by J. Random Hacker!" in the commit message.</p>
-
-<p>Overall, please do not add contributor names to the source code.</p>
-</div>
-
-<!--=========================================================================-->
-<div class="doc_section">
-  <a name="clp">Copyright, License, and Patents</a>
-</div>
-<!--=========================================================================-->
-
-<div class="doc_text">
-<p>This section addresses the issues of copyright, license and patents for the
-   LLVM project.  Currently, the University of Illinois is the LLVM copyright
-   holder and the terms of its license to LLVM users and developers is the
-   <a href="http://www.opensource.org/licenses/UoI-NCSA.php">University of 
-   Illinois/NCSA Open Source License</a>.</p>
-
-<div class="doc_notes">
-<p style="text-align:center;font-weight:bold">NOTE: This section deals with
-   legal matters but does not provide legal advice.  We are not lawyers, please
-   seek legal counsel from an attorney.</p>
-</div>
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsection"><a name="copyright">Copyright</a></div>
-<div class="doc_text">
-<p>For consistency and ease of management, the project requires the copyright
-   for all LLVM software to be held by a single copyright holder: the University
-   of Illinois (UIUC).</p>
-  
-<p>Although UIUC may eventually reassign the copyright of the software to
-   another entity (e.g. a dedicated non-profit "LLVM Organization") the intent
-   for the project is to always have a single entity hold the copyrights to LLVM
-   at any given time.</p>
-
-<p>We believe that having a single copyright holder is in the best interests of
-   all developers and users as it greatly reduces the managerial burden for any
-   kind of administrative or technical decisions about LLVM.  The goal of the
-   LLVM project is to always keep the code open and <a href="#license">licensed
-   under a very liberal license</a>.</p>
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsection"><a name="license">License</a></div>
-<div class="doc_text">
-<p>We intend to keep LLVM perpetually open source and to use a liberal open
-   source license. The current license is the
-   <a href="http://www.opensource.org/licenses/UoI-NCSA.php">University of
-   llinois/NCSA Open Source License</a>, which boils down to this:</p>
-
-<ul>
-  <li>You can freely distribute LLVM.</li>
-
-  <li>You must retain the copyright notice if you redistribute LLVM.</li>
-
-  <li>Binaries derived from LLVM must reproduce the copyright notice (e.g.  in
-      an included readme file).</li>
-
-  <li>You can't use our names to promote your LLVM derived products.</li>
-
-  <li>There's no warranty on LLVM at all.</li>
-</ul>
-  
-<p>We believe this fosters the widest adoption of LLVM because it <b>allows
-   commercial products to be derived from LLVM</b> with few restrictions and
-   without a requirement for making any derived works also open source (i.e.
-   LLVM's license is not a "copyleft" license like the GPL). We suggest that you
-   read the <a href="http://www.opensource.org/licenses/UoI-NCSA.php">License</a>
-   if further clarification is needed.</p>
-  
-<p>Note that the LLVM Project does distribute llvm-gcc, <b>which is GPL.</b>
-   This means that anything "linked" into llvm-gcc must itself be compatible
-   with the GPL, and must be releasable under the terms of the GPL.  This
-   implies that <b>any code linked into llvm-gcc and distributed to others may
-   be subject to the viral aspects of the GPL</b> (for example, a proprietary
-   code generator linked into llvm-gcc must be made available under the GPL).
-   This is not a problem for code already distributed under a more liberal
-   license (like the UIUC license), and does not affect code generated by
-   llvm-gcc.  It may be a problem if you intend to base commercial development
-   on llvm-gcc without redistributing your source code.</p>
-  
-<p>We have no plans to change the license of LLVM.  If you have questions or
-   comments about the license, please contact the
-   <a href="mailto:llvm-oversight at cs.uiuc.edu">LLVM Oversight Group</a>.</p>
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsection"><a name="patents">Patents</a></div>
-<div class="doc_text">
-<p>To the best of our knowledge, LLVM does not infringe on any patents (we have
-   actually removed code from LLVM in the past that was found to infringe).
-   Having code in LLVM that infringes on patents would violate an important goal
-   of the project by making it hard or impossible to reuse the code for
-   arbitrary purposes (including commercial use).</p>
-   
-<p>When contributing code, we expect contributors to notify us of any potential
-   for patent-related trouble with their changes.  If you or your employer own
-   the rights to a patent and would like to contribute code to LLVM that relies
-   on it, we require that the copyright owner sign an agreement that allows any
-   other user of LLVM to freely use your patent.  Please contact
-   the <a href="mailto:llvm-oversight at cs.uiuc.edu">oversight group</a> for more
-   details.</p>
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsection"><a name="devagree">Developer Agreements</a></div>
-<div class="doc_text">
-<p>With regards to the LLVM copyright and licensing, developers agree to assign
-   their copyrights to UIUC for any contribution made so that the entire
-   software base can be managed by a single copyright holder.  This implies that
-   any contributions can be licensed under the license that the project
-   uses.</p>
-
-<p>When contributing code, you also affirm that you are legally entitled to
-   grant this copyright, personally or on behalf of your employer.  If the code
-   belongs to some other entity, please raise this issue with the oversight
-   group before the code is committed.</p>
-</div>
-
-<!-- *********************************************************************** -->
-<hr>
-<address>
-  <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
-  src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS"></a>
-  <a href="http://validator.w3.org/check/referer"><img
-  src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
-  Written by the 
-  <a href="mailto:llvm-oversight at cs.uiuc.edu">LLVM Oversight Group</a><br>
-  <a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
-  Last modified: $Date$
-</address>
-</body>
-</html>
diff --git a/libclamav/c++/llvm/docs/ExceptionHandling.html b/libclamav/c++/llvm/docs/ExceptionHandling.html
deleted file mode 100644
index 9c7c615..0000000
--- a/libclamav/c++/llvm/docs/ExceptionHandling.html
+++ /dev/null
@@ -1,606 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-                      "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-  <title>Exception Handling in LLVM</title>
-  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-  <meta name="description"
-        content="Exception Handling in LLVM.">
-  <link rel="stylesheet" href="llvm.css" type="text/css">
-</head>
-
-<body>
-
-<div class="doc_title">Exception Handling in LLVM</div>
-
-<table class="layout" style="width:100%">
-  <tr class="layout">
-    <td class="left">
-<ul>
-  <li><a href="#introduction">Introduction</a>
-  <ol>
-    <li><a href="#itanium">Itanium ABI Zero-cost Exception Handling</a></li>
-    <li><a href="#sjlj">Setjmp/Longjmp Exception Handling</a></li>
-    <li><a href="#overview">Overview</a></li>
-  </ol></li>
-  <li><a href="#codegen">LLVM Code Generation</a>
-  <ol>
-    <li><a href="#throw">Throw</a></li>
-    <li><a href="#try_catch">Try/Catch</a></li>
-    <li><a href="#cleanups">Cleanups</a></li>
-    <li><a href="#throw_filters">Throw Filters</a></li>
-    <li><a href="#restrictions">Restrictions</a></li>
-  </ol></li>
-  <li><a href="#format_common_intrinsics">Exception Handling Intrinsics</a>
-  <ol>
-  	<li><a href="#llvm_eh_exception"><tt>llvm.eh.exception</tt></a></li>
-  	<li><a href="#llvm_eh_selector"><tt>llvm.eh.selector</tt></a></li>
-  	<li><a href="#llvm_eh_typeid_for"><tt>llvm.eh.typeid.for</tt></a></li>
-  	<li><a href="#llvm_eh_sjlj_setjmp"><tt>llvm.eh.sjlj.setjmp</tt></a></li>
-  	<li><a href="#llvm_eh_sjlj_longjmp"><tt>llvm.eh.sjlj.longjmp</tt></a></li>
-  	<li><a href="#llvm_eh_sjlj_lsda"><tt>llvm.eh.sjlj.lsda</tt></a></li>
-  	<li><a href="#llvm_eh_sjlj_callsite"><tt>llvm.eh.sjlj.callsite</tt></a></li>
-  </ol></li>
-  <li><a href="#asm">Asm Table Formats</a>
-  <ol>
-    <li><a href="#unwind_tables">Exception Handling Frame</a></li>
-    <li><a href="#exception_tables">Exception Tables</a></li>
-  </ol></li>
-  <li><a href="#todo">ToDo</a></li>
-</ul>
-</td>
-</tr></table>
-
-<div class="doc_author">
-  <p>Written by <a href="mailto:jlaskey at mac.com">Jim Laskey</a></p>
-</div>
-
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="introduction">Introduction</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>This document is the central repository for all information pertaining to
-   exception handling in LLVM.  It describes the format that LLVM exception
-   handling information takes, which is useful for those interested in creating
-   front-ends or dealing directly with the information.  Further, this document
-   provides specific examples of what exception handling information is used for
-   in C/C++.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="itanium">Itanium ABI Zero-cost Exception Handling</a>
-</div>
-
-<div class="doc_text">
-
-<p>Exception handling for most programming languages is designed to recover from
-   conditions that rarely occur during general use of an application.  To that
-   end, exception handling should not interfere with the main flow of an
-   application's algorithm by performing checkpointing tasks, such as saving the
-   current pc or register state.</p>
-
-<p>The Itanium ABI Exception Handling Specification defines a methodology for
-   providing outlying data in the form of exception tables without inlining
-   speculative exception handling code in the flow of an application's main
-   algorithm.  Thus, the specification is said to add "zero-cost" to the normal
-   execution of an application.</p>
-
-<p>A more complete description of the Itanium ABI exception handling runtime
-   support of can be found at
-   <a href="http://www.codesourcery.com/cxx-abi/abi-eh.html">Itanium C++ ABI:
-   Exception Handling</a>. A description of the exception frame format can be
-   found at
-   <a href="http://refspecs.freestandards.org/LSB_3.0.0/LSB-Core-generic/LSB-Core-generic/ehframechpt.html">Exception
-   Frames</a>, with details of the DWARF 3 specification at
-   <a href="http://www.eagercon.com/dwarf/dwarf3std.htm">DWARF 3 Standard</a>.
-   A description for the C++ exception table formats can be found at
-   <a href="http://www.codesourcery.com/cxx-abi/exceptions.pdf">Exception Handling
-   Tables</a>.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="sjlj">Setjmp/Longjmp Exception Handling</a>
-</div>
-
-<div class="doc_text">
-
-<p>Setjmp/Longjmp (SJLJ) based exception handling uses LLVM intrinsics
-   <a href="#llvm_eh_sjlj_setjmp"><tt>llvm.eh.sjlj.setjmp</tt></a> and
-   <a href="#llvm_eh_sjlj_longjmp"><tt>llvm.eh.sjlj.longjmp</tt></a> to
-   handle control flow for exception handling.</p>
-
-<p>For each function which does exception processing, be it try/catch blocks
-   or cleanups, that function registers itself on a global frame list. When
-   exceptions are being unwound, the runtime uses this list to identify which
-   functions need processing.<p>
-
-<p>Landing pad selection is encoded in the call site entry of the function
-   context. The runtime returns to the function via
-   <a href="#llvm_eh_sjlj_longjmp"><tt>llvm.eh.sjlj.longjmp</tt></a>, where
-   a switch table transfers control to the appropriate landing pad based on
-   the index stored in the function context.</p>
-
-<p>In contrast to DWARF exception handling, which encodes exception regions
-   and frame information in out-of-line tables, SJLJ exception handling
-   builds and removes the unwind frame context at runtime. This results in
-   faster exception handling at the expense of slower execution when no
-   exceptions are thrown. As exceptions are, by their nature, intended for
-   uncommon code paths, DWARF exception handling is generally preferred to
-   SJLJ.</p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="overview">Overview</a>
-</div>
-
-<div class="doc_text">
-
-<p>When an exception is thrown in LLVM code, the runtime does its best to find a
-   handler suited to processing the circumstance.</p>
-
-<p>The runtime first attempts to find an <i>exception frame</i> corresponding to
-   the function where the exception was thrown.  If the programming language
-   (e.g. C++) supports exception handling, the exception frame contains a
-   reference to an exception table describing how to process the exception.  If
-   the language (e.g. C) does not support exception handling, or if the
-   exception needs to be forwarded to a prior activation, the exception frame
-   contains information about how to unwind the current activation and restore
-   the state of the prior activation.  This process is repeated until the
-   exception is handled.  If the exception is not handled and no activations
-   remain, then the application is terminated with an appropriate error
-   message.</p>
-
-<p>Because different programming languages have different behaviors when
-   handling exceptions, the exception handling ABI provides a mechanism for
-   supplying <i>personalities.</i> An exception handling personality is defined
-   by way of a <i>personality function</i> (e.g. <tt>__gxx_personality_v0</tt>
-   in C++), which receives the context of the exception, an <i>exception
-   structure</i> containing the exception object type and value, and a reference
-   to the exception table for the current function.  The personality function
-   for the current compile unit is specified in a <i>common exception
-   frame</i>.</p>
-
-<p>The organization of an exception table is language dependent.  For C++, an
-   exception table is organized as a series of code ranges defining what to do
-   if an exception occurs in that range.  Typically, the information associated
-   with a range defines which types of exception objects (using C++ <i>type
-   info</i>) that are handled in that range, and an associated action that
-   should take place.  Actions typically pass control to a <i>landing
-   pad</i>.</p>
-
-<p>A landing pad corresponds to the code found in the <i>catch</i> portion of
-   a <i>try</i>/<i>catch</i> sequence.  When execution resumes at a landing
-   pad, it receives the exception structure and a selector corresponding to
-   the <i>type</i> of exception thrown.  The selector is then used to determine
-   which <i>catch</i> should actually process the exception.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_section">
-  <a name="codegen">LLVM Code Generation</a>
-</div>
-
-<div class="doc_text">
-
-<p>At the time of this writing, only C++ exception handling support is available
-   in LLVM.  So the remainder of this document will be somewhat C++-centric.</p>
-
-<p>From the C++ developers perspective, exceptions are defined in terms of the
-   <tt>throw</tt> and <tt>try</tt>/<tt>catch</tt> statements.  In this section
-   we will describe the implementation of LLVM exception handling in terms of
-   C++ examples.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="throw">Throw</a>
-</div>
-
-<div class="doc_text">
-
-<p>Languages that support exception handling typically provide a <tt>throw</tt>
-   operation to initiate the exception process.  Internally, a throw operation
-   breaks down into two steps.  First, a request is made to allocate exception
-   space for an exception structure.  This structure needs to survive beyond the
-   current activation.  This structure will contain the type and value of the
-   object being thrown.  Second, a call is made to the runtime to raise the
-   exception, passing the exception structure as an argument.</p>
-
-<p>In C++, the allocation of the exception structure is done by
-   the <tt>__cxa_allocate_exception</tt> runtime function.  The exception
-   raising is handled by <tt>__cxa_throw</tt>.  The type of the exception is
-   represented using a C++ RTTI structure.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="try_catch">Try/Catch</a>
-</div>
-
-<div class="doc_text">
-
-<p>A call within the scope of a <i>try</i> statement can potentially raise an
-   exception.  In those circumstances, the LLVM C++ front-end replaces the call
-   with an <tt>invoke</tt> instruction.  Unlike a call, the <tt>invoke</tt> has
-   two potential continuation points: where to continue when the call succeeds
-   as per normal; and where to continue if the call raises an exception, either
-   by a throw or the unwinding of a throw.</p>
-
-<p>The term used to define a the place where an <tt>invoke</tt> continues after
-   an exception is called a <i>landing pad</i>.  LLVM landing pads are
-   conceptually alternative function entry points where an exception structure
-   reference and a type info index are passed in as arguments.  The landing pad
-   saves the exception structure reference and then proceeds to select the catch
-   block that corresponds to the type info of the exception object.</p>
-
-<p>Two LLVM intrinsic functions are used to convey information about the landing
-   pad to the back end.</p>
-
-<ol>
-  <li><a href="#llvm_eh_exception"><tt>llvm.eh.exception</tt></a> takes no
-      arguments and returns a pointer to the exception structure.  This only
-      returns a sensible value if called after an <tt>invoke</tt> has branched
-      to a landing pad.  Due to code generation limitations, it must currently
-      be called in the landing pad itself.</li>
-
-  <li><a href="#llvm_eh_selector"><tt>llvm.eh.selector</tt></a> takes a minimum
-      of three arguments.  The first argument is the reference to the exception
-      structure. The second argument is a reference to the personality function
-      to be used for this <tt>try</tt>/<tt>catch</tt> sequence. Each of the
-      remaining arguments is either a reference to the type info for
-      a <tt>catch</tt> statement, a <a href="#throw_filters">filter</a>
-      expression, or the number zero (<tt>0</tt>) representing
-      a <a href="#cleanups">cleanup</a>.  The exception is tested against the
-      arguments sequentially from first to last.  The result of
-      the <a href="#llvm_eh_selector"><tt>llvm.eh.selector</tt></a> is a
-      positive number if the exception matched a type info, a negative number if
-      it matched a filter, and zero if it matched a cleanup.  If nothing is
-      matched, the behaviour of the program
-      is <a href="#restrictions">undefined</a>.  This only returns a sensible
-      value if called after an <tt>invoke</tt> has branched to a landing pad.
-      Due to codegen limitations, it must currently be called in the landing pad
-      itself.  If a type info matched, then the selector value is the index of
-      the type info in the exception table, which can be obtained using the
-      <a href="#llvm_eh_typeid_for"><tt>llvm.eh.typeid.for</tt></a>
-      intrinsic.</li>
-</ol>
-
-<p>Once the landing pad has the type info selector, the code branches to the
-   code for the first catch.  The catch then checks the value of the type info
-   selector against the index of type info for that catch.  Since the type info
-   index is not known until all the type info have been gathered in the backend,
-   the catch code will call the
-   <a href="#llvm_eh_typeid_for"><tt>llvm.eh.typeid.for</tt></a> intrinsic
-   to determine the index for a given type info.  If the catch fails to match
-   the selector then control is passed on to the next catch. Note: Since the
-   landing pad will not be used if there is no match in the list of type info on
-   the call to <a href="#llvm_eh_selector"><tt>llvm.eh.selector</tt></a>, then
-   neither the last catch nor <i>catch all</i> need to perform the check
-   against the selector.</p>
-
-<p>Finally, the entry and exit of catch code is bracketed with calls
-   to <tt>__cxa_begin_catch</tt> and <tt>__cxa_end_catch</tt>.</p>
-
-<ul>
-  <li><tt>__cxa_begin_catch</tt> takes a exception structure reference as an
-      argument and returns the value of the exception object.</li>
-
-  <li><tt>__cxa_end_catch</tt> takes no arguments. This function:<br><br>
-    <ol>
-      <li>Locates the most recently caught exception and decrements its handler
-          count,</li>
-      <li>Removes the exception from the "caught" stack if the handler count
-          goes to zero, and</li>
-      <li>Destroys the exception if the handler count goes to zero, and the
-          exception was not re-thrown by throw.</li>
-    </ol>
-    <p>Note: a rethrow from within the catch may replace this call with
-       a <tt>__cxa_rethrow</tt>.</p></li>
-</ul>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="cleanups">Cleanups</a>
-</div>
-
-<div class="doc_text">
-
-<p>To handle destructors and cleanups in <tt>try</tt> code, control may not run
-   directly from a landing pad to the first catch.  Control may actually flow
-   from the landing pad to clean up code and then to the first catch.  Since the
-   required clean up for each <tt>invoke</tt> in a <tt>try</tt> may be different
-   (e.g. intervening constructor), there may be several landing pads for a given
-   try.  If cleanups need to be run, an <tt>i32 0</tt> should be passed as the
-   last <a href="#llvm_eh_selector"><tt>llvm.eh.selector</tt></a> argument.
-   However, when using DWARF exception handling with C++, a <tt>i8* null</tt>
-   <a href="#restrictions">must</a> be passed instead.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="throw_filters">Throw Filters</a>
-</div>
-
-<div class="doc_text">
-
-<p>C++ allows the specification of which exception types can be thrown from a
-   function.  To represent this a top level landing pad may exist to filter out
-   invalid types.  To express this in LLVM code the landing pad will
-   call <a href="#llvm_eh_selector"><tt>llvm.eh.selector</tt></a>.  The
-   arguments are a reference to the exception structure, a reference to the
-   personality function, the length of the filter expression (the number of type
-   infos plus one), followed by the type infos themselves.
-   <a href="#llvm_eh_selector"><tt>llvm.eh.selector</tt></a> will return a
-   negative value if the exception does not match any of the type infos.  If no
-   match is found then a call to <tt>__cxa_call_unexpected</tt> should be made,
-   otherwise <tt>_Unwind_Resume</tt>.  Each of these functions requires a
-   reference to the exception structure.  Note that the most general form of an
-   <a href="#llvm_eh_selector"><tt>llvm.eh.selector</tt></a> call can contain
-   any number of type infos, filter expressions and cleanups (though having more
-   than one cleanup is pointless).  The LLVM C++ front-end can generate such
-   <a href="#llvm_eh_selector"><tt>llvm.eh.selector</tt></a> calls due to
-   inlining creating nested exception handling scopes.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="restrictions">Restrictions</a>
-</div>
-
-<div class="doc_text">
-
-<p>The semantics of the invoke instruction require that any exception that
-   unwinds through an invoke call should result in a branch to the invoke's
-   unwind label.  However such a branch will only happen if the
-   <a href="#llvm_eh_selector"><tt>llvm.eh.selector</tt></a> matches. Thus in
-   order to ensure correct operation, the front-end must only generate
-   <a href="#llvm_eh_selector"><tt>llvm.eh.selector</tt></a> calls that are
-   guaranteed to always match whatever exception unwinds through the invoke.
-   For most languages it is enough to pass zero, indicating the presence of
-   a <a href="#cleanups">cleanup</a>, as the
-   last <a href="#llvm_eh_selector"><tt>llvm.eh.selector</tt></a> argument.
-   However for C++ this is not sufficient, because the C++ personality function
-   will terminate the program if it detects that unwinding the exception only
-   results in matches with cleanups.  For C++ a <tt>null i8*</tt> should be
-   passed as the last <a href="#llvm_eh_selector"><tt>llvm.eh.selector</tt></a>
-   argument instead.  This is interpreted as a catch-all by the C++ personality
-   function, and will always match.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_section">
-  <a name="format_common_intrinsics">Exception Handling Intrinsics</a>
-</div>
-
-<div class="doc_text">
-
-<p>LLVM uses several intrinsic functions (name prefixed with "llvm.eh") to
-   provide exception handling information at various points in generated
-   code.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection">
-  <a name="llvm_eh_exception">llvm.eh.exception</a>
-</div>
-
-<div class="doc_text">
-
-<pre>
-  i8* %<a href="#llvm_eh_exception">llvm.eh.exception</a>( )
-</pre>
-
-<p>This intrinsic returns a pointer to the exception structure.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection">
-  <a name="llvm_eh_selector">llvm.eh.selector</a>
-</div>
-
-<div class="doc_text">
-
-<pre>
-  i32 %<a href="#llvm_eh_selector">llvm.eh.selector</a>(i8*, i8*, i8*, ...)
-</pre>
-
-<p>This intrinsic is used to compare the exception with the given type infos,
-   filters and cleanups.</p>
-
-<p><a href="#llvm_eh_selector"><tt>llvm.eh.selector</tt></a> takes a minimum of
-   three arguments.  The first argument is the reference to the exception
-   structure. The second argument is a reference to the personality function to
-   be used for this try catch sequence. Each of the remaining arguments is
-   either a reference to the type info for a catch statement,
-   a <a href="#throw_filters">filter</a> expression, or the number zero
-   representing a <a href="#cleanups">cleanup</a>.  The exception is tested
-   against the arguments sequentially from first to last.  The result of
-   the <a href="#llvm_eh_selector"><tt>llvm.eh.selector</tt></a> is a positive
-   number if the exception matched a type info, a negative number if it matched
-   a filter, and zero if it matched a cleanup.  If nothing is matched, the
-   behaviour of the program is <a href="#restrictions">undefined</a>.  If a type
-   info matched then the selector value is the index of the type info in the
-   exception table, which can be obtained using the
-   <a href="#llvm_eh_typeid_for"><tt>llvm.eh.typeid.for</tt></a> intrinsic.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection">
-  <a name="llvm_eh_typeid_for">llvm.eh.typeid.for</a>
-</div>
-
-<div class="doc_text">
-
-<pre>
-  i32 %<a href="#llvm_eh_typeid_for">llvm.eh.typeid.for</a>(i8*)
-</pre>
-
-<p>This intrinsic returns the type info index in the exception table of the
-   current function.  This value can be used to compare against the result
-   of <a href="#llvm_eh_selector"><tt>llvm.eh.selector</tt></a>.  The single
-   argument is a reference to a type info.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection">
-  <a name="llvm_eh_sjlj_setjmp">llvm.eh.sjlj.setjmp</a>
-</div>
-
-<div class="doc_text">
-
-<pre>
-  i32 %<a href="#llvm_eh_sjlj_setjmp">llvm.eh.sjlj.setjmp</a>(i8*)
-</pre>
-
-<p>The SJLJ exception handling uses this intrinsic to force register saving for
-   the current function and to store the address of the following instruction
-   for use as a destination address by <a href="#llvm_eh_sjlj_longjmp">
-   <tt>llvm.eh.sjlj.longjmp</tt></a>. The buffer format and the overall
-   functioning of this intrinsic is compatible with the GCC
-   <tt>__builtin_setjmp</tt> implementation, allowing code built with the
-   two compilers to interoperate.</p>
-
-<p>The single parameter is a pointer to a five word buffer in which the calling
-   context is saved. The front end places the frame pointer in the first word,
-   and the target implementation of this intrinsic should place the destination
-   address for a
-   <a href="#llvm_eh_sjlj_longjmp"><tt>llvm.eh.sjlj.longjmp</tt></a> in the
-   second word. The following three words are available for use in a
-   target-specific manner.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection">
-  <a name="llvm_eh_sjlj_lsda">llvm.eh.sjlj.lsda</a>
-</div>
-
-<div class="doc_text">
-
-<pre>
-  i8* %<a href="#llvm_eh_sjlj_lsda">llvm.eh.sjlj.lsda</a>( )
-</pre>
-
-<p>Used for SJLJ based exception handling, the <a href="#llvm_eh_sjlj_lsda">
-   <tt>llvm.eh.sjlj.lsda</tt></a> intrinsic returns the address of the Language
-   Specific Data Area (LSDA) for the current function. The SJLJ front-end code
-   stores this address in the exception handling function context for use by the
-   runtime.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection">
-  <a name="llvm_eh_sjlj_callsite">llvm.eh.sjlj.callsite</a>
-</div>
-
-<div class="doc_text">
-
-<pre>
-  void %<a href="#llvm_eh_sjlj_callsite">llvm.eh.sjlj.callsite</a>(i32)
-</pre>
-
-<p>For SJLJ based exception handling, the <a href="#llvm_eh_sjlj_callsite">
-  <tt>llvm.eh.sjlj.callsite</tt></a> intrinsic identifies the callsite value
-  associated with the following invoke instruction. This is used to ensure
-  that landing pad entries in the LSDA are generated in the matching order.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_section">
-  <a name="asm">Asm Table Formats</a>
-</div>
-
-<div class="doc_text">
-
-<p>There are two tables that are used by the exception handling runtime to
-   determine which actions should take place when an exception is thrown.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="unwind_tables">Exception Handling Frame</a>
-</div>
-
-<div class="doc_text">
-
-<p>An exception handling frame <tt>eh_frame</tt> is very similar to the unwind
-   frame used by dwarf debug info.  The frame contains all the information
-   necessary to tear down the current frame and restore the state of the prior
-   frame.  There is an exception handling frame for each function in a compile
-   unit, plus a common exception handling frame that defines information common
-   to all functions in the unit.</p>
-
-<p>Todo - Table details here.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="exception_tables">Exception Tables</a>
-</div>
-
-<div class="doc_text">
-
-<p>An exception table contains information about what actions to take when an
-   exception is thrown in a particular part of a function's code.  There is one
-   exception table per function except leaf routines and functions that have
-   only calls to non-throwing functions will not need an exception table.</p>
-
-<p>Todo - Table details here.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_section">
-  <a name="todo">ToDo</a>
-</div>
-
-<div class="doc_text">
-
-<ol>
-
-  <li>Testing/Testing/Testing.</li>
-
-</ol>
-
-</div>
-
-<!-- *********************************************************************** -->
-
-<hr>
-<address>
-  <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
-  src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS"></a>
-  <a href="http://validator.w3.org/check/referer"><img
-  src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
-
-  <a href="mailto:sabre at nondot.org">Chris Lattner</a><br>
-  <a href="http://llvm.org">LLVM Compiler Infrastructure</a><br>
-  Last modified: $Date$
-</address>
-
-</body>
-</html>
diff --git a/libclamav/c++/llvm/docs/ExtendedIntegerResults.txt b/libclamav/c++/llvm/docs/ExtendedIntegerResults.txt
deleted file mode 100644
index 44e9fbf..0000000
--- a/libclamav/c++/llvm/docs/ExtendedIntegerResults.txt
+++ /dev/null
@@ -1,133 +0,0 @@
-//===----------------------------------------------------------------------===//
-// Representing sign/zero extension of function results
-//===----------------------------------------------------------------------===//
-
-Mar 25, 2009  - Initial Revision
-
-Most ABIs specify that functions which return small integers do so in a
-specific integer GPR.  This is an efficient way to go, but raises the question:
-if the returned value is smaller than the register, what do the high bits hold?
-
-There are three (interesting) possible answers: undefined, zero extended, or
-sign extended.  The number of bits in question depends on the data-type that
-the front-end is referencing (typically i1/i8/i16/i32).
-
-Knowing the answer to this is important for two reasons: 1) we want to be able
-to implement the ABI correctly.  If we need to sign extend the result according
-to the ABI, we really really do need to do this to preserve correctness.  2)
-this information is often useful for optimization purposes, and we want the
-mid-level optimizers to be able to process this (e.g. eliminate redundant
-extensions).
-
-For example, lets pretend that X86 requires the caller to properly extend the
-result of a return (I'm not sure this is the case, but the argument doesn't
-depend on this).  Given this, we should compile this:
-
-int a();
-short b() { return a(); }
-
-into:
-
-_b:
-	subl	$12, %esp
-	call	L_a$stub
-	addl	$12, %esp
-	cwtl
-	ret
-
-An optimization example is that we should be able to eliminate the explicit
-sign extension in this example:
-
-short y();
-int z() {
-  return ((int)y() << 16) >> 16;
-}
-
-_z:
-	subl	$12, %esp
-	call	_y
-	;;  movswl %ax, %eax   -> not needed because eax is already sext'd
-	addl	$12, %esp
-	ret
-
-//===----------------------------------------------------------------------===//
-// What we have right now.
-//===----------------------------------------------------------------------===//
-
-Currently, these sorts of things are modelled by compiling a function to return
-the small type and a signext/zeroext marker is used.  For example, we compile
-Z into:
-
-define i32 @z() nounwind {
-entry:
-	%0 = tail call signext i16 (...)* @y() nounwind
-	%1 = sext i16 %0 to i32
-	ret i32 %1
-}
-
-and b into:
-
-define signext i16 @b() nounwind {
-entry:
-	%0 = tail call i32 (...)* @a() nounwind		; <i32> [#uses=1]
-	%retval12 = trunc i32 %0 to i16		; <i16> [#uses=1]
-	ret i16 %retval12
-}
-
-This has some problems: 1) the actual precise semantics are really poorly
-defined (see PR3779).  2) some targets might want the caller to extend, some
-might want the callee to extend 3) the mid-level optimizer doesn't know the
-size of the GPR, so it doesn't know that %0 is sign extended up to 32-bits 
-here, and even if it did, it could not eliminate the sext. 4) the code
-generator has historically assumed that the result is extended to i32, which is
-a problem on PIC16 (and is also probably wrong on alpha and other 64-bit
-targets).
-
-//===----------------------------------------------------------------------===//
-// The proposal
-//===----------------------------------------------------------------------===//
-
-I suggest that we have the front-end fully lower out the ABI issues here to
-LLVM IR.  This makes it 100% explicit what is going on and means that there is
-no cause for confusion.  For example, the cases above should compile into:
-
-define i32 @z() nounwind {
-entry:
-        %0 = tail call i32 (...)* @y() nounwind
-	%1 = trunc i32 %0 to i16
-        %2 = sext i16 %1 to i32
-        ret i32 %2
-}
-define i32 @b() nounwind {
-entry:
-	%0 = tail call i32 (...)* @a() nounwind
-	%retval12 = trunc i32 %0 to i16
-	%tmp = sext i16 %retval12 to i32
-	ret i32 %tmp
-}
-
-In this model, no functions will return an i1/i8/i16 (and on a x86-64 target
-that extends results to i64, no i32).  This solves the ambiguity issue, allows us 
-to fully describe all possible ABIs, and now allows the optimizers to reason
-about and eliminate these extensions.
-
-The one thing that is missing is the ability for the front-end and optimizer to
-specify/infer the guarantees provided by the ABI to allow other optimizations.
-For example, in the y/z case, since y is known to return a sign extended value,
-the trunc/sext in z should be eliminable.
-
-This can be done by introducing new sext/zext attributes which mean "I know
-that the result of the function is sign extended at least N bits.  Given this,
-and given that it is stuck on the y function, the mid-level optimizer could
-easily eliminate the extensions etc with existing functionality.
-
-The major disadvantage of doing this sort of thing is that it makes the ABI
-lowering stuff even more explicit in the front-end, and that we would like to
-eventually move to having the code generator do more of this work.  However,
-the sad truth of the matter is that this is a) unlikely to happen anytime in
-the near future, and b) this is no worse than we have now with the existing
-attributes.
-
-C compilers fundamentally have to reason about the target in many ways.  
-This is ugly and horrible, but a fact of life.
-
diff --git a/libclamav/c++/llvm/docs/ExtendingLLVM.html b/libclamav/c++/llvm/docs/ExtendingLLVM.html
deleted file mode 100644
index 647fa01..0000000
--- a/libclamav/c++/llvm/docs/ExtendingLLVM.html
+++ /dev/null
@@ -1,391 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-                      "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-  <title>Extending LLVM: Adding instructions, intrinsics, types, etc.</title>
-  <link rel="stylesheet" href="llvm.css" type="text/css">
-</head>
-
-<body>
-
-<div class="doc_title">
-  Extending LLVM: Adding instructions, intrinsics, types, etc.
-</div>
-
-<ol>
-  <li><a href="#introduction">Introduction and Warning</a></li>
-  <li><a href="#intrinsic">Adding a new intrinsic function</a></li>
-  <li><a href="#instruction">Adding a new instruction</a></li>
-  <li><a href="#sdnode">Adding a new SelectionDAG node</a></li>
-  <li><a href="#type">Adding a new type</a>
-  <ol>
-    <li><a href="#fund_type">Adding a new fundamental type</a></li>
-    <li><a href="#derived_type">Adding a new derived type</a></li>
-  </ol></li>
-</ol>
-
-<div class="doc_author">    
-  <p>Written by <a href="http://misha.brukman.net">Misha Brukman</a>,
-  Brad Jones, Nate Begeman,
-  and <a href="http://nondot.org/sabre">Chris Lattner</a></p>
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="introduction">Introduction and Warning</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>During the course of using LLVM, you may wish to customize it for your
-research project or for experimentation. At this point, you may realize that
-you need to add something to LLVM, whether it be a new fundamental type, a new
-intrinsic function, or a whole new instruction.</p>
-
-<p>When you come to this realization, stop and think. Do you really need to
-extend LLVM? Is it a new fundamental capability that LLVM does not support at
-its current incarnation or can it be synthesized from already pre-existing LLVM
-elements? If you are not sure, ask on the <a
-href="http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev">LLVM-dev</a> list. The
-reason is that extending LLVM will get involved as you need to update all the
-different passes that you intend to use with your extension, and there are
-<em>many</em> LLVM analyses and transformations, so it may be quite a bit of
-work.</p>
-
-<p>Adding an <a href="#intrinsic">intrinsic function</a> is far easier than
-adding an instruction, and is transparent to optimization passes.  If your added
-functionality can be expressed as a
-function call, an intrinsic function is the method of choice for LLVM
-extension.</p>
-
-<p>Before you invest a significant amount of effort into a non-trivial
-extension, <span class="doc_warning">ask on the list</span> if what you are
-looking to do can be done with already-existing infrastructure, or if maybe
-someone else is already working on it. You will save yourself a lot of time and
-effort by doing so.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="intrinsic">Adding a new intrinsic function</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>Adding a new intrinsic function to LLVM is much easier than adding a new
-instruction.  Almost all extensions to LLVM should start as an intrinsic
-function and then be turned into an instruction if warranted.</p>
-
-<ol>
-<li><tt>llvm/docs/LangRef.html</tt>:
-    Document the intrinsic.  Decide whether it is code generator specific and
-    what the restrictions are.  Talk to other people about it so that you are
-    sure it's a good idea.</li>
-
-<li><tt>llvm/include/llvm/Intrinsics*.td</tt>:
-    Add an entry for your intrinsic.  Describe its memory access characteristics
-    for optimization (this controls whether it will be DCE'd, CSE'd, etc). Note
-    that any intrinsic using the <tt>llvm_int_ty</tt> type for an argument will
-    be deemed by <tt>tblgen</tt> as overloaded and the corresponding suffix 
-    will be required on the intrinsic's name.</li>
-
-<li><tt>llvm/lib/Analysis/ConstantFolding.cpp</tt>: If it is possible to 
-    constant fold your intrinsic, add support to it in the 
-    <tt>canConstantFoldCallTo</tt> and <tt>ConstantFoldCall</tt> functions.</li>
-
-<li><tt>llvm/test/Regression/*</tt>: Add test cases for your test cases to the 
-    test suite</li>
-</ol>
-
-<p>Once the intrinsic has been added to the system, you must add code generator
-support for it.  Generally you must do the following steps:</p>
-
-<dl>
-<dt>Add support to the C backend in <tt>lib/Target/CBackend/</tt></dt>
-
-<dd>Depending on the intrinsic, there are a few ways to implement this.  For
-    most intrinsics, it makes sense to add code to lower your intrinsic in
-    <tt>LowerIntrinsicCall</tt> in <tt>lib/CodeGen/IntrinsicLowering.cpp</tt>.
-    Second, if it makes sense to lower the intrinsic to an expanded sequence of
-    C code in all cases, just emit the expansion in <tt>visitCallInst</tt> in
-    <tt>Writer.cpp</tt>.  If the intrinsic has some way to express it with GCC
-    (or any other compiler) extensions, it can be conditionally supported based
-    on the compiler compiling the CBE output (see <tt>llvm.prefetch</tt> for an
-    example).  Third, if the intrinsic really has no way to be lowered, just
-    have the code generator emit code that prints an error message and calls
-    abort if executed.</dd>
-
-<dt>Add support to the .td file for the target(s) of your choice in 
-   <tt>lib/Target/*/*.td</tt>.</dt>
-
-<dd>This is usually a matter of adding a pattern to the .td file that matches
-    the intrinsic, though it may obviously require adding the instructions you
-    want to generate as well.  There are lots of examples in the PowerPC and X86
-    backend to follow.</dd>
-</dl>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="sdnode">Adding a new SelectionDAG node</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>As with intrinsics, adding a new SelectionDAG node to LLVM is much easier
-than adding a new instruction.  New nodes are often added to help represent
-instructions common to many targets.  These nodes often map to an LLVM
-instruction (add, sub) or intrinsic (byteswap, population count).  In other
-cases, new nodes have been added to allow many targets to perform a common task
-(converting between floating point and integer representation) or capture more
-complicated behavior in a single node (rotate).</p>
-
-<ol>
-<li><tt>include/llvm/CodeGen/SelectionDAGNodes.h</tt>:
-    Add an enum value for the new SelectionDAG node.</li>
-<li><tt>lib/CodeGen/SelectionDAG/SelectionDAG.cpp</tt>:
-    Add code to print the node to <tt>getOperationName</tt>.  If your new node
-    can be evaluated at compile time when given constant arguments (such as an
-    add of a constant with another constant), find the <tt>getNode</tt> method
-    that takes the appropriate number of arguments, and add a case for your node
-    to the switch statement that performs constant folding for nodes that take
-    the same number of arguments as your new node.</li>
-<li><tt>lib/CodeGen/SelectionDAG/LegalizeDAG.cpp</tt>:
-    Add code to <a href="CodeGenerator.html#selectiondag_legalize">legalize, 
-    promote, and expand</a> the node as necessary.  At a minimum, you will need
-    to add a case statement for your node in <tt>LegalizeOp</tt> which calls
-    LegalizeOp on the node's operands, and returns a new node if any of the
-    operands changed as a result of being legalized.  It is likely that not all
-    targets supported by the SelectionDAG framework will natively support the
-    new node.  In this case, you must also add code in your node's case
-    statement in <tt>LegalizeOp</tt> to Expand your node into simpler, legal
-    operations.  The case for <tt>ISD::UREM</tt> for expanding a remainder into
-    a divide, multiply, and a subtract is a good example.</li>
-<li><tt>lib/CodeGen/SelectionDAG/LegalizeDAG.cpp</tt>:
-    If targets may support the new node being added only at certain sizes, you 
-    will also need to add code to your node's case statement in 
-    <tt>LegalizeOp</tt> to Promote your node's operands to a larger size, and 
-    perform the correct operation.  You will also need to add code to 
-    <tt>PromoteOp</tt> to do this as well.  For a good example, see 
-    <tt>ISD::BSWAP</tt>,
-    which promotes its operand to a wider size, performs the byteswap, and then
-    shifts the correct bytes right to emulate the narrower byteswap in the
-    wider type.</li>
-<li><tt>lib/CodeGen/SelectionDAG/LegalizeDAG.cpp</tt>:
-    Add a case for your node in <tt>ExpandOp</tt> to teach the legalizer how to
-    perform the action represented by the new node on a value that has been
-    split into high and low halves.  This case will be used to support your 
-    node with a 64 bit operand on a 32 bit target.</li>
-<li><tt>lib/CodeGen/SelectionDAG/DAGCombiner.cpp</tt>:
-    If your node can be combined with itself, or other existing nodes in a 
-    peephole-like fashion, add a visit function for it, and call that function
-    from <tt></tt>.  There are several good examples for simple combines you
-    can do; <tt>visitFABS</tt> and <tt>visitSRL</tt> are good starting places.
-    </li>
-<li><tt>lib/Target/PowerPC/PPCISelLowering.cpp</tt>:
-    Each target has an implementation of the <tt>TargetLowering</tt> class,
-    usually in its own file (although some targets include it in the same
-    file as the DAGToDAGISel).  The default behavior for a target is to
-    assume that your new node is legal for all types that are legal for
-    that target.  If this target does not natively support your node, then
-    tell the target to either Promote it (if it is supported at a larger
-    type) or Expand it.  This will cause the code you wrote in 
-    <tt>LegalizeOp</tt> above to decompose your new node into other legal
-    nodes for this target.</li>
-<li><tt>lib/Target/TargetSelectionDAG.td</tt>:
-    Most current targets supported by LLVM generate code using the DAGToDAG
-    method, where SelectionDAG nodes are pattern matched to target-specific
-    nodes, which represent individual instructions.  In order for the targets
-    to match an instruction to your new node, you must add a def for that node
-    to the list in this file, with the appropriate type constraints. Look at
-    <tt>add</tt>, <tt>bswap</tt>, and <tt>fadd</tt> for examples.</li>
-<li><tt>lib/Target/PowerPC/PPCInstrInfo.td</tt>:
-    Each target has a tablegen file that describes the target's instruction
-    set.  For targets that use the DAGToDAG instruction selection framework,
-    add a pattern for your new node that uses one or more target nodes.
-    Documentation for this is a bit sparse right now, but there are several
-    decent examples.  See the patterns for <tt>rotl</tt> in 
-    <tt>PPCInstrInfo.td</tt>.</li>
-<li>TODO: document complex patterns.</li>
-<li><tt>llvm/test/Regression/CodeGen/*</tt>: Add test cases for your new node
-    to the test suite.  <tt>llvm/test/Regression/CodeGen/X86/bswap.ll</tt> is
-    a good example.</li>
-</ol>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="instruction">Adding a new instruction</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p><span class="doc_warning">WARNING: adding instructions changes the bitcode
-format, and it will take some effort to maintain compatibility with
-the previous version.</span> Only add an instruction if it is absolutely
-necessary.</p>
-
-<ol>
-
-<li><tt>llvm/include/llvm/Instruction.def</tt>:
-    add a number for your instruction and an enum name</li>
-
-<li><tt>llvm/include/llvm/Instructions.h</tt>:
-    add a definition for the class that will represent your instruction</li>
-
-<li><tt>llvm/include/llvm/Support/InstVisitor.h</tt>:
-    add a prototype for a visitor to your new instruction type</li>
-
-<li><tt>llvm/lib/AsmParser/Lexer.l</tt>:
-    add a new token to parse your instruction from assembly text file</li>
-
-<li><tt>llvm/lib/AsmParser/llvmAsmParser.y</tt>:
-    add the grammar on how your instruction can be read and what it will
-    construct as a result</li>
-
-<li><tt>llvm/lib/Bitcode/Reader/Reader.cpp</tt>:
-    add a case for your instruction and how it will be parsed from bitcode</li>
-
-<li><tt>llvm/lib/VMCore/Instruction.cpp</tt>:
-    add a case for how your instruction will be printed out to assembly</li>
-
-<li><tt>llvm/lib/VMCore/Instructions.cpp</tt>:
-    implement the class you defined in
-    <tt>llvm/include/llvm/Instructions.h</tt></li>
-
-<li>Test your instruction</li>
-
-<li><tt>llvm/lib/Target/*</tt>: 
-    Add support for your instruction to code generators, or add a lowering
-    pass.</li>
-
-<li><tt>llvm/test/Regression/*</tt>: add your test cases to the test suite.</li>
-
-</ol>
-
-<p>Also, you need to implement (or modify) any analyses or passes that you want
-to understand this new instruction.</p>
-
-</div>
-
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="type">Adding a new type</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p><span class="doc_warning">WARNING: adding new types changes the bitcode
-format, and will break compatibility with currently-existing LLVM
-installations.</span> Only add new types if it is absolutely necessary.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="fund_type">Adding a fundamental type</a>
-</div>
-
-<div class="doc_text">
-
-<ol>
-
-<li><tt>llvm/include/llvm/Type.h</tt>:
-    add enum for the new type; add static <tt>Type*</tt> for this type</li>
-
-<li><tt>llvm/lib/VMCore/Type.cpp</tt>:
-    add mapping from <tt>TypeID</tt> =&gt; <tt>Type*</tt>;
-    initialize the static <tt>Type*</tt></li>
-
-<li><tt>llvm/lib/AsmReader/Lexer.l</tt>:
-    add ability to parse in the type from text assembly</li>
-
-<li><tt>llvm/lib/AsmReader/llvmAsmParser.y</tt>:
-    add a token for that type</li>
-
-</ol>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="derived_type">Adding a derived type</a>
-</div>
-
-<div class="doc_text">
-
-<ol>
-<li><tt>llvm/include/llvm/Type.h</tt>:
-    add enum for the new type; add a forward declaration of the type
-    also</li>
-
-<li><tt>llvm/include/llvm/DerivedTypes.h</tt>:
-    add new class to represent new class in the hierarchy; add forward 
-    declaration to the TypeMap value type</li>
-
-<li><tt>llvm/lib/VMCore/Type.cpp</tt>:
-    add support for derived type to: 
-<div class="doc_code">
-<pre>
-std::string getTypeDescription(const Type &amp;Ty,
-  std::vector&lt;const Type*&gt; &amp;TypeStack)
-bool TypesEqual(const Type *Ty, const Type *Ty2,
-  std::map&lt;const Type*, const Type*&gt; &amp; EqTypes)
-</pre>
-</div>
-    add necessary member functions for type, and factory methods</li>
-
-<li><tt>llvm/lib/AsmReader/Lexer.l</tt>:
-    add ability to parse in the type from text assembly</li>
-
-<li><tt>llvm/lib/BitCode/Writer/Writer.cpp</tt>:
-    modify <tt>void BitcodeWriter::outputType(const Type *T)</tt> to serialize
-    your type</li>
-
-<li><tt>llvm/lib/BitCode/Reader/Reader.cpp</tt>:
-    modify <tt>const Type *BitcodeReader::ParseType()</tt> to read your data
-    type</li> 
-
-<li><tt>llvm/lib/VMCore/AsmWriter.cpp</tt>:
-    modify
-<div class="doc_code">
-<pre>
-void calcTypeName(const Type *Ty,
-                  std::vector&lt;const Type*&gt; &amp;TypeStack,
-                  std::map&lt;const Type*,std::string&gt; &amp;TypeNames,
-                  std::string &amp; Result)
-</pre>
-</div>
-    to output the new derived type
-</li>  
- 
-
-</ol>
-
-</div>
-
-<!-- *********************************************************************** -->
-
-<hr>
-<address>
-  <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
-  src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS"></a>
-  <a href="http://validator.w3.org/check/referer"><img
-  src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
-
-  <a href="http://llvm.org">The LLVM Compiler Infrastructure</a>
-  <br>
-  Last modified: $Date$
-</address>
-
-</body>
-</html>
diff --git a/libclamav/c++/llvm/docs/FAQ.html b/libclamav/c++/llvm/docs/FAQ.html
deleted file mode 100644
index d62ffd7..0000000
--- a/libclamav/c++/llvm/docs/FAQ.html
+++ /dev/null
@@ -1,938 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-                      "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-  <title>LLVM: Frequently Asked Questions</title>
-  <style type="text/css">
-    @import url("llvm.css");
-    .question { font-weight: bold }
-    .answer   { margin-left: 2em  }
-  </style>
-</head>
-<body>
-
-<div class="doc_title">
-  LLVM: Frequently Asked Questions
-</div>
-
-<ol>
-  <li><a href="#license">License</a>
-  <ol>
-    <li>Why are the LLVM source code and the front-end distributed under
-        different licenses?</li>
-
-    <li>Does the University of Illinois Open Source License really qualify as an
-       "open source" license?</li>
-
-    <li>Can I modify LLVM source code and redistribute the modified source?</li>
-
-    <li>Can I modify LLVM source code and redistribute binaries or other tools
-        based on it, without redistributing the source?</li>
-  </ol></li>
-
-  <li><a href="#source">Source code</a>
-  <ol>
-    <li>In what language is LLVM written?</li>
-
-    <li>How portable is the LLVM source code?</li>
-  </ol></li>
-
-  <li><a href="#build">Build Problems</a>
-  <ol>
-    <li>When I run configure, it finds the wrong C compiler.</li>
-
-    <li>The <tt>configure</tt> script finds the right C compiler, but it uses
-        the LLVM linker from a previous build.  What do I do?</li>
-
-    <li>When creating a dynamic library, I get a strange GLIBC error.</li>
-
-    <li>I've updated my source tree from Subversion, and now my build is trying
-        to use a file/directory that doesn't exist.</li>
-
-    <li>I've modified a Makefile in my source tree, but my build tree keeps
-        using the old version.  What do I do?</li>
-
-    <li>I've upgraded to a new version of LLVM, and I get strange build
-        errors.</li>
-
-    <li>I've built LLVM and am testing it, but the tests freeze.</li>
-
-    <li>Why do test results differ when I perform different types of
-        builds?</li>
-
-    <li>Compiling LLVM with GCC 3.3.2 fails, what should I do?</li>
-
-    <li>Compiling LLVM with GCC succeeds, but the resulting tools do not work,
-        what can be wrong?</li>
-
-    <li>When I use the test suite, all of the C Backend tests fail.  What is
-        wrong?</li>
-
-    <li>After Subversion update, rebuilding gives the error "No rule to make
-        target".</li>
-
-    <li><a href="#llvmc">The <tt>llvmc</tt> program gives me errors/doesn't
-        work.</a></li>
-
-    <li><a href="#srcdir-objdir">When I compile LLVM-GCC with srcdir == objdir,
-        it fails. Why?</a></li>
-  </ol></li>
-
-  <li><a href="#felangs">Source Languages</a>
-  <ol>
-    <li><a href="#langs">What source languages are supported?</a></li>
-
-    <li><a href="#langirgen">I'd like to write a self-hosting LLVM compiler. How
-        should I interface with the LLVM middle-end optimizers and back-end code
-        generators?</a></li>
-
-    <li><a href="#langhlsupp">What support is there for higher level source
-        language constructs for building a compiler?</a></li>
-
-    <li><a href="GetElementPtr.html">I don't understand the GetElementPtr
-      instruction. Help!</a></li>
-  </ol>
-
-  <li><a href="#cfe">Using the GCC Front End</a>
-  <ol>
-    <li>When I compile software that uses a configure script, the configure
-        script thinks my system has all of the header files and libraries it is
-        testing for.  How do I get configure to work correctly?</li>
-
-    <li>When I compile code using the LLVM GCC front end, it complains that it
-        cannot find libcrtend.a?</li>
-
-    <li>How can I disable all optimizations when compiling code using the LLVM
-        GCC front end?</li>
-
-    <li><a href="#translatecxx">Can I use LLVM to convert C++ code to C
-        code?</a></li>
-
-    <li><a href="#platformindependent">Can I compile C or C++ code to
-        platform-independent LLVM bitcode?</a></li>
-  </ol>
-  </li>
-
-  <li><a href="#cfe_code">Questions about code generated by the GCC front-end</a>
-  <ol>
-     <li><a href="#iosinit">What is this <tt>llvm.global_ctors</tt> and
-          <tt>_GLOBAL__I__tmp_webcompile...</tt> stuff that happens when I
-          #include &lt;iostream&gt;?</a></li>
-
-     <li><a href="#codedce">Where did all of my code go??</a></li>
-
-     <li><a href="#undef">What is this "<tt>undef</tt>" thing that shows up in
-         my code?</a></li>
-         
-      <li><a href="#callconvwrong">Why does instcombine + simplifycfg turn
-   a call to a function with a mismatched calling convention into "unreachable"?
-   Why not make the verifier reject it?</a></li>
-  </ol>
-  </li>
-</ol>
-
-<div class="doc_author">
-  <p>Written by <a href="http://llvm.org">The LLVM Team</a></p>
-</div>
-
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="license">License</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="question">
-<p>Why are the LLVM source code and the front-end distributed under different
-   licenses?</p>
-</div>
-	
-<div class="answer">
-<p>The C/C++ front-ends are based on GCC and must be distributed under the GPL.
-   Our aim is to distribute LLVM source code under a <em>much less
-   restrictive</em> license, in particular one that does not compel users who
-   distribute tools based on modifying the source to redistribute the modified
-   source code as well.</p>
-</div>
-
-<div class="question">
-<p>Does the University of Illinois Open Source License really qualify as an
-   "open source" license?</p>
-</div>
-
-<div class="answer">
-<p>Yes, the license
-   is <a href="http://www.opensource.org/licenses/UoI-NCSA.php">certified</a> by
-   the Open Source Initiative (OSI).</p>
-</div>
-
-<div class="question">
-<p>Can I modify LLVM source code and redistribute the modified source?</p>
-</div>
-
-<div class="answer">
-<p>Yes.  The modified source distribution must retain the copyright notice and
-   follow the three bulletted conditions listed in
-   the <a href="http://llvm.org/svn/llvm-project/llvm/trunk/LICENSE.TXT">LLVM
-   license</a>.</p>
-</div>
-
-<div class="question">
-<p>Can I modify LLVM source code and redistribute binaries or other tools based
-   on it, without redistributing the source?</p>
-</div>
-
-<div class="answer">
-<p>Yes. This is why we distribute LLVM under a less restrictive license than
-   GPL, as explained in the first question above.</p>
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="source">Source Code</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="question">
-<p>In what language is LLVM written?</p>
-</div>
-
-<div class="answer">
-<p>All of the LLVM tools and libraries are written in C++ with extensive use of
-   the STL.</p>
-</div>
-
-<div class="question">
-<p>How portable is the LLVM source code?</p>
-</div>
-
-<div class="answer">
-<p>The LLVM source code should be portable to most modern UNIX-like operating
-systems.  Most of the code is written in standard C++ with operating system
-services abstracted to a support library.  The tools required to build and test
-LLVM have been ported to a plethora of platforms.</p>
-
-<p>Some porting problems may exist in the following areas:</p>
-
-<ul>
-  <li>The GCC front end code is not as portable as the LLVM suite, so it may not
-      compile as well on unsupported platforms.</li>
-
-  <li>The LLVM build system relies heavily on UNIX shell tools, like the Bourne
-      Shell and sed.  Porting to systems without these tools (MacOS 9, Plan 9)
-      will require more effort.</li>
-</ul>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="build">Build Problems</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="question">
-<p>When I run configure, it finds the wrong C compiler.</p>
-</div>
-
-<div class="answer">
-<p>The <tt>configure</tt> script attempts to locate first <tt>gcc</tt> and then
-   <tt>cc</tt>, unless it finds compiler paths set in <tt>CC</tt>
-   and <tt>CXX</tt> for the C and C++ compiler, respectively.</p>
-
-<p>If <tt>configure</tt> finds the wrong compiler, either adjust your
-   <tt>PATH</tt> environment variable or set <tt>CC</tt> and <tt>CXX</tt>
-   explicitly.</p>
-
-</div>
-
-<div class="question">
-<p>The <tt>configure</tt> script finds the right C compiler, but it uses the
-   LLVM linker from a previous build.  What do I do?</p>
-</div>
-
-<div class="answer">
-<p>The <tt>configure</tt> script uses the <tt>PATH</tt> to find executables, so
-   if it's grabbing the wrong linker/assembler/etc, there are two ways to fix
-   it:</p>
-
-<ol>
-  <li><p>Adjust your <tt>PATH</tt> environment variable so that the correct
-      program appears first in the <tt>PATH</tt>.  This may work, but may not be
-      convenient when you want them <i>first</i> in your path for other
-      work.</p></li>
-
-  <li><p>Run <tt>configure</tt> with an alternative <tt>PATH</tt> that is
-      correct. In a Borne compatible shell, the syntax would be:</p>
-
-<pre class="doc_code">
-% PATH=[the path without the bad program] ./configure ...
-</pre>
-
-      <p>This is still somewhat inconvenient, but it allows <tt>configure</tt>
-         to do its work without having to adjust your <tt>PATH</tt>
-         permanently.</p></li>
-</ol>
-</div>
-
-<div class="question">
-<p>When creating a dynamic library, I get a strange GLIBC error.</p>
-</div>
-
-<div class="answer">
-<p>Under some operating systems (i.e. Linux), libtool does not work correctly if
-   GCC was compiled with the --disable-shared option.  To work around this,
-   install your own version of GCC that has shared libraries enabled by
-   default.</p>
-</div>
-
-<div class="question">
-<p>I've updated my source tree from Subversion, and now my build is trying to
-   use a file/directory that doesn't exist.</p>
-</div>
-
-<div class="answer">
-<p>You need to re-run configure in your object directory.  When new Makefiles
-   are added to the source tree, they have to be copied over to the object tree
-   in order to be used by the build.</p>
-</div>
-
-<div class="question">
-<p>I've modified a Makefile in my source tree, but my build tree keeps using the
-   old version.  What do I do?</p>
-</div>
-
-<div class="answer">
-<p>If the Makefile already exists in your object tree, you can just run the
-   following command in the top level directory of your object tree:</p>
-
-<pre class="doc_code">
-% ./config.status &lt;relative path to Makefile&gt;
-</pre>
-
-<p>If the Makefile is new, you will have to modify the configure script to copy
-   it over.</p>
-</div>
-
-<div class="question">
-<p>I've upgraded to a new version of LLVM, and I get strange build errors.</p>
-</div>
-
-<div class="answer">
-
-<p>Sometimes, changes to the LLVM source code alters how the build system works.
-   Changes in libtool, autoconf, or header file dependencies are especially
-   prone to this sort of problem.</p>
-
-<p>The best thing to try is to remove the old files and re-build.  In most
-   cases, this takes care of the problem.  To do this, just type <tt>make
-   clean</tt> and then <tt>make</tt> in the directory that fails to build.</p>
-</div>
-
-<div class="question">
-<p>I've built LLVM and am testing it, but the tests freeze.</p>
-</div>
-
-<div class="answer">
-<p>This is most likely occurring because you built a profile or release
-   (optimized) build of LLVM and have not specified the same information on the
-   <tt>gmake</tt> command line.</p>
-
-<p>For example, if you built LLVM with the command:</p>
-
-<pre class="doc_code">
-% gmake ENABLE_PROFILING=1
-</pre>
-
-<p>...then you must run the tests with the following commands:</p>
-
-<pre class="doc_code">
-% cd llvm/test
-% gmake ENABLE_PROFILING=1
-</pre>
-</div>
-
-<div class="question">
-<p>Why do test results differ when I perform different types of builds?</p>
-</div>
-
-<div class="answer">
-<p>The LLVM test suite is dependent upon several features of the LLVM tools and
-   libraries.</p>
-
-<p>First, the debugging assertions in code are not enabled in optimized or
-   profiling builds.  Hence, tests that used to fail may pass.</p>
-	
-<p>Second, some tests may rely upon debugging options or behavior that is only
-   available in the debug build.  These tests will fail in an optimized or
-   profile build.</p>
-</div>
-
-<div class="question">
-<p>Compiling LLVM with GCC 3.3.2 fails, what should I do?</p>
-</div>
-
-<div class="answer">
-<p>This is <a href="http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13392">a bug in
-   GCC</a>, and affects projects other than LLVM.  Try upgrading or downgrading
-   your GCC.</p>
-</div>
-
-<div class="question">
-<p>Compiling LLVM with GCC succeeds, but the resulting tools do not work, what
-   can be wrong?</p>
-</div>
-
-<div class="answer">
-<p>Several versions of GCC have shown a weakness in miscompiling the LLVM
-   codebase. Please consult your compiler version (<tt>gcc --version</tt>) to
-   find out whether it is <a href="GettingStarted.html#brokengcc">broken</a>.
-   If so, your only option is to upgrade GCC to a known good version.</p>
-</div>
-
-<div class="question">
-<p>After Subversion update, rebuilding gives the error "No rule to make
-   target".</p>
-</div>
-
-<div class="answer">
-<p>If the error is of the form:</p>
-
-<pre class="doc_code">
-gmake[2]: *** No rule to make target `/path/to/somefile', needed by
-`/path/to/another/file.d'.<br>
-Stop.
-</pre>
-
-<p>This may occur anytime files are moved within the Subversion repository or
-   removed entirely.  In this case, the best solution is to erase all
-   <tt>.d</tt> files, which list dependencies for source files, and rebuild:</p>
-
-<pre class="doc_code">
-% cd $LLVM_OBJ_DIR
-% rm -f `find . -name \*\.d` 
-% gmake 
-</pre>
-
-<p>In other cases, it may be necessary to run <tt>make clean</tt> before
-   rebuilding.</p>
-</div>
-
-<div class="question">
-<p><a name="llvmc">The <tt>llvmc</tt> program gives me errors/doesn't
-   work.</a></p>
-</div>
-
-<div class="answer">
-<p><tt>llvmc</tt> is experimental and isn't really supported. We suggest
-   using <tt>llvm-gcc</tt> instead.</p>
-</div>
-
-<div class="question">
-<p><a name="srcdir-objdir">When I compile LLVM-GCC with srcdir == objdir, it
-   fails. Why?</a></p>
-</div>
-
-<div class="answer">
-<p>The <tt>GNUmakefile</tt> in the top-level directory of LLVM-GCC is a special
-   <tt>Makefile</tt> used by Apple to invoke the <tt>build_gcc</tt> script after
-   setting up a special environment. This has the unforunate side-effect that
-   trying to build LLVM-GCC with srcdir == objdir in a "non-Apple way" invokes
-   the <tt>GNUmakefile</tt> instead of <tt>Makefile</tt>. Because the
-   environment isn't set up correctly to do this, the build fails.</p>
-
-<p>People not building LLVM-GCC the "Apple way" need to build LLVM-GCC with
-   srcdir != objdir, or simply remove the GNUmakefile entirely.</p>
-
-<p>We regret the inconvenience.</p>
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="felangs">Source Languages</a></div>
-
-<div class="question">
-<p><a name="langs">What source languages are supported?</a></p>
-</div>
-
-<div class="answer">
-<p>LLVM currently has full support for C and C++ source languages. These are
-   available through a special version of GCC that LLVM calls the
-   <a href="#cfe">C Front End</a></p>
-
-<p>There is an incomplete version of a Java front end available in the
-   <tt>java</tt> module. There is no documentation on this yet so you'll need to
-   download the code, compile it, and try it.</p>
-
-<p>The PyPy developers are working on integrating LLVM into the PyPy backend so
-   that PyPy language can translate to LLVM.</p>
-</div>
-
-<div class="question">
-<p><a name="langirgen">I'd like to write a self-hosting LLVM compiler. How
-   should I interface with the LLVM middle-end optimizers and back-end code
-   generators?</a></p>
-</div>
-
-<div class="answer">
-<p>Your compiler front-end will communicate with LLVM by creating a module in
-   the LLVM intermediate representation (IR) format. Assuming you want to write
-   your language's compiler in the language itself (rather than C++), there are
-   3 major ways to tackle generating LLVM IR from a front-end:</p>
-
-<ul>
-  <li><strong>Call into the LLVM libraries code using your language's FFI
-      (foreign function interface).</strong>
-
-    <ul>
-      <li><em>for:</em> best tracks changes to the LLVM IR, .ll syntax, and .bc
-          format</li>
-
-      <li><em>for:</em> enables running LLVM optimization passes without a
-          emit/parse overhead</li>
-
-      <li><em>for:</em> adapts well to a JIT context</li>
-
-      <li><em>against:</em> lots of ugly glue code to write</li>
-    </ul></li>
-
-  <li>  <strong>Emit LLVM assembly from your compiler's native language.</strong>
-    <ul>
-      <li><em>for:</em> very straightforward to get started</li>
-
-      <li><em>against:</em> the .ll parser is slower than the bitcode reader
-          when interfacing to the middle end</li>
-
-      <li><em>against:</em> you'll have to re-engineer the LLVM IR object model
-          and asm writer in your language</li>
-
-      <li><em>against:</em> it may be harder to track changes to the IR</li>
-    </ul></li>
-
-  <li><strong>Emit LLVM bitcode from your compiler's native language.</strong>
-
-    <ul>
-      <li><em>for:</em> can use the more-efficient bitcode reader when
-          interfacing to the middle end</li>
-
-      <li><em>against:</em> you'll have to re-engineer the LLVM IR object 
-          model and bitcode writer in your language</li>
-
-      <li><em>against:</em> it may be harder to track changes to the IR</li>
-    </ul></li>
-</ul>
-
-<p>If you go with the first option, the C bindings in include/llvm-c should help
-   a lot, since most languages have strong support for interfacing with C. The
-   most common hurdle with calling C from managed code is interfacing with the
-   garbage collector. The C interface was designed to require very little memory
-   management, and so is straightforward in this regard.</p>
-</div>
-
-<div class="question">
-<p><a name="langhlsupp">What support is there for a higher level source language
-   constructs for building a compiler?</a></p>
-</div>
-
-<div class="answer">
-<p>Currently, there isn't much. LLVM supports an intermediate representation
-   which is useful for code representation but will not support the high level
-   (abstract syntax tree) representation needed by most compilers. There are no
-   facilities for lexical nor semantic analysis. There is, however, a <i>mostly
-   implemented</i> configuration-driven
-   <a href="CompilerDriver.html">compiler driver</a> which simplifies the task
-   of running optimizations, linking, and executable generation.</p>
-</div>
-
-<div class="question">
-<p><a name="getelementptr">I don't understand the GetElementPtr
-   instruction. Help!</a></p>
-</div>
-
-<div class="answer">
-<p>See <a href="GetElementPtr.html">The Often Misunderstood GEP
-   Instruction</a>.</p>
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="cfe">Using the GCC Front End</a>
-</div>
-
-<div class="question">
-<p>When I compile software that uses a configure script, the configure script
-   thinks my system has all of the header files and libraries it is testing for.
-   How do I get configure to work correctly?</p>
-</div>
-
-<div class="answer">
-<p>The configure script is getting things wrong because the LLVM linker allows
-   symbols to be undefined at link time (so that they can be resolved during JIT
-   or translation to the C back end).  That is why configure thinks your system
-   "has everything."</p>
-
-<p>To work around this, perform the following steps:</p>
-
-<ol>
-  <li>Make sure the CC and CXX environment variables contains the full path to
-      the LLVM GCC front end.</li>
-
-  <li>Make sure that the regular C compiler is first in your PATH. </li>
-
-  <li>Add the string "-Wl,-native" to your CFLAGS environment variable.</li>
-</ol>
-
-<p>This will allow the <tt>llvm-ld</tt> linker to create a native code
-   executable instead of shell script that runs the JIT.  Creating native code
-   requires standard linkage, which in turn will allow the configure script to
-   find out if code is not linking on your system because the feature isn't
-   available on your system.</p>
-</div>
-
-<div class="question">
-<p>When I compile code using the LLVM GCC front end, it complains that it cannot
-   find libcrtend.a.
-</p>
-</div>
-
-<div class="answer">
-<p>The only way this can happen is if you haven't installed the runtime
-   library. To correct this, do:</p>
-
-<pre class="doc_code">
-% cd llvm/runtime
-% make clean ; make install-bytecode
-</pre>
-</div>
-
-<div class="question">
-<p>How can I disable all optimizations when compiling code using the LLVM GCC
-   front end?</p>
-</div>
-
-<div class="answer">
-<p>Passing "-Wa,-disable-opt -Wl,-disable-opt" will disable *all* cleanup and
-   optimizations done at the llvm level, leaving you with the truly horrible
-   code that you desire.</p>
-</div>
-
-
-<div class="question">
-<p><a name="translatecxx">Can I use LLVM to convert C++ code to C code?</a></p>
-</div>
-
-<div class="answer">
-<p>Yes, you can use LLVM to convert code from any language LLVM supports to C.
-   Note that the generated C code will be very low level (all loops are lowered
-   to gotos, etc) and not very pretty (comments are stripped, original source
-   formatting is totally lost, variables are renamed, expressions are
-   regrouped), so this may not be what you're looking for. Also, there are
-   several limitations noted below.<p>
-
-<p>Use commands like this:</p>
-
-<ol>
-  <li><p>Compile your program as normal with llvm-g++:</p>
-
-<pre class="doc_code">
-% llvm-g++ x.cpp -o program
-</pre>
-
-      <p>or:</p>
-
-<pre class="doc_code">
-% llvm-g++ a.cpp -c
-% llvm-g++ b.cpp -c
-% llvm-g++ a.o b.o -o program
-</pre>
-
-      <p>With llvm-gcc3, this will generate program and program.bc.  The .bc
-         file is the LLVM version of the program all linked together.</p></li>
-
-  <li><p>Convert the LLVM code to C code, using the LLC tool with the C
-      backend:</p>
-
-<pre class="doc_code">
-% llc -march=c program.bc -o program.c
-</pre></li>
-
-  <li><p>Finally, compile the C file:</p>
-
-<pre class="doc_code">
-% cc x.c
-</pre></li>
-
-</ol>
-
-<p>Using LLVM does not eliminate the need for C++ library support.  If you use
-   the llvm-g++ front-end, the generated code will depend on g++'s C++ support
-   libraries in the same way that code generated from g++ would.  If you use
-   another C++ front-end, the generated code will depend on whatever library
-   that front-end would normally require.</p>
-
-<p>If you are working on a platform that does not provide any C++ libraries, you
-   may be able to manually compile libstdc++ to LLVM bitcode, statically link it
-   into your program, then use the commands above to convert the whole result
-   into C code.  Alternatively, you might compile the libraries and your
-   application into two different chunks of C code and link them.</p>
-
-<p>Note that, by default, the C back end does not support exception handling.
-   If you want/need it for a certain program, you can enable it by passing
-   "-enable-correct-eh-support" to the llc program.  The resultant code will use
-   setjmp/longjmp to implement exception support that is relatively slow, and
-   not C++-ABI-conforming on most platforms, but otherwise correct.</p>
-
-<p>Also, there are a number of other limitations of the C backend that cause it
-   to produce code that does not fully conform to the C++ ABI on most
-   platforms. Some of the C++ programs in LLVM's test suite are known to fail
-   when compiled with the C back end because of ABI incompatibilities with
-   standard C++ libraries.</p>
-</div>
-
-<div class="question">
-<p><a name="platformindependent">Can I compile C or C++ code to
-   platform-independent LLVM bitcode?</a></p>
-</div>
-
-<div class="answer">
-<p>No. C and C++ are inherently platform-dependent languages. The most obvious
-   example of this is the preprocessor. A very common way that C code is made
-   portable is by using the preprocessor to include platform-specific code. In
-   practice, information about other platforms is lost after preprocessing, so
-   the result is inherently dependent on the platform that the preprocessing was
-   targeting.</p>
-
-<p>Another example is <tt>sizeof</tt>. It's common for <tt>sizeof(long)</tt> to
-   vary between platforms. In most C front-ends, <tt>sizeof</tt> is expanded to
-   a constant immediately, thus hard-wiring a platform-specific detail.</p>
-
-<p>Also, since many platforms define their ABIs in terms of C, and since LLVM is
-   lower-level than C, front-ends currently must emit platform-specific IR in
-   order to have the result conform to the platform ABI.</p>
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="cfe_code">Questions about code generated by the GCC front-end</a>
-</div>
-
-<div class="question">
-<p><a name="iosinit">What is this <tt>llvm.global_ctors</tt> and
-   <tt>_GLOBAL__I__tmp_webcompile...</tt> stuff that happens when I <tt>#include
-   &lt;iostream&gt;</tt>?</a></p>
-</div>
-
-<div class="answer">
-<p>If you <tt>#include</tt> the <tt>&lt;iostream&gt;</tt> header into a C++
-   translation unit, the file will probably use
-   the <tt>std::cin</tt>/<tt>std::cout</tt>/... global objects.  However, C++
-   does not guarantee an order of initialization between static objects in
-   different translation units, so if a static ctor/dtor in your .cpp file
-   used <tt>std::cout</tt>, for example, the object would not necessarily be
-   automatically initialized before your use.</p>
-
-<p>To make <tt>std::cout</tt> and friends work correctly in these scenarios, the
-   STL that we use declares a static object that gets created in every
-   translation unit that includes <tt>&lt;iostream&gt;</tt>.  This object has a
-   static constructor and destructor that initializes and destroys the global
-   iostream objects before they could possibly be used in the file.  The code
-   that you see in the .ll file corresponds to the constructor and destructor
-   registration code.
-</p>
-
-<p>If you would like to make it easier to <b>understand</b> the LLVM code
-   generated by the compiler in the demo page, consider using <tt>printf()</tt>
-   instead of <tt>iostream</tt>s to print values.</p>
-</div>
-
-<!--=========================================================================-->
-
-<div class="question">
-<p><a name="codedce">Where did all of my code go??</a></p>
-</div>
-
-<div class="answer">
-<p>If you are using the LLVM demo page, you may often wonder what happened to
-   all of the code that you typed in.  Remember that the demo script is running
-   the code through the LLVM optimizers, so if your code doesn't actually do
-   anything useful, it might all be deleted.</p>
-
-<p>To prevent this, make sure that the code is actually needed.  For example, if
-   you are computing some expression, return the value from the function instead
-   of leaving it in a local variable.  If you really want to constrain the
-   optimizer, you can read from and assign to <tt>volatile</tt> global
-   variables.</p>
-</div>
-
-<!--=========================================================================-->
-
-<div class="question">
-<p><a name="undef">What is this "<tt>undef</tt>" thing that shows up in my
-   code?</a></p>
-</div>
-
-<div class="answer">
-<p><a href="LangRef.html#undef"><tt>undef</tt></a> is the LLVM way of
-   representing a value that is not defined.  You can get these if you do not
-   initialize a variable before you use it.  For example, the C function:</p>
-
-<pre class="doc_code">
-int X() { int i; return i; }
-</pre>
-
-<p>Is compiled to "<tt>ret i32 undef</tt>" because "<tt>i</tt>" never has a
-   value specified for it.</p>
-</div>
-
-<!--=========================================================================-->
-
-<div class="question">
-<p><a name="callconvwrong">Why does instcombine + simplifycfg turn
-   a call to a function with a mismatched calling convention into "unreachable"?
-   Why not make the verifier reject it?</a></p>
-</div>
-
-<div class="answer">
-<p>This is a common problem run into by authors of front-ends that are using
-custom calling conventions: you need to make sure to set the right calling
-convention on both the function and on each call to the function.  For example,
-this code:</p>
-
-<pre class="doc_code">
-define fastcc void @foo() {
-        ret void
-}
-define void @bar() {
-        call void @foo( )
-        ret void
-}
-</pre>
-
-<p>Is optimized to:</p>
-
-<pre class="doc_code">
-define fastcc void @foo() {
-	ret void
-}
-define void @bar() {
-	unreachable
-}
-</pre>
-
-<p>... with "opt -instcombine -simplifycfg".  This often bites people because
-"all their code disappears".  Setting the calling convention on the caller and
-callee is required for indirect calls to work, so people often ask why not make
-the verifier reject this sort of thing.</p>
-
-<p>The answer is that this code has undefined behavior, but it is not illegal.
-If we made it illegal, then every transformation that could potentially create
-this would have to ensure that it doesn't, and there is valid code that can
-create this sort of construct (in dead code).  The sorts of things that can
-cause this to happen are fairly contrived, but we still need to accept them.
-Here's an example:</p>
-
-<pre class="doc_code">
-define fastcc void @foo() {
-        ret void
-}
-define internal void @bar(void()* %FP, i1 %cond) {
-        br i1 %cond, label %T, label %F
-T:  
-        call void %FP()
-        ret void
-F:
-        call fastcc void %FP()
-        ret void
-}
-define void @test() {
-        %X = or i1 false, false
-        call void @bar(void()* @foo, i1 %X)
-        ret void
-} 
-</pre>
-
-<p>In this example, "test" always passes @foo/false into bar, which ensures that
-   it is dynamically called with the right calling conv (thus, the code is
-   perfectly well defined).  If you run this through the inliner, you get this
-   (the explicit "or" is there so that the inliner doesn't dead code eliminate
-   a bunch of stuff):
-</p>
-
-<pre class="doc_code">
-define fastcc void @foo() {
-	ret void
-}
-define void @test() {
-	%X = or i1 false, false
-	br i1 %X, label %T.i, label %F.i
-T.i:
-	call void @foo()
-	br label %bar.exit
-F.i:
-	call fastcc void @foo()
-	br label %bar.exit
-bar.exit:
-	ret void
-}
-</pre>
-
-<p>Here you can see that the inlining pass made an undefined call to @foo with
-  the wrong calling convention.  We really don't want to make the inliner have
-  to know about this sort of thing, so it needs to be valid code.  In this case,
-  dead code elimination can trivially remove the undefined code.  However, if %X
-  was an input argument to @test, the inliner would produce this:
-</p>
-
-<pre class="doc_code">
-define fastcc void @foo() {
-	ret void
-}
-
-define void @test(i1 %X) {
-	br i1 %X, label %T.i, label %F.i
-T.i:
-	call void @foo()
-	br label %bar.exit
-F.i:
-	call fastcc void @foo()
-	br label %bar.exit
-bar.exit:
-	ret void
-}
-</pre>
-
-<p>The interesting thing about this is that %X <em>must</em> be false for the
-code to be well-defined, but no amount of dead code elimination will be able to
-delete the broken call as unreachable.  However, since instcombine/simplifycfg
-turns the undefined call into unreachable, we end up with a branch on a
-condition that goes to unreachable: a branch to unreachable can never happen, so
-"-inline -instcombine -simplifycfg" is able to produce:</p>
-
-<pre class="doc_code">
-define fastcc void @foo() {
-	ret void
-}
-define void @test(i1 %X) {
-F.i:
-	call fastcc void @foo()
-	ret void
-}
-</pre>
-
-</div>
-
-<!-- *********************************************************************** -->
-
-<hr>
-<address>
-  <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
-  src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS"></a>
-  <a href="http://validator.w3.org/check/referer"><img
-  src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
-
-  <a href="http://llvm.org">LLVM Compiler Infrastructure</a><br>
-  Last modified: $Date$
-</address>
-
-</body>
-</html>
diff --git a/libclamav/c++/llvm/docs/GCCFEBuildInstrs.html b/libclamav/c++/llvm/docs/GCCFEBuildInstrs.html
deleted file mode 100644
index b675ee7..0000000
--- a/libclamav/c++/llvm/docs/GCCFEBuildInstrs.html
+++ /dev/null
@@ -1,279 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-                      "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
-  <link rel="stylesheet" href="llvm.css" type="text/css" media="screen">
-  <title>Building the LLVM GCC Front-End</title>
-</head>
-<body>
-
-<div class="doc_title">
-  Building the LLVM GCC Front-End
-</div>
-
-<ol>
-  <li><a href="#instructions">Building llvm-gcc from Source</a></li>
-  <li><a href="#ada">Building the Ada front-end</a></li>
-  <li><a href="#fortran">Building the Fortran front-end</a></li>
-  <li><a href="#license">License Information</a></li>
-</ol>
-
-<div class="doc_author">    
-  <p>Written by the LLVM Team</p>
-</div>
-
-<!-- *********************************************************************** -->
-<h1><a name="instructions">Building llvm-gcc from Source</a></h1>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>This section describes how to acquire and build llvm-gcc 4.2, which is based
-on the GCC 4.2.1 front-end.  Supported languages are Ada, C, C++, Fortran,
-Objective-C and Objective-C++.  Note that the instructions for building these
-front-ends are completely different (and much easier!) than those for building
-llvm-gcc3 in the past.</p>
-
-<ol>
-  <li><p>Retrieve the appropriate llvm-gcc-4.2-<i>version</i>.source.tar.gz
-         archive from the <a href="http://llvm.org/releases/">LLVM web
-         site</a>.</p>
-
-      <p>It is also possible to download the sources of the llvm-gcc front end
-         from a read-only mirror using subversion.  To check out the 4.2 code
-         for first time use:</p>
-
-<div class="doc_code">
-<pre>
-svn co http://llvm.org/svn/llvm-project/llvm-gcc-4.2/trunk <i>dst-directory</i>
-</pre>
-</div>
-
-      <p>After that, the code can be be updated in the destination directory
-         using:</p>
-
-<div class="doc_code">
-<pre>svn update</pre>
-</div>
-
-      <p>The mirror is brought up to date every evening.</p></li>
-
-  <li>Follow the directions in the top-level <tt>README.LLVM</tt> file for
-      up-to-date instructions on how to build llvm-gcc.  See below for building
-      with support for Ada or Fortran.
-</ol>
-
-</div>
-
-<!-- *********************************************************************** -->
-<h1><a name="ada">Building the Ada front-end</a></h1>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-<p>Building with support for Ada amounts to following the directions in the
-top-level <tt>README.LLVM</tt> file, adding ",ada" to EXTRALANGS, for example:
-<tt>EXTRALANGS=,ada</tt></p>
-
-<p>There are some complications however:</p>
-
-<ol>
-  <li><p>The only platform for which the Ada front-end is known to build is
-      32 bit intel x86 running linux.  It is unlikely to build for other
-      systems without some work.</p></li>
-  <li><p>The build requires having a compiler that supports Ada, C and C++.
-      The Ada front-end is written in Ada so an Ada compiler is needed to
-      build it.  Compilers known to work with the
-      <a href="http://llvm.org/releases/download.html">LLVM 2.5 release</a>
-      are <a href="http://gcc.gnu.org/releases.html">gcc-4.2</a> and the
-      2005, 2006 and 2007 versions of the
-      <a href="http://libre.adacore.com/">GNAT GPL Edition</a>.
-      <b>GNAT GPL 2008, gcc-4.3 and later will not work</b>.
-      The LLVM parts of llvm-gcc are written in C++ so a C++ compiler is
-      needed to build them.  The rest of gcc is written in C.
-      Some linux distributions provide a version of gcc that supports all
-      three languages (the Ada part often comes as an add-on package to
-      the rest of gcc).  Otherwise it is possible to combine two versions
-      of gcc, one that supports Ada and C (such as the
-      <a href="http://libre.adacore.com/">2007 GNAT GPL Edition</a>)
-      and another which supports C++, see below.</p></li>
-  <li><p>Because the Ada front-end is experimental, it is wise to build the
-      compiler with checking enabled.  This causes it to run much slower, but
-      helps catch mistakes in the compiler (please report any problems using
-      <a href="http://llvm.org/bugs">LLVM bugzilla</a>).</p></li>
-  <li><p>The Ada front-end <a href="http://llvm.org/PR2007">fails to
-      bootstrap</a>, due to lack of LLVM support for
-      <tt>setjmp</tt>/<tt>longjmp</tt> style exception handling (used
-      internally by the compiler), so you must specify
-      <tt>--disable-bootstrap</tt>.</p></li>
-</ol>
-
-<p>Supposing appropriate compilers are available, llvm-gcc with Ada support can
-   be built on an x86-32 linux box using the following recipe:</p>
-
-<ol>
-  <li><p>Download the <a href="http://llvm.org/releases/download.html">LLVM source</a>
-      and unpack it:</p>
-
-<pre class="doc_code">
-wget http://llvm.org/releases/2.5/llvm-2.5.tar.gz
-tar xzf llvm-2.5.tar.gz
-mv llvm-2.5 llvm
-</pre>
-
-      <p>or <a href="GettingStarted.html#checkout">check out the
-      latest version from subversion</a>:</p>
-
-<pre class="doc_code">svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm</pre>
-
-      </li>
-
-  <li><p>Download the
-      <a href="http://llvm.org/releases/download.html">llvm-gcc-4.2 source</a>
-      and unpack it:</p>
-
-<pre class="doc_code">
-wget http://llvm.org/releases/2.5/llvm-gcc-4.2-2.5.source.tar.gz
-tar xzf llvm-gcc-4.2-2.5.source.tar.gz
-mv llvm-gcc4.2-2.5.source llvm-gcc-4.2
-</pre>
-
-      <p>or <a href="GettingStarted.html#checkout">check out the
-      latest version from subversion</a>:</p>
-
-<pre class="doc_code">
-svn co http://llvm.org/svn/llvm-project/llvm-gcc-4.2/trunk llvm-gcc-4.2
-</pre>
-      </li>
-
-  <li><p>Make a build directory <tt>llvm-objects</tt> for llvm and make it the
-      current directory:</p>
-
-<pre class="doc_code">
-mkdir llvm-objects
-cd llvm-objects
-</pre>
-      </li>
-
-  <li><p>Configure LLVM (here it is configured to install into <tt>/usr/local</tt>):</p>
-
-<pre class="doc_code">
-../llvm/configure --prefix=<b>/usr/local</b> --enable-optimized --enable-assertions
-</pre>
-
-      <p>If you have a multi-compiler setup and the C++ compiler is not the
-      default, then you can configure like this:</p>
-
-<pre class="doc_code">
-CXX=<b>PATH_TO_C++_COMPILER</b> ../llvm/configure --prefix=<b>/usr/local</b> --enable-optimized --enable-assertions
-</pre>
-
-      <p>To compile without checking (not recommended), replace
-      <tt>--enable-assertions</tt> with <tt>--disable-assertions</tt>.</p>
-
-      </li>
-
-  <li><p>Build LLVM:</p>
-
-<pre class="doc_code">
-make
-</pre>
-      </li>
-
-  <li><p>Install LLVM (optional):</p>
-
-<pre class="doc_code">
-make install
-</pre>
-      </li>
-
-  <li><p>Make a build directory <tt>llvm-gcc-4.2-objects</tt> for llvm-gcc and make it the
-      current directory:</p>
-
-<pre class="doc_code">
-cd ..
-mkdir llvm-gcc-4.2-objects
-cd llvm-gcc-4.2-objects
-</pre>
-      </li>
-
-  <li><p>Configure llvm-gcc (here it is configured to install into <tt>/usr/local</tt>).
-      The <tt>--enable-checking</tt> flag turns on sanity checks inside the compiler.
-      To turn off these checks (not recommended), replace <tt>--enable-checking</tt>
-      with <tt>--disable-checking</tt>.
-      Additional languages can be appended to the <tt>--enable-languages</tt> switch,
-      for example <tt>--enable-languages=ada,c,c++</tt>.</p>
-
-<pre class="doc_code">
-../llvm-gcc-4.2/configure --prefix=<b>/usr/local</b> --enable-languages=ada,c \
-                          --enable-checking --enable-llvm=$PWD/../llvm-objects \
-			  --disable-bootstrap --disable-multilib
-</pre>
-
-      <p>If you have a multi-compiler setup, then you can configure like this:</p>
-
-<pre class="doc_code">
-export CC=<b>PATH_TO_C_AND_ADA_COMPILER</b>
-export CXX=<b>PATH_TO_C++_COMPILER</b>
-../llvm-gcc-4.2/configure --prefix=<b>/usr/local</b> --enable-languages=ada,c \
-                          --enable-checking --enable-llvm=$PWD/../llvm-objects \
-			  --disable-bootstrap --disable-multilib
-</pre>
-      </li>
-
-  <li><p>Build and install the compiler:</p>
-
-<pre class="doc_code">
-make
-make install
-</pre>
-      </li>
-</ol>
-
-</div>
-
-<!-- *********************************************************************** -->
-<h1><a name="fortran">Building the Fortran front-end</a></h1>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-<p>To build with support for Fortran, follow the directions in the top-level
-<tt>README.LLVM</tt> file, adding ",fortran" to EXTRALANGS, for example:</p>
-
-<pre class="doc_code">
-EXTRALANGS=,fortran
-</pre>
-
-</div>
-
-<!-- *********************************************************************** -->
-<h1><a name="license">License Information</a></h1>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-<p>
-The LLVM GCC frontend is licensed to you under the GNU General Public License
-and the GNU Lesser General Public License.  Please see the files COPYING and
-COPYING.LIB for more details.
-</p>
-
-<p>
-More information is <a href="FAQ.html#license">available in the FAQ</a>.
-</p>
-</div>
-
-<!-- *********************************************************************** -->
-
-<hr>
-<address>
-  <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
-  src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS"></a>
-  <a href="http://validator.w3.org/check/referer"><img
-  src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
-
-  <a href="http://llvm.org">LLVM Compiler Infrastructure</a><br>
-  Last modified: $Date$
-</address>
-
-</body>
-</html>
diff --git a/libclamav/c++/llvm/docs/GarbageCollection.html b/libclamav/c++/llvm/docs/GarbageCollection.html
deleted file mode 100644
index d0b651e..0000000
--- a/libclamav/c++/llvm/docs/GarbageCollection.html
+++ /dev/null
@@ -1,1387 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-                      "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-  <meta http-equiv="Content-Type" Content="text/html; charset=UTF-8" >
-  <title>Accurate Garbage Collection with LLVM</title>
-  <link rel="stylesheet" href="llvm.css" type="text/css">
-  <style type="text/css">
-    .rowhead { text-align: left; background: inherit; }
-    .indent { padding-left: 1em; }
-    .optl { color: #BFBFBF; }
-  </style>
-</head>
-<body>
-
-<div class="doc_title">
-  Accurate Garbage Collection with LLVM
-</div>
-
-<ol>
-  <li><a href="#introduction">Introduction</a>
-    <ul>
-    <li><a href="#feature">Goals and non-goals</a></li>
-    </ul>
-  </li>
-
-  <li><a href="#quickstart">Getting started</a>
-    <ul>
-    <li><a href="#quickstart-compiler">In your compiler</a></li>
-    <li><a href="#quickstart-runtime">In your runtime library</a></li>
-    <li><a href="#shadow-stack">About the shadow stack</a></li>
-    </ul>
-  </li>
-
-  <li><a href="#core">Core support</a>
-    <ul>
-    <li><a href="#gcattr">Specifying GC code generation:
-      <tt>gc "..."</tt></a></li>
-    <li><a href="#gcroot">Identifying GC roots on the stack:
-      <tt>llvm.gcroot</tt></a></li>
-    <li><a href="#barriers">Reading and writing references in the heap</a>
-      <ul>
-      <li><a href="#gcwrite">Write barrier: <tt>llvm.gcwrite</tt></a></li>
-      <li><a href="#gcread">Read barrier: <tt>llvm.gcread</tt></a></li>
-      </ul>
-    </li>
-    </ul>
-  </li>
-  
-  <li><a href="#plugin">Compiler plugin interface</a>
-    <ul>
-    <li><a href="#collector-algos">Overview of available features</a></li>
-    <li><a href="#stack-map">Computing stack maps</a></li>
-    <li><a href="#init-roots">Initializing roots to null:
-      <tt>InitRoots</tt></a></li>
-    <li><a href="#custom">Custom lowering of intrinsics: <tt>CustomRoots</tt>, 
-      <tt>CustomReadBarriers</tt>, and <tt>CustomWriteBarriers</tt></a></li>
-    <li><a href="#safe-points">Generating safe points:
-      <tt>NeededSafePoints</tt></a></li>
-    <li><a href="#assembly">Emitting assembly code:
-      <tt>GCMetadataPrinter</tt></a></li>
-    </ul>
-  </li>
-
-  <li><a href="#runtime-impl">Implementing a collector runtime</a>
-    <ul>
-      <li><a href="#gcdescriptors">Tracing GC pointers from heap
-      objects</a></li>
-    </ul>
-  </li>
-  
-  <li><a href="#references">References</a></li>
-  
-</ol>
-
-<div class="doc_author">
-  <p>Written by <a href="mailto:sabre at nondot.org">Chris Lattner</a> and
-     Gordon Henriksen</p>
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="introduction">Introduction</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>Garbage collection is a widely used technique that frees the programmer from
-having to know the lifetimes of heap objects, making software easier to produce
-and maintain. Many programming languages rely on garbage collection for
-automatic memory management. There are two primary forms of garbage collection:
-conservative and accurate.</p>
-
-<p>Conservative garbage collection often does not require any special support
-from either the language or the compiler: it can handle non-type-safe
-programming languages (such as C/C++) and does not require any special
-information from the compiler. The
-<a href="http://www.hpl.hp.com/personal/Hans_Boehm/gc/">Boehm collector</a> is
-an example of a state-of-the-art conservative collector.</p>
-
-<p>Accurate garbage collection requires the ability to identify all pointers in
-the program at run-time (which requires that the source-language be type-safe in
-most cases). Identifying pointers at run-time requires compiler support to
-locate all places that hold live pointer variables at run-time, including the
-<a href="#gcroot">processor stack and registers</a>.</p>
-
-<p>Conservative garbage collection is attractive because it does not require any
-special compiler support, but it does have problems. In particular, because the
-conservative garbage collector cannot <i>know</i> that a particular word in the
-machine is a pointer, it cannot move live objects in the heap (preventing the
-use of compacting and generational GC algorithms) and it can occasionally suffer
-from memory leaks due to integer values that happen to point to objects in the
-program. In addition, some aggressive compiler transformations can break
-conservative garbage collectors (though these seem rare in practice).</p>
-
-<p>Accurate garbage collectors do not suffer from any of these problems, but
-they can suffer from degraded scalar optimization of the program. In particular,
-because the runtime must be able to identify and update all pointers active in
-the program, some optimizations are less effective. In practice, however, the
-locality and performance benefits of using aggressive garbage collection
-techniques dominates any low-level losses.</p>
-
-<p>This document describes the mechanisms and interfaces provided by LLVM to
-support accurate garbage collection.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="feature">Goals and non-goals</a>
-</div>
-
-<div class="doc_text">
-
-<p>LLVM's intermediate representation provides <a href="#intrinsics">garbage
-collection intrinsics</a> that offer support for a broad class of
-collector models. For instance, the intrinsics permit:</p>
-
-<ul>
-  <li>semi-space collectors</li>
-  <li>mark-sweep collectors</li>
-  <li>generational collectors</li>
-  <li>reference counting</li>
-  <li>incremental collectors</li>
-  <li>concurrent collectors</li>
-  <li>cooperative collectors</li>
-</ul>
-
-<p>We hope that the primitive support built into the LLVM IR is sufficient to
-support a broad class of garbage collected languages including Scheme, ML, Java,
-C#, Perl, Python, Lua, Ruby, other scripting languages, and more.</p>
-
-<p>However, LLVM does not itself provide a garbage collector&#151;this should
-be part of your language's runtime library. LLVM provides a framework for
-compile time <a href="#plugin">code generation plugins</a>. The role of these
-plugins is to generate code and data structures which conforms to the <em>binary
-interface</em> specified by the <em>runtime library</em>. This is similar to the
-relationship between LLVM and DWARF debugging info, for example. The
-difference primarily lies in the lack of an established standard in the domain
-of garbage collection&#151;thus the plugins.</p>
-
-<p>The aspects of the binary interface with which LLVM's GC support is
-concerned are:</p>
-
-<ul>
-  <li>Creation of GC-safe points within code where collection is allowed to
-      execute safely.</li>
-  <li>Computation of the stack map. For each safe point in the code, object
-      references within the stack frame must be identified so that the
-      collector may traverse and perhaps update them.</li>
-  <li>Write barriers when storing object references to the heap. These are
-      commonly used to optimize incremental scans in generational
-      collectors.</li>
-  <li>Emission of read barriers when loading object references. These are
-      useful for interoperating with concurrent collectors.</li>
-</ul>
-
-<p>There are additional areas that LLVM does not directly address:</p>
-
-<ul>
-  <li>Registration of global roots with the runtime.</li>
-  <li>Registration of stack map entries with the runtime.</li>
-  <li>The functions used by the program to allocate memory, trigger a
-      collection, etc.</li>
-  <li>Computation or compilation of type maps, or registration of them with
-      the runtime. These are used to crawl the heap for object
-      references.</li>
-</ul>
-
-<p>In general, LLVM's support for GC does not include features which can be
-adequately addressed with other features of the IR and does not specify a
-particular binary interface. On the plus side, this means that you should be
-able to integrate LLVM with an existing runtime. On the other hand, it leaves
-a lot of work for the developer of a novel language. However, it's easy to get
-started quickly and scale up to a more sophisticated implementation as your
-compiler matures.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="quickstart">Getting started</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>Using a GC with LLVM implies many things, for example:</p>
-
-<ul>
-  <li>Write a runtime library or find an existing one which implements a GC
-      heap.<ol>
-    <li>Implement a memory allocator.</li>
-    <li>Design a binary interface for the stack map, used to identify
-        references within a stack frame on the machine stack.*</li>
-    <li>Implement a stack crawler to discover functions on the call stack.*</li>
-    <li>Implement a registry for global roots.</li>
-    <li>Design a binary interface for type maps, used to identify references
-        within heap objects.</li>
-    <li>Implement a collection routine bringing together all of the above.</li>
-  </ol></li>
-  <li>Emit compatible code from your compiler.<ul>
-    <li>Initialization in the main function.</li>
-    <li>Use the <tt>gc "..."</tt> attribute to enable GC code generation
-        (or <tt>F.setGC("...")</tt>).</li>
-    <li>Use <tt>@llvm.gcroot</tt> to mark stack roots.</li>
-    <li>Use <tt>@llvm.gcread</tt> and/or <tt>@llvm.gcwrite</tt> to
-        manipulate GC references, if necessary.</li>
-    <li>Allocate memory using the GC allocation routine provided by the
-        runtime library.</li>
-    <li>Generate type maps according to your runtime's binary interface.</li>
-  </ul></li>
-  <li>Write a compiler plugin to interface LLVM with the runtime library.*<ul>
-    <li>Lower <tt>@llvm.gcread</tt> and <tt>@llvm.gcwrite</tt> to appropriate
-        code sequences.*</li>
-    <li>Compile LLVM's stack map to the binary form expected by the
-        runtime.</li>
-  </ul></li>
-  <li>Load the plugin into the compiler. Use <tt>llc -load</tt> or link the
-      plugin statically with your language's compiler.*</li>
-  <li>Link program executables with the runtime.</li>
-</ul>
-
-<p>To help with several of these tasks (those indicated with a *), LLVM
-includes a highly portable, built-in ShadowStack code generator. It is compiled
-into <tt>llc</tt> and works even with the interpreter and C backends.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="quickstart-compiler">In your compiler</a>
-</div>
-
-<div class="doc_text">
-
-<p>To turn the shadow stack on for your functions, first call:</p>
-
-<div class="doc_code"><pre
->F.setGC("shadow-stack");</pre></div>
-
-<p>for each function your compiler emits. Since the shadow stack is built into
-LLVM, you do not need to load a plugin.</p>
-
-<p>Your compiler must also use <tt>@llvm.gcroot</tt> as documented.
-Don't forget to create a root for each intermediate value that is generated
-when evaluating an expression. In <tt>h(f(), g())</tt>, the result of
-<tt>f()</tt> could easily be collected if evaluating <tt>g()</tt> triggers a
-collection.</p>
-
-<p>There's no need to use <tt>@llvm.gcread</tt> and <tt>@llvm.gcwrite</tt> over
-plain <tt>load</tt> and <tt>store</tt> for now. You will need them when
-switching to a more advanced GC.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="quickstart-runtime">In your runtime</a>
-</div>
-
-<div class="doc_text">
-
-<p>The shadow stack doesn't imply a memory allocation algorithm. A semispace
-collector or building atop <tt>malloc</tt> are great places to start, and can
-be implemented with very little code.</p>
-
-<p>When it comes time to collect, however, your runtime needs to traverse the
-stack roots, and for this it needs to integrate with the shadow stack. Luckily,
-doing so is very simple. (This code is heavily commented to help you
-understand the data structure, but there are only 20 lines of meaningful
-code.)</p>
-
-</div>
-
-<div class="doc_code"><pre
->/// @brief The map for a single function's stack frame. One of these is
-///        compiled as constant data into the executable for each function.
-/// 
-/// Storage of metadata values is elided if the %metadata parameter to
-/// @llvm.gcroot is null.
-struct FrameMap {
-  int32_t NumRoots;    //&lt; Number of roots in stack frame.
-  int32_t NumMeta;     //&lt; Number of metadata entries. May be &lt; NumRoots.
-  const void *Meta[0]; //&lt; Metadata for each root.
-};
-
-/// @brief A link in the dynamic shadow stack. One of these is embedded in the
-///        stack frame of each function on the call stack.
-struct StackEntry {
-  StackEntry *Next;    //&lt; Link to next stack entry (the caller's).
-  const FrameMap *Map; //&lt; Pointer to constant FrameMap.
-  void *Roots[0];      //&lt; Stack roots (in-place array).
-};
-
-/// @brief The head of the singly-linked list of StackEntries. Functions push
-///        and pop onto this in their prologue and epilogue.
-/// 
-/// Since there is only a global list, this technique is not threadsafe.
-StackEntry *llvm_gc_root_chain;
-
-/// @brief Calls Visitor(root, meta) for each GC root on the stack.
-///        root and meta are exactly the values passed to
-///        <tt>@llvm.gcroot</tt>.
-/// 
-/// Visitor could be a function to recursively mark live objects. Or it
-/// might copy them to another heap or generation.
-/// 
-/// @param Visitor A function to invoke for every GC root on the stack.
-void visitGCRoots(void (*Visitor)(void **Root, const void *Meta)) {
-  for (StackEntry *R = llvm_gc_root_chain; R; R = R->Next) {
-    unsigned i = 0;
-    
-    // For roots [0, NumMeta), the metadata pointer is in the FrameMap.
-    for (unsigned e = R->Map->NumMeta; i != e; ++i)
-      Visitor(&amp;R->Roots[i], R->Map->Meta[i]);
-    
-    // For roots [NumMeta, NumRoots), the metadata pointer is null.
-    for (unsigned e = R->Map->NumRoots; i != e; ++i)
-      Visitor(&amp;R->Roots[i], NULL);
-  }
-}</pre></div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="shadow-stack">About the shadow stack</a>
-</div>
-
-<div class="doc_text">
-
-<p>Unlike many GC algorithms which rely on a cooperative code generator to
-compile stack maps, this algorithm carefully maintains a linked list of stack
-roots [<a href="#henderson02">Henderson2002</a>]. This so-called "shadow stack"
-mirrors the machine stack. Maintaining this data structure is slower than using
-a stack map compiled into the executable as constant data, but has a significant
-portability advantage because it requires no special support from the target
-code generator, and does not require tricky platform-specific code to crawl
-the machine stack.</p>
-
-<p>The tradeoff for this simplicity and portability is:</p>
-
-<ul>
-  <li>High overhead per function call.</li>
-  <li>Not thread-safe.</li>
-</ul>
-
-<p>Still, it's an easy way to get started. After your compiler and runtime are
-up and running, writing a <a href="#plugin">plugin</a> will allow you to take
-advantage of <a href="#collector-algos">more advanced GC features</a> of LLVM
-in order to improve performance.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="core">IR features</a><a name="intrinsics"></a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>This section describes the garbage collection facilities provided by the
-<a href="LangRef.html">LLVM intermediate representation</a>. The exact behavior
-of these IR features is specified by the binary interface implemented by a
-<a href="#plugin">code generation plugin</a>, not by this document.</p>
-
-<p>These facilities are limited to those strictly necessary; they are not
-intended to be a complete interface to any garbage collector. A program will
-need to interface with the GC library using the facilities provided by that
-program.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="gcattr">Specifying GC code generation: <tt>gc "..."</tt></a>
-</div>
-
-<div class="doc_code"><tt>
-  define <i>ty</i> @<i>name</i>(...) <span style="text-decoration: underline">gc "<i>name</i>"</span> { ...
-</tt></div>
-
-<div class="doc_text">
-
-<p>The <tt>gc</tt> function attribute is used to specify the desired GC style
-to the compiler. Its programmatic equivalent is the <tt>setGC</tt> method of
-<tt>Function</tt>.</p>
-
-<p>Setting <tt>gc "<i>name</i>"</tt> on a function triggers a search for a
-matching code generation plugin "<i>name</i>"; it is that plugin which defines
-the exact nature of the code generated to support GC. If none is found, the
-compiler will raise an error.</p>
-
-<p>Specifying the GC style on a per-function basis allows LLVM to link together
-programs that use different garbage collection algorithms (or none at all).</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="gcroot">Identifying GC roots on the stack: <tt>llvm.gcroot</tt></a>
-</div>
-
-<div class="doc_code"><tt>
-  void @llvm.gcroot(i8** %ptrloc, i8* %metadata)
-</tt></div>
-
-<div class="doc_text">
-
-<p>The <tt>llvm.gcroot</tt> intrinsic is used to inform LLVM that a stack
-variable references an object on the heap and is to be tracked for garbage
-collection. The exact impact on generated code is specified by a <a
-href="#plugin">compiler plugin</a>.</p>
-
-<p>A compiler which uses mem2reg to raise imperative code using <tt>alloca</tt>
-into SSA form need only add a call to <tt>@llvm.gcroot</tt> for those variables
-which a pointers into the GC heap.</p>
-
-<p>It is also important to mark intermediate values with <tt>llvm.gcroot</tt>.
-For example, consider <tt>h(f(), g())</tt>. Beware leaking the result of
-<tt>f()</tt> in the case that <tt>g()</tt> triggers a collection.</p>
-
-<p>The first argument <b>must</b> be a value referring to an alloca instruction
-or a bitcast of an alloca. The second contains a pointer to metadata that
-should be associated with the pointer, and <b>must</b> be a constant or global
-value address. If your target collector uses tags, use a null pointer for
-metadata.</p>
-
-<p>The <tt>%metadata</tt> argument can be used to avoid requiring heap objects
-to have 'isa' pointers or tag bits. [<a href="#appel89">Appel89</a>, <a
-href="#goldberg91">Goldberg91</a>, <a href="#tolmach94">Tolmach94</a>] If
-specified, its value will be tracked along with the location of the pointer in
-the stack frame.</p>
-
-<p>Consider the following fragment of Java code:</p>
-
-<pre>
-       {
-         Object X;   // A null-initialized reference to an object
-         ...
-       }
-</pre>
-
-<p>This block (which may be located in the middle of a function or in a loop
-nest), could be compiled to this LLVM code:</p>
-
-<pre>
-Entry:
-   ;; In the entry block for the function, allocate the
-   ;; stack space for X, which is an LLVM pointer.
-   %X = alloca %Object*
-   
-   ;; Tell LLVM that the stack space is a stack root.
-   ;; Java has type-tags on objects, so we pass null as metadata.
-   %tmp = bitcast %Object** %X to i8**
-   call void @llvm.gcroot(i8** %X, i8* null)
-   ...
-
-   ;; "CodeBlock" is the block corresponding to the start
-   ;;  of the scope above.
-CodeBlock:
-   ;; Java null-initializes pointers.
-   store %Object* null, %Object** %X
-
-   ...
-
-   ;; As the pointer goes out of scope, store a null value into
-   ;; it, to indicate that the value is no longer live.
-   store %Object* null, %Object** %X
-   ...
-</pre>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="barriers">Reading and writing references in the heap</a>
-</div>
-
-<div class="doc_text">
-
-<p>Some collectors need to be informed when the mutator (the program that needs
-garbage collection) either reads a pointer from or writes a pointer to a field
-of a heap object. The code fragments inserted at these points are called
-<em>read barriers</em> and <em>write barriers</em>, respectively. The amount of
-code that needs to be executed is usually quite small and not on the critical
-path of any computation, so the overall performance impact of the barrier is
-tolerable.</p>
-
-<p>Barriers often require access to the <em>object pointer</em> rather than the
-<em>derived pointer</em> (which is a pointer to the field within the
-object). Accordingly, these intrinsics take both pointers as separate arguments
-for completeness. In this snippet, <tt>%object</tt> is the object pointer, and 
-<tt>%derived</tt> is the derived pointer:</p>
-
-<blockquote><pre>
-    ;; An array type.
-    %class.Array = type { %class.Object, i32, [0 x %class.Object*] }
-    ...
-
-    ;; Load the object pointer from a gcroot.
-    %object = load %class.Array** %object_addr
-
-    ;; Compute the derived pointer.
-    %derived = getelementptr %object, i32 0, i32 2, i32 %n</pre></blockquote>
-
-<p>LLVM does not enforce this relationship between the object and derived
-pointer (although a <a href="#plugin">plugin</a> might). However, it would be
-an unusual collector that violated it.</p>
-
-<p>The use of these intrinsics is naturally optional if the target GC does
-require the corresponding barrier. Such a GC plugin will replace the intrinsic
-calls with the corresponding <tt>load</tt> or <tt>store</tt> instruction if they
-are used.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection">
-  <a name="gcwrite">Write barrier: <tt>llvm.gcwrite</tt></a>
-</div>
-
-<div class="doc_code"><tt>
-void @llvm.gcwrite(i8* %value, i8* %object, i8** %derived)
-</tt></div>
-
-<div class="doc_text">
-
-<p>For write barriers, LLVM provides the <tt>llvm.gcwrite</tt> intrinsic
-function. It has exactly the same semantics as a non-volatile <tt>store</tt> to
-the derived pointer (the third argument). The exact code generated is specified
-by a <a href="#plugin">compiler plugin</a>.</p>
-
-<p>Many important algorithms require write barriers, including generational
-and concurrent collectors. Additionally, write barriers could be used to
-implement reference counting.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection">
-  <a name="gcread">Read barrier: <tt>llvm.gcread</tt></a>
-</div>
-
-<div class="doc_code"><tt>
-i8* @llvm.gcread(i8* %object, i8** %derived)<br>
-</tt></div>
-
-<div class="doc_text">
-
-<p>For read barriers, LLVM provides the <tt>llvm.gcread</tt> intrinsic function.
-It has exactly the same semantics as a non-volatile <tt>load</tt> from the
-derived pointer (the second argument). The exact code generated is specified by
-a <a href="#plugin">compiler plugin</a>.</p>
-
-<p>Read barriers are needed by fewer algorithms than write barriers, and may
-have a greater performance impact since pointer reads are more frequent than
-writes.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="plugin">Implementing a collector plugin</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>User code specifies which GC code generation to use with the <tt>gc</tt>
-function attribute or, equivalently, with the <tt>setGC</tt> method of
-<tt>Function</tt>.</p>
-
-<p>To implement a GC plugin, it is necessary to subclass
-<tt>llvm::GCStrategy</tt>, which can be accomplished in a few lines of
-boilerplate code. LLVM's infrastructure provides access to several important
-algorithms. For an uncontroversial collector, all that remains may be to
-compile LLVM's computed stack map to assembly code (using the binary
-representation expected by the runtime library). This can be accomplished in
-about 100 lines of code.</p>
-
-<p>This is not the appropriate place to implement a garbage collected heap or a
-garbage collector itself. That code should exist in the language's runtime
-library. The compiler plugin is responsible for generating code which
-conforms to the binary interface defined by library, most essentially the
-<a href="#stack-map">stack map</a>.</p>
-
-<p>To subclass <tt>llvm::GCStrategy</tt> and register it with the compiler:</p>
-
-<blockquote><pre>// lib/MyGC/MyGC.cpp - Example LLVM GC plugin
-
-#include "llvm/CodeGen/GCStrategy.h"
-#include "llvm/CodeGen/GCMetadata.h"
-#include "llvm/Support/Compiler.h"
-
-using namespace llvm;
-
-namespace {
-  class VISIBILITY_HIDDEN MyGC : public GCStrategy {
-  public:
-    MyGC() {}
-  };
-  
-  GCRegistry::Add&lt;MyGC&gt;
-  X("mygc", "My bespoke garbage collector.");
-}</pre></blockquote>
-
-<p>This boilerplate collector does nothing. More specifically:</p>
-
-<ul>
-  <li><tt>llvm.gcread</tt> calls are replaced with the corresponding
-      <tt>load</tt> instruction.</li>
-  <li><tt>llvm.gcwrite</tt> calls are replaced with the corresponding
-      <tt>store</tt> instruction.</li>
-  <li>No safe points are added to the code.</li>
-  <li>The stack map is not compiled into the executable.</li>
-</ul>
-
-<p>Using the LLVM makefiles (like the <a
-href="http://llvm.org/viewvc/llvm-project/llvm/trunk/projects/sample/">sample
-project</a>), this code can be compiled as a plugin using a simple
-makefile:</p>
-
-<blockquote><pre
-># lib/MyGC/Makefile
-
-LEVEL := ../..
-LIBRARYNAME = <var>MyGC</var>
-LOADABLE_MODULE = 1
-
-include $(LEVEL)/Makefile.common</pre></blockquote>
-
-<p>Once the plugin is compiled, code using it may be compiled using <tt>llc
--load=<var>MyGC.so</var></tt> (though <var>MyGC.so</var> may have some other
-platform-specific extension):</p>
-
-<blockquote><pre
->$ cat sample.ll
-define void @f() gc "mygc" {
-entry:
-        ret void
-}
-$ llvm-as &lt; sample.ll | llc -load=MyGC.so</pre></blockquote>
-
-<p>It is also possible to statically link the collector plugin into tools, such
-as a language-specific compiler front-end.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="collector-algos">Overview of available features</a>
-</div>
-
-<div class="doc_text">
-
-<p><tt>GCStrategy</tt> provides a range of features through which a plugin
-may do useful work. Some of these are callbacks, some are algorithms that can
-be enabled, disabled, or customized. This matrix summarizes the supported (and
-planned) features and correlates them with the collection techniques which
-typically require them.</p>
-
-<table>
-  <tr>
-    <th>Algorithm</th>
-    <th>Done</th>
-    <th>shadow stack</th>
-    <th>refcount</th>
-    <th>mark-sweep</th>
-    <th>copying</th>
-    <th>incremental</th>
-    <th>threaded</th>
-    <th>concurrent</th>
-  </tr>
-  <tr>
-    <th class="rowhead"><a href="#stack-map">stack map</a></th>
-    <td>&#10004;</td>
-    <td></td>
-    <td></td>
-    <td>&#10008;</td>
-    <td>&#10008;</td>
-    <td>&#10008;</td>
-    <td>&#10008;</td>
-    <td>&#10008;</td>
-  </tr>
-  <tr>
-    <th class="rowhead"><a href="#init-roots">initialize roots</a></th>
-    <td>&#10004;</td>
-    <td>&#10008;</td>
-    <td>&#10008;</td>
-    <td>&#10008;</td>
-    <td>&#10008;</td>
-    <td>&#10008;</td>
-    <td>&#10008;</td>
-    <td>&#10008;</td>
-  </tr>
-  <tr class="doc_warning">
-    <th class="rowhead">derived pointers</th>
-    <td>NO</td>
-    <td></td>
-    <td></td>
-    <td></td>
-    <td></td>
-    <td></td>
-    <td>&#10008;*</td>
-    <td>&#10008;*</td>
-  </tr>
-  <tr>
-    <th class="rowhead"><em><a href="#custom">custom lowering</a></em></th>
-    <td>&#10004;</td>
-    <th></th>
-    <th></th>
-    <th></th>
-    <th></th>
-    <th></th>
-    <th></th>
-    <th></th>
-  </tr>
-  <tr>
-    <th class="rowhead indent">gcroot</th>
-    <td>&#10004;</td>
-    <td>&#10008;</td>
-    <td>&#10008;</td>
-    <td></td>
-    <td></td>
-    <td></td>
-    <td></td>
-    <td></td>
-  </tr>
-  <tr>
-    <th class="rowhead indent">gcwrite</th>
-    <td>&#10004;</td>
-    <td></td>
-    <td>&#10008;</td>
-    <td></td>
-    <td></td>
-    <td>&#10008;</td>
-    <td></td>
-    <td>&#10008;</td>
-  </tr>
-  <tr>
-    <th class="rowhead indent">gcread</th>
-    <td>&#10004;</td>
-    <td></td>
-    <td></td>
-    <td></td>
-    <td></td>
-    <td></td>
-    <td></td>
-    <td>&#10008;</td>
-  </tr>
-  <tr>
-    <th class="rowhead"><em><a href="#safe-points">safe points</a></em></th>
-    <td></td>
-    <th></th>
-    <th></th>
-    <th></th>
-    <th></th>
-    <th></th>
-    <th></th>
-    <th></th>
-  </tr>
-  <tr>
-    <th class="rowhead indent">in calls</th>
-    <td>&#10004;</td>
-    <td></td>
-    <td></td>
-    <td>&#10008;</td>
-    <td>&#10008;</td>
-    <td>&#10008;</td>
-    <td>&#10008;</td>
-    <td>&#10008;</td>
-  </tr>
-  <tr>
-    <th class="rowhead indent">before calls</th>
-    <td>&#10004;</td>
-    <td></td>
-    <td></td>
-    <td></td>
-    <td></td>
-    <td></td>
-    <td>&#10008;</td>
-    <td>&#10008;</td>
-  </tr>
-  <tr class="doc_warning">
-    <th class="rowhead indent">for loops</th>
-    <td>NO</td>
-    <td></td>
-    <td></td>
-    <td></td>
-    <td></td>
-    <td></td>
-    <td>&#10008;</td>
-    <td>&#10008;</td>
-  </tr>
-  <tr>
-    <th class="rowhead indent">before escape</th>
-    <td>&#10004;</td>
-    <td></td>
-    <td></td>
-    <td></td>
-    <td></td>
-    <td></td>
-    <td>&#10008;</td>
-    <td>&#10008;</td>
-  </tr>
-  <tr class="doc_warning">
-    <th class="rowhead">emit code at safe points</th>
-    <td>NO</td>
-    <td></td>
-    <td></td>
-    <td></td>
-    <td></td>
-    <td></td>
-    <td>&#10008;</td>
-    <td>&#10008;</td>
-  </tr>
-  <tr>
-    <th class="rowhead"><em>output</em></th>
-    <td></td>
-    <th></th>
-    <th></th>
-    <th></th>
-    <th></th>
-    <th></th>
-    <th></th>
-    <th></th>
-  </tr>
-  <tr>
-    <th class="rowhead indent"><a href="#assembly">assembly</a></th>
-    <td>&#10004;</td>
-    <td></td>
-    <td></td>
-    <td>&#10008;</td>
-    <td>&#10008;</td>
-    <td>&#10008;</td>
-    <td>&#10008;</td>
-    <td>&#10008;</td>
-  </tr>
-  <tr class="doc_warning">
-    <th class="rowhead indent">JIT</th>
-    <td>NO</td>
-    <td></td>
-    <td></td>
-    <td class="optl">&#10008;</td>
-    <td class="optl">&#10008;</td>
-    <td class="optl">&#10008;</td>
-    <td class="optl">&#10008;</td>
-    <td class="optl">&#10008;</td>
-  </tr>
-  <tr class="doc_warning">
-    <th class="rowhead indent">obj</th>
-    <td>NO</td>
-    <td></td>
-    <td></td>
-    <td class="optl">&#10008;</td>
-    <td class="optl">&#10008;</td>
-    <td class="optl">&#10008;</td>
-    <td class="optl">&#10008;</td>
-    <td class="optl">&#10008;</td>
-  </tr>
-  <tr class="doc_warning">
-    <th class="rowhead">live analysis</th>
-    <td>NO</td>
-    <td></td>
-    <td></td>
-    <td class="optl">&#10008;</td>
-    <td class="optl">&#10008;</td>
-    <td class="optl">&#10008;</td>
-    <td class="optl">&#10008;</td>
-    <td class="optl">&#10008;</td>
-  </tr>
-  <tr class="doc_warning">
-    <th class="rowhead">register map</th>
-    <td>NO</td>
-    <td></td>
-    <td></td>
-    <td class="optl">&#10008;</td>
-    <td class="optl">&#10008;</td>
-    <td class="optl">&#10008;</td>
-    <td class="optl">&#10008;</td>
-    <td class="optl">&#10008;</td>
-  </tr>
-  <tr>
-    <td colspan="10">
-      <div><span class="doc_warning">*</span> Derived pointers only pose a
-           hazard to copying collectors.</div>
-      <div><span class="optl">&#10008;</span> in gray denotes a feature which
-           could be utilized if available.</div>
-    </td>
-  </tr>
-</table>
-
-<p>To be clear, the collection techniques above are defined as:</p>
-
-<dl>
-  <dt>Shadow Stack</dt>
-  <dd>The mutator carefully maintains a linked list of stack roots.</dd>
-  <dt>Reference Counting</dt>
-  <dd>The mutator maintains a reference count for each object and frees an
-      object when its count falls to zero.</dd>
-  <dt>Mark-Sweep</dt>
-  <dd>When the heap is exhausted, the collector marks reachable objects starting
-      from the roots, then deallocates unreachable objects in a sweep
-      phase.</dd>
-  <dt>Copying</dt>
-  <dd>As reachability analysis proceeds, the collector copies objects from one
-      heap area to another, compacting them in the process. Copying collectors
-      enable highly efficient "bump pointer" allocation and can improve locality
-      of reference.</dd>
-  <dt>Incremental</dt>
-  <dd>(Including generational collectors.) Incremental collectors generally have
-      all the properties of a copying collector (regardless of whether the
-      mature heap is compacting), but bring the added complexity of requiring
-      write barriers.</dd>
-  <dt>Threaded</dt>
-  <dd>Denotes a multithreaded mutator; the collector must still stop the mutator
-      ("stop the world") before beginning reachability analysis. Stopping a
-      multithreaded mutator is a complicated problem. It generally requires
-      highly platform specific code in the runtime, and the production of
-      carefully designed machine code at safe points.</dd>
-  <dt>Concurrent</dt>
-  <dd>In this technique, the mutator and the collector run concurrently, with
-      the goal of eliminating pause times. In a <em>cooperative</em> collector,
-      the mutator further aids with collection should a pause occur, allowing
-      collection to take advantage of multiprocessor hosts. The "stop the world"
-      problem of threaded collectors is generally still present to a limited
-      extent. Sophisticated marking algorithms are necessary. Read barriers may
-      be necessary.</dd>
-</dl>
-
-<p>As the matrix indicates, LLVM's garbage collection infrastructure is already
-suitable for a wide variety of collectors, but does not currently extend to
-multithreaded programs. This will be added in the future as there is
-interest.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="stack-map">Computing stack maps</a>
-</div>
-
-<div class="doc_text">
-
-<p>LLVM automatically computes a stack map. One of the most important features
-of a <tt>GCStrategy</tt> is to compile this information into the executable in
-the binary representation expected by the runtime library.</p>
-
-<p>The stack map consists of the location and identity of each GC root in the
-each function in the module. For each root:</p>
-
-<ul>
-  <li><tt>RootNum</tt>: The index of the root.</li>
-  <li><tt>StackOffset</tt>: The offset of the object relative to the frame
-      pointer.</li>
-  <li><tt>RootMetadata</tt>: The value passed as the <tt>%metadata</tt>
-      parameter to the <a href="#gcroot"><tt>@llvm.gcroot</tt></a> intrinsic.</li>
-</ul>
-
-<p>Also, for the function as a whole:</p>
-
-<ul>
-  <li><tt>getFrameSize()</tt>: The overall size of the function's initial
-      stack frame, not accounting for any dynamic allocation.</li>
-  <li><tt>roots_size()</tt>: The count of roots in the function.</li>
-</ul>
-
-<p>To access the stack map, use <tt>GCFunctionMetadata::roots_begin()</tt> and
--<tt>end()</tt> from the <tt><a
-href="#assembly">GCMetadataPrinter</a></tt>:</p>
-
-<blockquote><pre
->for (iterator I = begin(), E = end(); I != E; ++I) {
-  GCFunctionInfo *FI = *I;
-  unsigned FrameSize = FI-&gt;getFrameSize();
-  size_t RootCount = FI-&gt;roots_size();
-
-  for (GCFunctionInfo::roots_iterator RI = FI-&gt;roots_begin(),
-                                      RE = FI-&gt;roots_end();
-                                      RI != RE; ++RI) {
-    int RootNum = RI->Num;
-    int RootStackOffset = RI->StackOffset;
-    Constant *RootMetadata = RI->Metadata;
-  }
-}</pre></blockquote>
-
-<p>If the <tt>llvm.gcroot</tt> intrinsic is eliminated before code generation by
-a custom lowering pass, LLVM will compute an empty stack map. This may be useful
-for collector plugins which implement reference counting or a shadow stack.</p>
-
-</div>
-
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="init-roots">Initializing roots to null: <tt>InitRoots</tt></a>
-</div>
-
-<div class="doc_text">
-
-<blockquote><pre
->MyGC::MyGC() {
-  InitRoots = true;
-}</pre></blockquote>
-
-<p>When set, LLVM will automatically initialize each root to <tt>null</tt> upon
-entry to the function. This prevents the GC's sweep phase from visiting
-uninitialized pointers, which will almost certainly cause it to crash. This
-initialization occurs before custom lowering, so the two may be used
-together.</p>
-
-<p>Since LLVM does not yet compute liveness information, there is no means of
-distinguishing an uninitialized stack root from an initialized one. Therefore,
-this feature should be used by all GC plugins. It is enabled by default.</p>
-
-</div>
-
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="custom">Custom lowering of intrinsics: <tt>CustomRoots</tt>, 
-    <tt>CustomReadBarriers</tt>, and <tt>CustomWriteBarriers</tt></a>
-</div>
-
-<div class="doc_text">
-
-<p>For GCs which use barriers or unusual treatment of stack roots, these
-flags allow the collector to perform arbitrary transformations of the LLVM
-IR:</p>
-
-<blockquote><pre
->class MyGC : public GCStrategy {
-public:
-  MyGC() {
-    CustomRoots = true;
-    CustomReadBarriers = true;
-    CustomWriteBarriers = true;
-  }
-  
-  virtual bool initializeCustomLowering(Module &amp;M);
-  virtual bool performCustomLowering(Function &amp;F);
-};</pre></blockquote>
-
-<p>If any of these flags are set, then LLVM suppresses its default lowering for
-the corresponding intrinsics and instead calls
-<tt>performCustomLowering</tt>.</p>
-
-<p>LLVM's default action for each intrinsic is as follows:</p>
-
-<ul>
-  <li><tt>llvm.gcroot</tt>: Leave it alone. The code generator must see it
-                            or the stack map will not be computed.</li>
-  <li><tt>llvm.gcread</tt>: Substitute a <tt>load</tt> instruction.</li>
-  <li><tt>llvm.gcwrite</tt>: Substitute a <tt>store</tt> instruction.</li>
-</ul>
-
-<p>If <tt>CustomReadBarriers</tt> or <tt>CustomWriteBarriers</tt> are specified,
-then <tt>performCustomLowering</tt> <strong>must</strong> eliminate the
-corresponding barriers.</p>
-
-<p><tt>performCustomLowering</tt> must comply with the same restrictions as <a
-href="WritingAnLLVMPass.html#runOnFunction"><tt
->FunctionPass::runOnFunction</tt></a>.
-Likewise, <tt>initializeCustomLowering</tt> has the same semantics as <a
-href="WritingAnLLVMPass.html#doInitialization_mod"><tt
->Pass::doInitialization(Module&amp;)</tt></a>.</p>
-
-<p>The following can be used as a template:</p>
-
-<blockquote><pre
->#include "llvm/Module.h"
-#include "llvm/IntrinsicInst.h"
-
-bool MyGC::initializeCustomLowering(Module &amp;M) {
-  return false;
-}
-
-bool MyGC::performCustomLowering(Function &amp;F) {
-  bool MadeChange = false;
-  
-  for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB)
-    for (BasicBlock::iterator II = BB-&gt;begin(), E = BB-&gt;end(); II != E; )
-      if (IntrinsicInst *CI = dyn_cast&lt;IntrinsicInst&gt;(II++))
-        if (Function *F = CI-&gt;getCalledFunction())
-          switch (F-&gt;getIntrinsicID()) {
-          case Intrinsic::gcwrite:
-            // Handle llvm.gcwrite.
-            CI-&gt;eraseFromParent();
-            MadeChange = true;
-            break;
-          case Intrinsic::gcread:
-            // Handle llvm.gcread.
-            CI-&gt;eraseFromParent();
-            MadeChange = true;
-            break;
-          case Intrinsic::gcroot:
-            // Handle llvm.gcroot.
-            CI-&gt;eraseFromParent();
-            MadeChange = true;
-            break;
-          }
-  
-  return MadeChange;
-}</pre></blockquote>
-
-</div>
-
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="safe-points">Generating safe points: <tt>NeededSafePoints</tt></a>
-</div>
-
-<div class="doc_text">
-
-<p>LLVM can compute four kinds of safe points:</p>
-
-<blockquote><pre
->namespace GC {
-  /// PointKind - The type of a collector-safe point.
-  /// 
-  enum PointKind {
-    Loop,    //&lt; Instr is a loop (backwards branch).
-    Return,  //&lt; Instr is a return instruction.
-    PreCall, //&lt; Instr is a call instruction.
-    PostCall //&lt; Instr is the return address of a call.
-  };
-}</pre></blockquote>
-
-<p>A collector can request any combination of the four by setting the 
-<tt>NeededSafePoints</tt> mask:</p>
-
-<blockquote><pre
->MyGC::MyGC() {
-  NeededSafePoints = 1 &lt;&lt; GC::Loop
-                   | 1 &lt;&lt; GC::Return
-                   | 1 &lt;&lt; GC::PreCall
-                   | 1 &lt;&lt; GC::PostCall;
-}</pre></blockquote>
-
-<p>It can then use the following routines to access safe points.</p>
-
-<blockquote><pre
->for (iterator I = begin(), E = end(); I != E; ++I) {
-  GCFunctionInfo *MD = *I;
-  size_t PointCount = MD-&gt;size();
-
-  for (GCFunctionInfo::iterator PI = MD-&gt;begin(),
-                                PE = MD-&gt;end(); PI != PE; ++PI) {
-    GC::PointKind PointKind = PI-&gt;Kind;
-    unsigned PointNum = PI-&gt;Num;
-  }
-}
-</pre></blockquote>
-
-<p>Almost every collector requires <tt>PostCall</tt> safe points, since these
-correspond to the moments when the function is suspended during a call to a
-subroutine.</p>
-
-<p>Threaded programs generally require <tt>Loop</tt> safe points to guarantee
-that the application will reach a safe point within a bounded amount of time,
-even if it is executing a long-running loop which contains no function
-calls.</p>
-
-<p>Threaded collectors may also require <tt>Return</tt> and <tt>PreCall</tt>
-safe points to implement "stop the world" techniques using self-modifying code,
-where it is important that the program not exit the function without reaching a
-safe point (because only the topmost function has been patched).</p>
-
-</div>
-
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="assembly">Emitting assembly code: <tt>GCMetadataPrinter</tt></a>
-</div>
-
-<div class="doc_text">
-
-<p>LLVM allows a plugin to print arbitrary assembly code before and after the
-rest of a module's assembly code. At the end of the module, the GC can compile
-the LLVM stack map into assembly code. (At the beginning, this information is not
-yet computed.)</p>
-
-<p>Since AsmWriter and CodeGen are separate components of LLVM, a separate
-abstract base class and registry is provided for printing assembly code, the
-<tt>GCMetadaPrinter</tt> and <tt>GCMetadataPrinterRegistry</tt>. The AsmWriter
-will look for such a subclass if the <tt>GCStrategy</tt> sets
-<tt>UsesMetadata</tt>:</p>
-
-<blockquote><pre
->MyGC::MyGC() {
-  UsesMetadata = true;
-}</pre></blockquote>
-
-<p>This separation allows JIT-only clients to be smaller.</p>
-
-<p>Note that LLVM does not currently have analogous APIs to support code
-generation in the JIT, nor using the object writers.</p>
-
-<blockquote><pre
->// lib/MyGC/MyGCPrinter.cpp - Example LLVM GC printer
-
-#include "llvm/CodeGen/GCMetadataPrinter.h"
-#include "llvm/Support/Compiler.h"
-
-using namespace llvm;
-
-namespace {
-  class VISIBILITY_HIDDEN MyGCPrinter : public GCMetadataPrinter {
-  public:
-    virtual void beginAssembly(std::ostream &amp;OS, AsmPrinter &amp;AP,
-                               const TargetAsmInfo &amp;TAI);
-  
-    virtual void finishAssembly(std::ostream &amp;OS, AsmPrinter &amp;AP,
-                                const TargetAsmInfo &amp;TAI);
-  };
-  
-  GCMetadataPrinterRegistry::Add&lt;MyGCPrinter&gt;
-  X("mygc", "My bespoke garbage collector.");
-}</pre></blockquote>
-
-<p>The collector should use <tt>AsmPrinter</tt> and <tt>TargetAsmInfo</tt> to
-print portable assembly code to the <tt>std::ostream</tt>. The collector itself
-contains the stack map for the entire module, and may access the
-<tt>GCFunctionInfo</tt> using its own <tt>begin()</tt> and <tt>end()</tt>
-methods. Here's a realistic example:</p>
-
-<blockquote><pre
->#include "llvm/CodeGen/AsmPrinter.h"
-#include "llvm/Function.h"
-#include "llvm/Target/TargetMachine.h"
-#include "llvm/Target/TargetData.h"
-#include "llvm/Target/TargetAsmInfo.h"
-
-void MyGCPrinter::beginAssembly(std::ostream &amp;OS, AsmPrinter &amp;AP,
-                                const TargetAsmInfo &amp;TAI) {
-  // Nothing to do.
-}
-
-void MyGCPrinter::finishAssembly(std::ostream &amp;OS, AsmPrinter &amp;AP,
-                                 const TargetAsmInfo &amp;TAI) {
-  // Set up for emitting addresses.
-  const char *AddressDirective;
-  int AddressAlignLog;
-  if (AP.TM.getTargetData()->getPointerSize() == sizeof(int32_t)) {
-    AddressDirective = TAI.getData32bitsDirective();
-    AddressAlignLog = 2;
-  } else {
-    AddressDirective = TAI.getData64bitsDirective();
-    AddressAlignLog = 3;
-  }
-  
-  // Put this in the data section.
-  AP.SwitchToDataSection(TAI.getDataSection());
-  
-  // For each function...
-  for (iterator FI = begin(), FE = end(); FI != FE; ++FI) {
-    GCFunctionInfo &amp;MD = **FI;
-    
-    // Emit this data structure:
-    // 
-    // struct {
-    //   int32_t PointCount;
-    //   struct {
-    //     void *SafePointAddress;
-    //     int32_t LiveCount;
-    //     int32_t LiveOffsets[LiveCount];
-    //   } Points[PointCount];
-    // } __gcmap_&lt;FUNCTIONNAME&gt;;
-    
-    // Align to address width.
-    AP.EmitAlignment(AddressAlignLog);
-    
-    // Emit the symbol by which the stack map entry can be found.
-    std::string Symbol;
-    Symbol += TAI.getGlobalPrefix();
-    Symbol += "__gcmap_";
-    Symbol += MD.getFunction().getName();
-    if (const char *GlobalDirective = TAI.getGlobalDirective())
-      OS &lt;&lt; GlobalDirective &lt;&lt; Symbol &lt;&lt; "\n";
-    OS &lt;&lt; TAI.getGlobalPrefix() &lt;&lt; Symbol &lt;&lt; ":\n";
-    
-    // Emit PointCount.
-    AP.EmitInt32(MD.size());
-    AP.EOL("safe point count");
-    
-    // And each safe point...
-    for (GCFunctionInfo::iterator PI = MD.begin(),
-                                     PE = MD.end(); PI != PE; ++PI) {
-      // Align to address width.
-      AP.EmitAlignment(AddressAlignLog);
-      
-      // Emit the address of the safe point.
-      OS &lt;&lt; AddressDirective
-         &lt;&lt; TAI.getPrivateGlobalPrefix() &lt;&lt; "label" &lt;&lt; PI-&gt;Num;
-      AP.EOL("safe point address");
-      
-      // Emit the stack frame size.
-      AP.EmitInt32(MD.getFrameSize());
-      AP.EOL("stack frame size");
-      
-      // Emit the number of live roots in the function.
-      AP.EmitInt32(MD.live_size(PI));
-      AP.EOL("live root count");
-      
-      // And for each live root...
-      for (GCFunctionInfo::live_iterator LI = MD.live_begin(PI),
-                                            LE = MD.live_end(PI);
-                                            LI != LE; ++LI) {
-        // Print its offset within the stack frame.
-        AP.EmitInt32(LI-&gt;StackOffset);
-        AP.EOL("stack offset");
-      }
-    }
-  }
-}
-</pre></blockquote>
-
-</div>
-
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="references">References</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p><a name="appel89">[Appel89]</a> Runtime Tags Aren't Necessary. Andrew
-W. Appel. Lisp and Symbolic Computation 19(7):703-705, July 1989.</p>
-
-<p><a name="goldberg91">[Goldberg91]</a> Tag-free garbage collection for
-strongly typed programming languages. Benjamin Goldberg. ACM SIGPLAN
-PLDI'91.</p>
-
-<p><a name="tolmach94">[Tolmach94]</a> Tag-free garbage collection using
-explicit type parameters. Andrew Tolmach. Proceedings of the 1994 ACM
-conference on LISP and functional programming.</p>
-
-<p><a name="henderson02">[Henderson2002]</a> <a
-href="http://citeseer.ist.psu.edu/henderson02accurate.html">
-Accurate Garbage Collection in an Uncooperative Environment</a>.
-Fergus Henderson. International Symposium on Memory Management 2002.</p>
-
-</div>
-
-
-<!-- *********************************************************************** -->
-
-<hr>
-<address>
-  <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
-  src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS"></a>
-  <a href="http://validator.w3.org/check/referer"><img
-  src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
-
-  <a href="mailto:sabre at nondot.org">Chris Lattner</a><br>
-  <a href="http://llvm.org">LLVM Compiler Infrastructure</a><br>
-  Last modified: $Date$
-</address>
-
-</body>
-</html>
diff --git a/libclamav/c++/llvm/docs/GetElementPtr.html b/libclamav/c++/llvm/docs/GetElementPtr.html
deleted file mode 100644
index dd49ef7..0000000
--- a/libclamav/c++/llvm/docs/GetElementPtr.html
+++ /dev/null
@@ -1,371 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-                      "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-  <title>The Often Misunderstood GEP Instruction</title>
-  <link rel="stylesheet" href="llvm.css" type="text/css">
-  <style type="text/css">
-    TABLE   { text-align: left; border: 1px solid black; border-collapse: collapse; margin: 0 0 0 0; }
-  </style>
-</head>
-<body>
-
-<div class="doc_title">
-  The Often Misunderstood GEP Instruction
-</div>
-
-<ol>
-  <li><a href="#intro">Introduction</a></li>
-  <li><a href="#questions">The Questions</a>
-  <ol>
-    <li><a href="#extra_index">Why is the extra 0 index required?</a></li>
-    <li><a href="#deref">What is dereferenced by GEP?</a></li>
-    <li><a href="#firstptr">Why can you index through the first pointer but not
-      subsequent ones?</a></li>
-    <li><a href="#lead0">Why don't GEP x,0,0,1 and GEP x,1 alias? </a></li>
-    <li><a href="#trail0">Why do GEP x,1,0,0 and GEP x,1 alias? </a></li>
-  </ol></li>
-  <li><a href="#summary">Summary</a></li>
-</ol>
-
-<div class="doc_author">
-  <p>Written by: <a href="mailto:rspencer at reidspencer.com">Reid Spencer</a>.</p>
-</div>
-
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="intro"><b>Introduction</b></a></div>
-<!-- *********************************************************************** -->
-<div class="doc_text"> 
-  <p>This document seeks to dispel the mystery and confusion surrounding LLVM's
-  GetElementPtr (GEP) instruction. Questions about the wiley GEP instruction are
-  probably the most frequently occurring questions once a developer gets down to
-  coding with LLVM. Here we lay out the sources of confusion and show that the
-  GEP instruction is really quite simple.
-  </p>
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="questions"><b>The Questions</b></a></div>
-<!-- *********************************************************************** -->
-<div class="doc_text">
-  <p>When people are first confronted with the GEP instruction, they tend to
-  relate it to known concepts from other programming paradigms, most notably C
-  array indexing and field selection. However, GEP is a little different and
-  this leads to the following questions; all of which are answered in the
-  following sections.</p>
-  <ol>
-    <li><a href="#firstptr">What is the first index of the GEP instruction?</a>
-    </li>
-    <li><a href="#extra_index">Why is the extra 0 index required?</a></li>
-    <li><a href="#deref">What is dereferenced by GEP?</a></li>
-    <li><a href="#lead0">Why don't GEP x,0,0,1 and GEP x,1 alias? </a></li>
-    <li><a href="#trail0">Why do GEP x,1,0,0 and GEP x,1 alias? </a></li>
-  </ol>
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_subsection">
-  <a name="firstptr"><b>What is the first index of the GEP instruction?</b></a>
-</div>
-<div class="doc_text">
-  <p>Quick answer: The index stepping through the first operand.</p> 
-  <p>The confusion with the first index usually arises from thinking about 
-  the GetElementPtr instruction as if it was a C index operator. They aren't the
-  same. For example, when we write, in "C":</p>
-
-<div class="doc_code">
-<pre>
-AType *Foo;
-...
-X = &amp;Foo-&gt;F;
-</pre>
-</div>
-
-  <p>it is natural to think that there is only one index, the selection of the
-  field <tt>F</tt>.  However, in this example, <tt>Foo</tt> is a pointer. That 
-  pointer must be indexed explicitly in LLVM. C, on the other hand, indexs
-  through it transparently.  To arrive at the same address location as the C 
-  code, you would provide the GEP instruction with two index operands. The 
-  first operand indexes through the pointer; the second operand indexes the 
-  field <tt>F</tt> of the structure, just as if you wrote:</p>
-
-<div class="doc_code">
-<pre>
-X = &amp;Foo[0].F;
-</pre>
-</div>
-
-  <p>Sometimes this question gets rephrased as:</p>
-  <blockquote><p><i>Why is it okay to index through the first pointer, but 
-      subsequent pointers won't be dereferenced?</i></p></blockquote> 
-  <p>The answer is simply because memory does not have to be accessed to 
-  perform the computation. The first operand to the GEP instruction must be a 
-  value of a pointer type. The value of the pointer is provided directly to 
-  the GEP instruction as an operand without any need for accessing memory. It 
-  must, therefore be indexed and requires an index operand. Consider this 
-  example:</p>
-
-<div class="doc_code">
-<pre>
-struct munger_struct {
-  int f1;
-  int f2;
-};
-void munge(struct munger_struct *P) {
-  P[0].f1 = P[1].f1 + P[2].f2;
-}
-...
-munger_struct Array[3];
-...
-munge(Array);
-</pre>
-</div>
-
-  <p>In this "C" example, the front end compiler (llvm-gcc) will generate three
-  GEP instructions for the three indices through "P" in the assignment
-  statement.  The function argument <tt>P</tt> will be the first operand of each
-  of these GEP instructions.  The second operand indexes through that pointer.
-  The third operand will be the field offset into the 
-  <tt>struct munger_struct</tt> type,  for either the <tt>f1</tt> or 
-  <tt>f2</tt> field. So, in LLVM assembly the <tt>munge</tt> function looks 
-  like:</p>
-
-<div class="doc_code">
-<pre>
-void %munge(%struct.munger_struct* %P) {
-entry:
-  %tmp = getelementptr %struct.munger_struct* %P, i32 1, i32 0
-  %tmp = load i32* %tmp
-  %tmp6 = getelementptr %struct.munger_struct* %P, i32 2, i32 1
-  %tmp7 = load i32* %tmp6
-  %tmp8 = add i32 %tmp7, %tmp
-  %tmp9 = getelementptr %struct.munger_struct* %P, i32 0, i32 0
-  store i32 %tmp8, i32* %tmp9
-  ret void
-}
-</pre>
-</div>
-
-  <p>In each case the first operand is the pointer through which the GEP
-  instruction starts. The same is true whether the first operand is an
-  argument, allocated memory, or a global variable. </p>
-  <p>To make this clear, let's consider a more obtuse example:</p>
-
-<div class="doc_code">
-<pre>
-%MyVar = unintialized global i32
-...
-%idx1 = getelementptr i32* %MyVar, i64 0
-%idx2 = getelementptr i32* %MyVar, i64 1
-%idx3 = getelementptr i32* %MyVar, i64 2
-</pre>
-</div>
-
-  <p>These GEP instructions are simply making address computations from the 
-  base address of <tt>MyVar</tt>.  They compute, as follows (using C syntax):
-  </p>
-
-<div class="doc_code">
-<pre>
-idx1 = (char*) &amp;MyVar + 0
-idx2 = (char*) &amp;MyVar + 4
-idx3 = (char*) &amp;MyVar + 8
-</pre>
-</div>
-
-  <p>Since the type <tt>i32</tt> is known to be four bytes long, the indices 
-  0, 1 and 2 translate into memory offsets of 0, 4, and 8, respectively. No 
-  memory is accessed to make these computations because the address of 
-  <tt>%MyVar</tt> is passed directly to the GEP instructions.</p>
-  <p>The obtuse part of this example is in the cases of <tt>%idx2</tt> and 
-  <tt>%idx3</tt>. They result in the computation of addresses that point to
-  memory past the end of the <tt>%MyVar</tt> global, which is only one
-  <tt>i32</tt> long, not three <tt>i32</tt>s long.  While this is legal in LLVM,
-  it is inadvisable because any load or store with the pointer that results 
-  from these GEP instructions would produce undefined results.</p>
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_subsection">
-  <a name="extra_index"><b>Why is the extra 0 index required?</b></a>
-</div>
-<!-- *********************************************************************** -->
-<div class="doc_text">
-  <p>Quick answer: there are no superfluous indices.</p>
-  <p>This question arises most often when the GEP instruction is applied to a
-  global variable which is always a pointer type. For example, consider
-  this:</p>
-
-<div class="doc_code">
-<pre>
-%MyStruct = uninitialized global { float*, i32 }
-...
-%idx = getelementptr { float*, i32 }* %MyStruct, i64 0, i32 1
-</pre>
-</div>
-
-  <p>The GEP above yields an <tt>i32*</tt> by indexing the <tt>i32</tt> typed 
-  field of the structure <tt>%MyStruct</tt>. When people first look at it, they 
-  wonder why the <tt>i64 0</tt> index is needed. However, a closer inspection 
-  of how globals and GEPs work reveals the need. Becoming aware of the following
-  facts will dispell the confusion:</p>
-  <ol>
-    <li>The type of <tt>%MyStruct</tt> is <i>not</i> <tt>{ float*, i32 }</tt> 
-    but rather <tt>{ float*, i32 }*</tt>. That is, <tt>%MyStruct</tt> is a 
-    pointer to a structure containing a pointer to a <tt>float</tt> and an 
-    <tt>i32</tt>.</li>
-    <li>Point #1 is evidenced by noticing the type of the first operand of 
-    the GEP instruction (<tt>%MyStruct</tt>) which is 
-    <tt>{ float*, i32 }*</tt>.</li>
-    <li>The first index, <tt>i64 0</tt> is required to step over the global
-    variable <tt>%MyStruct</tt>.  Since the first argument to the GEP
-    instruction must always be a value of pointer type, the first index 
-    steps through that pointer. A value of 0 means 0 elements offset from that
-    pointer.</li>
-    <li>The second index, <tt>i32 1</tt> selects the second field of the
-    structure (the <tt>i32</tt>). </li>
-  </ol>
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_subsection">
-  <a name="deref"><b>What is dereferenced by GEP?</b></a>
-</div>
-<div class="doc_text">
-  <p>Quick answer: nothing.</p> 
-  <p>The GetElementPtr instruction dereferences nothing. That is, it doesn't
-  access memory in any way. That's what the Load and Store instructions are for.
-  GEP is only involved in the computation of addresses. For example, consider 
-  this:</p>
-
-<div class="doc_code">
-<pre>
-%MyVar = uninitialized global { [40 x i32 ]* }
-...
-%idx = getelementptr { [40 x i32]* }* %MyVar, i64 0, i32 0, i64 0, i64 17
-</pre>
-</div>
-
-  <p>In this example, we have a global variable, <tt>%MyVar</tt> that is a
-  pointer to a structure containing a pointer to an array of 40 ints. The 
-  GEP instruction seems to be accessing the 18th integer of the structure's
-  array of ints. However, this is actually an illegal GEP instruction. It 
-  won't compile. The reason is that the pointer in the structure <i>must</i>
-  be dereferenced in order to index into the array of 40 ints. Since the 
-  GEP instruction never accesses memory, it is illegal.</p>
-  <p>In order to access the 18th integer in the array, you would need to do the
-  following:</p>
-
-<div class="doc_code">
-<pre>
-%idx = getelementptr { [40 x i32]* }* %, i64 0, i32 0
-%arr = load [40 x i32]** %idx
-%idx = getelementptr [40 x i32]* %arr, i64 0, i64 17
-</pre>
-</div>
-
-  <p>In this case, we have to load the pointer in the structure with a load
-  instruction before we can index into the array. If the example was changed 
-  to:</p>
-
-<div class="doc_code">
-<pre>
-%MyVar = uninitialized global { [40 x i32 ] }
-...
-%idx = getelementptr { [40 x i32] }*, i64 0, i32 0, i64 17
-</pre>
-</div>
-
-  <p>then everything works fine. In this case, the structure does not contain a
-  pointer and the GEP instruction can index through the global variable,
-  into the first field of the structure and access the 18th <tt>i32</tt> in the 
-  array there.</p>
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_subsection">
-  <a name="lead0"><b>Why don't GEP x,0,0,1 and GEP x,1 alias?</b></a>
-</div>
-<div class="doc_text">
-  <p>Quick Answer: They compute different address locations.</p>
-  <p>If you look at the first indices in these GEP
-  instructions you find that they are different (0 and 1), therefore the address
-  computation diverges with that index. Consider this example:</p>
-
-<div class="doc_code">
-<pre>
-%MyVar = global { [10 x i32 ] }
-%idx1 = getlementptr { [10 x i32 ] }* %MyVar, i64 0, i32 0, i64 1
-%idx2 = getlementptr { [10 x i32 ] }* %MyVar, i64 1
-</pre>
-</div>
-
-  <p>In this example, <tt>idx1</tt> computes the address of the second integer
-  in the array that is in the structure in <tt>%MyVar</tt>, that is
-  <tt>MyVar+4</tt>. The type of <tt>idx1</tt> is <tt>i32*</tt>. However,
-  <tt>idx2</tt> computes the address of <i>the next</i> structure after
-  <tt>%MyVar</tt>. The type of <tt>idx2</tt> is <tt>{ [10 x i32] }*</tt> and its
-  value is equivalent to <tt>MyVar + 40</tt> because it indexes past the ten
-  4-byte integers in <tt>MyVar</tt>. Obviously, in such a situation, the
-  pointers don't alias.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_subsection">
-  <a name="trail0"><b>Why do GEP x,1,0,0 and GEP x,1 alias?</b></a>
-</div>
-<div class="doc_text">
-  <p>Quick Answer: They compute the same address location.</p>
-  <p>These two GEP instructions will compute the same address because indexing
-  through the 0th element does not change the address. However, it does change
-  the type. Consider this example:</p>
-
-<div class="doc_code">
-<pre>
-%MyVar = global { [10 x i32 ] }
-%idx1 = getlementptr { [10 x i32 ] }* %MyVar, i64 1, i32 0, i64 0
-%idx2 = getlementptr { [10 x i32 ] }* %MyVar, i64 1
-</pre>
-</div>
-
-  <p>In this example, the value of <tt>%idx1</tt> is <tt>%MyVar+40</tt> and
-  its type is <tt>i32*</tt>. The value of <tt>%idx2</tt> is also 
-  <tt>MyVar+40</tt> but its type is <tt>{ [10 x i32] }*</tt>.</p>
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="summary"><b>Summary</b></a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-  <p>In summary, here's some things to always remember about the GetElementPtr
-  instruction:</p>
-  <ol>
-    <li>The GEP instruction never accesses memory, it only provides pointer
-    computations.</li>
-    <li>The first operand to the GEP instruction is always a pointer and it must
-    be indexed.</li>
-    <li>There are no superfluous indices for the GEP instruction.</li>
-    <li>Trailing zero indices are superfluous for pointer aliasing, but not for
-    the types of the pointers.</li>
-    <li>Leading zero indices are not superfluous for pointer aliasing nor the
-    types of the pointers.</li>
-  </ol>
-</div>
-
-<!-- *********************************************************************** -->
-
-<hr>
-<address>
-  <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
-  src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS"></a>
-  <a href="http://validator.w3.org/check/referer"><img
-  src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
-  <a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br/>
-  Last modified: $Date$
-</address>
-</body>
-</html>
diff --git a/libclamav/c++/llvm/docs/GettingStarted.html b/libclamav/c++/llvm/docs/GettingStarted.html
deleted file mode 100644
index 89253b6..0000000
--- a/libclamav/c++/llvm/docs/GettingStarted.html
+++ /dev/null
@@ -1,1673 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-                      "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-  <title>Getting Started with LLVM System</title>
-  <link rel="stylesheet" href="llvm.css" type="text/css">
-</head>
-<body>
-
-<div class="doc_title">
-  Getting Started with the LLVM System  
-</div>
-
-<ul>
-  <li><a href="#overview">Overview</a>
-  <li><a href="#quickstart">Getting Started Quickly (A Summary)</a>
-  <li><a href="#requirements">Requirements</a>
-    <ol>
-      <li><a href="#hardware">Hardware</a></li>
-      <li><a href="#software">Software</a></li>
-      <li><a href="#brokengcc">Broken versions of GCC and other tools</a></li>
-    </ol></li>
-
-  <li><a href="#starting">Getting Started with LLVM</a>
-    <ol>
-      <li><a href="#terminology">Terminology and Notation</a></li>
-      <li><a href="#environment">Setting Up Your Environment</a></li>
-      <li><a href="#unpack">Unpacking the LLVM Archives</a></li>
-      <li><a href="#checkout">Checkout LLVM from Subversion</a></li>
-      <li><a href="#installcf">Install the GCC Front End</a></li>
-      <li><a href="#config">Local LLVM Configuration</a></li>
-      <li><a href="#compile">Compiling the LLVM Suite Source Code</a></li>
-      <li><a href="#cross-compile">Cross-Compiling LLVM</a></li>
-      <li><a href="#objfiles">The Location of LLVM Object Files</a></li>
-      <li><a href="#optionalconfig">Optional Configuration Items</a></li>
-    </ol></li>
-
-  <li><a href="#layout">Program layout</a>
-    <ol>
-      <li><a href="#examples"><tt>llvm/examples</tt></a></li>
-      <li><a href="#include"><tt>llvm/include</tt></a></li>
-      <li><a href="#lib"><tt>llvm/lib</tt></a></li>
-      <li><a href="#projects"><tt>llvm/projects</tt></a></li>
-      <li><a href="#runtime"><tt>llvm/runtime</tt></a></li>
-      <li><a href="#test"><tt>llvm/test</tt></a></li>
-      <li><a href="#llvmtest"><tt>llvm-test</tt></a></li>
-      <li><a href="#tools"><tt>llvm/tools</tt></a></li>
-      <li><a href="#utils"><tt>llvm/utils</tt></a></li>
-      <li><a href="#win32"><tt>llvm/win32</tt></a></li>
-    </ol></li>
-
-  <li><a href="#tutorial">An Example Using the LLVM Tool Chain</a>
-      <ol>
-         <li><a href="#tutorial4">Example with llvm-gcc4</a></li>
-      </ol>
-  <li><a href="#problems">Common Problems</a>
-  <li><a href="#links">Links</a>
-</ul>
-
-<div class="doc_author">
-  <p>Written by: 
-    <a href="mailto:criswell at uiuc.edu">John Criswell</a>, 
-    <a href="mailto:sabre at nondot.org">Chris Lattner</a>,
-    <a href="http://misha.brukman.net">Misha Brukman</a>, 
-    <a href="http://www.cs.uiuc.edu/~vadve">Vikram Adve</a>, and
-    <a href="mailto:gshi1 at uiuc.edu">Guochun Shi</a>.
-  </p>
-</div>
-
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="overview"><b>Overview</b></a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>Welcome to LLVM! In order to get started, you first need to know some
-basic information.</p>
-
-<p>First, LLVM comes in two pieces. The first piece is the LLVM suite. This
-contains all of the tools, libraries, and header files needed to use the low
-level virtual machine.  It contains an assembler, disassembler, bitcode
-analyzer and bitcode optimizer.  It also contains a test suite that can be
-used to test the LLVM tools and the GCC front end.</p>
-
-<p>The second piece is the GCC front end.  This component provides a version of
-GCC that compiles C and C++ code into LLVM bitcode.  Currently, the GCC front
-end uses the GCC parser to convert code to LLVM.  Once
-compiled into LLVM bitcode, a program can be manipulated with the LLVM tools
-from the LLVM suite.</p>
-
-<p>
-There is a third, optional piece called llvm-test.  It is a suite of programs
-with a testing harness that can be used to further test LLVM's functionality
-and performance.
-</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="quickstart"><b>Getting Started Quickly (A Summary)</b></a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>Here's the short story for getting up and running quickly with LLVM:</p>
-
-<ol>
-  <li>Read the documentation.</li>
-  <li>Read the documentation.</li>
-  <li>Remember that you were warned twice about reading the documentation.</li>
-  <li>Install the llvm-gcc-4.2 front end if you intend to compile C or C++
-      (see <a href="#installcf">Install the GCC Front End</a> for details):</li>
-    <ol>
-      <li><tt>cd <i>where-you-want-the-C-front-end-to-live</i></tt></li>
-      <li><tt>gunzip --stdout llvm-gcc-4.2-<i>version</i>-<i>platform</i>.tar.gz | tar -xvf -</tt></li>
-	  <li><tt><i>install-binutils-binary-from-MinGW</i></tt> (Windows only)</li>
-	  <li>Note: If the binary extension is "<tt>.bz</tt>" use <tt>bunzip2</tt> instead of <tt>gunzip</tt>.</li>
-	  <li>Note: On Windows, use <a href="http://www.7-zip.org">7-Zip</a> or a similar archiving tool.</li>
-	  <li>Add <tt>llvm-gcc</tt>'s "<tt>bin</tt>" directory to your <tt>PATH</tt> environment variable.</li>
-    </ol></li>
-
-  <li>Get the LLVM Source Code
-  <ul>
-    <li>With the distributed files (or use <a href="#checkout">SVN</a>):
-    <ol>
-      <li><tt>cd <i>where-you-want-llvm-to-live</i></tt>
-      <li><tt>gunzip --stdout llvm-<i>version</i>.tar.gz | tar -xvf -</tt>
-    </ol></li>
-
-  </ul></li>
-
-  <li><b>[Optional]</b> Get the Test Suite Source Code 
-  <ul>
-    <li>With the distributed files (or use <a href="#checkout">SVN</a>):
-    <ol>
-      <li><tt>cd <i>where-you-want-llvm-to-live</i></tt>
-      <li><tt>cd llvm/projects</tt>
-      <li><tt>gunzip --stdout llvm-test-<i>version</i>.tar.gz | tar -xvf -</tt>
-    </ol></li>
-
-  </ul></li>
-
-
-  <li>Configure the LLVM Build Environment
-  <ol>
-    <li><tt>cd <i>where-you-want-to-build-llvm</i></tt></li>
-    <li><tt><i>/path/to/llvm/</i>configure [options]</tt><br>
-    Some common options:
-
-      <ul>
-        <li><tt>--prefix=<i>directory</i></tt>
-        <p>Specify for <i>directory</i> the full pathname of where you
-        want the LLVM tools and libraries to be installed (default
-        <tt>/usr/local</tt>).</p></li>
-        <li><tt>--with-llvmgccdir=<i>directory</i></tt>
-        <p>Optionally, specify for <i>directory</i> the full pathname of the 
-        C/C++ front end installation to use with this LLVM configuration. If
-        not specified, the PATH will be searched.  This is only needed if you
-        want to run the testsuite or do some special kinds of LLVM builds.</p></li>
-        <li><tt>--enable-spec2000=<i>directory</i></tt>
-            <p>Enable the SPEC2000 benchmarks for testing.  The SPEC2000
-            benchmarks should be available in
-            <tt><i>directory</i></tt>.</p></li>
-      </ul>
-  </ol></li>
-
-  <li>Build the LLVM Suite:
-  <ol>
-      <li><tt>gmake -k |&amp; tee gnumake.out
-      &nbsp;&nbsp;&nbsp;# this is csh or tcsh syntax</tt></li>
-      <li>If you get an "internal compiler error (ICE)" or test failures, see 
-          <a href="#brokengcc">below</a>.</li>
-  </ol>
-
-</ol>
-
-<p>Consult the <a href="#starting">Getting Started with LLVM</a> section for
-detailed information on configuring and compiling LLVM.  See <a
-href="#environment">Setting Up Your Environment</a> for tips that simplify
-working with the GCC front end and LLVM tools.  Go to <a href="#layout">Program
-Layout</a> to learn about the layout of the source code tree.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="requirements"><b>Requirements</b></a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>Before you begin to use the LLVM system, review the requirements given below.
-This may save you some trouble by knowing ahead of time what hardware and
-software you will need.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="hardware"><b>Hardware</b></a>
-</div>
-
-<div class="doc_text">
-
-<p>LLVM is known to work on the following platforms:</p>
-
-<table cellpadding="3" summary="Known LLVM platforms">
-<tr>
-  <th>OS</th>
-  <th>Arch</th>
-  <th>Compilers</th>
-</tr>
-<tr>
-  <td>AuroraUX</td>
-  <td>x86<sup><a href="#pf_1">1</a></sup></td>
-  <td>GCC</td>
-</tr>
-<tr>
-  <td>Linux</td>
-  <td>x86<sup><a href="#pf_1">1</a></sup></td>
-  <td>GCC</td>
-</tr>
-<tr>
-  <td>Linux</td>
-  <td>amd64</td>
-  <td>GCC</td>
-</tr>
-<tr>
-  <td>Solaris</td>
-  <td>V9 (Ultrasparc)</td>
-  <td>GCC</td>
-</tr>
-<tr>
-  <td>FreeBSD</td>
-  <td>x86<sup><a href="#pf_1">1</a></sup></td>
-  <td>GCC</td>
-</tr>
-<tr>
-  <td>MacOS X<sup><a href="#pf_2">2</a></sup></td>
-  <td>PowerPC</td>
-  <td>GCC</td>
-</tr>
-<tr>
-  <td>MacOS X<sup><a href="#pf_2">2</a>,<a href="#pf_9">9</a></sup></td>
-  <td>x86</td>
-  <td>GCC</td>
-</tr>
-<tr>
-  <td>Cygwin/Win32</td>
-  <td>x86<sup><a href="#pf_1">1</a>,<a href="#pf_8">8</a>,
-     <a href="#pf_11">11</a></sup></td>
-  <td>GCC 3.4.X, binutils 2.20</td>
-</tr>
-<tr>
-  <td>MinGW/Win32</td>
-  <td>x86<sup><a href="#pf_1">1</a>,<a href="#pf_6">6</a>,
-     <a href="#pf_8">8</a>, <a href="#pf_10">10</a></sup></td>
-  <td>GCC 3.4.X, binutils 2.20</td>
-</tr>
-</table>
-
-<p>LLVM has partial support for the following platforms:</p>
-
-<table summary="LLVM partial platform support">
-<tr>
-  <th>OS</th>
-  <th>Arch</th>
-  <th>Compilers</th>
-</tr>
-<tr>
-  <td>Windows</td>
-  <td>x86<sup><a href="#pf_1">1</a></sup></td>
-  <td>Visual Studio 2005 SP1 or higher<sup><a href="#pf_4">4</a>,<a href="#pf_5">5</a></sup></td>
-<tr>
-  <td>AIX<sup><a href="#pf_3">3</a>,<a href="#pf_4">4</a></sup></td>
-  <td>PowerPC</td>
-  <td>GCC</td>
-</tr>
-<tr>
-  <td>Linux<sup><a href="#pf_3">3</a>,<a href="#pf_5">5</a></sup></td>
-  <td>PowerPC</td>
-  <td>GCC</td>
-</tr>
-
-<tr>
-  <td>Linux<sup><a href="#pf_7">7</a></sup></td>
-  <td>Alpha</td>
-  <td>GCC</td>
-</tr>
-<tr>
-  <td>Linux<sup><a href="#pf_7">7</a></sup></td>
-  <td>Itanium (IA-64)</td>
-  <td>GCC</td>
-</tr>
-<tr>
-  <td>HP-UX<sup><a href="#pf_7">7</a></sup></td>
-  <td>Itanium (IA-64)</td>
-  <td>HP aCC</td>
-</tr>
-</table>
-
-<p><b>Notes:</b></p>
-
-<div class="doc_notes">
-<ol>
-<li><a name="pf_1">Code generation supported for Pentium processors and
-up</a></li>
-<li><a name="pf_2">Code generation supported for 32-bit ABI only</a></li>
-<li><a name="pf_3">No native code generation</a></li>
-<li><a name="pf_4">Build is not complete: one or more tools do not link or function</a></li>
-<li><a name="pf_5">The GCC-based C/C++ frontend does not build</a></li>
-<li><a name="pf_6">The port is done using the MSYS shell.</a></li>
-<li><a name="pf_7">Native code generation exists but is not complete.</a></li>
-<li><a name="pf_8">Binutils 2.20 or later is required to build the assembler
-    generated by LLVM properly.</a></li>
-<li><a name="pf_9">XCode 2.5 and gcc 4.0.1</a> (Apple Build 5370) will trip
-    internal LLVM assert messages when compiled for Release at optimization
-    levels greater than 0 (i.e., <i>"-O1"</i> and higher).
-    Add <i>OPTIMIZE_OPTION="-O0"</i> to the build command line
-    if compiling for LLVM Release or bootstrapping the LLVM toolchain.</li>
-<li><a name="pf_10">For MSYS/MinGW on Windows, be sure to install the MSYS
-    version of the perl package, and be sure it appears in your path
-    before any Windows-based versions such as Strawberry Perl and
-    ActivePerl, as these have Windows-specifics that will cause the
-    build to fail.</a></li>
-<li><a name="pf_11">In general, LLVM modules requiring dynamic linking can
-    not be built on Windows. However, you can build LLVM tools using
-    <i>"make tools-only"</i>.</li>
-</ol>
-</div>
-
-<p>Note that you will need about 1-3 GB of space for a full LLVM build in Debug
-mode, depending on the system (it is so large because of all the debugging
-information and the fact that the libraries are statically linked into multiple
-tools).  If you do not need many of the tools and you are space-conscious, you
-can pass <tt>ONLY_TOOLS="tools you need"</tt> to make.  The Release build
-requires considerably less space.</p>
-
-<p>The LLVM suite <i>may</i> compile on other platforms, but it is not
-guaranteed to do so.  If compilation is successful, the LLVM utilities should be
-able to assemble, disassemble, analyze, and optimize LLVM bitcode.  Code
-generation should work as well, although the generated native code may not work
-on your platform.</p>
-
-<p>The GCC front end is not very portable at the moment.  If you want to get it
-to work on another platform, you can download a copy of the source and <a
-href="GCCFEBuildInstrs.html">try to compile it</a> on your platform.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="software"><b>Software</b></a></div>
-<div class="doc_text">
-  <p>Compiling LLVM requires that you have several software packages 
-  installed. The table below lists those required packages. The Package column
-  is the usual name for the software package that LLVM depends on. The Version
-  column provides "known to work" versions of the package. The Notes column
-  describes how LLVM uses the package and provides other details.</p>
-  <table summary="Packages required to compile LLVM">
-    <tr><th>Package</th><th>Version</th><th>Notes</th></tr>
-
-    <tr>
-      <td><a href="http://savannah.gnu.org/projects/make">GNU Make</a></td>
-      <td>3.79, 3.79.1</td>
-      <td>Makefile/build processor</td>
-    </tr>
-
-    <tr>
-      <td><a href="http://gcc.gnu.org">GCC</a></td>
-      <td>3.4.2</td>
-      <td>C/C++ compiler<sup><a href="#sf1">1</a></sup></td>
-    </tr>
-
-    <tr>
-      <td><a href="http://www.gnu.org/software/texinfo">TeXinfo</a></td>
-      <td>4.5</td>
-      <td>For building the CFE</td>
-    </tr>
-
-    <tr>
-      <td><a href="http://subversion.tigris.org/project_packages.html">SVN</a></td>
-      <td>&ge;1.3</td>
-      <td>Subversion access to LLVM<sup><a href="#sf2">2</a></sup></td>
-    </tr>
-
-    <tr>
-      <td><a href="http://savannah.gnu.org/projects/dejagnu">DejaGnu</a></td>
-      <td>1.4.2</td>
-      <td>Automated test suite<sup><a href="#sf3">3</a></sup></td>
-    </tr>
-
-    <tr>
-      <td><a href="http://www.tcl.tk/software/tcltk/">tcl</a></td>
-      <td>8.3, 8.4</td>
-      <td>Automated test suite<sup><a href="#sf3">3</a></sup></td>
-    </tr>
-
-    <tr>
-      <td><a href="http://expect.nist.gov/">expect</a></td>
-      <td>5.38.0</td>
-      <td>Automated test suite<sup><a href="#sf3">3</a></sup></td>
-    </tr>
-
-    <tr>
-      <td><a href="http://www.perl.com/download.csp">perl</a></td>
-      <td>&ge;5.6.0</td>
-      <td>Nightly tester, utilities</td>
-    </tr>
-
-    <tr>
-      <td><a href="http://savannah.gnu.org/projects/m4">GNU M4</a>
-      <td>1.4</td>
-      <td>Macro processor for configuration<sup><a href="#sf4">4</a></sup></td>
-    </tr>
-
-    <tr>
-      <td><a href="http://www.gnu.org/software/autoconf">GNU Autoconf</a></td>
-      <td>2.60</td>
-      <td>Configuration script builder<sup><a href="#sf4">4</a></sup></td>
-    </tr>
-
-    <tr>
-      <td><a href="http://www.gnu.org/software/automake">GNU Automake</a></td>
-      <td>1.9.6</td>
-      <td>aclocal macro generator<sup><a href="#sf4">4</a></sup></td>
-    </tr>
-
-    <tr>
-      <td><a href="http://savannah.gnu.org/projects/libtool">libtool</a></td>
-      <td>1.5.22</td>
-      <td>Shared library manager<sup><a href="#sf4">4</a></sup></td>
-    </tr>
-
-  </table>
-
-  <p><b>Notes:</b></p>
-  <div class="doc_notes">
-  <ol>
-    <li><a name="sf1">Only the C and C++ languages are needed so there's no
-      need to build the other languages for LLVM's purposes.</a> See 
-      <a href="#brokengcc">below</a> for specific version info.</li>
-    <li><a name="sf2">You only need Subversion if you intend to build from the 
-      latest LLVM sources. If you're working from a release distribution, you
-      don't need Subversion.</a></li>
-    <li><a name="sf3">Only needed if you want to run the automated test 
-      suite in the <tt>llvm/test</tt> directory.</a></li>
-    <li><a name="sf4">If you want to make changes to the configure scripts, 
-      you will need GNU autoconf (2.59), and consequently, GNU M4 (version 1.4 
-      or higher). You will also need automake (1.9.2). We only use aclocal 
-      from that package.</a></li>
-  </ol>
-  </div>
-  
-  <p>Additionally, your compilation host is expected to have the usual 
-  plethora of Unix utilities. Specifically:</p>
-  <ul>
-    <li><b>ar</b> - archive library builder</li>
-    <li><b>bzip2*</b> - bzip2 command for distribution generation</li>
-    <li><b>bunzip2*</b> - bunzip2 command for distribution checking</li>
-    <li><b>chmod</b> - change permissions on a file</li>
-    <li><b>cat</b> - output concatenation utility</li>
-    <li><b>cp</b> - copy files</li>
-    <li><b>date</b> - print the current date/time </li>
-    <li><b>echo</b> - print to standard output</li>
-    <li><b>egrep</b> - extended regular expression search utility</li>
-    <li><b>find</b> - find files/dirs in a file system</li>
-    <li><b>grep</b> - regular expression search utility</li>
-    <li><b>gzip*</b> - gzip command for distribution generation</li>
-    <li><b>gunzip*</b> - gunzip command for distribution checking</li>
-    <li><b>install</b> - install directories/files </li>
-    <li><b>mkdir</b> - create a directory</li>
-    <li><b>mv</b> - move (rename) files</li>
-    <li><b>ranlib</b> - symbol table builder for archive libraries</li>
-    <li><b>rm</b> - remove (delete) files and directories</li>
-    <li><b>sed</b> - stream editor for transforming output</li>
-    <li><b>sh</b> - Bourne shell for make build scripts</li>
-    <li><b>tar</b> - tape archive for distribution generation</li>
-    <li><b>test</b> - test things in file system</li>
-    <li><b>unzip*</b> - unzip command for distribution checking</li>
-    <li><b>zip*</b> - zip command for distribution generation</li>
-  </ul>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="brokengcc">Broken versions of GCC and other tools</a>
-</div>
-
-<div class="doc_text">
-
-<p>LLVM is very demanding of the host C++ compiler, and as such tends to expose
-bugs in the compiler.  In particular, several versions of GCC crash when trying
-to compile LLVM.  We routinely use GCC 3.3.3, 3.4.0, and Apple 4.0.1 
-successfully with them (however, see important notes below).  Other versions 
-of GCC will probably work as well.  GCC versions listed
-here are known to not work.  If you are using one of these versions, please try
-to upgrade your GCC to something more recent.  If you run into a problem with a
-version of GCC not listed here, please <a href="mailto:llvmdev at cs.uiuc.edu">let
-us know</a>.  Please use the "<tt>gcc -v</tt>" command to find out which version
-of GCC you are using.
-</p>
-
-<p><b>GCC versions prior to 3.0</b>: GCC 2.96.x and before had several
-problems in the STL that effectively prevent it from compiling LLVM.
-</p>
-
-<p><b>GCC 3.2.2 and 3.2.3</b>: These versions of GCC fails to compile LLVM with
-a bogus template error.  This was fixed in later GCCs.</p>
-
-<p><b>GCC 3.3.2</b>: This version of GCC suffered from a <a 
-href="http://gcc.gnu.org/PR13392">serious bug</a> which causes it to crash in
-the "<tt>convert_from_eh_region_ranges_1</tt>" GCC function.</p>
-
-<p><b>Cygwin GCC 3.3.3</b>: The version of GCC 3.3.3 commonly shipped with 
-   Cygwin does not work.  Please <a href="GCCFEBuildInstrs.html#cygwin">upgrade 
-   to a newer version</a> if possible.</p>
-<p><b>SuSE GCC 3.3.3</b>: The version of GCC 3.3.3 shipped with SuSE 9.1 (and 
-   possibly others) does not compile LLVM correctly (it appears that exception 
-   handling is broken in some cases).  Please download the FSF 3.3.3 or upgrade
-   to a newer version of GCC.</p>
-<p><b>GCC 3.4.0 on linux/x86 (32-bit)</b>: GCC miscompiles portions of the 
-   code generator, causing an infinite loop in the llvm-gcc build when built
-   with optimizations enabled (i.e. a release build).</p>
-<p><b>GCC 3.4.2 on linux/x86 (32-bit)</b>: GCC miscompiles portions of the 
-   code generator at -O3, as with 3.4.0.  However gcc 3.4.2 (unlike 3.4.0)
-   correctly compiles LLVM at -O2.  A work around is to build release LLVM
-   builds with "make ENABLE_OPTIMIZED=1 OPTIMIZE_OPTION=-O2 ..."</p>
-<p><b>GCC 3.4.x on X86-64/amd64</b>: GCC <a href="http://llvm.org/PR1056">
-   miscompiles portions of LLVM</a>.</p>
-<p><b>GCC 3.4.4 (CodeSourcery ARM 2005q3-2)</b>: this compiler miscompiles LLVM
-   when building with optimizations enabled.  It appears to work with 
-   "<tt>make ENABLE_OPTIMIZED=1 OPTIMIZE_OPTION=-O1</tt>" or build a debug
-   build.</p>
-<p><b>IA-64 GCC 4.0.0</b>: The IA-64 version of GCC 4.0.0 is known to
-   miscompile LLVM.</p>
-<p><b>Apple Xcode 2.3</b>: GCC crashes when compiling LLVM at -O3 (which is the
-   default with ENABLE_OPTIMIZED=1.  To work around this, build with 
-   "ENABLE_OPTIMIZED=1 OPTIMIZE_OPTION=-O2".</p>
-<p><b>GCC 4.1.1</b>: GCC fails to build LLVM with template concept check errors
-      compiling some files.  At the time of this writing, GCC mainline (4.2)
-      did not share the problem.</p>
-<p><b>GCC 4.1.1 on X86-64/amd64</b>: GCC <a href="http://llvm.org/PR1063">
-   miscompiles portions of LLVM</a> when compiling llvm itself into 64-bit 
-   code.  LLVM will appear to mostly work but will be buggy, e.g. failing 
-   portions of its testsuite.</p>
-<p><b>GCC 4.1.2 on OpenSUSE</b>: Seg faults during libstdc++ build and on x86_64
-platforms compiling md5.c gets a mangled constant.</p>
-<p><b>GCC 4.1.2 (20061115 (prerelease) (Debian 4.1.1-21)) on Debian</b>: Appears
-to miscompile parts of LLVM 2.4. One symptom is ValueSymbolTable complaining
-about symbols remaining in the table on destruction.</p>
-<p><b>GCC 4.1.2 20071124 (Red Hat 4.1.2-42)</b>: Suffers from the same symptoms
-as the previous one. It appears to work with ENABLE_OPTIMIZED=0 (the default).</p>
-<p><b>Cygwin GCC 4.3.2 20080827 (beta) 2</b>:
-  Users <a href="http://llvm.org/PR4145">reported</a> various problems related
-  with link errors when using this GCC version.</p>
-<p><b>Debian GCC 4.3.2 on X86</b>: Crashes building some files in LLVM 2.6.</p>
-<p><b>GCC 4.3.3 (Debian 4.3.3-10) on ARM</b>: Miscompiles parts of LLVM 2.6
-when optimizations are turned on. The symptom is an infinite loop in
-FoldingSetImpl::RemoveNode while running the code generator.</p>
-<p><b>GNU ld 2.16.X</b>. Some 2.16.X versions of the ld linker will produce very
-long warning messages complaining that some ".gnu.linkonce.t.*" symbol was
-defined in a discarded section. You can safely ignore these messages as they are
-erroneous and the linkage is correct.  These messages disappear using ld
-2.17.</p>
-
-<p><b>GNU binutils 2.17</b>: Binutils 2.17 contains <a 
-href="http://sourceware.org/bugzilla/show_bug.cgi?id=3111">a bug</a> which
-causes huge link times (minutes instead of seconds) when building LLVM.  We
-recommend upgrading to a newer version (2.17.50.0.4 or later).</p>
-
-<p><b>GNU Binutils 2.19.1 Gold</b>: This version of Gold contained
-<a href="http://sourceware.org/bugzilla/show_bug.cgi?id=9836">a bug</a>
-which causes intermittent failures when building LLVM with position independent
-code.  The symptom is an error about cyclic dependencies.  We recommend
-upgrading to a newer version of Gold.</p>
-
-</div>
-
-
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="starting"><b>Getting Started with LLVM</b></a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>The remainder of this guide is meant to get you up and running with
-LLVM and to give you some basic information about the LLVM environment.</p>
-
-<p>The later sections of this guide describe the <a
-href="#layout">general layout</a> of the the LLVM source tree, a <a
-href="#tutorial">simple example</a> using the LLVM tool chain, and <a
-href="#links">links</a> to find more information about LLVM or to get
-help via e-mail.</p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="terminology">Terminology and Notation</a>
-</div>
-
-<div class="doc_text">
-
-<p>Throughout this manual, the following names are used to denote paths
-specific to the local system and working environment.  <i>These are not
-environment variables you need to set but just strings used in the rest
-of this document below</i>.  In any of the examples below, simply replace
-each of these names with the appropriate pathname on your local system.
-All these paths are absolute:</p>
-
-<dl>
-    <dt>SRC_ROOT
-    <dd>
-    This is the top level directory of the LLVM source tree.
-    <br><br>
-
-    <dt>OBJ_ROOT
-    <dd>
-    This is the top level directory of the LLVM object tree (i.e. the
-    tree where object files and compiled programs will be placed.  It
-    can be the same as SRC_ROOT).
-    <br><br>
-
-    <dt>LLVMGCCDIR
-    <dd>
-    This is where the LLVM GCC Front End is installed.
-    <p>
-    For the pre-built GCC front end binaries, the LLVMGCCDIR is
-    <tt>llvm-gcc/<i>platform</i>/llvm-gcc</tt>.
-</dl>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="environment">Setting Up Your Environment</a>
-</div>
-
-<div class="doc_text">
-
-<p>
-In order to compile and use LLVM, you may need to set some environment
-variables.
-
-<dl>
-  <dt><tt>LLVM_LIB_SEARCH_PATH</tt>=<tt>/path/to/your/bitcode/libs</tt></dt>
-  <dd>[Optional] This environment variable helps LLVM linking tools find the
-  locations of your bitcode libraries. It is provided only as a
-  convenience since you can specify the paths using the -L options of the
-  tools and the C/C++ front-end will automatically use the bitcode files
-  installed in its
-  <tt>lib</tt> directory.</dd>
-</dl>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="unpack">Unpacking the LLVM Archives</a>
-</div>
-
-<div class="doc_text">
-
-<p>
-If you have the LLVM distribution, you will need to unpack it before you
-can begin to compile it.  LLVM is distributed as a set of two files: the LLVM
-suite and the LLVM GCC front end compiled for your platform.  There is an
-additional test suite that is optional.  Each file is a TAR archive that is
-compressed with the gzip program.
-</p>
-
-<p>The files are as follows, with <em>x.y</em> marking the version number:
-<dl>
-  <dt><tt>llvm-x.y.tar.gz</tt></dt>
-  <dd>Source release for the LLVM libraries and tools.<br></dd>
-
-  <dt><tt>llvm-test-x.y.tar.gz</tt></dt>
-  <dd>Source release for the LLVM test suite.</dd>
-
-  <dt><tt>llvm-gcc-4.2-x.y.source.tar.gz</tt></dt>
-  <dd>Source release of the llvm-gcc-4.2 front end.  See README.LLVM in the root
-      directory for build instructions.<br></dd>
-
-  <dt><tt>llvm-gcc-4.2-x.y-platform.tar.gz</tt></dt>
-  <dd>Binary release of the llvm-gcc-4.2 front end for a specific platform.<br></dd>
-
-</dl>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="checkout">Checkout LLVM from Subversion</a>
-</div>
-
-<div class="doc_text">
-
-<p>If you have access to our Subversion repository, you can get a fresh copy of
-the entire source code.  All you need to do is check it out from Subversion as
-follows:</p>
-
-<ul>
-  <li><tt>cd <i>where-you-want-llvm-to-live</i></tt></li>
-  <li>Read-Only: <tt>svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm</tt></li>
-  <li>Read-Write:<tt>svn co https://user@llvm.org/svn/llvm-project/llvm/trunk
-    llvm</tt></li>
-</ul>
-
-
-<p>This will create an '<tt>llvm</tt>' directory in the current
-directory and fully populate it with the LLVM source code, Makefiles,
-test directories, and local copies of documentation files.</p>
-
-<p>If you want to get a specific release (as opposed to the most recent
-revision), you can checkout it from the '<tt>tags</tt>' directory (instead of
-'<tt>trunk</tt>'). The following releases are located in the following
-subdirectories of the '<tt>tags</tt>' directory:</p>
-
-<ul>
-<li>Release 2.6: <b>RELEASE_26</b></li>
-<li>Release 2.5: <b>RELEASE_25</b></li>
-<li>Release 2.4: <b>RELEASE_24</b></li>
-<li>Release 2.3: <b>RELEASE_23</b></li>
-<li>Release 2.2: <b>RELEASE_22</b></li>
-<li>Release 2.1: <b>RELEASE_21</b></li>
-<li>Release 2.0: <b>RELEASE_20</b></li>
-<li>Release 1.9: <b>RELEASE_19</b></li>
-<li>Release 1.8: <b>RELEASE_18</b></li>
-<li>Release 1.7: <b>RELEASE_17</b></li>
-<li>Release 1.6: <b>RELEASE_16</b></li>
-<li>Release 1.5: <b>RELEASE_15</b></li>
-<li>Release 1.4: <b>RELEASE_14</b></li>
-<li>Release 1.3: <b>RELEASE_13</b></li>
-<li>Release 1.2: <b>RELEASE_12</b></li>
-<li>Release 1.1: <b>RELEASE_11</b></li>
-<li>Release 1.0: <b>RELEASE_1</b></li>
-</ul>
-
-<p>If you would like to get the LLVM test suite (a separate package as of 1.4),
-you get it from the Subversion repository:</p>
-
-<div class="doc_code">
-<pre>
-% cd llvm/projects
-% svn co http://llvm.org/svn/llvm-project/test-suite/trunk llvm-test
-</pre>
-</div>
-
-<p>By placing it in the <tt>llvm/projects</tt>, it will be automatically
-configured by the LLVM configure script as well as automatically updated when
-you run <tt>svn update</tt>.</p>
-
-<p>If you would like to get the GCC front end source code, you can also get it 
-and build it yourself.  Please follow <a href="GCCFEBuildInstrs.html">these 
-instructions</a> to successfully get and build the LLVM GCC front-end.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="installcf">Install the GCC Front End</a>
-</div>
-
-<div class="doc_text">
-
-<p>Before configuring and compiling the LLVM suite (or if you want to use just the LLVM
-GCC front end) you can optionally extract the front end from the binary distribution.
-It is used for running the llvm-test testsuite and for compiling C/C++ programs.  Note that
-you can optionally <a href="GCCFEBuildInstrs.html">build llvm-gcc yourself</a> after building the
-main LLVM repository.</p>
-
-<p>To install the GCC front end, do the following (on Windows, use an archival tool
-like <a href="http://www.7-zip.org">7-zip</a> that understands gzipped tars):</p>
-
-<ol>
-  <li><tt>cd <i>where-you-want-the-front-end-to-live</i></tt></li>
-  <li><tt>gunzip --stdout llvm-gcc-4.2-<i>version</i>-<i>platform</i>.tar.gz | tar -xvf
-      -</tt></li>
-</ol>
-
-<p>Once the binary is uncompressed, if you're using a *nix-based system, add a symlink for
-<tt>llvm-gcc</tt> and <tt>llvm-g++</tt> to some directory in your path.  If you're using a
-Windows-based system, add the <tt>bin</tt> subdirectory of your front end installation directory
-to your <tt>PATH</tt> environment variable.  For example, if you uncompressed the binary to
-<tt>c:\llvm-gcc</tt>, add <tt>c:\llvm-gcc\bin</tt> to your <tt>PATH</tt>.</p>
-
-<p>If you now want to build LLVM from source, when you configure LLVM, it will 
-automatically detect <tt>llvm-gcc</tt>'s presence (if it is in your path) enabling its
-use in llvm-test.  Note that you can always build or install <tt>llvm-gcc</tt> at any
-point after building the main LLVM repository: just reconfigure llvm and 
-llvm-test will pick it up.
-</p>
-
-<p>As a convenience for Windows users, the front end binaries for MinGW/x86 include
-versions of the required w32api and mingw-runtime binaries.  The last remaining step for
-Windows users is to simply uncompress the binary binutils package from
-<a href="http://mingw.org/">MinGW</a> into your front end installation directory.  While the
-front end installation steps are not quite the same as a typical manual MinGW installation,
-they should be similar enough to those who have previously installed MinGW on Windows systems.</p>
-
-<p>To install binutils on Windows:</p>
-
-<ol>
-  <li><tt><i>download GNU Binutils from <a href="http://sourceforge.net/projects/mingw/files/">MinGW Downloads</a></i></tt></li>
-  <li><tt>cd <i>where-you-uncompressed-the-front-end</i></tt></li>
-  <li><tt><i>uncompress archived binutils directories (not the tar file) into the current directory</i></tt></li>
-</ol>
-
-<p>The binary versions of the LLVM GCC front end may not suit all of your needs.  For
-example, the binary distribution may include an old version of a system header
-file, not "fix" a header file that needs to be fixed for GCC, or it may be linked with
-libraries not available on your system.  In cases like these, you may want to try
-<a href="GCCFEBuildInstrs.html">building the GCC front end from source</a>.  Thankfully,
-this is much easier now than it was in the past.</p>
-
-<p>We also do not currently support updating of the GCC front end by manually overlaying
-newer versions of the w32api and mingw-runtime binary packages that may become available
-from MinGW.  At this time, it's best to think of the MinGW LLVM GCC front end binary as
-a self-contained convenience package that requires Windows users to simply download and
-uncompress the GNU Binutils binary package from the MinGW project.</p>
-
-<p>Regardless of your platform, if you discover that installing the LLVM GCC front end
-binaries is not as easy as previously described, or you would like to suggest improvements,
-please let us know how you would like to see things improved by dropping us a note on our
-<a href="http://llvm.org/docs/#maillist">mailing list</a>.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="config">Local LLVM Configuration</a>
-</div>
-
-<div class="doc_text">
-
-  <p>Once checked out from the Subversion repository, the LLVM suite source 
-  code must be
-configured via the <tt>configure</tt> script.  This script sets variables in the
-various <tt>*.in</tt> files, most notably <tt>llvm/Makefile.config</tt> and 
-<tt>llvm/include/Config/config.h</tt>.  It also populates <i>OBJ_ROOT</i> with 
-the Makefiles needed to begin building LLVM.</p>
-
-<p>The following environment variables are used by the <tt>configure</tt>
-script to configure the build system:</p>
-
-<table summary="LLVM configure script environment variables">
-  <tr><th>Variable</th><th>Purpose</th></tr>
-  <tr>
-    <td>CC</td>
-    <td>Tells <tt>configure</tt> which C compiler to use.  By default,
-        <tt>configure</tt> will look for the first GCC C compiler in
-        <tt>PATH</tt>.  Use this variable to override
-        <tt>configure</tt>'s default behavior.</td>
-  </tr>
-  <tr>
-    <td>CXX</td>
-    <td>Tells <tt>configure</tt> which C++ compiler to use.  By default,
-       <tt>configure</tt> will look for the first GCC C++ compiler in
-       <tt>PATH</tt>.  Use this variable to override
-       <tt>configure</tt>'s default behavior.</td>
-  </tr>
-</table>
-
-<p>The following options can be used to set or enable LLVM specific options:</p>
-
-<dl>
-  <dt><i>--with-llvmgccdir</i></dt>
-  <dd>Path to the LLVM C/C++ FrontEnd to be used with this LLVM configuration. 
-  The value of this option should specify the full pathname of the C/C++ Front
-  End to be used. If this option is not provided, the PATH will be searched for
-  a program named <i>llvm-gcc</i> and the C/C++ FrontEnd install directory will
-  be inferred from the path found. If the option is not given, and no llvm-gcc
-  can be found in the path then a warning will be produced by 
-  <tt>configure</tt> indicating this situation. LLVM may still be built with 
-  the <tt>tools-only</tt> target but attempting to build the runtime libraries
-  will fail as these libraries require llvm-gcc and llvm-g++. See 
-  <a href="#installcf">Install the GCC Front End</a> for details on installing
-  the C/C++ Front End. See
-  <a href="GCCFEBuildInstrs.html">Bootstrapping the LLVM C/C++ Front-End</a>
-  for details on building the C/C++ Front End.</dd>
-  <dt><i>--with-tclinclude</i></dt>
-  <dd>Path to the tcl include directory under which <tt>tclsh</tt> can be
-  found. Use this if you have multiple tcl installations on your machine and you
-  want to use a specific one (8.x) for LLVM. LLVM only uses tcl for running the
-  dejagnu based test suite in <tt>llvm/test</tt>. If you don't specify this
-  option, the LLVM configure script will search for the tcl 8.4 and 8.3
-  releases.
-  <br><br>
-  </dd>
-  <dt><i>--enable-optimized</i></dt>
-  <dd>
-    Enables optimized compilation (debugging symbols are removed
-    and GCC optimization flags are enabled). Note that this is the default 
-    setting     if you are using the LLVM distribution. The default behavior 
-    of an Subversion checkout is to use an unoptimized build (also known as a 
-    debug build).
-    <br><br>
-  </dd>
-  <dt><i>--enable-debug-runtime</i></dt>
-  <dd>
-    Enables debug symbols in the runtime libraries. The default is to strip
-    debug symbols from the runtime libraries. 
-  </dd>
-  <dt><i>--enable-jit</i></dt>
-  <dd>
-    Compile the Just In Time (JIT) compiler functionality.  This is not
-    available
-    on all platforms.  The default is dependent on platform, so it is best
-    to explicitly enable it if you want it.
-    <br><br>
-  </dd>
-  <dt><i>--enable-targets=</i><tt>target-option</tt></dt>
-  <dd>Controls which targets will be built and linked into llc. The default 
-  value for <tt>target_options</tt> is "all" which builds and links all 
-  available targets.  The value "host-only" can be specified to build only a 
-  native compiler (no cross-compiler targets available). The "native" target is 
-  selected as the target of the build host. You can also specify a comma 
-  separated list of target names that you want available in llc. The target 
-  names use all lower case. The current set of targets is: <br>
-  <tt>alpha, ia64, powerpc, skeleton, sparc, x86</tt>.
-  <br><br></dd>
-  <dt><i>--enable-doxygen</i></dt>
-  <dd>Look for the doxygen program and enable construction of doxygen based
-  documentation from the source code. This is disabled by default because 
-  generating the documentation can take a long time and producess 100s of 
-  megabytes of output.</dd>
-  <dt><i>--with-udis86</i></dt>
-  <dd>LLVM can use external disassembler library for various purposes (now it's
-  used only for examining code produced by JIT). This option will enable usage
-  of <a href="http://udis86.sourceforge.net/">udis86</a> x86 (both 32 and 64
-  bits) disassembler library.</dd>
-</dl>
-
-<p>To configure LLVM, follow these steps:</p>
-
-<ol>
-    <li><p>Change directory into the object root directory:</p>
-
-    <div class="doc_code"><pre>% cd <i>OBJ_ROOT</i></pre></div></li>
-
-    <li><p>Run the <tt>configure</tt> script located in the LLVM source
-    tree:</p>
-
-    <div class="doc_code">
-    <pre>% <i>SRC_ROOT</i>/configure --prefix=/install/path [other options]</pre>
-    </div></li>
-</ol>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="compile">Compiling the LLVM Suite Source Code</a>
-</div>
-
-<div class="doc_text">
-
-<p>Once you have configured LLVM, you can build it.  There are three types of
-builds:</p>
-
-<dl>
-    <dt>Debug Builds
-    <dd>
-    These builds are the default when one is using an Subversion checkout and 
-    types <tt>gmake</tt> (unless the <tt>--enable-optimized</tt> option was 
-    used during configuration).  The build system will compile the tools and 
-    libraries with debugging information.  To get a Debug Build using the
-    LLVM distribution the <tt>--disable-optimized</tt> option must be passed
-    to <tt>configure</tt>.
-    <br><br>
-
-    <dt>Release (Optimized) Builds
-    <dd>
-    These builds are enabled with the <tt>--enable-optimized</tt> option to
-    <tt>configure</tt> or by specifying <tt>ENABLE_OPTIMIZED=1</tt> on the
-    <tt>gmake</tt> command line.  For these builds, the build system will
-    compile the tools and libraries with GCC optimizations enabled and strip
-    debugging information from the libraries and executables it generates. 
-    Note that Release Builds are default when using an LLVM distribution.
-    <br><br>
-
-    <dt>Profile Builds
-    <dd>
-    These builds are for use with profiling.  They compile profiling
-    information into the code for use with programs like <tt>gprof</tt>.
-    Profile builds must be started by specifying <tt>ENABLE_PROFILING=1</tt>
-    on the <tt>gmake</tt> command line.
-</dl>
-
-<p>Once you have LLVM configured, you can build it by entering the
-<i>OBJ_ROOT</i> directory and issuing the following command:</p>
-
-<div class="doc_code"><pre>% gmake</pre></div>
-
-<p>If the build fails, please <a href="#brokengcc">check here</a> to see if you
-are using a version of GCC that is known not to compile LLVM.</p>
-
-<p>
-If you have multiple processors in your machine, you may wish to use some of
-the parallel build options provided by GNU Make.  For example, you could use the
-command:</p>
-
-<div class="doc_code"><pre>% gmake -j2</pre></div>
-
-<p>There are several special targets which are useful when working with the LLVM
-source code:</p>
-
-<dl>
-  <dt><tt>gmake clean</tt>
-  <dd>
-  Removes all files generated by the build.  This includes object files,
-  generated C/C++ files, libraries, and executables.
-  <br><br>
-
-  <dt><tt>gmake dist-clean</tt>
-  <dd>
-  Removes everything that <tt>gmake clean</tt> does, but also removes files
-  generated by <tt>configure</tt>.  It attempts to return the source tree to the
-  original state in which it was shipped.
-  <br><br>
-
-  <dt><tt>gmake install</tt>
-  <dd>
-  Installs LLVM header files, libraries, tools, and documentation in a
-  hierarchy 
-  under $PREFIX, specified with <tt>./configure --prefix=[dir]</tt>, which 
-  defaults to <tt>/usr/local</tt>.
-  <br><br>
-
-  <dt><tt>gmake -C runtime install-bytecode</tt>
-  <dd>
-  Assuming you built LLVM into $OBJDIR, when this command is run, it will 
-  install bitcode libraries into the GCC front end's bitcode library 
-  directory.  If you need to update your bitcode libraries,
-  this is the target to use once you've built them.
-  <br><br>
-</dl>
-
-<p>Please see the <a href="MakefileGuide.html">Makefile Guide</a> for further
-details on these <tt>make</tt> targets and descriptions of other targets
-available.</p>
-
-<p>It is also possible to override default values from <tt>configure</tt> by
-declaring variables on the command line.  The following are some examples:</p>
-
-<dl>
-  <dt><tt>gmake ENABLE_OPTIMIZED=1</tt>
-  <dd>
-  Perform a Release (Optimized) build.
-  <br><br>
-
-  <dt><tt>gmake ENABLE_OPTIMIZED=1 DISABLE_ASSERTIONS=1</tt>
-  <dd>
-  Perform a Release (Optimized) build without assertions enabled.
-  <br><br>
- 
-  <dt><tt>gmake ENABLE_OPTIMIZED=0</tt>
-  <dd>
-  Perform a Debug build.
-  <br><br>
-
-  <dt><tt>gmake ENABLE_PROFILING=1</tt>
-  <dd>
-  Perform a Profiling build.
-  <br><br>
-
-  <dt><tt>gmake VERBOSE=1</tt>
-  <dd>
-  Print what <tt>gmake</tt> is doing on standard output.
-  <br><br>
-
-  <dt><tt>gmake TOOL_VERBOSE=1</tt></dt>
-  <dd>Ask each tool invoked by the makefiles to print out what it is doing on 
-  the standard output. This also implies <tt>VERBOSE=1</tt>.
-  <br><br></dd>
-</dl>
-
-<p>Every directory in the LLVM object tree includes a <tt>Makefile</tt> to build
-it and any subdirectories that it contains.  Entering any directory inside the
-LLVM object tree and typing <tt>gmake</tt> should rebuild anything in or below
-that directory that is out of date.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="cross-compile">Cross-Compiling LLVM</a>
-</div>
-
-<div class="doc_text">
-  <p>It is possible to cross-compile LLVM itself. That is, you can create LLVM
-  executables and libraries to be hosted on a platform different from the
-  platform where they are build (a Canadian Cross build). To configure a
-  cross-compile, supply the configure script with <tt>--build</tt> and
-  <tt>--host</tt> options that are different. The values of these options must
-  be legal target triples that your GCC compiler supports.</p>
-
-  <p>The result of such a build is executables that are not runnable on
-  on the build host (--build option) but can be executed on the compile host
-  (--host option).</p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="objfiles">The Location of LLVM Object Files</a>
-</div>
-
-<div class="doc_text">
-
-<p>The LLVM build system is capable of sharing a single LLVM source tree among
-several LLVM builds.  Hence, it is possible to build LLVM for several different
-platforms or configurations using the same source tree.</p>
-
-<p>This is accomplished in the typical autoconf manner:</p>
-
-<ul>
-  <li><p>Change directory to where the LLVM object files should live:</p>
-
-      <div class="doc_code"><pre>% cd <i>OBJ_ROOT</i></pre></div></li>
-
-  <li><p>Run the <tt>configure</tt> script found in the LLVM source
-      directory:</p>
-
-      <div class="doc_code"><pre>% <i>SRC_ROOT</i>/configure</pre></div></li>
-</ul>
-
-<p>The LLVM build will place files underneath <i>OBJ_ROOT</i> in directories
-named after the build type:</p>
-
-<dl>
-  <dt>Debug Builds
-  <dd>
-  <dl>
-    <dt>Tools
-    <dd><tt><i>OBJ_ROOT</i>/Debug/bin</tt>
-    <dt>Libraries
-    <dd><tt><i>OBJ_ROOT</i>/Debug/lib</tt>
-  </dl>
-  <br><br>
-
-  <dt>Release Builds
-  <dd>
-  <dl>
-    <dt>Tools
-    <dd><tt><i>OBJ_ROOT</i>/Release/bin</tt>
-    <dt>Libraries
-    <dd><tt><i>OBJ_ROOT</i>/Release/lib</tt>
-  </dl>
-  <br><br>
-
-  <dt>Profile Builds
-  <dd>
-  <dl>
-    <dt>Tools
-    <dd><tt><i>OBJ_ROOT</i>/Profile/bin</tt>
-    <dt>Libraries
-    <dd><tt><i>OBJ_ROOT</i>/Profile/lib</tt>
-  </dl>
-</dl>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="optionalconfig">Optional Configuration Items</a>
-</div>
-
-<div class="doc_text">
-
-<p>
-If you're running on a Linux system that supports the "<a
-href="http://www.tat.physik.uni-tuebingen.de/~rguenth/linux/binfmt_misc.html">binfmt_misc</a>"
-module, and you have root access on the system, you can set your system up to
-execute LLVM bitcode files directly. To do this, use commands like this (the
-first command may not be required if you are already using the module):</p>
-
-<div class="doc_code">
-<pre>
-$ mount -t binfmt_misc none /proc/sys/fs/binfmt_misc
-$ echo ':llvm:M::BC::/path/to/lli:' &gt; /proc/sys/fs/binfmt_misc/register
-$ chmod u+x hello.bc   (if needed)
-$ ./hello.bc
-</pre>
-</div>
-
-<p>
-This allows you to execute LLVM bitcode files directly.  Thanks to Jack
-Cummings for pointing this out!
-</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="layout"><b>Program Layout</b></a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>One useful source of information about the LLVM source base is the LLVM <a
-href="http://www.doxygen.org">doxygen</a> documentation available at <tt><a
-href="http://llvm.org/doxygen/">http://llvm.org/doxygen/</a></tt>.
-The following is a brief introduction to code layout:</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="examples"><tt>llvm/examples</tt></a></div>
-<div class="doc_text">
-  <p>This directory contains some simple examples of how to use the LLVM IR and
-  JIT.</p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="include"><tt>llvm/include</tt></a></div>
-<div class="doc_text">
-
-<p>This directory contains public header files exported from the LLVM
-library. The three main subdirectories of this directory are:</p>
-
-<dl>
-  <dt><tt><b>llvm/include/llvm</b></tt></dt>
-  <dd>This directory contains all of the LLVM specific header files.  This 
-  directory also has subdirectories for different portions of LLVM: 
-  <tt>Analysis</tt>, <tt>CodeGen</tt>, <tt>Target</tt>, <tt>Transforms</tt>, 
-  etc...</dd>
-
-  <dt><tt><b>llvm/include/llvm/Support</b></tt></dt>
-  <dd>This directory contains generic support libraries that are provided with 
-  LLVM but not necessarily specific to LLVM. For example, some C++ STL utilities 
-  and a Command Line option processing library store their header files here.
-  </dd>
-
-  <dt><tt><b>llvm/include/llvm/Config</b></tt></dt>
-  <dd>This directory contains header files configured by the <tt>configure</tt> 
-  script.  They wrap "standard" UNIX and C header files.  Source code can 
-  include these header files which automatically take care of the conditional 
-  #includes that the <tt>configure</tt> script generates.</dd>
-</dl>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="lib"><tt>llvm/lib</tt></a></div>
-<div class="doc_text">
-
-<p>This directory contains most of the source files of the LLVM system. In LLVM,
-almost all code exists in libraries, making it very easy to share code among the
-different <a href="#tools">tools</a>.</p>
-
-<dl>
-  <dt><tt><b>llvm/lib/VMCore/</b></tt></dt>
-  <dd> This directory holds the core LLVM source files that implement core 
-  classes like Instruction and BasicBlock.</dd>
-
-  <dt><tt><b>llvm/lib/AsmParser/</b></tt></dt>
-  <dd>This directory holds the source code for the LLVM assembly language parser 
-  library.</dd>
-
-  <dt><tt><b>llvm/lib/BitCode/</b></tt></dt>
-  <dd>This directory holds code for reading and write LLVM bitcode.</dd>
-
-  <dt><tt><b>llvm/lib/Analysis/</b></tt><dd>This directory contains a variety of
-  different program analyses, such as Dominator Information, Call Graphs,
-  Induction Variables, Interval Identification, Natural Loop Identification,
-  etc.</dd>
-
-  <dt><tt><b>llvm/lib/Transforms/</b></tt></dt>
-  <dd> This directory contains the source code for the LLVM to LLVM program 
-  transformations, such as Aggressive Dead Code Elimination, Sparse Conditional 
-  Constant Propagation, Inlining, Loop Invariant Code Motion, Dead Global 
-  Elimination, and many others.</dd>
-
-  <dt><tt><b>llvm/lib/Target/</b></tt></dt>
-  <dd> This directory contains files that describe various target architectures
-  for code generation.  For example, the <tt>llvm/lib/Target/X86</tt> 
-  directory holds the X86 machine description while
-  <tt>llvm/lib/Target/CBackend</tt> implements the LLVM-to-C converter.</dd>
-    
-  <dt><tt><b>llvm/lib/CodeGen/</b></tt></dt>
-  <dd> This directory contains the major parts of the code generator: Instruction 
-  Selector, Instruction Scheduling, and Register Allocation.</dd>
-
-  <dt><tt><b>llvm/lib/Debugger/</b></tt></dt>
-  <dd> This directory contains the source level debugger library that makes 
-  it possible to instrument LLVM programs so that a debugger could identify 
-  source code locations at which the program is executing.</dd>
-
-  <dt><tt><b>llvm/lib/ExecutionEngine/</b></tt></dt>
-  <dd> This directory contains libraries for executing LLVM bitcode directly 
-  at runtime in both interpreted and JIT compiled fashions.</dd>
-
-  <dt><tt><b>llvm/lib/Support/</b></tt></dt>
-  <dd> This directory contains the source code that corresponds to the header 
-  files located in <tt>llvm/include/Support/</tt>.</dd>
-
-  <dt><tt><b>llvm/lib/System/</b></tt></dt>
-  <dd>This directory contains the operating system abstraction layer that
-  shields LLVM from platform-specific coding.</dd>
-</dl>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="projects"><tt>llvm/projects</tt></a></div>
-<div class="doc_text">
-  <p>This directory contains projects that are not strictly part of LLVM but are
-  shipped with LLVM. This is also the directory where you should create your own
-  LLVM-based projects. See <tt>llvm/projects/sample</tt> for an example of how
-  to set up your own project.</p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="runtime"><tt>llvm/runtime</tt></a></div>
-<div class="doc_text">
-
-<p>This directory contains libraries which are compiled into LLVM bitcode and
-used when linking programs with the GCC front end.  Most of these libraries are
-skeleton versions of real libraries; for example, libc is a stripped down
-version of glibc.</p>
-
-<p>Unlike the rest of the LLVM suite, this directory needs the LLVM GCC front
-end to compile.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="test"><tt>llvm/test</tt></a></div>
-<div class="doc_text">
-  <p>This directory contains feature and regression tests and other basic sanity
-  checks on the LLVM infrastructure. These are intended to run quickly and cover
-  a lot of territory without being exhaustive.</p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="llvmtest"><tt>test-suite</tt></a></div>
-<div class="doc_text">
-  <p>This is not a directory in the normal llvm module; it is a separate
-  Subversion
-  module that must be checked out (usually to <tt>projects/test-suite</tt>). 
-  This
-  module contains a comprehensive correctness, performance, and benchmarking
-  test
-  suite for LLVM. It is a separate Subversion module because not every LLVM 
-  user is
-  interested in downloading or building such a comprehensive test suite. For
-  further details on this test suite, please see the 
-  <a href="TestingGuide.html">Testing Guide</a> document.</p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="tools"><tt>llvm/tools</tt></a></div>
-<div class="doc_text">
-
-<p>The <b>tools</b> directory contains the executables built out of the
-libraries above, which form the main part of the user interface.  You can
-always get help for a tool by typing <tt>tool_name --help</tt>.  The
-following is a brief introduction to the most important tools.  More detailed
-information is in the <a href="CommandGuide/index.html">Command Guide</a>.</p>
-
-<dl>
-
-  <dt><tt><b>bugpoint</b></tt></dt>
-  <dd><tt>bugpoint</tt> is used to debug
-  optimization passes or code generation backends by narrowing down the
-  given test case to the minimum number of passes and/or instructions that
-  still cause a problem, whether it is a crash or miscompilation. See <a
-  href="HowToSubmitABug.html">HowToSubmitABug.html</a> for more information
-  on using <tt>bugpoint</tt>.</dd>
-
-  <dt><tt><b>llvmc</b></tt></dt>
-  <dd>The LLVM Compiler Driver. This program can
-  be configured to utilize both LLVM and non-LLVM compilation tools to enable
-  pre-processing, translation, optimization, assembly, and linking of programs
-  all from one command line. <tt>llvmc</tt> also takes care of processing the
-  dependent libraries found in bitcode. This reduces the need to get the
-  traditional <tt>-l&lt;name&gt;</tt> options right on the command line. Please
-  note that this tool, while functional, is still experimental and not feature
-  complete.</dd>
-
-  <dt><tt><b>llvm-ar</b></tt></dt>
-  <dd>The archiver produces an archive containing
-  the given LLVM bitcode files, optionally with an index for faster
-  lookup.</dd>
-  
-  <dt><tt><b>llvm-as</b></tt></dt>
-  <dd>The assembler transforms the human readable LLVM assembly to LLVM 
-  bitcode.</dd>
-
-  <dt><tt><b>llvm-dis</b></tt></dt>
-  <dd>The disassembler transforms the LLVM bitcode to human readable 
-  LLVM assembly.</dd>
-
-  <dt><tt><b>llvm-ld</b></tt></dt>
-  <dd><tt>llvm-ld</tt> is a general purpose and extensible linker for LLVM. 
-  This is the linker invoked by <tt>llvmc</tt>. It performsn standard link time
-  optimizations and allows optimization modules to be loaded and run so that 
-  language specific optimizations can be applied at link time.</dd>
-
-  <dt><tt><b>llvm-link</b></tt></dt>
-  <dd><tt>llvm-link</tt>, not surprisingly, links multiple LLVM modules into 
-  a single program.</dd>
-  
-  <dt><tt><b>lli</b></tt></dt>
-  <dd><tt>lli</tt> is the LLVM interpreter, which
-  can directly execute LLVM bitcode (although very slowly...). For architectures
-  that support it (currently x86, Sparc, and PowerPC), by default, <tt>lli</tt>
-  will function as a Just-In-Time compiler (if the functionality was compiled
-  in), and will execute the code <i>much</i> faster than the interpreter.</dd>
-
-  <dt><tt><b>llc</b></tt></dt>
-  <dd> <tt>llc</tt> is the LLVM backend compiler, which
-  translates LLVM bitcode to a native code assembly file or to C code (with
-  the -march=c option).</dd>
-
-  <dt><tt><b>llvm-gcc</b></tt></dt>
-  <dd><tt>llvm-gcc</tt> is a GCC-based C frontend that has been retargeted to 
-  use LLVM as its backend instead of GCC's RTL backend. It can also emit LLVM 
-  bitcode or assembly (with the <tt>-emit-llvm</tt> option) instead of the
-  usual machine code output.  It works just like any other GCC compiler, 
-  taking the typical <tt>-c, -S, -E, -o</tt> options that are typically used.  
-  Additionally, the the source code for <tt>llvm-gcc</tt> is available as a 
-  separate Subversion module.</dd>
-
-  <dt><tt><b>opt</b></tt></dt>
-  <dd><tt>opt</tt> reads LLVM bitcode, applies a series of LLVM to LLVM 
-  transformations (which are specified on the command line), and then outputs 
-  the resultant bitcode.  The '<tt>opt --help</tt>' command is a good way to 
-  get a list of the program transformations available in LLVM.<br>
-  <dd><tt>opt</tt> can also be used to run a specific analysis on an input 
-  LLVM bitcode file and print out the results.  It is primarily useful for 
-  debugging analyses, or familiarizing yourself with what an analysis does.</dd>
-</dl>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="utils"><tt>llvm/utils</tt></a></div>
-<div class="doc_text">
-
-<p>This directory contains utilities for working with LLVM source code, and some
-of the utilities are actually required as part of the build process because they
-are code generators for parts of LLVM infrastructure.</p>
-
-<dl>
-  <dt><tt><b>codegen-diff</b></tt> <dd><tt>codegen-diff</tt> is a script
-  that finds differences between code that LLC generates and code that LLI
-  generates. This is a useful tool if you are debugging one of them,
-  assuming that the other generates correct output. For the full user
-  manual, run <tt>`perldoc codegen-diff'</tt>.<br><br>
-
-  <dt><tt><b>emacs/</b></tt> <dd>The <tt>emacs</tt> directory contains
-  syntax-highlighting files which will work with Emacs and XEmacs editors,
-  providing syntax highlighting support for LLVM assembly files and TableGen
-  description files. For information on how to use the syntax files, consult
-  the <tt>README</tt> file in that directory.<br><br>
-
-  <dt><tt><b>getsrcs.sh</b></tt> <dd>The <tt>getsrcs.sh</tt> script finds
-  and outputs all non-generated source files, which is useful if one wishes
-  to do a lot of development across directories and does not want to
-  individually find each file. One way to use it is to run, for example:
-  <tt>xemacs `utils/getsources.sh`</tt> from the top of your LLVM source
-  tree.<br><br>
-
-  <dt><tt><b>llvmgrep</b></tt></dt>
-  <dd>This little tool performs an "egrep -H -n" on each source file in LLVM and
-  passes to it a regular expression provided on <tt>llvmgrep</tt>'s command
-  line. This is a very efficient way of searching the source base for a
-  particular regular expression.</dd>
-
-  <dt><tt><b>makellvm</b></tt> <dd>The <tt>makellvm</tt> script compiles all
-  files in the current directory and then compiles and links the tool that
-  is the first argument. For example, assuming you are in the directory
-  <tt>llvm/lib/Target/Sparc</tt>, if <tt>makellvm</tt> is in your path,
-  simply running <tt>makellvm llc</tt> will make a build of the current
-  directory, switch to directory <tt>llvm/tools/llc</tt> and build it,
-  causing a re-linking of LLC.<br><br>
-
-  <dt><tt><b>NewNightlyTest.pl</b></tt> and
-  <tt><b>NightlyTestTemplate.html</b></tt> <dd>These files are used in a
-  cron script to generate nightly status reports of the functionality of
-  tools, and the results can be seen by following the appropriate link on
-  the <a href="http://llvm.org/">LLVM homepage</a>.<br><br>
-
-  <dt><tt><b>TableGen/</b></tt> <dd>The <tt>TableGen</tt> directory contains
-  the tool used to generate register descriptions, instruction set
-  descriptions, and even assemblers from common TableGen description
-  files.<br><br>
-
-  <dt><tt><b>vim/</b></tt> <dd>The <tt>vim</tt> directory contains
-  syntax-highlighting files which will work with the VIM editor, providing
-  syntax highlighting support for LLVM assembly files and TableGen
-  description files. For information on how to use the syntax files, consult
-  the <tt>README</tt> file in that directory.<br><br>
-
-</dl>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="win32"><tt>llvm/win32</tt></a></div>
-<div class="doc_text">
-  <p>This directory contains build scripts and project files for use with 
-  Visual C++. This allows developers on Windows to build LLVM without the need
-  for Cygwin. The contents of this directory should be considered experimental
-  at this time.
-  </p>
-</div>
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="tutorial">An Example Using the LLVM Tool Chain</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-<p>This section gives an example of using LLVM.  llvm-gcc3 is now obsolete,
-so we only include instructions for llvm-gcc4.
-</p>
-
-<p><b>Note:</b> The <i>gcc4</i> frontend's invocation is <b><i>considerably different</i></b>
-from the previous <i>gcc3</i> frontend. In particular, the <i>gcc4</i> frontend <b><i>does not</i></b>
-create bitcode by default: <i>gcc4</i> produces native code. As the example below illustrates,
-the '--emit-llvm' flag is needed to produce LLVM bitcode output. For <i>makefiles</i> and
-<i>configure</i> scripts, the CFLAGS variable needs '--emit-llvm' to produce bitcode
-output.</p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="tutorial4">Example with llvm-gcc4</a></div>
-
-<div class="doc_text">
-
-<ol>
-  <li><p>First, create a simple C file, name it 'hello.c':</p>
-
-<div class="doc_code">
-<pre>
-#include &lt;stdio.h&gt;
-
-int main() {
-  printf("hello world\n");
-  return 0;
-}
-</pre></div></li>
-
-  <li><p>Next, compile the C file into a native executable:</p>
-
-      <div class="doc_code"><pre>% llvm-gcc hello.c -o hello</pre></div>
-
-      <p>Note that llvm-gcc works just like GCC by default.  The standard -S and
-        -c arguments work as usual (producing a native .s or .o file,
-        respectively).</p></li>
-
-  <li><p>Next, compile the C file into a LLVM bitcode file:</p>
-
-      <div class="doc_code">
-      <pre>% llvm-gcc -O3 -emit-llvm hello.c -c -o hello.bc</pre></div>
-
-      <p>The -emit-llvm option can be used with the -S or -c options to emit an
-         LLVM ".ll" or ".bc" file (respectively) for the code.  This allows you
-         to use the <a href="CommandGuide/index.html">standard LLVM tools</a> on
-         the bitcode file.</p>
-
-      <p>Unlike llvm-gcc3, llvm-gcc4 correctly responds to -O[0123] arguments.
-         </p></li>
-
-  <li><p>Run the program in both forms. To run the program, use:</p>
-      
-      <div class="doc_code"><pre>% ./hello</pre></div>
- 
-      <p>and</p>
-
-      <div class="doc_code"><pre>% lli hello.bc</pre></div>
-
-      <p>The second examples shows how to invoke the LLVM JIT, <a
-       href="CommandGuide/html/lli.html">lli</a>.</p></li>
-
-  <li><p>Use the <tt>llvm-dis</tt> utility to take a look at the LLVM assembly
-      code:</p>
-
-<div class="doc_code">
-<pre>llvm-dis &lt; hello.bc | less</pre>
-</div></li>
-
-  <li><p>Compile the program to native assembly using the LLC code
-      generator:</p>
-
-      <div class="doc_code"><pre>% llc hello.bc -o hello.s</pre></div></li>
-
-  <li><p>Assemble the native assembly language file into a program:</p>
-
-<div class="doc_code">
-<pre>
-<b>Solaris:</b> % /opt/SUNWspro/bin/cc -xarch=v9 hello.s -o hello.native
-
-<b>Others:</b>  % gcc hello.s -o hello.native
-</pre>
-</div></li>
-
-  <li><p>Execute the native code program:</p>
-
-      <div class="doc_code"><pre>% ./hello.native</pre></div>
-
-      <p>Note that using llvm-gcc to compile directly to native code (i.e. when
-         the -emit-llvm option is not present) does steps 6/7/8 for you.</p>
-        </li>
-
-</ol>
-
-</div>
-
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="problems">Common Problems</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>If you are having problems building or using LLVM, or if you have any other
-general questions about LLVM, please consult the <a href="FAQ.html">Frequently
-Asked Questions</a> page.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="links">Links</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>This document is just an <b>introduction</b> on how to use LLVM to do
-some simple things... there are many more interesting and complicated things
-that you can do that aren't documented here (but we'll gladly accept a patch
-if you want to write something up!).  For more information about LLVM, check
-out:</p>
-
-<ul>
-  <li><a href="http://llvm.org/">LLVM homepage</a></li>
-  <li><a href="http://llvm.org/doxygen/">LLVM doxygen tree</a></li>
-  <li><a href="http://llvm.org/docs/Projects.html">Starting a Project
-  that Uses LLVM</a></li>
-</ul>
-
-</div>
-
-<!-- *********************************************************************** -->
-
-<hr>
-<address>
-  <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
-  src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS"></a>
-  <a href="http://validator.w3.org/check/referer"><img
-  src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
-
-  <a href="mailto:sabre at nondot.org">Chris Lattner</a><br>
-  <a href="http://llvm.x10sys.com/rspencer/">Reid Spencer</a><br>
-  <a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
-  Last modified: $Date$
-</address>
-</body>
-</html>
diff --git a/libclamav/c++/llvm/docs/GettingStartedVS.html b/libclamav/c++/llvm/docs/GettingStartedVS.html
deleted file mode 100644
index 5a86199..0000000
--- a/libclamav/c++/llvm/docs/GettingStartedVS.html
+++ /dev/null
@@ -1,417 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-                      "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-  <title>Getting Started with LLVM System for Microsoft Visual Studio</title>
-  <link rel="stylesheet" href="llvm.css" type="text/css">
-</head>
-<body>
-
-<div class="doc_title">
-  Getting Started with the LLVM System using Microsoft Visual Studio
-</div>
-
-<ul>
-  <li><a href="#overview">Overview</a>
-  <li><a href="#quickstart">Getting Started Quickly (A Summary)</a>
-  <li><a href="#requirements">Requirements</a>
-    <ol>
-      <li><a href="#hardware">Hardware</a>
-      <li><a href="#software">Software</a>
-    </ol></li>
-
-  <li><a href="#starting">Getting Started with LLVM</a>
-    <ol>
-      <li><a href="#terminology">Terminology and Notation</a>
-      <li><a href="#objfiles">The Location of LLVM Object Files</a>
-    </ol></li>
-
-  <li><a href="#tutorial">An Example Using the LLVM Tool Chain</a>
-  <li><a href="#problems">Common Problems</a>
-  <li><a href="#links">Links</a>
-</ul>
-
-<div class="doc_author">
-  <p>Written by: 
-    <a href="mailto:jeffc at jolt-lang.org">Jeff Cohen</a>
-  </p>
-</div>
-
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="overview"><b>Overview</b></a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-  <p>The Visual Studio port at this time is experimental.  It is suitable for
-  use only if you are writing your own compiler front end or otherwise have a
-  need to dynamically generate machine code.  The JIT and interpreter are
-  functional, but it is currently not possible to generate assembly code which
-  is then assembled into an executable.  You can indirectly create executables
-  by using the C back end.</p>
-
-  <p>To emphasize, there is no C/C++ front end currently available.
-  <tt>llvm-gcc</tt> is based on GCC, which cannot be bootstrapped using VC++.
-  Eventually there should be a <tt>llvm-gcc</tt> based on Cygwin or MinGW that
-  is usable.  There is also the option of generating bitcode files on Unix and
-  copying them over to Windows.  But be aware the odds of linking C++ code
-  compiled with <tt>llvm-gcc</tt> with code compiled with VC++ is essentially
-  zero.</p>
-
-  <p>The LLVM test suite cannot be run on the Visual Studio port at this
-  time.</p>
-
-  <p>Most of the tools build and work.  <tt>bugpoint</tt> does build, but does
-  not work.  The other tools 'should' work, but have not been fully tested.</p>
-
-  <p>Additional information about the LLVM directory structure and tool chain
-  can be found on the main <a href="GettingStarted.html">Getting Started</a>
-  page.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="quickstart"><b>Getting Started Quickly (A Summary)</b></a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>Here's the short story for getting up and running quickly with LLVM:</p>
-
-<ol>
-  <li>Read the documentation.</li>
-  <li>Seriously, read the documentation.</li>
-  <li>Remember that you were warned twice about reading the documentation.</li>
-
-  <li>Get the Source Code
-  <ul>
-    <li>With the distributed files:
-    <ol>
-      <li><tt>cd <i>where-you-want-llvm-to-live</i></tt>
-      <li><tt>gunzip --stdout llvm-<i>version</i>.tar.gz | tar -xvf -</tt>
-      <i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;or use WinZip</i>
-      <li><tt>cd llvm</tt></li>
-    </ol></li>
-
-    <li>With anonymous Subversion access:
-    <ol>
-      <li><tt>cd <i>where-you-want-llvm-to-live</i></tt></li>
-      <li><tt>svn co http://llvm.org/svn/llvm-project/llvm-top/trunk llvm-top
-      </tt></li>
-      <li><tt>make checkout MODULE=llvm</tt>
-      <li><tt>cd llvm</tt></li>
-    </ol></li>
-  </ul></li>
-  
-  <li> Use <a href="http://www.cmake.org/">CMake</a> to generate up-to-date
-    project files:
-    <ul><li>This step is currently optional as LLVM does still come with a
-    normal Visual Studio solution file, but it is not always kept up-to-date
-    and will soon be deprecated in favor of the multi-platform generator
-    CMake.</li>
-    <li>If CMake is installed then the most simple way is to just start the
-    CMake GUI, select the directory where you have LLVM extracted to, and
-    the default options should all be fine.  The one option you may really
-    want to change, regardless of anything else, might be the
-    CMAKE_INSTALL_PREFIX setting to select a directory to INSTALL to once
-    compiling is complete.</li>
-    <li>If you use CMake to generate the Visual Studio solution and project
-    files, then the Solution will have a few extra options compared to the
-    current included one.  The projects may still be built individually, but
-    to build them all do not just select all of them in batch build (as some
-    are meant as configuration projects), but rather select and build just
-    the ALL_BUILD project to build everything, or the INSTALL project, which
-    first builds the ALL_BUILD project, then installs the LLVM headers, libs,
-    and other useful things to the directory set by the CMAKE_INSTALL_PREFIX
-    setting when you first configured CMake.</li>
-    </ul>
-  </li>
-
-  <li>Start Visual Studio
-  <ul>
-    <li>If you did not use CMake, then simply double click on the solution
-    file <tt>llvm/win32/llvm.sln</tt>.</li>
-    <li>If you used CMake, then the directory you created the project files,
-    the root directory will have an <tt>llvm.sln</tt> file, just
-    double-click on that to open Visual Studio.</li>
-  </ul></li>
-
-  <li>Build the LLVM Suite:
-  <ul>
-    <li>Simply build the solution.</li>
-    <li>The Fibonacci project is a sample program that uses the JIT.  Modify
-    the project's debugging properties to provide a numeric command line
-    argument.  The program will print the corresponding fibonacci value.</li>
-  </ul></li>
-
-</ol>
-
-<p>It is strongly encouraged that you get the latest version from Subversion as
-changes are continually making the VS support better.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="requirements"><b>Requirements</b></a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-  <p>Before you begin to use the LLVM system, review the requirements given
-  below.  This may save you some trouble by knowing ahead of time what hardware
-  and software you will need.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="hardware"><b>Hardware</b></a>
-</div>
-
-<div class="doc_text">
-
-  <p>Any system that can adequately run Visual Studio .NET 2005 SP1 is fine.  
-  The LLVM source tree and object files, libraries and executables will consume
-  approximately 3GB.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="software"><b>Software</b></a></div>
-<div class="doc_text">
-
-  <p>You will need Visual Studio .NET 2005 SP1 or higher.  The VS2005 SP1
-  beta and the normal VS2005 still have bugs that are not completely
-  compatible. VS2003 would work except (at last check) it has a bug with
-  friend classes that you can work-around with some minor code rewriting
-  (and please submit a patch if you do).  Earlier versions of Visual Studio
-  do not support the C++ standard well enough and will not work.</p>
-  
-  <p>You will also need the <a href="http://www.cmake.org/">CMake</a> build
-  system since it generates the project files you will use to build with.</p>
-
-  <p>
-  Do not install the LLVM directory tree into a path containing spaces (e.g.
-  C:\Documents and Settings\...) as the configure step will fail.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="starting"><b>Getting Started with LLVM</b></a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>The remainder of this guide is meant to get you up and running with
-LLVM using Visual Studio and to give you some basic information about the LLVM
-environment.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="terminology">Terminology and Notation</a>
-</div>
-
-<div class="doc_text">
-
-<p>Throughout this manual, the following names are used to denote paths
-specific to the local system and working environment.  <i>These are not
-environment variables you need to set but just strings used in the rest
-of this document below</i>.  In any of the examples below, simply replace
-each of these names with the appropriate pathname on your local system.
-All these paths are absolute:</p>
-
-<dl>
-    <dt>SRC_ROOT</dt>
-    <dd><p>This is the top level directory of the LLVM source tree.</p></dd>
-
-    <dt>OBJ_ROOT</dt>
-    <dd><p>This is the top level directory of the LLVM object tree (i.e. the
-        tree where object files and compiled programs will be placed.  It is
-        fixed at SRC_ROOT/win32).</p></dd>
-</dl>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="objfiles">The Location of LLVM Object Files</a>
-</div>
-
-<div class="doc_text">
-
-  <p>The object files are placed under <tt>OBJ_ROOT/Debug</tt> for debug builds
-  and <tt>OBJ_ROOT/Release</tt> for release (optimized) builds.  These include
-  both executables and libararies that your application can link against.</p>
-
-  <p>The files that <tt>configure</tt> would create when building on Unix are
-  created by the <tt>Configure</tt> project and placed in
-  <tt>OBJ_ROOT/llvm</tt>.  You application must have OBJ_ROOT in its include
-  search path just before <tt>SRC_ROOT/include</tt>.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="tutorial">An Example Using the LLVM Tool Chain</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<ol>
-  <li><p>First, create a simple C file, name it 'hello.c':</p>
-
-<div class="doc_code">
-<pre>
-#include &lt;stdio.h&gt;
-int main() {
-  printf("hello world\n");
-  return 0;
-}
-</pre></div></li>
-
-  <li><p>Next, compile the C file into a LLVM bitcode file:</p>
-
-<div class="doc_code">
-<pre>
-% llvm-gcc -c hello.c -emit-llvm -o hello.bc
-</pre>
-</div>
-
-      <p>This will create the result file <tt>hello.bc</tt> which is the LLVM
-         bitcode that corresponds the the compiled program and the library
-         facilities that it required.  You can execute this file directly using
-         <tt>lli</tt> tool, compile it to native assembly with the <tt>llc</tt>,
-         optimize or analyze it further with the <tt>opt</tt> tool, etc.</p>
-      
-      <p><b>Note: while you cannot do this step on Windows, you can do it on a
-         Unix system and transfer <tt>hello.bc</tt> to Windows.  Important:
-         transfer as a binary file!</b></p></li>
-
-  <li><p>Run the program using the just-in-time compiler:</p>
-      
-<div class="doc_code">
-<pre>
-% lli hello.bc
-</pre>
-</div>
-
-      <p>Note: this will only work for trivial C programs.  Non-trivial programs
-         (and any C++ program) will have dependencies on the GCC runtime that
-         won't be satisfied by the Microsoft runtime libraries.</p></li>
-
-  <li><p>Use the <tt>llvm-dis</tt> utility to take a look at the LLVM assembly
-      code:</p>
-
-<div class="doc_code">
-<pre>
-% llvm-dis &lt; hello.bc | more
-</pre>
-</div></li>
-
-  <li><p>Compile the program to C using the LLC code generator:</p>
-
-<div class="doc_code">
-<pre>
-% llc -march=c hello.bc
-</pre>
-</div></li>
-
-  <li><p>Compile to binary using Microsoft C:</p>
-
-<div class="doc_code">
-<pre>
-% cl hello.cbe.c
-</pre>
-</div>
-
-    <p>Note: this will only work for trivial C programs.  Non-trivial programs
-      (and any C++ program) will have dependencies on the GCC runtime that won't
-      be satisfied by the Microsoft runtime libraries.</p></li>
-
-  <li><p>Execute the native code program:</p>
-
-<div class="doc_code">
-<pre>
-% hello.cbe.exe
-</pre>
-</div></li>
-</ol>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="problems">Common Problems</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-  <ul>
-    <li>In Visual C++, if you are linking with the x86 target statically, the
-    linker will remove the x86 target library from your generated executable or
-    shared library because there are no references to it. You can force the
-    linker to include these references by using
-    <tt>"/INCLUDE:_X86TargetMachineModule"</tt> when linking. In the Visual
-    Studio IDE, this can be added in
-<tt>Project&nbsp;Properties->Linker->Input->Force&nbsp;Symbol&nbsp;References</tt>.
-    </li>
-  </ul>
-
-<p>If you are having problems building or using LLVM, or if you have any other
-general questions about LLVM, please consult the <a href="FAQ.html">Frequently
-Asked Questions</a> page.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="links">Links</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>This document is just an <b>introduction</b> to how to use LLVM to do
-some simple things... there are many more interesting and complicated things
-that you can do that aren't documented here (but we'll gladly accept a patch
-if you want to write something up!).  For more information about LLVM, check
-out:</p>
-
-<ul>
-  <li><a href="http://llvm.org/">LLVM homepage</a></li>
-  <li><a href="http://llvm.org/doxygen/">LLVM doxygen tree</a></li>
-  <li><a href="http://llvm.org/docs/Projects.html">Starting a Project
-      that Uses LLVM</a></li>
-</ul>
-
-</div>
-
-<!-- *********************************************************************** -->
-
-<hr>
-<address>
-  <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
-  src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS"></a>
-  <a href="http://validator.w3.org/check/referer"><img
-  src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
-
-  <a href="mailto:jeffc at jolt-lang.org">Jeff Cohen</a><br>
-  <a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
-  Last modified: $Date$
-</address>
-</body>
-</html>
diff --git a/libclamav/c++/llvm/docs/GoldPlugin.html b/libclamav/c++/llvm/docs/GoldPlugin.html
deleted file mode 100644
index 77a417f..0000000
--- a/libclamav/c++/llvm/docs/GoldPlugin.html
+++ /dev/null
@@ -1,200 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-                      "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-  <title>LLVM gold plugin</title>
-  <link rel="stylesheet" href="llvm.css" type="text/css">
-</head>
-<body>
-      
-<div class="doc_title">LLVM gold plugin</div>
-<ol>
-  <li><a href="#introduction">Introduction</a></li>
-  <li><a href="#build">How to build it</a></li>
-  <li><a href="#usage">Usage</a>
-  <ul>
-    <li><a href="#example1">Example of link time optimization</a></li>
-    <li><a href="#lto_autotools">Quickstart for using LTO with autotooled projects</a></li>
-  </ul></li>
-  <li><a href="#licensing">Licensing</a></li>
-</ol>
-<div class="doc_author">Written by Nick Lewycky</div>
-
-<!--=========================================================================-->
-<div class="doc_section"><a name="introduction">Introduction</a></div>
-<!--=========================================================================-->
-<div class="doc_text">
-  <p>Building with link time optimization requires cooperation from the
-system linker. LTO support on Linux systems requires that you use
-the <a href="http://sourceware.org/binutils">gold linker</a> which supports
-LTO via plugins. This is the same system used by the upcoming
-<a href="http://gcc.gnu.org/wiki/LinkTimeOptimization">GCC LTO</a>
-project.</p>
-  <p>The LLVM gold plugin implements the
-<a href="http://gcc.gnu.org/wiki/whopr/driver">gold plugin interface</a>
-on top of
-<a href="http://llvm.org/docs/LinkTimeOptimization.html#lto">libLTO</a>.
-The same plugin can also be used by other tools such as <tt>ar</tt> and
-<tt>nm</tt>.
-</div>
-<!--=========================================================================-->
-<div class="doc_section"><a name="build">How to build it</a></div>
-<!--=========================================================================-->
-<div class="doc_text">
-  <p>You need to build gold with plugin support and build the LLVMgold
-plugin.</p>
-<ul>
-  <li>Build gold with plugin support:
-    <pre class="doc_code">
-mkdir binutils
-cd binutils
-cvs -z 9 -d :pserver:anoncvs at sourceware.org:/cvs/src login
-<em>{enter "anoncvs" as the password}</em>
-cvs -z 9 -d :pserver:anoncvs at sourceware.org:/cvs/src co src
-mkdir build
-cd build
-../src/configure --enable-gold --enable-plugins
-make all-gold
-</pre>
-    That should leave you with binutils/build/gold/ld-new which supports the
-<tt>-plugin</tt> option.
-
-    <li>Build the LLVMgold plugin: Configure LLVM with
-    <tt>--with-binutils-include=/path/to/binutils/src/include</tt> and run
-    <tt>make</tt>.
-</ul>
-</div>
-<!--=========================================================================-->
-<div class="doc_section"><a name="usage">Usage</a></div>
-<!--=========================================================================-->
-<div class="doc_text">
-  <p>The linker takes a <tt>-plugin</tt> option that points to the path of
-  the plugin <tt>.so</tt> file. To find out what link command <tt>gcc</tt>
-  would run in a given situation, run <tt>gcc -v <em>[...]</em></tt> and look
-  for the line where it runs <tt>collect2</tt>. Replace that with
-  <tt>ld-new -plugin /path/to/LLVMgold.so</tt> to test it out. Once you're
-  ready to switch to using gold, backup your existing <tt>/usr/bin/ld</tt>
-  then replace it with <tt>ld-new</tt>.</p>
-  <p>You can produce bitcode files from <tt>llvm-gcc</tt> using
-  <tt>-emit-llvm</tt> or <tt>-flto</tt>, or the <tt>-O4</tt> flag which is
-  synonymous with <tt>-O3 -flto</tt>.</p>
-  <p><tt>llvm-gcc</tt> has a <tt>-use-gold-plugin</tt> option which looks
-  for the gold plugin in the same directories as it looks for <tt>cc1</tt> and
-  passes the <tt>-plugin</tt> option to ld. It will not look for an alternate
-  linker, which is why you need gold to be the installed system linker in your
-  path.</p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="example1">Example of link time optimization</a>
-</div>
-
-<div class="doc_text">
-  <p>The following example shows a worked example of the gold plugin mixing
-  LLVM bitcode and native code.
-<pre class="doc_code">
---- a.c ---
-#include &lt;stdio.h&gt;
-
-extern void foo1(void);
-extern void foo4(void);
-
-void foo2(void) {
-  printf("Foo2\n");
-}
-
-void foo3(void) {
-  foo4();
-}
-
-int main(void) {
-  foo1();
-}
-
---- b.c ---
-#include &lt;stdio.h&gt;
-
-extern void foo2(void);
-
-void foo1(void) {
-  foo2();
-}
-
-void foo4(void) {
-  printf("Foo4");
-}
-
---- command lines ---
-$ llvm-gcc -flto a.c -c -o a.o              # &lt;-- a.o is LLVM bitcode file
-$ ar q a.a a.o                              # &lt;-- a.a is an archive with LLVM bitcode
-$ llvm-gcc b.c -c -o b.o                    # &lt;-- b.o is native object file
-$ llvm-gcc -use-gold-plugin a.a b.o -o main # &lt;-- link with LLVMgold plugin
-</pre>
-  <p>Gold informs the plugin that foo3 is never referenced outside the IR,
-  leading LLVM to delete that function. However, unlike in the
-  <a href="http://llvm.org/docs/LinkTimeOptimization.html#example1">libLTO
-  example</a> gold does not currently eliminate foo4.</p>
-</div>
-
-<!--=========================================================================-->
-<div class="doc_section"><a name="lto_autotools">Quickstart for using LTO with autotooled projects</a></div>
-<!--=========================================================================-->
-<div class="doc_text">
-  <p><tt>gold</tt>, <tt>ar</tt> and <tt>nm</tt> all support plugins now, so everything should be
-  in place for an easy to use LTO build of autotooled projects:</p>
-  <ul>
-    <li>Follow the instructions <a href="#build">on how to build libLLVMgold.so</a>.</li>
-    <li>Install the newly built binutils to <tt>$PREFIX</tt></li>
-    <li>Copy <tt>Release/lib/libLLVMgold.so</tt> to
-    <tt>$PREFIX/libexec/gcc/x86_64-unknown-linux-gnu/4.2.1/</tt> and
-    <tt>$PREFIX/lib/bfd-plugins/</tt></li>
-    <li>Set environment variables (<tt>$PREFIX</tt> is where you installed llvm-gcc and
-    binutils):
-    <pre class="doc_code">
-export CC="$PREFIX/bin/llvm-gcc -use-gold-plugin"
-export CXX="$PREFIX/bin/llvm-g++ -use-gold-plugin"
-export AR="$PREFIX/bin/ar"
-export NM="$PREFIX/bin/nm"
-export RANLIB=/bin/true #ranlib is not needed, and doesn't support .bc files in .a
-export CFLAGS="-O4"
-</pre>
-     </li>
-     <li>Or you can just set your path:
-    <pre class="doc_code">
-export PATH="$PREFIX/bin:$PATH"
-export CC="llvm-gcc -use-gold-plugin"
-export CXX="llvm-g++ -use-gold-plugin"
-export RANLIB=/bin/true
-export CFLAGS="-O4"
-</pre>
-     </li>
-     <li>Configure &amp; build the project as usual: <tt>./configure &amp;&amp; make &amp;&amp; make check</tt> </li>
-   </ul>
-   <p> The environment variable settings may work for non-autotooled projects
-   too, but you may need to set the <tt>LD</tt> environment variable as well.</p>
-</div>
-
-<!--=========================================================================-->
-<div class="doc_section"><a name="licensing">Licensing</a></div>
-<!--=========================================================================-->
-<div class="doc_text">
-  <p>Gold is licensed under the GPLv3. LLVMgold uses the interface file
-<tt>plugin-api.h</tt> from gold which means that the resulting LLVMgold.so
-binary is also GPLv3. This can still be used to link non-GPLv3 programs just
-as much as gold could without the plugin.</p>
-</div>
-
-<!-- *********************************************************************** -->
-<hr>
-<address>
-  <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
-  src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS"></a>
-  <a href="http://validator.w3.org/check/referer"><img
-  src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
-  <a href="mailto:nicholas at metrix.on.ca">Nick Lewycky</a><br>
-  <a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
-  Last modified: $Date: 2009-01-01 23:10:51 -0800 (Thu, 01 Jan 2009) $
-</address>
-</body>
-</html>
diff --git a/libclamav/c++/llvm/docs/HistoricalNotes/2000-11-18-EarlyDesignIdeas.txt b/libclamav/c++/llvm/docs/HistoricalNotes/2000-11-18-EarlyDesignIdeas.txt
deleted file mode 100644
index f086181..0000000
--- a/libclamav/c++/llvm/docs/HistoricalNotes/2000-11-18-EarlyDesignIdeas.txt
+++ /dev/null
@@ -1,74 +0,0 @@
-Date: Sat, 18 Nov 2000 09:19:35 -0600 (CST)
-From: Vikram Adve <vadve at cs.uiuc.edu>
-To: Chris Lattner <lattner at cs.uiuc.edu>
-Subject: a few thoughts
-
-I've been mulling over the virtual machine problem and I had some
-thoughts about some things for us to think about discuss:
-
-1. We need to be clear on our goals for the VM.  Do we want to emphasize
-   portability and safety like the Java VM?  Or shall we focus on the
-   architecture interface first (i.e., consider the code generation and
-   processor issues), since the architecture interface question is also
-   important for portable Java-type VMs?
-
-   This is important because the audiences for these two goals are very
-   different.  Architects and many compiler people care much more about
-   the second question.  The Java compiler and OS community care much more
-   about the first one.
-
-   Also, while the architecture interface question is important for
-   Java-type VMs, the design constraints are very different.
-
-
-2. Design issues to consider (an initial list that we should continue
-   to modify).  Note that I'm not trying to suggest actual solutions here,
-   but just various directions we can pursue:
-
-   a. A single-assignment VM, which we've both already been thinking about.
-
-   b. A strongly-typed VM.  One question is do we need the types to be
-      explicitly declared or should they be inferred by the dynamic compiler?
-
-   c. How do we get more high-level information into the VM while keeping
-      to a low-level VM design?
-
-        o  Explicit array references as operands?  An alternative is
-           to have just an array type, and let the index computations be
-           separate 3-operand instructions.
-
-        o  Explicit instructions to handle aliasing, e.g.s:
-           -- an instruction to say "I speculate that these two values are not
-              aliased, but check at runtime", like speculative execution in
-              EPIC?
-           -- or an instruction to check whether two values are aliased and
-              execute different code depending on the answer, somewhat like
-              predicated code in EPIC
-
-        o  (This one is a difficult but powerful idea.)
-           A "thread-id" field on every instruction that allows the static
-           compiler to generate a set of parallel threads, and then have
-           the runtime compiler and hardware do what they please with it.
-           This has very powerful uses, but thread-id on every instruction
-           is expensive in terms of instruction size and code size.
-           We would need to compactly encode it somehow.
-
-           Also, this will require some reading on at least two other
-           projects:
-                -- Multiscalar architecture from Wisconsin
-                -- Simultaneous multithreading architecture from Washington
-
-        o  Or forget all this and stick to a traditional instruction set?
-
-
-BTW, on an unrelated note, after the meeting yesterday, I did remember
-that you had suggested doing instruction scheduling on SSA form instead
-of a dependence DAG earlier in the semester.  When we talked about
-it yesterday, I didn't remember where the idea had come from but I
-remembered later.  Just giving credit where its due...
-
-Perhaps you can save the above as a file under RCS so you and I can
-continue to expand on this.
-
---Vikram
-
diff --git a/libclamav/c++/llvm/docs/HistoricalNotes/2000-11-18-EarlyDesignIdeasResp.txt b/libclamav/c++/llvm/docs/HistoricalNotes/2000-11-18-EarlyDesignIdeasResp.txt
deleted file mode 100644
index 1c725f5..0000000
--- a/libclamav/c++/llvm/docs/HistoricalNotes/2000-11-18-EarlyDesignIdeasResp.txt
+++ /dev/null
@@ -1,199 +0,0 @@
-Date: Sun, 19 Nov 2000 16:23:57 -0600 (CST)
-From: Chris Lattner <sabre at nondot.org>
-To: Vikram Adve <vadve at cs.uiuc.edu>
-Subject: Re: a few thoughts
-
-Okay... here are a few of my thoughts on this (it's good to know that we
-think so alike!):
-
-> 1. We need to be clear on our goals for the VM.  Do we want to emphasize
->    portability and safety like the Java VM?  Or shall we focus on the
->    architecture interface first (i.e., consider the code generation and
->    processor issues), since the architecture interface question is also
->    important for portable Java-type VMs?
-
-I forsee the architecture looking kinda like this: (which is completely
-subject to change)
-
-1. The VM code is NOT guaranteed safe in a java sense.  Doing so makes it
-   basically impossible to support C like languages.  Besides that,
-   certifying a register based language as safe at run time would be a
-   pretty expensive operation to have to do.  Additionally, we would like
-   to be able to statically eliminate many bounds checks in Java
-   programs... for example.
-
- 2. Instead, we can do the following (eventually): 
-   * Java bytecode is used as our "safe" representation (to avoid
-     reinventing something that we don't add much value to).  When the
-     user chooses to execute Java bytecodes directly (ie, not
-     precompiled) the runtime compiler can do some very simple
-     transformations (JIT style) to convert it into valid input for our
-     VM.  Performance is not wonderful, but it works right.
-   * The file is scheduled to be compiled (rigorously) at a later
-     time.  This could be done by some background process or by a second
-     processor in the system during idle time or something...
-   * To keep things "safe" ie to enforce a sandbox on Java/foreign code,
-     we could sign the generated VM code with a host specific private
-     key.  Then before the code is executed/loaded, we can check to see if
-     the trusted compiler generated the code.  This would be much quicker
-     than having to validate consistency (especially if bounds checks have
-     been removed, for example)
-
->    This is important because the audiences for these two goals are very
->    different.  Architects and many compiler people care much more about
->    the second question.  The Java compiler and OS community care much more
->    about the first one.
-
-3. By focusing on a more low level virtual machine, we have much more room
-   for value add.  The nice safe "sandbox" VM can be provided as a layer
-   on top of it.  It also lets us focus on the more interesting compilers
-   related projects.
-
-> 2. Design issues to consider (an initial list that we should continue
->    to modify).  Note that I'm not trying to suggest actual solutions here,
->    but just various directions we can pursue:
-
-Understood.  :)
-
->    a. A single-assignment VM, which we've both already been thinking
->       about.
-
-Yup, I think that this makes a lot of sense.  I am still intrigued,
-however, by the prospect of a minimally allocated VM representation... I
-think that it could have definate advantages for certain applications
-(think very small machines, like PDAs).  I don't, however, think that our
-initial implementations should focus on this.  :)
-
-Here are some other auxilliary goals that I think we should consider:
-
-1. Primary goal: Support a high performance dynamic compilation
-   system.  This means that we have an "ideal" division of labor between
-   the runtime and static compilers.  Of course, the other goals of the
-   system somewhat reduce the importance of this point (f.e. portability
-   reduces performance, but hopefully not much)
-2. Portability to different processors.  Since we are most familiar with
-   x86 and solaris, I think that these two are excellent candidates when
-   we get that far...
-3. Support for all languages & styles of programming (general purpose
-   VM).  This is the point that disallows java style bytecodes, where all
-   array refs are checked for bounds, etc...
-4. Support linking between different language families.  For example, call
-   C functions directly from Java without using the nasty/slow/gross JNI
-   layer.  This involves several subpoints:
-  A. Support for languages that require garbage collectors and integration
-     with languages that don't.  As a base point, we could insist on
-     always using a conservative GC, but implement free as a noop, f.e.
-
->    b. A strongly-typed VM.  One question is do we need the types to be
->       explicitly declared or should they be inferred by the dynamic
->       compiler?
-
-  B. This is kind of similar to another idea that I have: make OOP
-     constructs (virtual function tables, class heirarchies, etc) explicit
-     in the VM representation.  I believe that the number of additional
-     constructs would be fairly low, but would give us lots of important
-     information... something else that would/could be important is to
-     have exceptions as first class types so that they would be handled in
-     a uniform way for the entire VM... so that C functions can call Java
-     functions for example...
-
->    c. How do we get more high-level information into the VM while keeping
->       to a low-level VM design?
->       o  Explicit array references as operands?  An alternative is
->          to have just an array type, and let the index computations be
->          separate 3-operand instructions.
-
-   C. In the model I was thinking of (subject to change of course), we
-      would just have an array type (distinct from the pointer
-      types).  This would allow us to have arbitrarily complex index
-      expressions, while still distinguishing "load" from "Array load",
-      for example.  Perhaps also, switch jump tables would be first class
-      types as well?  This would allow better reasoning about the program.
-
-5. Support dynamic loading of code from various sources.  Already
-   mentioned above was the example of loading java bytecodes, but we want
-   to support dynamic loading of VM code as well.  This makes the job of
-   the runtime compiler much more interesting:  it can do interprocedural
-   optimizations that the static compiler can't do, because it doesn't
-   have all of the required information (for example, inlining from
-   shared libraries, etc...)
-
-6. Define a set of generally useful annotations to add to the VM
-   representation.  For example, a function can be analysed to see if it
-   has any sideeffects when run... also, the MOD/REF sets could be
-   calculated, etc... we would have to determine what is reasonable.  This
-   would generally be used to make IP optimizations cheaper for the
-   runtime compiler...
-
->       o  Explicit instructions to handle aliasing, e.g.s:
->            -- an instruction to say "I speculate that these two values are not
->               aliased, but check at runtime", like speculative execution in
->             EPIC?
->          -- or an instruction to check whether two values are aliased and
->             execute different code depending on the answer, somewhat like
->             predicated code in EPIC
-
-These are also very good points... if this can be determined at compile
-time.  I think that an epic style of representation (not the instruction
-packing, just the information presented) could be a very interesting model
-to use... more later...
-
->         o  (This one is a difficult but powerful idea.)
->          A "thread-id" field on every instruction that allows the static
->          compiler to generate a set of parallel threads, and then have
->          the runtime compiler and hardware do what they please with it.
->          This has very powerful uses, but thread-id on every instruction
->          is expensive in terms of instruction size and code size.
->          We would need to compactly encode it somehow.
-
-Yes yes yes!  :)  I think it would be *VERY* useful to include this kind
-of information (which EPIC architectures *implicitly* encode.  The trend
-that we are seeing supports this greatly:
-
-1. Commodity processors are getting massive SIMD support:
-   * Intel/Amd MMX/MMX2
-   * AMD's 3Dnow!
-   * Intel's SSE/SSE2
-   * Sun's VIS
-2. SMP is becoming much more common, especially in the server space.
-3. Multiple processors on a die are right around the corner.
-
-If nothing else, not designing this in would severely limit our future
-expansion of the project...
-
->          Also, this will require some reading on at least two other
->          projects:
->               -- Multiscalar architecture from Wisconsin
->               -- Simultaneous multithreading architecture from Washington
->
->       o  Or forget all this and stick to a traditional instruction set?
-
-Heh... :)  Well, from a pure research point of view, it is almost more
-attactive to go with the most extreme/different ISA possible.  On one axis
-you get safety and conservatism, and on the other you get degree of
-influence that the results have.  Of course the problem with pure research
-is that often times there is no concrete product of the research... :)
-
-> BTW, on an unrelated note, after the meeting yesterday, I did remember
-> that you had suggested doing instruction scheduling on SSA form instead
-> of a dependence DAG earlier in the semester.  When we talked about
-> it yesterday, I didn't remember where the idea had come from but I
-> remembered later.  Just giving credit where its due...
-
-:) Thanks.  
-
-> Perhaps you can save the above as a file under RCS so you and I can
-> continue to expand on this.
-
-I think it makes sense to do so when we get our ideas more formalized and
-bounce it back and forth a couple of times... then I'll do a more formal
-writeup of our goals and ideas.  Obviously our first implementation will
-not want to do all of the stuff that I pointed out above... be we will
-want to design the project so that we do not artificially limit ourselves
-at sometime in the future...
-
-Anyways, let me know what you think about these ideas... and if they sound
-reasonable...
-
--Chris
-
diff --git a/libclamav/c++/llvm/docs/HistoricalNotes/2000-12-06-EncodingIdea.txt b/libclamav/c++/llvm/docs/HistoricalNotes/2000-12-06-EncodingIdea.txt
deleted file mode 100644
index 8c45292..0000000
--- a/libclamav/c++/llvm/docs/HistoricalNotes/2000-12-06-EncodingIdea.txt
+++ /dev/null
@@ -1,30 +0,0 @@
-From: Chris Lattner [mailto:sabre at nondot.org]
-Sent: Wednesday, December 06, 2000 6:41 PM
-To: Vikram S. Adve
-Subject: Additional idea with respect to encoding
-
-Here's another idea with respect to keeping the common case instruction
-size down (less than 32 bits ideally):
-
-Instead of encoding an instruction to operate on two register numbers,
-have it operate on two negative offsets based on the current register
-number.  Therefore, instead of using:
-
-r57 = add r55, r56  (r57 is the implicit dest register, of course)
-
-We could use:
-
-r57 = add -2, -1
-
-My guess is that most SSA references are to recent values (especially if
-they correspond to expressions like (x+y*z+p*q/ ...), so the negative
-numbers would tend to stay small, even at the end of the procedure (where
-the implicit register destination number could be quite large).  Of course
-the negative sign is reduntant, so you would be storing small integers
-almost all of the time, and 5-6 bits worth of register number would be
-plenty for most cases...
-
-What do you think?
-
--Chris
-
diff --git a/libclamav/c++/llvm/docs/HistoricalNotes/2000-12-06-MeetingSummary.txt b/libclamav/c++/llvm/docs/HistoricalNotes/2000-12-06-MeetingSummary.txt
deleted file mode 100644
index b66e185..0000000
--- a/libclamav/c++/llvm/docs/HistoricalNotes/2000-12-06-MeetingSummary.txt
+++ /dev/null
@@ -1,83 +0,0 @@
-SUMMARY
--------
-
-We met to discuss the LLVM instruction format and bytecode representation:
-
-ISSUES RESOLVED
----------------
-
-1. We decided that we shall use a flat namespace to represent our 
-   variables in SSA form, as opposed to having a two dimensional namespace
-   of the original variable and the SSA instance subscript.
-
-ARGUMENT AGAINST:
-   * A two dimensional namespace would be valuable when doing alias 
-     analysis because the extra information can help limit the scope of
-     analysis.
-
-ARGUMENT FOR:
-   * Including this information would require that all users of the LLVM
-     bytecode would have to parse and handle it.  This would slow down the
-     common case and inflate the instruction representation with another
-     infinite variable space.
-
-REASONING:
-   * It was decided that because original variable sources could be
-     reconstructed from SSA form in linear time, that it would be an
-     unjustified expense for the common case to include the extra
-     information for one optimization.  Alias analysis itself is typically
-     greater than linear in asymptotic complexity, so this extra analaysis
-     would not affect the runtime of the optimization in a significant
-     way.  Additionally, this would be an unlikely optimization to do at
-     runtime.
-
-
-IDEAS TO CONSIDER
------------------
-
-1. Including dominator information in the LLVM bytecode
-   representation.  This is one example of an analysis result that may be
-   packaged with the bytecodes themselves.  As a conceptual implementation 
-   idea, we could include an immediate dominator number for each basic block
-   in the LLVM bytecode program.  Basic blocks could be numbered according
-   to the order of occurance in the bytecode representation.
-
-2. Including loop header and body information.  This would facilitate
-   detection of intervals and natural loops.
-
-UNRESOLVED ISSUES 
------------------ 
-
-1. Will oSUIF provide enough of an infrastructure to support the research
-   that we will be doing?  We know that it has less than stellar
-   performance, but hope that this will be of little importance for our
-   static compiler.  This could affect us if we decided to do some IP
-   research.  Also we do not yet understand the level of exception support
-   currently implemented.
-
-2. Should we consider the requirements of a direct hardware implementation
-   of the LLVM when we design it?  If so, several design issues should
-   have their priorities shifted.  The other option is to focus on a
-   software layer interpreting the LLVM in all cases.
-
-3. Should we use some form of packetized format to improve forward
-   compatibility?  For example, we could design the system to encode a
-   packet type and length field before analysis information, to allow a
-   runtime to skip information that it didn't understand in a bytecode
-   stream.  The obvious benefit would be for compatibility, the drawback
-   is that it would tend to splinter that 'standard' LLVM definition.
-
-4. Should we use fixed length instructions or variable length
-   instructions?  Fetching variable length instructions is expensive (for
-   either hardware or software based LLVM runtimes), but we have several
-   'infinite' spaces that instructions operate in (SSA register numbers,
-   type spaces, or packet length [if packets were implemented]).  Several
-   options were mentioned including: 
-     A. Using 16 or 32 bit numbers, which would be 'big enough'
-     B. A scheme similar to how UTF-8 works, to encode infinite numbers
-        while keeping small number small.
-     C. Use something similar to Huffman encoding, so that the most common
-        numbers are the smallest.
-
--Chris
-
diff --git a/libclamav/c++/llvm/docs/HistoricalNotes/2001-01-31-UniversalIRIdea.txt b/libclamav/c++/llvm/docs/HistoricalNotes/2001-01-31-UniversalIRIdea.txt
deleted file mode 100644
index 111706a..0000000
--- a/libclamav/c++/llvm/docs/HistoricalNotes/2001-01-31-UniversalIRIdea.txt
+++ /dev/null
@@ -1,39 +0,0 @@
-Date: Wed, 31 Jan 2001 12:04:33 -0600
-From: Vikram S. Adve <vadve at cs.uiuc.edu>
-To: Chris Lattner <lattner at cs.uiuc.edu>
-Subject: another thought
-
-I have a budding idea about making LLVM a little more ambitious: a
-customizable runtime system that can be used to implement language-specific
-virtual machines for many different languages.  E.g., a C vm, a C++ vm, a
-Java vm, a Lisp vm, ..
-
-The idea would be that LLVM would provide a standard set of runtime features
-(some low-level like standard assembly instructions with code generation and
-static and runtime optimization; some higher-level like type-safety and
-perhaps a garbage collection library).  Each language vm would select the
-runtime features needed for that language, extending or customizing them as
-needed.  Most of the machine-dependent code-generation and optimization
-features as well as low-level machine-independent optimizations (like PRE)
-could be provided by LLVM and should be sufficient for any language,
-simplifying the language compiler.  (This would also help interoperability
-between languages.)  Also, some or most of the higher-level
-machine-independent features like type-safety and access safety should be
-reusable by different languages, with minor extensions.  The language
-compiler could then focus on language-specific analyses and optimizations.
-
-The risk is that this sounds like a universal IR -- something that the
-compiler community has tried and failed to develop for decades, and is
-universally skeptical about.  No matter what we say, we won't be able to
-convince anyone that we have a universal IR that will work.  We need to
-think about whether LLVM is different or if has something novel that might
-convince people.  E.g., the idea of providing a package of separable
-features that different languages select from.  Also, using SSA with or
-without type-safety as the intermediate representation.
-
-One interesting starting point would be to discuss how a JVM would be
-implemented on top of LLVM a bit more.  That might give us clues on how to
-structure LLVM to support one or more language VMs.
-
---Vikram
-
diff --git a/libclamav/c++/llvm/docs/HistoricalNotes/2001-02-06-TypeNotationDebate.txt b/libclamav/c++/llvm/docs/HistoricalNotes/2001-02-06-TypeNotationDebate.txt
deleted file mode 100644
index c09cf1f..0000000
--- a/libclamav/c++/llvm/docs/HistoricalNotes/2001-02-06-TypeNotationDebate.txt
+++ /dev/null
@@ -1,67 +0,0 @@
-Date: Tue, 6 Feb 2001 20:27:37 -0600 (CST)
-From: Chris Lattner <sabre at nondot.org>
-To: Vikram S. Adve <vadve at cs.uiuc.edu>
-Subject: Type notation debate...
-
-This is the way that I am currently planning on implementing types:
-
-Primitive Types:        
-type ::= void|bool|sbyte|ubyte|short|ushort|int|uint|long|ulong
-
-Method:
-typelist ::= typelisth | /*empty*/
-typelisth ::= type | typelisth ',' type
-type ::= type (typelist)
-
-Arrays (without and with size):
-type ::= '[' type ']' | '[' INT ',' type ']'
-
-Pointer:
-type ::= type '*'
-
-Structure:
-type ::= '{' typelist '}'
-
-Packed:
-type ::= '<' INT ',' type '>'
-
-Simple examples:
-
-[[ %4, int ]]   - array of (array of 4 (int))
-[ { int, int } ] - Array of structure
-[ < %4, int > ] - Array of 128 bit SIMD packets
-int (int, [[int, %4]])  - Method taking a 2d array and int, returning int
-
-
-Okay before you comment, please look at:
-
-http://www.research.att.com/~bs/devXinterview.html
-
-Search for "In another interview, you defined the C declarator syntax as
-an experiment that failed. However, this syntactic construct has been
-around for 27 years and perhaps more; why do you consider it problematic
-(except for its cumbersome syntax)?" and read that response for me.  :)
-
-Now with this syntax, his example would be represented as:
-
-[ %10, bool (int, int) * ] *
-
-vs 
-
-bool (*(*)[10])(int, int)
-
-in C.
-
-Basically, my argument for this type construction system is that it is
-VERY simple to use and understand (although it IS different than C, it is
-very simple and straightforward, which C is NOT).  In fact, I would assert
-that most programmers TODAY do not understand pointers to member
-functions, and have to look up an example when they have to write them.
-
-In my opinion, it is critically important to have clear and concise type
-specifications, because types are going to be all over the programs.
-
-Let me know your thoughts on this.  :)
-
--Chris
-
diff --git a/libclamav/c++/llvm/docs/HistoricalNotes/2001-02-06-TypeNotationDebateResp1.txt b/libclamav/c++/llvm/docs/HistoricalNotes/2001-02-06-TypeNotationDebateResp1.txt
deleted file mode 100644
index 8bfefbf..0000000
--- a/libclamav/c++/llvm/docs/HistoricalNotes/2001-02-06-TypeNotationDebateResp1.txt
+++ /dev/null
@@ -1,75 +0,0 @@
-Date: Thu, 8 Feb 2001 08:42:04 -0600
-From: Vikram S. Adve <vadve at cs.uiuc.edu>
-To: Chris Lattner <sabre at nondot.org>
-Subject: RE: Type notation debate...
-
-Chris,
-
-> Okay before you comment, please look at:
->
-> http://www.research.att.com/~bs/devXinterview.html
-
-I read this argument.  Even before that, I was already in agreement with you
-and him that the C declarator syntax is difficult and confusing.
-
-But in fact, if you read the entire answer carefully, he came to the same
-conclusion I do: that you have to go with familiar syntax over logical
-syntax because familiarity is such a strong force:
-
-        "However, familiarity is a strong force. To compare, in English, we
-live
-more or less happily with the absurd rules for "to be" (am, are, is, been,
-was, were, ...) and all attempts to simplify are treated with contempt or
-(preferably) humor. It be a curious world and it always beed."
-
-> Basically, my argument for this type construction system is that it is
-> VERY simple to use and understand (although it IS different than C, it is
-> very simple and straightforward, which C is NOT).  In fact, I would assert
-> that most programmers TODAY do not understand pointers to member
-> functions, and have to look up an example when they have to write them.
-
-Again, I don't disagree with this at all.  But to some extent this
-particular problem is inherently difficult.  Your syntax for the above
-example may be easier for you to read because this is the way you have been
-thinking about it.  Honestly, I don't find it much easier than the C syntax.
-In either case, I would have to look up an example to write pointers to
-member functions.
-
-But pointers to member functions are nowhere near as common as arrays.  And
-the old array syntax:
-        type [ int, int, ...]
-is just much more familiar and clear to people than anything new you
-introduce, no matter how logical it is.  Introducing a new syntax that may
-make function pointers easier but makes arrays much more difficult seems
-very risky to me.
-
-> In my opinion, it is critically important to have clear and concise type
-> specifications, because types are going to be all over the programs.
-
-I absolutely agree.  But the question is, what is more clear and concise?
-The syntax programmers are used to out of years of experience or a new
-syntax that they have never seen that has a more logical structure.  I think
-the answer is the former.  Sometimes, you have to give up a better idea
-because you can't overcome sociological barriers to it.  Qwerty keyboards
-and Windows are two classic examples of bad technology that are difficult to
-root out.
-
-P.S.  Also, while I agree that most your syntax is more logical, there is
-one part that isn't:
-
-Arrays (without and with size):
-type ::= '[' type ']' | '[' INT ',' type ']'.
-
-The arrays with size lists the dimensions and the type in a single list.
-That is just too confusing:
-        [10, 40, int]
-This seems to be a 3-D array where the third dimension is something strange.
-It is too confusing to have a list of 3 things, some of which are dimensions
-and one is a type.  Either of the following would be better:
-
-        array [10, 40] of int
-or
-        int [10, 40]
-
---Vikram
-
diff --git a/libclamav/c++/llvm/docs/HistoricalNotes/2001-02-06-TypeNotationDebateResp2.txt b/libclamav/c++/llvm/docs/HistoricalNotes/2001-02-06-TypeNotationDebateResp2.txt
deleted file mode 100644
index 6e97841..0000000
--- a/libclamav/c++/llvm/docs/HistoricalNotes/2001-02-06-TypeNotationDebateResp2.txt
+++ /dev/null
@@ -1,53 +0,0 @@
-Date: Thu, 8 Feb 2001 14:31:05 -0600 (CST)
-From: Chris Lattner <sabre at nondot.org>
-To: Vikram S. Adve <vadve at cs.uiuc.edu>
-Subject: RE: Type notation debate...
-
-> Arrays (without and with size):
-> type ::= '[' type ']' | '[' INT ',' type ']'.
-> 
-> The arrays with size lists the dimensions and the type in a single list.
-> That is just too confusing:
-
->       [10, 40, int]
-> This seems to be a 3-D array where the third dimension is something strange.
-> It is too confusing to have a list of 3 things, some of which are dimensions
-> and one is a type. 
-
-The above grammar indicates that there is only one integer parameter, ie
-the upper bound.  The lower bound is always implied to be zero, for
-several reasons:
-
-* As a low level VM, we want to expose addressing computations
-  explicitly.  Since the lower bound must always be known in a high level
-  language statically, the language front end can do the translation
-  automatically.
-* This fits more closely with what Java needs, ie what we need in the
-  short term.  Java arrays are always zero based.
-
-If a two element list is too confusing, I would recommend an alternate
-syntax of:
-
-type ::= '[' type ']' | '[' INT 'x' type ']'.
-
-For example:
-  [12 x int]
-  [12x int]
-  [ 12 x [ 4x int ]]
-
-Which is syntactically nicer, and more explicit.
-
-> Either of the following would be better:
->       array [10, 40] of int
-
-I considered this approach for arrays in general (ie array of int/ array
-of 12 int), but found that it made declarations WAY too long.  Remember
-that because of the nature of llvm, you get a lot of types strewn all over
-the program, and using the 'typedef' like facility is not a wonderful
-option, because then types aren't explicit anymore.
-
-I find this email interesting, because you contradict the previous email
-you sent, where you recommend that we stick to C syntax....
-
--Chris
-
diff --git a/libclamav/c++/llvm/docs/HistoricalNotes/2001-02-06-TypeNotationDebateResp4.txt b/libclamav/c++/llvm/docs/HistoricalNotes/2001-02-06-TypeNotationDebateResp4.txt
deleted file mode 100644
index 7b90327..0000000
--- a/libclamav/c++/llvm/docs/HistoricalNotes/2001-02-06-TypeNotationDebateResp4.txt
+++ /dev/null
@@ -1,89 +0,0 @@
-> But in fact, if you read the entire answer carefully, he came to the same
-> conclusion I do: that you have to go with familiar syntax over logical
-> syntax because familiarity is such a strong force:
->       "However, familiarity is a strong force. To compare, in English, we
-live
-> more or less happily with the absurd rules for "to be" (am, are, is, been,
-> was, were, ...) and all attempts to simplify are treated with contempt or
-> (preferably) humor. It be a curious world and it always beed."
-
-Although you have to remember that his situation was considerably
-different than ours.  He was in a position where he was designing a high
-level language that had to be COMPATIBLE with C.  Our language is such
-that a new person would have to learn the new, different, syntax
-anyways.  Making them learn about the type system does not seem like much
-of a stretch from learning the opcodes and how SSA form works, and how
-everything ties together...
-
-> > Basically, my argument for this type construction system is that it is
-> > VERY simple to use and understand (although it IS different than C, it is
-> > very simple and straightforward, which C is NOT).  In fact, I would assert
-> > that most programmers TODAY do not understand pointers to member
-> > functions, and have to look up an example when they have to write them.
-
-> Again, I don't disagree with this at all.  But to some extent this
-> particular problem is inherently difficult.  Your syntax for the above
-> example may be easier for you to read because this is the way you have been
-> thinking about it.  Honestly, I don't find it much easier than the C syntax.
-> In either case, I would have to look up an example to write pointers to
-> member functions.
-
-I would argue that because the lexical structure of the language is self
-consistent, any person who spent a significant amount of time programming
-in LLVM directly would understand how to do it without looking it up in a
-manual.  The reason this does not work for C is because you rarely have to
-declare these pointers, and the syntax is inconsistent with the method
-declaration and calling syntax.
-
-> But pointers to member functions are nowhere near as common as arrays.
-
-Very true.  If you're implementing an object oriented language, however,
-remember that you have to do all the pointer to member function stuff
-yourself.... so everytime you invoke a virtual method one is involved
-(instead of having C++ hide it for you behind "syntactic sugar").
-
-> And the old array syntax:
->       type [ int, int, ...]
-> is just much more familiar and clear to people than anything new you
-> introduce, no matter how logical it is.  
-
-Erm... excuse me but how is this the "old array syntax"?  If you are
-arguing for consistency with C, you should be asking for 'type int []',
-which is significantly different than the above (beside the above
-introduces a new operator and duplicates information
-needlessly).  Basically what I am suggesting is exactly the above without
-the fluff.  So instead of:
-
-       type [ int, int, ...]
-
-you use:
-
-       type [ int ]
-
-> Introducing a new syntax that may
-> make function pointers easier but makes arrays much more difficult seems
-> very risky to me.
-
-This is not about function pointers.  This is about consistency in the
-type system, and consistency with the rest of the language.  The point
-above does not make arrays any more difficult to use, and makes the
-structure of types much more obvious than the "c way".
-
-> > In my opinion, it is critically important to have clear and concise type
-> > specifications, because types are going to be all over the programs.
-> 
-> I absolutely agree.  But the question is, what is more clear and concise?
-> The syntax programmers are used to out of years of experience or a new
-> syntax that they have never seen that has a more logical structure.  I think
-> the answer is the former.  Sometimes, you have to give up a better idea
-> because you can't overcome sociological barriers to it.  Qwerty keyboards
-> and Windows are two classic examples of bad technology that are difficult to
-> root out.
-
-Very true, but you seem to be advocating a completely different Type
-system than C has, in addition to it not offering the advantages of clear
-structure that the system I recommended does... so you seem to not have a
-problem with changing this, just with what I change it to.  :)
-
--Chris
-
diff --git a/libclamav/c++/llvm/docs/HistoricalNotes/2001-02-09-AdveComments.txt b/libclamav/c++/llvm/docs/HistoricalNotes/2001-02-09-AdveComments.txt
deleted file mode 100644
index 5503233..0000000
--- a/libclamav/c++/llvm/docs/HistoricalNotes/2001-02-09-AdveComments.txt
+++ /dev/null
@@ -1,120 +0,0 @@
-Ok, here are my comments and suggestions about the LLVM instruction set.
-We should discuss some now, but can discuss many of them later, when we
-revisit synchronization, type inference, and other issues.
-(We have discussed some of the comments already.)
-
-
-o  We should consider eliminating the type annotation in cases where it is
-   essentially obvious from the instruction type, e.g., in br, it is obvious
-   that the first arg. should be a bool and the other args should be labels:
-
-	br bool <cond>, label <iftrue>, label <iffalse>
-
-   I think your point was that making all types explicit improves clarity
-   and readability.  I agree to some extent, but it also comes at the cost
-   of verbosity.  And when the types are obvious from people's experience
-   (e.g., in the br instruction), it doesn't seem to help as much.
-
-
-o  On reflection, I really like your idea of having the two different switch
-   types (even though they encode implementation techniques rather than
-   semantics).  It should simplify building the CFG and my guess is it could
-   enable some significant optimizations, though we should think about which.
-
-
-o  In the lookup-indirect form of the switch, is there a reason not to make
-   the val-type uint?  Most HLL switch statements (including Java and C++)
-   require that anyway.  And it would also make the val-type uniform 
-   in the two forms of the switch.
-
-   I did see the switch-on-bool examples and, while cute, we can just use
-   the branch instructions in that particular case.
-
-
-o  I agree with your comment that we don't need 'neg'.
-
-
-o  There's a trade-off with the cast instruction:
-   +  it avoids having to define all the upcasts and downcasts that are
-      valid for the operands of each instruction  (you probably have thought
-      of other benefits also)
-   -  it could make the bytecode significantly larger because there could
-      be a lot of cast operations
-
-
-o  Making the second arg. to 'shl' a ubyte seems good enough to me.
-   255 positions seems adequate for several generations of machines
-   and is more compact than uint.
-
-
-o  I still have some major concerns about including malloc and free in the
-   language (either as builtin functions or instructions).  LLVM must be
-   able to represent code from many different languages.  Languages such as
-   C, C++ Java and Fortran 90 would not be able to use our malloc anyway
-   because each of them will want to provide a library implementation of it.
-
-   This gets even worse when code from different languages is linked
-   into a single executable (which is fairly common in large apps).
-   Having a single malloc would just not suffice, and instead would simply
-   complicate the picture further because it adds an extra variant in
-   addition to the one each language provides.
-
-   Instead, providing a default library version of malloc and free
-   (and perhaps a malloc_gc with garbage collection instead of free)
-   would make a good implementation available to anyone who wants it.
-
-   I don't recall all your arguments in favor so let's discuss this again,
-   and soon.
-
-
-o  'alloca' on the other hand sounds like a good idea, and the
-   implementation seems fairly language-independent so it doesn't have the
-   problems with malloc listed above.
-
-
-o  About indirect call:
-   Your option #2 sounded good to me.  I'm not sure I understand your
-   concern about an explicit 'icall' instruction?
-
-
-o  A pair of important synchronization instr'ns to think about:
-     load-linked
-     store-conditional
-
-
-o  Other classes of instructions that are valuable for pipeline performance:
-     conditional-move		 
-     predicated instructions
-
-
-o  I believe tail calls are relatively easy to identify; do you know why
-   .NET has a tailcall instruction?
-
-
-o  I agree that we need a static data space.  Otherwise, emulating global
-   data gets unnecessarily complex.
-
-
-o  About explicit parallelism:
-
-   We once talked about adding a symbolic thread-id field to each
-   instruction.  (It could be optional so single-threaded codes are
-   not penalized.)  This could map well to multi-threaded architectures
-   while providing easy ILP for single-threaded onces.  But it is probably
-   too radical an idea to include in a base version of LLVM.  Instead, it
-   could a great topic for a separate study.
-
-   What is the semantics of the IA64 stop bit?
-
-
-
-
-o  And finally, another thought about the syntax for arrays :-)
-
-   Although this syntax:
-	  array <dimension-list> of <type>
-   is verbose, it will be used only in the human-readable assembly code so
-   size should not matter.  I think we should consider it because I find it
-   to be the clearest syntax.  It could even make arrays of function
-   pointers somewhat readable.
-
diff --git a/libclamav/c++/llvm/docs/HistoricalNotes/2001-02-09-AdveCommentsResponse.txt b/libclamav/c++/llvm/docs/HistoricalNotes/2001-02-09-AdveCommentsResponse.txt
deleted file mode 100644
index 5c87330..0000000
--- a/libclamav/c++/llvm/docs/HistoricalNotes/2001-02-09-AdveCommentsResponse.txt
+++ /dev/null
@@ -1,245 +0,0 @@
-From: Chris Lattner <sabre at nondot.org>
-To: "Vikram S. Adve" <vadve at cs.uiuc.edu>
-Subject: Re: LLVM Feedback
-
-I've included your feedback in the /home/vadve/lattner/llvm/docs directory
-so that it will live in CVS eventually with the rest of LLVM.  I've
-significantly updated the documentation to reflect the changes you
-suggested, as specified below:
-
-> We should consider eliminating the type annotation in cases where it is
-> essentially obvious from the instruction type:
->        br bool <cond>, label <iftrue>, label <iffalse>
-> I think your point was that making all types explicit improves clarity
-> and readability.  I agree to some extent, but it also comes at the
-> cost of verbosity.  And when the types are obvious from people's
-> experience (e.g., in the br instruction), it doesn't seem to help as
-> much.
-
-Very true.  We should discuss this more, but my reasoning is more of a
-consistency argument.  There are VERY few instructions that can have all
-of the types eliminated, and doing so when available unnecesarily makes
-the language more difficult to handle.  Especially when you see 'int
-%this' and 'bool %that' all over the place, I think it would be
-disorienting to see:
-
-  br %predicate, %iftrue, %iffalse
-
-for branches.  Even just typing that once gives me the creeps. ;)  Like I
-said, we should probably discuss this further in person...
-
-> On reflection, I really like your idea of having the two different
-> switch types (even though they encode implementation techniques rather
-> than semantics).  It should simplify building the CFG and my guess is it
-> could enable some significant optimizations, though we should think
-> about which.
-
-Great.  I added a note to the switch section commenting on how the VM
-should just use the instruction type as a hint, and that the
-implementation may choose altermate representations (such as predicated
-branches).
-
-> In the lookup-indirect form of the switch, is there a reason not to
-> make the val-type uint?
-
-No.  This was something I was debating for a while, and didn't really feel
-strongly about either way.  It is common to switch on other types in HLL's
-(for example signed int's are particually common), but in this case, all
-that will be added is an additional 'cast' instruction.  I removed that
-from the spec.
-
-> I agree with your comment that we don't need 'neg'
-
-Removed.
-
-> There's a trade-off with the cast instruction:
->  +  it avoids having to define all the upcasts and downcasts that are
->     valid for the operands of each instruction  (you probably have
->     thought of other benefits also)
->  -  it could make the bytecode significantly larger because there could
->     be a lot of cast operations
-
- + You NEED casts to represent things like:
-    void foo(float);
-    ...
-    int x;
-    ...
-    foo(x);
-   in a language like C.  Even in a Java like language, you need upcasts
-   and some way to implement dynamic downcasts.
- + Not all forms of instructions take every type (for example you can't
-   shift by a floating point number of bits), thus SOME programs will need
-   implicit casts.
-
-To be efficient and to avoid your '-' point above, we just have to be
-careful to specify that the instructions shall operate on all common
-types, therefore casting should be relatively uncommon.  For example all
-of the arithmetic operations work on almost all data types.
-
-> Making the second arg. to 'shl' a ubyte seems good enough to me.
-> 255 positions seems adequate for several generations of machines
-
-Okay, that comment is removed.
-
-> and is more compact than uint.
-
-No, it isn't.  Remember that the bytecode encoding saves value slots into
-the bytecode instructions themselves, not constant values.  This is
-another case where we may introduce more cast instructions (but we will
-also reduce the number of opcode variants that must be supported by a
-virtual machine).  Because most shifts are by constant values, I don't
-think that we'll have to cast many shifts.  :)
-
-> I still have some major concerns about including malloc and free in the
-> language (either as builtin functions or instructions).
-
-Agreed.  How about this proposal:
-
-malloc/free are either built in functions or actual opcodes.  They provide
-all of the type safety that the document would indicate, blah blah
-blah. :)
-
-Now, because of all of the excellent points that you raised, an
-implementation may want to override the default malloc/free behavior of
-the program.  To do this, they simply implement a "malloc" and
-"free" function.  The virtual machine will then be defined to use the user
-defined malloc/free function (which return/take void*'s, not type'd
-pointers like the builtin function would) if one is available, otherwise
-fall back on a system malloc/free.
-
-Does this sound like a good compromise?  It would give us all of the
-typesafety/elegance in the language while still allowing the user to do
-all the cool stuff they want to...
-
->  'alloca' on the other hand sounds like a good idea, and the
->  implementation seems fairly language-independent so it doesn't have the
->  problems with malloc listed above.
-
-Okay, once we get the above stuff figured out, I'll put it all in the
-spec.
-
->  About indirect call:
->  Your option #2 sounded good to me.  I'm not sure I understand your
->  concern about an explicit 'icall' instruction?
-
-I worry too much.  :)  The other alternative has been removed. 'icall' is
-now up in the instruction list next to 'call'.
-
-> I believe tail calls are relatively easy to identify; do you know why
-> .NET has a tailcall instruction?
-
-Although I am just guessing, I believe it probably has to do with the fact
-that they want languages like Haskell and lisp to be efficiently runnable
-on their VM.  Of course this means that the VM MUST implement tail calls
-'correctly', or else life will suck.  :)  I would put this into a future
-feature bin, because it could be pretty handy...
-
->  A pair of important synchronization instr'ns to think about:
->    load-linked
->    store-conditional
-
-What is 'load-linked'?  I think that (at least for now) I should add these
-to the 'possible extensions' section, because they are not immediately
-needed...
-
-> Other classes of instructions that are valuable for pipeline
-> performance:
->    conditional-move            
->    predicated instructions
-
-Conditional move is effectly a special case of a predicated
-instruction... and I think that all predicated instructions can possibly
-be implemented later in LLVM.  It would significantly change things, and
-it doesn't seem to be very necessary right now.  It would seem to
-complicate flow control analysis a LOT in the virtual machine.  I would
-tend to prefer that a predicated architecture like IA64 convert from a
-"basic block" representation to a predicated rep as part of it's dynamic
-complication phase.  Also, if a basic block contains ONLY a move, then
-that can be trivally translated into a conditional move...
-
-> I agree that we need a static data space.  Otherwise, emulating global
-> data gets unnecessarily complex.
-
-Definately.  Also a later item though.  :)
-
-> We once talked about adding a symbolic thread-id field to each
-> ..
-> Instead, it could a great topic for a separate study.
-
-Agreed.  :)
-
-> What is the semantics of the IA64 stop bit?
-
-Basically, the IA64 writes instructions like this:
-mov ...
-add ...
-sub ...
-op xxx
-op xxx
-;;
-mov ...
-add ...
-sub ...
-op xxx
-op xxx
-;;
-
-Where the ;; delimits a group of instruction with no dependencies between
-them, which can all be executed concurrently (to the limits of the
-available functional units).  The ;; gets translated into a bit set in one
-of the opcodes.
-
-The advantages of this representation is that you don't have to do some
-kind of 'thread id scheduling' pass by having to specify ahead of time how
-many threads to use, and the representation doesn't have a per instruction
-overhead...
-
-> And finally, another thought about the syntax for arrays :-)
->  Although this syntax:
->         array <dimension-list> of <type>
->  is verbose, it will be used only in the human-readable assembly code so
->  size should not matter.  I think we should consider it because I find it
->  to be the clearest syntax.  It could even make arrays of function
->  pointers somewhat readable.
-
-My only comment will be to give you an example of why this is a bad
-idea.  :)
-
-Here is an example of using the switch statement (with my recommended
-syntax):
-
-switch uint %val, label %otherwise, 
-       [%3 x {uint, label}] [ { uint %57, label %l1 }, 
-                              { uint %20, label %l2 }, 
-                              { uint %14, label %l3 } ]
-
-Here it is with the syntax you are proposing:
-
-switch uint %val, label %otherwise, 
-       array %3 of {uint, label} 
-              array of {uint, label}
-                              { uint %57, label %l1 },
-                              { uint %20, label %l2 },
-                              { uint %14, label %l3 }
-
-Which is ambiguous and very verbose. It would be possible to specify
-constants with [] brackets as in my syntax, which would look like this:
-
-switch uint %val, label %otherwise,
-       array %3 of {uint, label}  [ { uint %57, label %l1 },
-                                    { uint %20, label %l2 },
-                                    { uint %14, label %l3 } ]
-
-But then the syntax is inconsistent between type definition and constant
-definition (why do []'s enclose the constants but not the types??).  
-
-Anyways, I'm sure that there is much debate still to be had over
-this... :)
-
--Chris
-
-http://www.nondot.org/~sabre/os/
-http://www.nondot.org/MagicStats/
-http://korbit.sourceforge.net/
-
-
diff --git a/libclamav/c++/llvm/docs/HistoricalNotes/2001-02-13-Reference-Memory.txt b/libclamav/c++/llvm/docs/HistoricalNotes/2001-02-13-Reference-Memory.txt
deleted file mode 100644
index 2c7534d..0000000
--- a/libclamav/c++/llvm/docs/HistoricalNotes/2001-02-13-Reference-Memory.txt
+++ /dev/null
@@ -1,39 +0,0 @@
-Date: Tue, 13 Feb 2001 13:29:52 -0600 (CST)
-From: Chris Lattner <sabre at nondot.org>
-To: Vikram S. Adve <vadve at cs.uiuc.edu>
-Subject: LLVM Concerns...
-
-
-I've updated the documentation to include load store and allocation
-instructions (please take a look and let me know if I'm on the right
-track):
-
-file:/home/vadve/lattner/llvm/docs/LangRef.html#memoryops
-
-I have a couple of concerns I would like to bring up:
-
-1. Reference types
-   Right now, I've spec'd out the language to have a pointer type, which
-   works fine for lots of stuff... except that Java really has
-   references: constrained pointers that cannot be manipulated: added and
-   subtracted, moved, etc... Do we want to have a type like this?  It
-   could be very nice for analysis (pointer always points to the start of
-   an object, etc...) and more closely matches Java semantics.  The
-   pointer type would be kept for C++ like semantics.  Through analysis,
-   C++ pointers could be promoted to references in the LLVM
-   representation.
-
-2. Our "implicit" memory references in assembly language:
-   After thinking about it, this model has two problems:
-      A. If you do pointer analysis and realize that two stores are
-         independent and can share the same memory source object, there is
-         no way to represent this in either the bytecode or assembly.
-      B. When parsing assembly/bytecode, we effectively have to do a full
-         SSA generation/PHI node insertion pass to build the dependencies
-         when we don't want the "pinned" representation.  This is not
-         cool.
-   I'm tempted to make memory references explicit in both the assembly and
-   bytecode to get around this... what do you think?
-
--Chris
-
diff --git a/libclamav/c++/llvm/docs/HistoricalNotes/2001-02-13-Reference-MemoryResponse.txt b/libclamav/c++/llvm/docs/HistoricalNotes/2001-02-13-Reference-MemoryResponse.txt
deleted file mode 100644
index 5053433..0000000
--- a/libclamav/c++/llvm/docs/HistoricalNotes/2001-02-13-Reference-MemoryResponse.txt
+++ /dev/null
@@ -1,47 +0,0 @@
-Date: Tue, 13 Feb 2001 18:25:42 -0600
-From: Vikram S. Adve <vadve at cs.uiuc.edu>
-To: Chris Lattner <sabre at nondot.org>
-Subject: RE: LLVM Concerns...
-
-> 1. Reference types
->    Right now, I've spec'd out the language to have a pointer type, which
->    works fine for lots of stuff... except that Java really has
->    references: constrained pointers that cannot be manipulated: added and
->    subtracted, moved, etc... Do we want to have a type like this?  It
->    could be very nice for analysis (pointer always points to the start of
->    an object, etc...) and more closely matches Java semantics.  The
->    pointer type would be kept for C++ like semantics.  Through analysis,
->    C++ pointers could be promoted to references in the LLVM
->    representation.
-
-
-You're right, having references would be useful.  Even for C++ the *static*
-compiler could generate references instead of pointers with fairly
-straightforward analysis.  Let's include a reference type for now.  But I'm
-also really concerned that LLVM is becoming big and complex and (perhaps)
-too high-level.  After we get some initial performance results, we may have
-a clearer idea of what our goals should be and we should revisit this
-question then.
-
-> 2. Our "implicit" memory references in assembly language:
->    After thinking about it, this model has two problems:
->       A. If you do pointer analysis and realize that two stores are
->          independent and can share the same memory source object,
-
-not sure what you meant by "share the same memory source object"
-
-> there is
->          no way to represent this in either the bytecode or assembly.
->       B. When parsing assembly/bytecode, we effectively have to do a full
->          SSA generation/PHI node insertion pass to build the dependencies
->          when we don't want the "pinned" representation.  This is not
->          cool.
-
-I understand the concern.  But again, let's focus on the performance first
-and then look at the language design issues.  E.g., it would be good to know
-how big the bytecode files are before expanding them further.  I am pretty
-keen to explore the implications of LLVM for mobile devices.  Both bytecode
-size and power consumption are important to consider there.
-
---Vikram
-
diff --git a/libclamav/c++/llvm/docs/HistoricalNotes/2001-04-16-DynamicCompilation.txt b/libclamav/c++/llvm/docs/HistoricalNotes/2001-04-16-DynamicCompilation.txt
deleted file mode 100644
index 5f7843a..0000000
--- a/libclamav/c++/llvm/docs/HistoricalNotes/2001-04-16-DynamicCompilation.txt
+++ /dev/null
@@ -1,49 +0,0 @@
-By Chris:
-
-LLVM has been designed with two primary goals in mind.  First we strive to 
-enable the best possible division of labor between static and dynamic 
-compilers, and second, we need a flexible and powerful interface 
-between these two complementary stages of compilation.  We feel that 
-providing a solution to these two goals will yield an excellent solution 
-to the performance problem faced by modern architectures and programming 
-languages.
-
-A key insight into current compiler and runtime systems is that a 
-compiler may fall in anywhere in a "continuum of compilation" to do its 
-job.  On one side, scripting languages statically compile nothing and 
-dynamically compile (or equivalently, interpret) everything.  On the far 
-other side, traditional static compilers process everything statically and 
-nothing dynamically.  These approaches have typically been seen as a 
-tradeoff between performance and portability.  On a deeper level, however, 
-there are two reasons that optimal system performance may be obtained by a
-system somewhere in between these two extremes: Dynamic application 
-behavior and social constraints.
-
-From a technical perspective, pure static compilation cannot ever give 
-optimal performance in all cases, because applications have varying dynamic
-behavior that the static compiler cannot take into consideration.  Even 
-compilers that support profile guided optimization generate poor code in 
-the real world, because using such optimization tunes that application 
-to one particular usage pattern, whereas real programs (as opposed to 
-benchmarks) often have several different usage patterns.
-
-On a social level, static compilation is a very shortsighted solution to 
-the performance problem.  Instruction set architectures (ISAs) continuously 
-evolve, and each implementation of an ISA (a processor) must choose a set 
-of tradeoffs that make sense in the market context that it is designed for.  
-With every new processor introduced, the vendor faces two fundamental 
-problems: First, there is a lag time between when a processor is introduced 
-to when compilers generate quality code for the architecture.  Secondly, 
-even when compilers catch up to the new architecture there is often a large 
-body of legacy code that was compiled for previous generations and will 
-not or can not be upgraded.  Thus a large percentage of code running on a 
-processor may be compiled quite sub-optimally for the current 
-characteristics of the dynamic execution environment.
-
-For these reasons, LLVM has been designed from the beginning as a long-term 
-solution to these problems.  Its design allows the large body of platform 
-independent, static, program optimizations currently in compilers to be 
-reused unchanged in their current form.  It also provides important static 
-type information to enable powerful dynamic and link time optimizations 
-to be performed quickly and efficiently.  This combination enables an 
-increase in effective system performance for real world environments.
diff --git a/libclamav/c++/llvm/docs/HistoricalNotes/2001-05-18-ExceptionHandling.txt b/libclamav/c++/llvm/docs/HistoricalNotes/2001-05-18-ExceptionHandling.txt
deleted file mode 100644
index b546301..0000000
--- a/libclamav/c++/llvm/docs/HistoricalNotes/2001-05-18-ExceptionHandling.txt
+++ /dev/null
@@ -1,202 +0,0 @@
-Meeting notes: Implementation idea: Exception Handling in C++/Java
-
-The 5/18/01 meeting discussed ideas for implementing exceptions in LLVM.
-We decided that the best solution requires a set of library calls provided by
-the VM, as well as an extension to the LLVM function invocation syntax.
-
-The LLVM function invocation instruction previously looks like this (ignoring
-types):
-
-  call func(arg1, arg2, arg3)
-
-The extension discussed today adds an optional "with" clause that 
-associates a label with the call site.  The new syntax looks like this:
-
-  call func(arg1, arg2, arg3) with funcCleanup
-
-This funcHandler always stays tightly associated with the call site (being
-encoded directly into the call opcode itself), and should be used whenever
-there is cleanup work that needs to be done for the current function if 
-an exception is thrown by func (or if we are in a try block).
-
-To support this, the VM/Runtime provide the following simple library 
-functions (all syntax in this document is very abstract):
-
-typedef struct { something } %frame;
-  The VM must export a "frame type", that is an opaque structure used to 
-  implement different types of stack walking that may be used by various
-  language runtime libraries. We imagine that it would be typical to 
-  represent a frame with a PC and frame pointer pair, although that is not 
-  required.
-
-%frame getStackCurrentFrame();
-  Get a frame object for the current function.  Note that if the current
-  function was inlined into its caller, the "current" frame will belong to
-  the "caller".
-
-bool isFirstFrame(%frame f);
-  Returns true if the specified frame is the top level (first activated) frame
-  for this thread.  For the main thread, this corresponds to the main() 
-  function, for a spawned thread, it corresponds to the thread function.
-
-%frame getNextFrame(%frame f);
-  Return the previous frame on the stack.  This function is undefined if f
-  satisfies the predicate isFirstFrame(f).
-
-Label *getFrameLabel(%frame f);
-  If a label was associated with f (as discussed below), this function returns
-  it.  Otherwise, it returns a null pointer.
-
-doNonLocalBranch(Label *L);
-  At this point, it is not clear whether this should be a function or 
-  intrinsic.  It should probably be an intrinsic in LLVM, but we'll deal with
-  this issue later.
-
-
-Here is a motivating example that illustrates how these facilities could be
-used to implement the C++ exception model:
-
-void TestFunction(...) {
-  A a; B b;
-  foo();        // Any function call may throw
-  bar();
-  C c;
-
-  try {
-    D d;
-    baz();
-  } catch (int) {
-    ...int Stuff...
-    // execution continues after the try block: the exception is consumed
-  } catch (double) {
-    ...double stuff...
-   throw;            // Exception is propogated
-  }
-}
-
-This function would compile to approximately the following code (heavy 
-pseudo code follows):
-
-Func:
-  %a = alloca A
-  A::A(%a)        // These ctors & dtors could throw, but we ignore this 
-  %b = alloca B   // minor detail for this example
-  B::B(%b)
-
-  call foo() with fooCleanup // An exception in foo is propogated to fooCleanup
-  call bar() with barCleanup // An exception in bar is propogated to barCleanup
-
-  %c = alloca C
-  C::C(c)
-  %d = alloca D
-  D::D(d)
-  call baz() with bazCleanup // An exception in baz is propogated to bazCleanup
-  d->~D();
-EndTry:                   // This label corresponds to the end of the try block
-  c->~C()       // These could also throw, these are also ignored
-  b->~B()
-  a->~A()
-  return
-
-Note that this is a very straight forward and literal translation: exactly
-what we want for zero cost (when unused) exception handling.  Especially on
-platforms with many registers (ie, the IA64) setjmp/longjmp style exception
-handling is *very* impractical.  Also, the "with" clauses describe the 
-control flow paths explicitly so that analysis is not adversly effected.
-
-The foo/barCleanup labels are implemented as:
-
-TryCleanup:          // Executed if an exception escapes the try block  
-  c->~C()
-barCleanup:          // Executed if an exception escapes from bar()
-  // fall through
-fooCleanup:          // Executed if an exception escapes from foo()
-  b->~B()
-  a->~A()
-  Exception *E = getThreadLocalException()
-  call throw(E)      // Implemented by the C++ runtime, described below
-
-Which does the work one would expect.  getThreadLocalException is a function
-implemented by the C++ support library.  It returns the current exception 
-object for the current thread.  Note that we do not attempt to recycle the 
-shutdown code from before, because performance of the mainline code is 
-critically important.  Also, obviously fooCleanup and barCleanup may be 
-merged and one of them eliminated.  This just shows how the code generator 
-would most likely emit code.
-
-The bazCleanup label is more interesting.  Because the exception may be caught
-by the try block, we must dispatch to its handler... but it does not exist
-on the call stack (it does not have a VM Call->Label mapping installed), so 
-we must dispatch statically with a goto.  The bazHandler thus appears as:
-
-bazHandler:
-  d->~D();    // destruct D as it goes out of scope when entering catch clauses
-  goto TryHandler
-
-In general, TryHandler is not the same as bazHandler, because multiple 
-function calls could be made from the try block.  In this case, trivial 
-optimization could merge the two basic blocks.  TryHandler is the code 
-that actually determines the type of exception, based on the Exception object
-itself.  For this discussion, assume that the exception object contains *at
-least*:
-
-1. A pointer to the RTTI info for the contained object
-2. A pointer to the dtor for the contained object
-3. The contained object itself
-
-Note that it is necessary to maintain #1 & #2 in the exception object itself
-because objects without virtual function tables may be thrown (as in this 
-example).  Assuming this, TryHandler would look something like this:
-
-TryHandler: 
-  Exception *E = getThreadLocalException();
-  switch (E->RTTIType) {
-  case IntRTTIInfo:
-    ...int Stuff...       // The action to perform from the catch block
-    break;
-  case DoubleRTTIInfo:
-    ...double Stuff...    // The action to perform from the catch block
-    goto TryCleanup       // This catch block rethrows the exception
-    break;                // Redundant, eliminated by the optimizer
-  default:
-    goto TryCleanup       // Exception not caught, rethrow
-  }
-
-  // Exception was consumed
-  if (E->dtor)
-    E->dtor(E->object)    // Invoke the dtor on the object if it exists
-  goto EndTry             // Continue mainline code...
-
-And that is all there is to it.
-
-The throw(E) function would then be implemented like this (which may be 
-inlined into the caller through standard optimization):
-
-function throw(Exception *E) {
-  // Get the start of the stack trace...
-  %frame %f = call getStackCurrentFrame()
-
-  // Get the label information that corresponds to it
-  label * %L = call getFrameLabel(%f)
-  while (%L == 0 && !isFirstFrame(%f)) {
-    // Loop until a cleanup handler is found
-    %f = call getNextFrame(%f)
-    %L = call getFrameLabel(%f)
-  }
-
-  if (%L != 0) {
-    call setThreadLocalException(E)   // Allow handlers access to this...
-    call doNonLocalBranch(%L)
-  }
-  // No handler found!
-  call BlowUp()         // Ends up calling the terminate() method in use
-}
-
-That's a brief rundown of how C++ exception handling could be implemented in
-llvm.  Java would be very similar, except it only uses destructors to unlock
-synchronized blocks, not to destroy data.  Also, it uses two stack walks: a
-nondestructive walk that builds a stack trace, then a destructive walk that
-unwinds the stack as shown here. 
-
-It would be trivial to get exception interoperability between C++ and Java.
-
diff --git a/libclamav/c++/llvm/docs/HistoricalNotes/2001-05-19-ExceptionResponse.txt b/libclamav/c++/llvm/docs/HistoricalNotes/2001-05-19-ExceptionResponse.txt
deleted file mode 100644
index 3375365..0000000
--- a/libclamav/c++/llvm/docs/HistoricalNotes/2001-05-19-ExceptionResponse.txt
+++ /dev/null
@@ -1,45 +0,0 @@
-Date: Sat, 19 May 2001 19:09:13 -0500 (CDT)
-From: Chris Lattner <sabre at nondot.org>
-To: Vikram S. Adve <vadve at cs.uiuc.edu>
-Subject: RE: Meeting writeup
-
-> I read it through and it looks great!
-
-Thanks!
-
-> The finally clause in Java may need more thought.  The code for this clause
-> is like a subroutine because it needs to be entered from many points (end of
-> try block and beginning of each catch block), and then needs to *return to
-> the place from where the code was entered*.  That's why JVM has the
-> jsr/jsr_w instruction.
-
-Hrm... I guess that is an implementation decision.  It can either be
-modelled as a subroutine (as java bytecodes do), which is really
-gross... or it can be modelled as code duplication (emitted once inline,
-then once in the exception path).  Because this could, at worst,
-slightly less than double the amount of code in a function (it is
-bounded) I don't think this is a big deal.  One of the really nice things
-about the LLVM representation is that it still allows for runtime code
-generation for exception paths (exceptions paths are not compiled until
-needed).  Obviously a static compiler couldn't do this though.  :)
-
-In this case, only one copy of the code would be compiled... until the
-other one is needed on demand.  Also this strategy fits with the "zero
-cost" exception model... the standard case is not burdened with extra
-branches or "call"s.
-
-> I suppose you could save the return address in a particular register
-> (specific to this finally block), jump to the finally block, and then at the
-> end of the finally block, jump back indirectly through this register.  It
-> will complicate building the CFG but I suppose that can be handled.  It is
-> also unsafe in terms of checking where control returns (which is I suppose
-> why the JVM doesn't use this).
-
-I think that a code duplication method would be cleaner, and would avoid
-the caveats that you mention.  Also, it does not slow down the normal case
-with an indirect branch...
-
-Like everything, we can probably defer a final decision until later.  :)
-
--Chris
-
diff --git a/libclamav/c++/llvm/docs/HistoricalNotes/2001-06-01-GCCOptimizations.txt b/libclamav/c++/llvm/docs/HistoricalNotes/2001-06-01-GCCOptimizations.txt
deleted file mode 100644
index 97af16a..0000000
--- a/libclamav/c++/llvm/docs/HistoricalNotes/2001-06-01-GCCOptimizations.txt
+++ /dev/null
@@ -1,63 +0,0 @@
-Date: Fri, 1 Jun 2001 16:38:17 -0500 (CDT)
-From: Chris Lattner <sabre at nondot.org>
-To: Vikram S. Adve <vadve at cs.uiuc.edu>
-Subject: Interesting: GCC passes
-
-
-Take a look at this document (which describes the order of optimizations
-that GCC performs):
-
-http://gcc.gnu.org/onlinedocs/gcc_17.html
-
-The rundown is that after RTL generation, the following happens:
-
-1 . [t] jump optimization (jumps to jumps, etc)
-2 . [t] Delete unreachable code
-3 .     Compute live ranges for CSE
-4 . [t] Jump threading (jumps to jumps with identical or inverse conditions)
-5 . [t] CSE
-6 . *** Conversion to SSA 
-7 . [t] SSA Based DCE
-8 . *** Conversion to LLVM
-9 .     UnSSA
-10.     GCSE
-11.     LICM
-12.     Strength Reduction
-13.     Loop unrolling
-14. [t] CSE
-15. [t] DCE
-16.     Instruction combination, register movement, scheduling... etc.
-
-I've marked optimizations with a [t] to indicate things that I believe to
-be relatively trivial to implement in LLVM itself.  The time consuming
-things to reimplement would be SSA based PRE, Strength reduction & loop
-unrolling... these would be the major things we would miss out on if we
-did LLVM creation from tree code [inlining and other high level
-optimizations are done on the tree representation].
-
-Given the lack of "strong" optimizations that would take a long time to
-reimplement, I am leaning a bit more towards creating LLVM from the tree
-code.  Especially given that SGI has GPL'd their compiler, including many
-SSA based optimizations that could be adapted (besides the fact that their
-code looks MUCH nicer than GCC :)
-
-Even if we choose to do LLVM code emission from RTL, we will almost
-certainly want to move LLVM emission from step 8 down until at least CSE
-has been rerun... which causes me to wonder if the SSA generation code
-will still work (due to global variable dependencies and stuff).  I assume
-that it can be made to work, but might be a little more involved than we
-would like.
-
-I'm continuing to look at the Tree -> RTL code.  It is pretty gross
-because they do some of the translation a statement at a time, and some
-of it a function at a time...  I'm not quite clear why and how the
-distinction is drawn, but it does not appear that there is a wonderful
-place to attach extra info.
-
-Anyways, I'm proceeding with the RTL -> LLVM conversion phase for now.  We
-can talk about this more on Monday.
-
-Wouldn't it be nice if there were a obvious decision to be made?  :)
-
--Chris
-
diff --git a/libclamav/c++/llvm/docs/HistoricalNotes/2001-06-01-GCCOptimizations2.txt b/libclamav/c++/llvm/docs/HistoricalNotes/2001-06-01-GCCOptimizations2.txt
deleted file mode 100644
index 6c9e097..0000000
--- a/libclamav/c++/llvm/docs/HistoricalNotes/2001-06-01-GCCOptimizations2.txt
+++ /dev/null
@@ -1,71 +0,0 @@
-Date: Fri, 1 Jun 2001 17:08:44 -0500 (CDT)
-From: Chris Lattner <sabre at nondot.org>
-To: Vikram S. Adve <vadve at cs.uiuc.edu>
-Subject: RE: Interesting: GCC passes
-
-> That is very interesting.  I agree that some of these could be done on LLVM
-> at link-time, but it is the extra time required that concerns me.  Link-time
-> optimization is severely time-constrained.
-
-If we were to reimplement any of these optimizations, I assume that we
-could do them a translation unit at a time, just as GCC does now.  This
-would lead to a pipeline like this:
-
-Static optimizations, xlation unit at a time:
-.c --GCC--> .llvm --llvmopt--> .llvm 
-
-Link time optimizations:
-.llvm --llvm-ld--> .llvm --llvm-link-opt--> .llvm 
-
-Of course, many optimizations could be shared between llvmopt and
-llvm-link-opt, but the wouldn't need to be shared...  Thus compile time
-could be faster, because we are using a "smarter" IR (SSA based).
-
-> BTW, about SGI, "borrowing" SSA-based optimizations from one compiler and
-> putting it into another is not necessarily easier than re-doing it.
-> Optimization code is usually heavily tied in to the specific IR they use.
-
-Understood.  The only reason that I brought this up is because SGI's IR is
-more similar to LLVM than it is different in many respects (SSA based,
-relatively low level, etc), and could be easily adapted.  Also their
-optimizations are written in C++ and are actually somewhat
-structured... of course it would be no walk in the park, but it would be
-much less time consuming to adapt, say, SSA-PRE than to rewrite it.
-
-> But your larger point is valid that adding SSA based optimizations is
-> feasible and should be fun.  (Again, link time cost is the issue.)
-
-Assuming linktime cost wasn't an issue, the question is: 
-Does using GCC's backend buy us anything?
-
-> It also occurs to me that GCC is probably doing quite a bit of back-end
-> optimization (step 16 in your list).  Do you have a breakdown of that?
-
-Not really.  The irritating part of GCC is that it mixes it all up and
-doesn't have a clean seperation of concerns.  A lot of the "back end
-optimization" happens right along with other data optimizations (ie, CSE
-of machine specific things).
-
-As far as REAL back end optimizations go, it looks something like this:
-
-1. Instruction combination: try to make CISCy instructions, if available
-2. Register movement: try to get registers in the right places for the
-architecture to avoid register to register moves.  For example, try to get
-the first argument of a function to naturally land in %o0 for sparc.
-3. Instruction scheduling: 'nuff said :)
-4. Register class preferencing: ??
-5. Local register allocation
-6. global register allocation
-7. Spilling
-8. Local regalloc
-9. Jump optimization
-10. Delay slot scheduling
-11. Branch shorting for CISC machines
-12. Instruction selection & peephole optimization
-13. Debug info output
-
-But none of this would be usable for LLVM anyways, unless we were using
-GCC as a static compiler.
-
--Chris
-
diff --git a/libclamav/c++/llvm/docs/HistoricalNotes/2001-06-20-.NET-Differences.txt b/libclamav/c++/llvm/docs/HistoricalNotes/2001-06-20-.NET-Differences.txt
deleted file mode 100644
index 1bc2eae..0000000
--- a/libclamav/c++/llvm/docs/HistoricalNotes/2001-06-20-.NET-Differences.txt
+++ /dev/null
@@ -1,30 +0,0 @@
-Date: Wed, 20 Jun 2001 12:32:22 -0500
-From: Vikram Adve <vadve at cs.uiuc.edu>
-To: Chris Lattner <lattner at cs.uiuc.edu>
-Subject: .NET vs. our VM
-
-One significant difference between .NET CLR and our VM is that the CLR
-includes full information about classes and inheritance.  In fact, I just
-sat through the paper on adding templates to .NET CLR, and the speaker
-indicated that the goal seems to be to do simple static compilation (very
-little lowering or optimization).  Also, the templates implementation in CLR
-"relies on dynamic class loading and JIT compilation".
-
-This is an important difference because I think there are some significant
-advantages to have a much lower level VM layer, and do significant static
-analysis and optimization.
-
-I also talked to the lead guy for KAI's C++ compiler (Arch Robison) and he
-said that SGI and other commercial compilers have included options to export
-their *IR* next to the object code (i.e., .il files) and use them for
-link-time code generation.  In fact, he said that the .o file was nearly
-empty and was entirely generated from the .il at link-time.  But he agreed
-that this limited the link-time interprocedural optimization to modules
-compiled by the same compiler, whereas our approach allows us to link and
-optimize modules from multiple different compilers.  (Also, of course, they
-don't do anything for runtime optimization).
-
-All issues to bring up in Related Work.
-
---Vikram
-
diff --git a/libclamav/c++/llvm/docs/HistoricalNotes/2001-07-06-LoweringIRForCodeGen.txt b/libclamav/c++/llvm/docs/HistoricalNotes/2001-07-06-LoweringIRForCodeGen.txt
deleted file mode 100644
index 3e10416..0000000
--- a/libclamav/c++/llvm/docs/HistoricalNotes/2001-07-06-LoweringIRForCodeGen.txt
+++ /dev/null
@@ -1,31 +0,0 @@
-Date: Fri, 6 Jul 2001 16:56:56 -0500
-From: Vikram S. Adve <vadve at cs.uiuc.edu>
-To: Chris Lattner <lattner at cs.uiuc.edu>
-Subject: lowering the IR
-
-BTW, I do think that we should consider lowering the IR as you said.  I
-didn't get time to raise it today, but it comes up with the SPARC
-move-conditional instruction.  I don't think we want to put that in the core
-VM -- it is a little too specialized.  But without a corresponding
-conditional move instruction in the VM, it is pretty difficult to maintain a
-close mapping between VM and machine code.  Other architectures may have
-other such instructions.
-
-What I was going to suggest was that for a particular processor, we define
-additional VM instructions that match some of the unusual opcodes on the
-processor but have VM semantics otherwise, i.e., all operands are in SSA
-form and typed.  This means that we can re-generate core VM code from the
-more specialized code any time we want (so that portability is not lost).
-
-Typically, a static compiler like gcc would generate just the core VM, which
-is relatively portable.  Anyone (an offline tool, the linker, etc., or even
-the static compiler itself if it chooses) can transform that into more
-specialized target-specific VM code for a particular architecture.  If the
-linker does it, it can do it after all machine-independent optimizations.
-This would be the most convenient, but not necessary.
-
-The main benefit of lowering will be that we will be able to retain a close
-mapping between VM and machine code.
-
---Vikram
-
diff --git a/libclamav/c++/llvm/docs/HistoricalNotes/2001-09-18-OptimizeExceptions.txt b/libclamav/c++/llvm/docs/HistoricalNotes/2001-09-18-OptimizeExceptions.txt
deleted file mode 100644
index 9379081..0000000
--- a/libclamav/c++/llvm/docs/HistoricalNotes/2001-09-18-OptimizeExceptions.txt
+++ /dev/null
@@ -1,56 +0,0 @@
-Date: Tue, 18 Sep 2001 00:38:37 -0500 (CDT)
-From: Chris Lattner <sabre at nondot.org>
-To: Vikram S. Adve <vadve at cs.uiuc.edu>
-Subject: Idea for a simple, useful link time optimization
-
-
-In C++ programs, exceptions suck, and here's why:
-
-1. In virtually all function calls, you must assume that the function
-   throws an exception, unless it is defined as 'nothrow'.  This means
-   that every function call has to have code to invoke dtors on objects
-   locally if one is thrown by the function.  Most functions don't throw
-   exceptions, so this code is dead [with all the bad effects of dead
-   code, including icache pollution].
-2. Declaring a function nothrow causes catch blocks to be added to every
-   call that isnot  provably nothrow.  This makes them very slow.
-3. Extra extraneous exception edges reduce the opportunity for code
-   motion.
-4. EH is typically implemented with large lookup tables.  Ours is going to
-   be much smaller (than the "standard" way of doing it) to start with,
-   but eliminating it entirely would be nice. :)
-5. It is physically impossible to correctly put (accurate, correct)
-   exception specifications on generic, templated code.  But it is trivial
-   to analyze instantiations of said code.
-6. Most large C++ programs throw few exceptions.  Most well designed
-   programs only throw exceptions in specific planned portions of the
-   code.
-
-Given our _planned_ model of handling exceptions, all of this would be
-pretty trivial to eliminate through some pretty simplistic interprocedural
-analysis.  The DCE factor alone could probably be pretty significant.  The
-extra code motion opportunities could also be exploited though...
-
-Additionally, this optimization can be implemented in a straight forward
-conservative manner, allowing libraries to be optimized or individual
-files even (if there are leaf functions visible in the translation unit
-that are called).
-
-I think it's a reasonable optimization that hasn't really been addressed
-(because assembly is way too low level for this), and could have decent
-payoffs... without being a overly complex optimization.
-
-After I wrote all of that, I found this page that is talking about
-basically the same thing I just wrote, except that it is translation unit
-at a time, tree based approach:
-http://www.ocston.org/~jls/ehopt.html
-
-but is very useful from "expected gain" and references perspective.  Note
-that their compiler is apparently unable to inline functions that use
-exceptions, so there numbers are pretty worthless... also our results
-would (hopefully) be better because it's interprocedural...
-
-What do you think?
-
--Chris
-
diff --git a/libclamav/c++/llvm/docs/HistoricalNotes/2002-05-12-InstListChange.txt b/libclamav/c++/llvm/docs/HistoricalNotes/2002-05-12-InstListChange.txt
deleted file mode 100644
index 004edb0..0000000
--- a/libclamav/c++/llvm/docs/HistoricalNotes/2002-05-12-InstListChange.txt
+++ /dev/null
@@ -1,55 +0,0 @@
-Date: Sun, 12 May 2002 17:12:53 -0500 (CDT)
-From: Chris Lattner <sabre at nondot.org>
-To: "Vikram S. Adve" <vadve at cs.uiuc.edu>
-Subject: LLVM change
-
-There is a fairly fundemental change that I would like to make to the LLVM 
-infrastructure, but I'd like to know if you see any drawbacks that I 
-don't...
-
-Basically right now at the basic block level, each basic block contains an 
-instruction list (returned by getInstList()) that is a ValueHolder of 
-instructions.  To iterate over instructions, we must actually iterate over 
-the instlist, and access the instructions through the instlist.
-
-To add or remove an instruction from a basic block, we need to get an 
-iterator to an instruction, which, given just an Instruction*, requires a 
-linear search of the basic block the instruction is contained in... just 
-to insert an instruction before another instruction, or to delete an 
-instruction!  This complicates algorithms that should be very simple (like 
-simple constant propogation), because they aren't actually sparse anymore, 
-they have to traverse basic blocks to remove constant propogated 
-instructions.
-
-Additionally, adding or removing instructions to a basic block 
-_invalidates all iterators_ pointing into that block, which is really 
-irritating.
-
-To fix these problems (and others), I would like to make the ordering of
-the instructions be represented with a doubly linked list in the
-instructions themselves, instead of an external data structure.  This is 
-how many other representations do it, and frankly I can't remember why I 
-originally implemented it the way I did.
-
-Long term, all of the code that depends on the nasty features in the 
-instruction list (which can be found by grep'ing for getInstList()) will 
-be changed to do nice local transformations.  In the short term, I'll 
-change the representation, but preserve the interface (including 
-getInstList()) so that all of the code doesn't have to change.
-
-Iteration over the instructions in a basic block remains the simple:
-for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I) ...
-
-But we will also support:
-for (Instruction *I = BB->front(); I; I = I->getNext()) ...
-
-After converting instructions over, I'll convert basic blocks and 
-functions to have a similar interface.
-
-The only negative aspect of this change that I see is that it increases 
-the amount of memory consumed by one pointer per instruction.  Given the 
-benefits, I think this is a very reasonable tradeoff. 
-
-What do you think?
-
--Chris
diff --git a/libclamav/c++/llvm/docs/HistoricalNotes/2002-06-25-MegaPatchInfo.txt b/libclamav/c++/llvm/docs/HistoricalNotes/2002-06-25-MegaPatchInfo.txt
deleted file mode 100644
index 2ca4611..0000000
--- a/libclamav/c++/llvm/docs/HistoricalNotes/2002-06-25-MegaPatchInfo.txt
+++ /dev/null
@@ -1,72 +0,0 @@
-Changes:
-* Change the casting code to be const correct.  Now, doing this is invalid:
-     const Value *V = ...;
-     Instruction *I = dyn_cast<Instruction>(V);
-  instead, the second line should be:
-     const Instruction *I = dyn_cast<Instruction>(V);
-
-* Change the casting code to allow casting a reference value thus:
-     const Value &V = ...;
-     Instruction &I = cast<Instruction>(V);
-
-  dyn_cast does not work with references, because it must return a null pointer
-  on failure.
-
-* Fundamentally change how instructions and other values are represented.
-  Before, every llvm container was an instance of the ValueHolder template,
-  instantiated for each container type.  This ValueHolder was effectively a
-  wrapper around a vector of pointers to the sub-objects.
-
-  Now, instead of having a vector to pointers of objects, the objects are
-  maintained in a doubly linked list of values (ie each Instruction now has
-  Next & Previous fields).  The containers are now instances of ilist (intrusive
-  linked list class), which use the next and previous fields to chain them
-  together.  The advantage of this implementation is that iterators can be
-  formed directly from pointers to the LLVM value, and invalidation is much
-  easier to handle.
-
-* As part of the above change, dereferencing an iterator (for example:
-  BasicBlock::iterator) now produces a reference to the underlying type (same
-  example: Instruction&) instead of a pointer to the underlying object.  This
-  makes it much easier to write nested loops that iterator over things, changing
-  this:
-
-    for (Function::iterator BI = Func->begin(); BI != Func->end(); ++BI)
-      for (BasicBlock::iterator II = (*BI)->begin(); II != (*BI)->end(); ++II)
-        (*II)->dump();
-
-  into:
-
-    for (Function::iterator BI = Func->begin(); BI != Func->end(); ++BI)
-      for (BasicBlock::iterator II = BI->begin(); II != BI->end(); ++II)
-        II->dump();
-
-  which is much more natural and what users expect.
-
-* Simplification of #include's: Before, it was necessary for a .cpp file to
-  include every .h file that it used.  Now things are batched a little bit more
-  to make it easier to use.  Specifically, the include graph now includes these
-  edges:
-    Module.h -> Function.h, GlobalVariable.h
-    Function.h -> BasicBlock.h, Argument.h
-    BasicBlock.h -> Instruction.h
-
-  Which means that #including Function.h is usually sufficient for getting the
-  lower level #includes.
-
-* Printing out a Value* has now changed: Printing a Value* will soon print out
-  the address of the value instead of the contents of the Value.  To print out
-  the contents, you must convert it to a reference with (for example)
-  'cout << *I' instead of 'cout << I;'.  This conversion is not yet complete,
-  but will be eventually.  In the mean time, both forms print out the contents.
-
-* References are used much more throughout the code base.  In general, if a
-  pointer is known to never be null, it is passed in as a reference instead of a
-  pointer.  For example, the instruction visitor class uses references instead
-  of pointers, and that Pass subclasses now all receive references to Values
-  instead of pointers, because they may never be null.
-
-* The Function class now has helper functions for accessing the Arguments list.
-  Instead of having to go through getArgumentList for simple things like
-  iterator over the arguments, now the a*() methods can be used to access them.
-
diff --git a/libclamav/c++/llvm/docs/HistoricalNotes/2003-01-23-CygwinNotes.txt b/libclamav/c++/llvm/docs/HistoricalNotes/2003-01-23-CygwinNotes.txt
deleted file mode 100644
index fbe811d..0000000
--- a/libclamav/c++/llvm/docs/HistoricalNotes/2003-01-23-CygwinNotes.txt
+++ /dev/null
@@ -1,28 +0,0 @@
-Date: Mon, 20 Jan 2003 00:00:28 -0600
-From: Brian R. Gaeke <gaeke at uiuc.edu>
-Subject: windows vs. llvm
-
-If you're interested, here are some of the major problems compiling LLVM
-under Cygwin and/or Mingw.
-
-1. Cygwin doesn't have <inttypes.h> or <stdint.h>, so all the INT*_MAX
-   symbols and standard int*_t types are off in limbo somewhere. Mingw has
-   <stdint.h>, but Cygwin doesn't like it.
-
-2. Mingw doesn't have <dlfcn.h> (because Windows doesn't have it.)
-
-3. SA_SIGINFO and friends are not around; only signal() seems to work.
-
-4. Relink, aka ld -r, doesn't work (probably an ld bug); you need
-   DONT_BUILD_RELINKED. This breaks all the tools makefiles; you just need to
-   change them to have .a's.
-
-5. There isn't a <values.h>.
-
-6. There isn't a mallinfo() (or, at least, it's documented, but it doesn't seem
-   to link).
-
-7. The version of Bison that cygwin (and newer Linux versions) comes with
-   does not like = signs in rules. Burg's gram.yc source file uses them. I think
-   you can just take them out.
-
diff --git a/libclamav/c++/llvm/docs/HistoricalNotes/2003-06-25-Reoptimizer1.txt b/libclamav/c++/llvm/docs/HistoricalNotes/2003-06-25-Reoptimizer1.txt
deleted file mode 100644
index a745784..0000000
--- a/libclamav/c++/llvm/docs/HistoricalNotes/2003-06-25-Reoptimizer1.txt
+++ /dev/null
@@ -1,137 +0,0 @@
-Wed Jun 25 15:13:51 CDT 2003
-
-First-level instrumentation
----------------------------
-
-We use opt to do Bytecode-to-bytecode instrumentation. Look at
-back-edges and insert llvm_first_trigger() function call which takes
-no arguments and no return value. This instrumentation is designed to
-be easy to remove, for instance by writing a NOP over the function
-call instruction.
-
-Keep count of every call to llvm_first_trigger(), and maintain
-counters in a map indexed by return address. If the trigger count
-exceeds a threshold, we identify a hot loop and perform second-level
-instrumentation on the hot loop region (the instructions between the
-target of the back-edge and the branch that causes the back-edge).  We
-do not move code across basic-block boundaries.
-
-
-Second-level instrumentation
----------------------------
-
-We remove the first-level instrumentation by overwriting the CALL to
-llvm_first_trigger() with a NOP.
-
-The reoptimizer maintains a map between machine-code basic blocks and
-LLVM BasicBlock*s.  We only keep track of paths that start at the
-first machine-code basic block of the hot loop region.
-
-How do we keep track of which edges to instrument, and which edges are
-exits from the hot region? 3 step process.
-
-1) Do a DFS from the first machine-code basic block of the hot loop
-region and mark reachable edges.
-
-2) Do a DFS from the last machine-code basic block of the hot loop
-region IGNORING back edges, and mark the edges which are reachable in
-1) and also in 2) (i.e., must be reachable from both the start BB and
-the end BB of the hot region).
-
-3) Mark BBs which end in edges that exit the hot region; we need to
-instrument these differently.
-
-Assume that there is 1 free register. On SPARC we use %g1, which LLC
-has agreed not to use.  Shift a 1 into it at the beginning. At every
-edge which corresponds to a conditional branch, we shift 0 for not
-taken and 1 for taken into a register. This uniquely numbers the paths
-through the hot region. Silently fail if we need more than 64 bits.
-
-At the end BB we call countPath and increment the counter based on %g1
-and the return address of the countPath call.  We keep track of the
-number of iterations and the number of paths.  We only run this
-version 30 or 40 times.
-
-Find the BBs that total 90% or more of execution, and aggregate them
-together to form our trace. But we do not allow more than 5 paths; if
-we have more than 5 we take the ones that are executed the most.  We
-verify our assumption that we picked a hot back-edge in first-level
-instrumentation, by making sure that the number of times we took an
-exit edge from the hot trace is less than 10% of the number of
-iterations.
-
-LLC has been taught to recognize llvm_first_trigger() calls and NOT
-generate saves and restores of caller-saved registers around these
-calls.
-
-
-Phase behavior
---------------
-
-We turn off llvm_first_trigger() calls with NOPs, but this would hide
-phase behavior from us (when some funcs/traces stop being hot and
-others become hot.)
-
-We have a SIGALRM timer that counts time for us. Every time we get a
-SIGALRM we look at our priority queue of locations where we have
-removed llvm_first_trigger() calls. Each location is inserted along
-with a time when we will next turn instrumentation back on for that
-call site. If the time has arrived for a particular call site, we pop
-that off the prio. queue and turn instrumentation back on for that
-call site.
-
-
-Generating traces
------------------
-
-When we finally generate an optimized trace we first copy the code
-into the trace cache. This leaves us with 3 copies of the code: the
-original code, the instrumented code, and the optimized trace. The
-optimized trace does not have instrumentation. The original code and
-the instrumented code are modified to have a branch to the trace
-cache, where the optimized traces are kept.
-
-We copy the code from the original to the instrumentation version
-by tracing the LLVM-to-Machine code basic block map and then copying
-each machine code basic block we think is in the hot region into the
-trace cache. Then we instrument that code. The process is similar for
-generating the final optimized trace; we copy the same basic blocks
-because we might need to put in fixup code for exit BBs.
-
-LLVM basic blocks are not typically used in the Reoptimizer except
-for the mapping information.
-
-We are restricted to using single instructions to branch between the
-original code, trace, and instrumented code. So we have to keep the
-code copies in memory near the original code (they can't be far enough
-away that a single pc-relative branch would not work.) Malloc() or
-data region space is too far away. this impacts the design of the 
-trace cache.
-
-We use a dummy function that is full of a bunch of for loops which we
-overwrite with trace-cache code. The trace manager keeps track of
-whether or not we have enough space in the trace cache, etc.
-
-The trace insertion routine takes an original start address, a vector
-of machine instructions representing the trace, index of branches and
-their corresponding absolute targets, and index of calls and their
-corresponding absolute targets.
-
-The trace insertion routine is responsible for inserting branches from
-the beginning of the original code to the beginning of the optimized
-trace. This is because at some point the trace cache may run out of
-space and it may have to evict a trace, at which point the branch to
-the trace would also have to be removed. It uses a round-robin
-replacement policy; we have found that this is almost as good as LRU
-and better than random (especially because of problems fitting the new
-trace in.)
-
-We cannot deal with discontiguous trace cache areas.  The trace cache
-is supposed to be cache-line-aligned, but it is not page-aligned.
-
-We generate instrumentation traces and optimized traces into separate
-trace caches. We keep the instrumented code around because you don't
-want to delete a trace when you still might have to return to it
-(i.e., return from a llvm_first_trigger() or countPath() call.)
-
-
diff --git a/libclamav/c++/llvm/docs/HistoricalNotes/2003-06-26-Reoptimizer2.txt b/libclamav/c++/llvm/docs/HistoricalNotes/2003-06-26-Reoptimizer2.txt
deleted file mode 100644
index ec4b93f..0000000
--- a/libclamav/c++/llvm/docs/HistoricalNotes/2003-06-26-Reoptimizer2.txt
+++ /dev/null
@@ -1,110 +0,0 @@
-Thu Jun 26 14:43:04 CDT 2003
-
-Information about BinInterface
-------------------------------
-
-Take in a set of instructions with some particular register
-allocation. It allows you to add, modify, or delete some instructions,
-in SSA form (kind of like LLVM's MachineInstrs.) Then re-allocate
-registers. It assumes that the transformations you are doing are safe.
-It does not update the mapping information or the LLVM representation
-for the modified trace (so it would not, for instance, support
-multiple optimization passes; passes have to be aware of and update
-manually the mapping information.)
-
-The way you use it is you take the original code and provide it to
-BinInterface; then you do optimizations to it, then you put it in the
-trace cache.
-
-The BinInterface tries to find live-outs for traces so that it can do
-register allocation on just the trace, and stitch the trace back into
-the original code. It has to preserve the live-ins and live-outs when
-it does its register allocation.  (On exits from the trace we have
-epilogues that copy live-outs back into the right registers, but
-live-ins have to be in the right registers.)
-
-
-Limitations of BinInterface
----------------------------
-
-It does copy insertions for PHIs, which it infers from the machine
-code. The mapping info inserted by LLC is not sufficient to determine
-the PHIs.
-
-It does not handle integer or floating-point condition codes and it
-does not handle floating-point register allocation.
-
-It is not aggressively able to use lots of registers.
-
-There is a problem with alloca: we cannot find our spill space for
-spilling registers, normally allocated on the stack, if the trace
-follows an alloca(). What might be an acceptable solution would be to
-disable trace generation on functions that have variable-sized
-alloca()s. Variable-sized allocas in the trace would also probably
-screw things up.
-
-Because of the FP and alloca limitations, the BinInterface is
-completely disabled right now.
-
-
-Demo
-----
-
-This is a demo of the Ball & Larus version that does NOT use 2-level
-profiling.
-
-1. Compile program with llvm-gcc.
-2. Run opt -lowerswitch -paths -emitfuncs on the bytecode.
-   -lowerswitch change switch statements to branches
-   -paths       Ball & Larus path-profiling algorithm
-   -emitfuncs   emit the table of functions
-3. Run llc to generate SPARC assembly code for the result of step 2.
-4. Use g++ to link the (instrumented) assembly code.
-
-We use a script to do all this:
-------------------------------------------------------------------------------
-#!/bin/sh
-llvm-gcc $1.c -o $1
-opt -lowerswitch -paths -emitfuncs $1.bc > $1.run.bc
-llc -f $1.run.bc 
-LIBS=$HOME/llvm_sparc/lib/Debug
-GXX=/usr/dcs/software/evaluation/bin/g++
-$GXX -g -L $LIBS $1.run.s -o $1.run.llc \
-$LIBS/tracecache.o \
-$LIBS/mapinfo.o \
-$LIBS/trigger.o \
-$LIBS/profpaths.o \
-$LIBS/bininterface.o \
-$LIBS/support.o \
-$LIBS/vmcore.o \
-$LIBS/transformutils.o \
-$LIBS/bcreader.o \
--lscalaropts -lscalaropts -lanalysis \
--lmalloc -lcpc -lm -ldl
-------------------------------------------------------------------------------
-
-5. Run the resulting binary.  You will see output from BinInterface
-(described below) intermixed with the output from the program.
-
-
-Output from BinInterface
-------------------------
-
-BinInterface's debugging code prints out the following stuff in order:
-
-1. Initial code provided to BinInterface with original register
-allocation.
-
-2. Section 0 is the trace prolog, consisting mainly of live-ins and
-register saves which will be restored in epilogs.
-
-3. Section 1 is the trace itself, in SSA form used by BinInterface,
-along with the PHIs that are inserted.
-PHIs are followed by the copies that implement them.
-Each branch (i.e., out of the trace) is annotated with the
-section number that represents the epilog it branches to.
-
-4. All the other sections starting with Section 2 are trace epilogs.
-Every branch from the trace has to go to some epilog.
-
-5. After the last section is the register allocation output.
diff --git a/libclamav/c++/llvm/docs/HistoricalNotes/2007-OriginalClangReadme.txt b/libclamav/c++/llvm/docs/HistoricalNotes/2007-OriginalClangReadme.txt
deleted file mode 100644
index 611dc9d..0000000
--- a/libclamav/c++/llvm/docs/HistoricalNotes/2007-OriginalClangReadme.txt
+++ /dev/null
@@ -1,178 +0,0 @@
-//===----------------------------------------------------------------------===//
-// C Language Family Front-end
-//===----------------------------------------------------------------------===//
-                                                             Chris Lattner
-
-I. Introduction:
- 
- clang: noun
-    1. A loud, resonant, metallic sound.
-    2. The strident call of a crane or goose.
-    3. C-language family front-end toolkit.
-
- The world needs better compiler tools, tools which are built as libraries. This
- design point allows reuse of the tools in new and novel ways. However, building
- the tools as libraries isn't enough: they must have clean APIs, be as
- decoupled from each other as possible, and be easy to modify/extend.  This
- requires clean layering, decent design, and avoiding tying the libraries to a
- specific use.  Oh yeah, did I mention that we want the resultant libraries to
- be as fast as possible? :)
-
- This front-end is built as a component of the LLVM toolkit that can be used
- with the LLVM backend or independently of it.  In this spirit, the API has been
- carefully designed as the following components:
- 
-   libsupport  - Basic support library, reused from LLVM.
-
-   libsystem   - System abstraction library, reused from LLVM.
-   
-   libbasic    - Diagnostics, SourceLocations, SourceBuffer abstraction,
-                 file system caching for input source files.  This depends on
-                 libsupport and libsystem.
-
-   libast      - Provides classes to represent the C AST, the C type system,
-                 builtin functions, and various helpers for analyzing and
-                 manipulating the AST (visitors, pretty printers, etc).  This
-                 library depends on libbasic.
-
-
-   liblex      - C/C++/ObjC lexing and preprocessing, identifier hash table,
-                 pragma handling, tokens, and macros.  This depends on libbasic.
-
-   libparse    - C (for now) parsing and local semantic analysis. This library
-                 invokes coarse-grained 'Actions' provided by the client to do
-                 stuff (e.g. libsema builds ASTs).  This depends on liblex.
-
-   libsema     - Provides a set of parser actions to build a standardized AST
-                 for programs.  AST's are 'streamed' out a top-level declaration
-                 at a time, allowing clients to use decl-at-a-time processing,
-                 build up entire translation units, or even build 'whole
-                 program' ASTs depending on how they use the APIs.  This depends
-                 on libast and libparse.
-
-   librewrite  - Fast, scalable rewriting of source code.  This operates on
-                 the raw syntactic text of source code, allowing a client
-                 to insert and delete text in very large source files using
-                 the same source location information embedded in ASTs.  This
-                 is intended to be a low-level API that is useful for
-                 higher-level clients and libraries such as code refactoring.
-
-   libanalysis - Source-level dataflow analysis useful for performing analyses
-                 such as computing live variables.  It also includes a
-                 path-sensitive "graph-reachability" engine for writing
-                 analyses that reason about different possible paths of
-                 execution through source code.  This is currently being
-                 employed to write a set of checks for finding bugs in software.
-
-   libcodegen  - Lower the AST to LLVM IR for optimization & codegen.  Depends
-                 on libast.
-                 
-   clang       - An example driver, client of the libraries at various levels.
-                 This depends on all these libraries, and on LLVM VMCore.
-
- This front-end has been intentionally built as a DAG of libraries, making it
- easy to  reuse individual parts or replace pieces if desired. For example, to
- build a preprocessor, you take the Basic and Lexer libraries. If you want an
- indexer, you take those plus the Parser library and provide some actions for
- indexing.  If you want a refactoring, static analysis, or source-to-source
- compiler tool, it makes sense to take those plus the AST building and semantic
- analyzer library.  Finally, if you want to use this with the LLVM backend,
- you'd take these components plus the AST to LLVM lowering code.
- 
- In the future I hope this toolkit will grow to include new and interesting
- components, including a C++ front-end, ObjC support, and a whole lot of other
- things.
-
- Finally, it should be pointed out that the goal here is to build something that
- is high-quality and industrial-strength: all the obnoxious features of the C
- family must be correctly supported (trigraphs, preprocessor arcana, K&R-style
- prototypes, GCC/MS extensions, etc).  It cannot be used if it is not 'real'.
-
-
-II. Usage of clang driver:
-
- * Basic Command-Line Options:
-   - Help: clang --help
-   - Standard GCC options accepted: -E, -I*, -i*, -pedantic, -std=c90, etc.
-   - To make diagnostics more gcc-like: -fno-caret-diagnostics -fno-show-column
-   - Enable metric printing: -stats
-
- * -fsyntax-only is currently the default mode.
-
- * -E mode works the same way as GCC.
-
- * -Eonly mode does all preprocessing, but does not print the output,
-     useful for timing the preprocessor.
- 
- * -fsyntax-only is currently partially implemented, lacking some
-     semantic analysis (some errors and warnings are not produced).
-
- * -parse-noop parses code without building an AST.  This is useful
-     for timing the cost of the parser without including AST building
-     time.
- 
- * -parse-ast builds ASTs, but doesn't print them.  This is most
-     useful for timing AST building vs -parse-noop.
- 
- * -parse-ast-print pretty prints most expression and statements nodes.
-
- * -parse-ast-check checks that diagnostic messages that are expected
-     are reported and that those which are reported are expected.
-
- * -dump-cfg builds ASTs and then CFGs.  CFGs are then pretty-printed.
-
- * -view-cfg builds ASTs and then CFGs.  CFGs are then visualized by
-     invoking Graphviz.
-
-     For more information on getting Graphviz to work with clang/LLVM,
-     see: http://llvm.org/docs/ProgrammersManual.html#ViewGraph
-
-
-III. Current advantages over GCC:
-
- * Column numbers are fully tracked (no 256 col limit, no GCC-style pruning).
- * All diagnostics have column numbers, includes 'caret diagnostics', and they
-   highlight regions of interesting code (e.g. the LHS and RHS of a binop).
- * Full diagnostic customization by client (can format diagnostics however they
-   like, e.g. in an IDE or refactoring tool) through DiagnosticClient interface.
- * Built as a framework, can be reused by multiple tools.
- * All languages supported linked into same library (no cc1,cc1obj, ...).
- * mmap's code in read-only, does not dirty the pages like GCC (mem footprint).
- * LLVM License, can be linked into non-GPL projects.
- * Full diagnostic control, per diagnostic.  Diagnostics are identified by ID.
- * Significantly faster than GCC at semantic analysis, parsing, preprocessing
-   and lexing.
- * Defers exposing platform-specific stuff to as late as possible, tracks use of
-   platform-specific features (e.g. #ifdef PPC) to allow 'portable bytecodes'.
- * The lexer doesn't rely on the "lexer hack": it has no notion of scope and
-   does not categorize identifiers as types or variables -- this is up to the
-   parser to decide.
-
-Potential Future Features:
-
- * Fine grained diag control within the source (#pragma enable/disable warning).
- * Better token tracking within macros?  (Token came from this line, which is
-   a macro argument instantiated here, recursively instantiated here).
- * Fast #import with a module system.
- * Dependency tracking: change to header file doesn't recompile every function
-   that texually depends on it: recompile only those functions that need it.
-   This is aka 'incremental parsing'.
-
-
-IV. Missing Functionality / Improvements
-
-Lexer:
- * Source character mapping.  GCC supports ASCII and UTF-8.
-   See GCC options: -ftarget-charset and -ftarget-wide-charset.
- * Universal character support.  Experimental in GCC, enabled with
-   -fextended-identifiers.
- * -fpreprocessed mode.
-
-Preprocessor:
- * #assert/#unassert
- * MSExtension: "L#param" stringizes to a wide string literal.
- * Add support for -M*
-
-Traditional Preprocessor:
- * Currently, we have none. :)
-
diff --git a/libclamav/c++/llvm/docs/HowToReleaseLLVM.html b/libclamav/c++/llvm/docs/HowToReleaseLLVM.html
deleted file mode 100644
index 7f18440..0000000
--- a/libclamav/c++/llvm/docs/HowToReleaseLLVM.html
+++ /dev/null
@@ -1,524 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-                      "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-  <title>How To Release LLVM To The Public</title>
-  <link rel="stylesheet" href="llvm.css" type="text/css">
-</head>
-<body>
-
-<div class="doc_title">How To Release LLVM To The Public</div>
-<ol>
-  <li><a href="#introduction">Introduction</a></li>
-  <li><a href="#criteria">Qualification Criteria</a></li>
-  <li><a href="#introduction">Release Timeline</a></li>
-  <li><a href="#process">Release Process</a></li>
-</ol>
-<div class="doc_author">
-  <p>Written by <a href="mailto:tonic at nondot.org">Tanya Lattner</a>,
-  <a href="mailto:rspencer at x10sys.com">Reid Spencer</a>,
-  <a href="mailto:criswell at cs.uiuc.edu">John Criswell</a>
-  </p>
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="introduction">Introduction</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-  <p>
-  This document collects information about successfully releasing LLVM 
-  (including subprojects llvm-gcc and Clang) to the public. 
-  It is the release manager's responsibility to ensure that a high quality 
-  build of LLVM is released. 
-  </p>
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="process">Release Timeline</a></div>
-<!-- *********************************************************************** -->
-<div class="doc_text">
-  <p>LLVM is released on a time based schedule (currently every 6 months). We
-  do not have dot releases because of the nature of LLVM incremental 
-  development philosophy. The release schedule is roughly as follows:
-  </p>
-<ol>
-<li>Set code freeze and branch creation date for 6 months after last code freeze 
-date. Announce release schedule to the LLVM community and update the website.</li>
-<li>Create release branch and begin release process. </li>
-<li>Send out pre-release for first round of testing. Testing will last 7-10 days.
-During the first round of testing, regressions should be found and fixed. Patches
-are merged from mainline to the release branch.</li>
-<li>Generate and send out second pre-release. Bugs found during this time will
-not be fixed unless absolutely critical. Bugs introduce by patches merged in
-will be fixed and if so, a 3rd round of testing is needed.</li>
-<li>The release notes should be updated during the first and second round of
-pre-release testing.</li>
-<li>Finally, release!</li>
-</ol>
-</div>
-
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="process">Release Process</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-  <ol>
-    <li><a href="#release-admin">Release Administrative Tasks</a></li>
-    <ol>
-    <li><a href="#branch">Create Release Branch</a></li>
-    <li><a href="#verchanges">Update Version Numbers</a></li>
-    </ol>
-    <li><a href="#release-build">Building the Release</a></li>
-    <ol>
-    <li><a href="#dist">Build the LLVM Source Distributions</a></li>
-    <li><a href="#build">Build LLVM</a></li>
-    <li><a href="#llvmgccbin">Build the LLVM-GCC Binary Distribution</a></li>
-    <li><a href="#clangbin">Build the Clang Binary Distribution</a></li>
-    <li><a href="#target-build">Target Specific Build Details</a></li>
-    </ol>
-    
-    <li><a href="#release-qualify">Release Qualification Criteria</a></li>
-    <ol>
-    <li><a href="#llvm-qualify">Qualify LLVM</a></li>
-    <li><a href="#llvmgcc-qualify">Qualify LLVM-GCC</a></li>
-    <li><a href="#clang-qualify">Qualify Clang</a></li>
-    <li><a href="#targets">Specific Target Qualification Details</a></li>
-    </ol>
-    
-    <li><a href="#commTest">Community Testing</a></li>    
-    <li><a href="#release-patch">Release Patch Rules</a></li>
-
-    
-    <li><a href="#release-final">Release final tasks</a></li>
-    <ol>
-    <li><a href="#updocs">Update Documentation</a></li>
-    <li><a href="#tag">Tag the LLVM Release Branch</a></li>
-    <li><a href="#updemo">Update the LLVM Demo Page</a></li>
-    <li><a href="#webupdates">Update the LLVM Website</a></li>
-    <li><a href="#announce">Announce the Release</a></li>
-    </ol>
-    
-  </ol>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="release-admin">
-Release Administrative Tasks</a></div>
-
-<div class="doc_text">
-This section describes a few administrative tasks that need to be done for the
-release process to begin. Specifically, it involves creating the release branch,
- resetting version numbers, and creating the release tarballs for the release 
- team to begin testing.
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection"><a name="branch">Create Release Branch</a></div>
-<div class="doc_text">
-<p>Branch the Subversion HEAD using the following procedure:</p>
-  <ol>
-    <li>
-    <p>Verify that the current Subversion HEAD is in decent shape by examining 
-    nightly tester or buildbot results.</p></li>
-    <li>
-    <p>Request all developers to refrain from committing. Offenders get commit
-    rights taken away (temporarily).</p></li>
-  <li>
-  <p> Create the release branch for <tt>llvm</tt>, <tt>llvm-gcc4.2</tt>, 
-  <tt>clang</tt>, and the <tt>test-suite</tt>. The branch name will be 
-  <tt>release_XX</tt>,where <tt>XX</tt> is the major and minor release numbers.
-  <tt>Clang</tt> will have a different release number than <tt>llvm</tt>/
-  <tt>llvm-gcc4</tt> since its first release was years later 
-  (still deciding if this will be true or not). These branches 
-  can be created without checking out anything from subversion.
-  </p>
-  
-  <div class="doc_code">
-<pre>
-svn copy https://llvm.org/svn/llvm-project/llvm/trunk \
-         https://llvm.org/svn/llvm-project/llvm/branches/release_<i>XX</i>
-svn copy https://llvm.org/svn/llvm-project/llvm-gcc-4.2/trunk \
-         https://llvm.org/svn/llvm-project/llvm-gcc-4.2/branches/release_<i>XX</i>
-svn copy https://llvm.org/svn/llvm-project/test-suite/trunk \
-         https://llvm.org/svn/llvm-project/test-suite/branches/release_<i>XX</i>
-svn copy https://llvm.org/svn/llvm-project/cfe/trunk \
-         https://llvm.org/svn/llvm-project/cfe/branches/release_<i>XX</i>
-</pre>
-  </div>
-
-  <li>
-    <p>Advise developers they can work on Subversion HEAD again.</p></li>
-  
-  <li>
-    <p>The Release Manager should switch to the release branch (as all changes 
-    to the release will now be done in the branch).  The easiest way to do this 
-    is to grab another working copy using the following commands:</p>
-
-<div class="doc_code">
-<pre>
-svn co https://llvm.org/svn/llvm-project/llvm/branches/release_<i>XX</i>
-svn co https://llvm.org/svn/llvm-project/llvm-gcc-4.2/branches/release_<i>XX</i>
-svn co https://llvm.org/svn/llvm-project/test-suite/branches/release_<i>XX</i>
-svn co https://llvm.org/svn/llvm-project/cfe/branches/release_<i>XX</i>
-</pre>
-</div></li>
-
-  </ol>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection"><a name="verchanges">Update LLVM Version</a></div>
-<div class="doc_text">
-  <p>
-  After creating the LLVM release branch, update the release branches'
-  autoconf/configure.ac version from X.Xsvn to just X.X. Update it on mainline
-  as well to be the next version (X.X+1svn). Regenerated the configure script
-  for both. This must be done for both <tt>llvm</tt> and the 
-  <tt>test-suite</tt>.
-  </p>
-  <p>FIXME: Add a note about <tt>clang</tt>.</p>
-  <p>In addition, the version number of all the Bugzilla components must be
-  updated for the next release.
-  </p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection"><a name="dist">Build the LLVM Source Distributions</a></div>
-<div class="doc_text">
-  <p>
-  Create source distributions for <tt>LLVM</tt>, <tt>LLVM-GCC</tt>,  
-  <tt>clang</tt>, and the llvm <tt>test-suite</tt> by exporting the source from 
-  Subversion and archiving it.  This can be done with the following commands:
-  </p>
-
-<div class="doc_code">
-<pre>
-svn export https://llvm.org/svn/llvm-project/llvm/branches/release_<i>XX</i> llvm-X.X
-svn export https://llvm.org/svn/llvm-project/llvm-gcc-4.2/branches/release_<i>XX</i> llvm-gcc4.2-X.X.source
-svn export https://llvm.org/svn/llvm-project/test-suite/branches/release_<i>XX</i> llvm-test-X.X
-svn export https://llvm.org/svn/llvm-project/cfe/branches/release_<i>XX</i> clang-X.X
-tar -czvf - llvm-X.X          | gzip &gt; llvm-X.X.tar.gz
-tar -czvf - llvm-test-X.X     | gzip &gt; llvm-test-X.X.tar.gz
-tar -czvf - llvm-gcc4.2-X.X.source | gzip &gt; llvm-gcc-4.2-X.X.source.tar.gz
-tar -czvf - clang-X.X | gzip &gt; clang-X.X.tar.gz
-</pre>
-</div>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="release-build">
-Building the Release</a></div>
-
-<div class="doc_text">
-The build of <tt>llvm</tt>, <tt>llvm-gcc</tt>, and <tt>clang</tt> must be free
-of errors and warnings in both debug, release, and release-asserts builds. 
-If all builds are clean, then the release passes build qualification.
-
-<ol>
-<li>debug: ENABLE_OPTIMIZED=0</li>
-<li>release: ENABLE_OPTIMIZED=1</li>
-<li>release-asserts: ENABLE_OPTIMIZED=1 DISABLE_ASSERTIONS=1</li>
-</ol>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection"><a name="build">Build LLVM</a></div>
-<div class="doc_text">
-  <p>
-  Build both debug, release (optimized), and release-asserts versions of 
-  LLVM on all supported platforms. Direction to build llvm are 
-  <a href="http://llvm.org/docs/GettingStarted.html#quickstart">here</a>.
-  </p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection"><a name="llvmgccbin">Build the LLVM GCC Binary Distribution</a></div>
-<div class="doc_text">
-  <p>
-  Creating the LLVM GCC binary distribution (release/optimized) requires 
-  performing the following steps for each supported platform:
-  </p>
-
-  <ol>
-    <li>
-    Build the LLVM GCC front-end by following the directions in the README.LLVM
-    file. The frontend must be compiled with c, c++, objc (mac only), 
-    objc++ (mac only) and fortran support. </li>
-    <li>Please boostrap as well.</li>
-    <li>Be sure to build with LLVM_VERSION_INFO=X.X, where X is the major and
-    minor release numbers.
-    </li>
-
-    <li>
-    Copy the installation directory to a directory named for the specific target.
-    For example on Red Hat Enterprise Linux, the directory would be named
-    <tt>llvm-gcc4.2-2.6-x86-linux-RHEL4</tt>. Archive and compress the new directory.  
-    </li>
-  </ol>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection"><a name="clangbin">Build Clang 
-Binary Distribution</a></div>
-<div class="doc_text">
-  <p>
-  Creating the Clang binary distribution (debug/release/release-asserts) requires 
-  performing the following steps for each supported platform:
-  </p>
-
-  <ol>
-    <li>
-    Build clang according to the directions 
-    <a href="http://clang.llvm.org/get_started.html">here</a>.
-    </li>
-    
-    <li>Build both a debug and release version of clang, but the binary
-    will be a release build.</lI>
-
-    <li>
-    Package clang (details to follow).
-    </li>
-  </ol>
-</div>
-
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection"><a name="target-build">Target Specific Build 
-Details</a></div>
-<div class="doc_text">
-  <p>
-  The table below specifies which compilers are used for each arch/os combination
-  when qualifying the build of <tt>llvm</tt>, <tt>llvm-gcc</tt>, <tt>clang.
-  </tt></p>
-  
-  <p>
-  <table>
-  <tr><th>Architecture</th><th>OS</th><th>compiler</th></tr>
-  <tr><td>x86-32</td><td>Mac OS 10.5</td><td>gcc 4.0.1</td></tr>
-  <tr><td>x86-32</td><td>Linux</td><td>gcc 4.2.X, gcc 4.3.X</td></tr>
-  <tr><td>x86-32</td><td>FreeBSD</td><td>gcc 4.2.X</td></tr>
-   <tr><td>x86-32</td><td>mingw</td><td>gcc 3.4.5</td></tr>
-  <tr><td>x86-64</td><td>Mac OS 10.5</td><td>gcc 4.0.1</td></tr>
-  <tr><td>x86-64</td><td>Linux</td><td>gcc 4.2.X, gcc 4.3.X</td></tr>
-  <tr><td>x86-64</td><td>FreeBSD</td><td>gcc 4.2.X</td></tr>
- 
-  </table> 
-  </p>
-
-</div>
-
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="release-qualify">
-Building the Release</a></div>
-
-<div class="doc_text">
- A release is qualified when it has no regressions from the previous 
- release (or baseline). Regressions are related to correctness only and not 
- performance at this time. <b>Regressions are new failures in the set of tests that
- are used to qualify each product and only include things on the list. 
- Ultimately, there is no end to the number of possible bugs in a release.  We 
- need a very concrete and definitive release criteria that ensures we have 
- monotonically improving quality on some metric.  The metric we use is 
- described below.  This doesn't mean that we don't care about other things, 
- but this are things that must be satisfied before a release can go out</b>
-</div>
-
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection"><a name="llvm-qualify">Qualify LLVM</a></div>
-<div class="doc_text">
-  <p>
-  LLVM is qualified when it has a clean dejagnu test run without a frontend and 
-  it has no regressions when using either <tt>llvm-gcc</tt> or <tt>clang</tt> 
-  with the <tt>test-suite</tt> from the previous release.
-</p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection"><a name="llvmgcc-qualify">Qualify LLVM-GCC</a></div>
-<div class="doc_text">
-  <p>
-  <tt>LLVM-GCC</tt> is qualified when front-end specific tests in the 
-  <tt>llvm</tt> dejagnu test suite all pass and there are no regressions in 
-  the <tt>test-suite</tt>.</p>
-  <p>We do not use the gcc dejagnu test suite as release criteria.</p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection"><a name="clang-qualify">Qualify Clang</a></div>
-<div class="doc_text">
-    <tt>Clang</tt> is qualified when front-end specific tests in the 
-  <tt>llvm</tt> dejagnu test suite all pass, clang's own test suite passes 
-  cleanly, and there are no regressions in the <tt>test-suite</tt>.</p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection"><a name="targets">Specific Target 
-Qualification Details</a></div>
-<div class="doc_text">
-  <p><table>
-  <tr><th>Architecture</th><th>OS</th><th>llvm-gcc baseline</th><th>clang baseline
-  </th><th>tests</th></tr>
-  <tr><td>x86-32</td><td>Mac OS 10.5</td><td>last release</td><td>none</td><td>llvm dejagnu, clang tests, test-suite (including spec)</td></tr>
-  <tr><td>x86-32</td><td>Linux</td><td>last release</td><td>none</td><td>llvm dejagnu, clang tests, test-suite (including spec)</td></tr>
-  <tr><td>x86-32</td><td>FreeBSD</td><td>none</td><td>none</td><td>llvm dejagnu, clang tests, test-suite</td></tr>
-  <tr><td>x86-32</td><td>mingw</td><td>last release</td><td>none</td><td>QT</td></tr>
-  <tr><td>x86-64</td><td>Mac OS 10.5</td><td>last release</td><td>none</td><td>llvm dejagnu, clang tests, test-suite (including spec)</td></tr>
-  <tr><td>x86-64</td><td>Linux</td><td>last release</td><td>none</td><td>llvm dejagnu, clang tests, test-suite (including spec)</td></tr>
-  <tr><td>x86-64</td><td>FreeBSD</td><td>none</td><td>none</td><td>llvm dejagnu, clang tests, test-suite</td></tr>
-  </table></p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="commTest">Community Testing</a></div>
-<div class="doc_text">
-  <p>
-  Once all testing has been completed and appropriate bugs filed, the pre-release
-  tar balls may be put on the website and the LLVM community is notified. Ask that
-  all LLVM developers test the release in 2 ways:</p>
-  <ol>
-  <li>Download llvm-X.X, llvm-test-X.X, and the appropriate llvm-gcc4 
-  and/or clang binary. Build LLVM.
-  Run "make check" and the full llvm-test suite (make TEST=nightly report).</li>
-  <li>Download llvm-X.X, llvm-test-X.X, and the llvm-gcc4 and/or clang source. 
-  Compile everything. Run "make check" and the full llvm-test suite (make TEST=nightly 
-  report).</li>
-  </ol>
-  <p>Ask LLVM developers to submit the report and make check results to the list.
-  Attempt to verify that there are no regressions from the previous release. 
-  The results are not used to qualify a release, but to spot other potential 
-  problems. For unsupported targets, verify that make check at least is 
-  clean.</p>
-  
-  <p>During the first round of testing time,
-  all regressions must be fixed before the second pre-release is created.</p>
-  
-  <p>If this is the second round of testing, this is only to ensure the bug 
-  fixes previously merged in have not created new major problems. This is not 
-  the time to solve additional and unrelated bugs. If no patches are merged in, 
-  the release is determined to be ready and the release manager may move onto 
-  the next step.
-  </p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="release-patch">Release Patch Rules 
-</a></div>
-<div class="doc_text">
-  <p>
-  Below are the rules regarding patching the release branch.</p>
-  <p>
-  <li>Patches applied to the release branch are only applied by the release 
-  manager.</li>
-  <li>During the first round of testing, patches that fix regressions or that
-  are small and relatively risk free (verified by the appropriate code owner)
-  are applied to the branch. Code owners are asked to be very conservative in 
-  approving patches for the branch and we reserve the right to reject any patch 
-  that does not fix a regression as previously defined.</li>
-  <li>During the remaining rounds of testing, only patches that fix regressions
-  may be applied.</li>
-  
-  </p>
-</div>
-
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="release-final">Release Final Tasks 
-</a></div>
-<div class="doc_text">
-  <p>
-  The final stages of the release process involving taging the release branch,
-  updating documentation that refers to the release, and updating the demo
-  page.</p>
-  <p>FIXME: Add a note if anything needs to be done to the clang website. 
-  Eventually the websites will be merged hopefully.</p>
-</div>
-
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection"><a name="updocs">Update Documentation</a></div>
-<div class="doc_text">
-  <p>
-  Review the documentation and ensure that it is up to date.  The Release Notes
-  must be updated to reflect bug fixes, new known issues, and changes in the
-  list of supported platforms.  The Getting Started Guide should be updated to
-  reflect the new release version number tag avaiable from Subversion and
-  changes in basic system requirements. Merge both changes from mainline into 
-  the release branch.
-  </p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection"><a name="tag">Tag the Release Branch</a></div>
-<div class="doc_text">
-  <p>Tag the release branch using the following procedure:</p>
-<div class="doc_code">
-<pre>
-svn copy https://llvm.org/svn/llvm-project/llvm/branches/release_XX \
-         https://llvm.org/svn/llvm-project/llvm/tags/RELEASE_<i>XX</i>
-svn copy https://llvm.org/svn/llvm-project/llvm-gcc-4.2/branches/release_XX \
-         https://llvm.org/svn/llvm-project/llvm-gcc-4.2/tags/RELEASE_<i>XX</i>
-svn copy https://llvm.org/svn/llvm-project/test-suite/branches/release_XX \
-         https://llvm.org/svn/llvm-project/test-suite/tags/RELEASE_<i>XX</i>
-</pre>
-</div>
-</div>
-
-
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="updemo">Update the LLVM Demo Page</a></div>
-<div class="doc_text">
-  <p>
-  The LLVM demo page must be updated to use the new release. This consists of
-  using the llvm-gcc binary and building LLVM. Update the website demo page
-  configuration to use the new release.</p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection"><a name="webupdates">Update the LLVM Website</a></div>
-<div class="doc_text">
-  <p>
-  The website must be updated before the release announcement is sent out. Here is
-  what to do:</p>
-  <ol>
-  <li> Check out the <tt>website</tt> module from CVS. </li> 
-  <li> Create a new subdirectory X.X in the releases directory. </li> 
-  <li> Commit the <tt>llvm</tt>, <tt>test-suite</tt>, <tt>llvm-gcc</tt> source,
-  <tt>clang source</tt>, <tt>clang binaries</tt>, 
-  and <tt>llvm-gcc</tt> binaries in this new directory. </li>
-  <li> Copy and commit the <tt>llvm/docs</tt> and <tt>LICENSE.txt</tt>
-  files into this new directory. The docs should be built with BUILD_FOR_WEBSITE=1.</li>
-  <li> Commit the index.html to the release/X.X directory to redirect (use from previous
-  release. </li>
-  <li> Update the <tt>releases/download.html</tt> file with the new release. </li>
-  <li>Update the <tt>releases/index.html</tt> with the new release and link to 
-  release documentation.</li>
-  <li> Finally, update the main page (<tt>index.html</tt> and sidebar) to
-  point to the new release and release announcement. Make sure this all gets
-  committed back into Subversion.</li>
-  </ol>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection"><a name="announce">Announce the Release</a></div>
-<div class="doc_text">
-  <p>Have Chris send out the release announcement when everything is finished.</p>
-</div>
-
-<!-- *********************************************************************** -->
-<hr>
-<address>
-  <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
-  src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS"></a>
-  <a href="http://validator.w3.org/check/referer"><img
-  src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
-  <a href="http://llvm.cs.uiuc.edu">The LLVM Compiler Infrastructure</a>
-  <br>
-  Last modified: $Date$
-</address>
-</body>
-</html>
diff --git a/libclamav/c++/llvm/docs/HowToSubmitABug.html b/libclamav/c++/llvm/docs/HowToSubmitABug.html
deleted file mode 100644
index 0815b88..0000000
--- a/libclamav/c++/llvm/docs/HowToSubmitABug.html
+++ /dev/null
@@ -1,355 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-                      "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-  <title>How to submit an LLVM bug report</title>
-  <link rel="stylesheet" href="llvm.css" type="text/css">
-</head>
-<body>
-
-<div class="doc_title">
-  How to submit an LLVM bug report
-</div>
-
-<table class="layout" style="width: 90%" >
-<tr class="layout">
-  <td class="left">
-<ol>
-  <li><a href="#introduction">Introduction - Got bugs?</a></li>
-  <li><a href="#crashers">Crashing Bugs</a>
-    <ul>
-    <li><a href="#front-end">Front-end bugs</a>
-    <li><a href="#ct_optimizer">Compile-time optimization bugs</a>
-    <li><a href="#ct_codegen">Code generator bugs</a>
-    </ul></li>
-  <li><a href="#miscompilations">Miscompilations</a></li>
-  <li><a href="#codegen">Incorrect code generation (JIT and LLC)</a></li>
-</ol>
-<div class="doc_author">
-  <p>Written by <a href="mailto:sabre at nondot.org">Chris Lattner</a> and
-                <a href="http://misha.brukman.net">Misha Brukman</a></p>
-</div>
-</td>
-<td class="right">
-  <img src="img/Debugging.gif" alt="Debugging" width="444" height="314">
-</td>
-</tr>
-</table>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="introduction">Introduction - Got bugs?</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>If you're working with LLVM and run into a bug, we definitely want to know
-about it.  This document describes what you can do to increase the odds of
-getting it fixed quickly.</p>
-
-<p>Basically you have to do two things at a minimum.  First, decide whether the
-bug <a href="#crashers">crashes the compiler</a> (or an LLVM pass), or if the
-compiler is <a href="#miscompilations">miscompiling</a> the program (i.e., the
-compiler successfully produces an executable, but it doesn't run right).  Based
-on
-what type of bug it is, follow the instructions in the linked section to narrow
-down the bug so that the person who fixes it will be able to find the problem
-more easily.</p>
-
-<p>Once you have a reduced test-case, go to <a
-href="http://llvm.org/bugs/enter_bug.cgi">the LLVM Bug Tracking
-System</a> and fill out the form with the necessary details (note that you don't
-need to pick a category, just use the "new-bugs" category if you're not sure).
-The bug description should contain the following
-information:</p>
-
-<ul>
-  <li>All information necessary to reproduce the problem.</li>
-  <li>The reduced test-case that triggers the bug.</li>
-  <li>The location where you obtained LLVM (if not from our Subversion
-  repository).</li>
-</ul>
-
-<p>Thanks for helping us make LLVM better!</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="crashers">Crashing Bugs</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>More often than not, bugs in the compiler cause it to crash&mdash;often due
-to an assertion failure of some sort. The most important
-piece of the puzzle is to figure out if it is crashing in the GCC front-end
-or if it is one of the LLVM libraries (e.g. the optimizer or code generator)
-that has problems.</p>
-
-<p>To figure out which component is crashing (the front-end,
-optimizer or code generator), run the
-<tt><b>llvm-gcc</b></tt> command line as you were when the crash occurred, but
-with the following extra command line options:</p>
-
-<ul>
-  <li><tt><b>-O0 -emit-llvm</b></tt>: If <tt>llvm-gcc</tt> still crashes when
-  passed these options (which disable the optimizer and code generator), then
-  the crash is in the front-end.  Jump ahead to the section on <a
-  href="#front-end">front-end bugs</a>.</li>
-
-  <li><tt><b>-emit-llvm</b></tt>: If <tt>llvm-gcc</tt> crashes with this option
-  (which disables the code generator), you found an optimizer bug.  Jump ahead
-  to <a href="#ct_optimizer"> compile-time optimization bugs</a>.</li>
-
-  <li>Otherwise, you have a code generator crash.  Jump ahead to <a
-  href="#ct_codegen">code generator bugs</a>.</li>
-
-</ul>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="front-end">Front-end bugs</a>
-</div>
-
-<div class="doc_text">
-
-<p>If the problem is in the front-end, you should re-run the same
-<tt>llvm-gcc</tt> command that resulted in the crash, but add the
-<tt>-save-temps</tt> option.  The compiler will crash again, but it will leave
-behind a <tt><i>foo</i>.i</tt> file (containing preprocessed C source code) and
-possibly <tt><i>foo</i>.s</tt> for each
-compiled <tt><i>foo</i>.c</tt> file. Send us the <tt><i>foo</i>.i</tt> file,
-along with the options you passed to llvm-gcc, and a brief description of the
-error it caused.</p>
-
-<p>The <a href="http://delta.tigris.org/">delta</a> tool helps to reduce the
-preprocessed file down to the smallest amount of code that still replicates the
-problem. You're encouraged to use delta to reduce the code to make the
-developers' lives easier. <a
-href="http://gcc.gnu.org/wiki/A_guide_to_testcase_reduction">This website</a>
-has instructions on the best way to use delta.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="ct_optimizer">Compile-time optimization bugs</a>
-</div>
-
-<div class="doc_text">
-
-<p>If you find that a bug crashes in the optimizer, compile your test-case to a
-<tt>.bc</tt> file by passing "<tt><b>-emit-llvm -O0 -c -o foo.bc</b></tt>".
-Then run:</p>
-
-<div class="doc_code">
-<p><tt><b>opt</b> -std-compile-opts -debug-pass=Arguments foo.bc
-    -disable-output</tt></p>
-</div>
-
-<p>This command should do two things: it should print out a list of passes, and
-then it should crash in the same was as llvm-gcc.  If it doesn't crash, please
-follow the instructions for a <a href="#front-end">front-end bug</a>.</p>
-
-<p>If this does crash, then you should be able to debug this with the following
-bugpoint command:</p>
-
-<div class="doc_code">
-<p><tt><b>bugpoint</b> foo.bc &lt;list of passes printed by 
-<b>opt</b>&gt;</tt></p>
-</div>
-
-<p>Please run this, then file a bug with the instructions and reduced .bc files
-that bugpoint emits.  If something goes wrong with bugpoint, please submit the
-"foo.bc" file and the list of passes printed by <b>opt</b>.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="ct_codegen">Code generator bugs</a>
-</div>
-
-<div class="doc_text">
-
-<p>If you find a bug that crashes llvm-gcc in the code generator, compile your
-source file to a .bc file by passing "<tt><b>-emit-llvm -c -o foo.bc</b></tt>"
-to llvm-gcc (in addition to the options you already pass).  Once your have
-foo.bc, one of the following commands should fail:</p>
-
-<ol>
-<li><tt><b>llc</b> foo.bc</tt></li>
-<li><tt><b>llc</b> foo.bc -relocation-model=pic</tt></li>
-<li><tt><b>llc</b> foo.bc -relocation-model=static</tt></li>
-<li><tt><b>llc</b> foo.bc -enable-eh</tt></li>
-<li><tt><b>llc</b> foo.bc -relocation-model=pic -enable-eh</tt></li>
-<li><tt><b>llc</b> foo.bc -relocation-model=static -enable-eh</tt></li>
-</ol>
-
-<p>If none of these crash, please follow the instructions for a
-<a href="#front-end">front-end bug</a>.  If one of these do crash, you should
-be able to reduce this with one of the following bugpoint command lines (use
-the one corresponding to the command above that failed):</p>
-
-<ol>
-<li><tt><b>bugpoint</b> -run-llc foo.bc</tt></li>
-<li><tt><b>bugpoint</b> -run-llc foo.bc --tool-args
-           -relocation-model=pic</tt></li>
-<li><tt><b>bugpoint</b> -run-llc foo.bc --tool-args
-           -relocation-model=static</tt></li>
-<li><tt><b>bugpoint</b> -run-llc foo.bc --tool-args -enable-eh</tt></li>
-<li><tt><b>bugpoint</b> -run-llc foo.bc --tool-args
-           -relocation-model=pic -enable-eh</tt></li>
-<li><tt><b>bugpoint</b> -run-llc foo.bc --tool-args
-           -relocation-model=static -enable-eh</tt></li>
-</ol>
-
-<p>Please run this, then file a bug with the instructions and reduced .bc file
-that bugpoint emits.  If something goes wrong with bugpoint, please submit the
-"foo.bc" file and the option that llc crashes with.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="miscompilations">Miscompilations</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>If llvm-gcc successfully produces an executable, but that executable doesn't
-run right, this is either a bug in the code or a bug in the
-compiler.  The first thing to check is to make sure it is not using undefined
-behavior (e.g. reading a variable before it is defined).  In particular, check
-to see if the program <a href="http://valgrind.org/">valgrind</a>s clean,
-passes purify, or some other memory checker tool.  Many of the "LLVM bugs" that
-we have chased down ended up being bugs in the program being compiled, not
- LLVM.</p>
-
-<p>Once you determine that the program itself is not buggy, you should choose 
-which code generator you wish to compile the program with (e.g. C backend, the 
-JIT, or LLC) and optionally a series of LLVM passes to run.  For example:</p>
-
-<div class="doc_code">
-<p><tt>
-<b>bugpoint</b> -run-cbe [... optzn passes ...] file-to-test.bc --args -- [program arguments]</tt></p>
-</div>
-
-<p><tt>bugpoint</tt> will try to narrow down your list of passes to the one pass
-that causes an error, and simplify the bitcode file as much as it can to assist
-you. It will print a message letting you know how to reproduce the resulting
-error.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="codegen">Incorrect code generation</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>Similarly to debugging incorrect compilation by mis-behaving passes, you can
-debug incorrect code generation by either LLC or the JIT, using
-<tt>bugpoint</tt>. The process <tt>bugpoint</tt> follows in this case is to try
-to narrow the code down to a function that is miscompiled by one or the other
-method, but since for correctness, the entire program must be run,
-<tt>bugpoint</tt> will compile the code it deems to not be affected with the C
-Backend, and then link in the shared object it generates.</p>
-
-<p>To debug the JIT:</p>
-
-<div class="doc_code">
-<pre>
-bugpoint -run-jit -output=[correct output file] [bitcode file]  \
-         --tool-args -- [arguments to pass to lli]              \
-         --args -- [program arguments]
-</pre>
-</div>
-
-<p>Similarly, to debug the LLC, one would run:</p>
-
-<div class="doc_code">
-<pre>
-bugpoint -run-llc -output=[correct output file] [bitcode file]  \
-         --tool-args -- [arguments to pass to llc]              \
-         --args -- [program arguments]
-</pre>
-</div>
-
-<p><b>Special note:</b> if you are debugging MultiSource or SPEC tests that
-already exist in the <tt>llvm/test</tt> hierarchy, there is an easier way to
-debug the JIT, LLC, and CBE, using the pre-written Makefile targets, which
-will pass the program options specified in the Makefiles:</p>
-
-<div class="doc_code">
-<p><tt>
-cd llvm/test/../../program<br>
-make bugpoint-jit
-</tt></p>
-</div>
-
-<p>At the end of a successful <tt>bugpoint</tt> run, you will be presented
-with two bitcode files: a <em>safe</em> file which can be compiled with the C
-backend and the <em>test</em> file which either LLC or the JIT
-mis-codegenerates, and thus causes the error.</p>
-
-<p>To reproduce the error that <tt>bugpoint</tt> found, it is sufficient to do
-the following:</p>
-
-<ol>
-
-<li><p>Regenerate the shared object from the safe bitcode file:</p>
-
-<div class="doc_code">
-<p><tt>
-<b>llc</b> -march=c safe.bc -o safe.c<br>
-<b>gcc</b> -shared safe.c -o safe.so
-</tt></p>
-</div></li>
-
-<li><p>If debugging LLC, compile test bitcode native and link with the shared
-    object:</p>
-
-<div class="doc_code">
-<p><tt>
-<b>llc</b> test.bc -o test.s<br>
-<b>gcc</b> test.s safe.so -o test.llc<br>
-./test.llc [program options]
-</tt></p>
-</div></li>
-    
-<li><p>If debugging the JIT, load the shared object and supply the test
-    bitcode:</p>
-
-<div class="doc_code">
-<p><tt><b>lli</b> -load=safe.so test.bc [program options]</tt></p>
-</div></li>  
-
-</ol>
-
-</div>
-
-<!-- *********************************************************************** -->
-<hr>
-<address>
-  <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
-  src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS"></a>
-  <a href="http://validator.w3.org/check/referer"><img
-  src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
-
-  <a href="mailto:sabre at nondot.org">Chris Lattner</a><br>
-  <a href="http://llvm.org">The LLVM Compiler Infrastructure</a>
-  <br>
-  Last modified: $Date$
-</address>
-
-</body>
-</html>
diff --git a/libclamav/c++/llvm/docs/LangRef.html b/libclamav/c++/llvm/docs/LangRef.html
deleted file mode 100644
index b337b6a..0000000
--- a/libclamav/c++/llvm/docs/LangRef.html
+++ /dev/null
@@ -1,7439 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-                      "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-  <title>LLVM Assembly Language Reference Manual</title>
-  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-  <meta name="author" content="Chris Lattner">
-  <meta name="description"
-  content="LLVM Assembly Language Reference Manual.">
-  <link rel="stylesheet" href="llvm.css" type="text/css">
-</head>
-
-<body>
-
-<div class="doc_title"> LLVM Language Reference Manual </div>
-<ol>
-  <li><a href="#abstract">Abstract</a></li>
-  <li><a href="#introduction">Introduction</a></li>
-  <li><a href="#identifiers">Identifiers</a></li>
-  <li><a href="#highlevel">High Level Structure</a>
-    <ol>
-      <li><a href="#modulestructure">Module Structure</a></li>
-      <li><a href="#linkage">Linkage Types</a>
-        <ol>
-          <li><a href="#linkage_private">'<tt>private</tt>' Linkage</a></li>
-          <li><a href="#linkage_linker_private">'<tt>linker_private</tt>' Linkage</a></li>
-          <li><a href="#linkage_internal">'<tt>internal</tt>' Linkage</a></li>
-          <li><a href="#linkage_available_externally">'<tt>available_externally</tt>' Linkage</a></li>
-          <li><a href="#linkage_linkonce">'<tt>linkonce</tt>' Linkage</a></li>
-          <li><a href="#linkage_common">'<tt>common</tt>' Linkage</a></li>
-          <li><a href="#linkage_weak">'<tt>weak</tt>' Linkage</a></li>
-          <li><a href="#linkage_appending">'<tt>appending</tt>' Linkage</a></li>
-          <li><a href="#linkage_externweak">'<tt>extern_weak</tt>' Linkage</a></li>
-          <li><a href="#linkage_linkonce_odr">'<tt>linkonce_odr</tt>' Linkage</a></li>
-          <li><a href="#linkage_weak">'<tt>weak_odr</tt>' Linkage</a></li>
-          <li><a href="#linkage_external">'<tt>externally visible</tt>' Linkage</a></li>
-          <li><a href="#linkage_dllimport">'<tt>dllimport</tt>' Linkage</a></li>
-          <li><a href="#linkage_dllexport">'<tt>dllexport</tt>' Linkage</a></li>
-        </ol>
-      </li>
-      <li><a href="#callingconv">Calling Conventions</a></li>
-      <li><a href="#namedtypes">Named Types</a></li>
-      <li><a href="#globalvars">Global Variables</a></li>
-      <li><a href="#functionstructure">Functions</a></li>
-      <li><a href="#aliasstructure">Aliases</a></li>
-      <li><a href="#namedmetadatastructure">Named Metadata</a></li>
-      <li><a href="#paramattrs">Parameter Attributes</a></li>
-      <li><a href="#fnattrs">Function Attributes</a></li>
-      <li><a href="#gc">Garbage Collector Names</a></li>
-      <li><a href="#moduleasm">Module-Level Inline Assembly</a></li>
-      <li><a href="#datalayout">Data Layout</a></li>
-      <li><a href="#pointeraliasing">Pointer Aliasing Rules</a></li>
-    </ol>
-  </li>
-  <li><a href="#typesystem">Type System</a>
-    <ol>
-      <li><a href="#t_classifications">Type Classifications</a></li>
-      <li><a href="#t_primitive">Primitive Types</a>
-        <ol>
-          <li><a href="#t_integer">Integer Type</a></li>
-          <li><a href="#t_floating">Floating Point Types</a></li>
-          <li><a href="#t_void">Void Type</a></li>
-          <li><a href="#t_label">Label Type</a></li>
-          <li><a href="#t_metadata">Metadata Type</a></li>
-        </ol>
-      </li>
-      <li><a href="#t_derived">Derived Types</a>
-        <ol>
-          <li><a href="#t_aggregate">Aggregate Types</a>
-            <ol>
-              <li><a href="#t_array">Array Type</a></li>
-              <li><a href="#t_struct">Structure Type</a></li>
-              <li><a href="#t_pstruct">Packed Structure Type</a></li>
-              <li><a href="#t_union">Union Type</a></li>
-              <li><a href="#t_vector">Vector Type</a></li>
-            </ol>
-          </li>
-          <li><a href="#t_function">Function Type</a></li>
-          <li><a href="#t_pointer">Pointer Type</a></li>
-          <li><a href="#t_opaque">Opaque Type</a></li>
-        </ol>
-      </li>
-      <li><a href="#t_uprefs">Type Up-references</a></li>
-    </ol>
-  </li>
-  <li><a href="#constants">Constants</a>
-    <ol>
-      <li><a href="#simpleconstants">Simple Constants</a></li>
-      <li><a href="#complexconstants">Complex Constants</a></li>
-      <li><a href="#globalconstants">Global Variable and Function Addresses</a></li>
-      <li><a href="#undefvalues">Undefined Values</a></li>
-      <li><a href="#blockaddress">Addresses of Basic Blocks</a></li>
-      <li><a href="#constantexprs">Constant Expressions</a></li>
-    </ol>
-  </li>
-  <li><a href="#othervalues">Other Values</a>
-    <ol>
-      <li><a href="#inlineasm">Inline Assembler Expressions</a></li>
-      <li><a href="#metadata">Metadata Nodes and Metadata Strings</a></li>
-    </ol>
-  </li>
-  <li><a href="#intrinsic_globals">Intrinsic Global Variables</a>
-    <ol>
-      <li><a href="#intg_used">The '<tt>llvm.used</tt>' Global Variable</a></li>
-      <li><a href="#intg_compiler_used">The '<tt>llvm.compiler.used</tt>'
-          Global Variable</a></li>
-      <li><a href="#intg_global_ctors">The '<tt>llvm.global_ctors</tt>'
-         Global Variable</a></li>
-      <li><a href="#intg_global_dtors">The '<tt>llvm.global_dtors</tt>'
-         Global Variable</a></li>
-    </ol>
-  </li>
-  <li><a href="#instref">Instruction Reference</a>
-    <ol>
-      <li><a href="#terminators">Terminator Instructions</a>
-        <ol>
-          <li><a href="#i_ret">'<tt>ret</tt>' Instruction</a></li>
-          <li><a href="#i_br">'<tt>br</tt>' Instruction</a></li>
-          <li><a href="#i_switch">'<tt>switch</tt>' Instruction</a></li>
-          <li><a href="#i_indirectbr">'<tt>indirectbr</tt>' Instruction</a></li>
-          <li><a href="#i_invoke">'<tt>invoke</tt>' Instruction</a></li>
-          <li><a href="#i_unwind">'<tt>unwind</tt>'  Instruction</a></li>
-          <li><a href="#i_unreachable">'<tt>unreachable</tt>' Instruction</a></li>
-        </ol>
-      </li>
-      <li><a href="#binaryops">Binary Operations</a>
-        <ol>
-          <li><a href="#i_add">'<tt>add</tt>' Instruction</a></li>
-          <li><a href="#i_fadd">'<tt>fadd</tt>' Instruction</a></li>
-          <li><a href="#i_sub">'<tt>sub</tt>' Instruction</a></li>
-          <li><a href="#i_fsub">'<tt>fsub</tt>' Instruction</a></li>
-          <li><a href="#i_mul">'<tt>mul</tt>' Instruction</a></li>
-          <li><a href="#i_fmul">'<tt>fmul</tt>' Instruction</a></li>
-          <li><a href="#i_udiv">'<tt>udiv</tt>' Instruction</a></li>
-          <li><a href="#i_sdiv">'<tt>sdiv</tt>' Instruction</a></li>
-          <li><a href="#i_fdiv">'<tt>fdiv</tt>' Instruction</a></li>
-          <li><a href="#i_urem">'<tt>urem</tt>' Instruction</a></li>
-          <li><a href="#i_srem">'<tt>srem</tt>' Instruction</a></li>
-          <li><a href="#i_frem">'<tt>frem</tt>' Instruction</a></li>
-        </ol>
-      </li>
-      <li><a href="#bitwiseops">Bitwise Binary Operations</a>
-        <ol>
-          <li><a href="#i_shl">'<tt>shl</tt>' Instruction</a></li>
-          <li><a href="#i_lshr">'<tt>lshr</tt>' Instruction</a></li>
-          <li><a href="#i_ashr">'<tt>ashr</tt>' Instruction</a></li>
-          <li><a href="#i_and">'<tt>and</tt>' Instruction</a></li>
-          <li><a href="#i_or">'<tt>or</tt>'  Instruction</a></li>
-          <li><a href="#i_xor">'<tt>xor</tt>' Instruction</a></li>
-        </ol>
-      </li>
-      <li><a href="#vectorops">Vector Operations</a>
-        <ol>
-          <li><a href="#i_extractelement">'<tt>extractelement</tt>' Instruction</a></li>
-          <li><a href="#i_insertelement">'<tt>insertelement</tt>' Instruction</a></li>
-          <li><a href="#i_shufflevector">'<tt>shufflevector</tt>' Instruction</a></li>
-        </ol>
-      </li>
-      <li><a href="#aggregateops">Aggregate Operations</a>
-        <ol>
-          <li><a href="#i_extractvalue">'<tt>extractvalue</tt>' Instruction</a></li>
-          <li><a href="#i_insertvalue">'<tt>insertvalue</tt>' Instruction</a></li>
-        </ol>
-      </li>
-      <li><a href="#memoryops">Memory Access and Addressing Operations</a>
-        <ol>
-          <li><a href="#i_alloca">'<tt>alloca</tt>'   Instruction</a></li>
-         <li><a href="#i_load">'<tt>load</tt>'     Instruction</a></li>
-         <li><a href="#i_store">'<tt>store</tt>'    Instruction</a></li>
-         <li><a href="#i_getelementptr">'<tt>getelementptr</tt>' Instruction</a></li>
-        </ol>
-      </li>
-      <li><a href="#convertops">Conversion Operations</a>
-        <ol>
-          <li><a href="#i_trunc">'<tt>trunc .. to</tt>' Instruction</a></li>
-          <li><a href="#i_zext">'<tt>zext .. to</tt>' Instruction</a></li>
-          <li><a href="#i_sext">'<tt>sext .. to</tt>' Instruction</a></li>
-          <li><a href="#i_fptrunc">'<tt>fptrunc .. to</tt>' Instruction</a></li>
-          <li><a href="#i_fpext">'<tt>fpext .. to</tt>' Instruction</a></li>
-          <li><a href="#i_fptoui">'<tt>fptoui .. to</tt>' Instruction</a></li>
-          <li><a href="#i_fptosi">'<tt>fptosi .. to</tt>' Instruction</a></li>
-          <li><a href="#i_uitofp">'<tt>uitofp .. to</tt>' Instruction</a></li>
-          <li><a href="#i_sitofp">'<tt>sitofp .. to</tt>' Instruction</a></li>
-          <li><a href="#i_ptrtoint">'<tt>ptrtoint .. to</tt>' Instruction</a></li>
-          <li><a href="#i_inttoptr">'<tt>inttoptr .. to</tt>' Instruction</a></li>
-          <li><a href="#i_bitcast">'<tt>bitcast .. to</tt>' Instruction</a></li>
-        </ol>
-      </li>
-      <li><a href="#otherops">Other Operations</a>
-        <ol>
-          <li><a href="#i_icmp">'<tt>icmp</tt>' Instruction</a></li>
-          <li><a href="#i_fcmp">'<tt>fcmp</tt>' Instruction</a></li>
-          <li><a href="#i_phi">'<tt>phi</tt>'   Instruction</a></li>
-          <li><a href="#i_select">'<tt>select</tt>' Instruction</a></li>
-          <li><a href="#i_call">'<tt>call</tt>'  Instruction</a></li>
-          <li><a href="#i_va_arg">'<tt>va_arg</tt>'  Instruction</a></li>
-        </ol>
-      </li>
-    </ol>
-  </li>
-  <li><a href="#intrinsics">Intrinsic Functions</a>
-    <ol>
-      <li><a href="#int_varargs">Variable Argument Handling Intrinsics</a>
-        <ol>
-          <li><a href="#int_va_start">'<tt>llvm.va_start</tt>' Intrinsic</a></li>
-          <li><a href="#int_va_end">'<tt>llvm.va_end</tt>'   Intrinsic</a></li>
-          <li><a href="#int_va_copy">'<tt>llvm.va_copy</tt>'  Intrinsic</a></li>
-        </ol>
-      </li>
-      <li><a href="#int_gc">Accurate Garbage Collection Intrinsics</a>
-        <ol>
-          <li><a href="#int_gcroot">'<tt>llvm.gcroot</tt>' Intrinsic</a></li>
-          <li><a href="#int_gcread">'<tt>llvm.gcread</tt>' Intrinsic</a></li>
-          <li><a href="#int_gcwrite">'<tt>llvm.gcwrite</tt>' Intrinsic</a></li>
-        </ol>
-      </li>
-      <li><a href="#int_codegen">Code Generator Intrinsics</a>
-        <ol>
-          <li><a href="#int_returnaddress">'<tt>llvm.returnaddress</tt>' Intrinsic</a></li>
-          <li><a href="#int_frameaddress">'<tt>llvm.frameaddress</tt>'   Intrinsic</a></li>
-          <li><a href="#int_stacksave">'<tt>llvm.stacksave</tt>' Intrinsic</a></li>
-          <li><a href="#int_stackrestore">'<tt>llvm.stackrestore</tt>' Intrinsic</a></li>
-          <li><a href="#int_prefetch">'<tt>llvm.prefetch</tt>' Intrinsic</a></li>
-          <li><a href="#int_pcmarker">'<tt>llvm.pcmarker</tt>' Intrinsic</a></li>
-          <li><a href="#int_readcyclecounter"><tt>llvm.readcyclecounter</tt>' Intrinsic</a></li>
-        </ol>
-      </li>
-      <li><a href="#int_libc">Standard C Library Intrinsics</a>
-        <ol>
-          <li><a href="#int_memcpy">'<tt>llvm.memcpy.*</tt>' Intrinsic</a></li>
-          <li><a href="#int_memmove">'<tt>llvm.memmove.*</tt>' Intrinsic</a></li>
-          <li><a href="#int_memset">'<tt>llvm.memset.*</tt>' Intrinsic</a></li>
-          <li><a href="#int_sqrt">'<tt>llvm.sqrt.*</tt>' Intrinsic</a></li>
-          <li><a href="#int_powi">'<tt>llvm.powi.*</tt>' Intrinsic</a></li>
-          <li><a href="#int_sin">'<tt>llvm.sin.*</tt>' Intrinsic</a></li>
-          <li><a href="#int_cos">'<tt>llvm.cos.*</tt>' Intrinsic</a></li>
-          <li><a href="#int_pow">'<tt>llvm.pow.*</tt>' Intrinsic</a></li>
-        </ol>
-      </li>
-      <li><a href="#int_manip">Bit Manipulation Intrinsics</a>
-        <ol>
-          <li><a href="#int_bswap">'<tt>llvm.bswap.*</tt>' Intrinsics</a></li>
-          <li><a href="#int_ctpop">'<tt>llvm.ctpop.*</tt>' Intrinsic </a></li>
-          <li><a href="#int_ctlz">'<tt>llvm.ctlz.*</tt>' Intrinsic </a></li>
-          <li><a href="#int_cttz">'<tt>llvm.cttz.*</tt>' Intrinsic </a></li>
-        </ol>
-      </li>
-      <li><a href="#int_overflow">Arithmetic with Overflow Intrinsics</a>
-        <ol>
-          <li><a href="#int_sadd_overflow">'<tt>llvm.sadd.with.overflow.*</tt> Intrinsics</a></li>
-          <li><a href="#int_uadd_overflow">'<tt>llvm.uadd.with.overflow.*</tt> Intrinsics</a></li>
-          <li><a href="#int_ssub_overflow">'<tt>llvm.ssub.with.overflow.*</tt> Intrinsics</a></li>
-          <li><a href="#int_usub_overflow">'<tt>llvm.usub.with.overflow.*</tt> Intrinsics</a></li>
-          <li><a href="#int_smul_overflow">'<tt>llvm.smul.with.overflow.*</tt> Intrinsics</a></li>
-          <li><a href="#int_umul_overflow">'<tt>llvm.umul.with.overflow.*</tt> Intrinsics</a></li>
-        </ol>
-      </li>
-      <li><a href="#int_debugger">Debugger intrinsics</a></li>
-      <li><a href="#int_eh">Exception Handling intrinsics</a></li>
-      <li><a href="#int_trampoline">Trampoline Intrinsic</a>
-        <ol>
-          <li><a href="#int_it">'<tt>llvm.init.trampoline</tt>' Intrinsic</a></li>
-        </ol>
-      </li>
-      <li><a href="#int_atomics">Atomic intrinsics</a>
-        <ol>
-          <li><a href="#int_memory_barrier"><tt>llvm.memory_barrier</tt></a></li>
-          <li><a href="#int_atomic_cmp_swap"><tt>llvm.atomic.cmp.swap</tt></a></li>
-          <li><a href="#int_atomic_swap"><tt>llvm.atomic.swap</tt></a></li>
-          <li><a href="#int_atomic_load_add"><tt>llvm.atomic.load.add</tt></a></li>
-          <li><a href="#int_atomic_load_sub"><tt>llvm.atomic.load.sub</tt></a></li>
-          <li><a href="#int_atomic_load_and"><tt>llvm.atomic.load.and</tt></a></li>
-          <li><a href="#int_atomic_load_nand"><tt>llvm.atomic.load.nand</tt></a></li>
-          <li><a href="#int_atomic_load_or"><tt>llvm.atomic.load.or</tt></a></li>
-          <li><a href="#int_atomic_load_xor"><tt>llvm.atomic.load.xor</tt></a></li>
-          <li><a href="#int_atomic_load_max"><tt>llvm.atomic.load.max</tt></a></li>
-          <li><a href="#int_atomic_load_min"><tt>llvm.atomic.load.min</tt></a></li>
-          <li><a href="#int_atomic_load_umax"><tt>llvm.atomic.load.umax</tt></a></li>
-          <li><a href="#int_atomic_load_umin"><tt>llvm.atomic.load.umin</tt></a></li>
-        </ol>
-      </li>
-      <li><a href="#int_memorymarkers">Memory Use Markers</a>
-        <ol>
-          <li><a href="#int_lifetime_start"><tt>llvm.lifetime.start</tt></a></li>
-          <li><a href="#int_lifetime_end"><tt>llvm.lifetime.end</tt></a></li>
-          <li><a href="#int_invariant_start"><tt>llvm.invariant.start</tt></a></li>
-          <li><a href="#int_invariant_end"><tt>llvm.invariant.end</tt></a></li>
-        </ol>
-      </li>
-      <li><a href="#int_general">General intrinsics</a>
-        <ol>
-          <li><a href="#int_var_annotation">
-            '<tt>llvm.var.annotation</tt>' Intrinsic</a></li>
-          <li><a href="#int_annotation">
-            '<tt>llvm.annotation.*</tt>' Intrinsic</a></li>
-          <li><a href="#int_trap">
-            '<tt>llvm.trap</tt>' Intrinsic</a></li>
-          <li><a href="#int_stackprotector">
-            '<tt>llvm.stackprotector</tt>' Intrinsic</a></li>
-	  <li><a href="#int_objectsize">
-            '<tt>llvm.objectsize</tt>' Intrinsic</a></li>
-        </ol>
-      </li>
-    </ol>
-  </li>
-</ol>
-
-<div class="doc_author">
-  <p>Written by <a href="mailto:sabre at nondot.org">Chris Lattner</a>
-            and <a href="mailto:vadve at cs.uiuc.edu">Vikram Adve</a></p>
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"> <a name="abstract">Abstract </a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>This document is a reference manual for the LLVM assembly language. LLVM is
-   a Static Single Assignment (SSA) based representation that provides type
-   safety, low-level operations, flexibility, and the capability of representing
-   'all' high-level languages cleanly.  It is the common code representation
-   used throughout all phases of the LLVM compilation strategy.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"> <a name="introduction">Introduction</a> </div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>The LLVM code representation is designed to be used in three different forms:
-   as an in-memory compiler IR, as an on-disk bitcode representation (suitable
-   for fast loading by a Just-In-Time compiler), and as a human readable
-   assembly language representation.  This allows LLVM to provide a powerful
-   intermediate representation for efficient compiler transformations and
-   analysis, while providing a natural means to debug and visualize the
-   transformations.  The three different forms of LLVM are all equivalent.  This
-   document describes the human readable representation and notation.</p>
-
-<p>The LLVM representation aims to be light-weight and low-level while being
-   expressive, typed, and extensible at the same time.  It aims to be a
-   "universal IR" of sorts, by being at a low enough level that high-level ideas
-   may be cleanly mapped to it (similar to how microprocessors are "universal
-   IR's", allowing many source languages to be mapped to them).  By providing
-   type information, LLVM can be used as the target of optimizations: for
-   example, through pointer analysis, it can be proven that a C automatic
-   variable is never accessed outside of the current function, allowing it to
-   be promoted to a simple SSA value instead of a memory location.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection"> <a name="wellformed">Well-Formedness</a> </div>
-
-<div class="doc_text">
-
-<p>It is important to note that this document describes 'well formed' LLVM
-   assembly language.  There is a difference between what the parser accepts and
-   what is considered 'well formed'.  For example, the following instruction is
-   syntactically okay, but not well formed:</p>
-
-<div class="doc_code">
-<pre>
-%x = <a href="#i_add">add</a> i32 1, %x
-</pre>
-</div>
-
-<p>because the definition of <tt>%x</tt> does not dominate all of its uses. The
-   LLVM infrastructure provides a verification pass that may be used to verify
-   that an LLVM module is well formed.  This pass is automatically run by the
-   parser after parsing input assembly and by the optimizer before it outputs
-   bitcode.  The violations pointed out by the verifier pass indicate bugs in
-   transformation passes or input to the parser.</p>
-
-</div>
-
-<!-- Describe the typesetting conventions here. -->
-
-<!-- *********************************************************************** -->
-<div class="doc_section"> <a name="identifiers">Identifiers</a> </div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>LLVM identifiers come in two basic types: global and local. Global
-   identifiers (functions, global variables) begin with the <tt>'@'</tt>
-   character. Local identifiers (register names, types) begin with
-   the <tt>'%'</tt> character. Additionally, there are three different formats
-   for identifiers, for different purposes:</p>
-
-<ol>
-  <li>Named values are represented as a string of characters with their prefix.
-      For example, <tt>%foo</tt>, <tt>@DivisionByZero</tt>,
-      <tt>%a.really.long.identifier</tt>. The actual regular expression used is
-      '<tt>[%@][a-zA-Z$._][a-zA-Z$._0-9]*</tt>'.  Identifiers which require
-      other characters in their names can be surrounded with quotes. Special
-      characters may be escaped using <tt>"\xx"</tt> where <tt>xx</tt> is the
-      ASCII code for the character in hexadecimal.  In this way, any character
-      can be used in a name value, even quotes themselves.</li>
-
-  <li>Unnamed values are represented as an unsigned numeric value with their
-      prefix.  For example, <tt>%12</tt>, <tt>@2</tt>, <tt>%44</tt>.</li>
-
-  <li>Constants, which are described in a <a href="#constants">section about
-      constants</a>, below.</li>
-</ol>
-
-<p>LLVM requires that values start with a prefix for two reasons: Compilers
-   don't need to worry about name clashes with reserved words, and the set of
-   reserved words may be expanded in the future without penalty.  Additionally,
-   unnamed identifiers allow a compiler to quickly come up with a temporary
-   variable without having to avoid symbol table conflicts.</p>
-
-<p>Reserved words in LLVM are very similar to reserved words in other
-   languages. There are keywords for different opcodes
-   ('<tt><a href="#i_add">add</a></tt>',
-   '<tt><a href="#i_bitcast">bitcast</a></tt>',
-   '<tt><a href="#i_ret">ret</a></tt>', etc...), for primitive type names
-   ('<tt><a href="#t_void">void</a></tt>',
-   '<tt><a href="#t_primitive">i32</a></tt>', etc...), and others.  These
-   reserved words cannot conflict with variable names, because none of them
-   start with a prefix character (<tt>'%'</tt> or <tt>'@'</tt>).</p>
-
-<p>Here is an example of LLVM code to multiply the integer variable
-   '<tt>%X</tt>' by 8:</p>
-
-<p>The easy way:</p>
-
-<div class="doc_code">
-<pre>
-%result = <a href="#i_mul">mul</a> i32 %X, 8
-</pre>
-</div>
-
-<p>After strength reduction:</p>
-
-<div class="doc_code">
-<pre>
-%result = <a href="#i_shl">shl</a> i32 %X, i8 3
-</pre>
-</div>
-
-<p>And the hard way:</p>
-
-<div class="doc_code">
-<pre>
-%0 = <a href="#i_add">add</a> i32 %X, %X           <i>; yields {i32}:%0</i>
-%1 = <a href="#i_add">add</a> i32 %0, %0           <i>; yields {i32}:%1</i>
-%result = <a href="#i_add">add</a> i32 %1, %1
-</pre>
-</div>
-
-<p>This last way of multiplying <tt>%X</tt> by 8 illustrates several important
-   lexical features of LLVM:</p>
-
-<ol>
-  <li>Comments are delimited with a '<tt>;</tt>' and go until the end of
-      line.</li>
-
-  <li>Unnamed temporaries are created when the result of a computation is not
-      assigned to a named value.</li>
-
-  <li>Unnamed temporaries are numbered sequentially</li>
-</ol>
-
-<p>It also shows a convention that we follow in this document.  When
-   demonstrating instructions, we will follow an instruction with a comment that
-   defines the type and name of value produced.  Comments are shown in italic
-   text.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"> <a name="highlevel">High Level Structure</a> </div>
-<!-- *********************************************************************** -->
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"> <a name="modulestructure">Module Structure</a>
-</div>
-
-<div class="doc_text">
-
-<p>LLVM programs are composed of "Module"s, each of which is a translation unit
-   of the input programs.  Each module consists of functions, global variables,
-   and symbol table entries.  Modules may be combined together with the LLVM
-   linker, which merges function (and global variable) definitions, resolves
-   forward declarations, and merges symbol table entries. Here is an example of
-   the "hello world" module:</p>
-
-<div class="doc_code">
-<pre>
-<i>; Declare the string constant as a global constant.</i>
-<a href="#identifiers">@.LC0</a> = <a href="#linkage_internal">internal</a> <a href="#globalvars">constant</a> <a href="#t_array">[13 x i8]</a> c"hello world\0A\00"    <i>; [13 x i8]*</i>
-
-<i>; External declaration of the puts function</i>
-<a href="#functionstructure">declare</a> i32 @puts(i8 *)                                     <i>; i32(i8 *)* </i>
-
-<i>; Definition of main function</i>
-define i32 @main() {                                        <i>; i32()* </i>
-  <i>; Convert [13 x i8]* to i8  *...</i>
-  %cast210 = <a href="#i_getelementptr">getelementptr</a> [13 x i8]* @.LC0, i64 0, i64 0   <i>; i8 *</i>
-
-  <i>; Call puts function to write out the string to stdout.</i>
-  <a href="#i_call">call</a> i32 @puts(i8 * %cast210)                             <i>; i32</i>
-  <a href="#i_ret">ret</a> i32 0<br>}
-
-<i>; Named metadata</i>
-!1 = metadata !{i32 41}
-!foo = !{!1, null}
-</pre>
-</div>
-
-<p>This example is made up of a <a href="#globalvars">global variable</a> named
-   "<tt>.LC0</tt>", an external declaration of the "<tt>puts</tt>" function,
-   a <a href="#functionstructure">function definition</a> for
-   "<tt>main</tt>" and <a href="#namedmetadatastructure">named metadata</a> 
-   "<tt>foo"</tt>.</p>
-
-<p>In general, a module is made up of a list of global values, where both
-   functions and global variables are global values.  Global values are
-   represented by a pointer to a memory location (in this case, a pointer to an
-   array of char, and a pointer to a function), and have one of the
-   following <a href="#linkage">linkage types</a>.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="linkage">Linkage Types</a>
-</div>
-
-<div class="doc_text">
-
-<p>All Global Variables and Functions have one of the following types of
-   linkage:</p>
-
-<dl>
-  <dt><tt><b><a name="linkage_private">private</a></b></tt></dt>
-  <dd>Global values with private linkage are only directly accessible by objects
-      in the current module.  In particular, linking code into a module with an
-      private global value may cause the private to be renamed as necessary to
-      avoid collisions.  Because the symbol is private to the module, all
-      references can be updated. This doesn't show up in any symbol table in the
-      object file.</dd>
-
-  <dt><tt><b><a name="linkage_linker_private">linker_private</a></b></tt></dt>
-  <dd>Similar to private, but the symbol is passed through the assembler and
-      removed by the linker after evaluation.  Note that (unlike private
-      symbols) linker_private symbols are subject to coalescing by the linker:
-      weak symbols get merged and redefinitions are rejected.  However, unlike
-      normal strong symbols, they are removed by the linker from the final
-      linked image (executable or dynamic library).</dd>
-
-  <dt><tt><b><a name="linkage_internal">internal</a></b></tt></dt>
-  <dd>Similar to private, but the value shows as a local symbol
-      (<tt>STB_LOCAL</tt> in the case of ELF) in the object file. This
-      corresponds to the notion of the '<tt>static</tt>' keyword in C.</dd>
-
-  <dt><tt><b><a name="linkage_available_externally">available_externally</a></b></tt></dt>
-  <dd>Globals with "<tt>available_externally</tt>" linkage are never emitted
-      into the object file corresponding to the LLVM module.  They exist to
-      allow inlining and other optimizations to take place given knowledge of
-      the definition of the global, which is known to be somewhere outside the
-      module.  Globals with <tt>available_externally</tt> linkage are allowed to
-      be discarded at will, and are otherwise the same as <tt>linkonce_odr</tt>.
-      This linkage type is only allowed on definitions, not declarations.</dd>
-
-  <dt><tt><b><a name="linkage_linkonce">linkonce</a></b></tt></dt>
-  <dd>Globals with "<tt>linkonce</tt>" linkage are merged with other globals of
-      the same name when linkage occurs.  This can be used to implement
-      some forms of inline functions, templates, or other code which must be
-      generated in each translation unit that uses it, but where the body may
-      be overridden with a more definitive definition later.  Unreferenced
-      <tt>linkonce</tt> globals are allowed to be discarded.  Note that
-      <tt>linkonce</tt> linkage does not actually allow the optimizer to
-      inline the body of this function into callers because it doesn't know if
-      this definition of the function is the definitive definition within the
-      program or whether it will be overridden by a stronger definition.
-      To enable inlining and other optimizations, use "<tt>linkonce_odr</tt>"
-      linkage.</dd>
-
-  <dt><tt><b><a name="linkage_weak">weak</a></b></tt></dt>
-  <dd>"<tt>weak</tt>" linkage has the same merging semantics as
-      <tt>linkonce</tt> linkage, except that unreferenced globals with
-      <tt>weak</tt> linkage may not be discarded.  This is used for globals that
-      are declared "weak" in C source code.</dd>
-
-  <dt><tt><b><a name="linkage_common">common</a></b></tt></dt>
-  <dd>"<tt>common</tt>" linkage is most similar to "<tt>weak</tt>" linkage, but
-      they are used for tentative definitions in C, such as "<tt>int X;</tt>" at
-      global scope.
-      Symbols with "<tt>common</tt>" linkage are merged in the same way as
-      <tt>weak symbols</tt>, and they may not be deleted if unreferenced.
-      <tt>common</tt> symbols may not have an explicit section,
-      must have a zero initializer, and may not be marked '<a
-      href="#globalvars"><tt>constant</tt></a>'.  Functions and aliases may not
-      have common linkage.</dd>
-
-
-  <dt><tt><b><a name="linkage_appending">appending</a></b></tt></dt>
-  <dd>"<tt>appending</tt>" linkage may only be applied to global variables of
-      pointer to array type.  When two global variables with appending linkage
-      are linked together, the two global arrays are appended together.  This is
-      the LLVM, typesafe, equivalent of having the system linker append together
-      "sections" with identical names when .o files are linked.</dd>
-
-  <dt><tt><b><a name="linkage_externweak">extern_weak</a></b></tt></dt>
-  <dd>The semantics of this linkage follow the ELF object file model: the symbol
-      is weak until linked, if not linked, the symbol becomes null instead of
-      being an undefined reference.</dd>
-
-  <dt><tt><b><a name="linkage_linkonce_odr">linkonce_odr</a></b></tt></dt>
-  <dt><tt><b><a name="linkage_weak_odr">weak_odr</a></b></tt></dt>
-  <dd>Some languages allow differing globals to be merged, such as two functions
-      with different semantics.  Other languages, such as <tt>C++</tt>, ensure
-      that only equivalent globals are ever merged (the "one definition rule" -
-      "ODR").  Such languages can use the <tt>linkonce_odr</tt>
-      and <tt>weak_odr</tt> linkage types to indicate that the global will only
-      be merged with equivalent globals.  These linkage types are otherwise the
-      same as their non-<tt>odr</tt> versions.</dd>
-
-  <dt><tt><b><a name="linkage_external">externally visible</a></b></tt>:</dt>
-  <dd>If none of the above identifiers are used, the global is externally
-      visible, meaning that it participates in linkage and can be used to
-      resolve external symbol references.</dd>
-</dl>
-
-<p>The next two types of linkage are targeted for Microsoft Windows platform
-   only. They are designed to support importing (exporting) symbols from (to)
-   DLLs (Dynamic Link Libraries).</p>
-
-<dl>
-  <dt><tt><b><a name="linkage_dllimport">dllimport</a></b></tt></dt>
-  <dd>"<tt>dllimport</tt>" linkage causes the compiler to reference a function
-      or variable via a global pointer to a pointer that is set up by the DLL
-      exporting the symbol. On Microsoft Windows targets, the pointer name is
-      formed by combining <code>__imp_</code> and the function or variable
-      name.</dd>
-
-  <dt><tt><b><a name="linkage_dllexport">dllexport</a></b></tt></dt>
-  <dd>"<tt>dllexport</tt>" linkage causes the compiler to provide a global
-      pointer to a pointer in a DLL, so that it can be referenced with the
-      <tt>dllimport</tt> attribute. On Microsoft Windows targets, the pointer
-      name is formed by combining <code>__imp_</code> and the function or
-      variable name.</dd>
-</dl>
-
-<p>For example, since the "<tt>.LC0</tt>" variable is defined to be internal, if
-   another module defined a "<tt>.LC0</tt>" variable and was linked with this
-   one, one of the two would be renamed, preventing a collision.  Since
-   "<tt>main</tt>" and "<tt>puts</tt>" are external (i.e., lacking any linkage
-   declarations), they are accessible outside of the current module.</p>
-
-<p>It is illegal for a function <i>declaration</i> to have any linkage type
-   other than "externally visible", <tt>dllimport</tt>
-   or <tt>extern_weak</tt>.</p>
-
-<p>Aliases can have only <tt>external</tt>, <tt>internal</tt>, <tt>weak</tt>
-   or <tt>weak_odr</tt> linkages.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="callingconv">Calling Conventions</a>
-</div>
-
-<div class="doc_text">
-
-<p>LLVM <a href="#functionstructure">functions</a>, <a href="#i_call">calls</a>
-   and <a href="#i_invoke">invokes</a> can all have an optional calling
-   convention specified for the call.  The calling convention of any pair of
-   dynamic caller/callee must match, or the behavior of the program is
-   undefined.  The following calling conventions are supported by LLVM, and more
-   may be added in the future:</p>
-
-<dl>
-  <dt><b>"<tt>ccc</tt>" - The C calling convention</b>:</dt>
-  <dd>This calling convention (the default if no other calling convention is
-      specified) matches the target C calling conventions.  This calling
-      convention supports varargs function calls and tolerates some mismatch in
-      the declared prototype and implemented declaration of the function (as
-      does normal C).</dd>
-
-  <dt><b>"<tt>fastcc</tt>" - The fast calling convention</b>:</dt>
-  <dd>This calling convention attempts to make calls as fast as possible
-      (e.g. by passing things in registers).  This calling convention allows the
-      target to use whatever tricks it wants to produce fast code for the
-      target, without having to conform to an externally specified ABI
-      (Application Binary Interface).
-      <a href="CodeGenerator.html#tailcallopt">Tail calls can only be optimized
-      when this convention is used.</a>  This calling convention does not
-      support varargs and requires the prototype of all callees to exactly match
-      the prototype of the function definition.</dd>
-
-  <dt><b>"<tt>coldcc</tt>" - The cold calling convention</b>:</dt>
-  <dd>This calling convention attempts to make code in the caller as efficient
-      as possible under the assumption that the call is not commonly executed.
-      As such, these calls often preserve all registers so that the call does
-      not break any live ranges in the caller side.  This calling convention
-      does not support varargs and requires the prototype of all callees to
-      exactly match the prototype of the function definition.</dd>
-
-  <dt><b>"<tt>cc &lt;<em>n</em>&gt;</tt>" - Numbered convention</b>:</dt>
-  <dd>Any calling convention may be specified by number, allowing
-      target-specific calling conventions to be used.  Target specific calling
-      conventions start at 64.</dd>
-</dl>
-
-<p>More calling conventions can be added/defined on an as-needed basis, to
-   support Pascal conventions or any other well-known target-independent
-   convention.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="visibility">Visibility Styles</a>
-</div>
-
-<div class="doc_text">
-
-<p>All Global Variables and Functions have one of the following visibility
-   styles:</p>
-
-<dl>
-  <dt><b>"<tt>default</tt>" - Default style</b>:</dt>
-  <dd>On targets that use the ELF object file format, default visibility means
-      that the declaration is visible to other modules and, in shared libraries,
-      means that the declared entity may be overridden. On Darwin, default
-      visibility means that the declaration is visible to other modules. Default
-      visibility corresponds to "external linkage" in the language.</dd>
-
-  <dt><b>"<tt>hidden</tt>" - Hidden style</b>:</dt>
-  <dd>Two declarations of an object with hidden visibility refer to the same
-      object if they are in the same shared object. Usually, hidden visibility
-      indicates that the symbol will not be placed into the dynamic symbol
-      table, so no other module (executable or shared library) can reference it
-      directly.</dd>
-
-  <dt><b>"<tt>protected</tt>" - Protected style</b>:</dt>
-  <dd>On ELF, protected visibility indicates that the symbol will be placed in
-      the dynamic symbol table, but that references within the defining module
-      will bind to the local symbol. That is, the symbol cannot be overridden by
-      another module.</dd>
-</dl>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="namedtypes">Named Types</a>
-</div>
-
-<div class="doc_text">
-
-<p>LLVM IR allows you to specify name aliases for certain types.  This can make
-   it easier to read the IR and make the IR more condensed (particularly when
-   recursive types are involved).  An example of a name specification is:</p>
-
-<div class="doc_code">
-<pre>
-%mytype = type { %mytype*, i32 }
-</pre>
-</div>
-
-<p>You may give a name to any <a href="#typesystem">type</a> except
-   "<a href="t_void">void</a>".  Type name aliases may be used anywhere a type
-   is expected with the syntax "%mytype".</p>
-
-<p>Note that type names are aliases for the structural type that they indicate,
-   and that you can therefore specify multiple names for the same type.  This
-   often leads to confusing behavior when dumping out a .ll file.  Since LLVM IR
-   uses structural typing, the name is not part of the type.  When printing out
-   LLVM IR, the printer will pick <em>one name</em> to render all types of a
-   particular shape.  This means that if you have code where two different
-   source types end up having the same LLVM type, that the dumper will sometimes
-   print the "wrong" or unexpected type.  This is an important design point and
-   isn't going to change.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="globalvars">Global Variables</a>
-</div>
-
-<div class="doc_text">
-
-<p>Global variables define regions of memory allocated at compilation time
-   instead of run-time.  Global variables may optionally be initialized, may
-   have an explicit section to be placed in, and may have an optional explicit
-   alignment specified.  A variable may be defined as "thread_local", which
-   means that it will not be shared by threads (each thread will have a
-   separated copy of the variable).  A variable may be defined as a global
-   "constant," which indicates that the contents of the variable
-   will <b>never</b> be modified (enabling better optimization, allowing the
-   global data to be placed in the read-only section of an executable, etc).
-   Note that variables that need runtime initialization cannot be marked
-   "constant" as there is a store to the variable.</p>
-
-<p>LLVM explicitly allows <em>declarations</em> of global variables to be marked
-   constant, even if the final definition of the global is not.  This capability
-   can be used to enable slightly better optimization of the program, but
-   requires the language definition to guarantee that optimizations based on the
-   'constantness' are valid for the translation units that do not include the
-   definition.</p>
-
-<p>As SSA values, global variables define pointer values that are in scope
-   (i.e. they dominate) all basic blocks in the program.  Global variables
-   always define a pointer to their "content" type because they describe a
-   region of memory, and all memory objects in LLVM are accessed through
-   pointers.</p>
-
-<p>A global variable may be declared to reside in a target-specific numbered
-   address space. For targets that support them, address spaces may affect how
-   optimizations are performed and/or what target instructions are used to
-   access the variable. The default address space is zero. The address space
-   qualifier must precede any other attributes.</p>
-
-<p>LLVM allows an explicit section to be specified for globals.  If the target
-   supports it, it will emit globals to the section specified.</p>
-
-<p>An explicit alignment may be specified for a global.  If not present, or if
-   the alignment is set to zero, the alignment of the global is set by the
-   target to whatever it feels convenient.  If an explicit alignment is
-   specified, the global is forced to have at least that much alignment.  All
-   alignments must be a power of 2.</p>
-
-<p>For example, the following defines a global in a numbered address space with
-   an initializer, section, and alignment:</p>
-
-<div class="doc_code">
-<pre>
- at G = addrspace(5) constant float 1.0, section "foo", align 4
-</pre>
-</div>
-
-</div>
-
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="functionstructure">Functions</a>
-</div>
-
-<div class="doc_text">
-
-<p>LLVM function definitions consist of the "<tt>define</tt>" keyord, an
-   optional <a href="#linkage">linkage type</a>, an optional
-   <a href="#visibility">visibility style</a>, an optional
-   <a href="#callingconv">calling convention</a>, a return type, an optional
-   <a href="#paramattrs">parameter attribute</a> for the return type, a function
-   name, a (possibly empty) argument list (each with optional
-   <a href="#paramattrs">parameter attributes</a>), optional
-   <a href="#fnattrs">function attributes</a>, an optional section, an optional
-   alignment, an optional <a href="#gc">garbage collector name</a>, an opening
-   curly brace, a list of basic blocks, and a closing curly brace.</p>
-
-<p>LLVM function declarations consist of the "<tt>declare</tt>" keyword, an
-   optional <a href="#linkage">linkage type</a>, an optional
-   <a href="#visibility">visibility style</a>, an optional
-   <a href="#callingconv">calling convention</a>, a return type, an optional
-   <a href="#paramattrs">parameter attribute</a> for the return type, a function
-   name, a possibly empty list of arguments, an optional alignment, and an
-   optional <a href="#gc">garbage collector name</a>.</p>
-
-<p>A function definition contains a list of basic blocks, forming the CFG
-   (Control Flow Graph) for the function.  Each basic block may optionally start
-   with a label (giving the basic block a symbol table entry), contains a list
-   of instructions, and ends with a <a href="#terminators">terminator</a>
-   instruction (such as a branch or function return).</p>
-
-<p>The first basic block in a function is special in two ways: it is immediately
-   executed on entrance to the function, and it is not allowed to have
-   predecessor basic blocks (i.e. there can not be any branches to the entry
-   block of a function).  Because the block can have no predecessors, it also
-   cannot have any <a href="#i_phi">PHI nodes</a>.</p>
-
-<p>LLVM allows an explicit section to be specified for functions.  If the target
-   supports it, it will emit functions to the section specified.</p>
-
-<p>An explicit alignment may be specified for a function.  If not present, or if
-   the alignment is set to zero, the alignment of the function is set by the
-   target to whatever it feels convenient.  If an explicit alignment is
-   specified, the function is forced to have at least that much alignment.  All
-   alignments must be a power of 2.</p>
-
-<h5>Syntax:</h5>
-<div class="doc_code">
-<pre>
-define [<a href="#linkage">linkage</a>] [<a href="#visibility">visibility</a>]
-       [<a href="#callingconv">cconv</a>] [<a href="#paramattrs">ret attrs</a>]
-       &lt;ResultType&gt; @&lt;FunctionName&gt; ([argument list])
-       [<a href="#fnattrs">fn Attrs</a>] [section "name"] [align N]
-       [<a href="#gc">gc</a>] { ... }
-</pre>
-</div>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="aliasstructure">Aliases</a>
-</div>
-
-<div class="doc_text">
-
-<p>Aliases act as "second name" for the aliasee value (which can be either
-   function, global variable, another alias or bitcast of global value). Aliases
-   may have an optional <a href="#linkage">linkage type</a>, and an
-   optional <a href="#visibility">visibility style</a>.</p>
-
-<h5>Syntax:</h5>
-<div class="doc_code">
-<pre>
-@&lt;Name&gt; = alias [Linkage] [Visibility] &lt;AliaseeTy&gt; @&lt;Aliasee&gt;
-</pre>
-</div>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="namedmetadatastructure">Named Metadata</a>
-</div>
-
-<div class="doc_text">
-
-<p>Named metadata is a collection of metadata. <a href="#metadata">Metadata
-   nodes</a> (but not metadata strings) and null are the only valid operands for
-   a named metadata.</p>
-
-<h5>Syntax:</h5>
-<div class="doc_code">
-<pre>
-!1 = metadata !{metadata !"one"}
-!name = !{null, !1}
-</pre>
-</div>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="paramattrs">Parameter Attributes</a></div>
-
-<div class="doc_text">
-
-<p>The return type and each parameter of a function type may have a set of
-   <i>parameter attributes</i> associated with them. Parameter attributes are
-   used to communicate additional information about the result or parameters of
-   a function. Parameter attributes are considered to be part of the function,
-   not of the function type, so functions with different parameter attributes
-   can have the same function type.</p>
-
-<p>Parameter attributes are simple keywords that follow the type specified. If
-   multiple parameter attributes are needed, they are space separated. For
-   example:</p>
-
-<div class="doc_code">
-<pre>
-declare i32 @printf(i8* noalias nocapture, ...)
-declare i32 @atoi(i8 zeroext)
-declare signext i8 @returns_signed_char()
-</pre>
-</div>
-
-<p>Note that any attributes for the function result (<tt>nounwind</tt>,
-   <tt>readonly</tt>) come immediately after the argument list.</p>
-
-<p>Currently, only the following parameter attributes are defined:</p>
-
-<dl>
-  <dt><tt><b>zeroext</b></tt></dt>
-  <dd>This indicates to the code generator that the parameter or return value
-      should be zero-extended to a 32-bit value by the caller (for a parameter)
-      or the callee (for a return value).</dd>
-
-  <dt><tt><b>signext</b></tt></dt>
-  <dd>This indicates to the code generator that the parameter or return value
-      should be sign-extended to a 32-bit value by the caller (for a parameter)
-      or the callee (for a return value).</dd>
-
-  <dt><tt><b>inreg</b></tt></dt>
-  <dd>This indicates that this parameter or return value should be treated in a
-      special target-dependent fashion during while emitting code for a function
-      call or return (usually, by putting it in a register as opposed to memory,
-      though some targets use it to distinguish between two different kinds of
-      registers).  Use of this attribute is target-specific.</dd>
-
-  <dt><tt><b><a name="byval">byval</a></b></tt></dt>
-  <dd>This indicates that the pointer parameter should really be passed by value
-      to the function.  The attribute implies that a hidden copy of the pointee
-      is made between the caller and the callee, so the callee is unable to
-      modify the value in the callee.  This attribute is only valid on LLVM
-      pointer arguments.  It is generally used to pass structs and arrays by
-      value, but is also valid on pointers to scalars.  The copy is considered
-      to belong to the caller not the callee (for example,
-      <tt><a href="#readonly">readonly</a></tt> functions should not write to
-      <tt>byval</tt> parameters). This is not a valid attribute for return
-      values.  The byval attribute also supports specifying an alignment with
-      the align attribute.  This has a target-specific effect on the code
-      generator that usually indicates a desired alignment for the synthesized
-      stack slot.</dd>
-
-  <dt><tt><b>sret</b></tt></dt>
-  <dd>This indicates that the pointer parameter specifies the address of a
-      structure that is the return value of the function in the source program.
-      This pointer must be guaranteed by the caller to be valid: loads and
-      stores to the structure may be assumed by the callee to not to trap.  This
-      may only be applied to the first parameter. This is not a valid attribute
-      for return values. </dd>
-
-  <dt><tt><b>noalias</b></tt></dt>
-  <dd>This indicates that the pointer does not alias any global or any other
-      parameter.  The caller is responsible for ensuring that this is the
-      case. On a function return value, <tt>noalias</tt> additionally indicates
-      that the pointer does not alias any other pointers visible to the
-      caller. For further details, please see the discussion of the NoAlias
-      response in
-      <a href="http://llvm.org/docs/AliasAnalysis.html#MustMayNo">alias
-      analysis</a>.</dd>
-
-  <dt><tt><b>nocapture</b></tt></dt>
-  <dd>This indicates that the callee does not make any copies of the pointer
-      that outlive the callee itself. This is not a valid attribute for return
-      values.</dd>
-
-  <dt><tt><b>nest</b></tt></dt>
-  <dd>This indicates that the pointer parameter can be excised using the
-      <a href="#int_trampoline">trampoline intrinsics</a>. This is not a valid
-      attribute for return values.</dd>
-</dl>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="gc">Garbage Collector Names</a>
-</div>
-
-<div class="doc_text">
-
-<p>Each function may specify a garbage collector name, which is simply a
-   string:</p>
-
-<div class="doc_code">
-<pre>
-define void @f() gc "name" { ... }
-</pre>
-</div>
-
-<p>The compiler declares the supported values of <i>name</i>. Specifying a
-   collector which will cause the compiler to alter its output in order to
-   support the named garbage collection algorithm.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="fnattrs">Function Attributes</a>
-</div>
-
-<div class="doc_text">
-
-<p>Function attributes are set to communicate additional information about a
-   function. Function attributes are considered to be part of the function, not
-   of the function type, so functions with different parameter attributes can
-   have the same function type.</p>
-
-<p>Function attributes are simple keywords that follow the type specified. If
-   multiple attributes are needed, they are space separated. For example:</p>
-
-<div class="doc_code">
-<pre>
-define void @f() noinline { ... }
-define void @f() alwaysinline { ... }
-define void @f() alwaysinline optsize { ... }
-define void @f() optsize { ... }
-</pre>
-</div>
-
-<dl>
-  <dt><tt><b>alignstack(&lt;<em>n</em>&gt;)</b></tt></dt>
-  <dd>This attribute indicates that, when emitting the prologue and epilogue,
-      the backend should forcibly align the stack pointer. Specify the
-      desired alignment, which must be a power of two, in parentheses.
-
-  <dt><tt><b>alwaysinline</b></tt></dt>
-  <dd>This attribute indicates that the inliner should attempt to inline this
-      function into callers whenever possible, ignoring any active inlining size
-      threshold for this caller.</dd>
-
-  <dt><tt><b>inlinehint</b></tt></dt>
-  <dd>This attribute indicates that the source code contained a hint that inlining
-      this function is desirable (such as the "inline" keyword in C/C++).  It
-      is just a hint; it imposes no requirements on the inliner.</dd>
-
-  <dt><tt><b>noinline</b></tt></dt>
-  <dd>This attribute indicates that the inliner should never inline this
-      function in any situation. This attribute may not be used together with
-      the <tt>alwaysinline</tt> attribute.</dd>
-
-  <dt><tt><b>optsize</b></tt></dt>
-  <dd>This attribute suggests that optimization passes and code generator passes
-      make choices that keep the code size of this function low, and otherwise
-      do optimizations specifically to reduce code size.</dd>
-
-  <dt><tt><b>noreturn</b></tt></dt>
-  <dd>This function attribute indicates that the function never returns
-      normally.  This produces undefined behavior at runtime if the function
-      ever does dynamically return.</dd>
-
-  <dt><tt><b>nounwind</b></tt></dt>
-  <dd>This function attribute indicates that the function never returns with an
-      unwind or exceptional control flow.  If the function does unwind, its
-      runtime behavior is undefined.</dd>
-
-  <dt><tt><b>readnone</b></tt></dt>
-  <dd>This attribute indicates that the function computes its result (or decides
-      to unwind an exception) based strictly on its arguments, without
-      dereferencing any pointer arguments or otherwise accessing any mutable
-      state (e.g. memory, control registers, etc) visible to caller functions.
-      It does not write through any pointer arguments
-      (including <tt><a href="#byval">byval</a></tt> arguments) and never
-      changes any state visible to callers.  This means that it cannot unwind
-      exceptions by calling the <tt>C++</tt> exception throwing methods, but
-      could use the <tt>unwind</tt> instruction.</dd>
-
-  <dt><tt><b><a name="readonly">readonly</a></b></tt></dt>
-  <dd>This attribute indicates that the function does not write through any
-      pointer arguments (including <tt><a href="#byval">byval</a></tt>
-      arguments) or otherwise modify any state (e.g. memory, control registers,
-      etc) visible to caller functions.  It may dereference pointer arguments
-      and read state that may be set in the caller.  A readonly function always
-      returns the same value (or unwinds an exception identically) when called
-      with the same set of arguments and global state.  It cannot unwind an
-      exception by calling the <tt>C++</tt> exception throwing methods, but may
-      use the <tt>unwind</tt> instruction.</dd>
-
-  <dt><tt><b><a name="ssp">ssp</a></b></tt></dt>
-  <dd>This attribute indicates that the function should emit a stack smashing
-      protector. It is in the form of a "canary"&mdash;a random value placed on
-      the stack before the local variables that's checked upon return from the
-      function to see if it has been overwritten. A heuristic is used to
-      determine if a function needs stack protectors or not.<br>
-<br>
-      If a function that has an <tt>ssp</tt> attribute is inlined into a
-      function that doesn't have an <tt>ssp</tt> attribute, then the resulting
-      function will have an <tt>ssp</tt> attribute.</dd>
-
-  <dt><tt><b>sspreq</b></tt></dt>
-  <dd>This attribute indicates that the function should <em>always</em> emit a
-      stack smashing protector. This overrides
-      the <tt><a href="#ssp">ssp</a></tt> function attribute.<br>
-<br>
-      If a function that has an <tt>sspreq</tt> attribute is inlined into a
-      function that doesn't have an <tt>sspreq</tt> attribute or which has
-      an <tt>ssp</tt> attribute, then the resulting function will have
-      an <tt>sspreq</tt> attribute.</dd>
-
-  <dt><tt><b>noredzone</b></tt></dt>
-  <dd>This attribute indicates that the code generator should not use a red
-      zone, even if the target-specific ABI normally permits it.</dd>
-
-  <dt><tt><b>noimplicitfloat</b></tt></dt>
-  <dd>This attributes disables implicit floating point instructions.</dd>
-
-  <dt><tt><b>naked</b></tt></dt>
-  <dd>This attribute disables prologue / epilogue emission for the function.
-      This can have very system-specific consequences.</dd>
-</dl>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="moduleasm">Module-Level Inline Assembly</a>
-</div>
-
-<div class="doc_text">
-
-<p>Modules may contain "module-level inline asm" blocks, which corresponds to
-   the GCC "file scope inline asm" blocks.  These blocks are internally
-   concatenated by LLVM and treated as a single unit, but may be separated in
-   the <tt>.ll</tt> file if desired.  The syntax is very simple:</p>
-
-<div class="doc_code">
-<pre>
-module asm "inline asm code goes here"
-module asm "more can go here"
-</pre>
-</div>
-
-<p>The strings can contain any character by escaping non-printable characters.
-   The escape sequence used is simply "\xx" where "xx" is the two digit hex code
-   for the number.</p>
-
-<p>The inline asm code is simply printed to the machine code .s file when
-   assembly code is generated.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="datalayout">Data Layout</a>
-</div>
-
-<div class="doc_text">
-
-<p>A module may specify a target specific data layout string that specifies how
-   data is to be laid out in memory. The syntax for the data layout is
-   simply:</p>
-
-<div class="doc_code">
-<pre>
-target datalayout = "<i>layout specification</i>"
-</pre>
-</div>
-
-<p>The <i>layout specification</i> consists of a list of specifications
-   separated by the minus sign character ('-').  Each specification starts with
-   a letter and may include other information after the letter to define some
-   aspect of the data layout.  The specifications accepted are as follows:</p>
-
-<dl>
-  <dt><tt>E</tt></dt>
-  <dd>Specifies that the target lays out data in big-endian form. That is, the
-      bits with the most significance have the lowest address location.</dd>
-
-  <dt><tt>e</tt></dt>
-  <dd>Specifies that the target lays out data in little-endian form. That is,
-      the bits with the least significance have the lowest address
-      location.</dd>
-
-  <dt><tt>p:<i>size</i>:<i>abi</i>:<i>pref</i></tt></dt>
-  <dd>This specifies the <i>size</i> of a pointer and its <i>abi</i> and
-      <i>preferred</i> alignments. All sizes are in bits. Specifying
-      the <i>pref</i> alignment is optional. If omitted, the
-      preceding <tt>:</tt> should be omitted too.</dd>
-
-  <dt><tt>i<i>size</i>:<i>abi</i>:<i>pref</i></tt></dt>
-  <dd>This specifies the alignment for an integer type of a given bit
-      <i>size</i>. The value of <i>size</i> must be in the range [1,2^23).</dd>
-
-  <dt><tt>v<i>size</i>:<i>abi</i>:<i>pref</i></tt></dt>
-  <dd>This specifies the alignment for a vector type of a given bit
-      <i>size</i>.</dd>
-
-  <dt><tt>f<i>size</i>:<i>abi</i>:<i>pref</i></tt></dt>
-  <dd>This specifies the alignment for a floating point type of a given bit
-      <i>size</i>. The value of <i>size</i> must be either 32 (float) or 64
-      (double).</dd>
-
-  <dt><tt>a<i>size</i>:<i>abi</i>:<i>pref</i></tt></dt>
-  <dd>This specifies the alignment for an aggregate type of a given bit
-      <i>size</i>.</dd>
-
-  <dt><tt>s<i>size</i>:<i>abi</i>:<i>pref</i></tt></dt>
-  <dd>This specifies the alignment for a stack object of a given bit
-      <i>size</i>.</dd>
-
-  <dt><tt>n<i>size1</i>:<i>size2</i>:<i>size3</i>...</tt></dt>
-  <dd>This specifies a set of native integer widths for the target CPU
-      in bits.  For example, it might contain "n32" for 32-bit PowerPC,
-      "n32:64" for PowerPC 64, or "n8:16:32:64" for X86-64.  Elements of
-      this set are considered to support most general arithmetic
-      operations efficiently.</dd>
-</dl>
-
-<p>When constructing the data layout for a given target, LLVM starts with a
-   default set of specifications which are then (possibly) overriden by the
-   specifications in the <tt>datalayout</tt> keyword. The default specifications
-   are given in this list:</p>
-
-<ul>
-  <li><tt>E</tt> - big endian</li>
-  <li><tt>p:32:64:64</tt> - 32-bit pointers with 64-bit alignment</li>
-  <li><tt>i1:8:8</tt> - i1 is 8-bit (byte) aligned</li>
-  <li><tt>i8:8:8</tt> - i8 is 8-bit (byte) aligned</li>
-  <li><tt>i16:16:16</tt> - i16 is 16-bit aligned</li>
-  <li><tt>i32:32:32</tt> - i32 is 32-bit aligned</li>
-  <li><tt>i64:32:64</tt> - i64 has ABI alignment of 32-bits but preferred
-  alignment of 64-bits</li>
-  <li><tt>f32:32:32</tt> - float is 32-bit aligned</li>
-  <li><tt>f64:64:64</tt> - double is 64-bit aligned</li>
-  <li><tt>v64:64:64</tt> - 64-bit vector is 64-bit aligned</li>
-  <li><tt>v128:128:128</tt> - 128-bit vector is 128-bit aligned</li>
-  <li><tt>a0:0:1</tt> - aggregates are 8-bit aligned</li>
-  <li><tt>s0:64:64</tt> - stack objects are 64-bit aligned</li>
-</ul>
-
-<p>When LLVM is determining the alignment for a given type, it uses the
-   following rules:</p>
-
-<ol>
-  <li>If the type sought is an exact match for one of the specifications, that
-      specification is used.</li>
-
-  <li>If no match is found, and the type sought is an integer type, then the
-      smallest integer type that is larger than the bitwidth of the sought type
-      is used. If none of the specifications are larger than the bitwidth then
-      the the largest integer type is used. For example, given the default
-      specifications above, the i7 type will use the alignment of i8 (next
-      largest) while both i65 and i256 will use the alignment of i64 (largest
-      specified).</li>
-
-  <li>If no match is found, and the type sought is a vector type, then the
-      largest vector type that is smaller than the sought vector type will be
-      used as a fall back.  This happens because &lt;128 x double&gt; can be
-      implemented in terms of 64 &lt;2 x double&gt;, for example.</li>
-</ol>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="pointeraliasing">Pointer Aliasing Rules</a>
-</div>
-
-<div class="doc_text">
-
-<p>Any memory access must be done through a pointer value associated
-with an address range of the memory access, otherwise the behavior
-is undefined. Pointer values are associated with address ranges
-according to the following rules:</p>
-
-<ul>
-  <li>A pointer value formed from a
-      <tt><a href="#i_getelementptr">getelementptr</a></tt> instruction
-      is associated with the addresses associated with the first operand
-      of the <tt>getelementptr</tt>.</li>
-  <li>An address of a global variable is associated with the address
-      range of the variable's storage.</li>
-  <li>The result value of an allocation instruction is associated with
-      the address range of the allocated storage.</li>
-  <li>A null pointer in the default address-space is associated with
-      no address.</li>
-  <li>A pointer value formed by an
-      <tt><a href="#i_inttoptr">inttoptr</a></tt> is associated with all
-      address ranges of all pointer values that contribute (directly or
-      indirectly) to the computation of the pointer's value.</li>
-  <li>The result value of a
-      <tt><a href="#i_bitcast">bitcast</a></tt> is associated with all
-      addresses associated with the operand of the <tt>bitcast</tt>.</li>
-  <li>An integer constant other than zero or a pointer value returned
-      from a function not defined within LLVM may be associated with address
-      ranges allocated through mechanisms other than those provided by
-      LLVM. Such ranges shall not overlap with any ranges of addresses
-      allocated by mechanisms provided by LLVM.</li>
-  </ul>
-
-<p>LLVM IR does not associate types with memory. The result type of a
-<tt><a href="#i_load">load</a></tt> merely indicates the size and
-alignment of the memory from which to load, as well as the
-interpretation of the value. The first operand of a
-<tt><a href="#i_store">store</a></tt> similarly only indicates the size
-and alignment of the store.</p>
-
-<p>Consequently, type-based alias analysis, aka TBAA, aka
-<tt>-fstrict-aliasing</tt>, is not applicable to general unadorned
-LLVM IR. <a href="#metadata">Metadata</a> may be used to encode
-additional information which specialized optimization passes may use
-to implement type-based alias analysis.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"> <a name="typesystem">Type System</a> </div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>The LLVM type system is one of the most important features of the
-   intermediate representation.  Being typed enables a number of optimizations
-   to be performed on the intermediate representation directly, without having
-   to do extra analyses on the side before the transformation.  A strong type
-   system makes it easier to read the generated code and enables novel analyses
-   and transformations that are not feasible to perform on normal three address
-   code representations.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"> <a name="t_classifications">Type
-Classifications</a> </div>
-
-<div class="doc_text">
-
-<p>The types fall into a few useful classifications:</p>
-
-<table border="1" cellspacing="0" cellpadding="4">
-  <tbody>
-    <tr><th>Classification</th><th>Types</th></tr>
-    <tr>
-      <td><a href="#t_integer">integer</a></td>
-      <td><tt>i1, i2, i3, ... i8, ... i16, ... i32, ... i64, ... </tt></td>
-    </tr>
-    <tr>
-      <td><a href="#t_floating">floating point</a></td>
-      <td><tt>float, double, x86_fp80, fp128, ppc_fp128</tt></td>
-    </tr>
-    <tr>
-      <td><a name="t_firstclass">first class</a></td>
-      <td><a href="#t_integer">integer</a>,
-          <a href="#t_floating">floating point</a>,
-          <a href="#t_pointer">pointer</a>,
-          <a href="#t_vector">vector</a>,
-          <a href="#t_struct">structure</a>,
-          <a href="#t_union">union</a>,
-          <a href="#t_array">array</a>,
-          <a href="#t_label">label</a>,
-          <a href="#t_metadata">metadata</a>.
-      </td>
-    </tr>
-    <tr>
-      <td><a href="#t_primitive">primitive</a></td>
-      <td><a href="#t_label">label</a>,
-          <a href="#t_void">void</a>,
-          <a href="#t_floating">floating point</a>,
-          <a href="#t_metadata">metadata</a>.</td>
-    </tr>
-    <tr>
-      <td><a href="#t_derived">derived</a></td>
-      <td><a href="#t_array">array</a>,
-          <a href="#t_function">function</a>,
-          <a href="#t_pointer">pointer</a>,
-          <a href="#t_struct">structure</a>,
-          <a href="#t_pstruct">packed structure</a>,
-          <a href="#t_union">union</a>,
-          <a href="#t_vector">vector</a>,
-          <a href="#t_opaque">opaque</a>.
-      </td>
-    </tr>
-  </tbody>
-</table>
-
-<p>The <a href="#t_firstclass">first class</a> types are perhaps the most
-   important.  Values of these types are the only ones which can be produced by
-   instructions.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"> <a name="t_primitive">Primitive Types</a> </div>
-
-<div class="doc_text">
-
-<p>The primitive types are the fundamental building blocks of the LLVM
-   system.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection"> <a name="t_integer">Integer Type</a> </div>
-
-<div class="doc_text">
-
-<h5>Overview:</h5>
-<p>The integer type is a very simple type that simply specifies an arbitrary
-   bit width for the integer type desired. Any bit width from 1 bit to
-   2<sup>23</sup>-1 (about 8 million) can be specified.</p>
-
-<h5>Syntax:</h5>
-<pre>
-  iN
-</pre>
-
-<p>The number of bits the integer will occupy is specified by the <tt>N</tt>
-   value.</p>
-
-<h5>Examples:</h5>
-<table class="layout">
-  <tr class="layout">
-    <td class="left"><tt>i1</tt></td>
-    <td class="left">a single-bit integer.</td>
-  </tr>
-  <tr class="layout">
-    <td class="left"><tt>i32</tt></td>
-    <td class="left">a 32-bit integer.</td>
-  </tr>
-  <tr class="layout">
-    <td class="left"><tt>i1942652</tt></td>
-    <td class="left">a really big integer of over 1 million bits.</td>
-  </tr>
-</table>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection"> <a name="t_floating">Floating Point Types</a> </div>
-
-<div class="doc_text">
-
-<table>
-  <tbody>
-    <tr><th>Type</th><th>Description</th></tr>
-    <tr><td><tt>float</tt></td><td>32-bit floating point value</td></tr>
-    <tr><td><tt>double</tt></td><td>64-bit floating point value</td></tr>
-    <tr><td><tt>fp128</tt></td><td>128-bit floating point value (112-bit mantissa)</td></tr>
-    <tr><td><tt>x86_fp80</tt></td><td>80-bit floating point value (X87)</td></tr>
-    <tr><td><tt>ppc_fp128</tt></td><td>128-bit floating point value (two 64-bits)</td></tr>
-  </tbody>
-</table>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection"> <a name="t_void">Void Type</a> </div>
-
-<div class="doc_text">
-
-<h5>Overview:</h5>
-<p>The void type does not represent any value and has no size.</p>
-
-<h5>Syntax:</h5>
-<pre>
-  void
-</pre>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection"> <a name="t_label">Label Type</a> </div>
-
-<div class="doc_text">
-
-<h5>Overview:</h5>
-<p>The label type represents code labels.</p>
-
-<h5>Syntax:</h5>
-<pre>
-  label
-</pre>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection"> <a name="t_metadata">Metadata Type</a> </div>
-
-<div class="doc_text">
-
-<h5>Overview:</h5>
-<p>The metadata type represents embedded metadata. No derived types may be
-   created from metadata except for <a href="#t_function">function</a>
-   arguments.
-
-<h5>Syntax:</h5>
-<pre>
-  metadata
-</pre>
-
-</div>
-
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"> <a name="t_derived">Derived Types</a> </div>
-
-<div class="doc_text">
-
-<p>The real power in LLVM comes from the derived types in the system.  This is
-   what allows a programmer to represent arrays, functions, pointers, and other
-   useful types.  Each of these types contain one or more element types which
-   may be a primitive type, or another derived type.  For example, it is
-   possible to have a two dimensional array, using an array as the element type
-   of another array.</p>
-
-   
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection"> <a name="t_aggregate">Aggregate Types</a> </div>
-
-<div class="doc_text">
-
-<p>Aggregate Types are a subset of derived types that can contain multiple
-  member types. <a href="#t_array">Arrays</a>,
-  <a href="#t_struct">structs</a>, <a href="#t_vector">vectors</a> and
-  <a href="#t_union">unions</a> are aggregate types.</p>
-
-</div>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection"> <a name="t_array">Array Type</a> </div>
-
-<div class="doc_text">
-
-<h5>Overview:</h5>
-<p>The array type is a very simple derived type that arranges elements
-   sequentially in memory.  The array type requires a size (number of elements)
-   and an underlying data type.</p>
-
-<h5>Syntax:</h5>
-<pre>
-  [&lt;# elements&gt; x &lt;elementtype&gt;]
-</pre>
-
-<p>The number of elements is a constant integer value; <tt>elementtype</tt> may
-   be any type with a size.</p>
-
-<h5>Examples:</h5>
-<table class="layout">
-  <tr class="layout">
-    <td class="left"><tt>[40 x i32]</tt></td>
-    <td class="left">Array of 40 32-bit integer values.</td>
-  </tr>
-  <tr class="layout">
-    <td class="left"><tt>[41 x i32]</tt></td>
-    <td class="left">Array of 41 32-bit integer values.</td>
-  </tr>
-  <tr class="layout">
-    <td class="left"><tt>[4 x i8]</tt></td>
-    <td class="left">Array of 4 8-bit integer values.</td>
-  </tr>
-</table>
-<p>Here are some examples of multidimensional arrays:</p>
-<table class="layout">
-  <tr class="layout">
-    <td class="left"><tt>[3 x [4 x i32]]</tt></td>
-    <td class="left">3x4 array of 32-bit integer values.</td>
-  </tr>
-  <tr class="layout">
-    <td class="left"><tt>[12 x [10 x float]]</tt></td>
-    <td class="left">12x10 array of single precision floating point values.</td>
-  </tr>
-  <tr class="layout">
-    <td class="left"><tt>[2 x [3 x [4 x i16]]]</tt></td>
-    <td class="left">2x3x4 array of 16-bit integer  values.</td>
-  </tr>
-</table>
-
-<p>There is no restriction on indexing beyond the end of the array implied by
-   a static type (though there are restrictions on indexing beyond the bounds
-   of an allocated object in some cases). This means that single-dimension
-   'variable sized array' addressing can be implemented in LLVM with a zero
-   length array type. An implementation of 'pascal style arrays' in LLVM could
-   use the type "<tt>{ i32, [0 x float]}</tt>", for example.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection"> <a name="t_function">Function Type</a> </div>
-
-<div class="doc_text">
-
-<h5>Overview:</h5>
-<p>The function type can be thought of as a function signature.  It consists of
-   a return type and a list of formal parameter types. The return type of a
-   function type is a scalar type, a void type, a struct type, or a union
-   type.  If the return type is a struct type then all struct elements must be
-   of first class types, and the struct must have at least one element.</p>
-
-<h5>Syntax:</h5>
-<pre>
-  &lt;returntype&gt; (&lt;parameter list&gt;)
-</pre>
-
-<p>...where '<tt>&lt;parameter list&gt;</tt>' is a comma-separated list of type
-   specifiers.  Optionally, the parameter list may include a type <tt>...</tt>,
-   which indicates that the function takes a variable number of arguments.
-   Variable argument functions can access their arguments with
-   the <a href="#int_varargs">variable argument handling intrinsic</a>
-   functions.  '<tt>&lt;returntype&gt;</tt>' is a any type except
-   <a href="#t_label">label</a>.</p>
-
-<h5>Examples:</h5>
-<table class="layout">
-  <tr class="layout">
-    <td class="left"><tt>i32 (i32)</tt></td>
-    <td class="left">function taking an <tt>i32</tt>, returning an <tt>i32</tt>
-    </td>
-  </tr><tr class="layout">
-    <td class="left"><tt>float&nbsp;(i16&nbsp;signext,&nbsp;i32&nbsp;*)&nbsp;*
-    </tt></td>
-    <td class="left"><a href="#t_pointer">Pointer</a> to a function that takes
-      an <tt>i16</tt> that should be sign extended and a
-      <a href="#t_pointer">pointer</a> to <tt>i32</tt>, returning
-      <tt>float</tt>.
-    </td>
-  </tr><tr class="layout">
-    <td class="left"><tt>i32 (i8*, ...)</tt></td>
-    <td class="left">A vararg function that takes at least one
-      <a href="#t_pointer">pointer</a> to <tt>i8 </tt> (char in C),
-      which returns an integer.  This is the signature for <tt>printf</tt> in
-      LLVM.
-    </td>
-  </tr><tr class="layout">
-    <td class="left"><tt>{i32, i32} (i32)</tt></td>
-    <td class="left">A function taking an <tt>i32</tt>, returning a
-        <a href="#t_struct">structure</a> containing two <tt>i32</tt> values
-    </td>
-  </tr>
-</table>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection"> <a name="t_struct">Structure Type</a> </div>
-
-<div class="doc_text">
-
-<h5>Overview:</h5>
-<p>The structure type is used to represent a collection of data members together
-   in memory.  The packing of the field types is defined to match the ABI of the
-   underlying processor.  The elements of a structure may be any type that has a
-   size.</p>
-
-<p>Structures in memory are accessed using '<tt><a href="#i_load">load</a></tt>'
-   and '<tt><a href="#i_store">store</a></tt>' by getting a pointer to a field
-   with the '<tt><a href="#i_getelementptr">getelementptr</a></tt>' instruction.
-   Structures in registers are accessed using the
-   '<tt><a href="#i_extractvalue">extractvalue</a></tt>' and
-   '<tt><a href="#i_insertvalue">insertvalue</a></tt>' instructions.</p>
-<h5>Syntax:</h5>
-<pre>
-  { &lt;type list&gt; }
-</pre>
-
-<h5>Examples:</h5>
-<table class="layout">
-  <tr class="layout">
-    <td class="left"><tt>{ i32, i32, i32 }</tt></td>
-    <td class="left">A triple of three <tt>i32</tt> values</td>
-  </tr><tr class="layout">
-    <td class="left"><tt>{&nbsp;float,&nbsp;i32&nbsp;(i32)&nbsp;*&nbsp;}</tt></td>
-    <td class="left">A pair, where the first element is a <tt>float</tt> and the
-      second element is a <a href="#t_pointer">pointer</a> to a
-      <a href="#t_function">function</a> that takes an <tt>i32</tt>, returning
-      an <tt>i32</tt>.</td>
-  </tr>
-</table>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection"> <a name="t_pstruct">Packed Structure Type</a>
-</div>
-
-<div class="doc_text">
-
-<h5>Overview:</h5>
-<p>The packed structure type is used to represent a collection of data members
-   together in memory.  There is no padding between fields.  Further, the
-   alignment of a packed structure is 1 byte.  The elements of a packed
-   structure may be any type that has a size.</p>
-
-<p>Structures are accessed using '<tt><a href="#i_load">load</a></tt> and
-   '<tt><a href="#i_store">store</a></tt>' by getting a pointer to a field with
-   the '<tt><a href="#i_getelementptr">getelementptr</a></tt>' instruction.</p>
-
-<h5>Syntax:</h5>
-<pre>
-  &lt; { &lt;type list&gt; } &gt;
-</pre>
-
-<h5>Examples:</h5>
-<table class="layout">
-  <tr class="layout">
-    <td class="left"><tt>&lt; { i32, i32, i32 } &gt;</tt></td>
-    <td class="left">A triple of three <tt>i32</tt> values</td>
-  </tr><tr class="layout">
-  <td class="left">
-<tt>&lt;&nbsp;{&nbsp;float,&nbsp;i32&nbsp;(i32)*&nbsp;}&nbsp;&gt;</tt></td>
-    <td class="left">A pair, where the first element is a <tt>float</tt> and the
-      second element is a <a href="#t_pointer">pointer</a> to a
-      <a href="#t_function">function</a> that takes an <tt>i32</tt>, returning
-      an <tt>i32</tt>.</td>
-  </tr>
-</table>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection"> <a name="t_union">Union Type</a> </div>
-
-<div class="doc_text">
-
-<h5>Overview:</h5>
-<p>A union type describes an object with size and alignment suitable for
-   an object of any one of a given set of types (also known as an "untagged"
-   union). It is similar in concept and usage to a
-   <a href="#t_struct">struct</a>, except that all members of the union
-   have an offset of zero. The elements of a union may be any type that has a
-   size. Unions must have at least one member - empty unions are not allowed.
-   </p>
-
-<p>The size of the union as a whole will be the size of its largest member,
-   and the alignment requirements of the union as a whole will be the largest
-   alignment requirement of any member.</p>
-
-<p>Unions members are accessed using '<tt><a href="#i_load">load</a></tt> and
-   '<tt><a href="#i_store">store</a></tt>' by getting a pointer to a field with
-   the '<tt><a href="#i_getelementptr">getelementptr</a></tt>' instruction.
-   Since all members are at offset zero, the getelementptr instruction does
-   not affect the address, only the type of the resulting pointer.</p>
-
-<h5>Syntax:</h5>
-<pre>
-  union { &lt;type list&gt; }
-</pre>
-
-<h5>Examples:</h5>
-<table class="layout">
-  <tr class="layout">
-    <td class="left"><tt>union { i32, i32*, float }</tt></td>
-    <td class="left">A union of three types: an <tt>i32</tt>, a pointer to
-      an <tt>i32</tt>, and a <tt>float</tt>.</td>
-  </tr><tr class="layout">
-    <td class="left">
-      <tt>union {&nbsp;float,&nbsp;i32&nbsp;(i32)&nbsp;*&nbsp;}</tt></td>
-    <td class="left">A union, where the first element is a <tt>float</tt> and the
-      second element is a <a href="#t_pointer">pointer</a> to a
-      <a href="#t_function">function</a> that takes an <tt>i32</tt>, returning
-      an <tt>i32</tt>.</td>
-  </tr>
-</table>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection"> <a name="t_pointer">Pointer Type</a> </div>
-
-<div class="doc_text">
-
-<h5>Overview:</h5>
-<p>As in many languages, the pointer type represents a pointer or reference to
-   another object, which must live in memory. Pointer types may have an optional
-   address space attribute defining the target-specific numbered address space
-   where the pointed-to object resides. The default address space is zero.</p>
-
-<p>Note that LLVM does not permit pointers to void (<tt>void*</tt>) nor does it
-   permit pointers to labels (<tt>label*</tt>).  Use <tt>i8*</tt> instead.</p>
-
-<h5>Syntax:</h5>
-<pre>
-  &lt;type&gt; *
-</pre>
-
-<h5>Examples:</h5>
-<table class="layout">
-  <tr class="layout">
-    <td class="left"><tt>[4 x i32]*</tt></td>
-    <td class="left">A <a href="#t_pointer">pointer</a> to <a
-                    href="#t_array">array</a> of four <tt>i32</tt> values.</td>
-  </tr>
-  <tr class="layout">
-    <td class="left"><tt>i32 (i32 *) *</tt></td>
-    <td class="left"> A <a href="#t_pointer">pointer</a> to a <a
-      href="#t_function">function</a> that takes an <tt>i32*</tt>, returning an
-      <tt>i32</tt>.</td>
-  </tr>
-  <tr class="layout">
-    <td class="left"><tt>i32 addrspace(5)*</tt></td>
-    <td class="left">A <a href="#t_pointer">pointer</a> to an <tt>i32</tt> value
-     that resides in address space #5.</td>
-  </tr>
-</table>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection"> <a name="t_vector">Vector Type</a> </div>
-
-<div class="doc_text">
-
-<h5>Overview:</h5>
-<p>A vector type is a simple derived type that represents a vector of elements.
-   Vector types are used when multiple primitive data are operated in parallel
-   using a single instruction (SIMD).  A vector type requires a size (number of
-   elements) and an underlying primitive data type.  Vector types are considered
-   <a href="#t_firstclass">first class</a>.</p>
-
-<h5>Syntax:</h5>
-<pre>
-  &lt; &lt;# elements&gt; x &lt;elementtype&gt; &gt;
-</pre>
-
-<p>The number of elements is a constant integer value; elementtype may be any
-   integer or floating point type.</p>
-
-<h5>Examples:</h5>
-<table class="layout">
-  <tr class="layout">
-    <td class="left"><tt>&lt;4 x i32&gt;</tt></td>
-    <td class="left">Vector of 4 32-bit integer values.</td>
-  </tr>
-  <tr class="layout">
-    <td class="left"><tt>&lt;8 x float&gt;</tt></td>
-    <td class="left">Vector of 8 32-bit floating-point values.</td>
-  </tr>
-  <tr class="layout">
-    <td class="left"><tt>&lt;2 x i64&gt;</tt></td>
-    <td class="left">Vector of 2 64-bit integer values.</td>
-  </tr>
-</table>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection"> <a name="t_opaque">Opaque Type</a> </div>
-<div class="doc_text">
-
-<h5>Overview:</h5>
-<p>Opaque types are used to represent unknown types in the system.  This
-   corresponds (for example) to the C notion of a forward declared structure
-   type.  In LLVM, opaque types can eventually be resolved to any type (not just
-   a structure type).</p>
-
-<h5>Syntax:</h5>
-<pre>
-  opaque
-</pre>
-
-<h5>Examples:</h5>
-<table class="layout">
-  <tr class="layout">
-    <td class="left"><tt>opaque</tt></td>
-    <td class="left">An opaque type.</td>
-  </tr>
-</table>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="t_uprefs">Type Up-references</a>
-</div>
-
-<div class="doc_text">
-
-<h5>Overview:</h5>
-<p>An "up reference" allows you to refer to a lexically enclosing type without
-   requiring it to have a name. For instance, a structure declaration may
-   contain a pointer to any of the types it is lexically a member of.  Example
-   of up references (with their equivalent as named type declarations)
-   include:</p>
-
-<pre>
-   { \2 * }                %x = type { %x* }
-   { \2 }*                 %y = type { %y }*
-   \1*                     %z = type %z*
-</pre>
-
-<p>An up reference is needed by the asmprinter for printing out cyclic types
-   when there is no declared name for a type in the cycle.  Because the
-   asmprinter does not want to print out an infinite type string, it needs a
-   syntax to handle recursive types that have no names (all names are optional
-   in llvm IR).</p>
-
-<h5>Syntax:</h5>
-<pre>
-   \&lt;level&gt;
-</pre>
-
-<p>The level is the count of the lexical type that is being referred to.</p>
-
-<h5>Examples:</h5>
-<table class="layout">
-  <tr class="layout">
-    <td class="left"><tt>\1*</tt></td>
-    <td class="left">Self-referential pointer.</td>
-  </tr>
-  <tr class="layout">
-    <td class="left"><tt>{ { \3*, i8 }, i32 }</tt></td>
-    <td class="left">Recursive structure where the upref refers to the out-most
-                     structure.</td>
-  </tr>
-</table>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"> <a name="constants">Constants</a> </div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>LLVM has several different basic types of constants.  This section describes
-   them all and their syntax.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="simpleconstants">Simple Constants</a></div>
-
-<div class="doc_text">
-
-<dl>
-  <dt><b>Boolean constants</b></dt>
-  <dd>The two strings '<tt>true</tt>' and '<tt>false</tt>' are both valid
-      constants of the <tt><a href="#t_integer">i1</a></tt> type.</dd>
-
-  <dt><b>Integer constants</b></dt>
-  <dd>Standard integers (such as '4') are constants of
-      the <a href="#t_integer">integer</a> type.  Negative numbers may be used
-      with integer types.</dd>
-
-  <dt><b>Floating point constants</b></dt>
-  <dd>Floating point constants use standard decimal notation (e.g. 123.421),
-      exponential notation (e.g. 1.23421e+2), or a more precise hexadecimal
-      notation (see below).  The assembler requires the exact decimal value of a
-      floating-point constant.  For example, the assembler accepts 1.25 but
-      rejects 1.3 because 1.3 is a repeating decimal in binary.  Floating point
-      constants must have a <a href="#t_floating">floating point</a> type. </dd>
-
-  <dt><b>Null pointer constants</b></dt>
-  <dd>The identifier '<tt>null</tt>' is recognized as a null pointer constant
-      and must be of <a href="#t_pointer">pointer type</a>.</dd>
-</dl>
-
-<p>The one non-intuitive notation for constants is the hexadecimal form of
-   floating point constants.  For example, the form '<tt>double
-   0x432ff973cafa8000</tt>' is equivalent to (but harder to read than)
-   '<tt>double 4.5e+15</tt>'.  The only time hexadecimal floating point
-   constants are required (and the only time that they are generated by the
-   disassembler) is when a floating point constant must be emitted but it cannot
-   be represented as a decimal floating point number in a reasonable number of
-   digits.  For example, NaN's, infinities, and other special values are
-   represented in their IEEE hexadecimal format so that assembly and disassembly
-   do not cause any bits to change in the constants.</p>
-
-<p>When using the hexadecimal form, constants of types float and double are
-   represented using the 16-digit form shown above (which matches the IEEE754
-   representation for double); float values must, however, be exactly
-   representable as IEE754 single precision.  Hexadecimal format is always used
-   for long double, and there are three forms of long double.  The 80-bit format
-   used by x86 is represented as <tt>0xK</tt> followed by 20 hexadecimal digits.
-   The 128-bit format used by PowerPC (two adjacent doubles) is represented
-   by <tt>0xM</tt> followed by 32 hexadecimal digits.  The IEEE 128-bit format
-   is represented by <tt>0xL</tt> followed by 32 hexadecimal digits; no
-   currently supported target uses this format.  Long doubles will only work if
-   they match the long double format on your target.  All hexadecimal formats
-   are big-endian (sign bit at the left).</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-<a name="aggregateconstants"></a> <!-- old anchor -->
-<a name="complexconstants">Complex Constants</a>
-</div>
-
-<div class="doc_text">
-
-<p>Complex constants are a (potentially recursive) combination of simple
-   constants and smaller complex constants.</p>
-
-<dl>
-  <dt><b>Structure constants</b></dt>
-  <dd>Structure constants are represented with notation similar to structure
-      type definitions (a comma separated list of elements, surrounded by braces
-      (<tt>{}</tt>)).  For example: "<tt>{ i32 4, float 17.0, i32* @G }</tt>",
-      where "<tt>@G</tt>" is declared as "<tt>@G = external global i32</tt>".
-      Structure constants must have <a href="#t_struct">structure type</a>, and
-      the number and types of elements must match those specified by the
-      type.</dd>
-
-  <dt><b>Union constants</b></dt>
-  <dd>Union constants are represented with notation similar to a structure with
-      a single element - that is, a single typed element surrounded
-      by braces (<tt>{}</tt>)).  For example: "<tt>{ i32 4 }</tt>".  The
-      <a href="#t_union">union type</a> can be initialized with a single-element
-      struct as long as the type of the struct element matches the type of
-      one of the union members.</dd>
-
-  <dt><b>Array constants</b></dt>
-  <dd>Array constants are represented with notation similar to array type
-     definitions (a comma separated list of elements, surrounded by square
-     brackets (<tt>[]</tt>)).  For example: "<tt>[ i32 42, i32 11, i32 74
-     ]</tt>".  Array constants must have <a href="#t_array">array type</a>, and
-     the number and types of elements must match those specified by the
-     type.</dd>
-
-  <dt><b>Vector constants</b></dt>
-  <dd>Vector constants are represented with notation similar to vector type
-      definitions (a comma separated list of elements, surrounded by
-      less-than/greater-than's (<tt>&lt;&gt;</tt>)).  For example: "<tt>&lt; i32
-      42, i32 11, i32 74, i32 100 &gt;</tt>".  Vector constants must
-      have <a href="#t_vector">vector type</a>, and the number and types of
-      elements must match those specified by the type.</dd>
-
-  <dt><b>Zero initialization</b></dt>
-  <dd>The string '<tt>zeroinitializer</tt>' can be used to zero initialize a
-      value to zero of <em>any</em> type, including scalar and
-      <a href="#t_aggregate">aggregate</a> types.
-      This is often used to avoid having to print large zero initializers
-      (e.g. for large arrays) and is always exactly equivalent to using explicit
-      zero initializers.</dd>
-
-  <dt><b>Metadata node</b></dt>
-  <dd>A metadata node is a structure-like constant with
-      <a href="#t_metadata">metadata type</a>.  For example: "<tt>metadata !{
-      i32 0, metadata !"test" }</tt>".  Unlike other constants that are meant to
-      be interpreted as part of the instruction stream, metadata is a place to
-      attach additional information such as debug info.</dd>
-</dl>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="globalconstants">Global Variable and Function Addresses</a>
-</div>
-
-<div class="doc_text">
-
-<p>The addresses of <a href="#globalvars">global variables</a>
-   and <a href="#functionstructure">functions</a> are always implicitly valid
-   (link-time) constants.  These constants are explicitly referenced when
-   the <a href="#identifiers">identifier for the global</a> is used and always
-   have <a href="#t_pointer">pointer</a> type. For example, the following is a
-   legal LLVM file:</p>
-
-<div class="doc_code">
-<pre>
- at X = global i32 17
- at Y = global i32 42
- at Z = global [2 x i32*] [ i32* @X, i32* @Y ]
-</pre>
-</div>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="undefvalues">Undefined Values</a></div>
-<div class="doc_text">
-
-<p>The string '<tt>undef</tt>' can be used anywhere a constant is expected, and
-   indicates that the user of the value may receive an unspecified bit-pattern.
-   Undefined values may be of any type (other than label or void) and be used
-   anywhere a constant is permitted.</p>
-
-<p>Undefined values are useful because they indicate to the compiler that the
-   program is well defined no matter what value is used.  This gives the
-   compiler more freedom to optimize.  Here are some examples of (potentially
-   surprising) transformations that are valid (in pseudo IR):</p>
-
-
-<div class="doc_code">
-<pre>
-  %A = add %X, undef
-  %B = sub %X, undef
-  %C = xor %X, undef
-Safe:
-  %A = undef
-  %B = undef
-  %C = undef
-</pre>
-</div>
-
-<p>This is safe because all of the output bits are affected by the undef bits.
-Any output bit can have a zero or one depending on the input bits.</p>
-
-<div class="doc_code">
-<pre>
-  %A = or %X, undef
-  %B = and %X, undef
-Safe:
-  %A = -1
-  %B = 0
-Unsafe:
-  %A = undef
-  %B = undef
-</pre>
-</div>
-
-<p>These logical operations have bits that are not always affected by the input.
-For example, if "%X" has a zero bit, then the output of the 'and' operation will
-always be a zero, no matter what the corresponding bit from the undef is.  As
-such, it is unsafe to optimize or assume that the result of the and is undef.
-However, it is safe to assume that all bits of the undef could be 0, and
-optimize the and to 0.  Likewise, it is safe to assume that all the bits of
-the undef operand to the or could be set, allowing the or to be folded to
--1.</p>
-
-<div class="doc_code">
-<pre>
-  %A = select undef, %X, %Y
-  %B = select undef, 42, %Y
-  %C = select %X, %Y, undef
-Safe:
-  %A = %X     (or %Y)
-  %B = 42     (or %Y)
-  %C = %Y
-Unsafe:
-  %A = undef
-  %B = undef
-  %C = undef
-</pre>
-</div>
-
-<p>This set of examples show that undefined select (and conditional branch)
-conditions can go "either way" but they have to come from one of the two
-operands.  In the %A example, if %X and %Y were both known to have a clear low
-bit, then %A would have to have a cleared low bit.  However, in the %C example,
-the optimizer is allowed to assume that the undef operand could be the same as
-%Y, allowing the whole select to be eliminated.</p>
-
-
-<div class="doc_code">
-<pre>
-  %A = xor undef, undef
-
-  %B = undef
-  %C = xor %B, %B
-
-  %D = undef
-  %E = icmp lt %D, 4
-  %F = icmp gte %D, 4
-
-Safe:
-  %A = undef
-  %B = undef
-  %C = undef
-  %D = undef
-  %E = undef
-  %F = undef
-</pre>
-</div>
-
-<p>This example points out that two undef operands are not necessarily the same.
-This can be surprising to people (and also matches C semantics) where they
-assume that "X^X" is always zero, even if X is undef.  This isn't true for a
-number of reasons, but the short answer is that an undef "variable" can
-arbitrarily change its value over its "live range".  This is true because the
-"variable" doesn't actually <em>have a live range</em>.  Instead, the value is
-logically read from arbitrary registers that happen to be around when needed,
-so the value is not necessarily consistent over time.  In fact, %A and %C need
-to have the same semantics or the core LLVM "replace all uses with" concept
-would not hold.</p>
-
-<div class="doc_code">
-<pre>
-  %A = fdiv undef, %X
-  %B = fdiv %X, undef
-Safe:
-  %A = undef
-b: unreachable
-</pre>
-</div>
-
-<p>These examples show the crucial difference between an <em>undefined
-value</em> and <em>undefined behavior</em>.  An undefined value (like undef) is
-allowed to have an arbitrary bit-pattern.  This means that the %A operation
-can be constant folded to undef because the undef could be an SNaN, and fdiv is
-not (currently) defined on SNaN's.  However, in the second example, we can make
-a more aggressive assumption: because the undef is allowed to be an arbitrary
-value, we are allowed to assume that it could be zero.  Since a divide by zero
-has <em>undefined behavior</em>, we are allowed to assume that the operation
-does not execute at all.  This allows us to delete the divide and all code after
-it: since the undefined operation "can't happen", the optimizer can assume that
-it occurs in dead code.
-</p>
-
-<div class="doc_code">
-<pre>
-a:  store undef -> %X
-b:  store %X -> undef
-Safe:
-a: &lt;deleted&gt;
-b: unreachable
-</pre>
-</div>
-
-<p>These examples reiterate the fdiv example: a store "of" an undefined value
-can be assumed to not have any effect: we can assume that the value is
-overwritten with bits that happen to match what was already there.  However, a
-store "to" an undefined location could clobber arbitrary memory, therefore, it
-has undefined behavior.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="blockaddress">Addresses of Basic
-    Blocks</a></div>
-<div class="doc_text">
-
-<p><b><tt>blockaddress(@function, %block)</tt></b></p>
-
-<p>The '<tt>blockaddress</tt>' constant computes the address of the specified
-   basic block in the specified function, and always has an i8* type.  Taking
-   the address of the entry block is illegal.</p>
-
-<p>This value only has defined behavior when used as an operand to the
-   '<a href="#i_indirectbr"><tt>indirectbr</tt></a>' instruction or for comparisons
-   against null.  Pointer equality tests between labels addresses is undefined
-   behavior - though, again, comparison against null is ok, and no label is
-   equal to the null pointer.  This may also be passed around as an opaque
-   pointer sized value as long as the bits are not inspected.  This allows
-   <tt>ptrtoint</tt> and arithmetic to be performed on these values so long as
-   the original value is reconstituted before the <tt>indirectbr</tt>.</p>
-
-<p>Finally, some targets may provide defined semantics when
-   using the value as the operand to an inline assembly, but that is target
-   specific.
-   </p>
-
-</div>
-
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="constantexprs">Constant Expressions</a>
-</div>
-
-<div class="doc_text">
-
-<p>Constant expressions are used to allow expressions involving other constants
-   to be used as constants.  Constant expressions may be of
-   any <a href="#t_firstclass">first class</a> type and may involve any LLVM
-   operation that does not have side effects (e.g. load and call are not
-   supported).  The following is the syntax for constant expressions:</p>
-
-<dl>
-  <dt><b><tt>trunc ( CST to TYPE )</tt></b></dt>
-  <dd>Truncate a constant to another type. The bit size of CST must be larger
-      than the bit size of TYPE. Both types must be integers.</dd>
-
-  <dt><b><tt>zext ( CST to TYPE )</tt></b></dt>
-  <dd>Zero extend a constant to another type. The bit size of CST must be
-      smaller or equal to the bit size of TYPE.  Both types must be
-      integers.</dd>
-
-  <dt><b><tt>sext ( CST to TYPE )</tt></b></dt>
-  <dd>Sign extend a constant to another type. The bit size of CST must be
-      smaller or equal to the bit size of TYPE.  Both types must be
-      integers.</dd>
-
-  <dt><b><tt>fptrunc ( CST to TYPE )</tt></b></dt>
-  <dd>Truncate a floating point constant to another floating point type. The
-      size of CST must be larger than the size of TYPE. Both types must be
-      floating point.</dd>
-
-  <dt><b><tt>fpext ( CST to TYPE )</tt></b></dt>
-  <dd>Floating point extend a constant to another type. The size of CST must be
-      smaller or equal to the size of TYPE. Both types must be floating
-      point.</dd>
-
-  <dt><b><tt>fptoui ( CST to TYPE )</tt></b></dt>
-  <dd>Convert a floating point constant to the corresponding unsigned integer
-      constant. TYPE must be a scalar or vector integer type. CST must be of
-      scalar or vector floating point type. Both CST and TYPE must be scalars,
-      or vectors of the same number of elements. If the value won't fit in the
-      integer type, the results are undefined.</dd>
-
-  <dt><b><tt>fptosi ( CST to TYPE )</tt></b></dt>
-  <dd>Convert a floating point constant to the corresponding signed integer
-      constant.  TYPE must be a scalar or vector integer type. CST must be of
-      scalar or vector floating point type. Both CST and TYPE must be scalars,
-      or vectors of the same number of elements. If the value won't fit in the
-      integer type, the results are undefined.</dd>
-
-  <dt><b><tt>uitofp ( CST to TYPE )</tt></b></dt>
-  <dd>Convert an unsigned integer constant to the corresponding floating point
-      constant. TYPE must be a scalar or vector floating point type. CST must be
-      of scalar or vector integer type. Both CST and TYPE must be scalars, or
-      vectors of the same number of elements. If the value won't fit in the
-      floating point type, the results are undefined.</dd>
-
-  <dt><b><tt>sitofp ( CST to TYPE )</tt></b></dt>
-  <dd>Convert a signed integer constant to the corresponding floating point
-      constant. TYPE must be a scalar or vector floating point type. CST must be
-      of scalar or vector integer type. Both CST and TYPE must be scalars, or
-      vectors of the same number of elements. If the value won't fit in the
-      floating point type, the results are undefined.</dd>
-
-  <dt><b><tt>ptrtoint ( CST to TYPE )</tt></b></dt>
-  <dd>Convert a pointer typed constant to the corresponding integer constant
-      <tt>TYPE</tt> must be an integer type. <tt>CST</tt> must be of pointer
-      type. The <tt>CST</tt> value is zero extended, truncated, or unchanged to
-      make it fit in <tt>TYPE</tt>.</dd>
-
-  <dt><b><tt>inttoptr ( CST to TYPE )</tt></b></dt>
-  <dd>Convert a integer constant to a pointer constant.  TYPE must be a pointer
-      type.  CST must be of integer type. The CST value is zero extended,
-      truncated, or unchanged to make it fit in a pointer size. This one is
-      <i>really</i> dangerous!</dd>
-
-  <dt><b><tt>bitcast ( CST to TYPE )</tt></b></dt>
-  <dd>Convert a constant, CST, to another TYPE. The constraints of the operands
-      are the same as those for the <a href="#i_bitcast">bitcast
-      instruction</a>.</dd>
-
-  <dt><b><tt>getelementptr ( CSTPTR, IDX0, IDX1, ... )</tt></b></dt>
-  <dt><b><tt>getelementptr inbounds ( CSTPTR, IDX0, IDX1, ... )</tt></b></dt>
-  <dd>Perform the <a href="#i_getelementptr">getelementptr operation</a> on
-      constants.  As with the <a href="#i_getelementptr">getelementptr</a>
-      instruction, the index list may have zero or more indexes, which are
-      required to make sense for the type of "CSTPTR".</dd>
-
-  <dt><b><tt>select ( COND, VAL1, VAL2 )</tt></b></dt>
-  <dd>Perform the <a href="#i_select">select operation</a> on constants.</dd>
-
-  <dt><b><tt>icmp COND ( VAL1, VAL2 )</tt></b></dt>
-  <dd>Performs the <a href="#i_icmp">icmp operation</a> on constants.</dd>
-
-  <dt><b><tt>fcmp COND ( VAL1, VAL2 )</tt></b></dt>
-  <dd>Performs the <a href="#i_fcmp">fcmp operation</a> on constants.</dd>
-
-  <dt><b><tt>extractelement ( VAL, IDX )</tt></b></dt>
-  <dd>Perform the <a href="#i_extractelement">extractelement operation</a> on
-      constants.</dd>
-
-  <dt><b><tt>insertelement ( VAL, ELT, IDX )</tt></b></dt>
-  <dd>Perform the <a href="#i_insertelement">insertelement operation</a> on
-    constants.</dd>
-
-  <dt><b><tt>shufflevector ( VEC1, VEC2, IDXMASK )</tt></b></dt>
-  <dd>Perform the <a href="#i_shufflevector">shufflevector operation</a> on
-      constants.</dd>
-
-  <dt><b><tt>OPCODE ( LHS, RHS )</tt></b></dt>
-  <dd>Perform the specified operation of the LHS and RHS constants. OPCODE may
-      be any of the <a href="#binaryops">binary</a>
-      or <a href="#bitwiseops">bitwise binary</a> operations.  The constraints
-      on operands are the same as those for the corresponding instruction
-      (e.g. no bitwise operations on floating point values are allowed).</dd>
-</dl>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"> <a name="othervalues">Other Values</a> </div>
-<!-- *********************************************************************** -->
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-<a name="inlineasm">Inline Assembler Expressions</a>
-</div>
-
-<div class="doc_text">
-
-<p>LLVM supports inline assembler expressions (as opposed
-   to <a href="#moduleasm"> Module-Level Inline Assembly</a>) through the use of
-   a special value.  This value represents the inline assembler as a string
-   (containing the instructions to emit), a list of operand constraints (stored
-   as a string), a flag that indicates whether or not the inline asm
-   expression has side effects, and a flag indicating whether the function
-   containing the asm needs to align its stack conservatively.  An example
-   inline assembler expression is:</p>
-
-<div class="doc_code">
-<pre>
-i32 (i32) asm "bswap $0", "=r,r"
-</pre>
-</div>
-
-<p>Inline assembler expressions may <b>only</b> be used as the callee operand of
-   a <a href="#i_call"><tt>call</tt> instruction</a>.  Thus, typically we
-   have:</p>
-
-<div class="doc_code">
-<pre>
-%X = call i32 asm "<a href="#int_bswap">bswap</a> $0", "=r,r"(i32 %Y)
-</pre>
-</div>
-
-<p>Inline asms with side effects not visible in the constraint list must be
-   marked as having side effects.  This is done through the use of the
-   '<tt>sideeffect</tt>' keyword, like so:</p>
-
-<div class="doc_code">
-<pre>
-call void asm sideeffect "eieio", ""()
-</pre>
-</div>
-
-<p>In some cases inline asms will contain code that will not work unless the
-   stack is aligned in some way, such as calls or SSE instructions on x86,
-   yet will not contain code that does that alignment within the asm.
-   The compiler should make conservative assumptions about what the asm might
-   contain and should generate its usual stack alignment code in the prologue
-   if the '<tt>alignstack</tt>' keyword is present:</p>
-
-<div class="doc_code">
-<pre>
-call void asm alignstack "eieio", ""()
-</pre>
-</div>
-
-<p>If both keywords appear the '<tt>sideeffect</tt>' keyword must come
-   first.</p>
-
-<p>TODO: The format of the asm and constraints string still need to be
-   documented here.  Constraints on what can be done (e.g. duplication, moving,
-   etc need to be documented).  This is probably best done by reference to
-   another document that covers inline asm from a holistic perspective.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="metadata">Metadata Nodes and Metadata
-  Strings</a>
-</div>
-
-<div class="doc_text">
-
-<p>LLVM IR allows metadata to be attached to instructions in the program that
-   can convey extra information about the code to the optimizers and code
-   generator.  One example application of metadata is source-level debug
-   information.  There are two metadata primitives: strings and nodes. All
-   metadata has the <tt>metadata</tt> type and is identified in syntax by a
-   preceding exclamation point ('<tt>!</tt>').</p>
-
-<p>A metadata string is a string surrounded by double quotes.  It can contain
-   any character by escaping non-printable characters with "\xx" where "xx" is
-   the two digit hex code.  For example: "<tt>!"test\00"</tt>".</p>
-
-<p>Metadata nodes are represented with notation similar to structure constants
-   (a comma separated list of elements, surrounded by braces and preceded by an
-   exclamation point).  For example: "<tt>!{ metadata !"test\00", i32
-   10}</tt>".  Metadata nodes can have any values as their operand.</p>
-
-<p>A <a href="#namedmetadatastructure">named metadata</a> is a collection of 
-   metadata nodes, which can be looked up in the module symbol table. For
-   example: "<tt>!foo =  metadata !{!4, !3}</tt>".
-
-</div>
-
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="intrinsic_globals">Intrinsic Global Variables</a>
-</div>
-<!-- *********************************************************************** -->
-
-<p>LLVM has a number of "magic" global variables that contain data that affect
-code generation or other IR semantics.  These are documented here.  All globals
-of this sort should have a section specified as "<tt>llvm.metadata</tt>".  This
-section and all globals that start with "<tt>llvm.</tt>" are reserved for use
-by LLVM.</p>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-<a name="intg_used">The '<tt>llvm.used</tt>' Global Variable</a>
-</div>
-
-<div class="doc_text">
-
-<p>The <tt>@llvm.used</tt> global is an array with i8* element type which has <a
-href="#linkage_appending">appending linkage</a>.  This array contains a list of
-pointers to global variables and functions which may optionally have a pointer
-cast formed of bitcast or getelementptr.  For example, a legal use of it is:</p>
-
-<pre>
-  @X = global i8 4
-  @Y = global i32 123
-
-  @llvm.used = appending global [2 x i8*] [
-     i8* @X,
-     i8* bitcast (i32* @Y to i8*)
-  ], section "llvm.metadata"
-</pre>
-
-<p>If a global variable appears in the <tt>@llvm.used</tt> list, then the
-compiler, assembler, and linker are required to treat the symbol as if there is
-a reference to the global that it cannot see.  For example, if a variable has
-internal linkage and no references other than that from the <tt>@llvm.used</tt>
-list, it cannot be deleted.  This is commonly used to represent references from
-inline asms and other things the compiler cannot "see", and corresponds to
-"attribute((used))" in GNU C.</p>
-
-<p>On some targets, the code generator must emit a directive to the assembler or
-object file to prevent the assembler and linker from molesting the symbol.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-<a name="intg_compiler_used">The '<tt>llvm.compiler.used</tt>' Global Variable</a>
-</div>
-
-<div class="doc_text">
-
-<p>The <tt>@llvm.compiler.used</tt> directive is the same as the
-<tt>@llvm.used</tt> directive, except that it only prevents the compiler from
-touching the symbol.  On targets that support it, this allows an intelligent
-linker to optimize references to the symbol without being impeded as it would be
-by <tt>@llvm.used</tt>.</p>
-
-<p>This is a rare construct that should only be used in rare circumstances, and
-should not be exposed to source languages.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-<a name="intg_global_ctors">The '<tt>llvm.global_ctors</tt>' Global Variable</a>
-</div>
-
-<div class="doc_text">
-
-<p>TODO: Describe this.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-<a name="intg_global_dtors">The '<tt>llvm.global_dtors</tt>' Global Variable</a>
-</div>
-
-<div class="doc_text">
-
-<p>TODO: Describe this.</p>
-
-</div>
-
-
-<!-- *********************************************************************** -->
-<div class="doc_section"> <a name="instref">Instruction Reference</a> </div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>The LLVM instruction set consists of several different classifications of
-   instructions: <a href="#terminators">terminator
-   instructions</a>, <a href="#binaryops">binary instructions</a>,
-   <a href="#bitwiseops">bitwise binary instructions</a>,
-   <a href="#memoryops">memory instructions</a>, and
-   <a href="#otherops">other instructions</a>.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"> <a name="terminators">Terminator
-Instructions</a> </div>
-
-<div class="doc_text">
-
-<p>As mentioned <a href="#functionstructure">previously</a>, every basic block
-   in a program ends with a "Terminator" instruction, which indicates which
-   block should be executed after the current block is finished. These
-   terminator instructions typically yield a '<tt>void</tt>' value: they produce
-   control flow, not values (the one exception being the
-   '<a href="#i_invoke"><tt>invoke</tt></a>' instruction).</p>
-
-<p>There are six different terminator instructions: the
-   '<a href="#i_ret"><tt>ret</tt></a>' instruction, the
-   '<a href="#i_br"><tt>br</tt></a>' instruction, the
-   '<a href="#i_switch"><tt>switch</tt></a>' instruction, the
-   '<a href="#i_indirectbr">'<tt>indirectbr</tt></a>' Instruction, the
-   '<a href="#i_invoke"><tt>invoke</tt></a>' instruction, the
-   '<a href="#i_unwind"><tt>unwind</tt></a>' instruction, and the
-   '<a href="#i_unreachable"><tt>unreachable</tt></a>' instruction.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection"> <a name="i_ret">'<tt>ret</tt>'
-Instruction</a> </div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  ret &lt;type&gt; &lt;value&gt;       <i>; Return a value from a non-void function</i>
-  ret void                 <i>; Return from void function</i>
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>ret</tt>' instruction is used to return control flow (and optionally
-   a value) from a function back to the caller.</p>
-
-<p>There are two forms of the '<tt>ret</tt>' instruction: one that returns a
-   value and then causes control flow, and one that just causes control flow to
-   occur.</p>
-
-<h5>Arguments:</h5>
-<p>The '<tt>ret</tt>' instruction optionally accepts a single argument, the
-   return value. The type of the return value must be a
-   '<a href="#t_firstclass">first class</a>' type.</p>
-
-<p>A function is not <a href="#wellformed">well formed</a> if it it has a
-   non-void return type and contains a '<tt>ret</tt>' instruction with no return
-   value or a return value with a type that does not match its type, or if it
-   has a void return type and contains a '<tt>ret</tt>' instruction with a
-   return value.</p>
-
-<h5>Semantics:</h5>
-<p>When the '<tt>ret</tt>' instruction is executed, control flow returns back to
-   the calling function's context.  If the caller is a
-   "<a href="#i_call"><tt>call</tt></a>" instruction, execution continues at the
-   instruction after the call.  If the caller was an
-   "<a href="#i_invoke"><tt>invoke</tt></a>" instruction, execution continues at
-   the beginning of the "normal" destination block.  If the instruction returns
-   a value, that value shall set the call or invoke instruction's return
-   value.</p>
-
-<h5>Example:</h5>
-<pre>
-  ret i32 5                       <i>; Return an integer value of 5</i>
-  ret void                        <i>; Return from a void function</i>
-  ret { i32, i8 } { i32 4, i8 2 } <i>; Return a struct of values 4 and 2</i>
-</pre>
-
-</div>
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection"> <a name="i_br">'<tt>br</tt>' Instruction</a> </div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  br i1 &lt;cond&gt;, label &lt;iftrue&gt;, label &lt;iffalse&gt;<br>  br label &lt;dest&gt;          <i>; Unconditional branch</i>
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>br</tt>' instruction is used to cause control flow to transfer to a
-   different basic block in the current function.  There are two forms of this
-   instruction, corresponding to a conditional branch and an unconditional
-   branch.</p>
-
-<h5>Arguments:</h5>
-<p>The conditional branch form of the '<tt>br</tt>' instruction takes a single
-   '<tt>i1</tt>' value and two '<tt>label</tt>' values.  The unconditional form
-   of the '<tt>br</tt>' instruction takes a single '<tt>label</tt>' value as a
-   target.</p>
-
-<h5>Semantics:</h5>
-<p>Upon execution of a conditional '<tt>br</tt>' instruction, the '<tt>i1</tt>'
-   argument is evaluated.  If the value is <tt>true</tt>, control flows to the
-   '<tt>iftrue</tt>' <tt>label</tt> argument.  If "cond" is <tt>false</tt>,
-   control flows to the '<tt>iffalse</tt>' <tt>label</tt> argument.</p>
-
-<h5>Example:</h5>
-<pre>
-Test:
-  %cond = <a href="#i_icmp">icmp</a> eq i32 %a, %b
-  br i1 %cond, label %IfEqual, label %IfUnequal
-IfEqual:
-  <a href="#i_ret">ret</a> i32 1
-IfUnequal:
-  <a href="#i_ret">ret</a> i32 0
-</pre>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-   <a name="i_switch">'<tt>switch</tt>' Instruction</a>
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  switch &lt;intty&gt; &lt;value&gt;, label &lt;defaultdest&gt; [ &lt;intty&gt; &lt;val&gt;, label &lt;dest&gt; ... ]
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>switch</tt>' instruction is used to transfer control flow to one of
-   several different places.  It is a generalization of the '<tt>br</tt>'
-   instruction, allowing a branch to occur to one of many possible
-   destinations.</p>
-
-<h5>Arguments:</h5>
-<p>The '<tt>switch</tt>' instruction uses three parameters: an integer
-   comparison value '<tt>value</tt>', a default '<tt>label</tt>' destination,
-   and an array of pairs of comparison value constants and '<tt>label</tt>'s.
-   The table is not allowed to contain duplicate constant entries.</p>
-
-<h5>Semantics:</h5>
-<p>The <tt>switch</tt> instruction specifies a table of values and
-   destinations. When the '<tt>switch</tt>' instruction is executed, this table
-   is searched for the given value.  If the value is found, control flow is
-   transferred to the corresponding destination; otherwise, control flow is
-   transferred to the default destination.</p>
-
-<h5>Implementation:</h5>
-<p>Depending on properties of the target machine and the particular
-   <tt>switch</tt> instruction, this instruction may be code generated in
-   different ways.  For example, it could be generated as a series of chained
-   conditional branches or with a lookup table.</p>
-
-<h5>Example:</h5>
-<pre>
- <i>; Emulate a conditional br instruction</i>
- %Val = <a href="#i_zext">zext</a> i1 %value to i32
- switch i32 %Val, label %truedest [ i32 0, label %falsedest ]
-
- <i>; Emulate an unconditional br instruction</i>
- switch i32 0, label %dest [ ]
-
- <i>; Implement a jump table:</i>
- switch i32 %val, label %otherwise [ i32 0, label %onzero
-                                     i32 1, label %onone
-                                     i32 2, label %ontwo ]
-</pre>
-
-</div>
-
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-   <a name="i_indirectbr">'<tt>indirectbr</tt>' Instruction</a>
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  indirectbr &lt;somety&gt;* &lt;address&gt;, [ label &lt;dest1&gt;, label &lt;dest2&gt;, ... ]
-</pre>
-
-<h5>Overview:</h5>
-
-<p>The '<tt>indirectbr</tt>' instruction implements an indirect branch to a label
-   within the current function, whose address is specified by
-   "<tt>address</tt>".  Address must be derived from a <a
-   href="#blockaddress">blockaddress</a> constant.</p>
-
-<h5>Arguments:</h5>
-
-<p>The '<tt>address</tt>' argument is the address of the label to jump to.  The
-   rest of the arguments indicate the full set of possible destinations that the
-   address may point to.  Blocks are allowed to occur multiple times in the
-   destination list, though this isn't particularly useful.</p>
-
-<p>This destination list is required so that dataflow analysis has an accurate
-   understanding of the CFG.</p>
-
-<h5>Semantics:</h5>
-
-<p>Control transfers to the block specified in the address argument.  All
-   possible destination blocks must be listed in the label list, otherwise this
-   instruction has undefined behavior.  This implies that jumps to labels
-   defined in other functions have undefined behavior as well.</p>
-
-<h5>Implementation:</h5>
-
-<p>This is typically implemented with a jump through a register.</p>
-
-<h5>Example:</h5>
-<pre>
- indirectbr i8* %Addr, [ label %bb1, label %bb2, label %bb3 ]
-</pre>
-
-</div>
-
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="i_invoke">'<tt>invoke</tt>' Instruction</a>
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  &lt;result&gt; = invoke [<a href="#callingconv">cconv</a>] [<a href="#paramattrs">ret attrs</a>] &lt;ptr to function ty&gt; &lt;function ptr val&gt;(&lt;function args&gt;) [<a href="#fnattrs">fn attrs</a>]
-                to label &lt;normal label&gt; unwind label &lt;exception label&gt;
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>invoke</tt>' instruction causes control to transfer to a specified
-   function, with the possibility of control flow transfer to either the
-   '<tt>normal</tt>' label or the '<tt>exception</tt>' label.  If the callee
-   function returns with the "<tt><a href="#i_ret">ret</a></tt>" instruction,
-   control flow will return to the "normal" label.  If the callee (or any
-   indirect callees) returns with the "<a href="#i_unwind"><tt>unwind</tt></a>"
-   instruction, control is interrupted and continued at the dynamically nearest
-   "exception" label.</p>
-
-<h5>Arguments:</h5>
-<p>This instruction requires several arguments:</p>
-
-<ol>
-  <li>The optional "cconv" marker indicates which <a href="#callingconv">calling
-      convention</a> the call should use.  If none is specified, the call
-      defaults to using C calling conventions.</li>
-
-  <li>The optional <a href="#paramattrs">Parameter Attributes</a> list for
-      return values. Only '<tt>zeroext</tt>', '<tt>signext</tt>', and
-      '<tt>inreg</tt>' attributes are valid here.</li>
-
-  <li>'<tt>ptr to function ty</tt>': shall be the signature of the pointer to
-      function value being invoked.  In most cases, this is a direct function
-      invocation, but indirect <tt>invoke</tt>s are just as possible, branching
-      off an arbitrary pointer to function value.</li>
-
-  <li>'<tt>function ptr val</tt>': An LLVM value containing a pointer to a
-      function to be invoked. </li>
-
-  <li>'<tt>function args</tt>': argument list whose types match the function
-      signature argument types.  If the function signature indicates the
-      function accepts a variable number of arguments, the extra arguments can
-      be specified.</li>
-
-  <li>'<tt>normal label</tt>': the label reached when the called function
-      executes a '<tt><a href="#i_ret">ret</a></tt>' instruction. </li>
-
-  <li>'<tt>exception label</tt>': the label reached when a callee returns with
-      the <a href="#i_unwind"><tt>unwind</tt></a> instruction. </li>
-
-  <li>The optional <a href="#fnattrs">function attributes</a> list. Only
-      '<tt>noreturn</tt>', '<tt>nounwind</tt>', '<tt>readonly</tt>' and
-      '<tt>readnone</tt>' attributes are valid here.</li>
-</ol>
-
-<h5>Semantics:</h5>
-<p>This instruction is designed to operate as a standard
-   '<tt><a href="#i_call">call</a></tt>' instruction in most regards.  The
-   primary difference is that it establishes an association with a label, which
-   is used by the runtime library to unwind the stack.</p>
-
-<p>This instruction is used in languages with destructors to ensure that proper
-   cleanup is performed in the case of either a <tt>longjmp</tt> or a thrown
-   exception.  Additionally, this is important for implementation of
-   '<tt>catch</tt>' clauses in high-level languages that support them.</p>
-
-<p>For the purposes of the SSA form, the definition of the value returned by the
-   '<tt>invoke</tt>' instruction is deemed to occur on the edge from the current
-   block to the "normal" label. If the callee unwinds then no return value is
-   available.</p>
-
-<p>Note that the code generator does not yet completely support unwind, and
-that the invoke/unwind semantics are likely to change in future versions.</p>
-
-<h5>Example:</h5>
-<pre>
-  %retval = invoke i32 @Test(i32 15) to label %Continue
-              unwind label %TestCleanup              <i>; {i32}:retval set</i>
-  %retval = invoke <a href="#callingconv">coldcc</a> i32 %Testfnptr(i32 15) to label %Continue
-              unwind label %TestCleanup              <i>; {i32}:retval set</i>
-</pre>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-
-<div class="doc_subsubsection"> <a name="i_unwind">'<tt>unwind</tt>'
-Instruction</a> </div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  unwind
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>unwind</tt>' instruction unwinds the stack, continuing control flow
-   at the first callee in the dynamic call stack which used
-   an <a href="#i_invoke"><tt>invoke</tt></a> instruction to perform the call.
-   This is primarily used to implement exception handling.</p>
-
-<h5>Semantics:</h5>
-<p>The '<tt>unwind</tt>' instruction causes execution of the current function to
-   immediately halt.  The dynamic call stack is then searched for the
-   first <a href="#i_invoke"><tt>invoke</tt></a> instruction on the call stack.
-   Once found, execution continues at the "exceptional" destination block
-   specified by the <tt>invoke</tt> instruction.  If there is no <tt>invoke</tt>
-   instruction in the dynamic call chain, undefined behavior results.</p>
-
-<p>Note that the code generator does not yet completely support unwind, and
-that the invoke/unwind semantics are likely to change in future versions.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-
-<div class="doc_subsubsection"> <a name="i_unreachable">'<tt>unreachable</tt>'
-Instruction</a> </div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  unreachable
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>unreachable</tt>' instruction has no defined semantics.  This
-   instruction is used to inform the optimizer that a particular portion of the
-   code is not reachable.  This can be used to indicate that the code after a
-   no-return function cannot be reached, and other facts.</p>
-
-<h5>Semantics:</h5>
-<p>The '<tt>unreachable</tt>' instruction has no defined semantics.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"> <a name="binaryops">Binary Operations</a> </div>
-
-<div class="doc_text">
-
-<p>Binary operators are used to do most of the computation in a program.  They
-   require two operands of the same type, execute an operation on them, and
-   produce a single value.  The operands might represent multiple data, as is
-   the case with the <a href="#t_vector">vector</a> data type.  The result value
-   has the same type as its operands.</p>
-
-<p>There are several different binary operators:</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="i_add">'<tt>add</tt>' Instruction</a>
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  &lt;result&gt; = add &lt;ty&gt; &lt;op1&gt;, &lt;op2&gt;          <i>; yields {ty}:result</i>
-  &lt;result&gt; = add nuw &lt;ty&gt; &lt;op1&gt;, &lt;op2&gt;      <i>; yields {ty}:result</i>
-  &lt;result&gt; = add nsw &lt;ty&gt; &lt;op1&gt;, &lt;op2&gt;      <i>; yields {ty}:result</i>
-  &lt;result&gt; = add nuw nsw &lt;ty&gt; &lt;op1&gt;, &lt;op2&gt;  <i>; yields {ty}:result</i>
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>add</tt>' instruction returns the sum of its two operands.</p>
-
-<h5>Arguments:</h5>
-<p>The two arguments to the '<tt>add</tt>' instruction must
-   be <a href="#t_integer">integer</a> or <a href="#t_vector">vector</a> of
-   integer values. Both arguments must have identical types.</p>
-
-<h5>Semantics:</h5>
-<p>The value produced is the integer sum of the two operands.</p>
-
-<p>If the sum has unsigned overflow, the result returned is the mathematical
-   result modulo 2<sup>n</sup>, where n is the bit width of the result.</p>
-
-<p>Because LLVM integers use a two's complement representation, this instruction
-   is appropriate for both signed and unsigned integers.</p>
-
-<p><tt>nuw</tt> and <tt>nsw</tt> stand for &quot;No Unsigned Wrap&quot;
-   and &quot;No Signed Wrap&quot;, respectively. If the <tt>nuw</tt> and/or
-   <tt>nsw</tt> keywords are present, the result value of the <tt>add</tt>
-   is undefined if unsigned and/or signed overflow, respectively, occurs.</p>
-
-<h5>Example:</h5>
-<pre>
-  &lt;result&gt; = add i32 4, %var          <i>; yields {i32}:result = 4 + %var</i>
-</pre>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="i_fadd">'<tt>fadd</tt>' Instruction</a>
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  &lt;result&gt; = fadd &lt;ty&gt; &lt;op1&gt;, &lt;op2&gt;   <i>; yields {ty}:result</i>
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>fadd</tt>' instruction returns the sum of its two operands.</p>
-
-<h5>Arguments:</h5>
-<p>The two arguments to the '<tt>fadd</tt>' instruction must be
-   <a href="#t_floating">floating point</a> or <a href="#t_vector">vector</a> of
-   floating point values. Both arguments must have identical types.</p>
-
-<h5>Semantics:</h5>
-<p>The value produced is the floating point sum of the two operands.</p>
-
-<h5>Example:</h5>
-<pre>
-  &lt;result&gt; = fadd float 4.0, %var          <i>; yields {float}:result = 4.0 + %var</i>
-</pre>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-   <a name="i_sub">'<tt>sub</tt>' Instruction</a>
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  &lt;result&gt; = sub &lt;ty&gt; &lt;op1&gt;, &lt;op2&gt;          <i>; yields {ty}:result</i>
-  &lt;result&gt; = sub nuw &lt;ty&gt; &lt;op1&gt;, &lt;op2&gt;      <i>; yields {ty}:result</i>
-  &lt;result&gt; = sub nsw &lt;ty&gt; &lt;op1&gt;, &lt;op2&gt;      <i>; yields {ty}:result</i>
-  &lt;result&gt; = sub nuw nsw &lt;ty&gt; &lt;op1&gt;, &lt;op2&gt;  <i>; yields {ty}:result</i>
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>sub</tt>' instruction returns the difference of its two
-   operands.</p>
-
-<p>Note that the '<tt>sub</tt>' instruction is used to represent the
-   '<tt>neg</tt>' instruction present in most other intermediate
-   representations.</p>
-
-<h5>Arguments:</h5>
-<p>The two arguments to the '<tt>sub</tt>' instruction must
-   be <a href="#t_integer">integer</a> or <a href="#t_vector">vector</a> of
-   integer values.  Both arguments must have identical types.</p>
-
-<h5>Semantics:</h5>
-<p>The value produced is the integer difference of the two operands.</p>
-
-<p>If the difference has unsigned overflow, the result returned is the
-   mathematical result modulo 2<sup>n</sup>, where n is the bit width of the
-   result.</p>
-
-<p>Because LLVM integers use a two's complement representation, this instruction
-   is appropriate for both signed and unsigned integers.</p>
-
-<p><tt>nuw</tt> and <tt>nsw</tt> stand for &quot;No Unsigned Wrap&quot;
-   and &quot;No Signed Wrap&quot;, respectively. If the <tt>nuw</tt> and/or
-   <tt>nsw</tt> keywords are present, the result value of the <tt>sub</tt>
-   is undefined if unsigned and/or signed overflow, respectively, occurs.</p>
-
-<h5>Example:</h5>
-<pre>
-  &lt;result&gt; = sub i32 4, %var          <i>; yields {i32}:result = 4 - %var</i>
-  &lt;result&gt; = sub i32 0, %val          <i>; yields {i32}:result = -%var</i>
-</pre>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-   <a name="i_fsub">'<tt>fsub</tt>' Instruction</a>
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  &lt;result&gt; = fsub &lt;ty&gt; &lt;op1&gt;, &lt;op2&gt;   <i>; yields {ty}:result</i>
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>fsub</tt>' instruction returns the difference of its two
-   operands.</p>
-
-<p>Note that the '<tt>fsub</tt>' instruction is used to represent the
-   '<tt>fneg</tt>' instruction present in most other intermediate
-   representations.</p>
-
-<h5>Arguments:</h5>
-<p>The two arguments to the '<tt>fsub</tt>' instruction must be
-   <a href="#t_floating">floating point</a> or <a href="#t_vector">vector</a> of
-   floating point values.  Both arguments must have identical types.</p>
-
-<h5>Semantics:</h5>
-<p>The value produced is the floating point difference of the two operands.</p>
-
-<h5>Example:</h5>
-<pre>
-  &lt;result&gt; = fsub float 4.0, %var           <i>; yields {float}:result = 4.0 - %var</i>
-  &lt;result&gt; = fsub float -0.0, %val          <i>; yields {float}:result = -%var</i>
-</pre>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="i_mul">'<tt>mul</tt>' Instruction</a>
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  &lt;result&gt; = mul &lt;ty&gt; &lt;op1&gt;, &lt;op2&gt;          <i>; yields {ty}:result</i>
-  &lt;result&gt; = mul nuw &lt;ty&gt; &lt;op1&gt;, &lt;op2&gt;      <i>; yields {ty}:result</i>
-  &lt;result&gt; = mul nsw &lt;ty&gt; &lt;op1&gt;, &lt;op2&gt;      <i>; yields {ty}:result</i>
-  &lt;result&gt; = mul nuw nsw &lt;ty&gt; &lt;op1&gt;, &lt;op2&gt;  <i>; yields {ty}:result</i>
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>mul</tt>' instruction returns the product of its two operands.</p>
-
-<h5>Arguments:</h5>
-<p>The two arguments to the '<tt>mul</tt>' instruction must
-   be <a href="#t_integer">integer</a> or <a href="#t_vector">vector</a> of
-   integer values.  Both arguments must have identical types.</p>
-
-<h5>Semantics:</h5>
-<p>The value produced is the integer product of the two operands.</p>
-
-<p>If the result of the multiplication has unsigned overflow, the result
-   returned is the mathematical result modulo 2<sup>n</sup>, where n is the bit
-   width of the result.</p>
-
-<p>Because LLVM integers use a two's complement representation, and the result
-   is the same width as the operands, this instruction returns the correct
-   result for both signed and unsigned integers.  If a full product
-   (e.g. <tt>i32</tt>x<tt>i32</tt>-><tt>i64</tt>) is needed, the operands should
-   be sign-extended or zero-extended as appropriate to the width of the full
-   product.</p>
-
-<p><tt>nuw</tt> and <tt>nsw</tt> stand for &quot;No Unsigned Wrap&quot;
-   and &quot;No Signed Wrap&quot;, respectively. If the <tt>nuw</tt> and/or
-   <tt>nsw</tt> keywords are present, the result value of the <tt>mul</tt>
-   is undefined if unsigned and/or signed overflow, respectively, occurs.</p>
-
-<h5>Example:</h5>
-<pre>
-  &lt;result&gt; = mul i32 4, %var          <i>; yields {i32}:result = 4 * %var</i>
-</pre>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="i_fmul">'<tt>fmul</tt>' Instruction</a>
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  &lt;result&gt; = fmul &lt;ty&gt; &lt;op1&gt;, &lt;op2&gt;   <i>; yields {ty}:result</i>
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>fmul</tt>' instruction returns the product of its two operands.</p>
-
-<h5>Arguments:</h5>
-<p>The two arguments to the '<tt>fmul</tt>' instruction must be
-   <a href="#t_floating">floating point</a> or <a href="#t_vector">vector</a> of
-   floating point values.  Both arguments must have identical types.</p>
-
-<h5>Semantics:</h5>
-<p>The value produced is the floating point product of the two operands.</p>
-
-<h5>Example:</h5>
-<pre>
-  &lt;result&gt; = fmul float 4.0, %var          <i>; yields {float}:result = 4.0 * %var</i>
-</pre>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection"> <a name="i_udiv">'<tt>udiv</tt>' Instruction
-</a></div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  &lt;result&gt; = udiv &lt;ty&gt; &lt;op1&gt;, &lt;op2&gt;   <i>; yields {ty}:result</i>
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>udiv</tt>' instruction returns the quotient of its two operands.</p>
-
-<h5>Arguments:</h5>
-<p>The two arguments to the '<tt>udiv</tt>' instruction must be
-   <a href="#t_integer">integer</a> or <a href="#t_vector">vector</a> of integer
-   values.  Both arguments must have identical types.</p>
-
-<h5>Semantics:</h5>
-<p>The value produced is the unsigned integer quotient of the two operands.</p>
-
-<p>Note that unsigned integer division and signed integer division are distinct
-   operations; for signed integer division, use '<tt>sdiv</tt>'.</p>
-
-<p>Division by zero leads to undefined behavior.</p>
-
-<h5>Example:</h5>
-<pre>
-  &lt;result&gt; = udiv i32 4, %var          <i>; yields {i32}:result = 4 / %var</i>
-</pre>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection"> <a name="i_sdiv">'<tt>sdiv</tt>' Instruction
-</a> </div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  &lt;result&gt; = sdiv &lt;ty&gt; &lt;op1&gt;, &lt;op2&gt;         <i>; yields {ty}:result</i>
-  &lt;result&gt; = sdiv exact &lt;ty&gt; &lt;op1&gt;, &lt;op2&gt;   <i>; yields {ty}:result</i>
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>sdiv</tt>' instruction returns the quotient of its two operands.</p>
-
-<h5>Arguments:</h5>
-<p>The two arguments to the '<tt>sdiv</tt>' instruction must be
-   <a href="#t_integer">integer</a> or <a href="#t_vector">vector</a> of integer
-   values.  Both arguments must have identical types.</p>
-
-<h5>Semantics:</h5>
-<p>The value produced is the signed integer quotient of the two operands rounded
-   towards zero.</p>
-
-<p>Note that signed integer division and unsigned integer division are distinct
-   operations; for unsigned integer division, use '<tt>udiv</tt>'.</p>
-
-<p>Division by zero leads to undefined behavior. Overflow also leads to
-   undefined behavior; this is a rare case, but can occur, for example, by doing
-   a 32-bit division of -2147483648 by -1.</p>
-
-<p>If the <tt>exact</tt> keyword is present, the result value of the
-   <tt>sdiv</tt> is undefined if the result would be rounded or if overflow
-   would occur.</p>
-
-<h5>Example:</h5>
-<pre>
-  &lt;result&gt; = sdiv i32 4, %var          <i>; yields {i32}:result = 4 / %var</i>
-</pre>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection"> <a name="i_fdiv">'<tt>fdiv</tt>'
-Instruction</a> </div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  &lt;result&gt; = fdiv &lt;ty&gt; &lt;op1&gt;, &lt;op2&gt;   <i>; yields {ty}:result</i>
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>fdiv</tt>' instruction returns the quotient of its two operands.</p>
-
-<h5>Arguments:</h5>
-<p>The two arguments to the '<tt>fdiv</tt>' instruction must be
-   <a href="#t_floating">floating point</a> or <a href="#t_vector">vector</a> of
-   floating point values.  Both arguments must have identical types.</p>
-
-<h5>Semantics:</h5>
-<p>The value produced is the floating point quotient of the two operands.</p>
-
-<h5>Example:</h5>
-<pre>
-  &lt;result&gt; = fdiv float 4.0, %var          <i>; yields {float}:result = 4.0 / %var</i>
-</pre>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection"> <a name="i_urem">'<tt>urem</tt>' Instruction</a>
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  &lt;result&gt; = urem &lt;ty&gt; &lt;op1&gt;, &lt;op2&gt;   <i>; yields {ty}:result</i>
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>urem</tt>' instruction returns the remainder from the unsigned
-   division of its two arguments.</p>
-
-<h5>Arguments:</h5>
-<p>The two arguments to the '<tt>urem</tt>' instruction must be
-   <a href="#t_integer">integer</a> or <a href="#t_vector">vector</a> of integer
-   values.  Both arguments must have identical types.</p>
-
-<h5>Semantics:</h5>
-<p>This instruction returns the unsigned integer <i>remainder</i> of a division.
-   This instruction always performs an unsigned division to get the
-   remainder.</p>
-
-<p>Note that unsigned integer remainder and signed integer remainder are
-   distinct operations; for signed integer remainder, use '<tt>srem</tt>'.</p>
-
-<p>Taking the remainder of a division by zero leads to undefined behavior.</p>
-
-<h5>Example:</h5>
-<pre>
-  &lt;result&gt; = urem i32 4, %var          <i>; yields {i32}:result = 4 % %var</i>
-</pre>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="i_srem">'<tt>srem</tt>' Instruction</a>
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  &lt;result&gt; = srem &lt;ty&gt; &lt;op1&gt;, &lt;op2&gt;   <i>; yields {ty}:result</i>
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>srem</tt>' instruction returns the remainder from the signed
-   division of its two operands. This instruction can also take
-   <a href="#t_vector">vector</a> versions of the values in which case the
-   elements must be integers.</p>
-
-<h5>Arguments:</h5>
-<p>The two arguments to the '<tt>srem</tt>' instruction must be
-   <a href="#t_integer">integer</a> or <a href="#t_vector">vector</a> of integer
-   values.  Both arguments must have identical types.</p>
-
-<h5>Semantics:</h5>
-<p>This instruction returns the <i>remainder</i> of a division (where the result
-   has the same sign as the dividend, <tt>op1</tt>), not the <i>modulo</i>
-   operator (where the result has the same sign as the divisor, <tt>op2</tt>) of
-   a value.  For more information about the difference,
-   see <a href="http://mathforum.org/dr.math/problems/anne.4.28.99.html">The
-   Math Forum</a>. For a table of how this is implemented in various languages,
-   please see <a href="http://en.wikipedia.org/wiki/Modulo_operation">
-   Wikipedia: modulo operation</a>.</p>
-
-<p>Note that signed integer remainder and unsigned integer remainder are
-   distinct operations; for unsigned integer remainder, use '<tt>urem</tt>'.</p>
-
-<p>Taking the remainder of a division by zero leads to undefined behavior.
-   Overflow also leads to undefined behavior; this is a rare case, but can
-   occur, for example, by taking the remainder of a 32-bit division of
-   -2147483648 by -1.  (The remainder doesn't actually overflow, but this rule
-   lets srem be implemented using instructions that return both the result of
-   the division and the remainder.)</p>
-
-<h5>Example:</h5>
-<pre>
-  &lt;result&gt; = srem i32 4, %var          <i>; yields {i32}:result = 4 % %var</i>
-</pre>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="i_frem">'<tt>frem</tt>' Instruction</a> </div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  &lt;result&gt; = frem &lt;ty&gt; &lt;op1&gt;, &lt;op2&gt;   <i>; yields {ty}:result</i>
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>frem</tt>' instruction returns the remainder from the division of
-   its two operands.</p>
-
-<h5>Arguments:</h5>
-<p>The two arguments to the '<tt>frem</tt>' instruction must be
-   <a href="#t_floating">floating point</a> or <a href="#t_vector">vector</a> of
-   floating point values.  Both arguments must have identical types.</p>
-
-<h5>Semantics:</h5>
-<p>This instruction returns the <i>remainder</i> of a division.  The remainder
-   has the same sign as the dividend.</p>
-
-<h5>Example:</h5>
-<pre>
-  &lt;result&gt; = frem float 4.0, %var          <i>; yields {float}:result = 4.0 % %var</i>
-</pre>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"> <a name="bitwiseops">Bitwise Binary
-Operations</a> </div>
-
-<div class="doc_text">
-
-<p>Bitwise binary operators are used to do various forms of bit-twiddling in a
-   program.  They are generally very efficient instructions and can commonly be
-   strength reduced from other instructions.  They require two operands of the
-   same type, execute an operation on them, and produce a single value.  The
-   resulting value is the same type as its operands.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection"> <a name="i_shl">'<tt>shl</tt>'
-Instruction</a> </div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  &lt;result&gt; = shl &lt;ty&gt; &lt;op1&gt;, &lt;op2&gt;   <i>; yields {ty}:result</i>
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>shl</tt>' instruction returns the first operand shifted to the left
-   a specified number of bits.</p>
-
-<h5>Arguments:</h5>
-<p>Both arguments to the '<tt>shl</tt>' instruction must be the
-    same <a href="#t_integer">integer</a> or <a href="#t_vector">vector</a> of
-    integer type.  '<tt>op2</tt>' is treated as an unsigned value.</p>
-
-<h5>Semantics:</h5>
-<p>The value produced is <tt>op1</tt> * 2<sup><tt>op2</tt></sup> mod
-   2<sup>n</sup>, where <tt>n</tt> is the width of the result.  If <tt>op2</tt>
-   is (statically or dynamically) negative or equal to or larger than the number
-   of bits in <tt>op1</tt>, the result is undefined.  If the arguments are
-   vectors, each vector element of <tt>op1</tt> is shifted by the corresponding
-   shift amount in <tt>op2</tt>.</p>
-
-<h5>Example:</h5>
-<pre>
-  &lt;result&gt; = shl i32 4, %var   <i>; yields {i32}: 4 &lt;&lt; %var</i>
-  &lt;result&gt; = shl i32 4, 2      <i>; yields {i32}: 16</i>
-  &lt;result&gt; = shl i32 1, 10     <i>; yields {i32}: 1024</i>
-  &lt;result&gt; = shl i32 1, 32     <i>; undefined</i>
-  &lt;result&gt; = shl &lt;2 x i32&gt; &lt; i32 1, i32 1&gt;, &lt; i32 1, i32 2&gt;   <i>; yields: result=&lt;2 x i32&gt; &lt; i32 2, i32 4&gt;</i>
-</pre>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection"> <a name="i_lshr">'<tt>lshr</tt>'
-Instruction</a> </div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  &lt;result&gt; = lshr &lt;ty&gt; &lt;op1&gt;, &lt;op2&gt;   <i>; yields {ty}:result</i>
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>lshr</tt>' instruction (logical shift right) returns the first
-   operand shifted to the right a specified number of bits with zero fill.</p>
-
-<h5>Arguments:</h5>
-<p>Both arguments to the '<tt>lshr</tt>' instruction must be the same
-   <a href="#t_integer">integer</a> or <a href="#t_vector">vector</a> of integer
-   type. '<tt>op2</tt>' is treated as an unsigned value.</p>
-
-<h5>Semantics:</h5>
-<p>This instruction always performs a logical shift right operation. The most
-   significant bits of the result will be filled with zero bits after the shift.
-   If <tt>op2</tt> is (statically or dynamically) equal to or larger than the
-   number of bits in <tt>op1</tt>, the result is undefined. If the arguments are
-   vectors, each vector element of <tt>op1</tt> is shifted by the corresponding
-   shift amount in <tt>op2</tt>.</p>
-
-<h5>Example:</h5>
-<pre>
-  &lt;result&gt; = lshr i32 4, 1   <i>; yields {i32}:result = 2</i>
-  &lt;result&gt; = lshr i32 4, 2   <i>; yields {i32}:result = 1</i>
-  &lt;result&gt; = lshr i8  4, 3   <i>; yields {i8}:result = 0</i>
-  &lt;result&gt; = lshr i8 -2, 1   <i>; yields {i8}:result = 0x7FFFFFFF </i>
-  &lt;result&gt; = lshr i32 1, 32  <i>; undefined</i>
-  &lt;result&gt; = lshr &lt;2 x i32&gt; &lt; i32 -2, i32 4&gt;, &lt; i32 1, i32 2&gt;   <i>; yields: result=&lt;2 x i32&gt; &lt; i32 0x7FFFFFFF, i32 1&gt;</i>
-</pre>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection"> <a name="i_ashr">'<tt>ashr</tt>'
-Instruction</a> </div>
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  &lt;result&gt; = ashr &lt;ty&gt; &lt;op1&gt;, &lt;op2&gt;   <i>; yields {ty}:result</i>
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>ashr</tt>' instruction (arithmetic shift right) returns the first
-   operand shifted to the right a specified number of bits with sign
-   extension.</p>
-
-<h5>Arguments:</h5>
-<p>Both arguments to the '<tt>ashr</tt>' instruction must be the same
-   <a href="#t_integer">integer</a> or <a href="#t_vector">vector</a> of integer
-   type.  '<tt>op2</tt>' is treated as an unsigned value.</p>
-
-<h5>Semantics:</h5>
-<p>This instruction always performs an arithmetic shift right operation, The
-   most significant bits of the result will be filled with the sign bit
-   of <tt>op1</tt>.  If <tt>op2</tt> is (statically or dynamically) equal to or
-   larger than the number of bits in <tt>op1</tt>, the result is undefined. If
-   the arguments are vectors, each vector element of <tt>op1</tt> is shifted by
-   the corresponding shift amount in <tt>op2</tt>.</p>
-
-<h5>Example:</h5>
-<pre>
-  &lt;result&gt; = ashr i32 4, 1   <i>; yields {i32}:result = 2</i>
-  &lt;result&gt; = ashr i32 4, 2   <i>; yields {i32}:result = 1</i>
-  &lt;result&gt; = ashr i8  4, 3   <i>; yields {i8}:result = 0</i>
-  &lt;result&gt; = ashr i8 -2, 1   <i>; yields {i8}:result = -1</i>
-  &lt;result&gt; = ashr i32 1, 32  <i>; undefined</i>
-  &lt;result&gt; = ashr &lt;2 x i32&gt; &lt; i32 -2, i32 4&gt;, &lt; i32 1, i32 3&gt;   <i>; yields: result=&lt;2 x i32&gt; &lt; i32 -1, i32 0&gt;</i>
-</pre>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection"> <a name="i_and">'<tt>and</tt>'
-Instruction</a> </div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  &lt;result&gt; = and &lt;ty&gt; &lt;op1&gt;, &lt;op2&gt;   <i>; yields {ty}:result</i>
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>and</tt>' instruction returns the bitwise logical and of its two
-   operands.</p>
-
-<h5>Arguments:</h5>
-<p>The two arguments to the '<tt>and</tt>' instruction must be
-   <a href="#t_integer">integer</a> or <a href="#t_vector">vector</a> of integer
-   values.  Both arguments must have identical types.</p>
-
-<h5>Semantics:</h5>
-<p>The truth table used for the '<tt>and</tt>' instruction is:</p>
-
-<table border="1" cellspacing="0" cellpadding="4">
-  <tbody>
-    <tr>
-      <td>In0</td>
-      <td>In1</td>
-      <td>Out</td>
-    </tr>
-    <tr>
-      <td>0</td>
-      <td>0</td>
-      <td>0</td>
-    </tr>
-    <tr>
-      <td>0</td>
-      <td>1</td>
-      <td>0</td>
-    </tr>
-    <tr>
-      <td>1</td>
-      <td>0</td>
-      <td>0</td>
-    </tr>
-    <tr>
-      <td>1</td>
-      <td>1</td>
-      <td>1</td>
-    </tr>
-  </tbody>
-</table>
-
-<h5>Example:</h5>
-<pre>
-  &lt;result&gt; = and i32 4, %var         <i>; yields {i32}:result = 4 &amp; %var</i>
-  &lt;result&gt; = and i32 15, 40          <i>; yields {i32}:result = 8</i>
-  &lt;result&gt; = and i32 4, 8            <i>; yields {i32}:result = 0</i>
-</pre>
-</div>
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection"> <a name="i_or">'<tt>or</tt>' Instruction</a> </div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  &lt;result&gt; = or &lt;ty&gt; &lt;op1&gt;, &lt;op2&gt;   <i>; yields {ty}:result</i>
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>or</tt>' instruction returns the bitwise logical inclusive or of its
-   two operands.</p>
-
-<h5>Arguments:</h5>
-<p>The two arguments to the '<tt>or</tt>' instruction must be
-   <a href="#t_integer">integer</a> or <a href="#t_vector">vector</a> of integer
-   values.  Both arguments must have identical types.</p>
-
-<h5>Semantics:</h5>
-<p>The truth table used for the '<tt>or</tt>' instruction is:</p>
-
-<table border="1" cellspacing="0" cellpadding="4">
-  <tbody>
-    <tr>
-      <td>In0</td>
-      <td>In1</td>
-      <td>Out</td>
-    </tr>
-    <tr>
-      <td>0</td>
-      <td>0</td>
-      <td>0</td>
-    </tr>
-    <tr>
-      <td>0</td>
-      <td>1</td>
-      <td>1</td>
-    </tr>
-    <tr>
-      <td>1</td>
-      <td>0</td>
-      <td>1</td>
-    </tr>
-    <tr>
-      <td>1</td>
-      <td>1</td>
-      <td>1</td>
-    </tr>
-  </tbody>
-</table>
-
-<h5>Example:</h5>
-<pre>
-  &lt;result&gt; = or i32 4, %var         <i>; yields {i32}:result = 4 | %var</i>
-  &lt;result&gt; = or i32 15, 40          <i>; yields {i32}:result = 47</i>
-  &lt;result&gt; = or i32 4, 8            <i>; yields {i32}:result = 12</i>
-</pre>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection"> <a name="i_xor">'<tt>xor</tt>'
-Instruction</a> </div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  &lt;result&gt; = xor &lt;ty&gt; &lt;op1&gt;, &lt;op2&gt;   <i>; yields {ty}:result</i>
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>xor</tt>' instruction returns the bitwise logical exclusive or of
-   its two operands.  The <tt>xor</tt> is used to implement the "one's
-   complement" operation, which is the "~" operator in C.</p>
-
-<h5>Arguments:</h5>
-<p>The two arguments to the '<tt>xor</tt>' instruction must be
-   <a href="#t_integer">integer</a> or <a href="#t_vector">vector</a> of integer
-   values.  Both arguments must have identical types.</p>
-
-<h5>Semantics:</h5>
-<p>The truth table used for the '<tt>xor</tt>' instruction is:</p>
-
-<table border="1" cellspacing="0" cellpadding="4">
-  <tbody>
-    <tr>
-      <td>In0</td>
-      <td>In1</td>
-      <td>Out</td>
-    </tr>
-    <tr>
-      <td>0</td>
-      <td>0</td>
-      <td>0</td>
-    </tr>
-    <tr>
-      <td>0</td>
-      <td>1</td>
-      <td>1</td>
-    </tr>
-    <tr>
-      <td>1</td>
-      <td>0</td>
-      <td>1</td>
-    </tr>
-    <tr>
-      <td>1</td>
-      <td>1</td>
-      <td>0</td>
-    </tr>
-  </tbody>
-</table>
-
-<h5>Example:</h5>
-<pre>
-  &lt;result&gt; = xor i32 4, %var         <i>; yields {i32}:result = 4 ^ %var</i>
-  &lt;result&gt; = xor i32 15, 40          <i>; yields {i32}:result = 39</i>
-  &lt;result&gt; = xor i32 4, 8            <i>; yields {i32}:result = 12</i>
-  &lt;result&gt; = xor i32 %V, -1          <i>; yields {i32}:result = ~%V</i>
-</pre>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="vectorops">Vector Operations</a>
-</div>
-
-<div class="doc_text">
-
-<p>LLVM supports several instructions to represent vector operations in a
-   target-independent manner.  These instructions cover the element-access and
-   vector-specific operations needed to process vectors effectively.  While LLVM
-   does directly support these vector operations, many sophisticated algorithms
-   will want to use target-specific intrinsics to take full advantage of a
-   specific target.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-   <a name="i_extractelement">'<tt>extractelement</tt>' Instruction</a>
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  &lt;result&gt; = extractelement &lt;n x &lt;ty&gt;&gt; &lt;val&gt;, i32 &lt;idx&gt;    <i>; yields &lt;ty&gt;</i>
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>extractelement</tt>' instruction extracts a single scalar element
-   from a vector at a specified index.</p>
-
-
-<h5>Arguments:</h5>
-<p>The first operand of an '<tt>extractelement</tt>' instruction is a value
-   of <a href="#t_vector">vector</a> type.  The second operand is an index
-   indicating the position from which to extract the element.  The index may be
-   a variable.</p>
-
-<h5>Semantics:</h5>
-<p>The result is a scalar of the same type as the element type of
-   <tt>val</tt>.  Its value is the value at position <tt>idx</tt> of
-   <tt>val</tt>.  If <tt>idx</tt> exceeds the length of <tt>val</tt>, the
-   results are undefined.</p>
-
-<h5>Example:</h5>
-<pre>
-  &lt;result&gt; = extractelement &lt;4 x i32&gt; %vec, i32 0    <i>; yields i32</i>
-</pre>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-   <a name="i_insertelement">'<tt>insertelement</tt>' Instruction</a>
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  &lt;result&gt; = insertelement &lt;n x &lt;ty&gt;&gt; &lt;val&gt;, &lt;ty&gt; &lt;elt&gt;, i32 &lt;idx&gt;    <i>; yields &lt;n x &lt;ty&gt;&gt;</i>
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>insertelement</tt>' instruction inserts a scalar element into a
-   vector at a specified index.</p>
-
-<h5>Arguments:</h5>
-<p>The first operand of an '<tt>insertelement</tt>' instruction is a value
-   of <a href="#t_vector">vector</a> type.  The second operand is a scalar value
-   whose type must equal the element type of the first operand.  The third
-   operand is an index indicating the position at which to insert the value.
-   The index may be a variable.</p>
-
-<h5>Semantics:</h5>
-<p>The result is a vector of the same type as <tt>val</tt>.  Its element values
-   are those of <tt>val</tt> except at position <tt>idx</tt>, where it gets the
-   value <tt>elt</tt>.  If <tt>idx</tt> exceeds the length of <tt>val</tt>, the
-   results are undefined.</p>
-
-<h5>Example:</h5>
-<pre>
-  &lt;result&gt; = insertelement &lt;4 x i32&gt; %vec, i32 1, i32 0    <i>; yields &lt;4 x i32&gt;</i>
-</pre>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-   <a name="i_shufflevector">'<tt>shufflevector</tt>' Instruction</a>
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  &lt;result&gt; = shufflevector &lt;n x &lt;ty&gt;&gt; &lt;v1&gt;, &lt;n x &lt;ty&gt;&gt; &lt;v2&gt;, &lt;m x i32&gt; &lt;mask&gt;    <i>; yields &lt;m x &lt;ty&gt;&gt;</i>
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>shufflevector</tt>' instruction constructs a permutation of elements
-   from two input vectors, returning a vector with the same element type as the
-   input and length that is the same as the shuffle mask.</p>
-
-<h5>Arguments:</h5>
-<p>The first two operands of a '<tt>shufflevector</tt>' instruction are vectors
-   with types that match each other. The third argument is a shuffle mask whose
-   element type is always 'i32'.  The result of the instruction is a vector
-   whose length is the same as the shuffle mask and whose element type is the
-   same as the element type of the first two operands.</p>
-
-<p>The shuffle mask operand is required to be a constant vector with either
-   constant integer or undef values.</p>
-
-<h5>Semantics:</h5>
-<p>The elements of the two input vectors are numbered from left to right across
-   both of the vectors.  The shuffle mask operand specifies, for each element of
-   the result vector, which element of the two input vectors the result element
-   gets.  The element selector may be undef (meaning "don't care") and the
-   second operand may be undef if performing a shuffle from only one vector.</p>
-
-<h5>Example:</h5>
-<pre>
-  &lt;result&gt; = shufflevector &lt;4 x i32&gt; %v1, &lt;4 x i32&gt; %v2,
-                          &lt;4 x i32&gt; &lt;i32 0, i32 4, i32 1, i32 5&gt;  <i>; yields &lt;4 x i32&gt;</i>
-  &lt;result&gt; = shufflevector &lt;4 x i32&gt; %v1, &lt;4 x i32&gt; undef,
-                          &lt;4 x i32&gt; &lt;i32 0, i32 1, i32 2, i32 3&gt;  <i>; yields &lt;4 x i32&gt;</i> - Identity shuffle.
-  &lt;result&gt; = shufflevector &lt;8 x i32&gt; %v1, &lt;8 x i32&gt; undef,
-                          &lt;4 x i32&gt; &lt;i32 0, i32 1, i32 2, i32 3&gt;  <i>; yields &lt;4 x i32&gt;</i>
-  &lt;result&gt; = shufflevector &lt;4 x i32&gt; %v1, &lt;4 x i32&gt; %v2,
-                          &lt;8 x i32&gt; &lt;i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7 &gt;  <i>; yields &lt;8 x i32&gt;</i>
-</pre>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="aggregateops">Aggregate Operations</a>
-</div>
-
-<div class="doc_text">
-
-<p>LLVM supports several instructions for working with
-  <a href="#t_aggregate">aggregate</a> values.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-   <a name="i_extractvalue">'<tt>extractvalue</tt>' Instruction</a>
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  &lt;result&gt; = extractvalue &lt;aggregate type&gt; &lt;val&gt;, &lt;idx&gt;{, &lt;idx&gt;}*
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>extractvalue</tt>' instruction extracts the value of a member field
-   from an <a href="#t_aggregate">aggregate</a> value.</p>
-
-<h5>Arguments:</h5>
-<p>The first operand of an '<tt>extractvalue</tt>' instruction is a value
-   of <a href="#t_struct">struct</a>, <a href="#t_union">union</a>  or
-   <a href="#t_array">array</a> type.  The operands are constant indices to
-   specify which value to extract in a similar manner as indices in a
-   '<tt><a href="#i_getelementptr">getelementptr</a></tt>' instruction.</p>
-
-<h5>Semantics:</h5>
-<p>The result is the value at the position in the aggregate specified by the
-   index operands.</p>
-
-<h5>Example:</h5>
-<pre>
-  &lt;result&gt; = extractvalue {i32, float} %agg, 0    <i>; yields i32</i>
-</pre>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-   <a name="i_insertvalue">'<tt>insertvalue</tt>' Instruction</a>
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  &lt;result&gt; = insertvalue &lt;aggregate type&gt; &lt;val&gt;, &lt;ty&gt; &lt;elt&gt;, &lt;idx&gt;    <i>; yields &lt;aggregate type&gt;</i>
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>insertvalue</tt>' instruction inserts a value into a member field
-   in an <a href="#t_aggregate">aggregate</a> value.</p>
-
-<h5>Arguments:</h5>
-<p>The first operand of an '<tt>insertvalue</tt>' instruction is a value
-   of <a href="#t_struct">struct</a>, <a href="#t_union">union</a> or
-   <a href="#t_array">array</a> type.  The second operand is a first-class
-   value to insert.  The following operands are constant indices indicating
-   the position at which to insert the value in a similar manner as indices in a
-   '<tt><a href="#i_getelementptr">getelementptr</a></tt>' instruction.  The
-   value to insert must have the same type as the value identified by the
-   indices.</p>
-
-<h5>Semantics:</h5>
-<p>The result is an aggregate of the same type as <tt>val</tt>.  Its value is
-   that of <tt>val</tt> except that the value at the position specified by the
-   indices is that of <tt>elt</tt>.</p>
-
-<h5>Example:</h5>
-<pre>
-  %agg1 = insertvalue {i32, float} undef, i32 1, 0         <i>; yields {i32 1, float undef}</i>
-  %agg2 = insertvalue {i32, float} %agg1, float %val, 1    <i>; yields {i32 1, float %val}</i>
-</pre>
-
-</div>
-
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="memoryops">Memory Access and Addressing Operations</a>
-</div>
-
-<div class="doc_text">
-
-<p>A key design point of an SSA-based representation is how it represents
-   memory.  In LLVM, no memory locations are in SSA form, which makes things
-   very simple.  This section describes how to read, write, and allocate
-   memory in LLVM.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="i_alloca">'<tt>alloca</tt>' Instruction</a>
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  &lt;result&gt; = alloca &lt;type&gt;[, i32 &lt;NumElements&gt;][, align &lt;alignment&gt;]     <i>; yields {type*}:result</i>
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>alloca</tt>' instruction allocates memory on the stack frame of the
-   currently executing function, to be automatically released when this function
-   returns to its caller. The object is always allocated in the generic address
-   space (address space zero).</p>
-
-<h5>Arguments:</h5>
-<p>The '<tt>alloca</tt>' instruction
-   allocates <tt>sizeof(&lt;type&gt;)*NumElements</tt> bytes of memory on the
-   runtime stack, returning a pointer of the appropriate type to the program.
-   If "NumElements" is specified, it is the number of elements allocated,
-   otherwise "NumElements" is defaulted to be one.  If a constant alignment is
-   specified, the value result of the allocation is guaranteed to be aligned to
-   at least that boundary.  If not specified, or if zero, the target can choose
-   to align the allocation on any convenient boundary compatible with the
-   type.</p>
-
-<p>'<tt>type</tt>' may be any sized type.</p>
-
-<h5>Semantics:</h5>
-<p>Memory is allocated; a pointer is returned.  The operation is undefined if
-   there is insufficient stack space for the allocation.  '<tt>alloca</tt>'d
-   memory is automatically released when the function returns.  The
-   '<tt>alloca</tt>' instruction is commonly used to represent automatic
-   variables that must have an address available.  When the function returns
-   (either with the <tt><a href="#i_ret">ret</a></tt>
-   or <tt><a href="#i_unwind">unwind</a></tt> instructions), the memory is
-   reclaimed.  Allocating zero bytes is legal, but the result is undefined.</p>
-
-<h5>Example:</h5>
-<pre>
-  %ptr = alloca i32                             <i>; yields {i32*}:ptr</i>
-  %ptr = alloca i32, i32 4                      <i>; yields {i32*}:ptr</i>
-  %ptr = alloca i32, i32 4, align 1024          <i>; yields {i32*}:ptr</i>
-  %ptr = alloca i32, align 1024                 <i>; yields {i32*}:ptr</i>
-</pre>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection"> <a name="i_load">'<tt>load</tt>'
-Instruction</a> </div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  &lt;result&gt; = load &lt;ty&gt;* &lt;pointer&gt;[, align &lt;alignment&gt;]
-  &lt;result&gt; = volatile load &lt;ty&gt;* &lt;pointer&gt;[, align &lt;alignment&gt;]
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>load</tt>' instruction is used to read from memory.</p>
-
-<h5>Arguments:</h5>
-<p>The argument to the '<tt>load</tt>' instruction specifies the memory address
-   from which to load.  The pointer must point to
-   a <a href="#t_firstclass">first class</a> type.  If the <tt>load</tt> is
-   marked as <tt>volatile</tt>, then the optimizer is not allowed to modify the
-   number or order of execution of this <tt>load</tt> with other
-   volatile <tt>load</tt> and <tt><a href="#i_store">store</a></tt>
-   instructions. </p>
-
-<p>The optional constant "align" argument specifies the alignment of the
-   operation (that is, the alignment of the memory address). A value of 0 or an
-   omitted "align" argument means that the operation has the preferential
-   alignment for the target. It is the responsibility of the code emitter to
-   ensure that the alignment information is correct. Overestimating the
-   alignment results in an undefined behavior. Underestimating the alignment may
-   produce less efficient code. An alignment of 1 is always safe.</p>
-
-<h5>Semantics:</h5>
-<p>The location of memory pointed to is loaded.  If the value being loaded is of
-   scalar type then the number of bytes read does not exceed the minimum number
-   of bytes needed to hold all bits of the type.  For example, loading an
-   <tt>i24</tt> reads at most three bytes.  When loading a value of a type like
-   <tt>i20</tt> with a size that is not an integral number of bytes, the result
-   is undefined if the value was not originally written using a store of the
-   same type.</p>
-
-<h5>Examples:</h5>
-<pre>
-  %ptr = <a href="#i_alloca">alloca</a> i32                               <i>; yields {i32*}:ptr</i>
-  <a href="#i_store">store</a> i32 3, i32* %ptr                          <i>; yields {void}</i>
-  %val = load i32* %ptr                           <i>; yields {i32}:val = i32 3</i>
-</pre>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection"> <a name="i_store">'<tt>store</tt>'
-Instruction</a> </div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  store &lt;ty&gt; &lt;value&gt;, &lt;ty&gt;* &lt;pointer&gt;[, align &lt;alignment&gt;]                   <i>; yields {void}</i>
-  volatile store &lt;ty&gt; &lt;value&gt;, &lt;ty&gt;* &lt;pointer&gt;[, align &lt;alignment&gt;]          <i>; yields {void}</i>
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>store</tt>' instruction is used to write to memory.</p>
-
-<h5>Arguments:</h5>
-<p>There are two arguments to the '<tt>store</tt>' instruction: a value to store
-   and an address at which to store it.  The type of the
-   '<tt>&lt;pointer&gt;</tt>' operand must be a pointer to
-   the <a href="#t_firstclass">first class</a> type of the
-   '<tt>&lt;value&gt;</tt>' operand. If the <tt>store</tt> is marked
-   as <tt>volatile</tt>, then the optimizer is not allowed to modify the number
-   or order of execution of this <tt>store</tt> with other
-   volatile <tt>load</tt> and <tt><a href="#i_store">store</a></tt>
-   instructions.</p>
-
-<p>The optional constant "align" argument specifies the alignment of the
-   operation (that is, the alignment of the memory address). A value of 0 or an
-   omitted "align" argument means that the operation has the preferential
-   alignment for the target. It is the responsibility of the code emitter to
-   ensure that the alignment information is correct. Overestimating the
-   alignment results in an undefined behavior. Underestimating the alignment may
-   produce less efficient code. An alignment of 1 is always safe.</p>
-
-<h5>Semantics:</h5>
-<p>The contents of memory are updated to contain '<tt>&lt;value&gt;</tt>' at the
-   location specified by the '<tt>&lt;pointer&gt;</tt>' operand.  If
-   '<tt>&lt;value&gt;</tt>' is of scalar type then the number of bytes written
-   does not exceed the minimum number of bytes needed to hold all bits of the
-   type.  For example, storing an <tt>i24</tt> writes at most three bytes.  When
-   writing a value of a type like <tt>i20</tt> with a size that is not an
-   integral number of bytes, it is unspecified what happens to the extra bits
-   that do not belong to the type, but they will typically be overwritten.</p>
-
-<h5>Example:</h5>
-<pre>
-  %ptr = <a href="#i_alloca">alloca</a> i32                               <i>; yields {i32*}:ptr</i>
-  store i32 3, i32* %ptr                          <i>; yields {void}</i>
-  %val = <a href="#i_load">load</a> i32* %ptr                           <i>; yields {i32}:val = i32 3</i>
-</pre>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-   <a name="i_getelementptr">'<tt>getelementptr</tt>' Instruction</a>
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  &lt;result&gt; = getelementptr &lt;pty&gt;* &lt;ptrval&gt;{, &lt;ty&gt; &lt;idx&gt;}*
-  &lt;result&gt; = getelementptr inbounds &lt;pty&gt;* &lt;ptrval&gt;{, &lt;ty&gt; &lt;idx&gt;}*
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>getelementptr</tt>' instruction is used to get the address of a
-   subelement of an <a href="#t_aggregate">aggregate</a> data structure.
-   It performs address calculation only and does not access memory.</p>
-
-<h5>Arguments:</h5>
-<p>The first argument is always a pointer, and forms the basis of the
-   calculation. The remaining arguments are indices that indicate which of the
-   elements of the aggregate object are indexed. The interpretation of each
-   index is dependent on the type being indexed into. The first index always
-   indexes the pointer value given as the first argument, the second index
-   indexes a value of the type pointed to (not necessarily the value directly
-   pointed to, since the first index can be non-zero), etc. The first type
-   indexed into must be a pointer value, subsequent types can be arrays,
-   vectors, structs and unions. Note that subsequent types being indexed into
-   can never be pointers, since that would require loading the pointer before
-   continuing calculation.</p>
-
-<p>The type of each index argument depends on the type it is indexing into.
-   When indexing into a (optionally packed) structure or union, only <tt>i32</tt>
-   integer <b>constants</b> are allowed.  When indexing into an array, pointer
-   or vector, integers of any width are allowed, and they are not required to be
-   constant.</p>
-
-<p>For example, let's consider a C code fragment and how it gets compiled to
-   LLVM:</p>
-
-<div class="doc_code">
-<pre>
-struct RT {
-  char A;
-  int B[10][20];
-  char C;
-};
-struct ST {
-  int X;
-  double Y;
-  struct RT Z;
-};
-
-int *foo(struct ST *s) {
-  return &amp;s[1].Z.B[5][13];
-}
-</pre>
-</div>
-
-<p>The LLVM code generated by the GCC frontend is:</p>
-
-<div class="doc_code">
-<pre>
-%RT = <a href="#namedtypes">type</a> { i8 , [10 x [20 x i32]], i8  }
-%ST = <a href="#namedtypes">type</a> { i32, double, %RT }
-
-define i32* @foo(%ST* %s) {
-entry:
-  %reg = getelementptr %ST* %s, i32 1, i32 2, i32 1, i32 5, i32 13
-  ret i32* %reg
-}
-</pre>
-</div>
-
-<h5>Semantics:</h5>
-<p>In the example above, the first index is indexing into the '<tt>%ST*</tt>'
-   type, which is a pointer, yielding a '<tt>%ST</tt>' = '<tt>{ i32, double, %RT
-   }</tt>' type, a structure.  The second index indexes into the third element
-   of the structure, yielding a '<tt>%RT</tt>' = '<tt>{ i8 , [10 x [20 x i32]],
-   i8 }</tt>' type, another structure.  The third index indexes into the second
-   element of the structure, yielding a '<tt>[10 x [20 x i32]]</tt>' type, an
-   array.  The two dimensions of the array are subscripted into, yielding an
-   '<tt>i32</tt>' type.  The '<tt>getelementptr</tt>' instruction returns a
-   pointer to this element, thus computing a value of '<tt>i32*</tt>' type.</p>
-
-<p>Note that it is perfectly legal to index partially through a structure,
-   returning a pointer to an inner element.  Because of this, the LLVM code for
-   the given testcase is equivalent to:</p>
-
-<pre>
-  define i32* @foo(%ST* %s) {
-    %t1 = getelementptr %ST* %s, i32 1                        <i>; yields %ST*:%t1</i>
-    %t2 = getelementptr %ST* %t1, i32 0, i32 2                <i>; yields %RT*:%t2</i>
-    %t3 = getelementptr %RT* %t2, i32 0, i32 1                <i>; yields [10 x [20 x i32]]*:%t3</i>
-    %t4 = getelementptr [10 x [20 x i32]]* %t3, i32 0, i32 5  <i>; yields [20 x i32]*:%t4</i>
-    %t5 = getelementptr [20 x i32]* %t4, i32 0, i32 13        <i>; yields i32*:%t5</i>
-    ret i32* %t5
-  }
-</pre>
-
-<p>If the <tt>inbounds</tt> keyword is present, the result value of the
-   <tt>getelementptr</tt> is undefined if the base pointer is not an
-   <i>in bounds</i> address of an allocated object, or if any of the addresses
-   that would be formed by successive addition of the offsets implied by the
-   indices to the base address with infinitely precise arithmetic are not an
-   <i>in bounds</i> address of that allocated object.
-   The <i>in bounds</i> addresses for an allocated object are all the addresses
-   that point into the object, plus the address one byte past the end.</p>
-
-<p>If the <tt>inbounds</tt> keyword is not present, the offsets are added to
-   the base address with silently-wrapping two's complement arithmetic, and
-   the result value of the <tt>getelementptr</tt> may be outside the object
-   pointed to by the base pointer. The result value may not necessarily be
-   used to access memory though, even if it happens to point into allocated
-   storage. See the <a href="#pointeraliasing">Pointer Aliasing Rules</a>
-   section for more information.</p>
-
-<p>The getelementptr instruction is often confusing.  For some more insight into
-   how it works, see <a href="GetElementPtr.html">the getelementptr FAQ</a>.</p>
-
-<h5>Example:</h5>
-<pre>
-    <i>; yields [12 x i8]*:aptr</i>
-    %aptr = getelementptr {i32, [12 x i8]}* %saptr, i64 0, i32 1
-    <i>; yields i8*:vptr</i>
-    %vptr = getelementptr {i32, &lt;2 x i8&gt;}* %svptr, i64 0, i32 1, i32 1
-    <i>; yields i8*:eptr</i>
-    %eptr = getelementptr [12 x i8]* %aptr, i64 0, i32 1
-    <i>; yields i32*:iptr</i>
-    %iptr = getelementptr [10 x i32]* @arr, i16 0, i16 0
-</pre>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"> <a name="convertops">Conversion Operations</a>
-</div>
-
-<div class="doc_text">
-
-<p>The instructions in this category are the conversion instructions (casting)
-   which all take a single operand and a type. They perform various bit
-   conversions on the operand.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-   <a name="i_trunc">'<tt>trunc .. to</tt>' Instruction</a>
-</div>
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  &lt;result&gt; = trunc &lt;ty&gt; &lt;value&gt; to &lt;ty2&gt;             <i>; yields ty2</i>
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>trunc</tt>' instruction truncates its operand to the
-   type <tt>ty2</tt>.</p>
-
-<h5>Arguments:</h5>
-<p>The '<tt>trunc</tt>' instruction takes a <tt>value</tt> to trunc, which must
-   be an <a href="#t_integer">integer</a> type, and a type that specifies the
-   size and type of the result, which must be
-   an <a href="#t_integer">integer</a> type. The bit size of <tt>value</tt> must
-   be larger than the bit size of <tt>ty2</tt>. Equal sized types are not
-   allowed.</p>
-
-<h5>Semantics:</h5>
-<p>The '<tt>trunc</tt>' instruction truncates the high order bits
-   in <tt>value</tt> and converts the remaining bits to <tt>ty2</tt>. Since the
-   source size must be larger than the destination size, <tt>trunc</tt> cannot
-   be a <i>no-op cast</i>.  It will always truncate bits.</p>
-
-<h5>Example:</h5>
-<pre>
-  %X = trunc i32 257 to i8              <i>; yields i8:1</i>
-  %Y = trunc i32 123 to i1              <i>; yields i1:true</i>
-  %Z = trunc i32 122 to i1              <i>; yields i1:false</i>
-</pre>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-   <a name="i_zext">'<tt>zext .. to</tt>' Instruction</a>
-</div>
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  &lt;result&gt; = zext &lt;ty&gt; &lt;value&gt; to &lt;ty2&gt;             <i>; yields ty2</i>
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>zext</tt>' instruction zero extends its operand to type
-   <tt>ty2</tt>.</p>
-
-
-<h5>Arguments:</h5>
-<p>The '<tt>zext</tt>' instruction takes a value to cast, which must be of
-   <a href="#t_integer">integer</a> type, and a type to cast it to, which must
-   also be of <a href="#t_integer">integer</a> type. The bit size of the
-   <tt>value</tt> must be smaller than the bit size of the destination type,
-   <tt>ty2</tt>.</p>
-
-<h5>Semantics:</h5>
-<p>The <tt>zext</tt> fills the high order bits of the <tt>value</tt> with zero
-   bits until it reaches the size of the destination type, <tt>ty2</tt>.</p>
-
-<p>When zero extending from i1, the result will always be either 0 or 1.</p>
-
-<h5>Example:</h5>
-<pre>
-  %X = zext i32 257 to i64              <i>; yields i64:257</i>
-  %Y = zext i1 true to i32              <i>; yields i32:1</i>
-</pre>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-   <a name="i_sext">'<tt>sext .. to</tt>' Instruction</a>
-</div>
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  &lt;result&gt; = sext &lt;ty&gt; &lt;value&gt; to &lt;ty2&gt;             <i>; yields ty2</i>
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>sext</tt>' sign extends <tt>value</tt> to the type <tt>ty2</tt>.</p>
-
-<h5>Arguments:</h5>
-<p>The '<tt>sext</tt>' instruction takes a value to cast, which must be of
-   <a href="#t_integer">integer</a> type, and a type to cast it to, which must
-   also be of <a href="#t_integer">integer</a> type.  The bit size of the
-   <tt>value</tt> must be smaller than the bit size of the destination type,
-   <tt>ty2</tt>.</p>
-
-<h5>Semantics:</h5>
-<p>The '<tt>sext</tt>' instruction performs a sign extension by copying the sign
-   bit (highest order bit) of the <tt>value</tt> until it reaches the bit size
-   of the type <tt>ty2</tt>.</p>
-
-<p>When sign extending from i1, the extension always results in -1 or 0.</p>
-
-<h5>Example:</h5>
-<pre>
-  %X = sext i8  -1 to i16              <i>; yields i16   :65535</i>
-  %Y = sext i1 true to i32             <i>; yields i32:-1</i>
-</pre>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-   <a name="i_fptrunc">'<tt>fptrunc .. to</tt>' Instruction</a>
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  &lt;result&gt; = fptrunc &lt;ty&gt; &lt;value&gt; to &lt;ty2&gt;             <i>; yields ty2</i>
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>fptrunc</tt>' instruction truncates <tt>value</tt> to type
-   <tt>ty2</tt>.</p>
-
-<h5>Arguments:</h5>
-<p>The '<tt>fptrunc</tt>' instruction takes a <a href="#t_floating">floating
-   point</a> value to cast and a <a href="#t_floating">floating point</a> type
-   to cast it to. The size of <tt>value</tt> must be larger than the size of
-   <tt>ty2</tt>. This implies that <tt>fptrunc</tt> cannot be used to make a
-   <i>no-op cast</i>.</p>
-
-<h5>Semantics:</h5>
-<p>The '<tt>fptrunc</tt>' instruction truncates a <tt>value</tt> from a larger
-   <a href="#t_floating">floating point</a> type to a smaller
-   <a href="#t_floating">floating point</a> type.  If the value cannot fit
-   within the destination type, <tt>ty2</tt>, then the results are
-   undefined.</p>
-
-<h5>Example:</h5>
-<pre>
-  %X = fptrunc double 123.0 to float         <i>; yields float:123.0</i>
-  %Y = fptrunc double 1.0E+300 to float      <i>; yields undefined</i>
-</pre>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-   <a name="i_fpext">'<tt>fpext .. to</tt>' Instruction</a>
-</div>
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  &lt;result&gt; = fpext &lt;ty&gt; &lt;value&gt; to &lt;ty2&gt;             <i>; yields ty2</i>
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>fpext</tt>' extends a floating point <tt>value</tt> to a larger
-   floating point value.</p>
-
-<h5>Arguments:</h5>
-<p>The '<tt>fpext</tt>' instruction takes a
-   <a href="#t_floating">floating point</a> <tt>value</tt> to cast, and
-   a <a href="#t_floating">floating point</a> type to cast it to. The source
-   type must be smaller than the destination type.</p>
-
-<h5>Semantics:</h5>
-<p>The '<tt>fpext</tt>' instruction extends the <tt>value</tt> from a smaller
-   <a href="#t_floating">floating point</a> type to a larger
-   <a href="#t_floating">floating point</a> type. The <tt>fpext</tt> cannot be
-   used to make a <i>no-op cast</i> because it always changes bits. Use
-   <tt>bitcast</tt> to make a <i>no-op cast</i> for a floating point cast.</p>
-
-<h5>Example:</h5>
-<pre>
-  %X = fpext float 3.1415 to double        <i>; yields double:3.1415</i>
-  %Y = fpext float 1.0 to float            <i>; yields float:1.0 (no-op)</i>
-</pre>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-   <a name="i_fptoui">'<tt>fptoui .. to</tt>' Instruction</a>
-</div>
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  &lt;result&gt; = fptoui &lt;ty&gt; &lt;value&gt; to &lt;ty2&gt;             <i>; yields ty2</i>
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>fptoui</tt>' converts a floating point <tt>value</tt> to its
-   unsigned integer equivalent of type <tt>ty2</tt>.</p>
-
-<h5>Arguments:</h5>
-<p>The '<tt>fptoui</tt>' instruction takes a value to cast, which must be a
-   scalar or vector <a href="#t_floating">floating point</a> value, and a type
-   to cast it to <tt>ty2</tt>, which must be an <a href="#t_integer">integer</a>
-   type. If <tt>ty</tt> is a vector floating point type, <tt>ty2</tt> must be a
-   vector integer type with the same number of elements as <tt>ty</tt></p>
-
-<h5>Semantics:</h5>
-<p>The '<tt>fptoui</tt>' instruction converts its
-   <a href="#t_floating">floating point</a> operand into the nearest (rounding
-   towards zero) unsigned integer value. If the value cannot fit
-   in <tt>ty2</tt>, the results are undefined.</p>
-
-<h5>Example:</h5>
-<pre>
-  %X = fptoui double 123.0 to i32      <i>; yields i32:123</i>
-  %Y = fptoui float 1.0E+300 to i1     <i>; yields undefined:1</i>
-  %Z = fptoui float 1.04E+17 to i8     <i>; yields undefined:1</i>
-</pre>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-   <a name="i_fptosi">'<tt>fptosi .. to</tt>' Instruction</a>
-</div>
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  &lt;result&gt; = fptosi &lt;ty&gt; &lt;value&gt; to &lt;ty2&gt;             <i>; yields ty2</i>
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>fptosi</tt>' instruction converts
-   <a href="#t_floating">floating point</a> <tt>value</tt> to
-   type <tt>ty2</tt>.</p>
-
-<h5>Arguments:</h5>
-<p>The '<tt>fptosi</tt>' instruction takes a value to cast, which must be a
-   scalar or vector <a href="#t_floating">floating point</a> value, and a type
-   to cast it to <tt>ty2</tt>, which must be an <a href="#t_integer">integer</a>
-   type. If <tt>ty</tt> is a vector floating point type, <tt>ty2</tt> must be a
-   vector integer type with the same number of elements as <tt>ty</tt></p>
-
-<h5>Semantics:</h5>
-<p>The '<tt>fptosi</tt>' instruction converts its
-   <a href="#t_floating">floating point</a> operand into the nearest (rounding
-   towards zero) signed integer value. If the value cannot fit in <tt>ty2</tt>,
-   the results are undefined.</p>
-
-<h5>Example:</h5>
-<pre>
-  %X = fptosi double -123.0 to i32      <i>; yields i32:-123</i>
-  %Y = fptosi float 1.0E-247 to i1      <i>; yields undefined:1</i>
-  %Z = fptosi float 1.04E+17 to i8      <i>; yields undefined:1</i>
-</pre>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-   <a name="i_uitofp">'<tt>uitofp .. to</tt>' Instruction</a>
-</div>
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  &lt;result&gt; = uitofp &lt;ty&gt; &lt;value&gt; to &lt;ty2&gt;             <i>; yields ty2</i>
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>uitofp</tt>' instruction regards <tt>value</tt> as an unsigned
-   integer and converts that value to the <tt>ty2</tt> type.</p>
-
-<h5>Arguments:</h5>
-<p>The '<tt>uitofp</tt>' instruction takes a value to cast, which must be a
-   scalar or vector <a href="#t_integer">integer</a> value, and a type to cast
-   it to <tt>ty2</tt>, which must be an <a href="#t_floating">floating point</a>
-   type. If <tt>ty</tt> is a vector integer type, <tt>ty2</tt> must be a vector
-   floating point type with the same number of elements as <tt>ty</tt></p>
-
-<h5>Semantics:</h5>
-<p>The '<tt>uitofp</tt>' instruction interprets its operand as an unsigned
-   integer quantity and converts it to the corresponding floating point
-   value. If the value cannot fit in the floating point value, the results are
-   undefined.</p>
-
-<h5>Example:</h5>
-<pre>
-  %X = uitofp i32 257 to float         <i>; yields float:257.0</i>
-  %Y = uitofp i8 -1 to double          <i>; yields double:255.0</i>
-</pre>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-   <a name="i_sitofp">'<tt>sitofp .. to</tt>' Instruction</a>
-</div>
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  &lt;result&gt; = sitofp &lt;ty&gt; &lt;value&gt; to &lt;ty2&gt;             <i>; yields ty2</i>
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>sitofp</tt>' instruction regards <tt>value</tt> as a signed integer
-   and converts that value to the <tt>ty2</tt> type.</p>
-
-<h5>Arguments:</h5>
-<p>The '<tt>sitofp</tt>' instruction takes a value to cast, which must be a
-   scalar or vector <a href="#t_integer">integer</a> value, and a type to cast
-   it to <tt>ty2</tt>, which must be an <a href="#t_floating">floating point</a>
-   type. If <tt>ty</tt> is a vector integer type, <tt>ty2</tt> must be a vector
-   floating point type with the same number of elements as <tt>ty</tt></p>
-
-<h5>Semantics:</h5>
-<p>The '<tt>sitofp</tt>' instruction interprets its operand as a signed integer
-   quantity and converts it to the corresponding floating point value. If the
-   value cannot fit in the floating point value, the results are undefined.</p>
-
-<h5>Example:</h5>
-<pre>
-  %X = sitofp i32 257 to float         <i>; yields float:257.0</i>
-  %Y = sitofp i8 -1 to double          <i>; yields double:-1.0</i>
-</pre>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-   <a name="i_ptrtoint">'<tt>ptrtoint .. to</tt>' Instruction</a>
-</div>
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  &lt;result&gt; = ptrtoint &lt;ty&gt; &lt;value&gt; to &lt;ty2&gt;             <i>; yields ty2</i>
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>ptrtoint</tt>' instruction converts the pointer <tt>value</tt> to
-   the integer type <tt>ty2</tt>.</p>
-
-<h5>Arguments:</h5>
-<p>The '<tt>ptrtoint</tt>' instruction takes a <tt>value</tt> to cast, which
-   must be a <a href="#t_pointer">pointer</a> value, and a type to cast it to
-   <tt>ty2</tt>, which must be an <a href="#t_integer">integer</a> type.</p>
-
-<h5>Semantics:</h5>
-<p>The '<tt>ptrtoint</tt>' instruction converts <tt>value</tt> to integer type
-   <tt>ty2</tt> by interpreting the pointer value as an integer and either
-   truncating or zero extending that value to the size of the integer type. If
-   <tt>value</tt> is smaller than <tt>ty2</tt> then a zero extension is done. If
-   <tt>value</tt> is larger than <tt>ty2</tt> then a truncation is done. If they
-   are the same size, then nothing is done (<i>no-op cast</i>) other than a type
-   change.</p>
-
-<h5>Example:</h5>
-<pre>
-  %X = ptrtoint i32* %X to i8           <i>; yields truncation on 32-bit architecture</i>
-  %Y = ptrtoint i32* %x to i64          <i>; yields zero extension on 32-bit architecture</i>
-</pre>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-   <a name="i_inttoptr">'<tt>inttoptr .. to</tt>' Instruction</a>
-</div>
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  &lt;result&gt; = inttoptr &lt;ty&gt; &lt;value&gt; to &lt;ty2&gt;             <i>; yields ty2</i>
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>inttoptr</tt>' instruction converts an integer <tt>value</tt> to a
-   pointer type, <tt>ty2</tt>.</p>
-
-<h5>Arguments:</h5>
-<p>The '<tt>inttoptr</tt>' instruction takes an <a href="#t_integer">integer</a>
-   value to cast, and a type to cast it to, which must be a
-   <a href="#t_pointer">pointer</a> type.</p>
-
-<h5>Semantics:</h5>
-<p>The '<tt>inttoptr</tt>' instruction converts <tt>value</tt> to type
-   <tt>ty2</tt> by applying either a zero extension or a truncation depending on
-   the size of the integer <tt>value</tt>. If <tt>value</tt> is larger than the
-   size of a pointer then a truncation is done. If <tt>value</tt> is smaller
-   than the size of a pointer then a zero extension is done. If they are the
-   same size, nothing is done (<i>no-op cast</i>).</p>
-
-<h5>Example:</h5>
-<pre>
-  %X = inttoptr i32 255 to i32*          <i>; yields zero extension on 64-bit architecture</i>
-  %Y = inttoptr i32 255 to i32*          <i>; yields no-op on 32-bit architecture</i>
-  %Z = inttoptr i64 0 to i32*            <i>; yields truncation on 32-bit architecture</i>
-</pre>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-   <a name="i_bitcast">'<tt>bitcast .. to</tt>' Instruction</a>
-</div>
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  &lt;result&gt; = bitcast &lt;ty&gt; &lt;value&gt; to &lt;ty2&gt;             <i>; yields ty2</i>
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>bitcast</tt>' instruction converts <tt>value</tt> to type
-   <tt>ty2</tt> without changing any bits.</p>
-
-<h5>Arguments:</h5>
-<p>The '<tt>bitcast</tt>' instruction takes a value to cast, which must be a
-   non-aggregate first class value, and a type to cast it to, which must also be
-   a non-aggregate <a href="#t_firstclass">first class</a> type. The bit sizes
-   of <tt>value</tt> and the destination type, <tt>ty2</tt>, must be
-   identical. If the source type is a pointer, the destination type must also be
-   a pointer.  This instruction supports bitwise conversion of vectors to
-   integers and to vectors of other types (as long as they have the same
-   size).</p>
-
-<h5>Semantics:</h5>
-<p>The '<tt>bitcast</tt>' instruction converts <tt>value</tt> to type
-   <tt>ty2</tt>. It is always a <i>no-op cast</i> because no bits change with
-   this conversion.  The conversion is done as if the <tt>value</tt> had been
-   stored to memory and read back as type <tt>ty2</tt>. Pointer types may only
-   be converted to other pointer types with this instruction. To convert
-   pointers to other types, use the <a href="#i_inttoptr">inttoptr</a> or
-   <a href="#i_ptrtoint">ptrtoint</a> instructions first.</p>
-
-<h5>Example:</h5>
-<pre>
-  %X = bitcast i8 255 to i8              <i>; yields i8 :-1</i>
-  %Y = bitcast i32* %x to sint*          <i>; yields sint*:%x</i>
-  %Z = bitcast &lt;2 x int&gt; %V to i64;      <i>; yields i64: %V</i>
-</pre>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"> <a name="otherops">Other Operations</a> </div>
-
-<div class="doc_text">
-
-<p>The instructions in this category are the "miscellaneous" instructions, which
-   defy better classification.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection"><a name="i_icmp">'<tt>icmp</tt>' Instruction</a>
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  &lt;result&gt; = icmp &lt;cond&gt; &lt;ty&gt; &lt;op1&gt;, &lt;op2&gt;   <i>; yields {i1} or {&lt;N x i1&gt;}:result</i>
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>icmp</tt>' instruction returns a boolean value or a vector of
-   boolean values based on comparison of its two integer, integer vector, or
-   pointer operands.</p>
-
-<h5>Arguments:</h5>
-<p>The '<tt>icmp</tt>' instruction takes three operands. The first operand is
-   the condition code indicating the kind of comparison to perform. It is not a
-   value, just a keyword. The possible condition code are:</p>
-
-<ol>
-  <li><tt>eq</tt>: equal</li>
-  <li><tt>ne</tt>: not equal </li>
-  <li><tt>ugt</tt>: unsigned greater than</li>
-  <li><tt>uge</tt>: unsigned greater or equal</li>
-  <li><tt>ult</tt>: unsigned less than</li>
-  <li><tt>ule</tt>: unsigned less or equal</li>
-  <li><tt>sgt</tt>: signed greater than</li>
-  <li><tt>sge</tt>: signed greater or equal</li>
-  <li><tt>slt</tt>: signed less than</li>
-  <li><tt>sle</tt>: signed less or equal</li>
-</ol>
-
-<p>The remaining two arguments must be <a href="#t_integer">integer</a> or
-   <a href="#t_pointer">pointer</a> or integer <a href="#t_vector">vector</a>
-   typed.  They must also be identical types.</p>
-
-<h5>Semantics:</h5>
-<p>The '<tt>icmp</tt>' compares <tt>op1</tt> and <tt>op2</tt> according to the
-   condition code given as <tt>cond</tt>. The comparison performed always yields
-   either an <a href="#t_integer"><tt>i1</tt></a> or vector of <tt>i1</tt>
-   result, as follows:</p>
-
-<ol>
-  <li><tt>eq</tt>: yields <tt>true</tt> if the operands are equal,
-      <tt>false</tt> otherwise. No sign interpretation is necessary or
-      performed.</li>
-
-  <li><tt>ne</tt>: yields <tt>true</tt> if the operands are unequal,
-      <tt>false</tt> otherwise. No sign interpretation is necessary or
-      performed.</li>
-
-  <li><tt>ugt</tt>: interprets the operands as unsigned values and yields
-      <tt>true</tt> if <tt>op1</tt> is greater than <tt>op2</tt>.</li>
-
-  <li><tt>uge</tt>: interprets the operands as unsigned values and yields
-      <tt>true</tt> if <tt>op1</tt> is greater than or equal
-      to <tt>op2</tt>.</li>
-
-  <li><tt>ult</tt>: interprets the operands as unsigned values and yields
-      <tt>true</tt> if <tt>op1</tt> is less than <tt>op2</tt>.</li>
-
-  <li><tt>ule</tt>: interprets the operands as unsigned values and yields
-      <tt>true</tt> if <tt>op1</tt> is less than or equal to <tt>op2</tt>.</li>
-
-  <li><tt>sgt</tt>: interprets the operands as signed values and yields
-      <tt>true</tt> if <tt>op1</tt> is greater than <tt>op2</tt>.</li>
-
-  <li><tt>sge</tt>: interprets the operands as signed values and yields
-      <tt>true</tt> if <tt>op1</tt> is greater than or equal
-      to <tt>op2</tt>.</li>
-
-  <li><tt>slt</tt>: interprets the operands as signed values and yields
-      <tt>true</tt> if <tt>op1</tt> is less than <tt>op2</tt>.</li>
-
-  <li><tt>sle</tt>: interprets the operands as signed values and yields
-      <tt>true</tt> if <tt>op1</tt> is less than or equal to <tt>op2</tt>.</li>
-</ol>
-
-<p>If the operands are <a href="#t_pointer">pointer</a> typed, the pointer
-   values are compared as if they were integers.</p>
-
-<p>If the operands are integer vectors, then they are compared element by
-   element. The result is an <tt>i1</tt> vector with the same number of elements
-   as the values being compared.  Otherwise, the result is an <tt>i1</tt>.</p>
-
-<h5>Example:</h5>
-<pre>
-  &lt;result&gt; = icmp eq i32 4, 5          <i>; yields: result=false</i>
-  &lt;result&gt; = icmp ne float* %X, %X     <i>; yields: result=false</i>
-  &lt;result&gt; = icmp ult i16  4, 5        <i>; yields: result=true</i>
-  &lt;result&gt; = icmp sgt i16  4, 5        <i>; yields: result=false</i>
-  &lt;result&gt; = icmp ule i16 -4, 5        <i>; yields: result=false</i>
-  &lt;result&gt; = icmp sge i16  4, 5        <i>; yields: result=false</i>
-</pre>
-
-<p>Note that the code generator does not yet support vector types with
-   the <tt>icmp</tt> instruction.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection"><a name="i_fcmp">'<tt>fcmp</tt>' Instruction</a>
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  &lt;result&gt; = fcmp &lt;cond&gt; &lt;ty&gt; &lt;op1&gt;, &lt;op2&gt;     <i>; yields {i1} or {&lt;N x i1&gt;}:result</i>
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>fcmp</tt>' instruction returns a boolean value or vector of boolean
-   values based on comparison of its operands.</p>
-
-<p>If the operands are floating point scalars, then the result type is a boolean
-(<a href="#t_integer"><tt>i1</tt></a>).</p>
-
-<p>If the operands are floating point vectors, then the result type is a vector
-   of boolean with the same number of elements as the operands being
-   compared.</p>
-
-<h5>Arguments:</h5>
-<p>The '<tt>fcmp</tt>' instruction takes three operands. The first operand is
-   the condition code indicating the kind of comparison to perform. It is not a
-   value, just a keyword. The possible condition code are:</p>
-
-<ol>
-  <li><tt>false</tt>: no comparison, always returns false</li>
-  <li><tt>oeq</tt>: ordered and equal</li>
-  <li><tt>ogt</tt>: ordered and greater than </li>
-  <li><tt>oge</tt>: ordered and greater than or equal</li>
-  <li><tt>olt</tt>: ordered and less than </li>
-  <li><tt>ole</tt>: ordered and less than or equal</li>
-  <li><tt>one</tt>: ordered and not equal</li>
-  <li><tt>ord</tt>: ordered (no nans)</li>
-  <li><tt>ueq</tt>: unordered or equal</li>
-  <li><tt>ugt</tt>: unordered or greater than </li>
-  <li><tt>uge</tt>: unordered or greater than or equal</li>
-  <li><tt>ult</tt>: unordered or less than </li>
-  <li><tt>ule</tt>: unordered or less than or equal</li>
-  <li><tt>une</tt>: unordered or not equal</li>
-  <li><tt>uno</tt>: unordered (either nans)</li>
-  <li><tt>true</tt>: no comparison, always returns true</li>
-</ol>
-
-<p><i>Ordered</i> means that neither operand is a QNAN while
-   <i>unordered</i> means that either operand may be a QNAN.</p>
-
-<p>Each of <tt>val1</tt> and <tt>val2</tt> arguments must be either
-   a <a href="#t_floating">floating point</a> type or
-   a <a href="#t_vector">vector</a> of floating point type.  They must have
-   identical types.</p>
-
-<h5>Semantics:</h5>
-<p>The '<tt>fcmp</tt>' instruction compares <tt>op1</tt> and <tt>op2</tt>
-   according to the condition code given as <tt>cond</tt>.  If the operands are
-   vectors, then the vectors are compared element by element.  Each comparison
-   performed always yields an <a href="#t_integer">i1</a> result, as
-   follows:</p>
-
-<ol>
-  <li><tt>false</tt>: always yields <tt>false</tt>, regardless of operands.</li>
-
-  <li><tt>oeq</tt>: yields <tt>true</tt> if both operands are not a QNAN and
-      <tt>op1</tt> is equal to <tt>op2</tt>.</li>
-
-  <li><tt>ogt</tt>: yields <tt>true</tt> if both operands are not a QNAN and
-      <tt>op1</tt> is greather than <tt>op2</tt>.</li>
-
-  <li><tt>oge</tt>: yields <tt>true</tt> if both operands are not a QNAN and
-      <tt>op1</tt> is greater than or equal to <tt>op2</tt>.</li>
-
-  <li><tt>olt</tt>: yields <tt>true</tt> if both operands are not a QNAN and
-      <tt>op1</tt> is less than <tt>op2</tt>.</li>
-
-  <li><tt>ole</tt>: yields <tt>true</tt> if both operands are not a QNAN and
-      <tt>op1</tt> is less than or equal to <tt>op2</tt>.</li>
-
-  <li><tt>one</tt>: yields <tt>true</tt> if both operands are not a QNAN and
-      <tt>op1</tt> is not equal to <tt>op2</tt>.</li>
-
-  <li><tt>ord</tt>: yields <tt>true</tt> if both operands are not a QNAN.</li>
-
-  <li><tt>ueq</tt>: yields <tt>true</tt> if either operand is a QNAN or
-      <tt>op1</tt> is equal to <tt>op2</tt>.</li>
-
-  <li><tt>ugt</tt>: yields <tt>true</tt> if either operand is a QNAN or
-      <tt>op1</tt> is greater than <tt>op2</tt>.</li>
-
-  <li><tt>uge</tt>: yields <tt>true</tt> if either operand is a QNAN or
-      <tt>op1</tt> is greater than or equal to <tt>op2</tt>.</li>
-
-  <li><tt>ult</tt>: yields <tt>true</tt> if either operand is a QNAN or
-      <tt>op1</tt> is less than <tt>op2</tt>.</li>
-
-  <li><tt>ule</tt>: yields <tt>true</tt> if either operand is a QNAN or
-      <tt>op1</tt> is less than or equal to <tt>op2</tt>.</li>
-
-  <li><tt>une</tt>: yields <tt>true</tt> if either operand is a QNAN or
-      <tt>op1</tt> is not equal to <tt>op2</tt>.</li>
-
-  <li><tt>uno</tt>: yields <tt>true</tt> if either operand is a QNAN.</li>
-
-  <li><tt>true</tt>: always yields <tt>true</tt>, regardless of operands.</li>
-</ol>
-
-<h5>Example:</h5>
-<pre>
-  &lt;result&gt; = fcmp oeq float 4.0, 5.0    <i>; yields: result=false</i>
-  &lt;result&gt; = fcmp one float 4.0, 5.0    <i>; yields: result=true</i>
-  &lt;result&gt; = fcmp olt float 4.0, 5.0    <i>; yields: result=true</i>
-  &lt;result&gt; = fcmp ueq double 1.0, 2.0   <i>; yields: result=false</i>
-</pre>
-
-<p>Note that the code generator does not yet support vector types with
-   the <tt>fcmp</tt> instruction.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="i_phi">'<tt>phi</tt>' Instruction</a>
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  &lt;result&gt; = phi &lt;ty&gt; [ &lt;val0&gt;, &lt;label0&gt;], ...
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>phi</tt>' instruction is used to implement the &#966; node in the
-   SSA graph representing the function.</p>
-
-<h5>Arguments:</h5>
-<p>The type of the incoming values is specified with the first type field. After
-   this, the '<tt>phi</tt>' instruction takes a list of pairs as arguments, with
-   one pair for each predecessor basic block of the current block.  Only values
-   of <a href="#t_firstclass">first class</a> type may be used as the value
-   arguments to the PHI node.  Only labels may be used as the label
-   arguments.</p>
-
-<p>There must be no non-phi instructions between the start of a basic block and
-   the PHI instructions: i.e. PHI instructions must be first in a basic
-   block.</p>
-
-<p>For the purposes of the SSA form, the use of each incoming value is deemed to
-   occur on the edge from the corresponding predecessor block to the current
-   block (but after any definition of an '<tt>invoke</tt>' instruction's return
-   value on the same edge).</p>
-
-<h5>Semantics:</h5>
-<p>At runtime, the '<tt>phi</tt>' instruction logically takes on the value
-   specified by the pair corresponding to the predecessor basic block that
-   executed just prior to the current block.</p>
-
-<h5>Example:</h5>
-<pre>
-Loop:       ; Infinite loop that counts from 0 on up...
-  %indvar = phi i32 [ 0, %LoopHeader ], [ %nextindvar, %Loop ]
-  %nextindvar = add i32 %indvar, 1
-  br label %Loop
-</pre>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-   <a name="i_select">'<tt>select</tt>' Instruction</a>
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  &lt;result&gt; = select <i>selty</i> &lt;cond&gt;, &lt;ty&gt; &lt;val1&gt;, &lt;ty&gt; &lt;val2&gt;             <i>; yields ty</i>
-
-  <i>selty</i> is either i1 or {&lt;N x i1&gt;}
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>select</tt>' instruction is used to choose one value based on a
-   condition, without branching.</p>
-
-
-<h5>Arguments:</h5>
-<p>The '<tt>select</tt>' instruction requires an 'i1' value or a vector of 'i1'
-   values indicating the condition, and two values of the
-   same <a href="#t_firstclass">first class</a> type.  If the val1/val2 are
-   vectors and the condition is a scalar, then entire vectors are selected, not
-   individual elements.</p>
-
-<h5>Semantics:</h5>
-<p>If the condition is an i1 and it evaluates to 1, the instruction returns the
-   first value argument; otherwise, it returns the second value argument.</p>
-
-<p>If the condition is a vector of i1, then the value arguments must be vectors
-   of the same size, and the selection is done element by element.</p>
-
-<h5>Example:</h5>
-<pre>
-  %X = select i1 true, i8 17, i8 42          <i>; yields i8:17</i>
-</pre>
-
-<p>Note that the code generator does not yet support conditions
-   with vector type.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="i_call">'<tt>call</tt>' Instruction</a>
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  &lt;result&gt; = [tail] call [<a href="#callingconv">cconv</a>] [<a href="#paramattrs">ret attrs</a>] &lt;ty&gt; [&lt;fnty&gt;*] &lt;fnptrval&gt;(&lt;function args&gt;) [<a href="#fnattrs">fn attrs</a>]
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>call</tt>' instruction represents a simple function call.</p>
-
-<h5>Arguments:</h5>
-<p>This instruction requires several arguments:</p>
-
-<ol>
-  <li>The optional "tail" marker indicates that the callee function does not
-      access any allocas or varargs in the caller.  Note that calls may be
-      marked "tail" even if they do not occur before
-      a <a href="#i_ret"><tt>ret</tt></a> instruction.  If the "tail" marker is
-      present, the function call is eligible for tail call optimization,
-      but <a href="CodeGenerator.html#tailcallopt">might not in fact be
-      optimized into a jump</a>.  As of this writing, the extra requirements for
-      a call to actually be optimized are:
-      <ul>
-        <li>Caller and callee both have the calling
-            convention <tt>fastcc</tt>.</li>
-        <li>The call is in tail position (ret immediately follows call and ret
-            uses value of call or is void).</li>
-        <li>Option <tt>-tailcallopt</tt> is enabled,
-            or <code>llvm::PerformTailCallOpt</code> is <code>true</code>.</li>
-        <li><a href="CodeGenerator.html#tailcallopt">Platform specific
-            constraints are met.</a></li>
-      </ul>
-  </li>
-
-  <li>The optional "cconv" marker indicates which <a href="#callingconv">calling
-      convention</a> the call should use.  If none is specified, the call
-      defaults to using C calling conventions.  The calling convention of the
-      call must match the calling convention of the target function, or else the
-      behavior is undefined.</li>
-
-  <li>The optional <a href="#paramattrs">Parameter Attributes</a> list for
-      return values. Only '<tt>zeroext</tt>', '<tt>signext</tt>', and
-      '<tt>inreg</tt>' attributes are valid here.</li>
-
-  <li>'<tt>ty</tt>': the type of the call instruction itself which is also the
-      type of the return value.  Functions that return no value are marked
-      <tt><a href="#t_void">void</a></tt>.</li>
-
-  <li>'<tt>fnty</tt>': shall be the signature of the pointer to function value
-      being invoked.  The argument types must match the types implied by this
-      signature.  This type can be omitted if the function is not varargs and if
-      the function type does not return a pointer to a function.</li>
-
-  <li>'<tt>fnptrval</tt>': An LLVM value containing a pointer to a function to
-      be invoked. In most cases, this is a direct function invocation, but
-      indirect <tt>call</tt>s are just as possible, calling an arbitrary pointer
-      to function value.</li>
-
-  <li>'<tt>function args</tt>': argument list whose types match the function
-      signature argument types. All arguments must be of
-      <a href="#t_firstclass">first class</a> type. If the function signature
-      indicates the function accepts a variable number of arguments, the extra
-      arguments can be specified.</li>
-
-  <li>The optional <a href="#fnattrs">function attributes</a> list. Only
-      '<tt>noreturn</tt>', '<tt>nounwind</tt>', '<tt>readonly</tt>' and
-      '<tt>readnone</tt>' attributes are valid here.</li>
-</ol>
-
-<h5>Semantics:</h5>
-<p>The '<tt>call</tt>' instruction is used to cause control flow to transfer to
-   a specified function, with its incoming arguments bound to the specified
-   values. Upon a '<tt><a href="#i_ret">ret</a></tt>' instruction in the called
-   function, control flow continues with the instruction after the function
-   call, and the return value of the function is bound to the result
-   argument.</p>
-
-<h5>Example:</h5>
-<pre>
-  %retval = call i32 @test(i32 %argc)
-  call i32 (i8 *, ...)* @printf(i8 * %msg, i32 12, i8 42)      <i>; yields i32</i>
-  %X = tail call i32 @foo()                                    <i>; yields i32</i>
-  %Y = tail call <a href="#callingconv">fastcc</a> i32 @foo()  <i>; yields i32</i>
-  call void %foo(i8 97 signext)
-
-  %struct.A = type { i32, i8 }
-  %r = call %struct.A @foo()                        <i>; yields { 32, i8 }</i>
-  %gr = extractvalue %struct.A %r, 0                <i>; yields i32</i>
-  %gr1 = extractvalue %struct.A %r, 1               <i>; yields i8</i>
-  %Z = call void @foo() noreturn                    <i>; indicates that %foo never returns normally</i>
-  %ZZ = call zeroext i32 @bar()                     <i>; Return value is %zero extended</i>
-</pre>
-
-<p>llvm treats calls to some functions with names and arguments that match the
-standard C99 library as being the C99 library functions, and may perform
-optimizations or generate code for them under that assumption.  This is
-something we'd like to change in the future to provide better support for
-freestanding environments and non-C-based langauges.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="i_va_arg">'<tt>va_arg</tt>' Instruction</a>
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  &lt;resultval&gt; = va_arg &lt;va_list*&gt; &lt;arglist&gt;, &lt;argty&gt;
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>va_arg</tt>' instruction is used to access arguments passed through
-   the "variable argument" area of a function call.  It is used to implement the
-   <tt>va_arg</tt> macro in C.</p>
-
-<h5>Arguments:</h5>
-<p>This instruction takes a <tt>va_list*</tt> value and the type of the
-   argument. It returns a value of the specified argument type and increments
-   the <tt>va_list</tt> to point to the next argument.  The actual type
-   of <tt>va_list</tt> is target specific.</p>
-
-<h5>Semantics:</h5>
-<p>The '<tt>va_arg</tt>' instruction loads an argument of the specified type
-   from the specified <tt>va_list</tt> and causes the <tt>va_list</tt> to point
-   to the next argument.  For more information, see the variable argument
-   handling <a href="#int_varargs">Intrinsic Functions</a>.</p>
-
-<p>It is legal for this instruction to be called in a function which does not
-   take a variable number of arguments, for example, the <tt>vfprintf</tt>
-   function.</p>
-
-<p><tt>va_arg</tt> is an LLVM instruction instead of
-   an <a href="#intrinsics">intrinsic function</a> because it takes a type as an
-   argument.</p>
-
-<h5>Example:</h5>
-<p>See the <a href="#int_varargs">variable argument processing</a> section.</p>
-
-<p>Note that the code generator does not yet fully support va_arg on many
-   targets. Also, it does not currently support va_arg with aggregate types on
-   any target.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"> <a name="intrinsics">Intrinsic Functions</a> </div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>LLVM supports the notion of an "intrinsic function".  These functions have
-   well known names and semantics and are required to follow certain
-   restrictions.  Overall, these intrinsics represent an extension mechanism for
-   the LLVM language that does not require changing all of the transformations
-   in LLVM when adding to the language (or the bitcode reader/writer, the
-   parser, etc...).</p>
-
-<p>Intrinsic function names must all start with an "<tt>llvm.</tt>" prefix. This
-   prefix is reserved in LLVM for intrinsic names; thus, function names may not
-   begin with this prefix.  Intrinsic functions must always be external
-   functions: you cannot define the body of intrinsic functions.  Intrinsic
-   functions may only be used in call or invoke instructions: it is illegal to
-   take the address of an intrinsic function.  Additionally, because intrinsic
-   functions are part of the LLVM language, it is required if any are added that
-   they be documented here.</p>
-
-<p>Some intrinsic functions can be overloaded, i.e., the intrinsic represents a
-   family of functions that perform the same operation but on different data
-   types. Because LLVM can represent over 8 million different integer types,
-   overloading is used commonly to allow an intrinsic function to operate on any
-   integer type. One or more of the argument types or the result type can be
-   overloaded to accept any integer type. Argument types may also be defined as
-   exactly matching a previous argument's type or the result type. This allows
-   an intrinsic function which accepts multiple arguments, but needs all of them
-   to be of the same type, to only be overloaded with respect to a single
-   argument or the result.</p>
-
-<p>Overloaded intrinsics will have the names of its overloaded argument types
-   encoded into its function name, each preceded by a period. Only those types
-   which are overloaded result in a name suffix. Arguments whose type is matched
-   against another type do not. For example, the <tt>llvm.ctpop</tt> function
-   can take an integer of any width and returns an integer of exactly the same
-   integer width. This leads to a family of functions such as
-   <tt>i8 @llvm.ctpop.i8(i8 %val)</tt> and <tt>i29 @llvm.ctpop.i29(i29
-   %val)</tt>.  Only one type, the return type, is overloaded, and only one type
-   suffix is required. Because the argument's type is matched against the return
-   type, it does not require its own name suffix.</p>
-
-<p>To learn how to add an intrinsic function, please see the
-   <a href="ExtendingLLVM.html">Extending LLVM Guide</a>.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="int_varargs">Variable Argument Handling Intrinsics</a>
-</div>
-
-<div class="doc_text">
-
-<p>Variable argument support is defined in LLVM with
-   the <a href="#i_va_arg"><tt>va_arg</tt></a> instruction and these three
-   intrinsic functions.  These functions are related to the similarly named
-   macros defined in the <tt>&lt;stdarg.h&gt;</tt> header file.</p>
-
-<p>All of these functions operate on arguments that use a target-specific value
-   type "<tt>va_list</tt>".  The LLVM assembly language reference manual does
-   not define what this type is, so all transformations should be prepared to
-   handle these functions regardless of the type used.</p>
-
-<p>This example shows how the <a href="#i_va_arg"><tt>va_arg</tt></a>
-   instruction and the variable argument handling intrinsic functions are
-   used.</p>
-
-<div class="doc_code">
-<pre>
-define i32 @test(i32 %X, ...) {
-  ; Initialize variable argument processing
-  %ap = alloca i8*
-  %ap2 = bitcast i8** %ap to i8*
-  call void @llvm.va_start(i8* %ap2)
-
-  ; Read a single integer argument
-  %tmp = va_arg i8** %ap, i32
-
-  ; Demonstrate usage of llvm.va_copy and llvm.va_end
-  %aq = alloca i8*
-  %aq2 = bitcast i8** %aq to i8*
-  call void @llvm.va_copy(i8* %aq2, i8* %ap2)
-  call void @llvm.va_end(i8* %aq2)
-
-  ; Stop processing of arguments.
-  call void @llvm.va_end(i8* %ap2)
-  ret i32 %tmp
-}
-
-declare void @llvm.va_start(i8*)
-declare void @llvm.va_copy(i8*, i8*)
-declare void @llvm.va_end(i8*)
-</pre>
-</div>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="int_va_start">'<tt>llvm.va_start</tt>' Intrinsic</a>
-</div>
-
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  declare void %llvm.va_start(i8* &lt;arglist&gt;)
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>llvm.va_start</tt>' intrinsic initializes <tt>*&lt;arglist&gt;</tt>
-   for subsequent use by <tt><a href="#i_va_arg">va_arg</a></tt>.</p>
-
-<h5>Arguments:</h5>
-<p>The argument is a pointer to a <tt>va_list</tt> element to initialize.</p>
-
-<h5>Semantics:</h5>
-<p>The '<tt>llvm.va_start</tt>' intrinsic works just like the <tt>va_start</tt>
-   macro available in C.  In a target-dependent way, it initializes
-   the <tt>va_list</tt> element to which the argument points, so that the next
-   call to <tt>va_arg</tt> will produce the first variable argument passed to
-   the function.  Unlike the C <tt>va_start</tt> macro, this intrinsic does not
-   need to know the last argument of the function as the compiler can figure
-   that out.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
- <a name="int_va_end">'<tt>llvm.va_end</tt>' Intrinsic</a>
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  declare void @llvm.va_end(i8* &lt;arglist&gt;)
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>llvm.va_end</tt>' intrinsic destroys <tt>*&lt;arglist&gt;</tt>,
-   which has been initialized previously
-   with <tt><a href="#int_va_start">llvm.va_start</a></tt>
-   or <tt><a href="#i_va_copy">llvm.va_copy</a></tt>.</p>
-
-<h5>Arguments:</h5>
-<p>The argument is a pointer to a <tt>va_list</tt> to destroy.</p>
-
-<h5>Semantics:</h5>
-<p>The '<tt>llvm.va_end</tt>' intrinsic works just like the <tt>va_end</tt>
-   macro available in C.  In a target-dependent way, it destroys
-   the <tt>va_list</tt> element to which the argument points.  Calls
-   to <a href="#int_va_start"><tt>llvm.va_start</tt></a>
-   and <a href="#int_va_copy"> <tt>llvm.va_copy</tt></a> must be matched exactly
-   with calls to <tt>llvm.va_end</tt>.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="int_va_copy">'<tt>llvm.va_copy</tt>' Intrinsic</a>
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  declare void @llvm.va_copy(i8* &lt;destarglist&gt;, i8* &lt;srcarglist&gt;)
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>llvm.va_copy</tt>' intrinsic copies the current argument position
-   from the source argument list to the destination argument list.</p>
-
-<h5>Arguments:</h5>
-<p>The first argument is a pointer to a <tt>va_list</tt> element to initialize.
-   The second argument is a pointer to a <tt>va_list</tt> element to copy
-   from.</p>
-
-<h5>Semantics:</h5>
-<p>The '<tt>llvm.va_copy</tt>' intrinsic works just like the <tt>va_copy</tt>
-   macro available in C.  In a target-dependent way, it copies the
-   source <tt>va_list</tt> element into the destination <tt>va_list</tt>
-   element.  This intrinsic is necessary because
-   the <tt><a href="#int_va_start"> llvm.va_start</a></tt> intrinsic may be
-   arbitrarily complex and require, for example, memory allocation.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="int_gc">Accurate Garbage Collection Intrinsics</a>
-</div>
-
-<div class="doc_text">
-
-<p>LLVM support for <a href="GarbageCollection.html">Accurate Garbage
-Collection</a> (GC) requires the implementation and generation of these
-intrinsics. These intrinsics allow identification of <a href="#int_gcroot">GC
-roots on the stack</a>, as well as garbage collector implementations that
-require <a href="#int_gcread">read</a> and <a href="#int_gcwrite">write</a>
-barriers.  Front-ends for type-safe garbage collected languages should generate
-these intrinsics to make use of the LLVM garbage collectors.  For more details,
-see <a href="GarbageCollection.html">Accurate Garbage Collection with
-LLVM</a>.</p>
-
-<p>The garbage collection intrinsics only operate on objects in the generic
-   address space (address space zero).</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="int_gcroot">'<tt>llvm.gcroot</tt>' Intrinsic</a>
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  declare void @llvm.gcroot(i8** %ptrloc, i8* %metadata)
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>llvm.gcroot</tt>' intrinsic declares the existence of a GC root to
-   the code generator, and allows some metadata to be associated with it.</p>
-
-<h5>Arguments:</h5>
-<p>The first argument specifies the address of a stack object that contains the
-   root pointer.  The second pointer (which must be either a constant or a
-   global value address) contains the meta-data to be associated with the
-   root.</p>
-
-<h5>Semantics:</h5>
-<p>At runtime, a call to this intrinsic stores a null pointer into the "ptrloc"
-   location.  At compile-time, the code generator generates information to allow
-   the runtime to find the pointer at GC safe points. The '<tt>llvm.gcroot</tt>'
-   intrinsic may only be used in a function which <a href="#gc">specifies a GC
-   algorithm</a>.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="int_gcread">'<tt>llvm.gcread</tt>' Intrinsic</a>
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  declare i8* @llvm.gcread(i8* %ObjPtr, i8** %Ptr)
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>llvm.gcread</tt>' intrinsic identifies reads of references from heap
-   locations, allowing garbage collector implementations that require read
-   barriers.</p>
-
-<h5>Arguments:</h5>
-<p>The second argument is the address to read from, which should be an address
-   allocated from the garbage collector.  The first object is a pointer to the
-   start of the referenced object, if needed by the language runtime (otherwise
-   null).</p>
-
-<h5>Semantics:</h5>
-<p>The '<tt>llvm.gcread</tt>' intrinsic has the same semantics as a load
-   instruction, but may be replaced with substantially more complex code by the
-   garbage collector runtime, as needed. The '<tt>llvm.gcread</tt>' intrinsic
-   may only be used in a function which <a href="#gc">specifies a GC
-   algorithm</a>.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="int_gcwrite">'<tt>llvm.gcwrite</tt>' Intrinsic</a>
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  declare void @llvm.gcwrite(i8* %P1, i8* %Obj, i8** %P2)
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>llvm.gcwrite</tt>' intrinsic identifies writes of references to heap
-   locations, allowing garbage collector implementations that require write
-   barriers (such as generational or reference counting collectors).</p>
-
-<h5>Arguments:</h5>
-<p>The first argument is the reference to store, the second is the start of the
-   object to store it to, and the third is the address of the field of Obj to
-   store to.  If the runtime does not require a pointer to the object, Obj may
-   be null.</p>
-
-<h5>Semantics:</h5>
-<p>The '<tt>llvm.gcwrite</tt>' intrinsic has the same semantics as a store
-   instruction, but may be replaced with substantially more complex code by the
-   garbage collector runtime, as needed. The '<tt>llvm.gcwrite</tt>' intrinsic
-   may only be used in a function which <a href="#gc">specifies a GC
-   algorithm</a>.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="int_codegen">Code Generator Intrinsics</a>
-</div>
-
-<div class="doc_text">
-
-<p>These intrinsics are provided by LLVM to expose special features that may
-   only be implemented with code generator support.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="int_returnaddress">'<tt>llvm.returnaddress</tt>' Intrinsic</a>
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  declare i8  *@llvm.returnaddress(i32 &lt;level&gt;)
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>llvm.returnaddress</tt>' intrinsic attempts to compute a
-   target-specific value indicating the return address of the current function
-   or one of its callers.</p>
-
-<h5>Arguments:</h5>
-<p>The argument to this intrinsic indicates which function to return the address
-   for.  Zero indicates the calling function, one indicates its caller, etc.
-   The argument is <b>required</b> to be a constant integer value.</p>
-
-<h5>Semantics:</h5>
-<p>The '<tt>llvm.returnaddress</tt>' intrinsic either returns a pointer
-   indicating the return address of the specified call frame, or zero if it
-   cannot be identified.  The value returned by this intrinsic is likely to be
-   incorrect or 0 for arguments other than zero, so it should only be used for
-   debugging purposes.</p>
-
-<p>Note that calling this intrinsic does not prevent function inlining or other
-   aggressive transformations, so the value returned may not be that of the
-   obvious source-language caller.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="int_frameaddress">'<tt>llvm.frameaddress</tt>' Intrinsic</a>
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  declare i8 *@llvm.frameaddress(i32 &lt;level&gt;)
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>llvm.frameaddress</tt>' intrinsic attempts to return the
-   target-specific frame pointer value for the specified stack frame.</p>
-
-<h5>Arguments:</h5>
-<p>The argument to this intrinsic indicates which function to return the frame
-   pointer for.  Zero indicates the calling function, one indicates its caller,
-   etc.  The argument is <b>required</b> to be a constant integer value.</p>
-
-<h5>Semantics:</h5>
-<p>The '<tt>llvm.frameaddress</tt>' intrinsic either returns a pointer
-   indicating the frame address of the specified call frame, or zero if it
-   cannot be identified.  The value returned by this intrinsic is likely to be
-   incorrect or 0 for arguments other than zero, so it should only be used for
-   debugging purposes.</p>
-
-<p>Note that calling this intrinsic does not prevent function inlining or other
-   aggressive transformations, so the value returned may not be that of the
-   obvious source-language caller.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="int_stacksave">'<tt>llvm.stacksave</tt>' Intrinsic</a>
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  declare i8 *@llvm.stacksave()
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>llvm.stacksave</tt>' intrinsic is used to remember the current state
-   of the function stack, for use
-   with <a href="#int_stackrestore"> <tt>llvm.stackrestore</tt></a>.  This is
-   useful for implementing language features like scoped automatic variable
-   sized arrays in C99.</p>
-
-<h5>Semantics:</h5>
-<p>This intrinsic returns a opaque pointer value that can be passed
-   to <a href="#int_stackrestore"><tt>llvm.stackrestore</tt></a>.  When
-   an <tt>llvm.stackrestore</tt> intrinsic is executed with a value saved
-   from <tt>llvm.stacksave</tt>, it effectively restores the state of the stack
-   to the state it was in when the <tt>llvm.stacksave</tt> intrinsic executed.
-   In practice, this pops any <a href="#i_alloca">alloca</a> blocks from the
-   stack that were allocated after the <tt>llvm.stacksave</tt> was executed.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="int_stackrestore">'<tt>llvm.stackrestore</tt>' Intrinsic</a>
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  declare void @llvm.stackrestore(i8 * %ptr)
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>llvm.stackrestore</tt>' intrinsic is used to restore the state of
-   the function stack to the state it was in when the
-   corresponding <a href="#int_stacksave"><tt>llvm.stacksave</tt></a> intrinsic
-   executed.  This is useful for implementing language features like scoped
-   automatic variable sized arrays in C99.</p>
-
-<h5>Semantics:</h5>
-<p>See the description
-   for <a href="#int_stacksave"><tt>llvm.stacksave</tt></a>.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="int_prefetch">'<tt>llvm.prefetch</tt>' Intrinsic</a>
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  declare void @llvm.prefetch(i8* &lt;address&gt;, i32 &lt;rw&gt;, i32 &lt;locality&gt;)
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>llvm.prefetch</tt>' intrinsic is a hint to the code generator to
-   insert a prefetch instruction if supported; otherwise, it is a noop.
-   Prefetches have no effect on the behavior of the program but can change its
-   performance characteristics.</p>
-
-<h5>Arguments:</h5>
-<p><tt>address</tt> is the address to be prefetched, <tt>rw</tt> is the
-   specifier determining if the fetch should be for a read (0) or write (1),
-   and <tt>locality</tt> is a temporal locality specifier ranging from (0) - no
-   locality, to (3) - extremely local keep in cache.  The <tt>rw</tt>
-   and <tt>locality</tt> arguments must be constant integers.</p>
-
-<h5>Semantics:</h5>
-<p>This intrinsic does not modify the behavior of the program.  In particular,
-   prefetches cannot trap and do not produce a value.  On targets that support
-   this intrinsic, the prefetch can provide hints to the processor cache for
-   better performance.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="int_pcmarker">'<tt>llvm.pcmarker</tt>' Intrinsic</a>
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  declare void @llvm.pcmarker(i32 &lt;id&gt;)
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>llvm.pcmarker</tt>' intrinsic is a method to export a Program
-   Counter (PC) in a region of code to simulators and other tools.  The method
-   is target specific, but it is expected that the marker will use exported
-   symbols to transmit the PC of the marker.  The marker makes no guarantees
-   that it will remain with any specific instruction after optimizations.  It is
-   possible that the presence of a marker will inhibit optimizations.  The
-   intended use is to be inserted after optimizations to allow correlations of
-   simulation runs.</p>
-
-<h5>Arguments:</h5>
-<p><tt>id</tt> is a numerical id identifying the marker.</p>
-
-<h5>Semantics:</h5>
-<p>This intrinsic does not modify the behavior of the program.  Backends that do
-   not support this intrinisic may ignore it.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="int_readcyclecounter">'<tt>llvm.readcyclecounter</tt>' Intrinsic</a>
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  declare i64 @llvm.readcyclecounter( )
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>llvm.readcyclecounter</tt>' intrinsic provides access to the cycle
-   counter register (or similar low latency, high accuracy clocks) on those
-   targets that support it.  On X86, it should map to RDTSC.  On Alpha, it
-   should map to RPCC.  As the backing counters overflow quickly (on the order
-   of 9 seconds on alpha), this should only be used for small timings.</p>
-
-<h5>Semantics:</h5>
-<p>When directly supported, reading the cycle counter should not modify any
-   memory.  Implementations are allowed to either return a application specific
-   value or a system wide value.  On backends without support, this is lowered
-   to a constant 0.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="int_libc">Standard C Library Intrinsics</a>
-</div>
-
-<div class="doc_text">
-
-<p>LLVM provides intrinsics for a few important standard C library functions.
-   These intrinsics allow source-language front-ends to pass information about
-   the alignment of the pointer arguments to the code generator, providing
-   opportunity for more efficient code generation.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="int_memcpy">'<tt>llvm.memcpy</tt>' Intrinsic</a>
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<p>This is an overloaded intrinsic. You can use <tt>llvm.memcpy</tt> on any
-   integer bit width. Not all targets support all bit widths however.</p>
-
-<pre>
-  declare void @llvm.memcpy.i8(i8 * &lt;dest&gt;, i8 * &lt;src&gt;,
-                               i8 &lt;len&gt;, i32 &lt;align&gt;)
-  declare void @llvm.memcpy.i16(i8 * &lt;dest&gt;, i8 * &lt;src&gt;,
-                                i16 &lt;len&gt;, i32 &lt;align&gt;)
-  declare void @llvm.memcpy.i32(i8 * &lt;dest&gt;, i8 * &lt;src&gt;,
-                                i32 &lt;len&gt;, i32 &lt;align&gt;)
-  declare void @llvm.memcpy.i64(i8 * &lt;dest&gt;, i8 * &lt;src&gt;,
-                                i64 &lt;len&gt;, i32 &lt;align&gt;)
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>llvm.memcpy.*</tt>' intrinsics copy a block of memory from the
-   source location to the destination location.</p>
-
-<p>Note that, unlike the standard libc function, the <tt>llvm.memcpy.*</tt>
-   intrinsics do not return a value, and takes an extra alignment argument.</p>
-
-<h5>Arguments:</h5>
-<p>The first argument is a pointer to the destination, the second is a pointer
-   to the source.  The third argument is an integer argument specifying the
-   number of bytes to copy, and the fourth argument is the alignment of the
-   source and destination locations.</p>
-
-<p>If the call to this intrinisic has an alignment value that is not 0 or 1,
-   then the caller guarantees that both the source and destination pointers are
-   aligned to that boundary.</p>
-
-<h5>Semantics:</h5>
-<p>The '<tt>llvm.memcpy.*</tt>' intrinsics copy a block of memory from the
-   source location to the destination location, which are not allowed to
-   overlap.  It copies "len" bytes of memory over.  If the argument is known to
-   be aligned to some boundary, this can be specified as the fourth argument,
-   otherwise it should be set to 0 or 1.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="int_memmove">'<tt>llvm.memmove</tt>' Intrinsic</a>
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<p>This is an overloaded intrinsic. You can use llvm.memmove on any integer bit
-   width. Not all targets support all bit widths however.</p>
-
-<pre>
-  declare void @llvm.memmove.i8(i8 * &lt;dest&gt;, i8 * &lt;src&gt;,
-                                i8 &lt;len&gt;, i32 &lt;align&gt;)
-  declare void @llvm.memmove.i16(i8 * &lt;dest&gt;, i8 * &lt;src&gt;,
-                                 i16 &lt;len&gt;, i32 &lt;align&gt;)
-  declare void @llvm.memmove.i32(i8 * &lt;dest&gt;, i8 * &lt;src&gt;,
-                                 i32 &lt;len&gt;, i32 &lt;align&gt;)
-  declare void @llvm.memmove.i64(i8 * &lt;dest&gt;, i8 * &lt;src&gt;,
-                                 i64 &lt;len&gt;, i32 &lt;align&gt;)
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>llvm.memmove.*</tt>' intrinsics move a block of memory from the
-   source location to the destination location. It is similar to the
-   '<tt>llvm.memcpy</tt>' intrinsic but allows the two memory locations to
-   overlap.</p>
-
-<p>Note that, unlike the standard libc function, the <tt>llvm.memmove.*</tt>
-   intrinsics do not return a value, and takes an extra alignment argument.</p>
-
-<h5>Arguments:</h5>
-<p>The first argument is a pointer to the destination, the second is a pointer
-   to the source.  The third argument is an integer argument specifying the
-   number of bytes to copy, and the fourth argument is the alignment of the
-   source and destination locations.</p>
-
-<p>If the call to this intrinisic has an alignment value that is not 0 or 1,
-   then the caller guarantees that the source and destination pointers are
-   aligned to that boundary.</p>
-
-<h5>Semantics:</h5>
-<p>The '<tt>llvm.memmove.*</tt>' intrinsics copy a block of memory from the
-   source location to the destination location, which may overlap.  It copies
-   "len" bytes of memory over.  If the argument is known to be aligned to some
-   boundary, this can be specified as the fourth argument, otherwise it should
-   be set to 0 or 1.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="int_memset">'<tt>llvm.memset.*</tt>' Intrinsics</a>
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<p>This is an overloaded intrinsic. You can use llvm.memset on any integer bit
-   width. Not all targets support all bit widths however.</p>
-
-<pre>
-  declare void @llvm.memset.i8(i8 * &lt;dest&gt;, i8 &lt;val&gt;,
-                               i8 &lt;len&gt;, i32 &lt;align&gt;)
-  declare void @llvm.memset.i16(i8 * &lt;dest&gt;, i8 &lt;val&gt;,
-                                i16 &lt;len&gt;, i32 &lt;align&gt;)
-  declare void @llvm.memset.i32(i8 * &lt;dest&gt;, i8 &lt;val&gt;,
-                                i32 &lt;len&gt;, i32 &lt;align&gt;)
-  declare void @llvm.memset.i64(i8 * &lt;dest&gt;, i8 &lt;val&gt;,
-                                i64 &lt;len&gt;, i32 &lt;align&gt;)
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>llvm.memset.*</tt>' intrinsics fill a block of memory with a
-   particular byte value.</p>
-
-<p>Note that, unlike the standard libc function, the <tt>llvm.memset</tt>
-   intrinsic does not return a value, and takes an extra alignment argument.</p>
-
-<h5>Arguments:</h5>
-<p>The first argument is a pointer to the destination to fill, the second is the
-   byte value to fill it with, the third argument is an integer argument
-   specifying the number of bytes to fill, and the fourth argument is the known
-   alignment of destination location.</p>
-
-<p>If the call to this intrinisic has an alignment value that is not 0 or 1,
-   then the caller guarantees that the destination pointer is aligned to that
-   boundary.</p>
-
-<h5>Semantics:</h5>
-<p>The '<tt>llvm.memset.*</tt>' intrinsics fill "len" bytes of memory starting
-   at the destination location.  If the argument is known to be aligned to some
-   boundary, this can be specified as the fourth argument, otherwise it should
-   be set to 0 or 1.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="int_sqrt">'<tt>llvm.sqrt.*</tt>' Intrinsic</a>
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<p>This is an overloaded intrinsic. You can use <tt>llvm.sqrt</tt> on any
-   floating point or vector of floating point type. Not all targets support all
-   types however.</p>
-
-<pre>
-  declare float     @llvm.sqrt.f32(float %Val)
-  declare double    @llvm.sqrt.f64(double %Val)
-  declare x86_fp80  @llvm.sqrt.f80(x86_fp80 %Val)
-  declare fp128     @llvm.sqrt.f128(fp128 %Val)
-  declare ppc_fp128 @llvm.sqrt.ppcf128(ppc_fp128 %Val)
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>llvm.sqrt</tt>' intrinsics return the sqrt of the specified operand,
-   returning the same value as the libm '<tt>sqrt</tt>' functions would.
-   Unlike <tt>sqrt</tt> in libm, however, <tt>llvm.sqrt</tt> has undefined
-   behavior for negative numbers other than -0.0 (which allows for better
-   optimization, because there is no need to worry about errno being
-   set).  <tt>llvm.sqrt(-0.0)</tt> is defined to return -0.0 like IEEE sqrt.</p>
-
-<h5>Arguments:</h5>
-<p>The argument and return value are floating point numbers of the same
-   type.</p>
-
-<h5>Semantics:</h5>
-<p>This function returns the sqrt of the specified operand if it is a
-   nonnegative floating point number.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="int_powi">'<tt>llvm.powi.*</tt>' Intrinsic</a>
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<p>This is an overloaded intrinsic. You can use <tt>llvm.powi</tt> on any
-   floating point or vector of floating point type. Not all targets support all
-   types however.</p>
-
-<pre>
-  declare float     @llvm.powi.f32(float  %Val, i32 %power)
-  declare double    @llvm.powi.f64(double %Val, i32 %power)
-  declare x86_fp80  @llvm.powi.f80(x86_fp80  %Val, i32 %power)
-  declare fp128     @llvm.powi.f128(fp128 %Val, i32 %power)
-  declare ppc_fp128 @llvm.powi.ppcf128(ppc_fp128  %Val, i32 %power)
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>llvm.powi.*</tt>' intrinsics return the first operand raised to the
-   specified (positive or negative) power.  The order of evaluation of
-   multiplications is not defined.  When a vector of floating point type is
-   used, the second argument remains a scalar integer value.</p>
-
-<h5>Arguments:</h5>
-<p>The second argument is an integer power, and the first is a value to raise to
-   that power.</p>
-
-<h5>Semantics:</h5>
-<p>This function returns the first value raised to the second power with an
-   unspecified sequence of rounding operations.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="int_sin">'<tt>llvm.sin.*</tt>' Intrinsic</a>
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<p>This is an overloaded intrinsic. You can use <tt>llvm.sin</tt> on any
-   floating point or vector of floating point type. Not all targets support all
-   types however.</p>
-
-<pre>
-  declare float     @llvm.sin.f32(float  %Val)
-  declare double    @llvm.sin.f64(double %Val)
-  declare x86_fp80  @llvm.sin.f80(x86_fp80  %Val)
-  declare fp128     @llvm.sin.f128(fp128 %Val)
-  declare ppc_fp128 @llvm.sin.ppcf128(ppc_fp128  %Val)
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>llvm.sin.*</tt>' intrinsics return the sine of the operand.</p>
-
-<h5>Arguments:</h5>
-<p>The argument and return value are floating point numbers of the same
-   type.</p>
-
-<h5>Semantics:</h5>
-<p>This function returns the sine of the specified operand, returning the same
-   values as the libm <tt>sin</tt> functions would, and handles error conditions
-   in the same way.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="int_cos">'<tt>llvm.cos.*</tt>' Intrinsic</a>
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<p>This is an overloaded intrinsic. You can use <tt>llvm.cos</tt> on any
-   floating point or vector of floating point type. Not all targets support all
-   types however.</p>
-
-<pre>
-  declare float     @llvm.cos.f32(float  %Val)
-  declare double    @llvm.cos.f64(double %Val)
-  declare x86_fp80  @llvm.cos.f80(x86_fp80  %Val)
-  declare fp128     @llvm.cos.f128(fp128 %Val)
-  declare ppc_fp128 @llvm.cos.ppcf128(ppc_fp128  %Val)
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>llvm.cos.*</tt>' intrinsics return the cosine of the operand.</p>
-
-<h5>Arguments:</h5>
-<p>The argument and return value are floating point numbers of the same
-   type.</p>
-
-<h5>Semantics:</h5>
-<p>This function returns the cosine of the specified operand, returning the same
-   values as the libm <tt>cos</tt> functions would, and handles error conditions
-   in the same way.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="int_pow">'<tt>llvm.pow.*</tt>' Intrinsic</a>
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<p>This is an overloaded intrinsic. You can use <tt>llvm.pow</tt> on any
-   floating point or vector of floating point type. Not all targets support all
-   types however.</p>
-
-<pre>
-  declare float     @llvm.pow.f32(float  %Val, float %Power)
-  declare double    @llvm.pow.f64(double %Val, double %Power)
-  declare x86_fp80  @llvm.pow.f80(x86_fp80  %Val, x86_fp80 %Power)
-  declare fp128     @llvm.pow.f128(fp128 %Val, fp128 %Power)
-  declare ppc_fp128 @llvm.pow.ppcf128(ppc_fp128  %Val, ppc_fp128 Power)
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>llvm.pow.*</tt>' intrinsics return the first operand raised to the
-   specified (positive or negative) power.</p>
-
-<h5>Arguments:</h5>
-<p>The second argument is a floating point power, and the first is a value to
-   raise to that power.</p>
-
-<h5>Semantics:</h5>
-<p>This function returns the first value raised to the second power, returning
-   the same values as the libm <tt>pow</tt> functions would, and handles error
-   conditions in the same way.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="int_manip">Bit Manipulation Intrinsics</a>
-</div>
-
-<div class="doc_text">
-
-<p>LLVM provides intrinsics for a few important bit manipulation operations.
-   These allow efficient code generation for some algorithms.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="int_bswap">'<tt>llvm.bswap.*</tt>' Intrinsics</a>
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<p>This is an overloaded intrinsic function. You can use bswap on any integer
-   type that is an even number of bytes (i.e. BitWidth % 16 == 0).</p>
-
-<pre>
-  declare i16 @llvm.bswap.i16(i16 &lt;id&gt;)
-  declare i32 @llvm.bswap.i32(i32 &lt;id&gt;)
-  declare i64 @llvm.bswap.i64(i64 &lt;id&gt;)
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>llvm.bswap</tt>' family of intrinsics is used to byte swap integer
-   values with an even number of bytes (positive multiple of 16 bits).  These
-   are useful for performing operations on data that is not in the target's
-   native byte order.</p>
-
-<h5>Semantics:</h5>
-<p>The <tt>llvm.bswap.i16</tt> intrinsic returns an i16 value that has the high
-   and low byte of the input i16 swapped.  Similarly,
-   the <tt>llvm.bswap.i32</tt> intrinsic returns an i32 value that has the four
-   bytes of the input i32 swapped, so that if the input bytes are numbered 0, 1,
-   2, 3 then the returned i32 will have its bytes in 3, 2, 1, 0 order.
-   The <tt>llvm.bswap.i48</tt>, <tt>llvm.bswap.i64</tt> and other intrinsics
-   extend this concept to additional even-byte lengths (6 bytes, 8 bytes and
-   more, respectively).</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="int_ctpop">'<tt>llvm.ctpop.*</tt>' Intrinsic</a>
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<p>This is an overloaded intrinsic. You can use llvm.ctpop on any integer bit
-   width. Not all targets support all bit widths however.</p>
-
-<pre>
-  declare i8 @llvm.ctpop.i8(i8  &lt;src&gt;)
-  declare i16 @llvm.ctpop.i16(i16 &lt;src&gt;)
-  declare i32 @llvm.ctpop.i32(i32 &lt;src&gt;)
-  declare i64 @llvm.ctpop.i64(i64 &lt;src&gt;)
-  declare i256 @llvm.ctpop.i256(i256 &lt;src&gt;)
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>llvm.ctpop</tt>' family of intrinsics counts the number of bits set
-   in a value.</p>
-
-<h5>Arguments:</h5>
-<p>The only argument is the value to be counted.  The argument may be of any
-   integer type.  The return type must match the argument type.</p>
-
-<h5>Semantics:</h5>
-<p>The '<tt>llvm.ctpop</tt>' intrinsic counts the 1's in a variable.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="int_ctlz">'<tt>llvm.ctlz.*</tt>' Intrinsic</a>
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<p>This is an overloaded intrinsic. You can use <tt>llvm.ctlz</tt> on any
-   integer bit width. Not all targets support all bit widths however.</p>
-
-<pre>
-  declare i8 @llvm.ctlz.i8 (i8  &lt;src&gt;)
-  declare i16 @llvm.ctlz.i16(i16 &lt;src&gt;)
-  declare i32 @llvm.ctlz.i32(i32 &lt;src&gt;)
-  declare i64 @llvm.ctlz.i64(i64 &lt;src&gt;)
-  declare i256 @llvm.ctlz.i256(i256 &lt;src&gt;)
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>llvm.ctlz</tt>' family of intrinsic functions counts the number of
-   leading zeros in a variable.</p>
-
-<h5>Arguments:</h5>
-<p>The only argument is the value to be counted.  The argument may be of any
-   integer type. The return type must match the argument type.</p>
-
-<h5>Semantics:</h5>
-<p>The '<tt>llvm.ctlz</tt>' intrinsic counts the leading (most significant)
-   zeros in a variable.  If the src == 0 then the result is the size in bits of
-   the type of src. For example, <tt>llvm.ctlz(i32 2) = 30</tt>.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="int_cttz">'<tt>llvm.cttz.*</tt>' Intrinsic</a>
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<p>This is an overloaded intrinsic. You can use <tt>llvm.cttz</tt> on any
-   integer bit width. Not all targets support all bit widths however.</p>
-
-<pre>
-  declare i8 @llvm.cttz.i8 (i8  &lt;src&gt;)
-  declare i16 @llvm.cttz.i16(i16 &lt;src&gt;)
-  declare i32 @llvm.cttz.i32(i32 &lt;src&gt;)
-  declare i64 @llvm.cttz.i64(i64 &lt;src&gt;)
-  declare i256 @llvm.cttz.i256(i256 &lt;src&gt;)
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>llvm.cttz</tt>' family of intrinsic functions counts the number of
-   trailing zeros.</p>
-
-<h5>Arguments:</h5>
-<p>The only argument is the value to be counted.  The argument may be of any
-   integer type.  The return type must match the argument type.</p>
-
-<h5>Semantics:</h5>
-<p>The '<tt>llvm.cttz</tt>' intrinsic counts the trailing (least significant)
-   zeros in a variable.  If the src == 0 then the result is the size in bits of
-   the type of src.  For example, <tt>llvm.cttz(2) = 1</tt>.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="int_overflow">Arithmetic with Overflow Intrinsics</a>
-</div>
-
-<div class="doc_text">
-
-<p>LLVM provides intrinsics for some arithmetic with overflow operations.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="int_sadd_overflow">'<tt>llvm.sadd.with.overflow.*</tt>' Intrinsics</a>
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<p>This is an overloaded intrinsic. You can use <tt>llvm.sadd.with.overflow</tt>
-   on any integer bit width.</p>
-
-<pre>
-  declare {i16, i1} @llvm.sadd.with.overflow.i16(i16 %a, i16 %b)
-  declare {i32, i1} @llvm.sadd.with.overflow.i32(i32 %a, i32 %b)
-  declare {i64, i1} @llvm.sadd.with.overflow.i64(i64 %a, i64 %b)
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>llvm.sadd.with.overflow</tt>' family of intrinsic functions perform
-   a signed addition of the two arguments, and indicate whether an overflow
-   occurred during the signed summation.</p>
-
-<h5>Arguments:</h5>
-<p>The arguments (%a and %b) and the first element of the result structure may
-   be of integer types of any bit width, but they must have the same bit
-   width. The second element of the result structure must be of
-   type <tt>i1</tt>. <tt>%a</tt> and <tt>%b</tt> are the two values that will
-   undergo signed addition.</p>
-
-<h5>Semantics:</h5>
-<p>The '<tt>llvm.sadd.with.overflow</tt>' family of intrinsic functions perform
-   a signed addition of the two variables. They return a structure &mdash; the
-   first element of which is the signed summation, and the second element of
-   which is a bit specifying if the signed summation resulted in an
-   overflow.</p>
-
-<h5>Examples:</h5>
-<pre>
-  %res = call {i32, i1} @llvm.sadd.with.overflow.i32(i32 %a, i32 %b)
-  %sum = extractvalue {i32, i1} %res, 0
-  %obit = extractvalue {i32, i1} %res, 1
-  br i1 %obit, label %overflow, label %normal
-</pre>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="int_uadd_overflow">'<tt>llvm.uadd.with.overflow.*</tt>' Intrinsics</a>
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<p>This is an overloaded intrinsic. You can use <tt>llvm.uadd.with.overflow</tt>
-   on any integer bit width.</p>
-
-<pre>
-  declare {i16, i1} @llvm.uadd.with.overflow.i16(i16 %a, i16 %b)
-  declare {i32, i1} @llvm.uadd.with.overflow.i32(i32 %a, i32 %b)
-  declare {i64, i1} @llvm.uadd.with.overflow.i64(i64 %a, i64 %b)
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>llvm.uadd.with.overflow</tt>' family of intrinsic functions perform
-   an unsigned addition of the two arguments, and indicate whether a carry
-   occurred during the unsigned summation.</p>
-
-<h5>Arguments:</h5>
-<p>The arguments (%a and %b) and the first element of the result structure may
-   be of integer types of any bit width, but they must have the same bit
-   width. The second element of the result structure must be of
-   type <tt>i1</tt>. <tt>%a</tt> and <tt>%b</tt> are the two values that will
-   undergo unsigned addition.</p>
-
-<h5>Semantics:</h5>
-<p>The '<tt>llvm.uadd.with.overflow</tt>' family of intrinsic functions perform
-   an unsigned addition of the two arguments. They return a structure &mdash;
-   the first element of which is the sum, and the second element of which is a
-   bit specifying if the unsigned summation resulted in a carry.</p>
-
-<h5>Examples:</h5>
-<pre>
-  %res = call {i32, i1} @llvm.uadd.with.overflow.i32(i32 %a, i32 %b)
-  %sum = extractvalue {i32, i1} %res, 0
-  %obit = extractvalue {i32, i1} %res, 1
-  br i1 %obit, label %carry, label %normal
-</pre>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="int_ssub_overflow">'<tt>llvm.ssub.with.overflow.*</tt>' Intrinsics</a>
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<p>This is an overloaded intrinsic. You can use <tt>llvm.ssub.with.overflow</tt>
-   on any integer bit width.</p>
-
-<pre>
-  declare {i16, i1} @llvm.ssub.with.overflow.i16(i16 %a, i16 %b)
-  declare {i32, i1} @llvm.ssub.with.overflow.i32(i32 %a, i32 %b)
-  declare {i64, i1} @llvm.ssub.with.overflow.i64(i64 %a, i64 %b)
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>llvm.ssub.with.overflow</tt>' family of intrinsic functions perform
-   a signed subtraction of the two arguments, and indicate whether an overflow
-   occurred during the signed subtraction.</p>
-
-<h5>Arguments:</h5>
-<p>The arguments (%a and %b) and the first element of the result structure may
-   be of integer types of any bit width, but they must have the same bit
-   width. The second element of the result structure must be of
-   type <tt>i1</tt>. <tt>%a</tt> and <tt>%b</tt> are the two values that will
-   undergo signed subtraction.</p>
-
-<h5>Semantics:</h5>
-<p>The '<tt>llvm.ssub.with.overflow</tt>' family of intrinsic functions perform
-   a signed subtraction of the two arguments. They return a structure &mdash;
-   the first element of which is the subtraction, and the second element of
-   which is a bit specifying if the signed subtraction resulted in an
-   overflow.</p>
-
-<h5>Examples:</h5>
-<pre>
-  %res = call {i32, i1} @llvm.ssub.with.overflow.i32(i32 %a, i32 %b)
-  %sum = extractvalue {i32, i1} %res, 0
-  %obit = extractvalue {i32, i1} %res, 1
-  br i1 %obit, label %overflow, label %normal
-</pre>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="int_usub_overflow">'<tt>llvm.usub.with.overflow.*</tt>' Intrinsics</a>
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<p>This is an overloaded intrinsic. You can use <tt>llvm.usub.with.overflow</tt>
-   on any integer bit width.</p>
-
-<pre>
-  declare {i16, i1} @llvm.usub.with.overflow.i16(i16 %a, i16 %b)
-  declare {i32, i1} @llvm.usub.with.overflow.i32(i32 %a, i32 %b)
-  declare {i64, i1} @llvm.usub.with.overflow.i64(i64 %a, i64 %b)
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>llvm.usub.with.overflow</tt>' family of intrinsic functions perform
-   an unsigned subtraction of the two arguments, and indicate whether an
-   overflow occurred during the unsigned subtraction.</p>
-
-<h5>Arguments:</h5>
-<p>The arguments (%a and %b) and the first element of the result structure may
-   be of integer types of any bit width, but they must have the same bit
-   width. The second element of the result structure must be of
-   type <tt>i1</tt>. <tt>%a</tt> and <tt>%b</tt> are the two values that will
-   undergo unsigned subtraction.</p>
-
-<h5>Semantics:</h5>
-<p>The '<tt>llvm.usub.with.overflow</tt>' family of intrinsic functions perform
-   an unsigned subtraction of the two arguments. They return a structure &mdash;
-   the first element of which is the subtraction, and the second element of
-   which is a bit specifying if the unsigned subtraction resulted in an
-   overflow.</p>
-
-<h5>Examples:</h5>
-<pre>
-  %res = call {i32, i1} @llvm.usub.with.overflow.i32(i32 %a, i32 %b)
-  %sum = extractvalue {i32, i1} %res, 0
-  %obit = extractvalue {i32, i1} %res, 1
-  br i1 %obit, label %overflow, label %normal
-</pre>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="int_smul_overflow">'<tt>llvm.smul.with.overflow.*</tt>' Intrinsics</a>
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<p>This is an overloaded intrinsic. You can use <tt>llvm.smul.with.overflow</tt>
-   on any integer bit width.</p>
-
-<pre>
-  declare {i16, i1} @llvm.smul.with.overflow.i16(i16 %a, i16 %b)
-  declare {i32, i1} @llvm.smul.with.overflow.i32(i32 %a, i32 %b)
-  declare {i64, i1} @llvm.smul.with.overflow.i64(i64 %a, i64 %b)
-</pre>
-
-<h5>Overview:</h5>
-
-<p>The '<tt>llvm.smul.with.overflow</tt>' family of intrinsic functions perform
-   a signed multiplication of the two arguments, and indicate whether an
-   overflow occurred during the signed multiplication.</p>
-
-<h5>Arguments:</h5>
-<p>The arguments (%a and %b) and the first element of the result structure may
-   be of integer types of any bit width, but they must have the same bit
-   width. The second element of the result structure must be of
-   type <tt>i1</tt>. <tt>%a</tt> and <tt>%b</tt> are the two values that will
-   undergo signed multiplication.</p>
-
-<h5>Semantics:</h5>
-<p>The '<tt>llvm.smul.with.overflow</tt>' family of intrinsic functions perform
-   a signed multiplication of the two arguments. They return a structure &mdash;
-   the first element of which is the multiplication, and the second element of
-   which is a bit specifying if the signed multiplication resulted in an
-   overflow.</p>
-
-<h5>Examples:</h5>
-<pre>
-  %res = call {i32, i1} @llvm.smul.with.overflow.i32(i32 %a, i32 %b)
-  %sum = extractvalue {i32, i1} %res, 0
-  %obit = extractvalue {i32, i1} %res, 1
-  br i1 %obit, label %overflow, label %normal
-</pre>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="int_umul_overflow">'<tt>llvm.umul.with.overflow.*</tt>' Intrinsics</a>
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<p>This is an overloaded intrinsic. You can use <tt>llvm.umul.with.overflow</tt>
-   on any integer bit width.</p>
-
-<pre>
-  declare {i16, i1} @llvm.umul.with.overflow.i16(i16 %a, i16 %b)
-  declare {i32, i1} @llvm.umul.with.overflow.i32(i32 %a, i32 %b)
-  declare {i64, i1} @llvm.umul.with.overflow.i64(i64 %a, i64 %b)
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>llvm.umul.with.overflow</tt>' family of intrinsic functions perform
-   a unsigned multiplication of the two arguments, and indicate whether an
-   overflow occurred during the unsigned multiplication.</p>
-
-<h5>Arguments:</h5>
-<p>The arguments (%a and %b) and the first element of the result structure may
-   be of integer types of any bit width, but they must have the same bit
-   width. The second element of the result structure must be of
-   type <tt>i1</tt>. <tt>%a</tt> and <tt>%b</tt> are the two values that will
-   undergo unsigned multiplication.</p>
-
-<h5>Semantics:</h5>
-<p>The '<tt>llvm.umul.with.overflow</tt>' family of intrinsic functions perform
-   an unsigned multiplication of the two arguments. They return a structure
-   &mdash; the first element of which is the multiplication, and the second
-   element of which is a bit specifying if the unsigned multiplication resulted
-   in an overflow.</p>
-
-<h5>Examples:</h5>
-<pre>
-  %res = call {i32, i1} @llvm.umul.with.overflow.i32(i32 %a, i32 %b)
-  %sum = extractvalue {i32, i1} %res, 0
-  %obit = extractvalue {i32, i1} %res, 1
-  br i1 %obit, label %overflow, label %normal
-</pre>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="int_debugger">Debugger Intrinsics</a>
-</div>
-
-<div class="doc_text">
-
-<p>The LLVM debugger intrinsics (which all start with <tt>llvm.dbg.</tt>
-   prefix), are described in
-   the <a href="SourceLevelDebugging.html#format_common_intrinsics">LLVM Source
-   Level Debugging</a> document.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="int_eh">Exception Handling Intrinsics</a>
-</div>
-
-<div class="doc_text">
-
-<p>The LLVM exception handling intrinsics (which all start with
-   <tt>llvm.eh.</tt> prefix), are described in
-   the <a href="ExceptionHandling.html#format_common_intrinsics">LLVM Exception
-   Handling</a> document.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="int_trampoline">Trampoline Intrinsic</a>
-</div>
-
-<div class="doc_text">
-
-<p>This intrinsic makes it possible to excise one parameter, marked with
-   the <tt>nest</tt> attribute, from a function.  The result is a callable
-   function pointer lacking the nest parameter - the caller does not need to
-   provide a value for it.  Instead, the value to use is stored in advance in a
-   "trampoline", a block of memory usually allocated on the stack, which also
-   contains code to splice the nest value into the argument list.  This is used
-   to implement the GCC nested function address extension.</p>
-
-<p>For example, if the function is
-   <tt>i32 f(i8* nest %c, i32 %x, i32 %y)</tt> then the resulting function
-   pointer has signature <tt>i32 (i32, i32)*</tt>.  It can be created as
-   follows:</p>
-
-<div class="doc_code">
-<pre>
-  %tramp = alloca [10 x i8], align 4 ; size and alignment only correct for X86
-  %tramp1 = getelementptr [10 x i8]* %tramp, i32 0, i32 0
-  %p = call i8* @llvm.init.trampoline( i8* %tramp1, i8* bitcast (i32 (i8* nest , i32, i32)* @f to i8*), i8* %nval )
-  %fp = bitcast i8* %p to i32 (i32, i32)*
-</pre>
-</div>
-
-<p>The call <tt>%val = call i32 %fp( i32 %x, i32 %y )</tt> is then equivalent
-   to <tt>%val = call i32 %f( i8* %nval, i32 %x, i32 %y )</tt>.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="int_it">'<tt>llvm.init.trampoline</tt>' Intrinsic</a>
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  declare i8* @llvm.init.trampoline(i8* &lt;tramp&gt;, i8* &lt;func&gt;, i8* &lt;nval&gt;)
-</pre>
-
-<h5>Overview:</h5>
-<p>This fills the memory pointed to by <tt>tramp</tt> with code and returns a
-   function pointer suitable for executing it.</p>
-
-<h5>Arguments:</h5>
-<p>The <tt>llvm.init.trampoline</tt> intrinsic takes three arguments, all
-   pointers.  The <tt>tramp</tt> argument must point to a sufficiently large and
-   sufficiently aligned block of memory; this memory is written to by the
-   intrinsic.  Note that the size and the alignment are target-specific - LLVM
-   currently provides no portable way of determining them, so a front-end that
-   generates this intrinsic needs to have some target-specific knowledge.
-   The <tt>func</tt> argument must hold a function bitcast to
-   an <tt>i8*</tt>.</p>
-
-<h5>Semantics:</h5>
-<p>The block of memory pointed to by <tt>tramp</tt> is filled with target
-   dependent code, turning it into a function.  A pointer to this function is
-   returned, but needs to be bitcast to an <a href="#int_trampoline">appropriate
-   function pointer type</a> before being called.  The new function's signature
-   is the same as that of <tt>func</tt> with any arguments marked with
-   the <tt>nest</tt> attribute removed.  At most one such <tt>nest</tt> argument
-   is allowed, and it must be of pointer type.  Calling the new function is
-   equivalent to calling <tt>func</tt> with the same argument list, but
-   with <tt>nval</tt> used for the missing <tt>nest</tt> argument.  If, after
-   calling <tt>llvm.init.trampoline</tt>, the memory pointed to
-   by <tt>tramp</tt> is modified, then the effect of any later call to the
-   returned function pointer is undefined.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="int_atomics">Atomic Operations and Synchronization Intrinsics</a>
-</div>
-
-<div class="doc_text">
-
-<p>These intrinsic functions expand the "universal IR" of LLVM to represent
-   hardware constructs for atomic operations and memory synchronization.  This
-   provides an interface to the hardware, not an interface to the programmer. It
-   is aimed at a low enough level to allow any programming models or APIs
-   (Application Programming Interfaces) which need atomic behaviors to map
-   cleanly onto it. It is also modeled primarily on hardware behavior. Just as
-   hardware provides a "universal IR" for source languages, it also provides a
-   starting point for developing a "universal" atomic operation and
-   synchronization IR.</p>
-
-<p>These do <em>not</em> form an API such as high-level threading libraries,
-   software transaction memory systems, atomic primitives, and intrinsic
-   functions as found in BSD, GNU libc, atomic_ops, APR, and other system and
-   application libraries.  The hardware interface provided by LLVM should allow
-   a clean implementation of all of these APIs and parallel programming models.
-   No one model or paradigm should be selected above others unless the hardware
-   itself ubiquitously does so.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="int_memory_barrier">'<tt>llvm.memory.barrier</tt>' Intrinsic</a>
-</div>
-<div class="doc_text">
-<h5>Syntax:</h5>
-<pre>
-  declare void @llvm.memory.barrier( i1 &lt;ll&gt;, i1 &lt;ls&gt;, i1 &lt;sl&gt;, i1 &lt;ss&gt;, i1 &lt;device&gt; )
-</pre>
-
-<h5>Overview:</h5>
-<p>The <tt>llvm.memory.barrier</tt> intrinsic guarantees ordering between
-   specific pairs of memory access types.</p>
-
-<h5>Arguments:</h5>
-<p>The <tt>llvm.memory.barrier</tt> intrinsic requires five boolean arguments.
-   The first four arguments enables a specific barrier as listed below.  The
-   fith argument specifies that the barrier applies to io or device or uncached
-   memory.</p>
-
-<ul>
-  <li><tt>ll</tt>: load-load barrier</li>
-  <li><tt>ls</tt>: load-store barrier</li>
-  <li><tt>sl</tt>: store-load barrier</li>
-  <li><tt>ss</tt>: store-store barrier</li>
-  <li><tt>device</tt>: barrier applies to device and uncached memory also.</li>
-</ul>
-
-<h5>Semantics:</h5>
-<p>This intrinsic causes the system to enforce some ordering constraints upon
-   the loads and stores of the program. This barrier does not
-   indicate <em>when</em> any events will occur, it only enforces
-   an <em>order</em> in which they occur. For any of the specified pairs of load
-   and store operations (f.ex.  load-load, or store-load), all of the first
-   operations preceding the barrier will complete before any of the second
-   operations succeeding the barrier begin. Specifically the semantics for each
-   pairing is as follows:</p>
-
-<ul>
-  <li><tt>ll</tt>: All loads before the barrier must complete before any load
-      after the barrier begins.</li>
-  <li><tt>ls</tt>: All loads before the barrier must complete before any
-      store after the barrier begins.</li>
-  <li><tt>ss</tt>: All stores before the barrier must complete before any
-      store after the barrier begins.</li>
-  <li><tt>sl</tt>: All stores before the barrier must complete before any
-      load after the barrier begins.</li>
-</ul>
-
-<p>These semantics are applied with a logical "and" behavior when more than one
-   is enabled in a single memory barrier intrinsic.</p>
-
-<p>Backends may implement stronger barriers than those requested when they do
-   not support as fine grained a barrier as requested.  Some architectures do
-   not need all types of barriers and on such architectures, these become
-   noops.</p>
-
-<h5>Example:</h5>
-<pre>
-%mallocP  = tail call i8* @malloc(i32 ptrtoint (i32* getelementptr (i32* null, i32 1) to i32))
-%ptr      = bitcast i8* %mallocP to i32*
-            store i32 4, %ptr
-
-%result1  = load i32* %ptr      <i>; yields {i32}:result1 = 4</i>
-            call void @llvm.memory.barrier( i1 false, i1 true, i1 false, i1 false )
-                                <i>; guarantee the above finishes</i>
-            store i32 8, %ptr   <i>; before this begins</i>
-</pre>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="int_atomic_cmp_swap">'<tt>llvm.atomic.cmp.swap.*</tt>' Intrinsic</a>
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<p>This is an overloaded intrinsic. You can use <tt>llvm.atomic.cmp.swap</tt> on
-   any integer bit width and for different address spaces. Not all targets
-   support all bit widths however.</p>
-
-<pre>
-  declare i8 @llvm.atomic.cmp.swap.i8.p0i8( i8* &lt;ptr&gt;, i8 &lt;cmp&gt;, i8 &lt;val&gt; )
-  declare i16 @llvm.atomic.cmp.swap.i16.p0i16( i16* &lt;ptr&gt;, i16 &lt;cmp&gt;, i16 &lt;val&gt; )
-  declare i32 @llvm.atomic.cmp.swap.i32.p0i32( i32* &lt;ptr&gt;, i32 &lt;cmp&gt;, i32 &lt;val&gt; )
-  declare i64 @llvm.atomic.cmp.swap.i64.p0i64( i64* &lt;ptr&gt;, i64 &lt;cmp&gt;, i64 &lt;val&gt; )
-</pre>
-
-<h5>Overview:</h5>
-<p>This loads a value in memory and compares it to a given value. If they are
-   equal, it stores a new value into the memory.</p>
-
-<h5>Arguments:</h5>
-<p>The <tt>llvm.atomic.cmp.swap</tt> intrinsic takes three arguments. The result
-   as well as both <tt>cmp</tt> and <tt>val</tt> must be integer values with the
-   same bit width. The <tt>ptr</tt> argument must be a pointer to a value of
-   this integer type. While any bit width integer may be used, targets may only
-   lower representations they support in hardware.</p>
-
-<h5>Semantics:</h5>
-<p>This entire intrinsic must be executed atomically. It first loads the value
-   in memory pointed to by <tt>ptr</tt> and compares it with the
-   value <tt>cmp</tt>. If they are equal, <tt>val</tt> is stored into the
-   memory. The loaded value is yielded in all cases. This provides the
-   equivalent of an atomic compare-and-swap operation within the SSA
-   framework.</p>
-
-<h5>Examples:</h5>
-<pre>
-%mallocP  = tail call i8* @malloc(i32 ptrtoint (i32* getelementptr (i32* null, i32 1) to i32))
-%ptr      = bitcast i8* %mallocP to i32*
-            store i32 4, %ptr
-
-%val1     = add i32 4, 4
-%result1  = call i32 @llvm.atomic.cmp.swap.i32.p0i32( i32* %ptr, i32 4, %val1 )
-                                          <i>; yields {i32}:result1 = 4</i>
-%stored1  = icmp eq i32 %result1, 4       <i>; yields {i1}:stored1 = true</i>
-%memval1  = load i32* %ptr                <i>; yields {i32}:memval1 = 8</i>
-
-%val2     = add i32 1, 1
-%result2  = call i32 @llvm.atomic.cmp.swap.i32.p0i32( i32* %ptr, i32 5, %val2 )
-                                          <i>; yields {i32}:result2 = 8</i>
-%stored2  = icmp eq i32 %result2, 5       <i>; yields {i1}:stored2 = false</i>
-
-%memval2  = load i32* %ptr                <i>; yields {i32}:memval2 = 8</i>
-</pre>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="int_atomic_swap">'<tt>llvm.atomic.swap.*</tt>' Intrinsic</a>
-</div>
-<div class="doc_text">
-<h5>Syntax:</h5>
-
-<p>This is an overloaded intrinsic. You can use <tt>llvm.atomic.swap</tt> on any
-   integer bit width. Not all targets support all bit widths however.</p>
-
-<pre>
-  declare i8 @llvm.atomic.swap.i8.p0i8( i8* &lt;ptr&gt;, i8 &lt;val&gt; )
-  declare i16 @llvm.atomic.swap.i16.p0i16( i16* &lt;ptr&gt;, i16 &lt;val&gt; )
-  declare i32 @llvm.atomic.swap.i32.p0i32( i32* &lt;ptr&gt;, i32 &lt;val&gt; )
-  declare i64 @llvm.atomic.swap.i64.p0i64( i64* &lt;ptr&gt;, i64 &lt;val&gt; )
-</pre>
-
-<h5>Overview:</h5>
-<p>This intrinsic loads the value stored in memory at <tt>ptr</tt> and yields
-   the value from memory. It then stores the value in <tt>val</tt> in the memory
-   at <tt>ptr</tt>.</p>
-
-<h5>Arguments:</h5>
-<p>The <tt>llvm.atomic.swap</tt> intrinsic takes two arguments. Both
-  the <tt>val</tt> argument and the result must be integers of the same bit
-  width.  The first argument, <tt>ptr</tt>, must be a pointer to a value of this
-  integer type. The targets may only lower integer representations they
-  support.</p>
-
-<h5>Semantics:</h5>
-<p>This intrinsic loads the value pointed to by <tt>ptr</tt>, yields it, and
-   stores <tt>val</tt> back into <tt>ptr</tt> atomically. This provides the
-   equivalent of an atomic swap operation within the SSA framework.</p>
-
-<h5>Examples:</h5>
-<pre>
-%mallocP  = tail call i8* @malloc(i32 ptrtoint (i32* getelementptr (i32* null, i32 1) to i32))
-%ptr      = bitcast i8* %mallocP to i32*
-            store i32 4, %ptr
-
-%val1     = add i32 4, 4
-%result1  = call i32 @llvm.atomic.swap.i32.p0i32( i32* %ptr, i32 %val1 )
-                                        <i>; yields {i32}:result1 = 4</i>
-%stored1  = icmp eq i32 %result1, 4     <i>; yields {i1}:stored1 = true</i>
-%memval1  = load i32* %ptr              <i>; yields {i32}:memval1 = 8</i>
-
-%val2     = add i32 1, 1
-%result2  = call i32 @llvm.atomic.swap.i32.p0i32( i32* %ptr, i32 %val2 )
-                                        <i>; yields {i32}:result2 = 8</i>
-
-%stored2  = icmp eq i32 %result2, 8     <i>; yields {i1}:stored2 = true</i>
-%memval2  = load i32* %ptr              <i>; yields {i32}:memval2 = 2</i>
-</pre>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="int_atomic_load_add">'<tt>llvm.atomic.load.add.*</tt>' Intrinsic</a>
-
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<p>This is an overloaded intrinsic. You can use <tt>llvm.atomic.load.add</tt> on
-   any integer bit width. Not all targets support all bit widths however.</p>
-
-<pre>
-  declare i8 @llvm.atomic.load.add.i8..p0i8( i8* &lt;ptr&gt;, i8 &lt;delta&gt; )
-  declare i16 @llvm.atomic.load.add.i16..p0i16( i16* &lt;ptr&gt;, i16 &lt;delta&gt; )
-  declare i32 @llvm.atomic.load.add.i32..p0i32( i32* &lt;ptr&gt;, i32 &lt;delta&gt; )
-  declare i64 @llvm.atomic.load.add.i64..p0i64( i64* &lt;ptr&gt;, i64 &lt;delta&gt; )
-</pre>
-
-<h5>Overview:</h5>
-<p>This intrinsic adds <tt>delta</tt> to the value stored in memory
-   at <tt>ptr</tt>. It yields the original value at <tt>ptr</tt>.</p>
-
-<h5>Arguments:</h5>
-<p>The intrinsic takes two arguments, the first a pointer to an integer value
-   and the second an integer value. The result is also an integer value. These
-   integer types can have any bit width, but they must all have the same bit
-   width. The targets may only lower integer representations they support.</p>
-
-<h5>Semantics:</h5>
-<p>This intrinsic does a series of operations atomically. It first loads the
-   value stored at <tt>ptr</tt>. It then adds <tt>delta</tt>, stores the result
-   to <tt>ptr</tt>. It yields the original value stored at <tt>ptr</tt>.</p>
-
-<h5>Examples:</h5>
-<pre>
-%mallocP  = tail call i8* @malloc(i32 ptrtoint (i32* getelementptr (i32* null, i32 1) to i32))
-%ptr      = bitcast i8* %mallocP to i32*
-            store i32 4, %ptr
-%result1  = call i32 @llvm.atomic.load.add.i32.p0i32( i32* %ptr, i32 4 )
-                                <i>; yields {i32}:result1 = 4</i>
-%result2  = call i32 @llvm.atomic.load.add.i32.p0i32( i32* %ptr, i32 2 )
-                                <i>; yields {i32}:result2 = 8</i>
-%result3  = call i32 @llvm.atomic.load.add.i32.p0i32( i32* %ptr, i32 5 )
-                                <i>; yields {i32}:result3 = 10</i>
-%memval1  = load i32* %ptr      <i>; yields {i32}:memval1 = 15</i>
-</pre>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="int_atomic_load_sub">'<tt>llvm.atomic.load.sub.*</tt>' Intrinsic</a>
-
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<p>This is an overloaded intrinsic. You can use <tt>llvm.atomic.load.sub</tt> on
-   any integer bit width and for different address spaces. Not all targets
-   support all bit widths however.</p>
-
-<pre>
-  declare i8 @llvm.atomic.load.sub.i8.p0i32( i8* &lt;ptr&gt;, i8 &lt;delta&gt; )
-  declare i16 @llvm.atomic.load.sub.i16.p0i32( i16* &lt;ptr&gt;, i16 &lt;delta&gt; )
-  declare i32 @llvm.atomic.load.sub.i32.p0i32( i32* &lt;ptr&gt;, i32 &lt;delta&gt; )
-  declare i64 @llvm.atomic.load.sub.i64.p0i32( i64* &lt;ptr&gt;, i64 &lt;delta&gt; )
-</pre>
-
-<h5>Overview:</h5>
-<p>This intrinsic subtracts <tt>delta</tt> to the value stored in memory at
-   <tt>ptr</tt>. It yields the original value at <tt>ptr</tt>.</p>
-
-<h5>Arguments:</h5>
-<p>The intrinsic takes two arguments, the first a pointer to an integer value
-   and the second an integer value. The result is also an integer value. These
-   integer types can have any bit width, but they must all have the same bit
-   width. The targets may only lower integer representations they support.</p>
-
-<h5>Semantics:</h5>
-<p>This intrinsic does a series of operations atomically. It first loads the
-   value stored at <tt>ptr</tt>. It then subtracts <tt>delta</tt>, stores the
-   result to <tt>ptr</tt>. It yields the original value stored
-   at <tt>ptr</tt>.</p>
-
-<h5>Examples:</h5>
-<pre>
-%mallocP  = tail call i8* @malloc(i32 ptrtoint (i32* getelementptr (i32* null, i32 1) to i32))
-%ptr      = bitcast i8* %mallocP to i32*
-            store i32 8, %ptr
-%result1  = call i32 @llvm.atomic.load.sub.i32.p0i32( i32* %ptr, i32 4 )
-                                <i>; yields {i32}:result1 = 8</i>
-%result2  = call i32 @llvm.atomic.load.sub.i32.p0i32( i32* %ptr, i32 2 )
-                                <i>; yields {i32}:result2 = 4</i>
-%result3  = call i32 @llvm.atomic.load.sub.i32.p0i32( i32* %ptr, i32 5 )
-                                <i>; yields {i32}:result3 = 2</i>
-%memval1  = load i32* %ptr      <i>; yields {i32}:memval1 = -3</i>
-</pre>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="int_atomic_load_and">'<tt>llvm.atomic.load.and.*</tt>' Intrinsic</a><br>
-  <a name="int_atomic_load_nand">'<tt>llvm.atomic.load.nand.*</tt>' Intrinsic</a><br>
-  <a name="int_atomic_load_or">'<tt>llvm.atomic.load.or.*</tt>' Intrinsic</a><br>
-  <a name="int_atomic_load_xor">'<tt>llvm.atomic.load.xor.*</tt>' Intrinsic</a><br>
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<p>These are overloaded intrinsics. You can
-  use <tt>llvm.atomic.load_and</tt>, <tt>llvm.atomic.load_nand</tt>,
-  <tt>llvm.atomic.load_or</tt>, and <tt>llvm.atomic.load_xor</tt> on any integer
-  bit width and for different address spaces. Not all targets support all bit
-  widths however.</p>
-
-<pre>
-  declare i8 @llvm.atomic.load.and.i8.p0i8( i8* &lt;ptr&gt;, i8 &lt;delta&gt; )
-  declare i16 @llvm.atomic.load.and.i16.p0i16( i16* &lt;ptr&gt;, i16 &lt;delta&gt; )
-  declare i32 @llvm.atomic.load.and.i32.p0i32( i32* &lt;ptr&gt;, i32 &lt;delta&gt; )
-  declare i64 @llvm.atomic.load.and.i64.p0i64( i64* &lt;ptr&gt;, i64 &lt;delta&gt; )
-</pre>
-
-<pre>
-  declare i8 @llvm.atomic.load.or.i8.p0i8( i8* &lt;ptr&gt;, i8 &lt;delta&gt; )
-  declare i16 @llvm.atomic.load.or.i16.p0i16( i16* &lt;ptr&gt;, i16 &lt;delta&gt; )
-  declare i32 @llvm.atomic.load.or.i32.p0i32( i32* &lt;ptr&gt;, i32 &lt;delta&gt; )
-  declare i64 @llvm.atomic.load.or.i64.p0i64( i64* &lt;ptr&gt;, i64 &lt;delta&gt; )
-</pre>
-
-<pre>
-  declare i8 @llvm.atomic.load.nand.i8.p0i32( i8* &lt;ptr&gt;, i8 &lt;delta&gt; )
-  declare i16 @llvm.atomic.load.nand.i16.p0i32( i16* &lt;ptr&gt;, i16 &lt;delta&gt; )
-  declare i32 @llvm.atomic.load.nand.i32.p0i32( i32* &lt;ptr&gt;, i32 &lt;delta&gt; )
-  declare i64 @llvm.atomic.load.nand.i64.p0i32( i64* &lt;ptr&gt;, i64 &lt;delta&gt; )
-</pre>
-
-<pre>
-  declare i8 @llvm.atomic.load.xor.i8.p0i32( i8* &lt;ptr&gt;, i8 &lt;delta&gt; )
-  declare i16 @llvm.atomic.load.xor.i16.p0i32( i16* &lt;ptr&gt;, i16 &lt;delta&gt; )
-  declare i32 @llvm.atomic.load.xor.i32.p0i32( i32* &lt;ptr&gt;, i32 &lt;delta&gt; )
-  declare i64 @llvm.atomic.load.xor.i64.p0i32( i64* &lt;ptr&gt;, i64 &lt;delta&gt; )
-</pre>
-
-<h5>Overview:</h5>
-<p>These intrinsics bitwise the operation (and, nand, or, xor) <tt>delta</tt> to
-   the value stored in memory at <tt>ptr</tt>. It yields the original value
-   at <tt>ptr</tt>.</p>
-
-<h5>Arguments:</h5>
-<p>These intrinsics take two arguments, the first a pointer to an integer value
-   and the second an integer value. The result is also an integer value. These
-   integer types can have any bit width, but they must all have the same bit
-   width. The targets may only lower integer representations they support.</p>
-
-<h5>Semantics:</h5>
-<p>These intrinsics does a series of operations atomically. They first load the
-   value stored at <tt>ptr</tt>. They then do the bitwise
-   operation <tt>delta</tt>, store the result to <tt>ptr</tt>. They yield the
-   original value stored at <tt>ptr</tt>.</p>
-
-<h5>Examples:</h5>
-<pre>
-%mallocP  = tail call i8* @malloc(i32 ptrtoint (i32* getelementptr (i32* null, i32 1) to i32))
-%ptr      = bitcast i8* %mallocP to i32*
-            store i32 0x0F0F, %ptr
-%result0  = call i32 @llvm.atomic.load.nand.i32.p0i32( i32* %ptr, i32 0xFF )
-                                <i>; yields {i32}:result0 = 0x0F0F</i>
-%result1  = call i32 @llvm.atomic.load.and.i32.p0i32( i32* %ptr, i32 0xFF )
-                                <i>; yields {i32}:result1 = 0xFFFFFFF0</i>
-%result2  = call i32 @llvm.atomic.load.or.i32.p0i32( i32* %ptr, i32 0F )
-                                <i>; yields {i32}:result2 = 0xF0</i>
-%result3  = call i32 @llvm.atomic.load.xor.i32.p0i32( i32* %ptr, i32 0F )
-                                <i>; yields {i32}:result3 = FF</i>
-%memval1  = load i32* %ptr      <i>; yields {i32}:memval1 = F0</i>
-</pre>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="int_atomic_load_max">'<tt>llvm.atomic.load.max.*</tt>' Intrinsic</a><br>
-  <a name="int_atomic_load_min">'<tt>llvm.atomic.load.min.*</tt>' Intrinsic</a><br>
-  <a name="int_atomic_load_umax">'<tt>llvm.atomic.load.umax.*</tt>' Intrinsic</a><br>
-  <a name="int_atomic_load_umin">'<tt>llvm.atomic.load.umin.*</tt>' Intrinsic</a><br>
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<p>These are overloaded intrinsics. You can use <tt>llvm.atomic.load_max</tt>,
-   <tt>llvm.atomic.load_min</tt>, <tt>llvm.atomic.load_umax</tt>, and
-   <tt>llvm.atomic.load_umin</tt> on any integer bit width and for different
-   address spaces. Not all targets support all bit widths however.</p>
-
-<pre>
-  declare i8 @llvm.atomic.load.max.i8.p0i8( i8* &lt;ptr&gt;, i8 &lt;delta&gt; )
-  declare i16 @llvm.atomic.load.max.i16.p0i16( i16* &lt;ptr&gt;, i16 &lt;delta&gt; )
-  declare i32 @llvm.atomic.load.max.i32.p0i32( i32* &lt;ptr&gt;, i32 &lt;delta&gt; )
-  declare i64 @llvm.atomic.load.max.i64.p0i64( i64* &lt;ptr&gt;, i64 &lt;delta&gt; )
-</pre>
-
-<pre>
-  declare i8 @llvm.atomic.load.min.i8.p0i8( i8* &lt;ptr&gt;, i8 &lt;delta&gt; )
-  declare i16 @llvm.atomic.load.min.i16.p0i16( i16* &lt;ptr&gt;, i16 &lt;delta&gt; )
-  declare i32 @llvm.atomic.load.min.i32..p0i32( i32* &lt;ptr&gt;, i32 &lt;delta&gt; )
-  declare i64 @llvm.atomic.load.min.i64..p0i64( i64* &lt;ptr&gt;, i64 &lt;delta&gt; )
-</pre>
-
-<pre>
-  declare i8 @llvm.atomic.load.umax.i8.p0i8( i8* &lt;ptr&gt;, i8 &lt;delta&gt; )
-  declare i16 @llvm.atomic.load.umax.i16.p0i16( i16* &lt;ptr&gt;, i16 &lt;delta&gt; )
-  declare i32 @llvm.atomic.load.umax.i32.p0i32( i32* &lt;ptr&gt;, i32 &lt;delta&gt; )
-  declare i64 @llvm.atomic.load.umax.i64.p0i64( i64* &lt;ptr&gt;, i64 &lt;delta&gt; )
-</pre>
-
-<pre>
-  declare i8 @llvm.atomic.load.umin.i8..p0i8( i8* &lt;ptr&gt;, i8 &lt;delta&gt; )
-  declare i16 @llvm.atomic.load.umin.i16.p0i16( i16* &lt;ptr&gt;, i16 &lt;delta&gt; )
-  declare i32 @llvm.atomic.load.umin.i32..p0i32( i32* &lt;ptr&gt;, i32 &lt;delta&gt; )
-  declare i64 @llvm.atomic.load.umin.i64..p0i64( i64* &lt;ptr&gt;, i64 &lt;delta&gt; )
-</pre>
-
-<h5>Overview:</h5>
-<p>These intrinsics takes the signed or unsigned minimum or maximum of
-   <tt>delta</tt> and the value stored in memory at <tt>ptr</tt>. It yields the
-   original value at <tt>ptr</tt>.</p>
-
-<h5>Arguments:</h5>
-<p>These intrinsics take two arguments, the first a pointer to an integer value
-   and the second an integer value. The result is also an integer value. These
-   integer types can have any bit width, but they must all have the same bit
-   width. The targets may only lower integer representations they support.</p>
-
-<h5>Semantics:</h5>
-<p>These intrinsics does a series of operations atomically. They first load the
-   value stored at <tt>ptr</tt>. They then do the signed or unsigned min or
-   max <tt>delta</tt> and the value, store the result to <tt>ptr</tt>. They
-   yield the original value stored at <tt>ptr</tt>.</p>
-
-<h5>Examples:</h5>
-<pre>
-%mallocP  = tail call i8* @malloc(i32 ptrtoint (i32* getelementptr (i32* null, i32 1) to i32))
-%ptr      = bitcast i8* %mallocP to i32*
-            store i32 7, %ptr
-%result0  = call i32 @llvm.atomic.load.min.i32.p0i32( i32* %ptr, i32 -2 )
-                                <i>; yields {i32}:result0 = 7</i>
-%result1  = call i32 @llvm.atomic.load.max.i32.p0i32( i32* %ptr, i32 8 )
-                                <i>; yields {i32}:result1 = -2</i>
-%result2  = call i32 @llvm.atomic.load.umin.i32.p0i32( i32* %ptr, i32 10 )
-                                <i>; yields {i32}:result2 = 8</i>
-%result3  = call i32 @llvm.atomic.load.umax.i32.p0i32( i32* %ptr, i32 30 )
-                                <i>; yields {i32}:result3 = 8</i>
-%memval1  = load i32* %ptr      <i>; yields {i32}:memval1 = 30</i>
-</pre>
-
-</div>
-
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="int_memorymarkers">Memory Use Markers</a>
-</div>
-
-<div class="doc_text">
-
-<p>This class of intrinsics exists to information about the lifetime of memory
-   objects and ranges where variables are immutable.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="int_lifetime_start">'<tt>llvm.lifetime.start</tt>' Intrinsic</a>
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  declare void @llvm.lifetime.start(i64 &lt;size&gt;, i8* nocapture &lt;ptr&gt;)
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>llvm.lifetime.start</tt>' intrinsic specifies the start of a memory
-   object's lifetime.</p>
-
-<h5>Arguments:</h5>
-<p>The first argument is a constant integer representing the size of the
-   object, or -1 if it is variable sized.  The second argument is a pointer to
-   the object.</p>
-
-<h5>Semantics:</h5>
-<p>This intrinsic indicates that before this point in the code, the value of the
-   memory pointed to by <tt>ptr</tt> is dead.  This means that it is known to
-   never be used and has an undefined value.  A load from the pointer that
-   precedes this intrinsic can be replaced with
-   <tt>'<a href="#undefvalues">undef</a>'</tt>.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="int_lifetime_end">'<tt>llvm.lifetime.end</tt>' Intrinsic</a>
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  declare void @llvm.lifetime.end(i64 &lt;size&gt;, i8* nocapture &lt;ptr&gt;)
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>llvm.lifetime.end</tt>' intrinsic specifies the end of a memory
-   object's lifetime.</p>
-
-<h5>Arguments:</h5>
-<p>The first argument is a constant integer representing the size of the
-   object, or -1 if it is variable sized.  The second argument is a pointer to
-   the object.</p>
-
-<h5>Semantics:</h5>
-<p>This intrinsic indicates that after this point in the code, the value of the
-   memory pointed to by <tt>ptr</tt> is dead.  This means that it is known to
-   never be used and has an undefined value.  Any stores into the memory object
-   following this intrinsic may be removed as dead.
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="int_invariant_start">'<tt>llvm.invariant.start</tt>' Intrinsic</a>
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  declare {}* @llvm.invariant.start(i64 &lt;size&gt;, i8* nocapture &lt;ptr&gt;) readonly
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>llvm.invariant.start</tt>' intrinsic specifies that the contents of
-   a memory object will not change.</p>
-
-<h5>Arguments:</h5>
-<p>The first argument is a constant integer representing the size of the
-   object, or -1 if it is variable sized.  The second argument is a pointer to
-   the object.</p>
-
-<h5>Semantics:</h5>
-<p>This intrinsic indicates that until an <tt>llvm.invariant.end</tt> that uses
-   the return value, the referenced memory location is constant and
-   unchanging.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="int_invariant_end">'<tt>llvm.invariant.end</tt>' Intrinsic</a>
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  declare void @llvm.invariant.end({}* &lt;start&gt;, i64 &lt;size&gt;, i8* nocapture &lt;ptr&gt;)
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>llvm.invariant.end</tt>' intrinsic specifies that the contents of
-   a memory object are mutable.</p>
-
-<h5>Arguments:</h5>
-<p>The first argument is the matching <tt>llvm.invariant.start</tt> intrinsic.
-   The second argument is a constant integer representing the size of the
-   object, or -1 if it is variable sized and the third argument is a pointer
-   to the object.</p>
-
-<h5>Semantics:</h5>
-<p>This intrinsic indicates that the memory is mutable again.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="int_general">General Intrinsics</a>
-</div>
-
-<div class="doc_text">
-
-<p>This class of intrinsics is designed to be generic and has no specific
-   purpose.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="int_var_annotation">'<tt>llvm.var.annotation</tt>' Intrinsic</a>
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  declare void @llvm.var.annotation(i8* &lt;val&gt;, i8* &lt;str&gt;, i8* &lt;str&gt;, i32  &lt;int&gt; )
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>llvm.var.annotation</tt>' intrinsic.</p>
-
-<h5>Arguments:</h5>
-<p>The first argument is a pointer to a value, the second is a pointer to a
-   global string, the third is a pointer to a global string which is the source
-   file name, and the last argument is the line number.</p>
-
-<h5>Semantics:</h5>
-<p>This intrinsic allows annotation of local variables with arbitrary strings.
-   This can be useful for special purpose optimizations that want to look for
-   these annotations.  These have no other defined use, they are ignored by code
-   generation and optimization.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="int_annotation">'<tt>llvm.annotation.*</tt>' Intrinsic</a>
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<p>This is an overloaded intrinsic. You can use '<tt>llvm.annotation</tt>' on
-   any integer bit width.</p>
-
-<pre>
-  declare i8 @llvm.annotation.i8(i8 &lt;val&gt;, i8* &lt;str&gt;, i8* &lt;str&gt;, i32  &lt;int&gt; )
-  declare i16 @llvm.annotation.i16(i16 &lt;val&gt;, i8* &lt;str&gt;, i8* &lt;str&gt;, i32  &lt;int&gt; )
-  declare i32 @llvm.annotation.i32(i32 &lt;val&gt;, i8* &lt;str&gt;, i8* &lt;str&gt;, i32  &lt;int&gt; )
-  declare i64 @llvm.annotation.i64(i64 &lt;val&gt;, i8* &lt;str&gt;, i8* &lt;str&gt;, i32  &lt;int&gt; )
-  declare i256 @llvm.annotation.i256(i256 &lt;val&gt;, i8* &lt;str&gt;, i8* &lt;str&gt;, i32  &lt;int&gt; )
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>llvm.annotation</tt>' intrinsic.</p>
-
-<h5>Arguments:</h5>
-<p>The first argument is an integer value (result of some expression), the
-   second is a pointer to a global string, the third is a pointer to a global
-   string which is the source file name, and the last argument is the line
-   number.  It returns the value of the first argument.</p>
-
-<h5>Semantics:</h5>
-<p>This intrinsic allows annotations to be put on arbitrary expressions with
-   arbitrary strings.  This can be useful for special purpose optimizations that
-   want to look for these annotations.  These have no other defined use, they
-   are ignored by code generation and optimization.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="int_trap">'<tt>llvm.trap</tt>' Intrinsic</a>
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  declare void @llvm.trap()
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>llvm.trap</tt>' intrinsic.</p>
-
-<h5>Arguments:</h5>
-<p>None.</p>
-
-<h5>Semantics:</h5>
-<p>This intrinsics is lowered to the target dependent trap instruction. If the
-   target does not have a trap instruction, this intrinsic will be lowered to
-   the call of the <tt>abort()</tt> function.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="int_stackprotector">'<tt>llvm.stackprotector</tt>' Intrinsic</a>
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  declare void @llvm.stackprotector( i8* &lt;guard&gt;, i8** &lt;slot&gt; )
-</pre>
-
-<h5>Overview:</h5>
-<p>The <tt>llvm.stackprotector</tt> intrinsic takes the <tt>guard</tt> and
-   stores it onto the stack at <tt>slot</tt>. The stack slot is adjusted to
-   ensure that it is placed on the stack before local variables.</p>
-
-<h5>Arguments:</h5>
-<p>The <tt>llvm.stackprotector</tt> intrinsic requires two pointer
-   arguments. The first argument is the value loaded from the stack
-   guard <tt>@__stack_chk_guard</tt>. The second variable is an <tt>alloca</tt>
-   that has enough space to hold the value of the guard.</p>
-
-<h5>Semantics:</h5>
-<p>This intrinsic causes the prologue/epilogue inserter to force the position of
-   the <tt>AllocaInst</tt> stack slot to be before local variables on the
-   stack. This is to ensure that if a local variable on the stack is
-   overwritten, it will destroy the value of the guard. When the function exits,
-   the guard on the stack is checked against the original guard. If they're
-   different, then the program aborts by calling the <tt>__stack_chk_fail()</tt>
-   function.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="int_objectsize">'<tt>llvm.objectsize</tt>' Intrinsic</a>
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
-  declare i32 @llvm.objectsize.i32( i8* &lt;object&gt;, i1 &lt;type&gt; )
-  declare i64 @llvm.objectsize.i64( i8* &lt;object&gt;, i1 &lt;type&gt; )
-</pre>
-
-<h5>Overview:</h5>
-<p>The <tt>llvm.objectsize</tt> intrinsic is designed to provide information
-   to the optimizers to discover at compile time either a) when an
-   operation like memcpy will either overflow a buffer that corresponds to
-   an object, or b) to determine that a runtime check for overflow isn't
-   necessary. An object in this context means an allocation of a
-   specific class, structure, array, or other object.</p>
-
-<h5>Arguments:</h5>
-<p>The <tt>llvm.objectsize</tt> intrinsic takes two arguments.  The first
-   argument is a pointer to or into the <tt>object</tt>. The second argument
-   is a boolean 0 or 1.  This argument determines whether you want the 
-   maximum (0) or minimum (1) bytes remaining.  This needs to be a literal 0 or
-   1, variables are not allowed.</p>
-   
-<h5>Semantics:</h5>
-<p>The <tt>llvm.objectsize</tt> intrinsic is lowered to either a constant
-   representing the size of the object concerned or <tt>i32/i64 -1 or 0</tt>
-   (depending on the <tt>type</tt> argument if the size cannot be determined
-   at compile time.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<hr>
-<address>
-  <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
-  src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS"></a>
-  <a href="http://validator.w3.org/check/referer"><img
-  src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
-
-  <a href="mailto:sabre at nondot.org">Chris Lattner</a><br>
-  <a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
-  Last modified: $Date$
-</address>
-
-</body>
-</html>
diff --git a/libclamav/c++/llvm/docs/Lexicon.html b/libclamav/c++/llvm/docs/Lexicon.html
deleted file mode 100644
index 820fdd6..0000000
--- a/libclamav/c++/llvm/docs/Lexicon.html
+++ /dev/null
@@ -1,263 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-  <title>The LLVM Lexicon</title>
-  <link rel="stylesheet" href="llvm.css" type="text/css">
-  <meta name="author" content="Various">
-  <meta name="description" 
-  content="A glossary of terms used with the LLVM project.">
-</head>
-<body>
-<div class="doc_title">The LLVM Lexicon</div>
-<p class="doc_warning">NOTE: This document is a work in progress!</p>
-<!-- *********************************************************************** -->
-<div class="doc_section">Table Of Contents</div>
-<!-- *********************************************************************** -->
-<div class="doc_text">
-  <table>
-    <tr><th colspan="8"><b>- <a href="#A">A</a> -</b></th></tr>
-    <tr>
-      <td><a href="#ADCE">ADCE</a></td>
-    </tr>
-    <tr><th colspan="8"><b>- <a href="#B">B</a> -</b></th></tr>
-    <tr>
-      <td><a href="#BURS">BURS</a></td>
-    </tr>
-    <tr><th colspan="8"><b>- <a href="#C">C</a> -</b></th></tr>
-    <tr>
-      <td><a href="#CSE">CSE</a></td>
-    </tr>
-    <tr><th colspan="8"><b>- <a href="#D">D</a> -</b></th></tr>
-    <tr>
-      <td><a href="#DAG">DAG</a></td>
-      <td><a href="#Derived_Pointer">Derived Pointer</a></td>
-      <td><a href="#DSA">DSA</a></td>
-      <td><a href="#DSE">DSE</a></td>
-    </tr>
-    <tr><th colspan="8"><b>- <a href="#G">G</a> -</b></th></tr>
-    <tr>
-      <td><a href="#GC">GC</a></td>
-    </tr>
-    <tr><th colspan="8"><b>- <a href="#I">I</a> -</b></th></tr>
-    <tr>
-      <td><a href="#IPA">IPA</a></td>
-      <td><a href="#IPO">IPO</a></td>
-      <td><a href="#ISel">ISel</a></td>
-    </tr>
-    <tr><th colspan="8"><b>- <a href="#L">L</a> -</b></th></tr>
-    <tr>
-      <td><a href="#LCSSA">LCSSA</a></td>
-      <td><a href="#LICM">LICM</a></td>
-      <td><a href="#Load-VN">Load-VN</a></td>
-    </tr>
-    <tr><th colspan="8"><b>- <a href="#O">O</a> -</b></th></tr>
-    <tr>
-      <td><a href="#Object_Pointer">Object Pointer</a></td>
-    </tr>
-    <tr><th colspan="8"><b>- <a href="#P">P</a> -</b></th></tr>
-    <tr>
-      <td><a href="#PRE">PRE</a></td>
-    </tr>
-    <tr><th colspan="8"><b>- <a href="#R">R</a> -</b></th></tr>
-    <tr>
-      <td><a href="#RAUW">RAUW</a></td>
-      <td><a href="#Reassociation">Reassociation</a></td>
-      <td><a href="#Root">Root</a></td>
-    </tr>
-    <tr><th colspan="8"><b>- <a href="#S">S</a> -</b></th></tr>
-    <tr>
-      <td><a href="#Safe_Point">Safe Point</a></td>
-      <td><a href="#SCC">SCC</a></td>
-      <td><a href="#SCCP">SCCP</a></td>
-      <td><a href="#SDISel">SDISel</a></td>
-      <td><a href="#SRoA">SRoA</a></td>
-      <td><a href="#Stack_Map">Stack Map</a></td>
-    </tr>
-  </table>
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">Definitions</div>
-<!-- *********************************************************************** -->
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsection"><a name="A">- A -</a></div>
-<div class="doc_text">
-  <dl>
-    <dt><a name="ADCE"><b>ADCE</b></a></dt>
-    <dd>Aggressive Dead Code Elimination</dd>
-  </dl>
-</div>
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsection"><a name="B">- B -</a></div>
-<div class="doc_text">
-  <dl>
-    <dt><a name="BURS"><b>BURS</b></a></dt>
-    <dd>Bottom Up Rewriting System&mdash;A method of instruction selection for
-        code generation.  An example is the <a 
-href="http://www.program-transformation.org/Transform/BURG">BURG</a> tool.</dd>
-  </dl>
-</div>
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsection"><a name="C">- C -</a></div>
-<div class="doc_text">
-  <dl>
-    <dt><a name="CSE"><b>CSE</b></a></dt>
-    <dd>Common Subexpression Elimination. An optimization that removes common
-    subexpression compuation. For example <tt>(a+b)*(a+b)</tt> has two
-    subexpressions that are the same: <tt>(a+b)</tt>. This optimization would
-    perform the addition only once and then perform the multiply (but only if
-    it's compulationally correct/safe).
-  </dl>
-</div>
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsection"><a name="D">- D -</a></div>
-<div class="doc_text">
-  <dl>
-    <dt><a name="DAG"><b>DAG</b></a></dt>
-    <dd>Directed Acyclic Graph</dd>
-    <dt><a name="Derived_Pointer"><b>Derived Pointer</b></a></dt>
-    <dd>A pointer to the interior of an object, such that a garbage collector
-    is unable to use the pointer for reachability analysis. While a derived
-    pointer is live, the corresponding object pointer must be kept in a root,
-    otherwise the collector might free the referenced object. With copying
-    collectors, derived pointers pose an additional hazard that they may be
-    invalidated at any <a href="Safe_Point">safe point</a>. This term is used in
-    opposition to <a href="#Object_Pointer">object pointer</a>.</dd>
-    <dt><a name="DSA"><b>DSA</b></a></dt>
-    <dd>Data Structure Analysis</dd>
-    <dt><a name="DSE"><b>DSE</b></a></dt>
-    <dd>Dead Store Elimination</dd>
-  </dl>
-</div>
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsection"><a name="G">- G -</a></div>
-<div class="doc_text">
-  <dl>
-    <dt><a name="GC"><b>GC</b></a></dt>
-    <dd>Garbage Collection. The practice of using reachability analysis instead
-    of explicit memory management to reclaim unused memory.</dd>
-  </dl>
-</div>
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsection"><a name="H">- H -</a></div>
-<div class="doc_text">
-  <dl>
-    <dt><a name="Heap"><b>Heap</b></a></dt>
-    <dd>In garbage collection, the region of memory which is managed using
-    reachability analysis.</dd>
-  </dl>
-</div>
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsection"><a name="I">- I -</a></div>
-<div class="doc_text">
-  <dl>
-    <dt><a name="IPA"><b>IPA</b></a></dt>
-    <dd>Inter-Procedural Analysis. Refers to any variety of code analysis that
-    occurs between procedures, functions or compilation units (modules).</dd>
-    <dt><a name="IPO"><b>IPO</b></a></dt>
-    <dd>Inter-Procedural Optimization. Refers to any variety of code
-    optimization that occurs between procedures, functions or compilation units
-    (modules).</dd>
-    <dt><a name="ISel"><b>ISel</b></a></dt>
-    <dd>Instruction Selection.</dd>
-  </dl>
-</div>
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsection"><a name="L">- L -</a></div>
-<div class="doc_text">
-  <dl>
-  	<dt><a name="LCSSA"><b>LCSSA</b></a></dt>
-  	<dd>Loop-Closed Static Single Assignment Form</dd>
-    <dt><a name="LICM"><b>LICM</b></a></dt>
-    <dd>Loop Invariant Code Motion</dd>
-    <dt><a name="Load-VN"><b>Load-VN</b></a></dt>
-    <dd>Load Value Numbering</dd>
-  </dl>
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsection"><a name="O">- O -</a></div>
-<div class="doc_text">
-  <dl>
-    <dt><a name="Object_Pointer"><b>Object Pointer</b></a></dt>
-    <dd>A pointer to an object such that the garbage collector is able to trace
-    references contained within the object. This term is used in opposition to
-    <a href="#Derived_Pointer">derived pointer</a>.</dd>
-  </dl>
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsection"><a name="P">- P -</a></div>
-<div class="doc_text">
-  <dl>
-    <dt><a name="PRE"><b>PRE</b></a></dt>
-    <dd>Partial Redundancy Elimination</dd>
-  </dl>
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsection"><a name="R">- R -</a></div>
-<div class="doc_text">
-  <dl>
-  	<dt><a name="RAUW"><b>RAUW</b></a></dt> <dd>An abbreviation for Replace
-  	All Uses With. The functions User::replaceUsesOfWith(), 
-  	Value::replaceAllUsesWith(), and Constant::replaceUsesOfWithOnConstant()
-  	implement the replacement of one Value with another by iterating over its
-  	def/use chain and fixing up all of the pointers to point to the new value.
-  	See also <a href="ProgrammersManual.html#iterate_chains">def/use chains</a>.
-  	</dd>
-    <dt><a name="Reassociation"><b>Reassociation</b></a></dt> <dd>Rearranging
-    associative expressions to promote better redundancy elimination and other
-    optimization.  For example, changing (A+B-A) into (B+A-A), permitting it to
-    be optimized into (B+0) then (B).</dd>
-    <dt><a name="Root"><b>Root</b></a></dt> <dd>In garbage collection, a
-    pointer variable lying outside of the <a href="#Heap">heap</a> from which
-    the collector begins its reachability analysis. In the context of code
-    generation, "root" almost always refers to a "stack root" -- a local or
-    temporary variable within an executing function.</dd>
-  </dl>
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsection"><a name="S">- S -</a></div>
-<div class="doc_text">
-  <dl>
-    <dt><a name="Safe_Point"><b>Safe Point</b></a></dt>
-    <dd>In garbage collection, it is necessary to identify <a href="#Root">stack
-    roots</a> so that reachability analysis may proceed. It may be infeasible to
-    provide this information for every instruction, so instead the information
-    may is calculated only at designated safe points. With a copying collector,
-    <a href="#Derived_Pointers">derived pointers</a> must not be retained across
-    safe points and <a href="#Object_Pointers">object pointers</a> must be
-    reloaded from stack roots.</dd>
-    <dt><a name="SDISel"><b>SDISel</b></a></dt>
-    <dd>Selection DAG Instruction Selection.</dd>
-    <dt><a name="SCC"><b>SCC</b></a></dt>
-    <dd>Strongly Connected Component</dd>
-    <dt><a name="SCCP"><b>SCCP</b></a></dt>
-    <dd>Sparse Conditional Constant Propagation</dd>
-    <dt><a name="SRoA"><b>SRoA</b></a></dt>
-    <dd>Scalar Replacement of Aggregates</dd>
-    <dt><a name="SSA"><b>SSA</b></a></dt>
-    <dd>Static Single Assignment</dd>
-    <dt><a name="Stack_Map"><b>Stack Map</b></a></dt>
-    <dd>In garbage collection, metadata emitted by the code generator which
-    identifies <a href="#Root">roots</a> within the stack frame of an executing
-    function.</dd>
-  </dl>
-</div>
-<!-- *********************************************************************** -->
-<hr>
-<address> <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
- src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS"></a><a
- href="http://validator.w3.org/check/referer"><img
- src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a><a
- href="http://llvm.org/">The LLVM Team</a><br>
-<a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
-Last modified: $Date$
-</address>
-<!-- vim: sw=2
--->
-</body>
-</html>
diff --git a/libclamav/c++/llvm/docs/LinkTimeOptimization.html b/libclamav/c++/llvm/docs/LinkTimeOptimization.html
deleted file mode 100644
index 524a4e8..0000000
--- a/libclamav/c++/llvm/docs/LinkTimeOptimization.html
+++ /dev/null
@@ -1,390 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" 
-                      "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
- <title>LLVM Link Time Optimization: Design and Implementation</title>
-  <link rel="stylesheet" href="llvm.css" type="text/css">
-</head>
-
-<div class="doc_title">
-  LLVM Link Time Optimization: Design and Implementation
-</div>
-
-<ul>
-  <li><a href="#desc">Description</a></li>
-  <li><a href="#design">Design Philosophy</a>
-  <ul>
-    <li><a href="#example1">Example of link time optimization</a></li>
-    <li><a href="#alternative_approaches">Alternative Approaches</a></li>
-  </ul></li>
-  <li><a href="#multiphase">Multi-phase communication between LLVM and linker</a>
-  <ul>
-    <li><a href="#phase1">Phase 1 : Read LLVM Bytecode Files</a></li>
-    <li><a href="#phase2">Phase 2 : Symbol Resolution</a></li>
-    <li><a href="#phase3">Phase 3 : Optimize Bitcode Files</a></li>
-    <li><a href="#phase4">Phase 4 : Symbol Resolution after optimization</a></li>
-  </ul></li>
-  <li><a href="#lto">libLTO</a>
-  <ul>
-    <li><a href="#lto_module_t">lto_module_t</a></li>
-    <li><a href="#lto_code_gen_t">lto_code_gen_t</a></li>
-  </ul>
-</ul>
-
-<div class="doc_author">
-<p>Written by Devang Patel and Nick Kledzik</p>
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-<a name="desc">Description</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-<p>
-LLVM features powerful intermodular optimizations which can be used at link 
-time.  Link Time Optimization (LTO) is another name for intermodular optimization 
-when performed during the link stage. This document describes the interface 
-and design between the LTO optimizer and the linker.</p>
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-<a name="design">Design Philosophy</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-<p>
-The LLVM Link Time Optimizer provides complete transparency, while doing 
-intermodular optimization, in the compiler tool chain. Its main goal is to let 
-the developer take advantage of intermodular optimizations without making any 
-significant changes to the developer's makefiles or build system. This is 
-achieved through tight integration with the linker. In this model, the linker 
-treates LLVM bitcode files like native object files and allows mixing and 
-matching among them. The linker uses <a href="#lto">libLTO</a>, a shared
-object, to handle LLVM bitcode files. This tight integration between 
-the linker and LLVM optimizer helps to do optimizations that are not possible 
-in other models. The linker input allows the optimizer to avoid relying on 
-conservative escape analysis.
-</p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="example1">Example of link time optimization</a>
-</div>
-
-<div class="doc_text">
-  <p>The following example illustrates the advantages of LTO's integrated
-  approach and clean interface. This example requires a system linker which
-  supports LTO through the interface described in this document.  Here,
-  llvm-gcc transparently invokes system linker. </p>
-  <ul>
-    <li> Input source file <tt>a.c</tt> is compiled into LLVM bitcode form.
-    <li> Input source file <tt>main.c</tt> is compiled into native object code.
-  </ul>
-<pre class="doc_code">
---- a.h ---
-extern int foo1(void);
-extern void foo2(void);
-extern void foo4(void);
---- a.c ---
-#include "a.h"
-
-static signed int i = 0;
-
-void foo2(void) {
- i = -1;
-}
-
-static int foo3() {
-foo4();
-return 10;
-}
-
-int foo1(void) {
-int data = 0;
-
-if (i &lt; 0) { data = foo3(); }
-
-data = data + 42;
-return data;
-}
-
---- main.c ---
-#include &lt;stdio.h&gt;
-#include "a.h"
-
-void foo4(void) {
- printf ("Hi\n");
-}
-
-int main() {
- return foo1();
-}
-
---- command lines ---
-$ llvm-gcc --emit-llvm -c a.c -o a.o  # &lt;-- a.o is LLVM bitcode file
-$ llvm-gcc -c main.c -o main.o # &lt;-- main.o is native object file
-$ llvm-gcc a.o main.o -o main # &lt;-- standard link command without any modifications
-</pre>
-  <p>In this example, the linker recognizes that <tt>foo2()</tt> is an 
-  externally visible symbol defined in LLVM bitcode file. The linker completes 
-  its usual symbol resolution 
-  pass and finds that <tt>foo2()</tt> is not used anywhere. This information 
-  is used by the LLVM optimizer and it removes <tt>foo2()</tt>. As soon as 
-  <tt>foo2()</tt> is removed, the optimizer recognizes that condition 
-  <tt>i &lt; 0</tt> is always false, which means <tt>foo3()</tt> is never 
-  used. Hence, the optimizer removes <tt>foo3()</tt>, also.  And this in turn, 
-  enables linker to remove <tt>foo4()</tt>.  This example illustrates the 
-  advantage of tight integration with the linker. Here, the optimizer can not 
-  remove <tt>foo3()</tt> without the linker's input.
-  </p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="alternative_approaches">Alternative Approaches</a>
-</div>
-
-<div class="doc_text">
-  <dl>
-    <dt><b>Compiler driver invokes link time optimizer separately.</b></dt>
-    <dd>In this model the link time optimizer is not able to take advantage of 
-    information collected during the linker's normal symbol resolution phase. 
-    In the above example, the optimizer can not remove <tt>foo2()</tt> without 
-    the linker's input because it is externally visible. This in turn prohibits
-    the optimizer from removing <tt>foo3()</tt>.</dd>
-    <dt><b>Use separate tool to collect symbol information from all object
-    files.</b></dt>
-    <dd>In this model, a new, separate, tool or library replicates the linker's
-    capability to collect information for link time optimization. Not only is
-    this code duplication difficult to justify, but it also has several other 
-    disadvantages.  For example, the linking semantics and the features 
-    provided by the linker on various platform are not unique. This means, 
-    this new tool needs to support all such features and platforms in one 
-    super tool or a separate tool per platform is required. This increases 
-    maintenance cost for link time optimizer significantly, which is not 
-    necessary. This approach also requires staying synchronized with linker 
-    developements on various platforms, which is not the main focus of the link 
-    time optimizer. Finally, this approach increases end user's build time due 
-    to the duplication of work done by this separate tool and the linker itself.
-    </dd>
-  </dl>
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="multiphase">Multi-phase communication between libLTO and linker</a>
-</div>
-
-<div class="doc_text">
-  <p>The linker collects information about symbol defininitions and uses in 
-  various link objects which is more accurate than any information collected 
-  by other tools during typical build cycles.  The linker collects this 
-  information by looking at the definitions and uses of symbols in native .o 
-  files and using symbol visibility information. The linker also uses 
-  user-supplied information, such as a list of exported symbols. LLVM 
-  optimizer collects control flow information, data flow information and knows 
-  much more about program structure from the optimizer's point of view. 
-  Our goal is to take advantage of tight integration between the linker and 
-  the optimizer by sharing this information during various linking phases.
-</p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="phase1">Phase 1 : Read LLVM Bitcode Files</a>
-</div>
-
-<div class="doc_text">
-  <p>The linker first reads all object files in natural order and collects 
-  symbol information. This includes native object files as well as LLVM bitcode 
-  files.  To minimize the cost to the linker in the case that all .o files
-  are native object files, the linker only calls <tt>lto_module_create()</tt> 
-  when a supplied object file is found to not be a native object file.  If
-  <tt>lto_module_create()</tt> returns that the file is an LLVM bitcode file, 
-  the linker
-  then iterates over the module using <tt>lto_module_get_symbol_name()</tt> and
-  <tt>lto_module_get_symbol_attribute()</tt> to get all symbols defined and 
-  referenced.
-  This information is added to the linker's global symbol table.
-</p>
-  <p>The lto* functions are all implemented in a shared object libLTO.  This
-  allows the LLVM LTO code to be updated independently of the linker tool.
-  On platforms that support it, the shared object is lazily loaded. 
-</p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="phase2">Phase 2 : Symbol Resolution</a>
-</div>
-
-<div class="doc_text">
-  <p>In this stage, the linker resolves symbols using global symbol table. 
-  It may report undefined symbol errors, read archive members, replace 
-  weak symbols, etc.  The linker is able to do this seamlessly even though it 
-  does not know the exact content of input LLVM bitcode files.  If dead code 
-  stripping is enabled then the linker collects the list of live symbols.
-  </p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="phase3">Phase 3 : Optimize Bitcode Files</a>
-</div>
-<div class="doc_text">
-  <p>After symbol resolution, the linker tells the LTO shared object which
-  symbols are needed by native object files.  In the example above, the linker 
-  reports that only <tt>foo1()</tt> is used by native object files using 
-  <tt>lto_codegen_add_must_preserve_symbol()</tt>.  Next the linker invokes
-  the LLVM optimizer and code generators using <tt>lto_codegen_compile()</tt>
-  which returns a native object file creating by merging the LLVM bitcode files 
-  and applying various optimization passes.  
-</p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="phase4">Phase 4 : Symbol Resolution after optimization</a>
-</div>
-
-<div class="doc_text">
-  <p>In this phase, the linker reads optimized a native object file and 
-  updates the internal global symbol table to reflect any changes. The linker 
-  also collects information about any changes in use of external symbols by 
-  LLVM bitcode files. In the examle above, the linker notes that 
-  <tt>foo4()</tt> is not used any more. If dead code stripping is enabled then 
-  the linker refreshes the live symbol information appropriately and performs 
-  dead code stripping.</p>
-  <p>After this phase, the linker continues linking as if it never saw LLVM 
-  bitcode files.</p>
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-<a name="lto">libLTO</a>
-</div>
-
-<div class="doc_text">
-  <p><tt>libLTO</tt> is a shared object that is part of the LLVM tools, and 
-  is intended for use by a linker. <tt>libLTO</tt> provides an abstract C 
-  interface to use the LLVM interprocedural optimizer without exposing details 
-  of LLVM's internals. The intention is to keep the interface as stable as 
-  possible even when the LLVM optimizer continues to evolve. It should even
-  be possible for a completely different compilation technology to provide
-  a different libLTO that works with their object files and the standard
-  linker tool.</p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="lto_module_t">lto_module_t</a>
-</div>
-
-<div class="doc_text">
-
-<p>A non-native object file is handled via an <tt>lto_module_t</tt>.  
-The following functions allow the linker to check if a file (on disk
-or in a memory buffer) is a file which libLTO can process:</p>
-
-<pre class="doc_code">
-lto_module_is_object_file(const char*)
-lto_module_is_object_file_for_target(const char*, const char*)
-lto_module_is_object_file_in_memory(const void*, size_t)
-lto_module_is_object_file_in_memory_for_target(const void*, size_t, const char*)
-</pre>
-
-<p>If the object file can be processed by libLTO, the linker creates a
-<tt>lto_module_t</tt> by using one of</p>
-
-<pre class="doc_code">
-lto_module_create(const char*)
-lto_module_create_from_memory(const void*, size_t)
-</pre>
-
-<p>and when done, the handle is released via</p>
-
-<pre class="doc_code">
-lto_module_dispose(lto_module_t)
-</pre>
-
-<p>The linker can introspect the non-native object file by getting the number of
-symbols and getting the name and attributes of each symbol via:</p>
-
-<pre class="doc_code">
-lto_module_get_num_symbols(lto_module_t)
-lto_module_get_symbol_name(lto_module_t, unsigned int)
-lto_module_get_symbol_attribute(lto_module_t, unsigned int)
-</pre>
-
-<p>The attributes of a symbol include the alignment, visibility, and kind.</p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="lto_code_gen_t">lto_code_gen_t</a>
-</div>
-
-<div class="doc_text">
-
-<p>Once the linker has loaded each non-native object files into an
-<tt>lto_module_t</tt>, it can request libLTO to process them all and
-generate a native object file.  This is done in a couple of steps.
-First, a code generator is created with:</p>
-
-<pre class="doc_code">lto_codegen_create()</pre>
-
-<p>Then, each non-native object file is added to the code generator with:</p>
-
-<pre class="doc_code">
-lto_codegen_add_module(lto_code_gen_t, lto_module_t)
-</pre>
-
-<p>The linker then has the option of setting some codegen options.  Whether or
-not to generate DWARF debug info is set with:</p>
-  
-<pre class="doc_code">lto_codegen_set_debug_model(lto_code_gen_t)</pre>
-
-<p>Which kind of position independence is set with:</p>
-
-<pre class="doc_code">lto_codegen_set_pic_model(lto_code_gen_t) </pre>
-  
-<p>And each symbol that is referenced by a native object file or otherwise must
-not be optimized away is set with:</p>
-
-<pre class="doc_code">
-lto_codegen_add_must_preserve_symbol(lto_code_gen_t, const char*)
-</pre>
-
-<p>After all these settings are done, the linker requests that a native object
-file be created from the modules with the settings using:</p>
-
-<pre class="doc_code">lto_codegen_compile(lto_code_gen_t, size*)</pre>
-
-<p>which returns a pointer to a buffer containing the generated native
-object file.  The linker then parses that and links it with the rest 
-of the native object files.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-
-<hr>
-<address>
-  <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
-  src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS"></a>
-  <a href="http://validator.w3.org/check/referer"><img
-  src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
-
-  Devang Patel and Nick Kledzik<br>
-  <a href="http://llvm.org">LLVM Compiler Infrastructure</a><br>
-  Last modified: $Date$
-</address>
-
-</body>
-</html>
-
diff --git a/libclamav/c++/llvm/docs/Makefile b/libclamav/c++/llvm/docs/Makefile
deleted file mode 100644
index 5bfa6c3..0000000
--- a/libclamav/c++/llvm/docs/Makefile
+++ /dev/null
@@ -1,123 +0,0 @@
-##===- docs/Makefile ---------------------------------------*- Makefile -*-===##
-# 
-#                     The LLVM Compiler Infrastructure
-#
-# This file is distributed under the University of Illinois Open Source
-# License. See LICENSE.TXT for details.
-# 
-##===----------------------------------------------------------------------===##
-
-LEVEL      := ..
-DIRS       := CommandGuide tutorial
-
-ifdef BUILD_FOR_WEBSITE
-PROJ_OBJ_DIR = .
-DOXYGEN = doxygen
-
-$(PROJ_OBJ_DIR)/doxygen.cfg: doxygen.cfg.in
-	cat $< | sed \
-	  -e 's/@abs_top_srcdir@/../g' \
-	  -e 's/@DOT@/dot/g' \
-	  -e 's/@PACKAGE_VERSION@/mainline/' \
-	  -e 's/@abs_top_builddir@/../g' > $@
-endif
-
-include $(LEVEL)/Makefile.common
-
-HTML       := $(wildcard $(PROJ_SRC_DIR)/*.html) \
-              $(wildcard $(PROJ_SRC_DIR)/*.css)
-IMAGES     := $(wildcard $(PROJ_SRC_DIR)/img/*.*)
-DOXYFILES  := doxygen.cfg.in doxygen.css doxygen.footer doxygen.header \
-              doxygen.intro
-EXTRA_DIST := $(HTML) $(DOXYFILES) llvm.css CommandGuide img
-
-.PHONY: install-html install-doxygen doxygen install-ocamldoc ocamldoc generated
-
-install_targets := install-html
-ifeq ($(ENABLE_DOXYGEN),1)
-install_targets += install-doxygen
-endif
-ifneq (,$(filter ocaml,$(BINDINGS_TO_BUILD)))
-install_targets += install-ocamldoc
-endif
-install-local:: $(install_targets)
-
-# Live documentation is generated for the web site using this target:
-# 'make generated BUILD_FOR_WEBSITE=1'
-generated:: doxygen ocamldoc
-
-install-html: $(PROJ_OBJ_DIR)/html.tar.gz
-	$(Echo) Installing HTML documentation
-	$(Verb) $(MKDIR) $(PROJ_docsdir)/html
-	$(Verb) $(MKDIR) $(PROJ_docsdir)/html/img
-	$(Verb) $(DataInstall) $(HTML) $(PROJ_docsdir)/html
-	$(Verb) $(DataInstall) $(IMAGES) $(PROJ_docsdir)/html/img
-	$(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/html.tar.gz $(PROJ_docsdir)
-
-$(PROJ_OBJ_DIR)/html.tar.gz: $(HTML)
-	$(Echo) Packaging HTML documentation
-	$(Verb) $(RM) -rf $@ $(PROJ_OBJ_DIR)/html.tar
-	$(Verb) cd $(PROJ_SRC_DIR) && \
-	  $(TAR) cf $(PROJ_OBJ_DIR)/html.tar *.html
-	$(Verb) $(GZIP) $(PROJ_OBJ_DIR)/html.tar
-
-install-doxygen: doxygen
-	$(Echo) Installing doxygen documentation
-	$(Verb) $(MKDIR) $(PROJ_docsdir)/html/doxygen
-	$(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/doxygen.tar.gz $(PROJ_docsdir)
-	$(Verb) cd $(PROJ_OBJ_DIR)/doxygen && \
-	  $(FIND) . -type f -exec \
-	    $(DataInstall) {} $(PROJ_docsdir)/html/doxygen \;
-
-doxygen: regendoc $(PROJ_OBJ_DIR)/doxygen.tar.gz
-
-regendoc:
-	$(Echo) Building doxygen documentation
-	$(Verb) if test -e $(PROJ_OBJ_DIR)/doxygen ; then \
-	  $(RM) -rf $(PROJ_OBJ_DIR)/doxygen ; \
-	fi
-	$(Verb) $(DOXYGEN) $(PROJ_OBJ_DIR)/doxygen.cfg
-
-$(PROJ_OBJ_DIR)/doxygen.tar.gz: $(DOXYFILES) $(PROJ_OBJ_DIR)/doxygen.cfg
-	$(Echo) Packaging doxygen documentation
-	$(Verb) $(RM) -rf $@ $(PROJ_OBJ_DIR)/doxygen.tar
-	$(Verb) $(TAR) cf $(PROJ_OBJ_DIR)/doxygen.tar doxygen
-	$(Verb) $(GZIP) $(PROJ_OBJ_DIR)/doxygen.tar
-	$(Verb) $(CP) $(PROJ_OBJ_DIR)/doxygen.tar.gz $(PROJ_OBJ_DIR)/doxygen/html/
-
-userloc: $(LLVM_SRC_ROOT)/docs/userloc.html
-
-$(LLVM_SRC_ROOT)/docs/userloc.html:
-	$(Echo) Making User LOC Table
-	$(Verb) cd $(LLVM_SRC_ROOT) ; ./utils/userloc.pl -details -recurse \
-	  -html lib include tools runtime utils examples autoconf test > docs/userloc.html
-
-install-ocamldoc: ocamldoc
-	$(Echo) Installing ocamldoc documentation
-	$(Verb) $(MKDIR) $(PROJ_docsdir)/ocamldoc/html
-	$(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/ocamldoc.tar.gz $(PROJ_docsdir)
-	$(Verb) cd $(PROJ_OBJ_DIR)/ocamldoc && \
-	  $(FIND) . -type f -exec \
-	    $(DataInstall) {} $(PROJ_docsdir)/ocamldoc/html \;
-
-ocamldoc: regen-ocamldoc
-	$(Echo) Packaging ocamldoc documentation
-	$(Verb) $(RM) -rf $(PROJ_OBJ_DIR)/ocamldoc.tar*
-	$(Verb) $(TAR) cf $(PROJ_OBJ_DIR)/ocamldoc.tar ocamldoc
-	$(Verb) $(GZIP) $(PROJ_OBJ_DIR)/ocamldoc.tar
-	$(Verb) $(CP) $(PROJ_OBJ_DIR)/ocamldoc.tar.gz $(PROJ_OBJ_DIR)/ocamldoc/html/
-
-regen-ocamldoc:
-	$(Echo) Building ocamldoc documentation
-	$(Verb) if test -e $(PROJ_OBJ_DIR)/ocamldoc ; then \
-		$(RM) -rf $(PROJ_OBJ_DIR)/ocamldoc ; \
-	fi
-	$(Verb) $(MAKE) -C $(LEVEL)/bindings/ocaml ocamldoc
-	$(Verb) $(MKDIR) $(PROJ_OBJ_DIR)/ocamldoc/html
-	$(Verb) \
-		$(OCAMLDOC) -d $(PROJ_OBJ_DIR)/ocamldoc/html -sort -colorize-code -html \
-		`$(FIND) $(LEVEL)/bindings/ocaml -name "*.odoc" -exec echo -load '{}' ';'`
-
-uninstall-local::
-	$(Echo) Uninstalling Documentation
-	$(Verb) $(RM) -rf $(PROJ_docsdir)
diff --git a/libclamav/c++/llvm/docs/MakefileGuide.html b/libclamav/c++/llvm/docs/MakefileGuide.html
deleted file mode 100644
index a9c0725..0000000
--- a/libclamav/c++/llvm/docs/MakefileGuide.html
+++ /dev/null
@@ -1,1027 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-  <title>LLVM Makefile Guide</title>
-  <link rel="stylesheet" href="llvm.css" type="text/css">
-</head>
-<body>
-
-<div class="doc_title">LLVM Makefile Guide</div>
-
-<ol>
-  <li><a href="#introduction">Introduction</a></li>
-  <li><a href="#general">General Concepts</a>
-    <ol>
-      <li><a href="#projects">Projects</a></li>
-      <li><a href="#varvals">Variable Values</a></li>
-      <li><a href="#including">Including Makefiles</a>
-        <ol>
-          <li><a href="#Makefile">Makefile</a></li>
-          <li><a href="#Makefile.common">Makefile.common</a></li>
-          <li><a href="#Makefile.config">Makefile.config</a></li>
-          <li><a href="#Makefile.rules">Makefile.rules</a></li>
-        </ol>
-      </li>
-      <li><a href="#Comments">Comments</a></li>
-    </ol>
-  </li>
-  <li><a href="#tutorial">Tutorial</a>
-    <ol>
-      <li><a href="#libraries">Libraries</a>
-        <ol>
-	  <li><a href="#BCModules">Bitcode Modules</a></li>
-	  <li><a href="#LoadableModules">Loadable Modules</a></li>
-	</ol>
-      </li>
-      <li><a href="#tools">Tools</a>
-        <ol>
-	  <li><a href="#JIT">JIT Tools</a></li>
-	</ol>
-      </li>
-      <li><a href="#projects">Projects</a></li>
-    </ol>
-  </li>
-  <li><a href="#targets">Targets Supported</a>
-    <ol>
-      <li><a href="#all">all</a></li>
-      <li><a href="#all-local">all-local</a></li>
-      <li><a href="#check">check</a></li>
-      <li><a href="#check-local">check-local</a></li>
-      <li><a href="#clean">clean</a></li>
-      <li><a href="#clean-local">clean-local</a></li>
-      <li><a href="#dist">dist</a></li>
-      <li><a href="#dist-check">dist-check</a></li>
-      <li><a href="#dist-clean">dist-clean</a></li>
-      <li><a href="#install">install</a></li>
-      <li><a href="#preconditions">preconditions</a></li>
-      <li><a href="#printvars">printvars</a></li>
-      <li><a href="#reconfigure">reconfigure</a></li>
-      <li><a href="#spotless">spotless</a></li>
-      <li><a href="#tags">tags</a></li>
-      <li><a href="#uninstall">uninstall</a></li>
-    </ol>
-  </li>
-  <li><a href="#variables">Using Variables</a>
-    <ol>
-      <li><a href="#setvars">Control Variables</a></li>
-      <li><a href="#overvars">Override Variables</a></li>
-      <li><a href="#getvars">Readable Variables</a></li>
-      <li><a href="#intvars">Internal Variables</a></li>
-    </ol>
-  </li>
-</ol>
-
-<div class="doc_author">    
-  <p>Written by <a href="mailto:reid at x10sys.com">Reid Spencer</a></p>
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="introduction">Introduction </a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-  <p>This document provides <em>usage</em> information about the LLVM makefile 
-  system. While loosely patterned after the BSD makefile system, LLVM has taken 
-  a departure from BSD in order to implement additional features needed by LLVM.
-  Although makefile systems such as automake were attempted at one point, it
-  has become clear that the features needed by LLVM and the Makefile norm are 
-  too great to use a more limited tool. Consequently, LLVM requires simply GNU 
-  Make 3.79, a widely portable makefile processor. LLVM unabashedly makes heavy 
-  use of the features of GNU Make so the dependency on GNU Make is firm. If 
-  you're not familiar with <tt>make</tt>, it is recommended that you read the 
-  <a href="http://www.gnu.org/software/make/manual/make.html">GNU Makefile 
-  Manual</a>.</p>
-  <p>While this document is rightly part of the 
-  <a href="ProgrammersManual.html">LLVM Programmer's Manual</a>, it is treated
-  separately here because of the volume of content and because it is often an
-  early source of bewilderment for new developers.</p>
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="general">General Concepts</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-  <p>The LLVM Makefile System is the component of LLVM that is responsible for
-  building the software, testing it,  generating distributions, checking those
-  distributions, installing and uninstalling, etc. It consists of a several
-  files throughout the source tree. These files and other general concepts are
-  described in this section.</p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="projects">Projects</a></div>
-<div class="doc_text">
-  <p>The LLVM Makefile System is quite generous. It not only builds its own
-  software, but it can build yours too. Built into the system is knowledge of
-  the <tt>llvm/projects</tt> directory. Any directory under <tt>projects</tt>
-  that has both a <tt>configure</tt> script and a <tt>Makefile</tt> is assumed
-  to be a project that uses the LLVM Makefile system.  Building software that
-  uses LLVM does not require the LLVM Makefile System nor even placement in the
-  <tt>llvm/projects</tt> directory. However, doing so will allow your project
-  to get up and running quickly by utilizing the built-in features that are used
-  to compile LLVM. LLVM compiles itself using the same features of the makefile
-  system as used for projects.</p>
-  <p>For complete details on setting up your projects configuration, simply
-  mimic the <tt>llvm/projects/sample</tt> project or for further details, 
-  consult the <a href="Projects.html">Projects.html</a> page.</p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="varvalues">Variable Values</a></div>
-<div class="doc_text">
-  <p>To use the makefile system, you simply create a file named 
-  <tt>Makefile</tt> in your directory and declare values for certain variables. 
-  The variables and values that you select determine what the makefile system
-  will do. These variables enable rules and processing in the makefile system
-  that automatically Do The Right Thing&trade;. 
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="including">Including Makefiles</a></div>
-<div class="doc_text">
-  <p>Setting variables alone is not enough. You must include into your Makefile
-  additional files that provide the rules of the LLVM Makefile system. The 
-  various files involved are described in the sections that follow.</p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection"><a name="Makefile">Makefile</a></div>
-<div class="doc_text">
-  <p>Each directory to participate in the build needs to have a file named
-  <tt>Makefile</tt>. This is the file first read by <tt>make</tt>. It has three
-  sections:</p>
-  <ol>
-    <li><a href="#setvars">Settable Variables</a> - Required that must be set
-    first.</li>
-    <li><a href="#Makefile.common">include <tt>$(LEVEL)/Makefile.common</tt></a>
-    - include the LLVM Makefile system.
-    <li><a href="#overvars">Override Variables</a> - Override variables set by
-    the LLVM Makefile system.
-  </ol>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection"><a name="Makefile.common">Makefile.common</a>
-</div>
-<div class="doc_text">
-  <p>Every project must have a <tt>Makefile.common</tt> file at its top source 
-  directory. This file serves three purposes:</p>
-  <ol>
-    <li>It includes the project's configuration makefile to obtain values
-    determined by the <tt>configure</tt> script. This is done by including the
-    <a href="#Makefile.config"><tt>$(LEVEL)/Makefile.config</tt></a> file.</li>
-    <li>It specifies any other (static) values that are needed throughout the
-    project. Only values that are used in all or a large proportion of the
-    project's directories should be placed here.</li>
-    <li>It includes the standard rules for the LLVM Makefile system,
-    <a href="#Makefile.rules"><tt>$(LLVM_SRC_ROOT)/Makefile.rules</tt></a>. 
-    This file is the "guts" of the LLVM Makefile system.</li>
-  </ol>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection"><a name="Makefile.config">Makefile.config</a>
-</div>
-<div class="doc_text">
-  <p>Every project must have a <tt>Makefile.config</tt> at the top of its
-  <em>build</em> directory. This file is <b>generated</b> by the
-  <tt>configure</tt> script from the pattern provided by the
-  <tt>Makefile.config.in</tt> file located at the top of the project's
-  <em>source</em> directory. The contents of this file depend largely on what
-  configuration items the project uses, however most projects can get what they
-  need by just relying on LLVM's configuration found in
-  <tt>$(LLVM_OBJ_ROOT)/Makefile.config</tt>.
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection"><a name="Makefile.rules">Makefile.rules</a></div>
-<div class="doc_text">
-  <p>This file, located at <tt>$(LLVM_SRC_ROOT)/Makefile.rules</tt> is the heart
-  of the LLVM Makefile System. It provides all the logic, dependencies, and
-  rules for building the targets supported by the system. What it does largely
-  depends on the values of <tt>make</tt> <a href="#variables">variables</a> that
-  have been set <em>before</em> <tt>Makefile.rules</tt> is included.
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="Comments">Comments</a></div>
-<div class="doc_text">
-  <p>User Makefiles need not have comments in them unless the construction is
-  unusual or it does not strictly follow the rules and patterns of the LLVM
-  makefile system. Makefile comments are invoked with the pound (#) character.
-  The # character and any text following it, to the end of the line, are ignored
-  by <tt>make</tt>.</p>
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="tutorial">Tutorial</a></div>
-<!-- *********************************************************************** -->
-<div class="doc_text">
-  <p>This section provides some examples of the different kinds of modules you
-  can build with the LLVM makefile system. In general, each directory you 
-  provide will build a single object although that object may be composed of
-  additionally compiled components.</p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="libraries">Libraries</a></div>
-<div class="doc_text">
-  <p>Only a few variable definitions are needed to build a regular library.
-  Normally, the makefile system will build all the software into a single
-  <tt>libname.o</tt> (pre-linked) object. This means the library is not
-  searchable and that the distinction between compilation units has been
-  dissolved. Optionally, you can ask for a shared library (.so) or archive
-  library (.a) built.  Archive libraries are the default. For example:</p>
-  <pre><tt>
-      LIBRARYNAME = mylib
-      SHARED_LIBRARY = 1
-      ARCHIVE_LIBRARY = 1
-  </tt></pre>
-  <p>says to build a library named "mylib" with both a shared library 
-  (<tt>mylib.so</tt>) and an archive library (<tt>mylib.a</tt>) version. The
-  contents of all the
-  libraries produced will be the same, they are just constructed differently.
-  Note that you normally do not need to specify the sources involved. The LLVM
-  Makefile system will infer the source files from the contents of the source
-  directory.</p>
-  <p>The <tt>LOADABLE_MODULE=1</tt> directive can be used in conjunction with
-  <tt>SHARED_LIBRARY=1</tt> to indicate that the resulting shared library should
-  be openable with the <tt>dlopen</tt> function and searchable with the
-  <tt>dlsym</tt> function (or your operating system's equivalents). While this
-  isn't strictly necessary on Linux and a few other platforms, it is required
-  on systems like HP-UX and Darwin. You should use <tt>LOADABLE_MODULE</tt> for
-  any shared library that you intend to be loaded into an tool via the
-  <tt>-load</tt> option. See the 
-  <a href="WritingAnLLVMPass.html#makefile">WritingAnLLVMPass.html</a> document
-  for an example of why you might want to do this.
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection"><a name="BCModules">Bitcode Modules</a></div>
-<div class="doc_text">
-  <p>In some situations, it is desirable to build a single bitcode module from
-  a variety of sources, instead of an archive, shared library, or bitcode 
-  library. Bitcode modules can be specified in addition to any of the other
-  types of libraries by defining the <a href="#MODULE_NAME">MODULE_NAME</a>
-  variable. For example:</p>
-  <pre><tt>
-      LIBRARYNAME = mylib
-      BYTECODE_LIBRARY = 1
-      MODULE_NAME = mymod
-  </tt></pre>
-  <p>will build a module named <tt>mymod.bc</tt> from the sources in the
-  directory. This module will be an aggregation of all the bitcode modules 
-  derived from the sources. The example will also build a bitcode archive 
-  containing a bitcode module for each compiled source file. The difference is
-  subtle, but important depending on how the module or library is to be linked.
-  </p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection">
-  <a name="LoadableModules">Loadable Modules</a>
-</div>
-<div class="doc_text">
-  <p>In some situations, you need to create a loadable module. Loadable modules
-  can be loaded into programs like <tt>opt</tt> or <tt>llc</tt> to specify
-  additional passes to run or targets to support.  Loadable modules are also
-  useful for debugging a pass or providing a pass with another package if that
-  pass can't be included in LLVM.</p>
-  <p>LLVM provides complete support for building such a module. All you need to
-  do is use the LOADABLE_MODULE variable in your Makefile. For example, to 
-  build a loadable module named <tt>MyMod</tt> that uses the LLVM libraries
-  <tt>LLVMSupport.a</tt> and <tt>LLVMSystem.a</tt>, you would specify:</p>
-  <pre><tt>
-     LIBRARYNAME := MyMod
-     LOADABLE_MODULE := 1
-     LINK_COMPONENTS := support system
-  </tt></pre>
-  <p>Use of the <tt>LOADABLE_MODULE</tt> facility implies several things:</p>
-  <ol>
-    <li>There will be no "lib" prefix on the module. This differentiates it from
-    a standard shared library of the same name.</li>
-    <li>The <a href="#SHARED_LIBRARY">SHARED_LIBRARY</a> variable is turned 
-    on.</li>
-    <li>The <a href="#LINK_LIBS_IN_SHARED">LINK_LIBS_IN_SHARED</a> variable
-    is turned on.</li>
-  </ol>
-  <p>A loadable module is loaded by LLVM via the facilities of libtool's libltdl
-  library which is part of <tt>lib/System</tt> implementation.</p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="tools">Tools</a></div>
-<div class="doc_text">
-  <p>For building executable programs (tools), you must provide the name of the
-  tool and the names of the libraries you wish to link with the tool. For
-  example:</p>
-  <pre><tt>
-      TOOLNAME = mytool
-      USEDLIBS = mylib
-      LINK_COMPONENTS = support system
-  </tt></pre>
-  <p>says that we are to build a tool name <tt>mytool</tt> and that it requires
-  three libraries: <tt>mylib</tt>, <tt>LLVMSupport.a</tt> and
-  <tt>LLVMSystem.a</tt>.</p>
-  <p>Note that two different variables are use to indicate which libraries are
-  linked: <tt>USEDLIBS</tt> and <tt>LLVMLIBS</tt>. This distinction is necessary
-  to support projects. <tt>LLVMLIBS</tt> refers to the LLVM libraries found in 
-  the LLVM object directory. <tt>USEDLIBS</tt> refers to the libraries built by 
-  your project. In the case of building LLVM tools, <tt>USEDLIBS</tt> and 
-  <tt>LLVMLIBS</tt> can be used interchangeably since the "project" is LLVM 
-  itself and <tt>USEDLIBS</tt> refers to the same place as <tt>LLVMLIBS</tt>.
-  </p>
-  <p>Also note that there are two different ways of specifying a library: with a
-  <tt>.a</tt> suffix and without. Without the suffix, the entry refers to the
-  re-linked (.o) file which will include <em>all</em> symbols of the library.
-  This is useful, for example, to include all passes from a library of passes.
-  If the <tt>.a</tt> suffix is used then the library is linked as a searchable
-  library (with the <tt>-l</tt> option). In this case, only the symbols that are
-  unresolved <em>at that point</em> will be resolved from the library, if they
-  exist. Other (unreferenced) symbols will not be included when the <tt>.a</tt>
-  syntax is used. Note that in order to use the <tt>.a</tt> suffix, the library
-  in question must have been built with the <tt>ARCHIVE_LIBRARY</tt> option set.
-  </p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection"><a name="JIT">JIT Tools</a></div>
-<div class="doc_text">
-  <p>Many tools will want to use the JIT features of LLVM.  To do this, you
-     simply specify that you want an execution 'engine', and the makefiles will
-     automatically link in the appropriate JIT for the host or an interpreter
-     if none is available:</p>
-  <pre><tt>
-      TOOLNAME = my_jit_tool
-      USEDLIBS = mylib
-      LINK_COMPONENTS = engine
-  </tt></pre>
-  <p>Of course, any additional libraries may be listed as other components.  To
-  get a full understanding of how this changes the linker command, it is
-  recommended that you:</p>
-  <pre><tt>
-      cd examples/Fibonacci
-      make VERBOSE=1
-  </tt></pre>
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="targets">Targets Supported</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-  <p>This section describes each of the targets that can be built using the LLVM
-  Makefile system. Any target can be invoked from any directory but not all are
-  applicable to a given directory (e.g. "check", "dist" and "install" will
-  always operate as if invoked from the top level directory).</p>
-
-  <table style="text-align:left">
-    <tr>
-      <th>Target Name</th><th>Implied Targets</th><th>Target Description</th>
-    </tr>
-    <tr><td><a href="#all"><tt>all</tt></a></td><td></td>
-      <td>Compile the software recursively. Default target.
-    </td></tr>
-    <tr><td><a href="#all-local"><tt>all-local</tt></a></td><td></td>
-      <td>Compile the software in the local directory only.
-    </td></tr>
-    <tr><td><a href="#check"><tt>check</tt></a></td><td></td>
-      <td>Change to the <tt>test</tt> directory in a project and run the
-      test suite there.
-    </td></tr>
-    <tr><td><a href="#check-local"><tt>check-local</tt></a></td><td></td>
-      <td>Run a local test suite. Generally this is only defined in the 
-        <tt>Makefile</tt> of the project's <tt>test</tt> directory.
-    </td></tr>
-    <tr><td><a href="#clean"><tt>clean</tt></a></td><td></td>
-      <td>Remove built objects recursively.
-    </td></tr>
-    <tr><td><a href="#clean-local"><tt>clean-local</tt></a></td><td></td>
-      <td>Remove built objects from the local directory only.
-    </td></tr>
-    <tr><td><a href="#dist"><tt>dist</tt></a></td><td>all</td>
-      <td>Prepare a source distribution tarball.
-    </td></tr>
-    <tr><td><a href="#dist-check"><tt>dist-check</tt></a></td><td>all</td>
-      <td>Prepare a source distribution tarball and check that it builds.
-    </td></tr>
-    <tr><td><a href="#dist-clean"><tt>dist-clean</tt></a></td><td>clean</td>
-      <td>Clean source distribution tarball temporary files.
-    </td></tr>
-    <tr><td><a href="#install"><tt>install</tt></a></td><td>all</td>
-      <td>Copy built objects to installation directory.
-    </td></tr>
-    <tr><td><a href="#preconditions"><tt>preconditions</tt></a></td><td>all</td>
-      <td>Check to make sure configuration and makefiles are up to date.
-    </td></tr>
-    <tr><td><a href="#printvars"><tt>printvars</tt></a></td><td>all</td>
-      <td>Prints variables defined by the makefile system (for debugging).
-    </td></tr>
-    <tr><td><a href="#tags"><tt>tags</tt></a></td><td></td>
-      <td>Make C and C++ tags files for emacs and vi.
-    </td></tr>
-    <tr><td><a href="#uninstall"><tt>uninstall</tt></a></td><td></td>
-      <td>Remove built objects from installation directory.
-    </td></tr>
-  </table>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="all">all (default)</a></div>
-<div class="doc_text">
-  <p>When you invoke <tt>make</tt> with no arguments, you are implicitly
-  instructing it to seek the "all" target (goal). This target is used for
-  building the software recursively and will do different things in different 
-  directories.  For example, in a <tt>lib</tt> directory, the "all" target will 
-  compile source files and generate libraries. But, in a <tt>tools</tt> 
-  directory, it will link libraries and generate executables.</p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="all-local">all-local</a></div>
-<div class="doc_text">
-  <p>This target is the same as <a href="#all">all</a> but it operates only on
-  the current directory instead of recursively.</p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="check">check</a></div>
-<div class="doc_text">
-  <p>This target can be invoked from anywhere within a project's directories
-  but always invokes the <a href="#check-local"><tt>check-local</tt></a> target 
-  in the project's <tt>test</tt> directory, if it exists and has a 
-  <tt>Makefile</tt>. A warning is produced otherwise.  If 
-  <a href="#TESTSUITE"><tt>TESTSUITE</tt></a> is defined on the <tt>make</tt>
-  command line, it will be passed down to the invocation of 
-  <tt>make check-local</tt> in the <tt>test</tt> directory. The intended usage 
-  for this is to assist in running specific suites of tests. If
-  <tt>TESTSUITE</tt> is not set, the implementation of <tt>check-local</tt> 
-  should run all normal tests.  It is up to the project to define what 
-  different values for <tt>TESTSUTE</tt> will do. See the 
-  <a href="TestingGuide.html">TestingGuide</a> for further details.</p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="check-local">check-local</a></div>
-<div class="doc_text">
-  <p>This target should be implemented by the <tt>Makefile</tt> in the project's
-  <tt>test</tt> directory. It is invoked by the <tt>check</tt> target elsewhere.
-  Each project is free to define the actions of <tt>check-local</tt> as 
-  appropriate for that project. The LLVM project itself uses dejagnu to run a 
-  suite of feature and regresson tests. Other projects may choose to use 
-  dejagnu or any other testing mechanism.</p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="clean">clean</a></div>
-<div class="doc_text">
-  <p>This target cleans the build directory, recursively removing all things
-  that the Makefile builds. The cleaning rules have been made guarded so they 
-  shouldn't go awry (via <tt>rm -f $(UNSET_VARIABLE)/*</tt> which will attempt
-  to erase the entire directory structure.</p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="clean-local">clean-local</a></div>
-<div class="doc_text">
-  <p>This target does the same thing as <tt>clean</tt> but only for the current
-  (local) directory.</p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="dist">dist</a></div>
-<div class="doc_text">
-  <p>This target builds a distribution tarball. It first builds the entire
-  project using the <tt>all</tt> target and then tars up the necessary files and
-  compresses it. The generated tarball is sufficient for a casual source 
-  distribution, but probably not for a release (see <tt>dist-check</tt>).</p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="dist-check">dist-check</a></div>
-<div class="doc_text">
-  <p>This target does the same thing as the <tt>dist</tt> target but also checks
-  the distribution tarball. The check is made by unpacking the tarball to a new
-  directory, configuring it, building it, installing it, and then verifying that
-  the installation results are correct (by comparing to the original build).
-  This target can take a long time to run but should be done before a release
-  goes out to make sure that the distributed tarball can actually be built into
-  a working release.</p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="dist-clean">dist-clean</a></div>
-<div class="doc_text">
-  <p>This is a special form of the <tt>clean</tt> clean target. It performs a
-  normal <tt>clean</tt> but also removes things pertaining to building the
-  distribution.</p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="install">install</a></div>
-<div class="doc_text">
-  <p>This target finalizes shared objects and executables and copies all
-  libraries, headers, executables and documentation to the directory given 
-  with the <tt>--prefix</tt> option to <tt>configure</tt>.  When completed, 
-  the prefix directory will have everything needed to <b>use</b> LLVM. </p>
-  <p>The LLVM makefiles can generate complete <b>internal</b> documentation 
-  for all the classes by using <tt>doxygen</tt>. By default, this feature is 
-  <b>not</b> enabled because it takes a long time and generates a massive 
-  amount of data (>100MB). If you want this feature, you must configure LLVM
-  with the --enable-doxygen switch and ensure that a modern version of doxygen
-  (1.3.7 or later) is available in your <tt>PATH</tt>. You can download 
-  doxygen from 
-  <a href="http://www.stack.nl/~dimitri/doxygen/download.html#latestsrc">
-  here</a>.
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="preconditions">preconditions</a></div>
-<div class="doc_text">
-  <p>This utility target checks to see if the <tt>Makefile</tt> in the object
-  directory is older than the <tt>Makefile</tt> in the source directory and
-  copies it if so. It also reruns the <tt>configure</tt> script if that needs to
-  be done and rebuilds the <tt>Makefile.config</tt> file similarly. Users may
-  overload this target to ensure that sanity checks are run <em>before</em> any
-  building of targets as all the targets depend on <tt>preconditions</tt>.</p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="printvars">printvars</a></div>
-<div class="doc_text">
-  <p>This utility target just causes the LLVM makefiles to print out some of 
-  the makefile variables so that you can double check how things are set. </p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="reconfigure">reconfigure</a></div>
-<div class="doc_text">
-  <p>This utility target will force a reconfigure of LLVM or your project. It 
-  simply runs <tt>$(PROJ_OBJ_ROOT)/config.status --recheck</tt> to rerun the
-  configuration tests and rebuild the configured files. This isn't generally
-  useful as the makefiles will reconfigure themselves whenever its necessary.
-  </p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="spotless">spotless</a></div>
-<div class="doc_text">
-  <p>This utility target, only available when <tt>$(PROJ_OBJ_ROOT)</tt> is not 
-  the same as <tt>$(PROJ_SRC_ROOT)</tt>, will completely clean the
-  <tt>$(PROJ_OBJ_ROOT)</tt> directory by removing its content entirely and 
-  reconfiguring the directory. This returns the <tt>$(PROJ_OBJ_ROOT)</tt> 
-  directory to a completely fresh state. All content in the directory except 
-  configured files and top-level makefiles will be lost.</p>
-  <div class="doc_warning"><p>Use with caution.</p></div>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="tags">tags</a></div>
-<div class="doc_text">
-  <p>This target will generate a <tt>TAGS</tt> file in the top-level source
-  directory. It is meant for use with emacs, XEmacs, or ViM. The TAGS file
-  provides an index of symbol definitions so that the editor can jump you to the
-  definition quickly. </p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="uninstall">uninstall</a></div>
-<div class="doc_text">
-  <p>This target is the opposite of the <tt>install</tt> target. It removes the
-  header, library and executable files from the installation directories. Note
-  that the directories themselves are not removed because it is not guaranteed
-  that LLVM is the only thing installing there (e.g. --prefix=/usr).</p>
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="variables">Variables</a></div>
-<!-- *********************************************************************** -->
-<div class="doc_text">
-  <p>Variables are used to tell the LLVM Makefile System what to do and to
-  obtain information from it. Variables are also used internally by the LLVM
-  Makefile System. Variable names that contain only the upper case alphabetic
-  letters and underscore are intended for use by the end user. All other
-  variables are internal to the LLVM Makefile System and should not be relied
-  upon nor modified. The sections below describe how to use the LLVM Makefile 
-  variables.</p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="setvars">Control Variables</a></div>
-<div class="doc_text">
-  <p>Variables listed in the table below should be set <em>before</em> the 
-  inclusion of <a href="#Makefile.common"><tt>$(LEVEL)/Makefile.common</tt></a>.
-  These variables provide input to the LLVM make system that tell it what to do 
-  for the current directory.</p>
-  <dl>
-    <dt><a name="BUILD_ARCHIVE"><tt>BUILD_ARCHIVE</tt></a></dt>
-    <dd>If set to any value, causes an archive (.a) library to be built.</dd>
-    <dt><a name="BUILT_SOURCES"><tt>BUILT_SOURCES</tt></a></dt>
-    <dd>Specifies a set of source files that are generated from other source
-    files. These sources will be built before any other target processing to 
-    ensure they are present.</dd>
-    <dt><a name="BYTECODE_LIBRARY"><tt>BYTECODE_LIBRARY</tt></a></dt>
-    <dd>If set to any value, causes a bitcode library (.bc) to be built.</dd>
-    <dt><a name="CONFIG_FILES"><tt>CONFIG_FILES</tt></a></dt>
-    <dd>Specifies a set of configuration files to be installed.</dd>
-    <dt><a name="DEBUG_SYMBOLS"><tt>DEBUG_SYMBOLS</tt></a></dt>
-    <dd>If set to any value, causes the build to include debugging
-    symbols even in optimized objects, libraries and executables. This
-    alters the flags specified to the compilers and linkers. Debugging
-    isn't fun in an optimized build, but it is possible.</dd>
-    <dt><a name="DIRS"><tt>DIRS</tt></a></dt>
-    <dd>Specifies a set of directories, usually children of the current
-    directory, that should also be made using the same goal. These directories 
-    will be built serially.</dd>
-    <dt><a name="DISABLE_AUTO_DEPENDENCIES"><tt>DISABLE_AUTO_DEPENDENCIES</tt></a></dt>
-    <dd>If set to any value, causes the makefiles to <b>not</b> automatically
-    generate dependencies when running the compiler. Use of this feature is
-    discouraged and it may be removed at a later date.</dd>
-    <dt><a name="ENABLE_OPTIMIZED"><tt>ENABLE_OPTIMIZED</tt></a></dt>
-    <dd>If set to any value, causes the build to generate optimized objects,
-    libraries and executables. This alters the flags specified to the compilers
-    and linkers. Generally debugging won't be a fun experience with an optimized
-    build.</dd>
-    <dt><a name="ENABLE_PROFILING"><tt>ENABLE_PROFILING</tt></a></dt>
-    <dd>If set to any value, causes the build to generate both optimized and 
-    profiled objects, libraries and executables. This alters the flags specified
-    to the compilers and linkers to ensure that profile data can be collected
-    from the tools built. Use the <tt>gprof</tt> tool to analyze the output from
-    the profiled tools (<tt>gmon.out</tt>).</dd>
-    <dt><a name="DISABLE_ASSERTIONS"><tt>DISABLE_ASSERTIONS</tt></a></dt>
-    <dd>If set to any value, causes the build to disable assertions, even if 
-    building a release or profile build.  This will exclude all assertion check
-    code from the build. LLVM will execute faster, but with little help when
-    things go wrong.</dd>
-    <dt><a name="EXPERIMENTAL_DIRS"><tt>EXPERIMENTAL_DIRS</tt></a></dt>
-    <dd>Specify a set of directories that should be built, but if they fail, it
-    should not cause the build to fail. Note that this should only be used 
-    temporarily while code is being written.</dd> 
-    <dt><a name="EXPORTED_SYMBOL_FILE"><tt>EXPORTED_SYMBOL_FILE</tt></a></dt>
-    <dd>Specifies the name of a single file that contains a list of the 
-    symbols to be exported by the linker. One symbol per line.</dd>
-    <dt><a name="EXPORTED_SYMBOL_LIST"><tt>EXPORTED_SYMBOL_LIST</tt></a></dt>
-    <dd>Specifies a set of symbols to be exported by the linker.</dd>
-    <dt><a name="EXTRA_DIST"><tt>EXTRA_DIST</tt></a></dt>
-    <dd>Specifies additional files that should be distributed with LLVM. All
-    source files, all built sources, all Makefiles, and most documentation files
-    will be automatically distributed. Use this variable to distribute any 
-    files that are not automatically distributed.</dd>
-    <dt><a name="KEEP_SYMBOLS"><tt>KEEP_SYMBOLS</tt></a></dt>
-    <dd>If set to any value, specifies that when linking executables the
-    makefiles should retain debug symbols in the executable. Normally, symbols
-    are stripped from the executable.</dd>
-    <dt><a name="LEVEL"><tt>LEVEL</tt></a><small>(required)</small></dt>
-    <dd>Specify the level of nesting from the top level. This variable must be
-    set in each makefile as it is used to find the top level and thus the other
-    makefiles.</dd>
-    <dt><a name="LIBRARYNAME"><tt>LIBRARYNAME</tt></a></dt>
-    <dd>Specify the name of the library to be built. (Required For
-    Libraries)</dd>
-    <dt><a name="LINK_COMPONENTS"><tt>LINK_COMPONENTS</tt></a></dt>
-    <dd>When specified for building a tool, the value of this variable will be
-    passed to the <tt>llvm-config</tt> tool to generate a link line for the
-    tool. Unlike <tt>USEDLIBS</tt> and <tt>LLVMLIBS</tt>, not all libraries need
-    to be specified. The <tt>llvm-config</tt> tool will figure out the library
-    dependencies and add any libraries that are needed. The <tt>USEDLIBS</tt>
-    variable can still be used in conjunction with <tt>LINK_COMPONENTS</tt> so
-    that additional project-specific libraries can be linked with the LLVM 
-    libraries specified by <tt>LINK_COMPONENTS</tt></dd>
-    <dt><a name="LINK_LIBS_IN_SHARED"><tt>LINK_LIBS_IN_SHARED</tt></a></dt>
-    <dd>By default, shared library linking will ignore any libraries specified
-    with the <a href="LLVMLIBS">LLVMLIBS</a> or <a href="USEDLIBS">USEDLIBS</a>.
-    This prevents shared libs from including things that will be in the LLVM
-    tool the shared library will be loaded into. However, sometimes it is useful
-    to link certain libraries into your shared library and this option enables
-    that feature.</dd>
-    <dt><a name="LLVMLIBS"><tt>LLVMLIBS</tt></a></dt>
-    <dd>Specifies the set of libraries from the LLVM $(ObjDir) that will be
-    linked into the tool or library.</dd>
-    <dt><a name="LOADABLE_MODULE"><tt>LOADABLE_MODULE</tt></a></dt>
-    <dd>If set to any value, causes the shared library being built to also be
-    a loadable module. Loadable modules can be opened with the dlopen() function
-    and searched with dlsym (or the operating system's equivalent). Note that
-    setting this variable without also setting <tt>SHARED_LIBRARY</tt> will have
-    no effect.</dd>
-    <dt><a name="MODULE_NAME"><tt>MODULE_NAME</tt></a></dt>
-    <dd>Specifies the name of a bitcode module to be created. A bitcode 
-    module can be specified in conjunction with other kinds of library builds 
-    or by itself. It constructs from the sources a single linked bitcode 
-    file.</dd>
-    <dt><a name="NO_INSTALL"><tt>NO_INSTALL</tt></a></dt>
-    <dd>Specifies that the build products of the directory should not be
-    installed but should be built even if the <tt>install</tt> target is given.
-    This is handy for directories that build libraries or tools that are only
-    used as part of the build process, such as code generators (e.g.
-    <tt>tblgen</tt>).</dd>
-    <dt><a name="OPTIONAL_DIRS"><tt>OPTIONAL_DIRS</tt></a></dt>
-    <dd>Specify a set of directories that may be built, if they exist, but its
-    not an error for them not to exist.</dd>
-    <dt><a name="PARALLEL_DIRS"><tt>PARALLEL_DIRS</tt></a></dt>
-    <dd>Specify a set of directories to build recursively and in parallel if
-    the -j option was used with <tt>make</tt>.</dd>
-    <dt><a name="SHARED_LIBRARY"><tt>SHARED_LIBRARY</tt></a></dt>
-    <dd>If set to any value, causes a shared library (.so) to be built in
-    addition to any other kinds of libraries. Note that this option will cause
-    all source files to be built twice: once with options for position
-    independent code and once without. Use it only where you really need a
-    shared library.</dd>
-    <dt><a name="SOURCES"><tt>SOURCES</tt><small>(optional)</small></a></dt>
-    <dd>Specifies the list of source files in the current directory to be
-    built. Source files of any type may be specified (programs, documentation, 
-    config files, etc.). If not specified, the makefile system will infer the
-    set of source files from the files present in the current directory.</dd>
-    <dt><a name="SUFFIXES"><tt>SUFFIXES</tt></a></dt>
-    <dd>Specifies a set of filename suffixes that occur in suffix match rules.
-    Only set this if your local <tt>Makefile</tt> specifies additional suffix
-    match rules.</dd> 
-    <dt><a name="TARGET"><tt>TARGET</tt></a></dt>
-    <dd>Specifies the name of the LLVM code generation target that the
-    current directory builds. Setting this variable enables additional rules to
-    build <tt>.inc</tt> files from <tt>.td</tt> files. </dd>
-    <dt><a name="TESTSUITE"><tt>TESTSUITE</tt></a></dt>
-    <dd>Specifies the directory of tests to run in <tt>llvm/test</tt>.</dd>
-    <dt><a name="TOOLNAME"><tt>TOOLNAME</tt></a></dt>
-    <dd>Specifies the name of the tool that the current directory should
-    build.</dd>
-    <dt><a name="TOOL_VERBOSE"><tt>TOOL_VERBOSE</tt></a></dt>
-    <dd>Implies VERBOSE and also tells each tool invoked to be verbose. This is
-    handy when you're trying to see the sub-tools invoked by each tool invoked 
-    by the makefile. For example, this will pass <tt>-v</tt> to the GCC 
-    compilers which causes it to print out the command lines it uses to invoke
-    sub-tools (compiler, assembler, linker).</dd>
-    <dt><a name="USEDLIBS"><tt>USEDLIBS</tt></a></dt>
-    <dd>Specifies the list of project libraries that will be linked into the
-    tool or library.</dd>
-    <dt><a name="VERBOSE"><tt>VERBOSE</tt></a></dt>
-    <dd>Tells the Makefile system to produce detailed output of what it is doing
-    instead of just summary comments. This will generate a LOT of output.</dd>
-  </dl>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="overvars">Override Variables</a></div>
-<div class="doc_text">
-  <p>Override variables can be used to override the default
-  values provided by the LLVM makefile system. These variables can be set in 
-  several ways:</p>
-  <ul>
-    <li>In the environment (e.g. setenv, export) -- not recommended.</li>
-    <li>On the <tt>make</tt> command line -- recommended.</li>
-    <li>On the <tt>configure</tt> command line</li>
-    <li>In the Makefile (only <em>after</em> the inclusion of <a
-    href="#Makefile.common"><tt>$(LEVEL)/Makefile.common</tt></a>).</li>
-  </ul>
-  <p>The override variables are given below:</p>
-  <dl>
-    <dt><a name="AR"><tt>AR</tt></a> <small>(defaulted)</small></dt>
-    <dd>Specifies the path to the <tt>ar</tt> tool.</dd>
-    <dt><a name="PROJ_OBJ_DIR"><tt>PROJ_OBJ_DIR</tt></a></dt>
-    <dd>The directory into which the products of build rules will be placed.
-    This might be the same as 
-    <a href="#PROJ_SRC_DIR"><tt>PROJ_SRC_DIR</tt></a> but typically is
-    not.</dd>
-    <dt><a name="PROJ_SRC_DIR"><tt>PROJ_SRC_DIR</tt></a></dt>
-    <dd>The directory which contains the source files to be built.</dd>
-    <dt><a name="BZIP2"><tt>BZIP2</tt></a><small>(configured)</small></dt>
-    <dd>The path to the <tt>bzip2</tt> tool.</dd>
-    <dt><a name="CC"><tt>CC</tt></a><small>(configured)</small></dt>
-    <dd>The path to the 'C' compiler.</dd>
-    <dt><a name="CFLAGS"><tt>CFLAGS</tt></a></dt>
-    <dd>Additional flags to be passed to the 'C' compiler.</dd>
-    <dt><a name="CXX"><tt>CXX</tt></a></dt>
-    <dd>Specifies the path to the C++ compiler.</dd>
-    <dt><a name="CXXFLAGS"><tt>CXXFLAGS</tt></a></dt>
-    <dd>Additional flags to be passed to the C++ compiler.</dd>
-    <dt><a name="DATE"><tt>DATE<small>(configured)</small></tt></a></dt>
-    <dd>Specifies the path to the <tt>date</tt> program or any program that can
-    generate the current date and time on its standard output</dd>
-    <dt><a name="DOT"><tt>DOT</tt></a><small>(configured)</small></dt>
-    <dd>Specifies the path to the <tt>dot</tt> tool or <tt>false</tt> if there
-    isn't one.</dd>
-    <dt><a name="ECHO"><tt>ECHO</tt></a><small>(configured)</small></dt>
-    <dd>Specifies the path to the <tt>echo</tt> tool for printing output.</dd>
-    <dt><a name="EXEEXT"><tt>EXEEXT</tt></a><small>(configured)</small></dt>
-    <dd>Provides the extension to be used on executables built by the makefiles.
-    The value may be empty on platforms that do not use file extensions for
-    executables (e.g. Unix).</dd>
-    <dt><a name="INSTALL"><tt>INSTALL</tt></a><small>(configured)</small></dt>
-    <dd>Specifies the path to the <tt>install</tt> tool.</dd>
-    <dt><a name="LDFLAGS"><tt>LDFLAGS</tt></a><small>(configured)</small></dt>
-    <dd>Allows users to specify additional flags to pass to the linker.</dd>
-    <dt><a name="LIBS"><tt>LIBS</tt></a><small>(configured)</small></dt>
-    <dd>The list of libraries that should be linked with each tool.</dd>
-    <dt><a name="LIBTOOL"><tt>LIBTOOL</tt></a><small>(configured)</small></dt>
-    <dd>Specifies the path to the <tt>libtool</tt> tool. This tool is renamed
-    <tt>mklib</tt> by the <tt>configure</tt> script and always located in the 
-    <dt><a name="LLVMAS"><tt>LLVMAS</tt></a><small>(defaulted)</small></dt>
-    <dd>Specifies the path to the <tt>llvm-as</tt> tool.</dd>
-    <dt><a name="LLVMGCC"><tt>LLVMGCC</tt></a><small>(defaulted)</small></dt>
-    <dd>Specifies the path to the LLVM version of the GCC 'C' Compiler</dd>
-    <dt><a name="LLVMGXX"><tt>LLVMGXX</tt></a><small>(defaulted)</small></dt>
-    <dd>Specifies the path to the LLVM version of the GCC C++ Compiler</dd>
-    <dt><a name="LLVMLD"><tt>LLVMLD</tt></a><small>(defaulted)</small></dt>
-    <dd>Specifies the path to the LLVM bitcode linker tool</dd>
-    <dt><a name="LLVM_OBJ_ROOT"><tt>LLVM_OBJ_ROOT</tt></a><small>(configured)
-    </small></dt>
-    <dd>Specifies the top directory into which the output of the build is
-    placed.</dd>
-    <dt><a name="LLVM_SRC_ROOT"><tt>LLVM_SRC_ROOT</tt></a><small>(configured)
-    </small></dt>
-    <dd>Specifies the top directory in which the sources are found.</dd>
-    <dt><a name="LLVM_TARBALL_NAME"><tt>LLVM_TARBALL_NAME</tt></a>
-    <small>(configured)</small></dt>
-    <dd>Specifies the name of the distribution tarball to create. This is
-    configured from the name of the project and its version number.</dd>
-    <dt><a name="MKDIR"><tt>MKDIR</tt></a><small>(defaulted)</small></dt>
-    <dd>Specifies the path to the <tt>mkdir</tt> tool that creates
-    directories.</dd>
-    <dt><a name="ONLY_TOOLS"><tt>ONLY_TOOLS</tt></a></dt>
-    <dd>If set, specifies the list of tools to build.</dd>
-    <dt><a name="PLATFORMSTRIPOPTS"><tt>PLATFORMSTRIPOPTS</tt></a></dt>
-    <dd>The options to provide to the linker to specify that a stripped (no
-    symbols) executable should be built.</dd>
-    <dt><a name="RANLIB"><tt>RANLIB</tt></a><small>(defaulted)</small></dt>
-    <dd>Specifies the path to the <tt>ranlib</tt> tool.</dd>
-    <dt><a name="RM"><tt>RM</tt></a><small>(defaulted)</small></dt>
-    <dd>Specifies the path to the <tt>rm</tt> tool.</dd>
-    <dt><a name="SED"><tt>SED</tt></a><small>(defaulted)</small></dt>
-    <dd>Specifies the path to the <tt>sed</tt> tool.</dd>
-    <dt><a name="SHLIBEXT"><tt>SHLIBEXT</tt></a><small>(configured)</small></dt>
-    <dd>Provides the filename extension to use for shared libraries.</dd>
-    <dt><a name="TBLGEN"><tt>TBLGEN</tt></a><small>(defaulted)</small></dt>
-    <dd>Specifies the path to the <tt>tblgen</tt> tool.</dd>
-    <dt><a name="TAR"><tt>TAR</tt></a><small>(defaulted)</small></dt>
-    <dd>Specifies the path to the <tt>tar</tt> tool.</dd>
-    <dt><a name="ZIP"><tt>ZIP</tt></a><small>(defaulted)</small></dt>
-    <dd>Specifies the path to the <tt>zip</tt> tool.</dd>
-  </dl>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="getvars">Readable Variables</a></div>
-<div class="doc_text">
-  <p>Variables listed in the table below can be used by the user's Makefile but
-  should not be changed. Changing the value will generally cause the build to go
-  wrong, so don't do it.</p>
-  <dl>
-    <dt><a name="bindir"><tt>bindir</tt></a></dt>
-    <dd>The directory into which executables will ultimately be installed. This
-    value is derived from the <tt>--prefix</tt> option given to
-    <tt>configure</tt>.</dd>
-    <dt><a name="BuildMode"><tt>BuildMode</tt></a></dt>
-    <dd>The name of the type of build being performed: Debug, Release, or 
-    Profile</dd>
-    <dt><a name="bitcode_libdir"><tt>bytecode_libdir</tt></a></dt>
-    <dd>The directory into which bitcode libraries will ultimately be 
-    installed.  This value is derived from the <tt>--prefix</tt> option given to
-    <tt>configure</tt>.</dd>
-    <dt><a name="ConfigureScriptFLAGS"><tt>ConfigureScriptFLAGS</tt></a></dt>
-    <dd>Additional flags given to the <tt>configure</tt> script when
-    reconfiguring.</dd>
-    <dt><a name="DistDir"><tt>DistDir</tt></a></dt>
-    <dd>The <em>current</em> directory for which a distribution copy is being
-    made.</dd>
-    <dt><a name="Echo"><tt>Echo</tt></a></dt>
-    <dd>The LLVM Makefile System output command. This provides the
-    <tt>llvm[n]</tt> prefix and starts with @ so the command itself is not
-    printed by <tt>make</tt>.</dd>
-    <dt><a name="EchoCmd"><tt>EchoCmd</tt></a></dt>
-    <dd> Same as <a href="#Echo"><tt>Echo</tt></a> but without the leading @.
-    </dd>
-    <dt><a name="includedir"><tt>includedir</tt></a></dt>
-    <dd>The directory into which include files will ultimately be installed. 
-    This value is derived from the <tt>--prefix</tt> option given to
-    <tt>configure</tt>.</dd>
-    <dt><a name="libdir"><tt>libdir</tt></a></dt><dd></dd>
-    <dd>The directory into which native libraries will ultimately be installed. 
-    This value is derived from the <tt>--prefix</tt> option given to
-    <tt>configure</tt>.</dd>
-    <dt><a name="LibDir"><tt>LibDir</tt></a></dt>
-    <dd>The configuration specific directory into which libraries are placed
-    before installation.</dd>
-    <dt><a name="MakefileConfig"><tt>MakefileConfig</tt></a></dt>
-    <dd>Full path of the <tt>Makefile.config</tt> file.</dd>
-    <dt><a name="MakefileConfigIn"><tt>MakefileConfigIn</tt></a></dt>
-    <dd>Full path of the <tt>Makefile.config.in</tt> file.</dd>
-    <dt><a name="ObjDir"><tt>ObjDir</tt></a></dt>
-    <dd>The configuration and directory specific directory where build objects
-    (compilation results) are placed.</dd>
-    <dt><a name="SubDirs"><tt>SubDirs</tt></a></dt>
-    <dd>The complete list of sub-directories of the current directory as
-    specified by other variables.</dd>
-    <dt><a name="Sources"><tt>Sources</tt></a></dt>
-    <dd>The complete list of source files.</dd>
-    <dt><a name="sysconfdir"><tt>sysconfdir</tt></a></dt>
-    <dd>The directory into which configuration files will ultimately be
-    installed. This value is derived from the <tt>--prefix</tt> option given to
-    <tt>configure</tt>.</dd>
-    <dt><a name="ToolDir"><tt>ToolDir</tt></a></dt>
-    <dd>The configuration specific directory into which executables are placed
-    before they are installed.</dd>
-    <dt><a name="TopDistDir"><tt>TopDistDir</tt></a></dt>
-    <dd>The top most directory into which the distribution files are copied.
-    </dd>
-    <dt><a name="Verb"><tt>Verb</tt></a></dt>
-    <dd>Use this as the first thing on your build script lines to enable or
-    disable verbose mode. It expands to either an @ (quiet mode) or nothing
-    (verbose mode). </dd>
-  </dl>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="intvars">Internal Variables</a></div>
-<div class="doc_text">
-  <p>Variables listed below are used by the LLVM Makefile System 
-  and considered internal. You should not use these variables under any
-  circumstances.</p>
-  <p><tt>
-    Archive
-    AR.Flags
-    BaseNameSources
-    BCCompile.C
-    BCCompile.CXX
-    BCLinkLib
-    C.Flags
-    Compile.C
-    CompileCommonOpts
-    Compile.CXX
-    ConfigStatusScript
-    ConfigureScript
-    CPP.Flags
-    CPP.Flags 
-    CXX.Flags
-    DependFiles
-    DestArchiveLib
-    DestBitcodeLib
-    DestModule
-    DestSharedLib
-    DestTool
-    DistAlways
-    DistCheckDir
-    DistCheckTop
-    DistFiles
-    DistName
-    DistOther
-    DistSources
-    DistSubDirs
-    DistTarBZ2
-    DistTarGZip
-    DistZip
-    ExtraLibs
-    FakeSources
-    INCFiles
-    InternalTargets
-    LD.Flags
-    LibName.A
-    LibName.BC
-    LibName.LA
-    LibName.O
-    LibTool.Flags
-    Link
-    LinkModule
-    LLVMLibDir
-    LLVMLibsOptions
-    LLVMLibsPaths
-    LLVMToolDir
-    LLVMUsedLibs
-    LocalTargets
-    Module
-    ObjectsBC
-    ObjectsLO
-    ObjectsO
-    ObjMakefiles
-    ParallelTargets
-    PreConditions
-    ProjLibsOptions
-    ProjLibsPaths
-    ProjUsedLibs
-    Ranlib
-    RecursiveTargets
-    SrcMakefiles
-    Strip
-    StripWarnMsg
-    TableGen
-    TDFiles
-    ToolBuildPath
-    TopLevelTargets
-    UserTargets
-  </tt></p>
-</div>
-
-<!-- *********************************************************************** -->
-<hr>
-<address>
-  <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
-  src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS"></a>
-  <a href="http://validator.w3.org/check/referer"><img
-  src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
-
-  <a href="mailto:rspencer at x10sys.com">Reid Spencer</a><br>
-  <a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
-  Last modified: $Date$
-</address>
-</body>
-</html>
diff --git a/libclamav/c++/llvm/docs/Passes.html b/libclamav/c++/llvm/docs/Passes.html
deleted file mode 100644
index bbf6b3d..0000000
--- a/libclamav/c++/llvm/docs/Passes.html
+++ /dev/null
@@ -1,1855 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-                      "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-  <title>LLVM's Analysis and Transform Passes</title>
-  <link rel="stylesheet" href="llvm.css" type="text/css">
-  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
-</head>
-<body>
-
-<!--
-
-If Passes.html is up to date, the following "one-liner" should print
-an empty diff.
-
-egrep -e '^<tr><td><a href="#.*">-.*</a></td><td>.*</td></tr>$' \
-      -e '^  <a name=".*">.*</a>$' < Passes.html >html; \
-perl >help <<'EOT' && diff -u help html; rm -f help html
-open HTML, "<Passes.html" or die "open: Passes.html: $!\n";
-while (<HTML>) {
-  m:^<tr><td><a href="#(.*)">-.*</a></td><td>.*</td></tr>$: or next;
-  $order{$1} = sprintf("%03d", 1 + int %order);
-}
-open HELP, "../Release/bin/opt -help|" or die "open: opt -help: $!\n";
-while (<HELP>) {
-  m:^    -([^ ]+) +- (.*)$: or next;
-  my $o = $order{$1};
-  $o = "000" unless defined $o;
-  push @x, "$o<tr><td><a href=\"#$1\">-$1</a></td><td>$2</td></tr>\n";
-  push @y, "$o  <a name=\"$1\">$2</a>\n";
-}
- at x = map { s/^\d\d\d//; $_ } sort @x;
- at y = map { s/^\d\d\d//; $_ } sort @y;
-print @x, @y;
-EOT
-
-This (real) one-liner can also be helpful when converting comments to HTML:
-
-perl -e '$/ = undef; for (split(/\n/, <>)) { s:^ *///? ?::; print "  <p>\n" if !$on && $_ =~ /\S/; print "  </p>\n" if $on && $_ =~ /^\s*$/; print "  $_\n"; $on = ($_ =~ /\S/); } print "  </p>\n" if $on'
-
-  -->
-
-<div class="doc_title">LLVM's Analysis and Transform Passes</div>
-
-<ol>
-  <li><a href="#intro">Introduction</a></li>
-  <li><a href="#analyses">Analysis Passes</a>
-  <li><a href="#transforms">Transform Passes</a></li>
-  <li><a href="#utilities">Utility Passes</a></li>
-</ol>
-
-<div class="doc_author">
-  <p>Written by <a href="mailto:rspencer at x10sys.com">Reid Spencer</a>
-            and Gordon Henriksen</p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_section"> <a name="intro">Introduction</a> </div>
-<div class="doc_text">
-  <p>This document serves as a high level summary of the optimization features 
-  that LLVM provides. Optimizations are implemented as Passes that traverse some
-  portion of a program to either collect information or transform the program.
-  The table below divides the passes that LLVM provides into three categories.
-  Analysis passes compute information that other passes can use or for debugging
-  or program visualization purposes. Transform passes can use (or invalidate)
-  the analysis passes. Transform passes all mutate the program in some way. 
-  Utility passes provides some utility but don't otherwise fit categorization.
-  For example passes to extract functions to bitcode or write a module to
-  bitcode are neither analysis nor transform passes.
-  <p>The table below provides a quick summary of each pass and links to the more
-  complete pass description later in the document.</p>
-</div>
-<div class="doc_text" >
-<table>
-<tr><th colspan="2"><b>ANALYSIS PASSES</b></th></tr>
-<tr><th>Option</th><th>Name</th></tr>
-<tr><td><a href="#aa-eval">-aa-eval</a></td><td>Exhaustive Alias Analysis Precision Evaluator</td></tr>
-<tr><td><a href="#anders-aa">-anders-aa</a></td><td>Andersen's Interprocedural Alias Analysis</td></tr>
-<tr><td><a href="#basicaa">-basicaa</a></td><td>Basic Alias Analysis (default AA impl)</td></tr>
-<tr><td><a href="#basiccg">-basiccg</a></td><td>Basic CallGraph Construction</td></tr>
-<tr><td><a href="#codegenprepare">-codegenprepare</a></td><td>Optimize for code generation</td></tr>
-<tr><td><a href="#count-aa">-count-aa</a></td><td>Count Alias Analysis Query Responses</td></tr>
-<tr><td><a href="#debug-aa">-debug-aa</a></td><td>AA use debugger</td></tr>
-<tr><td><a href="#domfrontier">-domfrontier</a></td><td>Dominance Frontier Construction</td></tr>
-<tr><td><a href="#domtree">-domtree</a></td><td>Dominator Tree Construction</td></tr>
-<tr><td><a href="#dot-callgraph">-dot-callgraph</a></td><td>Print Call Graph to 'dot' file</td></tr>
-<tr><td><a href="#dot-cfg">-dot-cfg</a></td><td>Print CFG of function to 'dot' file</td></tr>
-<tr><td><a href="#dot-cfg-only">-dot-cfg-only</a></td><td>Print CFG of function to 'dot' file (with no function bodies)</td></tr>
-<tr><td><a href="#globalsmodref-aa">-globalsmodref-aa</a></td><td>Simple mod/ref analysis for globals</td></tr>
-<tr><td><a href="#instcount">-instcount</a></td><td>Counts the various types of Instructions</td></tr>
-<tr><td><a href="#intervals">-intervals</a></td><td>Interval Partition Construction</td></tr>
-<tr><td><a href="#loops">-loops</a></td><td>Natural Loop Construction</td></tr>
-<tr><td><a href="#memdep">-memdep</a></td><td>Memory Dependence Analysis</td></tr>
-<tr><td><a href="#no-aa">-no-aa</a></td><td>No Alias Analysis (always returns 'may' alias)</td></tr>
-<tr><td><a href="#no-profile">-no-profile</a></td><td>No Profile Information</td></tr>
-<tr><td><a href="#postdomfrontier">-postdomfrontier</a></td><td>Post-Dominance Frontier Construction</td></tr>
-<tr><td><a href="#postdomtree">-postdomtree</a></td><td>Post-Dominator Tree Construction</td></tr>
-<tr><td><a href="#print-alias-sets">-print-alias-sets</a></td><td>Alias Set Printer</td></tr>
-<tr><td><a href="#print-callgraph">-print-callgraph</a></td><td>Print a call graph</td></tr>
-<tr><td><a href="#print-callgraph-sccs">-print-callgraph-sccs</a></td><td>Print SCCs of the Call Graph</td></tr>
-<tr><td><a href="#print-cfg-sccs">-print-cfg-sccs</a></td><td>Print SCCs of each function CFG</td></tr>
-<tr><td><a href="#print-externalfnconstants">-print-externalfnconstants</a></td><td>Print external fn callsites passed constants</td></tr>
-<tr><td><a href="#print-function">-print-function</a></td><td>Print function to stderr</td></tr>
-<tr><td><a href="#print-module">-print-module</a></td><td>Print module to stderr</td></tr>
-<tr><td><a href="#print-used-types">-print-used-types</a></td><td>Find Used Types</td></tr>
-<tr><td><a href="#profile-loader">-profile-loader</a></td><td>Load profile information from llvmprof.out</td></tr>
-<tr><td><a href="#scalar-evolution">-scalar-evolution</a></td><td>Scalar Evolution Analysis</td></tr>
-<tr><td><a href="#targetdata">-targetdata</a></td><td>Target Data Layout</td></tr>
-
-
-<tr><th colspan="2"><b>TRANSFORM PASSES</b></th></tr>
-<tr><th>Option</th><th>Name</th></tr>
-<tr><td><a href="#adce">-adce</a></td><td>Aggressive Dead Code Elimination</td></tr>
-<tr><td><a href="#argpromotion">-argpromotion</a></td><td>Promote 'by reference' arguments to scalars</td></tr>
-<tr><td><a href="#block-placement">-block-placement</a></td><td>Profile Guided Basic Block Placement</td></tr>
-<tr><td><a href="#break-crit-edges">-break-crit-edges</a></td><td>Break critical edges in CFG</td></tr>
-<tr><td><a href="#codegenprepare">-codegenprepare</a></td><td>Prepare a function for code generation </td></tr>
-<tr><td><a href="#condprop">-condprop</a></td><td>Conditional Propagation</td></tr>
-<tr><td><a href="#constmerge">-constmerge</a></td><td>Merge Duplicate Global Constants</td></tr>
-<tr><td><a href="#constprop">-constprop</a></td><td>Simple constant propagation</td></tr>
-<tr><td><a href="#dce">-dce</a></td><td>Dead Code Elimination</td></tr>
-<tr><td><a href="#deadargelim">-deadargelim</a></td><td>Dead Argument Elimination</td></tr>
-<tr><td><a href="#deadtypeelim">-deadtypeelim</a></td><td>Dead Type Elimination</td></tr>
-<tr><td><a href="#die">-die</a></td><td>Dead Instruction Elimination</td></tr>
-<tr><td><a href="#dse">-dse</a></td><td>Dead Store Elimination</td></tr>
-<tr><td><a href="#globaldce">-globaldce</a></td><td>Dead Global Elimination</td></tr>
-<tr><td><a href="#globalopt">-globalopt</a></td><td>Global Variable Optimizer</td></tr>
-<tr><td><a href="#gvn">-gvn</a></td><td>Global Value Numbering</td></tr>
-<tr><td><a href="#indmemrem">-indmemrem</a></td><td>Indirect Malloc and Free Removal</td></tr>
-<tr><td><a href="#indvars">-indvars</a></td><td>Canonicalize Induction Variables</td></tr>
-<tr><td><a href="#inline">-inline</a></td><td>Function Integration/Inlining</td></tr>
-<tr><td><a href="#insert-block-profiling">-insert-block-profiling</a></td><td>Insert instrumentation for block profiling</td></tr>
-<tr><td><a href="#insert-edge-profiling">-insert-edge-profiling</a></td><td>Insert instrumentation for edge profiling</td></tr>
-<tr><td><a href="#insert-function-profiling">-insert-function-profiling</a></td><td>Insert instrumentation for function profiling</td></tr>
-<tr><td><a href="#insert-null-profiling-rs">-insert-null-profiling-rs</a></td><td>Measure profiling framework overhead</td></tr>
-<tr><td><a href="#insert-rs-profiling-framework">-insert-rs-profiling-framework</a></td><td>Insert random sampling instrumentation framework</td></tr>
-<tr><td><a href="#instcombine">-instcombine</a></td><td>Combine redundant instructions</td></tr>
-<tr><td><a href="#internalize">-internalize</a></td><td>Internalize Global Symbols</td></tr>
-<tr><td><a href="#ipconstprop">-ipconstprop</a></td><td>Interprocedural constant propagation</td></tr>
-<tr><td><a href="#ipsccp">-ipsccp</a></td><td>Interprocedural Sparse Conditional Constant Propagation</td></tr>
-<tr><td><a href="#jump-threading">-jump-threading</a></td><td>Thread control through conditional blocks </td></tr>
-<tr><td><a href="#lcssa">-lcssa</a></td><td>Loop-Closed SSA Form Pass</td></tr>
-<tr><td><a href="#licm">-licm</a></td><td>Loop Invariant Code Motion</td></tr>
-<tr><td><a href="#loop-deletion">-loop-deletion</a></td><td>Dead Loop Deletion Pass </td></tr>
-<tr><td><a href="#loop-extract">-loop-extract</a></td><td>Extract loops into new functions</td></tr>
-<tr><td><a href="#loop-extract-single">-loop-extract-single</a></td><td>Extract at most one loop into a new function</td></tr>
-<tr><td><a href="#loop-index-split">-loop-index-split</a></td><td>Index Split Loops</td></tr>
-<tr><td><a href="#loop-reduce">-loop-reduce</a></td><td>Loop Strength Reduction</td></tr>
-<tr><td><a href="#loop-rotate">-loop-rotate</a></td><td>Rotate Loops</td></tr>
-<tr><td><a href="#loop-unroll">-loop-unroll</a></td><td>Unroll loops</td></tr>
-<tr><td><a href="#loop-unswitch">-loop-unswitch</a></td><td>Unswitch loops</td></tr>
-<tr><td><a href="#loopsimplify">-loopsimplify</a></td><td>Canonicalize natural loops</td></tr>
-<tr><td><a href="#lowerallocs">-lowerallocs</a></td><td>Lower allocations from instructions to calls</td></tr>
-<tr><td><a href="#lowerinvoke">-lowerinvoke</a></td><td>Lower invoke and unwind, for unwindless code generators</td></tr>
-<tr><td><a href="#lowersetjmp">-lowersetjmp</a></td><td>Lower Set Jump</td></tr>
-<tr><td><a href="#lowerswitch">-lowerswitch</a></td><td>Lower SwitchInst's to branches</td></tr>
-<tr><td><a href="#mem2reg">-mem2reg</a></td><td>Promote Memory to Register</td></tr>
-<tr><td><a href="#memcpyopt">-memcpyopt</a></td><td>Optimize use of memcpy and friends</td></tr>
-<tr><td><a href="#mergereturn">-mergereturn</a></td><td>Unify function exit nodes</td></tr>
-<tr><td><a href="#prune-eh">-prune-eh</a></td><td>Remove unused exception handling info</td></tr>
-<tr><td><a href="#reassociate">-reassociate</a></td><td>Reassociate expressions</td></tr>
-<tr><td><a href="#reg2mem">-reg2mem</a></td><td>Demote all values to stack slots</td></tr>
-<tr><td><a href="#scalarrepl">-scalarrepl</a></td><td>Scalar Replacement of Aggregates</td></tr>
-<tr><td><a href="#sccp">-sccp</a></td><td>Sparse Conditional Constant Propagation</td></tr>
-<tr><td><a href="#simplify-libcalls">-simplify-libcalls</a></td><td>Simplify well-known library calls</td></tr>
-<tr><td><a href="#simplifycfg">-simplifycfg</a></td><td>Simplify the CFG</td></tr>
-<tr><td><a href="#strip">-strip</a></td><td>Strip all symbols from a module</td></tr>
-<tr><td><a href="#strip-dead-prototypes">-strip-dead-prototypes</a></td><td>Remove unused function declarations</td></tr>
-<tr><td><a href="#sretpromotion">-sretpromotion</a></td><td>Promote sret arguments</td></tr>
-<tr><td><a href="#tailcallelim">-tailcallelim</a></td><td>Tail Call Elimination</td></tr>
-<tr><td><a href="#tailduplicate">-tailduplicate</a></td><td>Tail Duplication</td></tr>
-
-
-<tr><th colspan="2"><b>UTILITY PASSES</b></th></tr>
-<tr><th>Option</th><th>Name</th></tr>
-<tr><td><a href="#deadarghaX0r">-deadarghaX0r</a></td><td>Dead Argument Hacking (BUGPOINT USE ONLY; DO NOT USE)</td></tr>
-<tr><td><a href="#extract-blocks">-extract-blocks</a></td><td>Extract Basic Blocks From Module (for bugpoint use)</td></tr>
-<tr><td><a href="#preverify">-preverify</a></td><td>Preliminary module verification</td></tr>
-<tr><td><a href="#verify">-verify</a></td><td>Module Verifier</td></tr>
-<tr><td><a href="#view-cfg">-view-cfg</a></td><td>View CFG of function</td></tr>
-<tr><td><a href="#view-cfg-only">-view-cfg-only</a></td><td>View CFG of function (with no function bodies)</td></tr>
-</table>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_section"> <a name="example">Analysis Passes</a></div>
-<div class="doc_text">
-  <p>This section describes the LLVM Analysis Passes.</p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="aa-eval">Exhaustive Alias Analysis Precision Evaluator</a>
-</div>
-<div class="doc_text">
-  <p>This is a simple N^2 alias analysis accuracy evaluator.
-  Basically, for each function in the program, it simply queries to see how the
-  alias analysis implementation answers alias queries between each pair of
-  pointers in the function.</p>
-
-  <p>This is inspired and adapted from code by: Naveen Neelakantam, Francesco
-  Spadini, and Wojciech Stryjewski.</p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="anders-aa">Andersen's Interprocedural Alias Analysis</a>
-</div>
-<div class="doc_text">
-  <p>
-  This is an implementation of Andersen's interprocedural alias
-  analysis
-  </p>
-  
-  <p>
-  In pointer analysis terms, this is a subset-based, flow-insensitive,
-  field-sensitive, and context-insensitive algorithm pointer algorithm.
-  </p>
-  
-  <p>
-  This algorithm is implemented as three stages:
-  </p>
-  
-  <ol>
-    <li>Object identification.</li>
-    <li>Inclusion constraint identification.</li>
-    <li>Offline constraint graph optimization.</li>
-    <li>Inclusion constraint solving.</li>
-  </ol>
-  
-  <p>
-  The object identification stage identifies all of the memory objects in the
-  program, which includes globals, heap allocated objects, and stack allocated
-  objects.
-  </p>
-  
-  <p>
-  The inclusion constraint identification stage finds all inclusion constraints
-  in the program by scanning the program, looking for pointer assignments and
-  other statements that effect the points-to graph.  For a statement like 
-  <code><var>A</var> = <var>B</var></code>, this statement is processed to 
-  indicate that <var>A</var> can point to anything that <var>B</var> can point 
-  to.  Constraints can handle copies, loads, and stores, and address taking.
-  </p>
-  
-  <p>
-  The offline constraint graph optimization portion includes offline variable
-  substitution algorithms intended to computer pointer and location
-  equivalences.  Pointer equivalences are those pointers that will have the
-  same points-to sets, and location equivalences are those variables that
-  always appear together in points-to sets.
-  </p>
-  
-  <p>
-  The inclusion constraint solving phase iteratively propagates the inclusion
-  constraints until a fixed point is reached.  This is an O(<var>n</var>³) 
-  algorithm.
-  </p>
-  
-  <p>
-  Function constraints are handled as if they were structs with <var>X</var> 
-  fields. Thus, an access to argument <var>X</var> of function <var>Y</var> is 
-  an access to node index <code>getNode(<var>Y</var>) + <var>X</var></code>.  
-  This representation allows handling of indirect calls without any issues.  To 
-  wit, an indirect call <code><var>Y</var>(<var>a</var>,<var>b</var>)</code> is 
-  equivalent to <code>*(<var>Y</var> + 1) = <var>a</var>, *(<var>Y</var> + 2) = 
-  <var>b</var></code>. The return node for a function <var>F</var> is always 
-  located at <code>getNode(<var>F</var>) + CallReturnPos</code>. The arguments 
-  start at <code>getNode(<var>F</var>) + CallArgPos</code>.
-  </p>
-
-  <p>
-  Please keep in mind that the current andersen's pass has many known
-  problems and bugs.  It should be considered "research quality".
-  </p>
-
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="basicaa">Basic Alias Analysis (default AA impl)</a>
-</div>
-<div class="doc_text">
-  <p>
-  This is the default implementation of the Alias Analysis interface
-  that simply implements a few identities (two different globals cannot alias,
-  etc), but otherwise does no analysis.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="basiccg">Basic CallGraph Construction</a>
-</div>
-<div class="doc_text">
-  <p>Yet to be written.</p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="codegenprepare">Optimize for code generation</a>
-</div>
-<div class="doc_text">
-  <p>
-  This pass munges the code in the input function to better prepare it for
-  SelectionDAG-based code generation.  This works around limitations in it's
-  basic-block-at-a-time approach.  It should eventually be removed.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="count-aa">Count Alias Analysis Query Responses</a>
-</div>
-<div class="doc_text">
-  <p>
-  A pass which can be used to count how many alias queries
-  are being made and how the alias analysis implementation being used responds.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="debug-aa">AA use debugger</a>
-</div>
-<div class="doc_text">
-  <p>
-  This simple pass checks alias analysis users to ensure that if they
-  create a new value, they do not query AA without informing it of the value.
-  It acts as a shim over any other AA pass you want.
-  </p>
-  
-  <p>
-  Yes keeping track of every value in the program is expensive, but this is 
-  a debugging pass.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="domfrontier">Dominance Frontier Construction</a>
-</div>
-<div class="doc_text">
-  <p>
-  This pass is a simple dominator construction algorithm for finding forward
-  dominator frontiers.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="domtree">Dominator Tree Construction</a>
-</div>
-<div class="doc_text">
-  <p>
-  This pass is a simple dominator construction algorithm for finding forward
-  dominators.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="dot-callgraph">Print Call Graph to 'dot' file</a>
-</div>
-<div class="doc_text">
-  <p>
-  This pass, only available in <code>opt</code>, prints the call graph into a
-  <code>.dot</code> graph.  This graph can then be processed with the "dot" tool
-  to convert it to postscript or some other suitable format.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="dot-cfg">Print CFG of function to 'dot' file</a>
-</div>
-<div class="doc_text">
-  <p>
-  This pass, only available in <code>opt</code>, prints the control flow graph
-  into a <code>.dot</code> graph.  This graph can then be processed with the
-  "dot" tool to convert it to postscript or some other suitable format.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="dot-cfg-only">Print CFG of function to 'dot' file (with no function bodies)</a>
-</div>
-<div class="doc_text">
-  <p>
-  This pass, only available in <code>opt</code>, prints the control flow graph
-  into a <code>.dot</code> graph, omitting the function bodies.  This graph can
-  then be processed with the "dot" tool to convert it to postscript or some
-  other suitable format.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="globalsmodref-aa">Simple mod/ref analysis for globals</a>
-</div>
-<div class="doc_text">
-  <p>
-  This simple pass provides alias and mod/ref information for global values
-  that do not have their address taken, and keeps track of whether functions
-  read or write memory (are "pure").  For this simple (but very common) case,
-  we can provide pretty accurate and useful information.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="instcount">Counts the various types of Instructions</a>
-</div>
-<div class="doc_text">
-  <p>
-  This pass collects the count of all instructions and reports them
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="intervals">Interval Partition Construction</a>
-</div>
-<div class="doc_text">
-  <p>
-  This analysis calculates and represents the interval partition of a function,
-  or a preexisting interval partition.
-  </p>
-  
-  <p>
-  In this way, the interval partition may be used to reduce a flow graph down
-  to its degenerate single node interval partition (unless it is irreducible).
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="loops">Natural Loop Construction</a>
-</div>
-<div class="doc_text">
-  <p>
-  This analysis is used to identify natural loops and determine the loop depth
-  of various nodes of the CFG.  Note that the loops identified may actually be
-  several natural loops that share the same header node... not just a single
-  natural loop.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="memdep">Memory Dependence Analysis</a>
-</div>
-<div class="doc_text">
-  <p>
-  An analysis that determines, for a given memory operation, what preceding 
-  memory operations it depends on.  It builds on alias analysis information, and 
-  tries to provide a lazy, caching interface to a common kind of alias 
-  information query.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="no-aa">No Alias Analysis (always returns 'may' alias)</a>
-</div>
-<div class="doc_text">
-  <p>
-  Always returns "I don't know" for alias queries.  NoAA is unlike other alias
-  analysis implementations, in that it does not chain to a previous analysis. As
-  such it doesn't follow many of the rules that other alias analyses must.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="no-profile">No Profile Information</a>
-</div>
-<div class="doc_text">
-  <p>
-  The default "no profile" implementation of the abstract
-  <code>ProfileInfo</code> interface.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="postdomfrontier">Post-Dominance Frontier Construction</a>
-</div>
-<div class="doc_text">
-  <p>
-  This pass is a simple post-dominator construction algorithm for finding
-  post-dominator frontiers.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="postdomtree">Post-Dominator Tree Construction</a>
-</div>
-<div class="doc_text">
-  <p>
-  This pass is a simple post-dominator construction algorithm for finding
-  post-dominators.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="print-alias-sets">Alias Set Printer</a>
-</div>
-<div class="doc_text">
-  <p>Yet to be written.</p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="print-callgraph">Print a call graph</a>
-</div>
-<div class="doc_text">
-  <p>
-  This pass, only available in <code>opt</code>, prints the call graph to
-  standard output in a human-readable form.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="print-callgraph-sccs">Print SCCs of the Call Graph</a>
-</div>
-<div class="doc_text">
-  <p>
-  This pass, only available in <code>opt</code>, prints the SCCs of the call
-  graph to standard output in a human-readable form.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="print-cfg-sccs">Print SCCs of each function CFG</a>
-</div>
-<div class="doc_text">
-  <p>
-  This pass, only available in <code>opt</code>, prints the SCCs of each
-  function CFG to standard output in a human-readable form.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="print-externalfnconstants">Print external fn callsites passed constants</a>
-</div>
-<div class="doc_text">
-  <p>
-  This pass, only available in <code>opt</code>, prints out call sites to
-  external functions that are called with constant arguments.  This can be
-  useful when looking for standard library functions we should constant fold
-  or handle in alias analyses.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="print-function">Print function to stderr</a>
-</div>
-<div class="doc_text">
-  <p>
-  The <code>PrintFunctionPass</code> class is designed to be pipelined with
-  other <code>FunctionPass</code>es, and prints out the functions of the module
-  as they are processed.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="print-module">Print module to stderr</a>
-</div>
-<div class="doc_text">
-  <p>
-  This pass simply prints out the entire module when it is executed.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="print-used-types">Find Used Types</a>
-</div>
-<div class="doc_text">
-  <p>
-  This pass is used to seek out all of the types in use by the program.  Note
-  that this analysis explicitly does not include types only used by the symbol
-  table.
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="profile-loader">Load profile information from llvmprof.out</a>
-</div>
-<div class="doc_text">
-  <p>
-  A concrete implementation of profiling information that loads the information
-  from a profile dump file.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="scalar-evolution">Scalar Evolution Analysis</a>
-</div>
-<div class="doc_text">
-  <p>
-  The <code>ScalarEvolution</code> analysis can be used to analyze and
-  catagorize scalar expressions in loops.  It specializes in recognizing general
-  induction variables, representing them with the abstract and opaque
-  <code>SCEV</code> class.  Given this analysis, trip counts of loops and other
-  important properties can be obtained.
-  </p>
-  
-  <p>
-  This analysis is primarily useful for induction variable substitution and
-  strength reduction.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="targetdata">Target Data Layout</a>
-</div>
-<div class="doc_text">
-  <p>Provides other passes access to information on how the size and alignment
-  required by the the target ABI for various data types.</p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_section"> <a name="transform">Transform Passes</a></div>
-<div class="doc_text">
-  <p>This section describes the LLVM Transform Passes.</p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="adce">Aggressive Dead Code Elimination</a>
-</div>
-<div class="doc_text">
-  <p>ADCE aggressively tries to eliminate code. This pass is similar to
-  <a href="#dce">DCE</a> but it assumes that values are dead until proven 
-  otherwise. This is similar to <a href="#sccp">SCCP</a>, except applied to 
-  the liveness of values.</p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="argpromotion">Promote 'by reference' arguments to scalars</a>
-</div>
-<div class="doc_text">
-  <p>
-  This pass promotes "by reference" arguments to be "by value" arguments.  In
-  practice, this means looking for internal functions that have pointer
-  arguments.  If it can prove, through the use of alias analysis, that an
-  argument is *only* loaded, then it can pass the value into the function
-  instead of the address of the value.  This can cause recursive simplification
-  of code and lead to the elimination of allocas (especially in C++ template
-  code like the STL).
-  </p>
-  
-  <p>
-  This pass also handles aggregate arguments that are passed into a function,
-  scalarizing them if the elements of the aggregate are only loaded.  Note that
-  it refuses to scalarize aggregates which would require passing in more than
-  three operands to the function, because passing thousands of operands for a
-  large array or structure is unprofitable!
-  </p>
-  
-  <p>
-  Note that this transformation could also be done for arguments that are only
-  stored to (returning the value instead), but does not currently.  This case
-  would be best handled when and if LLVM starts supporting multiple return
-  values from functions.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="block-placement">Profile Guided Basic Block Placement</a>
-</div>
-<div class="doc_text">
-  <p>This pass is a very simple profile guided basic block placement algorithm.
-  The idea is to put frequently executed blocks together at the start of the
-  function and hopefully increase the number of fall-through conditional
-  branches.  If there is no profile information for a particular function, this
-  pass basically orders blocks in depth-first order.</p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="break-crit-edges">Break critical edges in CFG</a>
-</div>
-<div class="doc_text">
-  <p>
-  Break all of the critical edges in the CFG by inserting a dummy basic block.
-  It may be "required" by passes that cannot deal with critical edges. This
-  transformation obviously invalidates the CFG, but can update forward dominator
-  (set, immediate dominators, tree, and frontier) information.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="codegenprepare">Prepare a function for code generation</a>
-</div>
-<div class="doc_text">
-  This pass munges the code in the input function to better prepare it for
-  SelectionDAG-based code generation. This works around limitations in it's
-  basic-block-at-a-time approach. It should eventually be removed.
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="condprop">Conditional Propagation</a>
-</div>
-<div class="doc_text">
-  <p>This pass propagates information about conditional expressions through the
-  program, allowing it to eliminate conditional branches in some cases.</p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="constmerge">Merge Duplicate Global Constants</a>
-</div>
-<div class="doc_text">
-  <p>
-  Merges duplicate global constants together into a single constant that is
-  shared.  This is useful because some passes (ie TraceValues) insert a lot of
-  string constants into the program, regardless of whether or not an existing
-  string is available.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="constprop">Simple constant propagation</a>
-</div>
-<div class="doc_text">
-  <p>This file implements constant propagation and merging. It looks for
-  instructions involving only constant operands and replaces them with a
-  constant value instead of an instruction. For example:</p>
-  <blockquote><pre>add i32 1, 2</pre></blockquote>
-  <p>becomes</p>
-  <blockquote><pre>i32 3</pre></blockquote>
-  <p>NOTE: this pass has a habit of making definitions be dead.  It is a good 
-  idea to to run a <a href="#die">DIE</a> (Dead Instruction Elimination) pass 
-  sometime after running this pass.</p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="dce">Dead Code Elimination</a>
-</div>
-<div class="doc_text">
-  <p>
-  Dead code elimination is similar to <a href="#die">dead instruction
-  elimination</a>, but it rechecks instructions that were used by removed
-  instructions to see if they are newly dead.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="deadargelim">Dead Argument Elimination</a>
-</div>
-<div class="doc_text">
-  <p>
-  This pass deletes dead arguments from internal functions.  Dead argument
-  elimination removes arguments which are directly dead, as well as arguments
-  only passed into function calls as dead arguments of other functions.  This
-  pass also deletes dead arguments in a similar way.
-  </p>
-  
-  <p>
-  This pass is often useful as a cleanup pass to run after aggressive
-  interprocedural passes, which add possibly-dead arguments.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="deadtypeelim">Dead Type Elimination</a>
-</div>
-<div class="doc_text">
-  <p>
-  This pass is used to cleanup the output of GCC.  It eliminate names for types
-  that are unused in the entire translation unit, using the <a
-  href="#findusedtypes">find used types</a> pass.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="die">Dead Instruction Elimination</a>
-</div>
-<div class="doc_text">
-  <p>
-  Dead instruction elimination performs a single pass over the function,
-  removing instructions that are obviously dead.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="dse">Dead Store Elimination</a>
-</div>
-<div class="doc_text">
-  <p>
-  A trivial dead store elimination that only considers basic-block local
-  redundant stores.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="globaldce">Dead Global Elimination</a>
-</div>
-<div class="doc_text">
-  <p>
-  This transform is designed to eliminate unreachable internal globals from the
-  program.  It uses an aggressive algorithm, searching out globals that are
-  known to be alive.  After it finds all of the globals which are needed, it
-  deletes whatever is left over.  This allows it to delete recursive chunks of
-  the program which are unreachable.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="globalopt">Global Variable Optimizer</a>
-</div>
-<div class="doc_text">
-  <p>
-  This pass transforms simple global variables that never have their address
-  taken.  If obviously true, it marks read/write globals as constant, deletes
-  variables only stored to, etc.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="gvn">Global Value Numbering</a>
-</div>
-<div class="doc_text">
-  <p>
-  This pass performs global value numbering to eliminate fully and partially
-  redundant instructions.  It also performs redundant load elimination.
-  </p>
-</div>
-
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="indmemrem">Indirect Malloc and Free Removal</a>
-</div>
-<div class="doc_text">
-  <p>
-  This pass finds places where memory allocation functions may escape into
-  indirect land.  Some transforms are much easier (aka possible) only if free 
-  or malloc are not called indirectly.
-  </p>
-  
-  <p>
-  Thus find places where the address of memory functions are taken and construct
-  bounce functions with direct calls of those functions.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="indvars">Canonicalize Induction Variables</a>
-</div>
-<div class="doc_text">
-  <p>
-  This transformation analyzes and transforms the induction variables (and
-  computations derived from them) into simpler forms suitable for subsequent
-  analysis and transformation.
-  </p>
-  
-  <p>
-  This transformation makes the following changes to each loop with an
-  identifiable induction variable:
-  </p>
-  
-  <ol>
-    <li>All loops are transformed to have a <em>single</em> canonical
-        induction variable which starts at zero and steps by one.</li>
-    <li>The canonical induction variable is guaranteed to be the first PHI node
-        in the loop header block.</li>
-    <li>Any pointer arithmetic recurrences are raised to use array
-        subscripts.</li>
-  </ol>
-  
-  <p>
-  If the trip count of a loop is computable, this pass also makes the following
-  changes:
-  </p>
-  
-  <ol>
-    <li>The exit condition for the loop is canonicalized to compare the
-        induction value against the exit value.  This turns loops like:
-        <blockquote><pre>for (i = 7; i*i < 1000; ++i)</pre></blockquote>
-        into
-        <blockquote><pre>for (i = 0; i != 25; ++i)</pre></blockquote></li>
-    <li>Any use outside of the loop of an expression derived from the indvar
-        is changed to compute the derived value outside of the loop, eliminating
-        the dependence on the exit value of the induction variable.  If the only
-        purpose of the loop is to compute the exit value of some derived
-        expression, this transformation will make the loop dead.</li>
-  </ol>
-  
-  <p>
-  This transformation should be followed by strength reduction after all of the
-  desired loop transformations have been performed.  Additionally, on targets
-  where it is profitable, the loop could be transformed to count down to zero
-  (the "do loop" optimization).
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="inline">Function Integration/Inlining</a>
-</div>
-<div class="doc_text">
-  <p>
-  Bottom-up inlining of functions into callees.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="insert-block-profiling">Insert instrumentation for block profiling</a>
-</div>
-<div class="doc_text">
-  <p>
-  This pass instruments the specified program with counters for basic block
-  profiling, which counts the number of times each basic block executes.  This
-  is the most basic form of profiling, which can tell which blocks are hot, but
-  cannot reliably detect hot paths through the CFG.
-  </p>
-  
-  <p>
-  Note that this implementation is very naïve.  Control equivalent regions of
-  the CFG should not require duplicate counters, but it does put duplicate
-  counters in.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="insert-edge-profiling">Insert instrumentation for edge profiling</a>
-</div>
-<div class="doc_text">
-  <p>
-  This pass instruments the specified program with counters for edge profiling.
-  Edge profiling can give a reasonable approximation of the hot paths through a
-  program, and is used for a wide variety of program transformations.
-  </p>
-  
-  <p>
-  Note that this implementation is very naïve.  It inserts a counter for
-  <em>every</em> edge in the program, instead of using control flow information
-  to prune the number of counters inserted.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="insert-function-profiling">Insert instrumentation for function profiling</a>
-</div>
-<div class="doc_text">
-  <p>
-  This pass instruments the specified program with counters for function
-  profiling, which counts the number of times each function is called.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="insert-null-profiling-rs">Measure profiling framework overhead</a>
-</div>
-<div class="doc_text">
-  <p>
-  The basic profiler that does nothing.  It is the default profiler and thus
-  terminates <code>RSProfiler</code> chains.  It is useful for  measuring
-  framework overhead.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="insert-rs-profiling-framework">Insert random sampling instrumentation framework</a>
-</div>
-<div class="doc_text">
-  <p>
-  The second stage of the random-sampling instrumentation framework, duplicates
-  all instructions in a function, ignoring the profiling code, then connects the
-  two versions together at the entry and at backedges.  At each connection point
-  a choice is made as to whether to jump to the profiled code (take a sample) or
-  execute the unprofiled code.
-  </p>
-  
-  <p>
-  After this pass, it is highly recommended to run<a href="#mem2reg">mem2reg</a>
-  and <a href="#adce">adce</a>. <a href="#instcombine">instcombine</a>,
-  <a href="#load-vn">load-vn</a>, <a href="#gdce">gdce</a>, and
-  <a href="#dse">dse</a> also are good to run afterwards.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="instcombine">Combine redundant instructions</a>
-</div>
-<div class="doc_text">
-  <p>
-  Combine instructions to form fewer, simple
-  instructions.  This pass does not modify the CFG This pass is where algebraic
-  simplification happens.
-  </p>
-  
-  <p>
-  This pass combines things like:
-  </p>
-  
-<blockquote><pre
->%Y = add i32 %X, 1
-%Z = add i32 %Y, 1</pre></blockquote>
-  
-  <p>
-  into:
-  </p>
-
-<blockquote><pre
->%Z = add i32 %X, 2</pre></blockquote>
-  
-  <p>
-  This is a simple worklist driven algorithm.
-  </p>
-  
-  <p>
-  This pass guarantees that the following canonicalizations are performed on
-  the program:
-  </p>
-
-  <ul>
-    <li>If a binary operator has a constant operand, it is moved to the right-
-        hand side.</li>
-    <li>Bitwise operators with constant operands are always grouped so that
-        shifts are performed first, then <code>or</code>s, then
-        <code>and</code>s, then <code>xor</code>s.</li>
-    <li>Compare instructions are converted from <code>&lt;</code>,
-        <code>&gt;</code>, <code>≤</code>, or <code>≥</code> to
-        <code>=</code> or <code>≠</code> if possible.</li>
-    <li>All <code>cmp</code> instructions on boolean values are replaced with
-        logical operations.</li>
-    <li><code>add <var>X</var>, <var>X</var></code> is represented as
-        <code>mul <var>X</var>, 2</code> ⇒ <code>shl <var>X</var>, 1</code></li>
-    <li>Multiplies with a constant power-of-two argument are transformed into
-        shifts.</li>
-    <li>… etc.</li>
-  </ul>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="internalize">Internalize Global Symbols</a>
-</div>
-<div class="doc_text">
-  <p>
-  This pass loops over all of the functions in the input module, looking for a
-  main function.  If a main function is found, all other functions and all
-  global variables with initializers are marked as internal.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="ipconstprop">Interprocedural constant propagation</a>
-</div>
-<div class="doc_text">
-  <p>
-  This pass implements an <em>extremely</em> simple interprocedural constant
-  propagation pass.  It could certainly be improved in many different ways,
-  like using a worklist.  This pass makes arguments dead, but does not remove
-  them.  The existing dead argument elimination pass should be run after this
-  to clean up the mess.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="ipsccp">Interprocedural Sparse Conditional Constant Propagation</a>
-</div>
-<div class="doc_text">
-  <p>
-  An interprocedural variant of <a href="#sccp">Sparse Conditional Constant 
-  Propagation</a>.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="jump-threading">Thread control through conditional blocks</a>
-</div>
-<div class="doc_text">
-  <p>
-  Jump threading tries to find distinct threads of control flow running through
-  a basic block. This pass looks at blocks that have multiple predecessors and
-  multiple successors.  If one or more of the predecessors of the block can be
-  proven to always cause a jump to one of the successors, we forward the edge
-  from the predecessor to the successor by duplicating the contents of this
-  block.
-  </p>
-  <p>
-  An example of when this can occur is code like this:
-  </p>
-
-  <pre
->if () { ...
-  X = 4;
-}
-if (X &lt; 3) {</pre>
-
-  <p>
-  In this case, the unconditional branch at the end of the first if can be
-  revectored to the false side of the second if.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="lcssa">Loop-Closed SSA Form Pass</a>
-</div>
-<div class="doc_text">
-  <p>
-  This pass transforms loops by placing phi nodes at the end of the loops for
-  all values that are live across the loop boundary.  For example, it turns
-  the left into the right code:
-  </p>
-  
-  <pre
->for (...)                for (...)
-  if (c)                   if (c)
-    X1 = ...                 X1 = ...
-  else                     else
-    X2 = ...                 X2 = ...
-  X3 = phi(X1, X2)         X3 = phi(X1, X2)
-... = X3 + 4              X4 = phi(X3)
-                          ... = X4 + 4</pre>
-  
-  <p>
-  This is still valid LLVM; the extra phi nodes are purely redundant, and will
-  be trivially eliminated by <code>InstCombine</code>.  The major benefit of
-  this transformation is that it makes many other loop optimizations, such as 
-  LoopUnswitching, simpler.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="licm">Loop Invariant Code Motion</a>
-</div>
-<div class="doc_text">
-  <p>
-  This pass performs loop invariant code motion, attempting to remove as much
-  code from the body of a loop as possible.  It does this by either hoisting
-  code into the preheader block, or by sinking code to the exit blocks if it is
-  safe.  This pass also promotes must-aliased memory locations in the loop to
-  live in registers, thus hoisting and sinking "invariant" loads and stores.
-  </p>
-  
-  <p>
-  This pass uses alias analysis for two purposes:
-  </p>
-  
-  <ul>
-    <li>Moving loop invariant loads and calls out of loops.  If we can determine
-        that a load or call inside of a loop never aliases anything stored to,
-        we can hoist it or sink it like any other instruction.</li>
-    <li>Scalar Promotion of Memory - If there is a store instruction inside of
-        the loop, we try to move the store to happen AFTER the loop instead of
-        inside of the loop.  This can only happen if a few conditions are true:
-        <ul>
-          <li>The pointer stored through is loop invariant.</li>
-          <li>There are no stores or loads in the loop which <em>may</em> alias
-              the pointer.  There are no calls in the loop which mod/ref the
-              pointer.</li>
-        </ul>
-        If these conditions are true, we can promote the loads and stores in the
-        loop of the pointer to use a temporary alloca'd variable.  We then use
-        the mem2reg functionality to construct the appropriate SSA form for the
-        variable.</li>
-  </ul>
-</div>
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="loop-deletion">Dead Loop Deletion Pass</a>
-</div>
-<div class="doc_text">
-  <p>
-  This file implements the Dead Loop Deletion Pass.  This pass is responsible
-  for eliminating loops with non-infinite computable trip counts that have no
-  side effects or volatile instructions, and do not contribute to the
-  computation of the function's return value.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="loop-extract">Extract loops into new functions</a>
-</div>
-<div class="doc_text">
-  <p>
-  A pass wrapper around the <code>ExtractLoop()</code> scalar transformation to 
-  extract each top-level loop into its own new function. If the loop is the
-  <em>only</em> loop in a given function, it is not touched. This is a pass most
-  useful for debugging via bugpoint.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="loop-extract-single">Extract at most one loop into a new function</a>
-</div>
-<div class="doc_text">
-  <p>
-  Similar to <a href="#loop-extract">Extract loops into new functions</a>,
-  this pass extracts one natural loop from the program into a function if it
-  can. This is used by bugpoint.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="loop-index-split">Index Split Loops</a>
-</div>
-<div class="doc_text">
-  <p>
-  This pass divides loop's iteration range by spliting loop such that each 
-  individual loop is executed efficiently.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="loop-reduce">Loop Strength Reduction</a>
-</div>
-<div class="doc_text">
-  <p>
-  This pass performs a strength reduction on array references inside loops that
-  have as one or more of their components the loop induction variable.  This is
-  accomplished by creating a new value to hold the initial value of the array
-  access for the first iteration, and then creating a new GEP instruction in
-  the loop to increment the value by the appropriate amount.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="loop-rotate">Rotate Loops</a>
-</div>
-<div class="doc_text">
-  <p>A simple loop rotation transformation.</p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="loop-unroll">Unroll loops</a>
-</div>
-<div class="doc_text">
-  <p>
-  This pass implements a simple loop unroller.  It works best when loops have
-  been canonicalized by the <a href="#indvars"><tt>-indvars</tt></a> pass,
-  allowing it to determine the trip counts of loops easily.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="loop-unswitch">Unswitch loops</a>
-</div>
-<div class="doc_text">
-  <p>
-  This pass transforms loops that contain branches on loop-invariant conditions
-  to have multiple loops.  For example, it turns the left into the right code:
-  </p>
-  
-  <pre
->for (...)                  if (lic)
-  A                          for (...)
-  if (lic)                     A; B; C
-    B                      else
-  C                          for (...)
-                               A; C</pre>
-  
-  <p>
-  This can increase the size of the code exponentially (doubling it every time
-  a loop is unswitched) so we only unswitch if the resultant code will be
-  smaller than a threshold.
-  </p>
-  
-  <p>
-  This pass expects LICM to be run before it to hoist invariant conditions out
-  of the loop, to make the unswitching opportunity obvious.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="loopsimplify">Canonicalize natural loops</a>
-</div>
-<div class="doc_text">
-  <p>
-  This pass performs several transformations to transform natural loops into a
-  simpler form, which makes subsequent analyses and transformations simpler and
-  more effective.
-  </p>
-  
-  <p>
-  Loop pre-header insertion guarantees that there is a single, non-critical
-  entry edge from outside of the loop to the loop header.  This simplifies a
-  number of analyses and transformations, such as LICM.
-  </p>
-  
-  <p>
-  Loop exit-block insertion guarantees that all exit blocks from the loop
-  (blocks which are outside of the loop that have predecessors inside of the
-  loop) only have predecessors from inside of the loop (and are thus dominated
-  by the loop header).  This simplifies transformations such as store-sinking
-  that are built into LICM.
-  </p>
-  
-  <p>
-  This pass also guarantees that loops will have exactly one backedge.
-  </p>
-  
-  <p>
-  Note that the simplifycfg pass will clean up blocks which are split out but
-  end up being unnecessary, so usage of this pass should not pessimize
-  generated code.
-  </p>
-  
-  <p>
-  This pass obviously modifies the CFG, but updates loop information and
-  dominator information.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="lowerallocs">Lower allocations from instructions to calls</a>
-</div>
-<div class="doc_text">
-  <p>
-  Turn <tt>malloc</tt> and <tt>free</tt> instructions into <tt>@malloc</tt> and
-  <tt>@free</tt> calls.
-  </p>
-
-  <p>
-  This is a target-dependent tranformation because it depends on the size of
-  data types and alignment constraints.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="lowerinvoke">Lower invoke and unwind, for unwindless code generators</a>
-</div>
-<div class="doc_text">
-  <p>
-  This transformation is designed for use by code generators which do not yet
-  support stack unwinding.  This pass supports two models of exception handling
-  lowering, the 'cheap' support and the 'expensive' support.
-  </p>
-  
-  <p>
-  'Cheap' exception handling support gives the program the ability to execute
-  any program which does not "throw an exception", by turning 'invoke'
-  instructions into calls and by turning 'unwind' instructions into calls to
-  abort().  If the program does dynamically use the unwind instruction, the
-  program will print a message then abort.
-  </p>
-  
-  <p>
-  'Expensive' exception handling support gives the full exception handling
-  support to the program at the cost of making the 'invoke' instruction
-  really expensive.  It basically inserts setjmp/longjmp calls to emulate the
-  exception handling as necessary.
-  </p>
-  
-  <p>
-  Because the 'expensive' support slows down programs a lot, and EH is only
-  used for a subset of the programs, it must be specifically enabled by the
-  <tt>-enable-correct-eh-support</tt> option.
-  </p>
-  
-  <p>
-  Note that after this pass runs the CFG is not entirely accurate (exceptional
-  control flow edges are not correct anymore) so only very simple things should
-  be done after the lowerinvoke pass has run (like generation of native code).
-  This should not be used as a general purpose "my LLVM-to-LLVM pass doesn't
-  support the invoke instruction yet" lowering pass.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="lowersetjmp">Lower Set Jump</a>
-</div>
-<div class="doc_text">
-  <p>
-   Lowers <tt>setjmp</tt> and <tt>longjmp</tt> to use the LLVM invoke and unwind
-   instructions as necessary.
-  </p>
-  
-  <p>
-   Lowering of <tt>longjmp</tt> is fairly trivial. We replace the call with a
-   call to the LLVM library function <tt>__llvm_sjljeh_throw_longjmp()</tt>.
-   This unwinds the stack for us calling all of the destructors for
-   objects allocated on the stack.
-  </p>
-  
-  <p>
-   At a <tt>setjmp</tt> call, the basic block is split and the <tt>setjmp</tt>
-   removed. The calls in a function that have a <tt>setjmp</tt> are converted to
-   invoke where the except part checks to see if it's a <tt>longjmp</tt>
-   exception and, if so, if it's handled in the function. If it is, then it gets
-   the value returned by the <tt>longjmp</tt> and goes to where the basic block
-   was split. <tt>invoke</tt> instructions are handled in a similar fashion with
-   the original except block being executed if it isn't a <tt>longjmp</tt>
-   except that is handled by that function.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="lowerswitch">Lower SwitchInst's to branches</a>
-</div>
-<div class="doc_text">
-  <p>
-  Rewrites <tt>switch</tt> instructions with a sequence of branches, which
-  allows targets to get away with not implementing the switch instruction until
-  it is convenient.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="mem2reg">Promote Memory to Register</a>
-</div>
-<div class="doc_text">
-  <p>
-  This file promotes memory references to be register references.  It promotes
-  <tt>alloca</tt> instructions which only have <tt>load</tt>s and
-  <tt>store</tt>s as uses.  An <tt>alloca</tt> is transformed by using dominator
-  frontiers to place <tt>phi</tt> nodes, then traversing the function in
-  depth-first order to rewrite <tt>load</tt>s and <tt>store</tt>s as
-  appropriate. This is just the standard SSA construction algorithm to construct
-  "pruned" SSA form.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="memcpyopt">Optimize use of memcpy and friend</a>
-</div>
-<div class="doc_text">
-  <p>
-  This pass performs various transformations related to eliminating memcpy
-  calls, or transforming sets of stores into memset's.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="mergereturn">Unify function exit nodes</a>
-</div>
-<div class="doc_text">
-  <p>
-  Ensure that functions have at most one <tt>ret</tt> instruction in them.
-  Additionally, it keeps track of which node is the new exit node of the CFG.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="prune-eh">Remove unused exception handling info</a>
-</div>
-<div class="doc_text">
-  <p>
-  This file implements a simple interprocedural pass which walks the call-graph,
-  turning <tt>invoke</tt> instructions into <tt>call</tt> instructions if and
-  only if the callee cannot throw an exception. It implements this as a
-  bottom-up traversal of the call-graph.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="reassociate">Reassociate expressions</a>
-</div>
-<div class="doc_text">
-  <p>
-  This pass reassociates commutative expressions in an order that is designed
-  to promote better constant propagation, GCSE, LICM, PRE, etc.
-  </p>
-  
-  <p>
-  For example: 4 + (<var>x</var> + 5) ⇒ <var>x</var> + (4 + 5)
-  </p>
-  
-  <p>
-  In the implementation of this algorithm, constants are assigned rank = 0,
-  function arguments are rank = 1, and other values are assigned ranks
-  corresponding to the reverse post order traversal of current function
-  (starting at 2), which effectively gives values in deep loops higher rank
-  than values not in loops.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="reg2mem">Demote all values to stack slots</a>
-</div>
-<div class="doc_text">
-  <p>
-  This file demotes all registers to memory references.  It is intented to be
-  the inverse of <a href="#mem2reg"><tt>-mem2reg</tt></a>.  By converting to
-  <tt>load</tt> instructions, the only values live across basic blocks are
-  <tt>alloca</tt> instructions and <tt>load</tt> instructions before
-  <tt>phi</tt> nodes. It is intended that this should make CFG hacking much 
-  easier. To make later hacking easier, the entry block is split into two, such
-  that all introduced <tt>alloca</tt> instructions (and nothing else) are in the
-  entry block.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="scalarrepl">Scalar Replacement of Aggregates</a>
-</div>
-<div class="doc_text">
-  <p>
-  The well-known scalar replacement of aggregates transformation.  This
-  transform breaks up <tt>alloca</tt> instructions of aggregate type (structure
-  or array) into individual <tt>alloca</tt> instructions for each member if
-  possible.  Then, if possible, it transforms the individual <tt>alloca</tt>
-  instructions into nice clean scalar SSA form.
-  </p>
-  
-  <p>
-  This combines a simple scalar replacement of aggregates algorithm with the <a
-  href="#mem2reg"><tt>mem2reg</tt></a> algorithm because often interact, 
-  especially for C++ programs.  As such, iterating between <tt>scalarrepl</tt>, 
-  then <a href="#mem2reg"><tt>mem2reg</tt></a> until we run out of things to 
-  promote works well.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="sccp">Sparse Conditional Constant Propagation</a>
-</div>
-<div class="doc_text">
-  <p>
-  Sparse conditional constant propagation and merging, which can be summarized
-  as:
-  </p>
-  
-  <ol>
-    <li>Assumes values are constant unless proven otherwise</li>
-    <li>Assumes BasicBlocks are dead unless proven otherwise</li>
-    <li>Proves values to be constant, and replaces them with constants</li>
-    <li>Proves conditional branches to be unconditional</li>
-  </ol>
-  
-  <p>
-  Note that this pass has a habit of making definitions be dead.  It is a good
-  idea to to run a DCE pass sometime after running this pass.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="simplify-libcalls">Simplify well-known library calls</a>
-</div>
-<div class="doc_text">
-  <p>
-  Applies a variety of small optimizations for calls to specific well-known 
-  function calls (e.g. runtime library functions). For example, a call
-   <tt>exit(3)</tt> that occurs within the <tt>main()</tt> function can be 
-   transformed into simply <tt>return 3</tt>.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="simplifycfg">Simplify the CFG</a>
-</div>
-<div class="doc_text">
-  <p>
-  Performs dead code elimination and basic block merging. Specifically:
-  </p>
-  
-  <ol>
-    <li>Removes basic blocks with no predecessors.</li>
-    <li>Merges a basic block into its predecessor if there is only one and the
-        predecessor only has one successor.</li>
-    <li>Eliminates PHI nodes for basic blocks with a single predecessor.</li>
-    <li>Eliminates a basic block that only contains an unconditional
-        branch.</li>
-  </ol>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="strip">Strip all symbols from a module</a>
-</div>
-<div class="doc_text">
-  <p>
-  Performs code stripping. This transformation can delete:
-  </p>
-  
-  <ol>
-    <li>names for virtual registers</li>
-    <li>symbols for internal globals and functions</li>
-    <li>debug information</li>
-  </ol>
-  
-  <p>
-  Note that this transformation makes code much less readable, so it should
-  only be used in situations where the <tt>strip</tt> utility would be used,
-  such as reducing code size or making it harder to reverse engineer code.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="strip-dead-prototypes">Remove unused function declarations</a>
-</div>
-<div class="doc_text">
-  <p>
-  This pass loops over all of the functions in the input module, looking for
-  dead declarations and removes them. Dead declarations are declarations of
-  functions for which no implementation is available (i.e., declarations for
-  unused library functions).
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="sretpromotion">Promote sret arguments</a>
-</div>
-<div class="doc_text">
-  <p>
-  This pass finds functions that return a struct (using a pointer to the struct
-  as the first argument of the function, marked with the '<tt>sret</tt>' attribute) and
-  replaces them with a new function that simply returns each of the elements of
-  that struct (using multiple return values).
-  </p>
-
-  <p>
-  This pass works under a number of conditions:
-  </p>
-
-  <ul>
-  <li>The returned struct must not contain other structs</li>
-  <li>The returned struct must only be used to load values from</li>
-  <li>The placeholder struct passed in is the result of an <tt>alloca</tt></li>
-  </ul>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="tailcallelim">Tail Call Elimination</a>
-</div>
-<div class="doc_text">
-  <p>
-  This file transforms calls of the current function (self recursion) followed
-  by a return instruction with a branch to the entry of the function, creating
-  a loop.  This pass also implements the following extensions to the basic
-  algorithm:
-  </p>
-  
-  <ul>
-  <li>Trivial instructions between the call and return do not prevent the
-      transformation from taking place, though currently the analysis cannot
-      support moving any really useful instructions (only dead ones).
-  <li>This pass transforms functions that are prevented from being tail
-      recursive by an associative expression to use an accumulator variable,
-      thus compiling the typical naive factorial or <tt>fib</tt> implementation
-      into efficient code.
-  <li>TRE is performed if the function returns void, if the return
-      returns the result returned by the call, or if the function returns a
-      run-time constant on all exits from the function.  It is possible, though
-      unlikely, that the return returns something else (like constant 0), and
-      can still be TRE'd.  It can be TRE'd if <em>all other</em> return 
-      instructions in the function return the exact same value.
-  <li>If it can prove that callees do not access theier caller stack frame,
-      they are marked as eligible for tail call elimination (by the code
-      generator).
-  </ul>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="tailduplicate">Tail Duplication</a>
-</div>
-<div class="doc_text">
-  <p>
-  This pass performs a limited form of tail duplication, intended to simplify
-  CFGs by removing some unconditional branches.  This pass is necessary to
-  straighten out loops created by the C front-end, but also is capable of
-  making other code nicer.  After this pass is run, the CFG simplify pass
-  should be run to clean up the mess.
-  </p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_section"> <a name="transform">Utility Passes</a></div>
-<div class="doc_text">
-  <p>This section describes the LLVM Utility Passes.</p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="deadarghaX0r">Dead Argument Hacking (BUGPOINT USE ONLY; DO NOT USE)</a>
-</div>
-<div class="doc_text">
-  <p>
-  Same as dead argument elimination, but deletes arguments to functions which
-  are external.  This is only for use by <a
-  href="Bugpoint.html">bugpoint</a>.</p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="extract-blocks">Extract Basic Blocks From Module (for bugpoint use)</a>
-</div>
-<div class="doc_text">
-  <p>
-  This pass is used by bugpoint to extract all blocks from the module into their
-  own functions.</p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="preverify">Preliminary module verification</a>
-</div>
-<div class="doc_text">
-  <p>
-  Ensures that the module is in the form required by the <a
-  href="#verifier">Module Verifier</a> pass.
-  </p>
-  
-  <p>
-  Running the verifier runs this pass automatically, so there should be no need
-  to use it directly.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="verify">Module Verifier</a>
-</div>
-<div class="doc_text">
-  <p>
-  Verifies an LLVM IR code. This is useful to run after an optimization which is
-  undergoing testing. Note that <tt>llvm-as</tt> verifies its input before
-  emitting bitcode, and also that malformed bitcode is likely to make LLVM
-  crash. All language front-ends are therefore encouraged to verify their output
-  before performing optimizing transformations.
-  </p>
-
-  <ul>
-    <li>Both of a binary operator's parameters are of the same type.</li>
-    <li>Verify that the indices of mem access instructions match other
-        operands.</li>
-    <li>Verify that arithmetic and other things are only performed on
-        first-class types.  Verify that shifts and logicals only happen on
-        integrals f.e.</li>
-    <li>All of the constants in a switch statement are of the correct type.</li>
-    <li>The code is in valid SSA form.</li>
-    <li>It is illegal to put a label into any other type (like a structure) or 
-        to return one.</li>
-    <li>Only phi nodes can be self referential: <tt>%x = add i32 %x, %x</tt> is
-        invalid.</li>
-    <li>PHI nodes must have an entry for each predecessor, with no extras.</li>
-    <li>PHI nodes must be the first thing in a basic block, all grouped
-        together.</li>
-    <li>PHI nodes must have at least one entry.</li>
-    <li>All basic blocks should only end with terminator insts, not contain
-        them.</li>
-    <li>The entry node to a function must not have predecessors.</li>
-    <li>All Instructions must be embedded into a basic block.</li>
-    <li>Functions cannot take a void-typed parameter.</li>
-    <li>Verify that a function's argument list agrees with its declared
-        type.</li>
-    <li>It is illegal to specify a name for a void value.</li>
-    <li>It is illegal to have a internal global value with no initializer.</li>
-    <li>It is illegal to have a ret instruction that returns a value that does
-        not agree with the function return value type.</li>
-    <li>Function call argument types match the function prototype.</li>
-    <li>All other things that are tested by asserts spread about the code.</li>
-  </ul>
-  
-  <p>
-  Note that this does not provide full security verification (like Java), but
-  instead just tries to ensure that code is well-formed.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="view-cfg">View CFG of function</a>
-</div>
-<div class="doc_text">
-  <p>
-  Displays the control flow graph using the GraphViz tool.
-  </p>
-</div>
-
-<!-------------------------------------------------------------------------- -->
-<div class="doc_subsection">
-  <a name="view-cfg-only">View CFG of function (with no function bodies)</a>
-</div>
-<div class="doc_text">
-  <p>
-  Displays the control flow graph using the GraphViz tool, but omitting function
-  bodies.
-  </p>
-</div>
-
-<!-- *********************************************************************** -->
-
-<hr>
-<address>
-  <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
-  src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS"></a>
-  <a href="http://validator.w3.org/check/referer"><img
-  src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
-
-  <a href="mailto:rspencer at x10sys.com">Reid Spencer</a><br>
-  <a href="http://llvm.org">LLVM Compiler Infrastructure</a><br>
-  Last modified: $Date$
-</address>
-
-</body>
-</html>
diff --git a/libclamav/c++/llvm/docs/ProgrammersManual.html b/libclamav/c++/llvm/docs/ProgrammersManual.html
deleted file mode 100644
index a37eca2..0000000
--- a/libclamav/c++/llvm/docs/ProgrammersManual.html
+++ /dev/null
@@ -1,3928 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-                      "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-  <meta http-equiv="Content-type" content="text/html;charset=UTF-8">
-  <title>LLVM Programmer's Manual</title>
-  <link rel="stylesheet" href="llvm.css" type="text/css">
-</head>
-<body>
-
-<div class="doc_title">
-  LLVM Programmer's Manual
-</div>
-
-<ol>
-  <li><a href="#introduction">Introduction</a></li>
-  <li><a href="#general">General Information</a>
-    <ul>
-      <li><a href="#stl">The C++ Standard Template Library</a></li>
-<!--
-      <li>The <tt>-time-passes</tt> option</li>
-      <li>How to use the LLVM Makefile system</li>
-      <li>How to write a regression test</li>
-
---> 
-    </ul>
-  </li>
-  <li><a href="#apis">Important and useful LLVM APIs</a>
-    <ul>
-      <li><a href="#isa">The <tt>isa&lt;&gt;</tt>, <tt>cast&lt;&gt;</tt>
-and <tt>dyn_cast&lt;&gt;</tt> templates</a> </li>
-      <li><a href="#string_apis">Passing strings (the <tt>StringRef</tt>
-and <tt>Twine</tt> classes)</a>
-        <ul>
-          <li><a href="#StringRef">The <tt>StringRef</tt> class</a> </li>
-          <li><a href="#Twine">The <tt>Twine</tt> class</a> </li>
-        </ul>
-      </li>
-      <li><a href="#DEBUG">The <tt>DEBUG()</tt> macro and <tt>-debug</tt>
-option</a>
-        <ul>
-          <li><a href="#DEBUG_TYPE">Fine grained debug info with <tt>DEBUG_TYPE</tt>
-and the <tt>-debug-only</tt> option</a> </li>
-        </ul>
-      </li>
-      <li><a href="#Statistic">The <tt>Statistic</tt> class &amp; <tt>-stats</tt>
-option</a></li>
-<!--
-      <li>The <tt>InstVisitor</tt> template
-      <li>The general graph API
---> 
-      <li><a href="#ViewGraph">Viewing graphs while debugging code</a></li>
-    </ul>
-  </li>
-  <li><a href="#datastructure">Picking the Right Data Structure for a Task</a>
-    <ul>
-    <li><a href="#ds_sequential">Sequential Containers (std::vector, std::list, etc)</a>
-    <ul>
-      <li><a href="#dss_fixedarrays">Fixed Size Arrays</a></li>
-      <li><a href="#dss_heaparrays">Heap Allocated Arrays</a></li>
-      <li><a href="#dss_smallvector">"llvm/ADT/SmallVector.h"</a></li>
-      <li><a href="#dss_vector">&lt;vector&gt;</a></li>
-      <li><a href="#dss_deque">&lt;deque&gt;</a></li>
-      <li><a href="#dss_list">&lt;list&gt;</a></li>
-      <li><a href="#dss_ilist">llvm/ADT/ilist.h</a></li>
-      <li><a href="#dss_other">Other Sequential Container Options</a></li>
-    </ul></li>
-    <li><a href="#ds_set">Set-Like Containers (std::set, SmallSet, SetVector, etc)</a>
-    <ul>
-      <li><a href="#dss_sortedvectorset">A sorted 'vector'</a></li>
-      <li><a href="#dss_smallset">"llvm/ADT/SmallSet.h"</a></li>
-      <li><a href="#dss_smallptrset">"llvm/ADT/SmallPtrSet.h"</a></li>
-      <li><a href="#dss_denseset">"llvm/ADT/DenseSet.h"</a></li>
-      <li><a href="#dss_FoldingSet">"llvm/ADT/FoldingSet.h"</a></li>
-      <li><a href="#dss_set">&lt;set&gt;</a></li>
-      <li><a href="#dss_setvector">"llvm/ADT/SetVector.h"</a></li>
-      <li><a href="#dss_uniquevector">"llvm/ADT/UniqueVector.h"</a></li>
-      <li><a href="#dss_otherset">Other Set-Like ContainerOptions</a></li>
-    </ul></li>
-    <li><a href="#ds_map">Map-Like Containers (std::map, DenseMap, etc)</a>
-    <ul>
-      <li><a href="#dss_sortedvectormap">A sorted 'vector'</a></li>
-      <li><a href="#dss_stringmap">"llvm/ADT/StringMap.h"</a></li>
-      <li><a href="#dss_indexedmap">"llvm/ADT/IndexedMap.h"</a></li>
-      <li><a href="#dss_densemap">"llvm/ADT/DenseMap.h"</a></li>
-      <li><a href="#dss_valuemap">"llvm/ADT/ValueMap.h"</a></li>
-      <li><a href="#dss_map">&lt;map&gt;</a></li>
-      <li><a href="#dss_othermap">Other Map-Like Container Options</a></li>
-    </ul></li>
-    <li><a href="#ds_string">String-like containers</a>
-    <!--<ul>
-       todo
-    </ul>--></li>
-    <li><a href="#ds_bit">BitVector-like containers</a>
-    <ul>
-      <li><a href="#dss_bitvector">A dense bitvector</a></li>
-      <li><a href="#dss_smallbitvector">A "small" dense bitvector</a></li>
-      <li><a href="#dss_sparsebitvector">A sparse bitvector</a></li>
-    </ul></li>
-  </ul>
-  </li>
-  <li><a href="#common">Helpful Hints for Common Operations</a>
-    <ul>
-      <li><a href="#inspection">Basic Inspection and Traversal Routines</a>
-        <ul>
-          <li><a href="#iterate_function">Iterating over the <tt>BasicBlock</tt>s
-in a <tt>Function</tt></a> </li>
-          <li><a href="#iterate_basicblock">Iterating over the <tt>Instruction</tt>s
-in a <tt>BasicBlock</tt></a> </li>
-          <li><a href="#iterate_institer">Iterating over the <tt>Instruction</tt>s
-in a <tt>Function</tt></a> </li>
-          <li><a href="#iterate_convert">Turning an iterator into a
-class pointer</a> </li>
-          <li><a href="#iterate_complex">Finding call sites: a more
-complex example</a> </li>
-          <li><a href="#calls_and_invokes">Treating calls and invokes
-the same way</a> </li>
-          <li><a href="#iterate_chains">Iterating over def-use &amp;
-use-def chains</a> </li>
-          <li><a href="#iterate_preds">Iterating over predecessors &amp;
-successors of blocks</a></li>
-        </ul>
-      </li>
-      <li><a href="#simplechanges">Making simple changes</a>
-        <ul>
-          <li><a href="#schanges_creating">Creating and inserting new
-		 <tt>Instruction</tt>s</a> </li>
-          <li><a href="#schanges_deleting">Deleting 		 <tt>Instruction</tt>s</a> </li>
-          <li><a href="#schanges_replacing">Replacing an 		 <tt>Instruction</tt>
-with another <tt>Value</tt></a> </li>
-          <li><a href="#schanges_deletingGV">Deleting <tt>GlobalVariable</tt>s</a> </li>  
-        </ul>
-      </li>
-      <li><a href="#create_types">How to Create Types</a></li>
-<!--
-    <li>Working with the Control Flow Graph
-    <ul>
-      <li>Accessing predecessors and successors of a <tt>BasicBlock</tt>
-      <li>
-      <li>
-    </ul>
---> 
-    </ul>
-  </li>
-
-  <li><a href="#threading">Threads and LLVM</a>
-  <ul>
-    <li><a href="#startmultithreaded">Entering and Exiting Multithreaded Mode
-        </a></li>
-    <li><a href="#shutdown">Ending execution with <tt>llvm_shutdown()</tt></a></li>
-    <li><a href="#managedstatic">Lazy initialization with <tt>ManagedStatic</tt></a></li>
-    <li><a href="#llvmcontext">Achieving Isolation with <tt>LLVMContext</tt></a></li>
-    <li><a href="#jitthreading">Threads and the JIT</a></li>
-  </ul>
-  </li>
-
-  <li><a href="#advanced">Advanced Topics</a>
-  <ul>
-  <li><a href="#TypeResolve">LLVM Type Resolution</a>
-  <ul>
-    <li><a href="#BuildRecType">Basic Recursive Type Construction</a></li>
-    <li><a href="#refineAbstractTypeTo">The <tt>refineAbstractTypeTo</tt> method</a></li>
-    <li><a href="#PATypeHolder">The PATypeHolder Class</a></li>
-    <li><a href="#AbstractTypeUser">The AbstractTypeUser Class</a></li>
-  </ul></li>
-
-  <li><a href="#SymbolTable">The <tt>ValueSymbolTable</tt> and <tt>TypeSymbolTable</tt> classes</a></li>
-  <li><a href="#UserLayout">The <tt>User</tt> and owned <tt>Use</tt> classes' memory layout</a></li>
-  </ul></li>
-
-  <li><a href="#coreclasses">The Core LLVM Class Hierarchy Reference</a>
-    <ul>
-      <li><a href="#Type">The <tt>Type</tt> class</a> </li>
-      <li><a href="#Module">The <tt>Module</tt> class</a></li>
-      <li><a href="#Value">The <tt>Value</tt> class</a>
-      <ul>
-        <li><a href="#User">The <tt>User</tt> class</a>
-        <ul>
-          <li><a href="#Instruction">The <tt>Instruction</tt> class</a></li>
-          <li><a href="#Constant">The <tt>Constant</tt> class</a>
-          <ul>
-            <li><a href="#GlobalValue">The <tt>GlobalValue</tt> class</a>
-            <ul>
-              <li><a href="#Function">The <tt>Function</tt> class</a></li>
-              <li><a href="#GlobalVariable">The <tt>GlobalVariable</tt> class</a></li>
-            </ul>
-            </li>
-          </ul>
-          </li>
-        </ul>
-        </li>
-        <li><a href="#BasicBlock">The <tt>BasicBlock</tt> class</a></li>
-        <li><a href="#Argument">The <tt>Argument</tt> class</a></li>
-      </ul>
-      </li>
-    </ul>
-  </li>
-</ol>
-
-<div class="doc_author">    
-  <p>Written by <a href="mailto:sabre at nondot.org">Chris Lattner</a>, 
-                <a href="mailto:dhurjati at cs.uiuc.edu">Dinakar Dhurjati</a>, 
-                <a href="mailto:ggreif at gmail.com">Gabor Greif</a>, 
-                <a href="mailto:jstanley at cs.uiuc.edu">Joel Stanley</a>,
-                <a href="mailto:rspencer at x10sys.com">Reid Spencer</a> and
-                <a href="mailto:owen at apple.com">Owen Anderson</a></p>
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="introduction">Introduction </a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>This document is meant to highlight some of the important classes and
-interfaces available in the LLVM source-base.  This manual is not
-intended to explain what LLVM is, how it works, and what LLVM code looks
-like.  It assumes that you know the basics of LLVM and are interested
-in writing transformations or otherwise analyzing or manipulating the
-code.</p>
-
-<p>This document should get you oriented so that you can find your
-way in the continuously growing source code that makes up the LLVM
-infrastructure. Note that this manual is not intended to serve as a
-replacement for reading the source code, so if you think there should be
-a method in one of these classes to do something, but it's not listed,
-check the source.  Links to the <a href="/doxygen/">doxygen</a> sources
-are provided to make this as easy as possible.</p>
-
-<p>The first section of this document describes general information that is
-useful to know when working in the LLVM infrastructure, and the second describes
-the Core LLVM classes.  In the future this manual will be extended with
-information describing how to use extension libraries, such as dominator
-information, CFG traversal routines, and useful utilities like the <tt><a
-href="/doxygen/InstVisitor_8h-source.html">InstVisitor</a></tt> template.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="general">General Information</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>This section contains general information that is useful if you are working
-in the LLVM source-base, but that isn't specific to any particular API.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="stl">The C++ Standard Template Library</a>
-</div>
-
-<div class="doc_text">
-
-<p>LLVM makes heavy use of the C++ Standard Template Library (STL),
-perhaps much more than you are used to, or have seen before.  Because of
-this, you might want to do a little background reading in the
-techniques used and capabilities of the library.  There are many good
-pages that discuss the STL, and several books on the subject that you
-can get, so it will not be discussed in this document.</p>
-
-<p>Here are some useful links:</p>
-
-<ol>
-
-<li><a href="http://www.dinkumware.com/refxcpp.html">Dinkumware C++ Library
-reference</a> - an excellent reference for the STL and other parts of the
-standard C++ library.</li>
-
-<li><a href="http://www.tempest-sw.com/cpp/">C++ In a Nutshell</a> - This is an
-O'Reilly book in the making.  It has a decent Standard Library
-Reference that rivals Dinkumware's, and is unfortunately no longer free since the
-book has been published.</li>
-
-<li><a href="http://www.parashift.com/c++-faq-lite/">C++ Frequently Asked
-Questions</a></li>
-
-<li><a href="http://www.sgi.com/tech/stl/">SGI's STL Programmer's Guide</a> -
-Contains a useful <a
-href="http://www.sgi.com/tech/stl/stl_introduction.html">Introduction to the
-STL</a>.</li>
-
-<li><a href="http://www.research.att.com/%7Ebs/C++.html">Bjarne Stroustrup's C++
-Page</a></li>
-
-<li><a href="http://64.78.49.204/">
-Bruce Eckel's Thinking in C++, 2nd ed. Volume 2 Revision 4.0 (even better, get
-the book).</a></li>
-
-</ol>
-  
-<p>You are also encouraged to take a look at the <a
-href="CodingStandards.html">LLVM Coding Standards</a> guide which focuses on how
-to write maintainable code more than where to put your curly braces.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="stl">Other useful references</a>
-</div>
-
-<div class="doc_text">
-
-<ol>
-<li><a href="http://www.psc.edu/%7Esemke/cvs_branches.html">CVS
-Branch and Tag Primer</a></li>
-<li><a href="http://www.fortran-2000.com/ArnaudRecipes/sharedlib.html">Using
-static and shared libraries across platforms</a></li>
-</ol>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="apis">Important and useful LLVM APIs</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>Here we highlight some LLVM APIs that are generally useful and good to
-know about when writing transformations.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="isa">The <tt>isa&lt;&gt;</tt>, <tt>cast&lt;&gt;</tt> and
-  <tt>dyn_cast&lt;&gt;</tt> templates</a>
-</div>
-
-<div class="doc_text">
-
-<p>The LLVM source-base makes extensive use of a custom form of RTTI.
-These templates have many similarities to the C++ <tt>dynamic_cast&lt;&gt;</tt>
-operator, but they don't have some drawbacks (primarily stemming from
-the fact that <tt>dynamic_cast&lt;&gt;</tt> only works on classes that
-have a v-table). Because they are used so often, you must know what they
-do and how they work. All of these templates are defined in the <a
- href="/doxygen/Casting_8h-source.html"><tt>llvm/Support/Casting.h</tt></a>
-file (note that you very rarely have to include this file directly).</p>
-
-<dl>
-  <dt><tt>isa&lt;&gt;</tt>: </dt>
-
-  <dd><p>The <tt>isa&lt;&gt;</tt> operator works exactly like the Java
-  "<tt>instanceof</tt>" operator.  It returns true or false depending on whether
-  a reference or pointer points to an instance of the specified class.  This can
-  be very useful for constraint checking of various sorts (example below).</p>
-  </dd>
-
-  <dt><tt>cast&lt;&gt;</tt>: </dt>
-
-  <dd><p>The <tt>cast&lt;&gt;</tt> operator is a "checked cast" operation. It
-  converts a pointer or reference from a base class to a derived class, causing
-  an assertion failure if it is not really an instance of the right type.  This
-  should be used in cases where you have some information that makes you believe
-  that something is of the right type.  An example of the <tt>isa&lt;&gt;</tt>
-  and <tt>cast&lt;&gt;</tt> template is:</p>
-
-<div class="doc_code">
-<pre>
-static bool isLoopInvariant(const <a href="#Value">Value</a> *V, const Loop *L) {
-  if (isa&lt;<a href="#Constant">Constant</a>&gt;(V) || isa&lt;<a href="#Argument">Argument</a>&gt;(V) || isa&lt;<a href="#GlobalValue">GlobalValue</a>&gt;(V))
-    return true;
-
-  // <i>Otherwise, it must be an instruction...</i>
-  return !L-&gt;contains(cast&lt;<a href="#Instruction">Instruction</a>&gt;(V)-&gt;getParent());
-}
-</pre>
-</div>
-
-  <p>Note that you should <b>not</b> use an <tt>isa&lt;&gt;</tt> test followed
-  by a <tt>cast&lt;&gt;</tt>, for that use the <tt>dyn_cast&lt;&gt;</tt>
-  operator.</p>
-
-  </dd>
-
-  <dt><tt>dyn_cast&lt;&gt;</tt>:</dt>
-
-  <dd><p>The <tt>dyn_cast&lt;&gt;</tt> operator is a "checking cast" operation.
-  It checks to see if the operand is of the specified type, and if so, returns a
-  pointer to it (this operator does not work with references). If the operand is
-  not of the correct type, a null pointer is returned.  Thus, this works very
-  much like the <tt>dynamic_cast&lt;&gt;</tt> operator in C++, and should be
-  used in the same circumstances.  Typically, the <tt>dyn_cast&lt;&gt;</tt>
-  operator is used in an <tt>if</tt> statement or some other flow control
-  statement like this:</p>
-
-<div class="doc_code">
-<pre>
-if (<a href="#AllocationInst">AllocationInst</a> *AI = dyn_cast&lt;<a href="#AllocationInst">AllocationInst</a>&gt;(Val)) {
-  // <i>...</i>
-}
-</pre>
-</div>
-   
-  <p>This form of the <tt>if</tt> statement effectively combines together a call
-  to <tt>isa&lt;&gt;</tt> and a call to <tt>cast&lt;&gt;</tt> into one
-  statement, which is very convenient.</p>
-
-  <p>Note that the <tt>dyn_cast&lt;&gt;</tt> operator, like C++'s
-  <tt>dynamic_cast&lt;&gt;</tt> or Java's <tt>instanceof</tt> operator, can be
-  abused.  In particular, you should not use big chained <tt>if/then/else</tt>
-  blocks to check for lots of different variants of classes.  If you find
-  yourself wanting to do this, it is much cleaner and more efficient to use the
-  <tt>InstVisitor</tt> class to dispatch over the instruction type directly.</p>
-
-  </dd>
-
-  <dt><tt>cast_or_null&lt;&gt;</tt>: </dt>
-  
-  <dd><p>The <tt>cast_or_null&lt;&gt;</tt> operator works just like the
-  <tt>cast&lt;&gt;</tt> operator, except that it allows for a null pointer as an
-  argument (which it then propagates).  This can sometimes be useful, allowing
-  you to combine several null checks into one.</p></dd>
-
-  <dt><tt>dyn_cast_or_null&lt;&gt;</tt>: </dt>
-
-  <dd><p>The <tt>dyn_cast_or_null&lt;&gt;</tt> operator works just like the
-  <tt>dyn_cast&lt;&gt;</tt> operator, except that it allows for a null pointer
-  as an argument (which it then propagates).  This can sometimes be useful,
-  allowing you to combine several null checks into one.</p></dd>
-
-</dl>
-
-<p>These five templates can be used with any classes, whether they have a
-v-table or not.  To add support for these templates, you simply need to add
-<tt>classof</tt> static methods to the class you are interested casting
-to. Describing this is currently outside the scope of this document, but there
-are lots of examples in the LLVM source base.</p>
-
-</div>
-
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="string_apis">Passing strings (the <tt>StringRef</tt>
-and <tt>Twine</tt> classes)</a>
-</div>
-
-<div class="doc_text">
-
-<p>Although LLVM generally does not do much string manipulation, we do have
-several important APIs which take strings.  Two important examples are the
-Value class -- which has names for instructions, functions, etc. -- and the
-StringMap class which is used extensively in LLVM and Clang.</p>
-
-<p>These are generic classes, and they need to be able to accept strings which
-may have embedded null characters.  Therefore, they cannot simply take
-a <tt>const char *</tt>, and taking a <tt>const std::string&amp;</tt> requires
-clients to perform a heap allocation which is usually unnecessary.  Instead,
-many LLVM APIs use a <tt>const StringRef&amp;</tt> or a <tt>const 
-Twine&amp;</tt> for passing strings efficiently.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="StringRef">The <tt>StringRef</tt> class</a>
-</div>
-
-<div class="doc_text">
-
-<p>The <tt>StringRef</tt> data type represents a reference to a constant string
-(a character array and a length) and supports the common operations available
-on <tt>std:string</tt>, but does not require heap allocation.</p>
-
-<p>It can be implicitly constructed using a C style null-terminated string,
-an <tt>std::string</tt>, or explicitly with a character pointer and length.
-For example, the <tt>StringRef</tt> find function is declared as:</p>
-
-<div class="doc_code">
-  iterator find(const StringRef &amp;Key);
-</div>
-
-<p>and clients can call it using any one of:</p>
-
-<div class="doc_code">
-<pre>
-  Map.find("foo");                 <i>// Lookup "foo"</i>
-  Map.find(std::string("bar"));    <i>// Lookup "bar"</i>
-  Map.find(StringRef("\0baz", 4)); <i>// Lookup "\0baz"</i>
-</pre>
-</div>
-
-<p>Similarly, APIs which need to return a string may return a <tt>StringRef</tt>
-instance, which can be used directly or converted to an <tt>std::string</tt>
-using the <tt>str</tt> member function.  See 
-"<tt><a href="/doxygen/classllvm_1_1StringRef_8h-source.html">llvm/ADT/StringRef.h</a></tt>"
-for more information.</p>
-
-<p>You should rarely use the <tt>StringRef</tt> class directly, because it contains
-pointers to external memory it is not generally safe to store an instance of the
-class (unless you know that the external storage will not be freed).</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="Twine">The <tt>Twine</tt> class</a>
-</div>
-
-<div class="doc_text">
-
-<p>The <tt>Twine</tt> class is an efficient way for APIs to accept concatenated
-strings.  For example, a common LLVM paradigm is to name one instruction based on
-the name of another instruction with a suffix, for example:</p>
-
-<div class="doc_code">
-<pre>
-    New = CmpInst::Create(<i>...</i>, SO->getName() + ".cmp");
-</pre>
-</div>
-
-<p>The <tt>Twine</tt> class is effectively a
-lightweight <a href="http://en.wikipedia.org/wiki/Rope_(computer_science)">rope</a>
-which points to temporary (stack allocated) objects.  Twines can be implicitly
-constructed as the result of the plus operator applied to strings (i.e., a C
-strings, an <tt>std::string</tt>, or a <tt>StringRef</tt>).  The twine delays the
-actual concatentation of strings until it is actually required, at which point
-it can be efficiently rendered directly into a character array.  This avoids
-unnecessary heap allocation involved in constructing the temporary results of
-string concatenation. See
-"<tt><a href="/doxygen/classllvm_1_1Twine_8h-source.html">llvm/ADT/Twine.h</a></tt>"
-for more information.</p>
-
-<p>As with a <tt>StringRef</tt>, <tt>Twine</tt> objects point to external memory
-and should almost never be stored or mentioned directly.  They are intended
-solely for use when defining a function which should be able to efficiently
-accept concatenated strings.</p>
-
-</div>
-
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="DEBUG">The <tt>DEBUG()</tt> macro and <tt>-debug</tt> option</a>
-</div>
-
-<div class="doc_text">
-
-<p>Often when working on your pass you will put a bunch of debugging printouts
-and other code into your pass.  After you get it working, you want to remove
-it, but you may need it again in the future (to work out new bugs that you run
-across).</p>
-
-<p> Naturally, because of this, you don't want to delete the debug printouts,
-but you don't want them to always be noisy.  A standard compromise is to comment
-them out, allowing you to enable them if you need them in the future.</p>
-
-<p>The "<tt><a href="/doxygen/Debug_8h-source.html">llvm/Support/Debug.h</a></tt>"
-file provides a macro named <tt>DEBUG()</tt> that is a much nicer solution to
-this problem.  Basically, you can put arbitrary code into the argument of the
-<tt>DEBUG</tt> macro, and it is only executed if '<tt>opt</tt>' (or any other
-tool) is run with the '<tt>-debug</tt>' command line argument:</p>
-
-<div class="doc_code">
-<pre>
-DEBUG(errs() &lt;&lt; "I am here!\n");
-</pre>
-</div>
-
-<p>Then you can run your pass like this:</p>
-
-<div class="doc_code">
-<pre>
-$ opt &lt; a.bc &gt; /dev/null -mypass
-<i>&lt;no output&gt;</i>
-$ opt &lt; a.bc &gt; /dev/null -mypass -debug
-I am here!
-</pre>
-</div>
-
-<p>Using the <tt>DEBUG()</tt> macro instead of a home-brewed solution allows you
-to not have to create "yet another" command line option for the debug output for
-your pass.  Note that <tt>DEBUG()</tt> macros are disabled for optimized builds,
-so they do not cause a performance impact at all (for the same reason, they
-should also not contain side-effects!).</p>
-
-<p>One additional nice thing about the <tt>DEBUG()</tt> macro is that you can
-enable or disable it directly in gdb.  Just use "<tt>set DebugFlag=0</tt>" or
-"<tt>set DebugFlag=1</tt>" from the gdb if the program is running.  If the
-program hasn't been started yet, you can always just run it with
-<tt>-debug</tt>.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="DEBUG_TYPE">Fine grained debug info with <tt>DEBUG_TYPE</tt> and
-  the <tt>-debug-only</tt> option</a>
-</div>
-
-<div class="doc_text">
-
-<p>Sometimes you may find yourself in a situation where enabling <tt>-debug</tt>
-just turns on <b>too much</b> information (such as when working on the code
-generator).  If you want to enable debug information with more fine-grained
-control, you define the <tt>DEBUG_TYPE</tt> macro and the <tt>-debug</tt> only
-option as follows:</p>
-
-<div class="doc_code">
-<pre>
-#undef  DEBUG_TYPE
-DEBUG(errs() &lt;&lt; "No debug type\n");
-#define DEBUG_TYPE "foo"
-DEBUG(errs() &lt;&lt; "'foo' debug type\n");
-#undef  DEBUG_TYPE
-#define DEBUG_TYPE "bar"
-DEBUG(errs() &lt;&lt; "'bar' debug type\n"));
-#undef  DEBUG_TYPE
-#define DEBUG_TYPE ""
-DEBUG(errs() &lt;&lt; "No debug type (2)\n");
-</pre>
-</div>
-
-<p>Then you can run your pass like this:</p>
-
-<div class="doc_code">
-<pre>
-$ opt &lt; a.bc &gt; /dev/null -mypass
-<i>&lt;no output&gt;</i>
-$ opt &lt; a.bc &gt; /dev/null -mypass -debug
-No debug type
-'foo' debug type
-'bar' debug type
-No debug type (2)
-$ opt &lt; a.bc &gt; /dev/null -mypass -debug-only=foo
-'foo' debug type
-$ opt &lt; a.bc &gt; /dev/null -mypass -debug-only=bar
-'bar' debug type
-</pre>
-</div>
-
-<p>Of course, in practice, you should only set <tt>DEBUG_TYPE</tt> at the top of
-a file, to specify the debug type for the entire module (if you do this before
-you <tt>#include "llvm/Support/Debug.h"</tt>, you don't have to insert the ugly
-<tt>#undef</tt>'s).  Also, you should use names more meaningful than "foo" and
-"bar", because there is no system in place to ensure that names do not
-conflict. If two different modules use the same string, they will all be turned
-on when the name is specified. This allows, for example, all debug information
-for instruction scheduling to be enabled with <tt>-debug-type=InstrSched</tt>,
-even if the source lives in multiple files.</p>
-
-<p>The <tt>DEBUG_WITH_TYPE</tt> macro is also available for situations where you
-would like to set <tt>DEBUG_TYPE</tt>, but only for one specific <tt>DEBUG</tt>
-statement. It takes an additional first parameter, which is the type to use. For
-example, the preceding example could be written as:</p>
-
-
-<div class="doc_code">
-<pre>
-DEBUG_WITH_TYPE("", errs() &lt;&lt; "No debug type\n");
-DEBUG_WITH_TYPE("foo", errs() &lt;&lt; "'foo' debug type\n");
-DEBUG_WITH_TYPE("bar", errs() &lt;&lt; "'bar' debug type\n"));
-DEBUG_WITH_TYPE("", errs() &lt;&lt; "No debug type (2)\n");
-</pre>
-</div>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="Statistic">The <tt>Statistic</tt> class &amp; <tt>-stats</tt>
-  option</a>
-</div>
-
-<div class="doc_text">
-
-<p>The "<tt><a
-href="/doxygen/Statistic_8h-source.html">llvm/ADT/Statistic.h</a></tt>" file
-provides a class named <tt>Statistic</tt> that is used as a unified way to
-keep track of what the LLVM compiler is doing and how effective various
-optimizations are.  It is useful to see what optimizations are contributing to
-making a particular program run faster.</p>
-
-<p>Often you may run your pass on some big program, and you're interested to see
-how many times it makes a certain transformation.  Although you can do this with
-hand inspection, or some ad-hoc method, this is a real pain and not very useful
-for big programs.  Using the <tt>Statistic</tt> class makes it very easy to
-keep track of this information, and the calculated information is presented in a
-uniform manner with the rest of the passes being executed.</p>
-
-<p>There are many examples of <tt>Statistic</tt> uses, but the basics of using
-it are as follows:</p>
-
-<ol>
-    <li><p>Define your statistic like this:</p>
-
-<div class="doc_code">
-<pre>
-#define <a href="#DEBUG_TYPE">DEBUG_TYPE</a> "mypassname"   <i>// This goes before any #includes.</i>
-STATISTIC(NumXForms, "The # of times I did stuff");
-</pre>
-</div>
-
-  <p>The <tt>STATISTIC</tt> macro defines a static variable, whose name is
-    specified by the first argument.  The pass name is taken from the DEBUG_TYPE
-    macro, and the description is taken from the second argument.  The variable
-    defined ("NumXForms" in this case) acts like an unsigned integer.</p></li>
-
-    <li><p>Whenever you make a transformation, bump the counter:</p>
-
-<div class="doc_code">
-<pre>
-++NumXForms;   // <i>I did stuff!</i>
-</pre>
-</div>
-
-    </li>
-  </ol>
-
-  <p>That's all you have to do.  To get '<tt>opt</tt>' to print out the
-  statistics gathered, use the '<tt>-stats</tt>' option:</p>
-
-<div class="doc_code">
-<pre>
-$ opt -stats -mypassname &lt; program.bc &gt; /dev/null
-<i>... statistics output ...</i>
-</pre>
-</div>
-
-  <p> When running <tt>opt</tt> on a C file from the SPEC benchmark
-suite, it gives a report that looks like this:</p>
-
-<div class="doc_code">
-<pre>
-   7646 bitcodewriter   - Number of normal instructions
-    725 bitcodewriter   - Number of oversized instructions
- 129996 bitcodewriter   - Number of bitcode bytes written
-   2817 raise           - Number of insts DCEd or constprop'd
-   3213 raise           - Number of cast-of-self removed
-   5046 raise           - Number of expression trees converted
-     75 raise           - Number of other getelementptr's formed
-    138 raise           - Number of load/store peepholes
-     42 deadtypeelim    - Number of unused typenames removed from symtab
-    392 funcresolve     - Number of varargs functions resolved
-     27 globaldce       - Number of global variables removed
-      2 adce            - Number of basic blocks removed
-    134 cee             - Number of branches revectored
-     49 cee             - Number of setcc instruction eliminated
-    532 gcse            - Number of loads removed
-   2919 gcse            - Number of instructions removed
-     86 indvars         - Number of canonical indvars added
-     87 indvars         - Number of aux indvars removed
-     25 instcombine     - Number of dead inst eliminate
-    434 instcombine     - Number of insts combined
-    248 licm            - Number of load insts hoisted
-   1298 licm            - Number of insts hoisted to a loop pre-header
-      3 licm            - Number of insts hoisted to multiple loop preds (bad, no loop pre-header)
-     75 mem2reg         - Number of alloca's promoted
-   1444 cfgsimplify     - Number of blocks simplified
-</pre>
-</div>
-
-<p>Obviously, with so many optimizations, having a unified framework for this
-stuff is very nice.  Making your pass fit well into the framework makes it more
-maintainable and useful.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="ViewGraph">Viewing graphs while debugging code</a>
-</div>
-
-<div class="doc_text">
-
-<p>Several of the important data structures in LLVM are graphs: for example
-CFGs made out of LLVM <a href="#BasicBlock">BasicBlock</a>s, CFGs made out of
-LLVM <a href="CodeGenerator.html#machinebasicblock">MachineBasicBlock</a>s, and
-<a href="CodeGenerator.html#selectiondag_intro">Instruction Selection
-DAGs</a>.  In many cases, while debugging various parts of the compiler, it is
-nice to instantly visualize these graphs.</p>
-
-<p>LLVM provides several callbacks that are available in a debug build to do
-exactly that.  If you call the <tt>Function::viewCFG()</tt> method, for example,
-the current LLVM tool will pop up a window containing the CFG for the function
-where each basic block is a node in the graph, and each node contains the
-instructions in the block.  Similarly, there also exists 
-<tt>Function::viewCFGOnly()</tt> (does not include the instructions), the
-<tt>MachineFunction::viewCFG()</tt> and <tt>MachineFunction::viewCFGOnly()</tt>,
-and the <tt>SelectionDAG::viewGraph()</tt> methods.  Within GDB, for example,
-you can usually use something like <tt>call DAG.viewGraph()</tt> to pop
-up a window.  Alternatively, you can sprinkle calls to these functions in your
-code in places you want to debug.</p>
-
-<p>Getting this to work requires a small amount of configuration.  On Unix
-systems with X11, install the <a href="http://www.graphviz.org">graphviz</a>
-toolkit, and make sure 'dot' and 'gv' are in your path.  If you are running on
-Mac OS/X, download and install the Mac OS/X <a 
-href="http://www.pixelglow.com/graphviz/">Graphviz program</a>, and add
-<tt>/Applications/Graphviz.app/Contents/MacOS/</tt> (or wherever you install
-it) to your path.  Once in your system and path are set up, rerun the LLVM
-configure script and rebuild LLVM to enable this functionality.</p>
-
-<p><tt>SelectionDAG</tt> has been extended to make it easier to locate
-<i>interesting</i> nodes in large complex graphs.  From gdb, if you
-<tt>call DAG.setGraphColor(<i>node</i>, "<i>color</i>")</tt>, then the
-next <tt>call DAG.viewGraph()</tt> would highlight the node in the
-specified color (choices of colors can be found at <a
-href="http://www.graphviz.org/doc/info/colors.html">colors</a>.) More
-complex node attributes can be provided with <tt>call
-DAG.setGraphAttrs(<i>node</i>, "<i>attributes</i>")</tt> (choices can be
-found at <a href="http://www.graphviz.org/doc/info/attrs.html">Graph
-Attributes</a>.)  If you want to restart and clear all the current graph
-attributes, then you can <tt>call DAG.clearGraphAttrs()</tt>. </p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="datastructure">Picking the Right Data Structure for a Task</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>LLVM has a plethora of data structures in the <tt>llvm/ADT/</tt> directory,
- and we commonly use STL data structures.  This section describes the trade-offs
- you should consider when you pick one.</p>
-
-<p>
-The first step is a choose your own adventure: do you want a sequential
-container, a set-like container, or a map-like container?  The most important
-thing when choosing a container is the algorithmic properties of how you plan to
-access the container.  Based on that, you should use:</p>
-
-<ul>
-<li>a <a href="#ds_map">map-like</a> container if you need efficient look-up
-    of an value based on another value.  Map-like containers also support
-    efficient queries for containment (whether a key is in the map).  Map-like
-    containers generally do not support efficient reverse mapping (values to
-    keys).  If you need that, use two maps.  Some map-like containers also
-    support efficient iteration through the keys in sorted order.  Map-like
-    containers are the most expensive sort, only use them if you need one of
-    these capabilities.</li>
-
-<li>a <a href="#ds_set">set-like</a> container if you need to put a bunch of
-    stuff into a container that automatically eliminates duplicates.  Some
-    set-like containers support efficient iteration through the elements in
-    sorted order.  Set-like containers are more expensive than sequential
-    containers.
-</li>
-
-<li>a <a href="#ds_sequential">sequential</a> container provides
-    the most efficient way to add elements and keeps track of the order they are
-    added to the collection.  They permit duplicates and support efficient
-    iteration, but do not support efficient look-up based on a key.
-</li>
-
-<li>a <a href="#ds_string">string</a> container is a specialized sequential
-    container or reference structure that is used for character or byte
-    arrays.</li>
-
-<li>a <a href="#ds_bit">bit</a> container provides an efficient way to store and
-    perform set operations on sets of numeric id's, while automatically
-    eliminating duplicates.  Bit containers require a maximum of 1 bit for each
-    identifier you want to store.
-</li>
-</ul>
-
-<p>
-Once the proper category of container is determined, you can fine tune the
-memory use, constant factors, and cache behaviors of access by intelligently
-picking a member of the category.  Note that constant factors and cache behavior
-can be a big deal.  If you have a vector that usually only contains a few
-elements (but could contain many), for example, it's much better to use
-<a href="#dss_smallvector">SmallVector</a> than <a href="#dss_vector">vector</a>
-.  Doing so avoids (relatively) expensive malloc/free calls, which dwarf the
-cost of adding the elements to the container. </p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="ds_sequential">Sequential Containers (std::vector, std::list, etc)</a>
-</div>
-
-<div class="doc_text">
-There are a variety of sequential containers available for you, based on your
-needs.  Pick the first in this section that will do what you want.
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="dss_fixedarrays">Fixed Size Arrays</a>
-</div>
-
-<div class="doc_text">
-<p>Fixed size arrays are very simple and very fast.  They are good if you know
-exactly how many elements you have, or you have a (low) upper bound on how many
-you have.</p>
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="dss_heaparrays">Heap Allocated Arrays</a>
-</div>
-
-<div class="doc_text">
-<p>Heap allocated arrays (new[] + delete[]) are also simple.  They are good if
-the number of elements is variable, if you know how many elements you will need
-before the array is allocated, and if the array is usually large (if not,
-consider a <a href="#dss_smallvector">SmallVector</a>).  The cost of a heap
-allocated array is the cost of the new/delete (aka malloc/free).  Also note that
-if you are allocating an array of a type with a constructor, the constructor and
-destructors will be run for every element in the array (re-sizable vectors only
-construct those elements actually used).</p>
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="dss_smallvector">"llvm/ADT/SmallVector.h"</a>
-</div>
-
-<div class="doc_text">
-<p><tt>SmallVector&lt;Type, N&gt;</tt> is a simple class that looks and smells
-just like <tt>vector&lt;Type&gt;</tt>:
-it supports efficient iteration, lays out elements in memory order (so you can
-do pointer arithmetic between elements), supports efficient push_back/pop_back
-operations, supports efficient random access to its elements, etc.</p>
-
-<p>The advantage of SmallVector is that it allocates space for
-some number of elements (N) <b>in the object itself</b>.  Because of this, if
-the SmallVector is dynamically smaller than N, no malloc is performed.  This can
-be a big win in cases where the malloc/free call is far more expensive than the
-code that fiddles around with the elements.</p>
-
-<p>This is good for vectors that are "usually small" (e.g. the number of
-predecessors/successors of a block is usually less than 8).  On the other hand,
-this makes the size of the SmallVector itself large, so you don't want to
-allocate lots of them (doing so will waste a lot of space).  As such,
-SmallVectors are most useful when on the stack.</p>
-
-<p>SmallVector also provides a nice portable and efficient replacement for
-<tt>alloca</tt>.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="dss_vector">&lt;vector&gt;</a>
-</div>
-
-<div class="doc_text">
-<p>
-std::vector is well loved and respected.  It is useful when SmallVector isn't:
-when the size of the vector is often large (thus the small optimization will
-rarely be a benefit) or if you will be allocating many instances of the vector
-itself (which would waste space for elements that aren't in the container).
-vector is also useful when interfacing with code that expects vectors :).
-</p>
-
-<p>One worthwhile note about std::vector: avoid code like this:</p>
-
-<div class="doc_code">
-<pre>
-for ( ... ) {
-   std::vector&lt;foo&gt; V;
-   use V;
-}
-</pre>
-</div>
-
-<p>Instead, write this as:</p>
-
-<div class="doc_code">
-<pre>
-std::vector&lt;foo&gt; V;
-for ( ... ) {
-   use V;
-   V.clear();
-}
-</pre>
-</div>
-
-<p>Doing so will save (at least) one heap allocation and free per iteration of
-the loop.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="dss_deque">&lt;deque&gt;</a>
-</div>
-
-<div class="doc_text">
-<p>std::deque is, in some senses, a generalized version of std::vector.  Like
-std::vector, it provides constant time random access and other similar
-properties, but it also provides efficient access to the front of the list.  It
-does not guarantee continuity of elements within memory.</p>
-
-<p>In exchange for this extra flexibility, std::deque has significantly higher
-constant factor costs than std::vector.  If possible, use std::vector or
-something cheaper.</p>
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="dss_list">&lt;list&gt;</a>
-</div>
-
-<div class="doc_text">
-<p>std::list is an extremely inefficient class that is rarely useful.
-It performs a heap allocation for every element inserted into it, thus having an
-extremely high constant factor, particularly for small data types.  std::list
-also only supports bidirectional iteration, not random access iteration.</p>
-
-<p>In exchange for this high cost, std::list supports efficient access to both
-ends of the list (like std::deque, but unlike std::vector or SmallVector).  In
-addition, the iterator invalidation characteristics of std::list are stronger
-than that of a vector class: inserting or removing an element into the list does
-not invalidate iterator or pointers to other elements in the list.</p>
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="dss_ilist">llvm/ADT/ilist.h</a>
-</div>
-
-<div class="doc_text">
-<p><tt>ilist&lt;T&gt;</tt> implements an 'intrusive' doubly-linked list.  It is
-intrusive, because it requires the element to store and provide access to the
-prev/next pointers for the list.</p>
-
-<p><tt>ilist</tt> has the same drawbacks as <tt>std::list</tt>, and additionally
-requires an <tt>ilist_traits</tt> implementation for the element type, but it
-provides some novel characteristics.  In particular, it can efficiently store
-polymorphic objects, the traits class is informed when an element is inserted or
-removed from the list, and <tt>ilist</tt>s are guaranteed to support a
-constant-time splice operation.</p>
-
-<p>These properties are exactly what we want for things like
-<tt>Instruction</tt>s and basic blocks, which is why these are implemented with
-<tt>ilist</tt>s.</p>
-
-Related classes of interest are explained in the following subsections:
-    <ul>
-      <li><a href="#dss_ilist_traits">ilist_traits</a></li>
-      <li><a href="#dss_iplist">iplist</a></li>
-      <li><a href="#dss_ilist_node">llvm/ADT/ilist_node.h</a></li>
-      <li><a href="#dss_ilist_sentinel">Sentinels</a></li>
-    </ul>
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="dss_ilist_traits">ilist_traits</a>
-</div>
-
-<div class="doc_text">
-<p><tt>ilist_traits&lt;T&gt;</tt> is <tt>ilist&lt;T&gt;</tt>'s customization
-mechanism. <tt>iplist&lt;T&gt;</tt> (and consequently <tt>ilist&lt;T&gt;</tt>)
-publicly derive from this traits class.</p>
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="dss_iplist">iplist</a>
-</div>
-
-<div class="doc_text">
-<p><tt>iplist&lt;T&gt;</tt> is <tt>ilist&lt;T&gt;</tt>'s base and as such
-supports a slightly narrower interface. Notably, inserters from
-<tt>T&amp;</tt> are absent.</p>
-
-<p><tt>ilist_traits&lt;T&gt;</tt> is a public base of this class and can be
-used for a wide variety of customizations.</p>
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="dss_ilist_node">llvm/ADT/ilist_node.h</a>
-</div>
-
-<div class="doc_text">
-<p><tt>ilist_node&lt;T&gt;</tt> implements a the forward and backward links
-that are expected by the <tt>ilist&lt;T&gt;</tt> (and analogous containers)
-in the default manner.</p>
-
-<p><tt>ilist_node&lt;T&gt;</tt>s are meant to be embedded in the node type
-<tt>T</tt>, usually <tt>T</tt> publicly derives from
-<tt>ilist_node&lt;T&gt;</tt>.</p>
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="dss_ilist_sentinel">Sentinels</a>
-</div>
-
-<div class="doc_text">
-<p><tt>ilist</tt>s have another speciality that must be considered. To be a good
-citizen in the C++ ecosystem, it needs to support the standard container
-operations, such as <tt>begin</tt> and <tt>end</tt> iterators, etc. Also, the
-<tt>operator--</tt> must work correctly on the <tt>end</tt> iterator in the
-case of non-empty <tt>ilist</tt>s.</p>
-
-<p>The only sensible solution to this problem is to allocate a so-called
-<i>sentinel</i> along with the intrusive list, which serves as the <tt>end</tt>
-iterator, providing the back-link to the last element. However conforming to the
-C++ convention it is illegal to <tt>operator++</tt> beyond the sentinel and it
-also must not be dereferenced.</p>
-
-<p>These constraints allow for some implementation freedom to the <tt>ilist</tt>
-how to allocate and store the sentinel. The corresponding policy is dictated
-by <tt>ilist_traits&lt;T&gt;</tt>. By default a <tt>T</tt> gets heap-allocated
-whenever the need for a sentinel arises.</p>
-
-<p>While the default policy is sufficient in most cases, it may break down when
-<tt>T</tt> does not provide a default constructor. Also, in the case of many
-instances of <tt>ilist</tt>s, the memory overhead of the associated sentinels
-is wasted. To alleviate the situation with numerous and voluminous
-<tt>T</tt>-sentinels, sometimes a trick is employed, leading to <i>ghostly
-sentinels</i>.</p>
-
-<p>Ghostly sentinels are obtained by specially-crafted <tt>ilist_traits&lt;T&gt;</tt>
-which superpose the sentinel with the <tt>ilist</tt> instance in memory. Pointer
-arithmetic is used to obtain the sentinel, which is relative to the
-<tt>ilist</tt>'s <tt>this</tt> pointer. The <tt>ilist</tt> is augmented by an
-extra pointer, which serves as the back-link of the sentinel. This is the only
-field in the ghostly sentinel which can be legally accessed.</p>
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="dss_other">Other Sequential Container options</a>
-</div>
-
-<div class="doc_text">
-<p>Other STL containers are available, such as std::string.</p>
-
-<p>There are also various STL adapter classes such as std::queue,
-std::priority_queue, std::stack, etc.  These provide simplified access to an
-underlying container but don't affect the cost of the container itself.</p>
-
-</div>
-
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="ds_set">Set-Like Containers (std::set, SmallSet, SetVector, etc)</a>
-</div>
-
-<div class="doc_text">
-
-<p>Set-like containers are useful when you need to canonicalize multiple values
-into a single representation.  There are several different choices for how to do
-this, providing various trade-offs.</p>
-
-</div>
-
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="dss_sortedvectorset">A sorted 'vector'</a>
-</div>
-
-<div class="doc_text">
-
-<p>If you intend to insert a lot of elements, then do a lot of queries, a
-great approach is to use a vector (or other sequential container) with
-std::sort+std::unique to remove duplicates.  This approach works really well if
-your usage pattern has these two distinct phases (insert then query), and can be
-coupled with a good choice of <a href="#ds_sequential">sequential container</a>.
-</p>
-
-<p>
-This combination provides the several nice properties: the result data is
-contiguous in memory (good for cache locality), has few allocations, is easy to
-address (iterators in the final vector are just indices or pointers), and can be
-efficiently queried with a standard binary or radix search.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="dss_smallset">"llvm/ADT/SmallSet.h"</a>
-</div>
-
-<div class="doc_text">
-
-<p>If you have a set-like data structure that is usually small and whose elements
-are reasonably small, a <tt>SmallSet&lt;Type, N&gt;</tt> is a good choice.  This set
-has space for N elements in place (thus, if the set is dynamically smaller than
-N, no malloc traffic is required) and accesses them with a simple linear search.
-When the set grows beyond 'N' elements, it allocates a more expensive representation that
-guarantees efficient access (for most types, it falls back to std::set, but for
-pointers it uses something far better, <a
-href="#dss_smallptrset">SmallPtrSet</a>).</p>
-
-<p>The magic of this class is that it handles small sets extremely efficiently,
-but gracefully handles extremely large sets without loss of efficiency.  The
-drawback is that the interface is quite small: it supports insertion, queries
-and erasing, but does not support iteration.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="dss_smallptrset">"llvm/ADT/SmallPtrSet.h"</a>
-</div>
-
-<div class="doc_text">
-
-<p>SmallPtrSet has all the advantages of SmallSet (and a SmallSet of pointers is 
-transparently implemented with a SmallPtrSet), but also supports iterators.  If
-more than 'N' insertions are performed, a single quadratically
-probed hash table is allocated and grows as needed, providing extremely
-efficient access (constant time insertion/deleting/queries with low constant
-factors) and is very stingy with malloc traffic.</p>
-
-<p>Note that, unlike std::set, the iterators of SmallPtrSet are invalidated
-whenever an insertion occurs.  Also, the values visited by the iterators are not
-visited in sorted order.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="dss_denseset">"llvm/ADT/DenseSet.h"</a>
-</div>
-
-<div class="doc_text">
-
-<p>
-DenseSet is a simple quadratically probed hash table.  It excels at supporting
-small values: it uses a single allocation to hold all of the pairs that
-are currently inserted in the set.  DenseSet is a great way to unique small
-values that are not simple pointers (use <a 
-href="#dss_smallptrset">SmallPtrSet</a> for pointers).  Note that DenseSet has
-the same requirements for the value type that <a 
-href="#dss_densemap">DenseMap</a> has.
-</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="dss_FoldingSet">"llvm/ADT/FoldingSet.h"</a>
-</div>
-
-<div class="doc_text">
-
-<p>
-FoldingSet is an aggregate class that is really good at uniquing
-expensive-to-create or polymorphic objects.  It is a combination of a chained
-hash table with intrusive links (uniqued objects are required to inherit from
-FoldingSetNode) that uses <a href="#dss_smallvector">SmallVector</a> as part of
-its ID process.</p>
-
-<p>Consider a case where you want to implement a "getOrCreateFoo" method for
-a complex object (for example, a node in the code generator).  The client has a
-description of *what* it wants to generate (it knows the opcode and all the
-operands), but we don't want to 'new' a node, then try inserting it into a set
-only to find out it already exists, at which point we would have to delete it
-and return the node that already exists.
-</p>
-
-<p>To support this style of client, FoldingSet perform a query with a
-FoldingSetNodeID (which wraps SmallVector) that can be used to describe the
-element that we want to query for.  The query either returns the element
-matching the ID or it returns an opaque ID that indicates where insertion should
-take place.  Construction of the ID usually does not require heap traffic.</p>
-
-<p>Because FoldingSet uses intrusive links, it can support polymorphic objects
-in the set (for example, you can have SDNode instances mixed with LoadSDNodes).
-Because the elements are individually allocated, pointers to the elements are
-stable: inserting or removing elements does not invalidate any pointers to other
-elements.
-</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="dss_set">&lt;set&gt;</a>
-</div>
-
-<div class="doc_text">
-
-<p><tt>std::set</tt> is a reasonable all-around set class, which is decent at
-many things but great at nothing.  std::set allocates memory for each element
-inserted (thus it is very malloc intensive) and typically stores three pointers
-per element in the set (thus adding a large amount of per-element space
-overhead).  It offers guaranteed log(n) performance, which is not particularly
-fast from a complexity standpoint (particularly if the elements of the set are
-expensive to compare, like strings), and has extremely high constant factors for
-lookup, insertion and removal.</p>
-
-<p>The advantages of std::set are that its iterators are stable (deleting or
-inserting an element from the set does not affect iterators or pointers to other
-elements) and that iteration over the set is guaranteed to be in sorted order.
-If the elements in the set are large, then the relative overhead of the pointers
-and malloc traffic is not a big deal, but if the elements of the set are small,
-std::set is almost never a good choice.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="dss_setvector">"llvm/ADT/SetVector.h"</a>
-</div>
-
-<div class="doc_text">
-<p>LLVM's SetVector&lt;Type&gt; is an adapter class that combines your choice of
-a set-like container along with a <a href="#ds_sequential">Sequential 
-Container</a>.  The important property
-that this provides is efficient insertion with uniquing (duplicate elements are
-ignored) with iteration support.  It implements this by inserting elements into
-both a set-like container and the sequential container, using the set-like
-container for uniquing and the sequential container for iteration.
-</p>
-
-<p>The difference between SetVector and other sets is that the order of
-iteration is guaranteed to match the order of insertion into the SetVector.
-This property is really important for things like sets of pointers.  Because
-pointer values are non-deterministic (e.g. vary across runs of the program on
-different machines), iterating over the pointers in the set will
-not be in a well-defined order.</p>
-
-<p>
-The drawback of SetVector is that it requires twice as much space as a normal
-set and has the sum of constant factors from the set-like container and the 
-sequential container that it uses.  Use it *only* if you need to iterate over 
-the elements in a deterministic order.  SetVector is also expensive to delete
-elements out of (linear time), unless you use it's "pop_back" method, which is
-faster.
-</p>
-
-<p>SetVector is an adapter class that defaults to using std::vector and std::set
-for the underlying containers, so it is quite expensive.  However,
-<tt>"llvm/ADT/SetVector.h"</tt> also provides a SmallSetVector class, which
-defaults to using a SmallVector and SmallSet of a specified size.  If you use
-this, and if your sets are dynamically smaller than N, you will save a lot of 
-heap traffic.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="dss_uniquevector">"llvm/ADT/UniqueVector.h"</a>
-</div>
-
-<div class="doc_text">
-
-<p>
-UniqueVector is similar to <a href="#dss_setvector">SetVector</a>, but it
-retains a unique ID for each element inserted into the set.  It internally
-contains a map and a vector, and it assigns a unique ID for each value inserted
-into the set.</p>
-
-<p>UniqueVector is very expensive: its cost is the sum of the cost of
-maintaining both the map and vector, it has high complexity, high constant
-factors, and produces a lot of malloc traffic.  It should be avoided.</p>
-
-</div>
-
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="dss_otherset">Other Set-Like Container Options</a>
-</div>
-
-<div class="doc_text">
-
-<p>
-The STL provides several other options, such as std::multiset and the various 
-"hash_set" like containers (whether from C++ TR1 or from the SGI library). We
-never use hash_set and unordered_set because they are generally very expensive 
-(each insertion requires a malloc) and very non-portable.
-</p>
-
-<p>std::multiset is useful if you're not interested in elimination of
-duplicates, but has all the drawbacks of std::set.  A sorted vector (where you 
-don't delete duplicate entries) or some other approach is almost always
-better.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="ds_map">Map-Like Containers (std::map, DenseMap, etc)</a>
-</div>
-
-<div class="doc_text">
-Map-like containers are useful when you want to associate data to a key.  As
-usual, there are a lot of different ways to do this. :)
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="dss_sortedvectormap">A sorted 'vector'</a>
-</div>
-
-<div class="doc_text">
-
-<p>
-If your usage pattern follows a strict insert-then-query approach, you can
-trivially use the same approach as <a href="#dss_sortedvectorset">sorted vectors
-for set-like containers</a>.  The only difference is that your query function
-(which uses std::lower_bound to get efficient log(n) lookup) should only compare
-the key, not both the key and value.  This yields the same advantages as sorted
-vectors for sets.
-</p>
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="dss_stringmap">"llvm/ADT/StringMap.h"</a>
-</div>
-
-<div class="doc_text">
-
-<p>
-Strings are commonly used as keys in maps, and they are difficult to support
-efficiently: they are variable length, inefficient to hash and compare when
-long, expensive to copy, etc.  StringMap is a specialized container designed to
-cope with these issues.  It supports mapping an arbitrary range of bytes to an
-arbitrary other object.</p>
-
-<p>The StringMap implementation uses a quadratically-probed hash table, where
-the buckets store a pointer to the heap allocated entries (and some other
-stuff).  The entries in the map must be heap allocated because the strings are
-variable length.  The string data (key) and the element object (value) are
-stored in the same allocation with the string data immediately after the element
-object.  This container guarantees the "<tt>(char*)(&amp;Value+1)</tt>" points
-to the key string for a value.</p>
-
-<p>The StringMap is very fast for several reasons: quadratic probing is very
-cache efficient for lookups, the hash value of strings in buckets is not
-recomputed when lookup up an element, StringMap rarely has to touch the
-memory for unrelated objects when looking up a value (even when hash collisions
-happen), hash table growth does not recompute the hash values for strings
-already in the table, and each pair in the map is store in a single allocation
-(the string data is stored in the same allocation as the Value of a pair).</p>
-
-<p>StringMap also provides query methods that take byte ranges, so it only ever
-copies a string if a value is inserted into the table.</p>
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="dss_indexedmap">"llvm/ADT/IndexedMap.h"</a>
-</div>
-
-<div class="doc_text">
-<p>
-IndexedMap is a specialized container for mapping small dense integers (or
-values that can be mapped to small dense integers) to some other type.  It is
-internally implemented as a vector with a mapping function that maps the keys to
-the dense integer range.
-</p>
-
-<p>
-This is useful for cases like virtual registers in the LLVM code generator: they
-have a dense mapping that is offset by a compile-time constant (the first
-virtual register ID).</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="dss_densemap">"llvm/ADT/DenseMap.h"</a>
-</div>
-
-<div class="doc_text">
-
-<p>
-DenseMap is a simple quadratically probed hash table.  It excels at supporting
-small keys and values: it uses a single allocation to hold all of the pairs that
-are currently inserted in the map.  DenseMap is a great way to map pointers to
-pointers, or map other small types to each other.
-</p>
-
-<p>
-There are several aspects of DenseMap that you should be aware of, however.  The
-iterators in a densemap are invalidated whenever an insertion occurs, unlike
-map.  Also, because DenseMap allocates space for a large number of key/value
-pairs (it starts with 64 by default), it will waste a lot of space if your keys
-or values are large.  Finally, you must implement a partial specialization of
-DenseMapInfo for the key that you want, if it isn't already supported.  This
-is required to tell DenseMap about two special marker values (which can never be
-inserted into the map) that it needs internally.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="dss_valuemap">"llvm/ADT/ValueMap.h"</a>
-</div>
-
-<div class="doc_text">
-
-<p>
-ValueMap is a wrapper around a <a href="#dss_densemap">DenseMap</a> mapping
-Value*s (or subclasses) to another type.  When a Value is deleted or RAUW'ed,
-ValueMap will update itself so the new version of the key is mapped to the same
-value, just as if the key were a WeakVH.  You can configure exactly how this
-happens, and what else happens on these two events, by passing
-a <code>Config</code> parameter to the ValueMap template.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="dss_map">&lt;map&gt;</a>
-</div>
-
-<div class="doc_text">
-
-<p>
-std::map has similar characteristics to <a href="#dss_set">std::set</a>: it uses
-a single allocation per pair inserted into the map, it offers log(n) lookup with
-an extremely large constant factor, imposes a space penalty of 3 pointers per
-pair in the map, etc.</p>
-
-<p>std::map is most useful when your keys or values are very large, if you need
-to iterate over the collection in sorted order, or if you need stable iterators
-into the map (i.e. they don't get invalidated if an insertion or deletion of
-another element takes place).</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="dss_othermap">Other Map-Like Container Options</a>
-</div>
-
-<div class="doc_text">
-
-<p>
-The STL provides several other options, such as std::multimap and the various 
-"hash_map" like containers (whether from C++ TR1 or from the SGI library). We
-never use hash_set and unordered_set because they are generally very expensive 
-(each insertion requires a malloc) and very non-portable.</p>
-
-<p>std::multimap is useful if you want to map a key to multiple values, but has
-all the drawbacks of std::map.  A sorted vector or some other approach is almost
-always better.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="ds_string">String-like containers</a>
-</div>
-
-<div class="doc_text">
-
-<p>
-TODO: const char* vs stringref vs smallstring vs std::string.  Describe twine,
-xref to #string_apis.
-</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="ds_bit">Bit storage containers (BitVector, SparseBitVector)</a>
-</div>
-
-<div class="doc_text">
-<p>Unlike the other containers, there are only two bit storage containers, and 
-choosing when to use each is relatively straightforward.</p>
-
-<p>One additional option is 
-<tt>std::vector&lt;bool&gt;</tt>: we discourage its use for two reasons 1) the
-implementation in many common compilers (e.g. commonly available versions of 
-GCC) is extremely inefficient and 2) the C++ standards committee is likely to
-deprecate this container and/or change it significantly somehow.  In any case,
-please don't use it.</p>
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="dss_bitvector">BitVector</a>
-</div>
-
-<div class="doc_text">
-<p> The BitVector container provides a dynamic size set of bits for manipulation.
-It supports individual bit setting/testing, as well as set operations.  The set
-operations take time O(size of bitvector), but operations are performed one word
-at a time, instead of one bit at a time.  This makes the BitVector very fast for
-set operations compared to other containers.  Use the BitVector when you expect
-the number of set bits to be high (IE a dense set).
-</p>
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="dss_smallbitvector">SmallBitVector</a>
-</div>
-
-<div class="doc_text">
-<p> The SmallBitVector container provides the same interface as BitVector, but
-it is optimized for the case where only a small number of bits, less than
-25 or so, are needed. It also transparently supports larger bit counts, but
-slightly less efficiently than a plain BitVector, so SmallBitVector should
-only be used when larger counts are rare.
-</p>
-
-<p>
-At this time, SmallBitVector does not support set operations (and, or, xor),
-and its operator[] does not provide an assignable lvalue.
-</p>
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="dss_sparsebitvector">SparseBitVector</a>
-</div>
-
-<div class="doc_text">
-<p> The SparseBitVector container is much like BitVector, with one major
-difference: Only the bits that are set, are stored.  This makes the
-SparseBitVector much more space efficient than BitVector when the set is sparse,
-as well as making set operations O(number of set bits) instead of O(size of
-universe).  The downside to the SparseBitVector is that setting and testing of random bits is O(N), and on large SparseBitVectors, this can be slower than BitVector. In our implementation, setting or testing bits in sorted order
-(either forwards or reverse) is O(1) worst case.  Testing and setting bits within 128 bits (depends on size) of the current bit is also O(1).  As a general statement, testing/setting bits in a SparseBitVector is O(distance away from last set bit).
-</p>
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="common">Helpful Hints for Common Operations</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>This section describes how to perform some very simple transformations of
-LLVM code.  This is meant to give examples of common idioms used, showing the
-practical side of LLVM transformations.  <p> Because this is a "how-to" section,
-you should also read about the main classes that you will be working with.  The
-<a href="#coreclasses">Core LLVM Class Hierarchy Reference</a> contains details
-and descriptions of the main classes that you should know about.</p>
-
-</div>
-
-<!-- NOTE: this section should be heavy on example code -->
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="inspection">Basic Inspection and Traversal Routines</a>
-</div>
-
-<div class="doc_text">
-
-<p>The LLVM compiler infrastructure have many different data structures that may
-be traversed.  Following the example of the C++ standard template library, the
-techniques used to traverse these various data structures are all basically the
-same.  For a enumerable sequence of values, the <tt>XXXbegin()</tt> function (or
-method) returns an iterator to the start of the sequence, the <tt>XXXend()</tt>
-function returns an iterator pointing to one past the last valid element of the
-sequence, and there is some <tt>XXXiterator</tt> data type that is common
-between the two operations.</p>
-
-<p>Because the pattern for iteration is common across many different aspects of
-the program representation, the standard template library algorithms may be used
-on them, and it is easier to remember how to iterate. First we show a few common
-examples of the data structures that need to be traversed.  Other data
-structures are traversed in very similar ways.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="iterate_function">Iterating over the </a><a
-  href="#BasicBlock"><tt>BasicBlock</tt></a>s in a <a
-  href="#Function"><tt>Function</tt></a>
-</div>
-
-<div class="doc_text">
-
-<p>It's quite common to have a <tt>Function</tt> instance that you'd like to
-transform in some way; in particular, you'd like to manipulate its
-<tt>BasicBlock</tt>s.  To facilitate this, you'll need to iterate over all of
-the <tt>BasicBlock</tt>s that constitute the <tt>Function</tt>. The following is
-an example that prints the name of a <tt>BasicBlock</tt> and the number of
-<tt>Instruction</tt>s it contains:</p>
-
-<div class="doc_code">
-<pre>
-// <i>func is a pointer to a Function instance</i>
-for (Function::iterator i = func-&gt;begin(), e = func-&gt;end(); i != e; ++i)
-  // <i>Print out the name of the basic block if it has one, and then the</i>
-  // <i>number of instructions that it contains</i>
-  errs() &lt;&lt; "Basic block (name=" &lt;&lt; i-&gt;getName() &lt;&lt; ") has "
-             &lt;&lt; i-&gt;size() &lt;&lt; " instructions.\n";
-</pre>
-</div>
-
-<p>Note that i can be used as if it were a pointer for the purposes of
-invoking member functions of the <tt>Instruction</tt> class.  This is
-because the indirection operator is overloaded for the iterator
-classes.  In the above code, the expression <tt>i-&gt;size()</tt> is
-exactly equivalent to <tt>(*i).size()</tt> just like you'd expect.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="iterate_basicblock">Iterating over the </a><a
-  href="#Instruction"><tt>Instruction</tt></a>s in a <a
-  href="#BasicBlock"><tt>BasicBlock</tt></a>
-</div>
-
-<div class="doc_text">
-
-<p>Just like when dealing with <tt>BasicBlock</tt>s in <tt>Function</tt>s, it's
-easy to iterate over the individual instructions that make up
-<tt>BasicBlock</tt>s. Here's a code snippet that prints out each instruction in
-a <tt>BasicBlock</tt>:</p>
-
-<div class="doc_code">
-<pre>
-// <i>blk is a pointer to a BasicBlock instance</i>
-for (BasicBlock::iterator i = blk-&gt;begin(), e = blk-&gt;end(); i != e; ++i)
-   // <i>The next statement works since operator&lt;&lt;(ostream&amp;,...)</i>
-   // <i>is overloaded for Instruction&amp;</i>
-   errs() &lt;&lt; *i &lt;&lt; "\n";
-</pre>
-</div>
-
-<p>However, this isn't really the best way to print out the contents of a
-<tt>BasicBlock</tt>!  Since the ostream operators are overloaded for virtually
-anything you'll care about, you could have just invoked the print routine on the
-basic block itself: <tt>errs() &lt;&lt; *blk &lt;&lt; "\n";</tt>.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="iterate_institer">Iterating over the </a><a
-  href="#Instruction"><tt>Instruction</tt></a>s in a <a
-  href="#Function"><tt>Function</tt></a>
-</div>
-
-<div class="doc_text">
-
-<p>If you're finding that you commonly iterate over a <tt>Function</tt>'s
-<tt>BasicBlock</tt>s and then that <tt>BasicBlock</tt>'s <tt>Instruction</tt>s,
-<tt>InstIterator</tt> should be used instead. You'll need to include <a
-href="/doxygen/InstIterator_8h-source.html"><tt>llvm/Support/InstIterator.h</tt></a>,
-and then instantiate <tt>InstIterator</tt>s explicitly in your code.  Here's a
-small example that shows how to dump all instructions in a function to the standard error stream:<p>
-
-<div class="doc_code">
-<pre>
-#include "<a href="/doxygen/InstIterator_8h-source.html">llvm/Support/InstIterator.h</a>"
-
-// <i>F is a pointer to a Function instance</i>
-for (inst_iterator I = inst_begin(F), E = inst_end(F); I != E; ++I)
-  errs() &lt;&lt; *I &lt;&lt; "\n";
-</pre>
-</div>
-
-<p>Easy, isn't it?  You can also use <tt>InstIterator</tt>s to fill a
-work list with its initial contents.  For example, if you wanted to
-initialize a work list to contain all instructions in a <tt>Function</tt>
-F, all you would need to do is something like:</p>
-
-<div class="doc_code">
-<pre>
-std::set&lt;Instruction*&gt; worklist;
-// or better yet, SmallPtrSet&lt;Instruction*, 64&gt; worklist;
-
-for (inst_iterator I = inst_begin(F), E = inst_end(F); I != E; ++I)
-   worklist.insert(&amp;*I);
-</pre>
-</div>
-
-<p>The STL set <tt>worklist</tt> would now contain all instructions in the
-<tt>Function</tt> pointed to by F.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="iterate_convert">Turning an iterator into a class pointer (and
-  vice-versa)</a>
-</div>
-
-<div class="doc_text">
-
-<p>Sometimes, it'll be useful to grab a reference (or pointer) to a class
-instance when all you've got at hand is an iterator.  Well, extracting
-a reference or a pointer from an iterator is very straight-forward.
-Assuming that <tt>i</tt> is a <tt>BasicBlock::iterator</tt> and <tt>j</tt>
-is a <tt>BasicBlock::const_iterator</tt>:</p>
-
-<div class="doc_code">
-<pre>
-Instruction&amp; inst = *i;   // <i>Grab reference to instruction reference</i>
-Instruction* pinst = &amp;*i; // <i>Grab pointer to instruction reference</i>
-const Instruction&amp; inst = *j;
-</pre>
-</div>
-
-<p>However, the iterators you'll be working with in the LLVM framework are
-special: they will automatically convert to a ptr-to-instance type whenever they
-need to.  Instead of dereferencing the iterator and then taking the address of
-the result, you can simply assign the iterator to the proper pointer type and
-you get the dereference and address-of operation as a result of the assignment
-(behind the scenes, this is a result of overloading casting mechanisms).  Thus
-the last line of the last example,</p>
-
-<div class="doc_code">
-<pre>
-Instruction *pinst = &amp;*i;
-</pre>
-</div>
-
-<p>is semantically equivalent to</p>
-
-<div class="doc_code">
-<pre>
-Instruction *pinst = i;
-</pre>
-</div>
-
-<p>It's also possible to turn a class pointer into the corresponding iterator,
-and this is a constant time operation (very efficient).  The following code
-snippet illustrates use of the conversion constructors provided by LLVM
-iterators.  By using these, you can explicitly grab the iterator of something
-without actually obtaining it via iteration over some structure:</p>
-
-<div class="doc_code">
-<pre>
-void printNextInstruction(Instruction* inst) {
-  BasicBlock::iterator it(inst);
-  ++it; // <i>After this line, it refers to the instruction after *inst</i>
-  if (it != inst-&gt;getParent()-&gt;end()) errs() &lt;&lt; *it &lt;&lt; "\n";
-}
-</pre>
-</div>
-
-</div>
-
-<!--_______________________________________________________________________-->
-<div class="doc_subsubsection">
-  <a name="iterate_complex">Finding call sites: a slightly more complex
-  example</a>
-</div>
-
-<div class="doc_text">
-
-<p>Say that you're writing a FunctionPass and would like to count all the
-locations in the entire module (that is, across every <tt>Function</tt>) where a
-certain function (i.e., some <tt>Function</tt>*) is already in scope.  As you'll
-learn later, you may want to use an <tt>InstVisitor</tt> to accomplish this in a
-much more straight-forward manner, but this example will allow us to explore how
-you'd do it if you didn't have <tt>InstVisitor</tt> around. In pseudo-code, this
-is what we want to do:</p>
-
-<div class="doc_code">
-<pre>
-initialize callCounter to zero
-for each Function f in the Module
-  for each BasicBlock b in f
-    for each Instruction i in b
-      if (i is a CallInst and calls the given function)
-        increment callCounter
-</pre>
-</div>
-
-<p>And the actual code is (remember, because we're writing a
-<tt>FunctionPass</tt>, our <tt>FunctionPass</tt>-derived class simply has to
-override the <tt>runOnFunction</tt> method):</p>
-
-<div class="doc_code">
-<pre>
-Function* targetFunc = ...;
-
-class OurFunctionPass : public FunctionPass {
-  public:
-    OurFunctionPass(): callCounter(0) { }
-
-    virtual runOnFunction(Function&amp; F) {
-      for (Function::iterator b = F.begin(), be = F.end(); b != be; ++b) {
-        for (BasicBlock::iterator i = b-&gt;begin(), ie = b-&gt;end(); i != ie; ++i) {
-          if (<a href="#CallInst">CallInst</a>* callInst = <a href="#isa">dyn_cast</a>&lt;<a
- href="#CallInst">CallInst</a>&gt;(&amp;*i)) {
-            // <i>We know we've encountered a call instruction, so we</i>
-            // <i>need to determine if it's a call to the</i>
-            // <i>function pointed to by m_func or not.</i>
-            if (callInst-&gt;getCalledFunction() == targetFunc)
-              ++callCounter;
-          }
-        }
-      }
-    }
-
-  private:
-    unsigned callCounter;
-};
-</pre>
-</div>
-
-</div>
-
-<!--_______________________________________________________________________-->
-<div class="doc_subsubsection">
-  <a name="calls_and_invokes">Treating calls and invokes the same way</a>
-</div>
-
-<div class="doc_text">
-
-<p>You may have noticed that the previous example was a bit oversimplified in
-that it did not deal with call sites generated by 'invoke' instructions. In
-this, and in other situations, you may find that you want to treat
-<tt>CallInst</tt>s and <tt>InvokeInst</tt>s the same way, even though their
-most-specific common base class is <tt>Instruction</tt>, which includes lots of
-less closely-related things. For these cases, LLVM provides a handy wrapper
-class called <a
-href="http://llvm.org/doxygen/classllvm_1_1CallSite.html"><tt>CallSite</tt></a>.
-It is essentially a wrapper around an <tt>Instruction</tt> pointer, with some
-methods that provide functionality common to <tt>CallInst</tt>s and
-<tt>InvokeInst</tt>s.</p>
-
-<p>This class has "value semantics": it should be passed by value, not by
-reference and it should not be dynamically allocated or deallocated using
-<tt>operator new</tt> or <tt>operator delete</tt>. It is efficiently copyable,
-assignable and constructable, with costs equivalents to that of a bare pointer.
-If you look at its definition, it has only a single pointer member.</p>
-
-</div>
-
-<!--_______________________________________________________________________-->
-<div class="doc_subsubsection">
-  <a name="iterate_chains">Iterating over def-use &amp; use-def chains</a>
-</div>
-
-<div class="doc_text">
-
-<p>Frequently, we might have an instance of the <a
-href="/doxygen/classllvm_1_1Value.html">Value Class</a> and we want to
-determine which <tt>User</tt>s use the <tt>Value</tt>.  The list of all
-<tt>User</tt>s of a particular <tt>Value</tt> is called a <i>def-use</i> chain.
-For example, let's say we have a <tt>Function*</tt> named <tt>F</tt> to a
-particular function <tt>foo</tt>. Finding all of the instructions that
-<i>use</i> <tt>foo</tt> is as simple as iterating over the <i>def-use</i> chain
-of <tt>F</tt>:</p>
-
-<div class="doc_code">
-<pre>
-Function *F = ...;
-
-for (Value::use_iterator i = F-&gt;use_begin(), e = F-&gt;use_end(); i != e; ++i)
-  if (Instruction *Inst = dyn_cast&lt;Instruction&gt;(*i)) {
-    errs() &lt;&lt; "F is used in instruction:\n";
-    errs() &lt;&lt; *Inst &lt;&lt; "\n";
-  }
-</pre>
-</div>
-
-<p>Alternately, it's common to have an instance of the <a
-href="/doxygen/classllvm_1_1User.html">User Class</a> and need to know what
-<tt>Value</tt>s are used by it.  The list of all <tt>Value</tt>s used by a
-<tt>User</tt> is known as a <i>use-def</i> chain.  Instances of class
-<tt>Instruction</tt> are common <tt>User</tt>s, so we might want to iterate over
-all of the values that a particular instruction uses (that is, the operands of
-the particular <tt>Instruction</tt>):</p>
-
-<div class="doc_code">
-<pre>
-Instruction *pi = ...;
-
-for (User::op_iterator i = pi-&gt;op_begin(), e = pi-&gt;op_end(); i != e; ++i) {
-  Value *v = *i;
-  // <i>...</i>
-}
-</pre>
-</div>
-
-<!--
-  def-use chains ("finding all users of"): Value::use_begin/use_end
-  use-def chains ("finding all values used"): User::op_begin/op_end [op=operand]
--->
-
-</div>
-
-<!--_______________________________________________________________________-->
-<div class="doc_subsubsection">
-  <a name="iterate_preds">Iterating over predecessors &amp;
-successors of blocks</a>
-</div>
-
-<div class="doc_text">
-
-<p>Iterating over the predecessors and successors of a block is quite easy
-with the routines defined in <tt>"llvm/Support/CFG.h"</tt>.  Just use code like
-this to iterate over all predecessors of BB:</p>
-
-<div class="doc_code">
-<pre>
-#include "llvm/Support/CFG.h"
-BasicBlock *BB = ...;
-
-for (pred_iterator PI = pred_begin(BB), E = pred_end(BB); PI != E; ++PI) {
-  BasicBlock *Pred = *PI;
-  // <i>...</i>
-}
-</pre>
-</div>
-
-<p>Similarly, to iterate over successors use
-succ_iterator/succ_begin/succ_end.</p>
-
-</div>
-
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="simplechanges">Making simple changes</a>
-</div>
-
-<div class="doc_text">
-
-<p>There are some primitive transformation operations present in the LLVM
-infrastructure that are worth knowing about.  When performing
-transformations, it's fairly common to manipulate the contents of basic
-blocks. This section describes some of the common methods for doing so
-and gives example code.</p>
-
-</div>
-
-<!--_______________________________________________________________________-->
-<div class="doc_subsubsection">
-  <a name="schanges_creating">Creating and inserting new
-  <tt>Instruction</tt>s</a>
-</div>
-
-<div class="doc_text">
-
-<p><i>Instantiating Instructions</i></p>
-
-<p>Creation of <tt>Instruction</tt>s is straight-forward: simply call the
-constructor for the kind of instruction to instantiate and provide the necessary
-parameters. For example, an <tt>AllocaInst</tt> only <i>requires</i> a
-(const-ptr-to) <tt>Type</tt>. Thus:</p> 
-
-<div class="doc_code">
-<pre>
-AllocaInst* ai = new AllocaInst(Type::Int32Ty);
-</pre>
-</div>
-
-<p>will create an <tt>AllocaInst</tt> instance that represents the allocation of
-one integer in the current stack frame, at run time. Each <tt>Instruction</tt>
-subclass is likely to have varying default parameters which change the semantics
-of the instruction, so refer to the <a
-href="/doxygen/classllvm_1_1Instruction.html">doxygen documentation for the subclass of
-Instruction</a> that you're interested in instantiating.</p>
-
-<p><i>Naming values</i></p>
-
-<p>It is very useful to name the values of instructions when you're able to, as
-this facilitates the debugging of your transformations.  If you end up looking
-at generated LLVM machine code, you definitely want to have logical names
-associated with the results of instructions!  By supplying a value for the
-<tt>Name</tt> (default) parameter of the <tt>Instruction</tt> constructor, you
-associate a logical name with the result of the instruction's execution at
-run time.  For example, say that I'm writing a transformation that dynamically
-allocates space for an integer on the stack, and that integer is going to be
-used as some kind of index by some other code.  To accomplish this, I place an
-<tt>AllocaInst</tt> at the first point in the first <tt>BasicBlock</tt> of some
-<tt>Function</tt>, and I'm intending to use it within the same
-<tt>Function</tt>. I might do:</p>
-
-<div class="doc_code">
-<pre>
-AllocaInst* pa = new AllocaInst(Type::Int32Ty, 0, "indexLoc");
-</pre>
-</div>
-
-<p>where <tt>indexLoc</tt> is now the logical name of the instruction's
-execution value, which is a pointer to an integer on the run time stack.</p>
-
-<p><i>Inserting instructions</i></p>
-
-<p>There are essentially two ways to insert an <tt>Instruction</tt>
-into an existing sequence of instructions that form a <tt>BasicBlock</tt>:</p>
-
-<ul>
-  <li>Insertion into an explicit instruction list
-
-    <p>Given a <tt>BasicBlock* pb</tt>, an <tt>Instruction* pi</tt> within that
-    <tt>BasicBlock</tt>, and a newly-created instruction we wish to insert
-    before <tt>*pi</tt>, we do the following: </p>
-
-<div class="doc_code">
-<pre>
-BasicBlock *pb = ...;
-Instruction *pi = ...;
-Instruction *newInst = new Instruction(...);
-
-pb-&gt;getInstList().insert(pi, newInst); // <i>Inserts newInst before pi in pb</i>
-</pre>
-</div>
-
-    <p>Appending to the end of a <tt>BasicBlock</tt> is so common that
-    the <tt>Instruction</tt> class and <tt>Instruction</tt>-derived
-    classes provide constructors which take a pointer to a
-    <tt>BasicBlock</tt> to be appended to. For example code that
-    looked like: </p>
-
-<div class="doc_code">
-<pre>
-BasicBlock *pb = ...;
-Instruction *newInst = new Instruction(...);
-
-pb-&gt;getInstList().push_back(newInst); // <i>Appends newInst to pb</i>
-</pre>
-</div>
-
-    <p>becomes: </p>
-
-<div class="doc_code">
-<pre>
-BasicBlock *pb = ...;
-Instruction *newInst = new Instruction(..., pb);
-</pre>
-</div>
-
-    <p>which is much cleaner, especially if you are creating
-    long instruction streams.</p></li>
-
-  <li>Insertion into an implicit instruction list
-
-    <p><tt>Instruction</tt> instances that are already in <tt>BasicBlock</tt>s
-    are implicitly associated with an existing instruction list: the instruction
-    list of the enclosing basic block. Thus, we could have accomplished the same
-    thing as the above code without being given a <tt>BasicBlock</tt> by doing:
-    </p>
-
-<div class="doc_code">
-<pre>
-Instruction *pi = ...;
-Instruction *newInst = new Instruction(...);
-
-pi-&gt;getParent()-&gt;getInstList().insert(pi, newInst);
-</pre>
-</div>
-
-    <p>In fact, this sequence of steps occurs so frequently that the
-    <tt>Instruction</tt> class and <tt>Instruction</tt>-derived classes provide
-    constructors which take (as a default parameter) a pointer to an
-    <tt>Instruction</tt> which the newly-created <tt>Instruction</tt> should
-    precede.  That is, <tt>Instruction</tt> constructors are capable of
-    inserting the newly-created instance into the <tt>BasicBlock</tt> of a
-    provided instruction, immediately before that instruction.  Using an
-    <tt>Instruction</tt> constructor with a <tt>insertBefore</tt> (default)
-    parameter, the above code becomes:</p>
-
-<div class="doc_code">
-<pre>
-Instruction* pi = ...;
-Instruction* newInst = new Instruction(..., pi);
-</pre>
-</div>
-
-    <p>which is much cleaner, especially if you're creating a lot of
-    instructions and adding them to <tt>BasicBlock</tt>s.</p></li>
-</ul>
-
-</div>
-
-<!--_______________________________________________________________________-->
-<div class="doc_subsubsection">
-  <a name="schanges_deleting">Deleting <tt>Instruction</tt>s</a>
-</div>
-
-<div class="doc_text">
-
-<p>Deleting an instruction from an existing sequence of instructions that form a
-<a href="#BasicBlock"><tt>BasicBlock</tt></a> is very straight-forward. First,
-you must have a pointer to the instruction that you wish to delete.  Second, you
-need to obtain the pointer to that instruction's basic block. You use the
-pointer to the basic block to get its list of instructions and then use the
-erase function to remove your instruction. For example:</p>
-
-<div class="doc_code">
-<pre>
-<a href="#Instruction">Instruction</a> *I = .. ;
-I-&gt;eraseFromParent();
-</pre>
-</div>
-
-</div>
-
-<!--_______________________________________________________________________-->
-<div class="doc_subsubsection">
-  <a name="schanges_replacing">Replacing an <tt>Instruction</tt> with another
-  <tt>Value</tt></a>
-</div>
-
-<div class="doc_text">
-
-<p><i>Replacing individual instructions</i></p>
-
-<p>Including "<a href="/doxygen/BasicBlockUtils_8h-source.html">llvm/Transforms/Utils/BasicBlockUtils.h</a>"
-permits use of two very useful replace functions: <tt>ReplaceInstWithValue</tt>
-and <tt>ReplaceInstWithInst</tt>.</p>
-
-<h4><a name="schanges_deleting">Deleting <tt>Instruction</tt>s</a></h4>
-
-<ul>
-  <li><tt>ReplaceInstWithValue</tt>
-
-    <p>This function replaces all uses of a given instruction with a value,
-    and then removes the original instruction. The following example
-    illustrates the replacement of the result of a particular
-    <tt>AllocaInst</tt> that allocates memory for a single integer with a null
-    pointer to an integer.</p>
-
-<div class="doc_code">
-<pre>
-AllocaInst* instToReplace = ...;
-BasicBlock::iterator ii(instToReplace);
-
-ReplaceInstWithValue(instToReplace-&gt;getParent()-&gt;getInstList(), ii,
-                     Constant::getNullValue(PointerType::getUnqual(Type::Int32Ty)));
-</pre></div></li>
-
-  <li><tt>ReplaceInstWithInst</tt> 
-
-    <p>This function replaces a particular instruction with another
-    instruction, inserting the new instruction into the basic block at the
-    location where the old instruction was, and replacing any uses of the old
-    instruction with the new instruction. The following example illustrates
-    the replacement of one <tt>AllocaInst</tt> with another.</p>
-
-<div class="doc_code">
-<pre>
-AllocaInst* instToReplace = ...;
-BasicBlock::iterator ii(instToReplace);
-
-ReplaceInstWithInst(instToReplace-&gt;getParent()-&gt;getInstList(), ii,
-                    new AllocaInst(Type::Int32Ty, 0, "ptrToReplacedInt"));
-</pre></div></li>
-</ul>
-
-<p><i>Replacing multiple uses of <tt>User</tt>s and <tt>Value</tt>s</i></p>
-
-<p>You can use <tt>Value::replaceAllUsesWith</tt> and
-<tt>User::replaceUsesOfWith</tt> to change more than one use at a time.  See the
-doxygen documentation for the <a href="/doxygen/classllvm_1_1Value.html">Value Class</a>
-and <a href="/doxygen/classllvm_1_1User.html">User Class</a>, respectively, for more
-information.</p>
-
-<!-- Value::replaceAllUsesWith User::replaceUsesOfWith Point out:
-include/llvm/Transforms/Utils/ especially BasicBlockUtils.h with:
-ReplaceInstWithValue, ReplaceInstWithInst -->
-
-</div>
-
-<!--_______________________________________________________________________-->
-<div class="doc_subsubsection">
-  <a name="schanges_deletingGV">Deleting <tt>GlobalVariable</tt>s</a>
-</div>
-
-<div class="doc_text">
-
-<p>Deleting a global variable from a module is just as easy as deleting an 
-Instruction. First, you must have a pointer to the global variable that you wish
- to delete.  You use this pointer to erase it from its parent, the module.
- For example:</p>
-
-<div class="doc_code">
-<pre>
-<a href="#GlobalVariable">GlobalVariable</a> *GV = .. ;
-
-GV-&gt;eraseFromParent();
-</pre>
-</div>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="create_types">How to Create Types</a>
-</div>
-
-<div class="doc_text">
-
-<p>In generating IR, you may need some complex types.  If you know these types
-statically, you can use <tt>TypeBuilder&lt;...&gt;::get()</tt>, defined
-in <tt>llvm/Support/TypeBuilder.h</tt>, to retrieve them.  <tt>TypeBuilder</tt>
-has two forms depending on whether you're building types for cross-compilation
-or native library use.  <tt>TypeBuilder&lt;T, true&gt;</tt> requires
-that <tt>T</tt> be independent of the host environment, meaning that it's built
-out of types from
-the <a href="/doxygen/namespacellvm_1_1types.html"><tt>llvm::types</tt></a>
-namespace and pointers, functions, arrays, etc. built of
-those.  <tt>TypeBuilder&lt;T, false&gt;</tt> additionally allows native C types
-whose size may depend on the host compiler.  For example,</p>
-
-<div class="doc_code">
-<pre>
-FunctionType *ft = TypeBuilder&lt;types::i&lt;8&gt;(types::i&lt;32&gt;*), true&gt;::get();
-</pre>
-</div>
-
-<p>is easier to read and write than the equivalent</p>
-
-<div class="doc_code">
-<pre>
-std::vector&lt;const Type*&gt; params;
-params.push_back(PointerType::getUnqual(Type::Int32Ty));
-FunctionType *ft = FunctionType::get(Type::Int8Ty, params, false);
-</pre>
-</div>
-
-<p>See the <a href="/doxygen/TypeBuilder_8h-source.html#l00001">class
-comment</a> for more details.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="threading">Threads and LLVM</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-<p>
-This section describes the interaction of the LLVM APIs with multithreading,
-both on the part of client applications, and in the JIT, in the hosted
-application.
-</p>
-
-<p>
-Note that LLVM's support for multithreading is still relatively young.  Up 
-through version 2.5, the execution of threaded hosted applications was
-supported, but not threaded client access to the APIs.  While this use case is
-now supported, clients <em>must</em> adhere to the guidelines specified below to
-ensure proper operation in multithreaded mode.
-</p>
-
-<p>
-Note that, on Unix-like platforms, LLVM requires the presence of GCC's atomic
-intrinsics in order to support threaded operation.  If you need a
-multhreading-capable LLVM on a platform without a suitably modern system
-compiler, consider compiling LLVM and LLVM-GCC in single-threaded mode, and 
-using the resultant compiler to build a copy of LLVM with multithreading
-support.
-</p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="startmultithreaded">Entering and Exiting Multithreaded Mode</a>
-</div>
-
-<div class="doc_text">
-
-<p>
-In order to properly protect its internal data structures while avoiding 
-excessive locking overhead in the single-threaded case, the LLVM must intialize
-certain data structures necessary to provide guards around its internals.  To do
-so, the client program must invoke <tt>llvm_start_multithreaded()</tt> before
-making any concurrent LLVM API calls.  To subsequently tear down these
-structures, use the <tt>llvm_stop_multithreaded()</tt> call.  You can also use
-the <tt>llvm_is_multithreaded()</tt> call to check the status of multithreaded
-mode.
-</p>
-
-<p>
-Note that both of these calls must be made <em>in isolation</em>.  That is to
-say that no other LLVM API calls may be executing at any time during the 
-execution of <tt>llvm_start_multithreaded()</tt> or <tt>llvm_stop_multithreaded
-</tt>.  It's is the client's responsibility to enforce this isolation.
-</p>
-
-<p>
-The return value of <tt>llvm_start_multithreaded()</tt> indicates the success or
-failure of the initialization.  Failure typically indicates that your copy of
-LLVM was built without multithreading support, typically because GCC atomic
-intrinsics were not found in your system compiler.  In this case, the LLVM API
-will not be safe for concurrent calls.  However, it <em>will</em> be safe for
-hosting threaded applications in the JIT, though <a href="#jitthreading">care
-must be taken</a> to ensure that side exits and the like do not accidentally
-result in concurrent LLVM API calls.
-</p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="shutdown">Ending Execution with <tt>llvm_shutdown()</tt></a>
-</div>
-
-<div class="doc_text">
-<p>
-When you are done using the LLVM APIs, you should call <tt>llvm_shutdown()</tt>
-to deallocate memory used for internal structures.  This will also invoke 
-<tt>llvm_stop_multithreaded()</tt> if LLVM is operating in multithreaded mode.
-As such, <tt>llvm_shutdown()</tt> requires the same isolation guarantees as
-<tt>llvm_stop_multithreaded()</tt>.
-</p>
-
-<p>
-Note that, if you use scope-based shutdown, you can use the
-<tt>llvm_shutdown_obj</tt> class, which calls <tt>llvm_shutdown()</tt> in its
-destructor.
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="managedstatic">Lazy Initialization with <tt>ManagedStatic</tt></a>
-</div>
-
-<div class="doc_text">
-<p>
-<tt>ManagedStatic</tt> is a utility class in LLVM used to implement static
-initialization of static resources, such as the global type tables.  Before the
-invocation of <tt>llvm_shutdown()</tt>, it implements a simple lazy 
-initialization scheme.  Once <tt>llvm_start_multithreaded()</tt> returns,
-however, it uses double-checked locking to implement thread-safe lazy
-initialization.
-</p>
-
-<p>
-Note that, because no other threads are allowed to issue LLVM API calls before
-<tt>llvm_start_multithreaded()</tt> returns, it is possible to have 
-<tt>ManagedStatic</tt>s of <tt>llvm::sys::Mutex</tt>s.
-</p>
-
-<p>
-The <tt>llvm_acquire_global_lock()</tt> and <tt>llvm_release_global_lock</tt> 
-APIs provide access to the global lock used to implement the double-checked
-locking for lazy initialization.  These should only be used internally to LLVM,
-and only if you know what you're doing!
-</p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="llvmcontext">Achieving Isolation with <tt>LLVMContext</tt></a>
-</div>
-
-<div class="doc_text">
-<p>
-<tt>LLVMContext</tt> is an opaque class in the LLVM API which clients can use
-to operate multiple, isolated instances of LLVM concurrently within the same
-address space.  For instance, in a hypothetical compile-server, the compilation
-of an individual translation unit is conceptually independent from all the 
-others, and it would be desirable to be able to compile incoming translation 
-units concurrently on independent server threads.  Fortunately, 
-<tt>LLVMContext</tt> exists to enable just this kind of scenario!
-</p>
-
-<p>
-Conceptually, <tt>LLVMContext</tt> provides isolation.  Every LLVM entity 
-(<tt>Module</tt>s, <tt>Value</tt>s, <tt>Type</tt>s, <tt>Constant</tt>s, etc.)
-in LLVM's in-memory IR belongs to an <tt>LLVMContext</tt>.  Entities in 
-different contexts <em>cannot</em> interact with each other: <tt>Module</tt>s in
-different contexts cannot be linked together, <tt>Function</tt>s cannot be added
-to <tt>Module</tt>s in different contexts, etc.  What this means is that is is
-safe to compile on multiple threads simultaneously, as long as no two threads
-operate on entities within the same context.
-</p>
-
-<p>
-In practice, very few places in the API require the explicit specification of a
-<tt>LLVMContext</tt>, other than the <tt>Type</tt> creation/lookup APIs.
-Because every <tt>Type</tt> carries a reference to its owning context, most
-other entities can determine what context they belong to by looking at their
-own <tt>Type</tt>.  If you are adding new entities to LLVM IR, please try to
-maintain this interface design.
-</p>
-
-<p>
-For clients that do <em>not</em> require the benefits of isolation, LLVM 
-provides a convenience API <tt>getGlobalContext()</tt>.  This returns a global,
-lazily initialized <tt>LLVMContext</tt> that may be used in situations where
-isolation is not a concern.
-</p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="jitthreading">Threads and the JIT</a>
-</div>
-
-<div class="doc_text">
-<p>
-LLVM's "eager" JIT compiler is safe to use in threaded programs.  Multiple
-threads can call <tt>ExecutionEngine::getPointerToFunction()</tt> or
-<tt>ExecutionEngine::runFunction()</tt> concurrently, and multiple threads can
-run code output by the JIT concurrently.  The user must still ensure that only
-one thread accesses IR in a given <tt>LLVMContext</tt> while another thread
-might be modifying it.  One way to do that is to always hold the JIT lock while
-accessing IR outside the JIT (the JIT <em>modifies</em> the IR by adding
-<tt>CallbackVH</tt>s).  Another way is to only
-call <tt>getPointerToFunction()</tt> from the <tt>LLVMContext</tt>'s thread.
-</p>
-
-<p>When the JIT is configured to compile lazily (using
-<tt>ExecutionEngine::DisableLazyCompilation(false)</tt>), there is currently a
-<a href="http://llvm.org/bugs/show_bug.cgi?id=5184">race condition</a> in
-updating call sites after a function is lazily-jitted.  It's still possible to
-use the lazy JIT in a threaded program if you ensure that only one thread at a
-time can call any particular lazy stub and that the JIT lock guards any IR
-access, but we suggest using only the eager JIT in threaded programs.
-</p>
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="advanced">Advanced Topics</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-<p>
-This section describes some of the advanced or obscure API's that most clients
-do not need to be aware of.  These API's tend manage the inner workings of the
-LLVM system, and only need to be accessed in unusual circumstances.
-</p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="TypeResolve">LLVM Type Resolution</a>
-</div>
-
-<div class="doc_text">
-
-<p>
-The LLVM type system has a very simple goal: allow clients to compare types for
-structural equality with a simple pointer comparison (aka a shallow compare).
-This goal makes clients much simpler and faster, and is used throughout the LLVM
-system.
-</p>
-
-<p>
-Unfortunately achieving this goal is not a simple matter.  In particular,
-recursive types and late resolution of opaque types makes the situation very
-difficult to handle.  Fortunately, for the most part, our implementation makes
-most clients able to be completely unaware of the nasty internal details.  The
-primary case where clients are exposed to the inner workings of it are when
-building a recursive type.  In addition to this case, the LLVM bitcode reader,
-assembly parser, and linker also have to be aware of the inner workings of this
-system.
-</p>
-
-<p>
-For our purposes below, we need three concepts.  First, an "Opaque Type" is 
-exactly as defined in the <a href="LangRef.html#t_opaque">language 
-reference</a>.  Second an "Abstract Type" is any type which includes an 
-opaque type as part of its type graph (for example "<tt>{ opaque, i32 }</tt>").
-Third, a concrete type is a type that is not an abstract type (e.g. "<tt>{ i32, 
-float }</tt>").
-</p>
-
-</div>
-
-<!-- ______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="BuildRecType">Basic Recursive Type Construction</a>
-</div>
-
-<div class="doc_text">
-
-<p>
-Because the most common question is "how do I build a recursive type with LLVM",
-we answer it now and explain it as we go.  Here we include enough to cause this
-to be emitted to an output .ll file:
-</p>
-
-<div class="doc_code">
-<pre>
-%mylist = type { %mylist*, i32 }
-</pre>
-</div>
-
-<p>
-To build this, use the following LLVM APIs:
-</p>
-
-<div class="doc_code">
-<pre>
-// <i>Create the initial outer struct</i>
-<a href="#PATypeHolder">PATypeHolder</a> StructTy = OpaqueType::get();
-std::vector&lt;const Type*&gt; Elts;
-Elts.push_back(PointerType::getUnqual(StructTy));
-Elts.push_back(Type::Int32Ty);
-StructType *NewSTy = StructType::get(Elts);
-
-// <i>At this point, NewSTy = "{ opaque*, i32 }". Tell VMCore that</i>
-// <i>the struct and the opaque type are actually the same.</i>
-cast&lt;OpaqueType&gt;(StructTy.get())-&gt;<a href="#refineAbstractTypeTo">refineAbstractTypeTo</a>(NewSTy);
-
-// <i>NewSTy is potentially invalidated, but StructTy (a <a href="#PATypeHolder">PATypeHolder</a>) is</i>
-// <i>kept up-to-date</i>
-NewSTy = cast&lt;StructType&gt;(StructTy.get());
-
-// <i>Add a name for the type to the module symbol table (optional)</i>
-MyModule-&gt;addTypeName("mylist", NewSTy);
-</pre>
-</div>
-
-<p>
-This code shows the basic approach used to build recursive types: build a
-non-recursive type using 'opaque', then use type unification to close the cycle.
-The type unification step is performed by the <tt><a
-href="#refineAbstractTypeTo">refineAbstractTypeTo</a></tt> method, which is
-described next.  After that, we describe the <a
-href="#PATypeHolder">PATypeHolder class</a>.
-</p>
-
-</div>
-
-<!-- ______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="refineAbstractTypeTo">The <tt>refineAbstractTypeTo</tt> method</a>
-</div>
-
-<div class="doc_text">
-<p>
-The <tt>refineAbstractTypeTo</tt> method starts the type unification process.
-While this method is actually a member of the DerivedType class, it is most
-often used on OpaqueType instances.  Type unification is actually a recursive
-process.  After unification, types can become structurally isomorphic to
-existing types, and all duplicates are deleted (to preserve pointer equality).
-</p>
-
-<p>
-In the example above, the OpaqueType object is definitely deleted.
-Additionally, if there is an "{ \2*, i32}" type already created in the system,
-the pointer and struct type created are <b>also</b> deleted.  Obviously whenever
-a type is deleted, any "Type*" pointers in the program are invalidated.  As
-such, it is safest to avoid having <i>any</i> "Type*" pointers to abstract types
-live across a call to <tt>refineAbstractTypeTo</tt> (note that non-abstract
-types can never move or be deleted).  To deal with this, the <a
-href="#PATypeHolder">PATypeHolder</a> class is used to maintain a stable
-reference to a possibly refined type, and the <a
-href="#AbstractTypeUser">AbstractTypeUser</a> class is used to update more
-complex datastructures.
-</p>
-
-</div>
-
-<!-- ______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="PATypeHolder">The PATypeHolder Class</a>
-</div>
-
-<div class="doc_text">
-<p>
-PATypeHolder is a form of a "smart pointer" for Type objects.  When VMCore
-happily goes about nuking types that become isomorphic to existing types, it
-automatically updates all PATypeHolder objects to point to the new type.  In the
-example above, this allows the code to maintain a pointer to the resultant
-resolved recursive type, even though the Type*'s are potentially invalidated.
-</p>
-
-<p>
-PATypeHolder is an extremely light-weight object that uses a lazy union-find
-implementation to update pointers.  For example the pointer from a Value to its
-Type is maintained by PATypeHolder objects.
-</p>
-
-</div>
-
-<!-- ______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="AbstractTypeUser">The AbstractTypeUser Class</a>
-</div>
-
-<div class="doc_text">
-
-<p>
-Some data structures need more to perform more complex updates when types get
-resolved.  To support this, a class can derive from the AbstractTypeUser class.
-This class
-allows it to get callbacks when certain types are resolved.  To register to get
-callbacks for a particular type, the DerivedType::{add/remove}AbstractTypeUser
-methods can be called on a type.  Note that these methods only work for <i>
-  abstract</i> types.  Concrete types (those that do not include any opaque 
-objects) can never be refined.
-</p>
-</div>
-
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="SymbolTable">The <tt>ValueSymbolTable</tt> and
-   <tt>TypeSymbolTable</tt> classes</a>
-</div>
-
-<div class="doc_text">
-<p>The <tt><a href="http://llvm.org/doxygen/classllvm_1_1ValueSymbolTable.html">
-ValueSymbolTable</a></tt> class provides a symbol table that the <a
-href="#Function"><tt>Function</tt></a> and <a href="#Module">
-<tt>Module</tt></a> classes use for naming value definitions. The symbol table
-can provide a name for any <a href="#Value"><tt>Value</tt></a>. 
-The <tt><a href="http://llvm.org/doxygen/classllvm_1_1TypeSymbolTable.html">
-TypeSymbolTable</a></tt> class is used by the <tt>Module</tt> class to store
-names for types.</p>
-
-<p>Note that the <tt>SymbolTable</tt> class should not be directly accessed 
-by most clients.  It should only be used when iteration over the symbol table 
-names themselves are required, which is very special purpose.  Note that not 
-all LLVM
-<tt><a href="#Value">Value</a></tt>s have names, and those without names (i.e. they have
-an empty name) do not exist in the symbol table.
-</p>
-
-<p>These symbol tables support iteration over the values/types in the symbol
-table with <tt>begin/end/iterator</tt> and supports querying to see if a
-specific name is in the symbol table (with <tt>lookup</tt>).  The
-<tt>ValueSymbolTable</tt> class exposes no public mutator methods, instead,
-simply call <tt>setName</tt> on a value, which will autoinsert it into the
-appropriate symbol table.  For types, use the Module::addTypeName method to
-insert entries into the symbol table.</p>
-
-</div>
-
-
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="UserLayout">The <tt>User</tt> and owned <tt>Use</tt> classes' memory layout</a>
-</div>
-
-<div class="doc_text">
-<p>The <tt><a href="http://llvm.org/doxygen/classllvm_1_1User.html">
-User</a></tt> class provides a basis for expressing the ownership of <tt>User</tt>
-towards other <tt><a href="http://llvm.org/doxygen/classllvm_1_1Value.html">
-Value</a></tt>s. The <tt><a href="http://llvm.org/doxygen/classllvm_1_1Use.html">
-Use</a></tt> helper class is employed to do the bookkeeping and to facilitate <i>O(1)</i>
-addition and removal.</p>
-
-<!-- ______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="Use2User">Interaction and relationship between <tt>User</tt> and <tt>Use</tt> objects</a>
-</div>
-
-<div class="doc_text">
-<p>
-A subclass of <tt>User</tt> can choose between incorporating its <tt>Use</tt> objects
-or refer to them out-of-line by means of a pointer. A mixed variant
-(some <tt>Use</tt>s inline others hung off) is impractical and breaks the invariant
-that the <tt>Use</tt> objects belonging to the same <tt>User</tt> form a contiguous array.
-</p>
-</div>
-
-<p>
-We have 2 different layouts in the <tt>User</tt> (sub)classes:
-<ul>
-<li><p>Layout a)
-The <tt>Use</tt> object(s) are inside (resp. at fixed offset) of the <tt>User</tt>
-object and there are a fixed number of them.</p>
-
-<li><p>Layout b)
-The <tt>Use</tt> object(s) are referenced by a pointer to an
-array from the <tt>User</tt> object and there may be a variable
-number of them.</p>
-</ul>
-<p>
-As of v2.4 each layout still possesses a direct pointer to the
-start of the array of <tt>Use</tt>s. Though not mandatory for layout a),
-we stick to this redundancy for the sake of simplicity.
-The <tt>User</tt> object also stores the number of <tt>Use</tt> objects it
-has. (Theoretically this information can also be calculated
-given the scheme presented below.)</p>
-<p>
-Special forms of allocation operators (<tt>operator new</tt>)
-enforce the following memory layouts:</p>
-
-<ul>
-<li><p>Layout a) is modelled by prepending the <tt>User</tt> object by the <tt>Use[]</tt> array.</p>
-
-<pre>
-...---.---.---.---.-------...
-  | P | P | P | P | User
-'''---'---'---'---'-------'''
-</pre>
-
-<li><p>Layout b) is modelled by pointing at the <tt>Use[]</tt> array.</p>
-<pre>
-.-------...
-| User
-'-------'''
-    |
-    v
-    .---.---.---.---...
-    | P | P | P | P |
-    '---'---'---'---'''
-</pre>
-</ul>
-<i>(In the above figures '<tt>P</tt>' stands for the <tt>Use**</tt> that
-    is stored in each <tt>Use</tt> object in the member <tt>Use::Prev</tt>)</i>
-
-<!-- ______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="Waymarking">The waymarking algorithm</a>
-</div>
-
-<div class="doc_text">
-<p>
-Since the <tt>Use</tt> objects are deprived of the direct (back)pointer to
-their <tt>User</tt> objects, there must be a fast and exact method to
-recover it. This is accomplished by the following scheme:</p>
-</div>
-
-A bit-encoding in the 2 LSBits (least significant bits) of the <tt>Use::Prev</tt> allows to find the
-start of the <tt>User</tt> object:
-<ul>
-<li><tt>00</tt> &mdash;&gt; binary digit 0</li>
-<li><tt>01</tt> &mdash;&gt; binary digit 1</li>
-<li><tt>10</tt> &mdash;&gt; stop and calculate (<tt>s</tt>)</li>
-<li><tt>11</tt> &mdash;&gt; full stop (<tt>S</tt>)</li>
-</ul>
-<p>
-Given a <tt>Use*</tt>, all we have to do is to walk till we get
-a stop and we either have a <tt>User</tt> immediately behind or
-we have to walk to the next stop picking up digits
-and calculating the offset:</p>
-<pre>
-.---.---.---.---.---.---.---.---.---.---.---.---.---.---.---.---.----------------
-| 1 | s | 1 | 0 | 1 | 0 | s | 1 | 1 | 0 | s | 1 | 1 | s | 1 | S | User (or User*)
-'---'---'---'---'---'---'---'---'---'---'---'---'---'---'---'---'----------------
-    |+15                |+10            |+6         |+3     |+1
-    |                   |               |           |       |__>
-    |                   |               |           |__________>
-    |                   |               |______________________>
-    |                   |______________________________________>
-    |__________________________________________________________>
-</pre>
-<p>
-Only the significant number of bits need to be stored between the
-stops, so that the <i>worst case is 20 memory accesses</i> when there are
-1000 <tt>Use</tt> objects associated with a <tt>User</tt>.</p>
-
-<!-- ______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="ReferenceImpl">Reference implementation</a>
-</div>
-
-<div class="doc_text">
-<p>
-The following literate Haskell fragment demonstrates the concept:</p>
-</div>
-
-<div class="doc_code">
-<pre>
-> import Test.QuickCheck
-> 
-> digits :: Int -> [Char] -> [Char]
-> digits 0 acc = '0' : acc
-> digits 1 acc = '1' : acc
-> digits n acc = digits (n `div` 2) $ digits (n `mod` 2) acc
-> 
-> dist :: Int -> [Char] -> [Char]
-> dist 0 [] = ['S']
-> dist 0 acc = acc
-> dist 1 acc = let r = dist 0 acc in 's' : digits (length r) r
-> dist n acc = dist (n - 1) $ dist 1 acc
-> 
-> takeLast n ss = reverse $ take n $ reverse ss
-> 
-> test = takeLast 40 $ dist 20 []
-> 
-</pre>
-</div>
-<p>
-Printing &lt;test&gt; gives: <tt>"1s100000s11010s10100s1111s1010s110s11s1S"</tt></p>
-<p>
-The reverse algorithm computes the length of the string just by examining
-a certain prefix:</p>
-
-<div class="doc_code">
-<pre>
-> pref :: [Char] -> Int
-> pref "S" = 1
-> pref ('s':'1':rest) = decode 2 1 rest
-> pref (_:rest) = 1 + pref rest
-> 
-> decode walk acc ('0':rest) = decode (walk + 1) (acc * 2) rest
-> decode walk acc ('1':rest) = decode (walk + 1) (acc * 2 + 1) rest
-> decode walk acc _ = walk + acc
-> 
-</pre>
-</div>
-<p>
-Now, as expected, printing &lt;pref test&gt; gives <tt>40</tt>.</p>
-<p>
-We can <i>quickCheck</i> this with following property:</p>
-
-<div class="doc_code">
-<pre>
-> testcase = dist 2000 []
-> testcaseLength = length testcase
-> 
-> identityProp n = n > 0 && n <= testcaseLength ==> length arr == pref arr
->     where arr = takeLast n testcase
-> 
-</pre>
-</div>
-<p>
-As expected &lt;quickCheck identityProp&gt; gives:</p>
-
-<pre>
-*Main> quickCheck identityProp
-OK, passed 100 tests.
-</pre>
-<p>
-Let's be a bit more exhaustive:</p>
-
-<div class="doc_code">
-<pre>
-> 
-> deepCheck p = check (defaultConfig { configMaxTest = 500 }) p
-> 
-</pre>
-</div>
-<p>
-And here is the result of &lt;deepCheck identityProp&gt;:</p>
-
-<pre>
-*Main> deepCheck identityProp
-OK, passed 500 tests.
-</pre>
-
-<!-- ______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="Tagging">Tagging considerations</a>
-</div>
-
-<p>
-To maintain the invariant that the 2 LSBits of each <tt>Use**</tt> in <tt>Use</tt>
-never change after being set up, setters of <tt>Use::Prev</tt> must re-tag the
-new <tt>Use**</tt> on every modification. Accordingly getters must strip the
-tag bits.</p>
-<p>
-For layout b) instead of the <tt>User</tt> we find a pointer (<tt>User*</tt> with LSBit set).
-Following this pointer brings us to the <tt>User</tt>. A portable trick ensures
-that the first bytes of <tt>User</tt> (if interpreted as a pointer) never has
-the LSBit set. (Portability is relying on the fact that all known compilers place the
-<tt>vptr</tt> in the first word of the instances.)</p>
-
-</div>
-
-  <!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="coreclasses">The Core LLVM Class Hierarchy Reference </a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-<p><tt>#include "<a href="/doxygen/Type_8h-source.html">llvm/Type.h</a>"</tt>
-<br>doxygen info: <a href="/doxygen/classllvm_1_1Type.html">Type Class</a></p>
-
-<p>The Core LLVM classes are the primary means of representing the program
-being inspected or transformed.  The core LLVM classes are defined in
-header files in the <tt>include/llvm/</tt> directory, and implemented in
-the <tt>lib/VMCore</tt> directory.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="Type">The <tt>Type</tt> class and Derived Types</a>
-</div>
-
-<div class="doc_text">
-
-  <p><tt>Type</tt> is a superclass of all type classes. Every <tt>Value</tt> has
-  a <tt>Type</tt>. <tt>Type</tt> cannot be instantiated directly but only
-  through its subclasses. Certain primitive types (<tt>VoidType</tt>,
-  <tt>LabelType</tt>, <tt>FloatType</tt> and <tt>DoubleType</tt>) have hidden 
-  subclasses. They are hidden because they offer no useful functionality beyond
-  what the <tt>Type</tt> class offers except to distinguish themselves from 
-  other subclasses of <tt>Type</tt>.</p>
-  <p>All other types are subclasses of <tt>DerivedType</tt>.  Types can be 
-  named, but this is not a requirement. There exists exactly 
-  one instance of a given shape at any one time.  This allows type equality to
-  be performed with address equality of the Type Instance. That is, given two 
-  <tt>Type*</tt> values, the types are identical if the pointers are identical.
-  </p>
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="m_Type">Important Public Methods</a>
-</div>
-
-<div class="doc_text">
-
-<ul>
-  <li><tt>bool isInteger() const</tt>: Returns true for any integer type.</li>
-
-  <li><tt>bool isFloatingPoint()</tt>: Return true if this is one of the two
-  floating point types.</li>
-
-  <li><tt>bool isAbstract()</tt>: Return true if the type is abstract (contains
-  an OpaqueType anywhere in its definition).</li>
-
-  <li><tt>bool isSized()</tt>: Return true if the type has known size. Things
-  that don't have a size are abstract types, labels and void.</li>
-
-</ul>
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="derivedtypes">Important Derived Types</a>
-</div>
-<div class="doc_text">
-<dl>
-  <dt><tt>IntegerType</tt></dt>
-  <dd>Subclass of DerivedType that represents integer types of any bit width. 
-  Any bit width between <tt>IntegerType::MIN_INT_BITS</tt> (1) and 
-  <tt>IntegerType::MAX_INT_BITS</tt> (~8 million) can be represented.
-  <ul>
-    <li><tt>static const IntegerType* get(unsigned NumBits)</tt>: get an integer
-    type of a specific bit width.</li>
-    <li><tt>unsigned getBitWidth() const</tt>: Get the bit width of an integer
-    type.</li>
-  </ul>
-  </dd>
-  <dt><tt>SequentialType</tt></dt>
-  <dd>This is subclassed by ArrayType and PointerType
-    <ul>
-      <li><tt>const Type * getElementType() const</tt>: Returns the type of each
-      of the elements in the sequential type. </li>
-    </ul>
-  </dd>
-  <dt><tt>ArrayType</tt></dt>
-  <dd>This is a subclass of SequentialType and defines the interface for array 
-  types.
-    <ul>
-      <li><tt>unsigned getNumElements() const</tt>: Returns the number of 
-      elements in the array. </li>
-    </ul>
-  </dd>
-  <dt><tt>PointerType</tt></dt>
-  <dd>Subclass of SequentialType for pointer types.</dd>
-  <dt><tt>VectorType</tt></dt>
-  <dd>Subclass of SequentialType for vector types. A 
-  vector type is similar to an ArrayType but is distinguished because it is 
-  a first class type whereas ArrayType is not. Vector types are used for 
-  vector operations and are usually small vectors of of an integer or floating 
-  point type.</dd>
-  <dt><tt>StructType</tt></dt>
-  <dd>Subclass of DerivedTypes for struct types.</dd>
-  <dt><tt><a name="FunctionType">FunctionType</a></tt></dt>
-  <dd>Subclass of DerivedTypes for function types.
-    <ul>
-      <li><tt>bool isVarArg() const</tt>: Returns true if its a vararg
-      function</li>
-      <li><tt> const Type * getReturnType() const</tt>: Returns the
-      return type of the function.</li>
-      <li><tt>const Type * getParamType (unsigned i)</tt>: Returns
-      the type of the ith parameter.</li>
-      <li><tt> const unsigned getNumParams() const</tt>: Returns the
-      number of formal parameters.</li>
-    </ul>
-  </dd>
-  <dt><tt>OpaqueType</tt></dt>
-  <dd>Sublcass of DerivedType for abstract types. This class 
-  defines no content and is used as a placeholder for some other type. Note 
-  that OpaqueType is used (temporarily) during type resolution for forward 
-  references of types. Once the referenced type is resolved, the OpaqueType 
-  is replaced with the actual type. OpaqueType can also be used for data 
-  abstraction. At link time opaque types can be resolved to actual types 
-  of the same name.</dd>
-</dl>
-</div>
-
-
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="Module">The <tt>Module</tt> class</a>
-</div>
-
-<div class="doc_text">
-
-<p><tt>#include "<a
-href="/doxygen/Module_8h-source.html">llvm/Module.h</a>"</tt><br> doxygen info:
-<a href="/doxygen/classllvm_1_1Module.html">Module Class</a></p>
-
-<p>The <tt>Module</tt> class represents the top level structure present in LLVM
-programs.  An LLVM module is effectively either a translation unit of the
-original program or a combination of several translation units merged by the
-linker.  The <tt>Module</tt> class keeps track of a list of <a
-href="#Function"><tt>Function</tt></a>s, a list of <a
-href="#GlobalVariable"><tt>GlobalVariable</tt></a>s, and a <a
-href="#SymbolTable"><tt>SymbolTable</tt></a>.  Additionally, it contains a few
-helpful member functions that try to make common operations easy.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="m_Module">Important Public Members of the <tt>Module</tt> class</a>
-</div>
-
-<div class="doc_text">
-
-<ul>
-  <li><tt>Module::Module(std::string name = "")</tt></li>
-</ul>
-
-<p>Constructing a <a href="#Module">Module</a> is easy. You can optionally
-provide a name for it (probably based on the name of the translation unit).</p>
-
-<ul>
-  <li><tt>Module::iterator</tt> - Typedef for function list iterator<br>
-    <tt>Module::const_iterator</tt> - Typedef for const_iterator.<br>
-
-    <tt>begin()</tt>, <tt>end()</tt>
-    <tt>size()</tt>, <tt>empty()</tt>
-
-    <p>These are forwarding methods that make it easy to access the contents of
-    a <tt>Module</tt> object's <a href="#Function"><tt>Function</tt></a>
-    list.</p></li>
-
-  <li><tt>Module::FunctionListType &amp;getFunctionList()</tt>
-
-    <p> Returns the list of <a href="#Function"><tt>Function</tt></a>s.  This is
-    necessary to use when you need to update the list or perform a complex
-    action that doesn't have a forwarding method.</p>
-
-    <p><!--  Global Variable --></p></li> 
-</ul>
-
-<hr>
-
-<ul>
-  <li><tt>Module::global_iterator</tt> - Typedef for global variable list iterator<br>
-
-    <tt>Module::const_global_iterator</tt> - Typedef for const_iterator.<br>
-
-    <tt>global_begin()</tt>, <tt>global_end()</tt>
-    <tt>global_size()</tt>, <tt>global_empty()</tt>
-
-    <p> These are forwarding methods that make it easy to access the contents of
-    a <tt>Module</tt> object's <a
-    href="#GlobalVariable"><tt>GlobalVariable</tt></a> list.</p></li>
-
-  <li><tt>Module::GlobalListType &amp;getGlobalList()</tt>
-
-    <p>Returns the list of <a
-    href="#GlobalVariable"><tt>GlobalVariable</tt></a>s.  This is necessary to
-    use when you need to update the list or perform a complex action that
-    doesn't have a forwarding method.</p>
-
-    <p><!--  Symbol table stuff --> </p></li>
-</ul>
-
-<hr>
-
-<ul>
-  <li><tt><a href="#SymbolTable">SymbolTable</a> *getSymbolTable()</tt>
-
-    <p>Return a reference to the <a href="#SymbolTable"><tt>SymbolTable</tt></a>
-    for this <tt>Module</tt>.</p>
-
-    <p><!--  Convenience methods --></p></li>
-</ul>
-
-<hr>
-
-<ul>
-  <li><tt><a href="#Function">Function</a> *getFunction(const std::string
-  &amp;Name, const <a href="#FunctionType">FunctionType</a> *Ty)</tt>
-
-    <p>Look up the specified function in the <tt>Module</tt> <a
-    href="#SymbolTable"><tt>SymbolTable</tt></a>. If it does not exist, return
-    <tt>null</tt>.</p></li>
-
-  <li><tt><a href="#Function">Function</a> *getOrInsertFunction(const
-  std::string &amp;Name, const <a href="#FunctionType">FunctionType</a> *T)</tt>
-
-    <p>Look up the specified function in the <tt>Module</tt> <a
-    href="#SymbolTable"><tt>SymbolTable</tt></a>. If it does not exist, add an
-    external declaration for the function and return it.</p></li>
-
-  <li><tt>std::string getTypeName(const <a href="#Type">Type</a> *Ty)</tt>
-
-    <p>If there is at least one entry in the <a
-    href="#SymbolTable"><tt>SymbolTable</tt></a> for the specified <a
-    href="#Type"><tt>Type</tt></a>, return it.  Otherwise return the empty
-    string.</p></li>
-
-  <li><tt>bool addTypeName(const std::string &amp;Name, const <a
-  href="#Type">Type</a> *Ty)</tt>
-
-    <p>Insert an entry in the <a href="#SymbolTable"><tt>SymbolTable</tt></a>
-    mapping <tt>Name</tt> to <tt>Ty</tt>. If there is already an entry for this
-    name, true is returned and the <a
-    href="#SymbolTable"><tt>SymbolTable</tt></a> is not modified.</p></li>
-</ul>
-
-</div>
-
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="Value">The <tt>Value</tt> class</a>
-</div>
-
-<div class="doc_text">
-
-<p><tt>#include "<a href="/doxygen/Value_8h-source.html">llvm/Value.h</a>"</tt>
-<br> 
-doxygen info: <a href="/doxygen/classllvm_1_1Value.html">Value Class</a></p>
-
-<p>The <tt>Value</tt> class is the most important class in the LLVM Source
-base.  It represents a typed value that may be used (among other things) as an
-operand to an instruction.  There are many different types of <tt>Value</tt>s,
-such as <a href="#Constant"><tt>Constant</tt></a>s,<a
-href="#Argument"><tt>Argument</tt></a>s. Even <a
-href="#Instruction"><tt>Instruction</tt></a>s and <a
-href="#Function"><tt>Function</tt></a>s are <tt>Value</tt>s.</p>
-
-<p>A particular <tt>Value</tt> may be used many times in the LLVM representation
-for a program.  For example, an incoming argument to a function (represented
-with an instance of the <a href="#Argument">Argument</a> class) is "used" by
-every instruction in the function that references the argument.  To keep track
-of this relationship, the <tt>Value</tt> class keeps a list of all of the <a
-href="#User"><tt>User</tt></a>s that is using it (the <a
-href="#User"><tt>User</tt></a> class is a base class for all nodes in the LLVM
-graph that can refer to <tt>Value</tt>s).  This use list is how LLVM represents
-def-use information in the program, and is accessible through the <tt>use_</tt>*
-methods, shown below.</p>
-
-<p>Because LLVM is a typed representation, every LLVM <tt>Value</tt> is typed,
-and this <a href="#Type">Type</a> is available through the <tt>getType()</tt>
-method. In addition, all LLVM values can be named.  The "name" of the
-<tt>Value</tt> is a symbolic string printed in the LLVM code:</p>
-
-<div class="doc_code">
-<pre>
-%<b>foo</b> = add i32 1, 2
-</pre>
-</div>
-
-<p><a name="nameWarning">The name of this instruction is "foo".</a> <b>NOTE</b>
-that the name of any value may be missing (an empty string), so names should
-<b>ONLY</b> be used for debugging (making the source code easier to read,
-debugging printouts), they should not be used to keep track of values or map
-between them.  For this purpose, use a <tt>std::map</tt> of pointers to the
-<tt>Value</tt> itself instead.</p>
-
-<p>One important aspect of LLVM is that there is no distinction between an SSA
-variable and the operation that produces it.  Because of this, any reference to
-the value produced by an instruction (or the value available as an incoming
-argument, for example) is represented as a direct pointer to the instance of
-the class that
-represents this value.  Although this may take some getting used to, it
-simplifies the representation and makes it easier to manipulate.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="m_Value">Important Public Members of the <tt>Value</tt> class</a>
-</div>
-
-<div class="doc_text">
-
-<ul>
-  <li><tt>Value::use_iterator</tt> - Typedef for iterator over the
-use-list<br>
-    <tt>Value::use_const_iterator</tt> - Typedef for const_iterator over
-the use-list<br>
-    <tt>unsigned use_size()</tt> - Returns the number of users of the
-value.<br>
-    <tt>bool use_empty()</tt> - Returns true if there are no users.<br>
-    <tt>use_iterator use_begin()</tt> - Get an iterator to the start of
-the use-list.<br>
-    <tt>use_iterator use_end()</tt> - Get an iterator to the end of the
-use-list.<br>
-    <tt><a href="#User">User</a> *use_back()</tt> - Returns the last
-element in the list.
-    <p> These methods are the interface to access the def-use
-information in LLVM.  As with all other iterators in LLVM, the naming
-conventions follow the conventions defined by the <a href="#stl">STL</a>.</p>
-  </li>
-  <li><tt><a href="#Type">Type</a> *getType() const</tt>
-    <p>This method returns the Type of the Value.</p>
-  </li>
-  <li><tt>bool hasName() const</tt><br>
-    <tt>std::string getName() const</tt><br>
-    <tt>void setName(const std::string &amp;Name)</tt>
-    <p> This family of methods is used to access and assign a name to a <tt>Value</tt>,
-be aware of the <a href="#nameWarning">precaution above</a>.</p>
-  </li>
-  <li><tt>void replaceAllUsesWith(Value *V)</tt>
-
-    <p>This method traverses the use list of a <tt>Value</tt> changing all <a
-    href="#User"><tt>User</tt>s</a> of the current value to refer to
-    "<tt>V</tt>" instead.  For example, if you detect that an instruction always
-    produces a constant value (for example through constant folding), you can
-    replace all uses of the instruction with the constant like this:</p>
-
-<div class="doc_code">
-<pre>
-Inst-&gt;replaceAllUsesWith(ConstVal);
-</pre>
-</div>
-
-</ul>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="User">The <tt>User</tt> class</a>
-</div>
-
-<div class="doc_text">
-  
-<p>
-<tt>#include "<a href="/doxygen/User_8h-source.html">llvm/User.h</a>"</tt><br>
-doxygen info: <a href="/doxygen/classllvm_1_1User.html">User Class</a><br>
-Superclass: <a href="#Value"><tt>Value</tt></a></p>
-
-<p>The <tt>User</tt> class is the common base class of all LLVM nodes that may
-refer to <a href="#Value"><tt>Value</tt></a>s.  It exposes a list of "Operands"
-that are all of the <a href="#Value"><tt>Value</tt></a>s that the User is
-referring to.  The <tt>User</tt> class itself is a subclass of
-<tt>Value</tt>.</p>
-
-<p>The operands of a <tt>User</tt> point directly to the LLVM <a
-href="#Value"><tt>Value</tt></a> that it refers to.  Because LLVM uses Static
-Single Assignment (SSA) form, there can only be one definition referred to,
-allowing this direct connection.  This connection provides the use-def
-information in LLVM.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="m_User">Important Public Members of the <tt>User</tt> class</a>
-</div>
-
-<div class="doc_text">
-
-<p>The <tt>User</tt> class exposes the operand list in two ways: through
-an index access interface and through an iterator based interface.</p>
-
-<ul>
-  <li><tt>Value *getOperand(unsigned i)</tt><br>
-    <tt>unsigned getNumOperands()</tt>
-    <p> These two methods expose the operands of the <tt>User</tt> in a
-convenient form for direct access.</p></li>
-
-  <li><tt>User::op_iterator</tt> - Typedef for iterator over the operand
-list<br>
-    <tt>op_iterator op_begin()</tt> - Get an iterator to the start of 
-the operand list.<br>
-    <tt>op_iterator op_end()</tt> - Get an iterator to the end of the
-operand list.
-    <p> Together, these methods make up the iterator based interface to
-the operands of a <tt>User</tt>.</p></li>
-</ul>
-
-</div>    
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="Instruction">The <tt>Instruction</tt> class</a>
-</div>
-
-<div class="doc_text">
-
-<p><tt>#include "</tt><tt><a
-href="/doxygen/Instruction_8h-source.html">llvm/Instruction.h</a>"</tt><br>
-doxygen info: <a href="/doxygen/classllvm_1_1Instruction.html">Instruction Class</a><br>
-Superclasses: <a href="#User"><tt>User</tt></a>, <a
-href="#Value"><tt>Value</tt></a></p>
-
-<p>The <tt>Instruction</tt> class is the common base class for all LLVM
-instructions.  It provides only a few methods, but is a very commonly used
-class.  The primary data tracked by the <tt>Instruction</tt> class itself is the
-opcode (instruction type) and the parent <a
-href="#BasicBlock"><tt>BasicBlock</tt></a> the <tt>Instruction</tt> is embedded
-into.  To represent a specific type of instruction, one of many subclasses of
-<tt>Instruction</tt> are used.</p>
-
-<p> Because the <tt>Instruction</tt> class subclasses the <a
-href="#User"><tt>User</tt></a> class, its operands can be accessed in the same
-way as for other <a href="#User"><tt>User</tt></a>s (with the
-<tt>getOperand()</tt>/<tt>getNumOperands()</tt> and
-<tt>op_begin()</tt>/<tt>op_end()</tt> methods).</p> <p> An important file for
-the <tt>Instruction</tt> class is the <tt>llvm/Instruction.def</tt> file. This
-file contains some meta-data about the various different types of instructions
-in LLVM.  It describes the enum values that are used as opcodes (for example
-<tt>Instruction::Add</tt> and <tt>Instruction::ICmp</tt>), as well as the
-concrete sub-classes of <tt>Instruction</tt> that implement the instruction (for
-example <tt><a href="#BinaryOperator">BinaryOperator</a></tt> and <tt><a
-href="#CmpInst">CmpInst</a></tt>).  Unfortunately, the use of macros in
-this file confuses doxygen, so these enum values don't show up correctly in the
-<a href="/doxygen/classllvm_1_1Instruction.html">doxygen output</a>.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="s_Instruction">Important Subclasses of the <tt>Instruction</tt>
-  class</a>
-</div>
-<div class="doc_text">
-  <ul>
-    <li><tt><a name="BinaryOperator">BinaryOperator</a></tt>
-    <p>This subclasses represents all two operand instructions whose operands
-    must be the same type, except for the comparison instructions.</p></li>
-    <li><tt><a name="CastInst">CastInst</a></tt>
-    <p>This subclass is the parent of the 12 casting instructions. It provides
-    common operations on cast instructions.</p>
-    <li><tt><a name="CmpInst">CmpInst</a></tt>
-    <p>This subclass respresents the two comparison instructions, 
-    <a href="LangRef.html#i_icmp">ICmpInst</a> (integer opreands), and
-    <a href="LangRef.html#i_fcmp">FCmpInst</a> (floating point operands).</p>
-    <li><tt><a name="TerminatorInst">TerminatorInst</a></tt>
-    <p>This subclass is the parent of all terminator instructions (those which
-    can terminate a block).</p>
-  </ul>
-  </div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="m_Instruction">Important Public Members of the <tt>Instruction</tt>
-  class</a>
-</div>
-
-<div class="doc_text">
-
-<ul>
-  <li><tt><a href="#BasicBlock">BasicBlock</a> *getParent()</tt>
-    <p>Returns the <a href="#BasicBlock"><tt>BasicBlock</tt></a> that
-this  <tt>Instruction</tt> is embedded into.</p></li>
-  <li><tt>bool mayWriteToMemory()</tt>
-    <p>Returns true if the instruction writes to memory, i.e. it is a
-      <tt>call</tt>,<tt>free</tt>,<tt>invoke</tt>, or <tt>store</tt>.</p></li>
-  <li><tt>unsigned getOpcode()</tt>
-    <p>Returns the opcode for the <tt>Instruction</tt>.</p></li>
-  <li><tt><a href="#Instruction">Instruction</a> *clone() const</tt>
-    <p>Returns another instance of the specified instruction, identical
-in all ways to the original except that the instruction has no parent
-(ie it's not embedded into a <a href="#BasicBlock"><tt>BasicBlock</tt></a>),
-and it has no name</p></li>
-</ul>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="Constant">The <tt>Constant</tt> class and subclasses</a>
-</div>
-
-<div class="doc_text">
-
-<p>Constant represents a base class for different types of constants. It
-is subclassed by ConstantInt, ConstantArray, etc. for representing 
-the various types of Constants.  <a href="#GlobalValue">GlobalValue</a> is also
-a subclass, which represents the address of a global variable or function.
-</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">Important Subclasses of Constant </div>
-<div class="doc_text">
-<ul>
-  <li>ConstantInt : This subclass of Constant represents an integer constant of
-  any width.
-    <ul>
-      <li><tt>const APInt&amp; getValue() const</tt>: Returns the underlying
-      value of this constant, an APInt value.</li>
-      <li><tt>int64_t getSExtValue() const</tt>: Converts the underlying APInt
-      value to an int64_t via sign extension. If the value (not the bit width)
-      of the APInt is too large to fit in an int64_t, an assertion will result.
-      For this reason, use of this method is discouraged.</li>
-      <li><tt>uint64_t getZExtValue() const</tt>: Converts the underlying APInt
-      value to a uint64_t via zero extension. IF the value (not the bit width)
-      of the APInt is too large to fit in a uint64_t, an assertion will result.
-      For this reason, use of this method is discouraged.</li>
-      <li><tt>static ConstantInt* get(const APInt&amp; Val)</tt>: Returns the
-      ConstantInt object that represents the value provided by <tt>Val</tt>.
-      The type is implied as the IntegerType that corresponds to the bit width
-      of <tt>Val</tt>.</li>
-      <li><tt>static ConstantInt* get(const Type *Ty, uint64_t Val)</tt>: 
-      Returns the ConstantInt object that represents the value provided by 
-      <tt>Val</tt> for integer type <tt>Ty</tt>.</li>
-    </ul>
-  </li>
-  <li>ConstantFP : This class represents a floating point constant.
-    <ul>
-      <li><tt>double getValue() const</tt>: Returns the underlying value of 
-      this constant. </li>
-    </ul>
-  </li>
-  <li>ConstantArray : This represents a constant array.
-    <ul>
-      <li><tt>const std::vector&lt;Use&gt; &amp;getValues() const</tt>: Returns 
-      a vector of component constants that makeup this array. </li>
-    </ul>
-  </li>
-  <li>ConstantStruct : This represents a constant struct.
-    <ul>
-      <li><tt>const std::vector&lt;Use&gt; &amp;getValues() const</tt>: Returns 
-      a vector of component constants that makeup this array. </li>
-    </ul>
-  </li>
-  <li>GlobalValue : This represents either a global variable or a function. In 
-  either case, the value is a constant fixed address (after linking). 
-  </li>
-</ul>
-</div>
-
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="GlobalValue">The <tt>GlobalValue</tt> class</a>
-</div>
-
-<div class="doc_text">
-
-<p><tt>#include "<a
-href="/doxygen/GlobalValue_8h-source.html">llvm/GlobalValue.h</a>"</tt><br>
-doxygen info: <a href="/doxygen/classllvm_1_1GlobalValue.html">GlobalValue
-Class</a><br>
-Superclasses: <a href="#Constant"><tt>Constant</tt></a>, 
-<a href="#User"><tt>User</tt></a>, <a href="#Value"><tt>Value</tt></a></p>
-
-<p>Global values (<a href="#GlobalVariable"><tt>GlobalVariable</tt></a>s or <a
-href="#Function"><tt>Function</tt></a>s) are the only LLVM values that are
-visible in the bodies of all <a href="#Function"><tt>Function</tt></a>s.
-Because they are visible at global scope, they are also subject to linking with
-other globals defined in different translation units.  To control the linking
-process, <tt>GlobalValue</tt>s know their linkage rules. Specifically,
-<tt>GlobalValue</tt>s know whether they have internal or external linkage, as
-defined by the <tt>LinkageTypes</tt> enumeration.</p>
-
-<p>If a <tt>GlobalValue</tt> has internal linkage (equivalent to being
-<tt>static</tt> in C), it is not visible to code outside the current translation
-unit, and does not participate in linking.  If it has external linkage, it is
-visible to external code, and does participate in linking.  In addition to
-linkage information, <tt>GlobalValue</tt>s keep track of which <a
-href="#Module"><tt>Module</tt></a> they are currently part of.</p>
-
-<p>Because <tt>GlobalValue</tt>s are memory objects, they are always referred to
-by their <b>address</b>. As such, the <a href="#Type"><tt>Type</tt></a> of a
-global is always a pointer to its contents. It is important to remember this
-when using the <tt>GetElementPtrInst</tt> instruction because this pointer must
-be dereferenced first. For example, if you have a <tt>GlobalVariable</tt> (a
-subclass of <tt>GlobalValue)</tt> that is an array of 24 ints, type <tt>[24 x
-i32]</tt>, then the <tt>GlobalVariable</tt> is a pointer to that array. Although
-the address of the first element of this array and the value of the
-<tt>GlobalVariable</tt> are the same, they have different types. The
-<tt>GlobalVariable</tt>'s type is <tt>[24 x i32]</tt>. The first element's type
-is <tt>i32.</tt> Because of this, accessing a global value requires you to
-dereference the pointer with <tt>GetElementPtrInst</tt> first, then its elements
-can be accessed. This is explained in the <a href="LangRef.html#globalvars">LLVM
-Language Reference Manual</a>.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="m_GlobalValue">Important Public Members of the <tt>GlobalValue</tt>
-  class</a>
-</div>
-
-<div class="doc_text">
-
-<ul>
-  <li><tt>bool hasInternalLinkage() const</tt><br>
-    <tt>bool hasExternalLinkage() const</tt><br>
-    <tt>void setInternalLinkage(bool HasInternalLinkage)</tt>
-    <p> These methods manipulate the linkage characteristics of the <tt>GlobalValue</tt>.</p>
-    <p> </p>
-  </li>
-  <li><tt><a href="#Module">Module</a> *getParent()</tt>
-    <p> This returns the <a href="#Module"><tt>Module</tt></a> that the
-GlobalValue is currently embedded into.</p></li>
-</ul>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="Function">The <tt>Function</tt> class</a>
-</div>
-
-<div class="doc_text">
-
-<p><tt>#include "<a
-href="/doxygen/Function_8h-source.html">llvm/Function.h</a>"</tt><br> doxygen
-info: <a href="/doxygen/classllvm_1_1Function.html">Function Class</a><br>
-Superclasses: <a href="#GlobalValue"><tt>GlobalValue</tt></a>, 
-<a href="#Constant"><tt>Constant</tt></a>, 
-<a href="#User"><tt>User</tt></a>, 
-<a href="#Value"><tt>Value</tt></a></p>
-
-<p>The <tt>Function</tt> class represents a single procedure in LLVM.  It is
-actually one of the more complex classes in the LLVM hierarchy because it must
-keep track of a large amount of data.  The <tt>Function</tt> class keeps track
-of a list of <a href="#BasicBlock"><tt>BasicBlock</tt></a>s, a list of formal 
-<a href="#Argument"><tt>Argument</tt></a>s, and a 
-<a href="#SymbolTable"><tt>SymbolTable</tt></a>.</p>
-
-<p>The list of <a href="#BasicBlock"><tt>BasicBlock</tt></a>s is the most
-commonly used part of <tt>Function</tt> objects.  The list imposes an implicit
-ordering of the blocks in the function, which indicate how the code will be
-laid out by the backend.  Additionally, the first <a
-href="#BasicBlock"><tt>BasicBlock</tt></a> is the implicit entry node for the
-<tt>Function</tt>.  It is not legal in LLVM to explicitly branch to this initial
-block.  There are no implicit exit nodes, and in fact there may be multiple exit
-nodes from a single <tt>Function</tt>.  If the <a
-href="#BasicBlock"><tt>BasicBlock</tt></a> list is empty, this indicates that
-the <tt>Function</tt> is actually a function declaration: the actual body of the
-function hasn't been linked in yet.</p>
-
-<p>In addition to a list of <a href="#BasicBlock"><tt>BasicBlock</tt></a>s, the
-<tt>Function</tt> class also keeps track of the list of formal <a
-href="#Argument"><tt>Argument</tt></a>s that the function receives.  This
-container manages the lifetime of the <a href="#Argument"><tt>Argument</tt></a>
-nodes, just like the <a href="#BasicBlock"><tt>BasicBlock</tt></a> list does for
-the <a href="#BasicBlock"><tt>BasicBlock</tt></a>s.</p>
-
-<p>The <a href="#SymbolTable"><tt>SymbolTable</tt></a> is a very rarely used
-LLVM feature that is only used when you have to look up a value by name.  Aside
-from that, the <a href="#SymbolTable"><tt>SymbolTable</tt></a> is used
-internally to make sure that there are not conflicts between the names of <a
-href="#Instruction"><tt>Instruction</tt></a>s, <a
-href="#BasicBlock"><tt>BasicBlock</tt></a>s, or <a
-href="#Argument"><tt>Argument</tt></a>s in the function body.</p>
-
-<p>Note that <tt>Function</tt> is a <a href="#GlobalValue">GlobalValue</a>
-and therefore also a <a href="#Constant">Constant</a>. The value of the function
-is its address (after linking) which is guaranteed to be constant.</p>
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="m_Function">Important Public Members of the <tt>Function</tt>
-  class</a>
-</div>
-
-<div class="doc_text">
-
-<ul>
-  <li><tt>Function(const </tt><tt><a href="#FunctionType">FunctionType</a>
-  *Ty, LinkageTypes Linkage, const std::string &amp;N = "", Module* Parent = 0)</tt>
-
-    <p>Constructor used when you need to create new <tt>Function</tt>s to add
-    the the program.  The constructor must specify the type of the function to
-    create and what type of linkage the function should have. The <a 
-    href="#FunctionType"><tt>FunctionType</tt></a> argument
-    specifies the formal arguments and return value for the function. The same
-    <a href="#FunctionType"><tt>FunctionType</tt></a> value can be used to
-    create multiple functions. The <tt>Parent</tt> argument specifies the Module
-    in which the function is defined. If this argument is provided, the function
-    will automatically be inserted into that module's list of
-    functions.</p></li>
-
-  <li><tt>bool isDeclaration()</tt>
-
-    <p>Return whether or not the <tt>Function</tt> has a body defined.  If the
-    function is "external", it does not have a body, and thus must be resolved
-    by linking with a function defined in a different translation unit.</p></li>
-
-  <li><tt>Function::iterator</tt> - Typedef for basic block list iterator<br>
-    <tt>Function::const_iterator</tt> - Typedef for const_iterator.<br>
-
-    <tt>begin()</tt>, <tt>end()</tt>
-    <tt>size()</tt>, <tt>empty()</tt>
-
-    <p>These are forwarding methods that make it easy to access the contents of
-    a <tt>Function</tt> object's <a href="#BasicBlock"><tt>BasicBlock</tt></a>
-    list.</p></li>
-
-  <li><tt>Function::BasicBlockListType &amp;getBasicBlockList()</tt>
-
-    <p>Returns the list of <a href="#BasicBlock"><tt>BasicBlock</tt></a>s.  This
-    is necessary to use when you need to update the list or perform a complex
-    action that doesn't have a forwarding method.</p></li>
-
-  <li><tt>Function::arg_iterator</tt> - Typedef for the argument list
-iterator<br>
-    <tt>Function::const_arg_iterator</tt> - Typedef for const_iterator.<br>
-
-    <tt>arg_begin()</tt>, <tt>arg_end()</tt>
-    <tt>arg_size()</tt>, <tt>arg_empty()</tt>
-
-    <p>These are forwarding methods that make it easy to access the contents of
-    a <tt>Function</tt> object's <a href="#Argument"><tt>Argument</tt></a>
-    list.</p></li>
-
-  <li><tt>Function::ArgumentListType &amp;getArgumentList()</tt>
-
-    <p>Returns the list of <a href="#Argument"><tt>Argument</tt></a>s.  This is
-    necessary to use when you need to update the list or perform a complex
-    action that doesn't have a forwarding method.</p></li>
-
-  <li><tt><a href="#BasicBlock">BasicBlock</a> &amp;getEntryBlock()</tt>
-
-    <p>Returns the entry <a href="#BasicBlock"><tt>BasicBlock</tt></a> for the
-    function.  Because the entry block for the function is always the first
-    block, this returns the first block of the <tt>Function</tt>.</p></li>
-
-  <li><tt><a href="#Type">Type</a> *getReturnType()</tt><br>
-    <tt><a href="#FunctionType">FunctionType</a> *getFunctionType()</tt>
-
-    <p>This traverses the <a href="#Type"><tt>Type</tt></a> of the
-    <tt>Function</tt> and returns the return type of the function, or the <a
-    href="#FunctionType"><tt>FunctionType</tt></a> of the actual
-    function.</p></li>
-
-  <li><tt><a href="#SymbolTable">SymbolTable</a> *getSymbolTable()</tt>
-
-    <p> Return a pointer to the <a href="#SymbolTable"><tt>SymbolTable</tt></a>
-    for this <tt>Function</tt>.</p></li>
-</ul>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="GlobalVariable">The <tt>GlobalVariable</tt> class</a>
-</div>
-
-<div class="doc_text">
-
-<p><tt>#include "<a
-href="/doxygen/GlobalVariable_8h-source.html">llvm/GlobalVariable.h</a>"</tt>
-<br>
-doxygen info: <a href="/doxygen/classllvm_1_1GlobalVariable.html">GlobalVariable
- Class</a><br>
-Superclasses: <a href="#GlobalValue"><tt>GlobalValue</tt></a>, 
-<a href="#Constant"><tt>Constant</tt></a>,
-<a href="#User"><tt>User</tt></a>,
-<a href="#Value"><tt>Value</tt></a></p>
-
-<p>Global variables are represented with the (surprise surprise)
-<tt>GlobalVariable</tt> class. Like functions, <tt>GlobalVariable</tt>s are also
-subclasses of <a href="#GlobalValue"><tt>GlobalValue</tt></a>, and as such are
-always referenced by their address (global values must live in memory, so their
-"name" refers to their constant address). See 
-<a href="#GlobalValue"><tt>GlobalValue</tt></a> for more on this.  Global 
-variables may have an initial value (which must be a 
-<a href="#Constant"><tt>Constant</tt></a>), and if they have an initializer, 
-they may be marked as "constant" themselves (indicating that their contents 
-never change at runtime).</p>
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="m_GlobalVariable">Important Public Members of the
-  <tt>GlobalVariable</tt> class</a>
-</div>
-
-<div class="doc_text">
-
-<ul>
-  <li><tt>GlobalVariable(const </tt><tt><a href="#Type">Type</a> *Ty, bool
-  isConstant, LinkageTypes&amp; Linkage, <a href="#Constant">Constant</a>
-  *Initializer = 0, const std::string &amp;Name = "", Module* Parent = 0)</tt>
-
-    <p>Create a new global variable of the specified type. If
-    <tt>isConstant</tt> is true then the global variable will be marked as
-    unchanging for the program. The Linkage parameter specifies the type of
-    linkage (internal, external, weak, linkonce, appending) for the variable.
-    If the linkage is InternalLinkage, WeakAnyLinkage, WeakODRLinkage,
-    LinkOnceAnyLinkage or LinkOnceODRLinkage,&nbsp; then the resultant
-    global variable will have internal linkage.  AppendingLinkage concatenates
-    together all instances (in different translation units) of the variable
-    into a single variable but is only applicable to arrays.  &nbsp;See
-    the <a href="LangRef.html#modulestructure">LLVM Language Reference</a> for
-    further details on linkage types. Optionally an initializer, a name, and the
-    module to put the variable into may be specified for the global variable as
-    well.</p></li>
-
-  <li><tt>bool isConstant() const</tt>
-
-    <p>Returns true if this is a global variable that is known not to
-    be modified at runtime.</p></li>
-
-  <li><tt>bool hasInitializer()</tt>
-
-    <p>Returns true if this <tt>GlobalVariable</tt> has an intializer.</p></li>
-
-  <li><tt><a href="#Constant">Constant</a> *getInitializer()</tt>
-
-    <p>Returns the initial value for a <tt>GlobalVariable</tt>.  It is not legal
-    to call this method if there is no initializer.</p></li>
-</ul>
-
-</div>
-
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="BasicBlock">The <tt>BasicBlock</tt> class</a>
-</div>
-
-<div class="doc_text">
-
-<p><tt>#include "<a
-href="/doxygen/BasicBlock_8h-source.html">llvm/BasicBlock.h</a>"</tt><br>
-doxygen info: <a href="/doxygen/classllvm_1_1BasicBlock.html">BasicBlock
-Class</a><br>
-Superclass: <a href="#Value"><tt>Value</tt></a></p>
-
-<p>This class represents a single entry multiple exit section of the code,
-commonly known as a basic block by the compiler community.  The
-<tt>BasicBlock</tt> class maintains a list of <a
-href="#Instruction"><tt>Instruction</tt></a>s, which form the body of the block.
-Matching the language definition, the last element of this list of instructions
-is always a terminator instruction (a subclass of the <a
-href="#TerminatorInst"><tt>TerminatorInst</tt></a> class).</p>
-
-<p>In addition to tracking the list of instructions that make up the block, the
-<tt>BasicBlock</tt> class also keeps track of the <a
-href="#Function"><tt>Function</tt></a> that it is embedded into.</p>
-
-<p>Note that <tt>BasicBlock</tt>s themselves are <a
-href="#Value"><tt>Value</tt></a>s, because they are referenced by instructions
-like branches and can go in the switch tables. <tt>BasicBlock</tt>s have type
-<tt>label</tt>.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="m_BasicBlock">Important Public Members of the <tt>BasicBlock</tt>
-  class</a>
-</div>
-
-<div class="doc_text">
-<ul>
-
-<li><tt>BasicBlock(const std::string &amp;Name = "", </tt><tt><a
- href="#Function">Function</a> *Parent = 0)</tt>
-
-<p>The <tt>BasicBlock</tt> constructor is used to create new basic blocks for
-insertion into a function.  The constructor optionally takes a name for the new
-block, and a <a href="#Function"><tt>Function</tt></a> to insert it into.  If
-the <tt>Parent</tt> parameter is specified, the new <tt>BasicBlock</tt> is
-automatically inserted at the end of the specified <a
-href="#Function"><tt>Function</tt></a>, if not specified, the BasicBlock must be
-manually inserted into the <a href="#Function"><tt>Function</tt></a>.</p></li>
-
-<li><tt>BasicBlock::iterator</tt> - Typedef for instruction list iterator<br>
-<tt>BasicBlock::const_iterator</tt> - Typedef for const_iterator.<br>
-<tt>begin()</tt>, <tt>end()</tt>, <tt>front()</tt>, <tt>back()</tt>,
-<tt>size()</tt>, <tt>empty()</tt>
-STL-style functions for accessing the instruction list.
-
-<p>These methods and typedefs are forwarding functions that have the same
-semantics as the standard library methods of the same names.  These methods
-expose the underlying instruction list of a basic block in a way that is easy to
-manipulate.  To get the full complement of container operations (including
-operations to update the list), you must use the <tt>getInstList()</tt>
-method.</p></li>
-
-<li><tt>BasicBlock::InstListType &amp;getInstList()</tt>
-
-<p>This method is used to get access to the underlying container that actually
-holds the Instructions.  This method must be used when there isn't a forwarding
-function in the <tt>BasicBlock</tt> class for the operation that you would like
-to perform.  Because there are no forwarding functions for "updating"
-operations, you need to use this if you want to update the contents of a
-<tt>BasicBlock</tt>.</p></li>
-
-<li><tt><a href="#Function">Function</a> *getParent()</tt>
-
-<p> Returns a pointer to <a href="#Function"><tt>Function</tt></a> the block is
-embedded into, or a null pointer if it is homeless.</p></li>
-
-<li><tt><a href="#TerminatorInst">TerminatorInst</a> *getTerminator()</tt>
-
-<p> Returns a pointer to the terminator instruction that appears at the end of
-the <tt>BasicBlock</tt>.  If there is no terminator instruction, or if the last
-instruction in the block is not a terminator, then a null pointer is
-returned.</p></li>
-
-</ul>
-
-</div>
-
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="Argument">The <tt>Argument</tt> class</a>
-</div>
-
-<div class="doc_text">
-
-<p>This subclass of Value defines the interface for incoming formal
-arguments to a function. A Function maintains a list of its formal
-arguments. An argument has a pointer to the parent Function.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<hr>
-<address>
-  <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
-  src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS"></a>
-  <a href="http://validator.w3.org/check/referer"><img
-  src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01 Strict"></a>
-
-  <a href="mailto:dhurjati at cs.uiuc.edu">Dinakar Dhurjati</a> and
-  <a href="mailto:sabre at nondot.org">Chris Lattner</a><br>
-  <a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
-  Last modified: $Date$
-</address>
-
-</body>
-</html>
diff --git a/libclamav/c++/llvm/docs/Projects.html b/libclamav/c++/llvm/docs/Projects.html
deleted file mode 100644
index ada6196..0000000
--- a/libclamav/c++/llvm/docs/Projects.html
+++ /dev/null
@@ -1,460 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-                      "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-  <title>Creating an LLVM Project</title>
-  <link rel="stylesheet" href="llvm.css" type="text/css">
-</head>
-<body>
-
-<div class="doc_title">Creating an LLVM Project</div>
-
-<ol>
-<li><a href="#overview">Overview</a></li>
-<li><a href="#create">Create a project from the Sample Project</a></li>
-<li><a href="#source">Source tree layout</a></li>
-<li><a href="#makefiles">Writing LLVM-style Makefiles</a>
-  <ol>
-  <li><a href="#reqVars">Required Variables</a></li>
-  <li><a href="#varsBuildDir">Variables for Building Subdirectories</a></li>
-  <li><a href="#varsBuildLib">Variables for Building Libraries</a></li>
-  <li><a href="#varsBuildProg">Variables for Building Programs</a></li>
-  <li><a href="#miscVars">Miscellaneous Variables</a></li>
-  </ol></li>
-<li><a href="#objcode">Placement of object code</a></li>
-<li><a href="#help">Further help</a></li>
-</ol>
-
-<div class="doc_author">
-  <p>Written by John Criswell</p>
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="overview">Overview</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>The LLVM build system is designed to facilitate the building of third party
-projects that use LLVM header files, libraries, and tools.  In order to use
-these facilities, a Makefile from a project must do the following things:</p>
-
-<ol>
-  <li>Set <tt>make</tt> variables. There are several variables that a Makefile
-  needs to set to use the LLVM build system:
-  <ul>
-    <li><tt>PROJECT_NAME</tt> - The name by which your project is known.</li>
-    <li><tt>LLVM_SRC_ROOT</tt> - The root of the LLVM source tree.</li>
-    <li><tt>LLVM_OBJ_ROOT</tt> - The root of the LLVM object tree.</li>
-    <li><tt>PROJ_SRC_ROOT</tt> - The root of the project's source tree.</li>
-    <li><tt>PROJ_OBJ_ROOT</tt> - The root of the project's object tree.</li>
-    <li><tt>PROJ_INSTALL_ROOT</tt> - The root installation directory.</li>
-    <li><tt>LEVEL</tt> - The relative path from the current directory to the 
-    project's root ($PROJ_OBJ_ROOT).</li>
-  </ul></li>
-  <li>Include <tt>Makefile.config</tt> from <tt>$(LLVM_OBJ_ROOT)</tt>.</li>
-  <li>Include <tt>Makefile.rules</tt> from <tt>$(LLVM_SRC_ROOT)</tt>.</li>
-</ol>
-
-<p>There are two ways that you can set all of these variables:</p>
-<ol>
-  <li>You can write your own Makefiles which hard-code these values.</li>
-  <li>You can use the pre-made LLVM sample project. This sample project 
-  includes Makefiles, a configure script that can be used to configure the 
-  location of LLVM, and the ability to support multiple object directories 
-  from a single source directory.</li>
-</ol>
-
-<p>This document assumes that you will base your project on the LLVM sample
-project found in <tt>llvm/projects/sample</tt>.  If you want to devise your own
-build system, studying the sample project and LLVM Makefiles will probably
-provide enough information on how to write your own Makefiles.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="create">Create a Project from the Sample Project</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>Follow these simple steps to start your project:</p>
-
-<ol>
-<li>Copy the <tt>llvm/projects/sample</tt> directory to any place of your
-choosing.  You can place it anywhere you like.  Rename the directory to match
-the name of your project.</li>
-
-<li>
-If you downloaded LLVM using Subversion, remove all the directories named .svn 
-(and all the files therein) from your project's new source tree.  This will 
-keep Subversion from thinking that your project is inside 
-<tt>llvm/trunk/projects/sample</tt>.</li>
-
-<li>Add your source code and Makefiles to your source tree.</li>
-
-<li>If you want your project to be configured with the <tt>configure</tt> script
-then you need to edit <tt>autoconf/configure.ac</tt> as follows:
-  <ul>
-    <li><b>AC_INIT</b>. Place the name of your project, its version number and
-    a contact email address for your project as the arguments to this macro</li>
-    <li><b>AC_CONFIG_AUX_DIR</b>. If your project isn't in the
-    <tt>llvm/projects</tt> directory then you might need to adjust this so that
-    it specifies a relative path to the <tt>llvm/autoconf</tt> directory.</li>
-    <li><b>LLVM_CONFIG_PROJECT</b>. Just leave this alone.</li>
-    <li><b>AC_CONFIG_SRCDIR</b>. Specify a path to a file name that identifies
-    your project; or just leave it at <tt>Makefile.common.in</tt></li>
-    <li><b>AC_CONFIG_FILES</b>. Do not change.</li>
-    <li><b>AC_CONFIG_MAKEFILE</b>. Use one of these macros for each Makefile
-    that your project uses. This macro arranges for your makefiles to be copied
-    from the source directory, unmodified, to the build directory.</li>
-  </ul>
-</li>
-
-<li>After updating <tt>autoconf/configure.ac</tt>, regenerate the
-configure script with these commands:
-
-<div class="doc_code">
-<p><tt>% cd autoconf<br>
-       % ./AutoRegen.sh</tt></p>
-</div>
-
-<p>You must be using Autoconf version 2.59 or later and your aclocal version
-should be 1.9 or later.</p></li>
-
-<li>Run <tt>configure</tt> in the directory in which you want to place
-object code.  Use the following options to tell your project where it
-can find LLVM:
-
-  <dl>
-    <dt><tt>--with-llvmsrc=&lt;directory&gt;</tt></dt>
-    <dd>Tell your project where the LLVM source tree is located.</dd>
-    <dt><br><tt>--with-llvmobj=&lt;directory&gt;</tt></dt>
-    <dd>Tell your project where the LLVM object tree is located.</dd>
-    <dt><br><tt>--prefix=&lt;directory&gt;</tt></dt>
-    <dd>Tell your project where it should get installed.</dd>
-  </dl>
-</ol>
-
-<p>That's it!  Now all you have to do is type <tt>gmake</tt> (or <tt>make</tt>
-if your on a GNU/Linux system) in the root of your object directory, and your 
-project should build.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="source">Source Tree Layout</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>In order to use the LLVM build system, you will want to organize your
-source code so that it can benefit from the build system's features.
-Mainly, you want your source tree layout to look similar to the LLVM
-source tree layout.  The best way to do this is to just copy the
-project tree from <tt>llvm/projects/sample</tt> and modify it to meet
-your needs, but you can certainly add to it if you want.</p>
-
-<p>Underneath your top level directory, you should have the following
-directories:</p>
-
-<dl>
-  <dt><b>lib</b>
-  <dd>
-  This subdirectory should contain all of your library source
-  code.  For each library that you build, you will have one
-  directory in <b>lib</b> that will contain that library's source
-  code.
-
-  <p>
-  Libraries can be object files, archives, or dynamic libraries.
-  The <b>lib</b> directory is just a convenient place for libraries
-  as it places them all in a directory from which they can be linked
-  later.
-
-  <dt><b>include</b>
-  <dd>
-  This subdirectory should contain any header files that are
-  global to your project.  By global, we mean that they are used
-  by more than one library or executable of your project.
-  <p>
-  By placing your header files in <b>include</b>, they will be
-  found automatically by the LLVM build system.  For example, if
-  you have a file <b>include/jazz/note.h</b>, then your source
-  files can include it simply with <b>#include "jazz/note.h"</b>.
-
-  <dt><b>tools</b>
-  <dd>
-  This subdirectory should contain all of your source
-  code for executables.  For each program that you build, you
-  will have one directory in <b>tools</b> that will contain that
-  program's source code.
-  <p>
-
-  <dt><b>test</b>
-  <dd>
-  This subdirectory should contain tests that verify that your code
-  works correctly.  Automated tests are especially useful.
-  <p>
-  Currently, the LLVM build system provides basic support for tests.
-  The LLVM system provides the following:
-  <ul>
-    <li>
-    LLVM provides a tcl procedure that is used by Dejagnu to run
-    tests.  It can be found in <tt>llvm/lib/llvm-dg.exp</tt>.  This
-    test procedure uses RUN lines in the actual test case to determine
-    how to run the test.  See the <a
-    href="TestingGuide.html">TestingGuide</a> for more details. You
-    can easily write Makefile support similar to the Makefiles in 
-    <tt>llvm/test</tt> to use Dejagnu to run your project's tests.<br></li>
-    <li>
-    LLVM contains an optional package called <tt>llvm-test</tt>
-    which provides benchmarks and programs that are known to compile with the
-    LLVM GCC front ends.  You can use these
-    programs to test your code, gather statistics information, and
-    compare it to the current LLVM performance statistics.
-    <br>Currently, there is no way to hook your tests directly into the
-    <tt>llvm/test</tt> testing harness.  You will simply
-    need to find a way to use the source provided within that directory
-    on your own.
-  </ul>
-</dl>
-
-<p>Typically, you will want to build your <b>lib</b> directory first followed by
-your <b>tools</b> directory.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="makefiles">Writing LLVM Style Makefiles</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>The LLVM build system provides a convenient way to build libraries and
-executables.  Most of your project Makefiles will only need to define a few
-variables.  Below is a list of the variables one can set and what they can
-do:</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="reqVars">Required Variables</a>
-</div>
-
-<div class="doc_text">
-
-<dl>
-  <dt>LEVEL
-  <dd>
-  This variable is the relative path from this Makefile to the
-  top directory of your project's source code.  For example, if
-  your source code is in <tt>/tmp/src</tt>, then the Makefile in
-  <tt>/tmp/src/jump/high</tt> would set <tt>LEVEL</tt> to <tt>"../.."</tt>.
-</dl>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="varsBuildDir">Variables for Building Subdirectories</a>
-</div>
-
-<div class="doc_text">
-
-<dl>
-  <dt>DIRS
-  <dd>
-  This is a space separated list of subdirectories that should be
-  built.  They will be built, one at a time, in the order
-  specified.
-  <p>
-
-  <dt>PARALLEL_DIRS
-  <dd>
-  This is a list of directories that can be built in parallel.
-  These will be built after the directories in DIRS have been
-  built.
-  <p>
-
-  <dt>OPTIONAL_DIRS
-  <dd>
-  This is a list of directories that can be built if they exist,
-  but will not cause an error if they do not exist.  They are
-  built serially in the order in which they are listed.
-</dl>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="varsBuildLib">Variables for Building Libraries</a>
-</div>
-
-<div class="doc_text">
-
-<dl>
-  <dt>LIBRARYNAME
-  <dd>
-  This variable contains the base name of the library that will
-  be built.  For example, to build a library named
-  <tt>libsample.a</tt>, LIBRARYNAME should be set to
-  <tt>sample</tt>.
-  <p>
-
-  <dt>BUILD_ARCHIVE
-  <dd>
-  By default, a library is a <tt>.o</tt> file that is linked
-  directly into a program.  To build an archive (also known as
-  a static library), set the BUILD_ARCHIVE variable.
-  <p>
-
-  <dt>SHARED_LIBRARY
-  <dd>
-  If SHARED_LIBRARY is defined in your Makefile, a shared
-  (or dynamic) library will be built.
-</dl>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="varsBuildProg">Variables for Building Programs</a>
-</div>
-
-<div class="doc_text">
-
-<dl>
-  <dt>TOOLNAME
-  <dd>
-  This variable contains the name of the program that will
-  be built.  For example, to build an executable named
-  <tt>sample</tt>, TOOLNAME should be set to <tt>sample</tt>.
-  <p>
-
-  <dt>USEDLIBS
-  <dd>
-  This variable holds a space separated list of libraries that
-  should be linked into the program.  These libraries must either
-  be LLVM libraries or libraries that come from your <b>lib</b>
-  directory.  The libraries must be specified by their base name.
-  For example, to link libsample.a, you would set USEDLIBS to
-  <tt>sample</tt>.
-  <p>
-  Note that this works only for statically linked libraries.
-  <p>
-
-  <dt>LIBS
-  <dd>
-  To link dynamic libraries, add <tt>-l&lt;library base name&gt;</tt> to
-  the LIBS variable.  The LLVM build system will look in the same places
-  for dynamic libraries as it does for static libraries.
-  <p>
-  For example, to link <tt>libsample.so</tt>, you would have the
-  following line in your <tt>Makefile</tt>:
-  <p>
-  <tt>
-  LIBS += -lsample
-  </tt>
-</dl>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="miscVars">Miscellaneous Variables</a>
-</div>
-
-<div class="doc_text">
-
-<dl>
-  <dt>ExtraSource
-  <dd>
-  This variable contains a space separated list of extra source
-  files that need to be built.  It is useful for including the
-  output of Lex and Yacc programs.
-  <p>
-
-  <dt>CFLAGS
-  <dt>CPPFLAGS
-  <dd>
-  This variable can be used to add options to the C and C++
-  compiler, respectively.  It is typically used to add options
-  that tell the compiler the location of additional directories
-  to search for header files.
-  <p>
-  It is highly suggested that you append to CFLAGS and CPPFLAGS as
-  opposed to overwriting them.  The master Makefiles may already
-  have useful options in them that you may not want to overwrite.
-  <p>
-</dl>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="objcode">Placement of Object Code</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>The final location of built libraries and executables will depend upon
-whether you do a Debug, Release, or Profile build.</p>
-
-<dl>
-  <dt>Libraries
-  <dd>
-  All libraries (static and dynamic) will be stored in
-  <tt>PROJ_OBJ_ROOT/&lt;type&gt;/lib</tt>, where type is <tt>Debug</tt>,
-  <tt>Release</tt>, or <tt>Profile</tt> for a debug, optimized, or
-  profiled build, respectively.<p>
-
-  <dt>Executables
-  <dd>All executables will be stored in
-  <tt>PROJ_OBJ_ROOT/&lt;type&gt;/bin</tt>, where type is <tt>Debug</tt>,
-  <tt>Release</tt>, or <tt>Profile</tt> for a debug, optimized, or profiled
-  build, respectively.
-</dl>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="help">Further Help</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>If you have any questions or need any help creating an LLVM project,
-the LLVM team would be more than happy to help.  You can always post your
-questions to the <a
-href="http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev">LLVM Developers
-Mailing List</a>.</p>
-
-</div>
-  
-<!-- *********************************************************************** -->
-<hr>
-<address>
-  <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
-  src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS"></a>
-  <a href="http://validator.w3.org/check/referer"><img
-  src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
-
-  <a href="mailto:criswell at uiuc.edu">John Criswell</a><br>
-  <a href="http://llvm.org">The LLVM Compiler Infrastructure</a>
-  <br>
-  Last modified: $Date$
-</address>
-
-</body>
-</html>
diff --git a/libclamav/c++/llvm/docs/ReleaseNotes.html b/libclamav/c++/llvm/docs/ReleaseNotes.html
deleted file mode 100644
index 88c7de0..0000000
--- a/libclamav/c++/llvm/docs/ReleaseNotes.html
+++ /dev/null
@@ -1,999 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-                      "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-  <link rel="stylesheet" href="llvm.css" type="text/css">
-  <title>LLVM 2.7 Release Notes</title>
-</head>
-<body>
-
-<div class="doc_title">LLVM 2.7 Release Notes</div>
-
-<ol>
-  <li><a href="#intro">Introduction</a></li>
-  <li><a href="#subproj">Sub-project Status Update</a></li>
-  <li><a href="#externalproj">External Projects Using LLVM 2.7</a></li>
-  <li><a href="#whatsnew">What's New in LLVM 2.7?</a></li>
-  <li><a href="GettingStarted.html">Installation Instructions</a></li>
-  <li><a href="#portability">Portability and Supported Platforms</a></li>
-  <li><a href="#knownproblems">Known Problems</a></li>
-  <li><a href="#additionalinfo">Additional Information</a></li>
-</ol>
-
-<div class="doc_author">
-  <p>Written by the <a href="http://llvm.org">LLVM Team</a></p>
-</div>
-
-<h1 style="color:red">These are in-progress notes for the upcoming LLVM 2.7
-release.<br>
-You may prefer the
-<a href="http://llvm.org/releases/2.6/docs/ReleaseNotes.html">LLVM 2.6
-Release Notes</a>.</h1>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="intro">Introduction</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>This document contains the release notes for the LLVM Compiler
-Infrastructure, release 2.7.  Here we describe the status of LLVM, including
-major improvements from the previous release and significant known problems.
-All LLVM releases may be downloaded from the <a
-href="http://llvm.org/releases/">LLVM releases web site</a>.</p>
-
-<p>For more information about LLVM, including information about the latest
-release, please check out the <a href="http://llvm.org/">main LLVM
-web site</a>.  If you have questions or comments, the <a
-href="http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev">LLVM Developer's Mailing
-List</a> is a good place to send them.</p>
-
-<p>Note that if you are reading this file from a Subversion checkout or the
-main LLVM web page, this document applies to the <i>next</i> release, not the
-current one.  To see the release notes for a specific release, please see the
-<a href="http://llvm.org/releases/">releases page</a>.</p>
-
-</div>
- 
-
-<!--
-Almost dead code.
-  include/llvm/Analysis/LiveValues.h => Dan
-  lib/Transforms/IPO/MergeFunctions.cpp => consider for 2.8.
-  llvm/Analysis/PointerTracking.h => Edwin wants this, consider for 2.8.
-  ABCD, SCCVN, GEPSplitterPass
-  MSIL backend?
--->
- 
-   
-<!-- Features that need text if they're finished for 2.7:
-  gcc plugin.
-  strong phi elim
-  variable debug info for optimized code
-  postalloc scheduler: anti dependence breaking, hazard recognizer?
-  metadata
-  loop dependence analysis
-  ELF Writer?  How stable?
-  <li>PostRA scheduler improvements, ARM adoption (David Goodwin).</li>
-  2.7 supports the GDB 7.0 jit interfaces for debug info.
-  2.7 eliminates ADT/iterator.h
- -->
-
- <!-- for announcement email:
- Logo web page.
- llvm devmtg
- compiler_rt
- KLEE web page at klee.llvm.org
- Many new papers added to /pubs/
-   Mention gcc plugin.
-
-   -->
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="subproj">Sub-project Status Update</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-<p>
-The LLVM 2.7 distribution currently consists of code from the core LLVM
-repository (which roughly includes the LLVM optimizers, code generators
-and supporting tools), the Clang repository and the llvm-gcc repository.  In
-addition to this code, the LLVM Project includes other sub-projects that are in
-development.  Here we include updates on these subprojects.
-</p>
-
-</div>
-
-
-<!--=========================================================================-->
-<div class="doc_subsection">
-<a name="clang">Clang: C/C++/Objective-C Frontend Toolkit</a>
-</div>
-
-<div class="doc_text">
-
-<p>The <a href="http://clang.llvm.org/">Clang project</a> is ...</p>
-
-<p>In the LLVM 2.7 time-frame, the Clang team has made many improvements:</p>
-
-<ul>
-<li>...</li>
-</ul>
-</div>
-
-<!--=========================================================================-->
-<div class="doc_subsection">
-<a name="clangsa">Clang Static Analyzer</a>
-</div>
-
-<div class="doc_text">
-
-<p>Previously announced in the 2.4, 2.5, and 2.6 LLVM releases, the Clang project also
-includes an early stage static source code analysis tool for <a
-href="http://clang.llvm.org/StaticAnalysis.html">automatically finding bugs</a>
-in C and Objective-C programs. The tool performs checks to find
-bugs that occur on a specific path within a program.</p>
-
-<p>In the LLVM 2.7 time-frame, the analyzer core has ...</p>
-
-</div>
-
-<!--=========================================================================-->
-<div class="doc_subsection">
-<a name="vmkit">VMKit: JVM/CLI Virtual Machine Implementation</a>
-</div>
-
-<div class="doc_text">
-<p>
-The <a href="http://vmkit.llvm.org/">VMKit project</a> is an implementation of
-a JVM and a CLI Virtual Machine (Microsoft .NET is an
-implementation of the CLI) using LLVM for static and just-in-time
-compilation.</p>
-
-<p>
-VMKit version ?? builds with LLVM 2.7 and you can find it on its
-<a href="http://vmkit.llvm.org/releases/">web page</a>. The release includes
-bug fixes, cleanup and new features. The major changes are:</p>
-
-<ul>
-
-<li>...</li>
-
-</ul>
-</div>
-
-
-<!--=========================================================================-->
-<div class="doc_subsection">
-<a name="compiler-rt">compiler-rt: Compiler Runtime Library</a>
-</div>
-
-<div class="doc_text">
-<p>
-The new LLVM <a href="http://compiler-rt.llvm.org/">compiler-rt project</a>
-is a simple library that provides an implementation of the low-level
-target-specific hooks required by code generation and other runtime components.
-For example, when compiling for a 32-bit target, converting a double to a 64-bit
-unsigned integer is compiled into a runtime call to the "__fixunsdfdi"
-function. The compiler-rt library provides highly optimized implementations of
-this and other low-level routines (some are 3x faster than the equivalent
-libgcc routines).</p>
-
-<p>
-All of the code in the compiler-rt project is available under the standard LLVM
-License, a "BSD-style" license.</p>
-
-</div>
-
-<!--=========================================================================-->
-<div class="doc_subsection">
-<a name="klee">KLEE: Symbolic Execution and Automatic Test Case Generator</a>
-</div>
-
-<div class="doc_text">
-<p>
-The new LLVM <a href="http://klee.llvm.org/">KLEE project</a> is a symbolic
-execution framework for programs in LLVM bitcode form.  KLEE tries to
-symbolically evaluate "all" paths through the application and records state
-transitions that lead to fault states.  This allows it to construct testcases
-that lead to faults and can even be used to verify algorithms.  For more
-details, please see the <a
-href="http://llvm.org/pubs/2008-12-OSDI-KLEE.html">OSDI 2008 paper</a> about
-KLEE.</p>
-
-</div>
-
-<!--=========================================================================-->
-<div class="doc_subsection">
-<a name="dragonegg">DragonEgg: GCC-4.5 as an LLVM frontend</a>
-</div>
-
-<div class="doc_text">
-<p>
-The goal of <a href="http://dragonegg.llvm.org/">DragonEgg</a> is to make
-gcc-4.5 act like llvm-gcc without requiring any gcc modifications whatsoever.
-<a href="http://dragonegg.llvm.org/">DragonEgg</a> is a shared library (dragonegg.so)
-that is loaded by gcc at runtime.  It ...
-</p>
-
-</div>
-
-
-<!--=========================================================================-->
-<div class="doc_subsection">
-<a name="mc">llvm-mc: Machine Code Toolkit</a>
-</div>
-
-<div class="doc_text">
-<p>
-The LLVM Machine Code (MC) Toolkit project is ...
-</p>
-
-</div>	
-
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="externalproj">External Open Source Projects Using LLVM 2.7</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>An exciting aspect of LLVM is that it is used as an enabling technology for
-   a lot of other language and tools projects.  This section lists some of the
-   projects that have already been updated to work with LLVM 2.7.</p>
-</div>
-
-
-<!--=========================================================================-->
-<div class="doc_subsection">
-<a name="Rubinius">Rubinius</a>
-</div>
-
-<div class="doc_text">
-<p><a href="http://github.com/evanphx/rubinius">Rubinius</a> is an environment
-for running Ruby code which strives to write as much of the core class
-implementation in Ruby as possible. Combined with a bytecode interpreting VM, it
-uses LLVM to optimize and compile ruby code down to machine code. Techniques
-such as type feedback, method inlining, and uncommon traps are all used to
-remove dynamism from ruby execution and increase performance.</p>
-
-<p>Since LLVM 2.5, Rubinius has made several major leaps forward, implementing
-a counter based JIT, type feedback and speculative method inlining.
-</p>
-
-</div>
-
-<!--=========================================================================-->
-<div class="doc_subsection">
-<a name="macruby">MacRuby</a>
-</div>
-
-<div class="doc_text">
-
-<p>
-<a href="http://macruby.org">MacRuby</a> is an implementation of Ruby on top of
-core Mac OS X technologies, such as the Objective-C common runtime and garbage
-collector and the CoreFoundation framework. It is principally developed by
-Apple and aims at enabling the creation of full-fledged Mac OS X applications.
-</p>
-
-<p>
-MacRuby uses LLVM for optimization passes, JIT and AOT compilation of Ruby
-expressions. It also uses zero-cost DWARF exceptions to implement Ruby exception
-handling.</p>
-
-</div>
-
-
-<!--=========================================================================-->
-<div class="doc_subsection">
-<a name="pure">Pure</a>
-</div>
-
-<div class="doc_text">
-<p>
-<a href="http://pure-lang.googlecode.com/">Pure</a>
-is an algebraic/functional programming language based on term rewriting.
-Programs are collections of equations which are used to evaluate expressions in
-a symbolic fashion. Pure offers dynamic typing, eager and lazy evaluation,
-lexical closures, a hygienic macro system (also based on term rewriting),
-built-in list and matrix support (including list and matrix comprehensions) and
-an easy-to-use C interface. The interpreter uses LLVM as a backend to
- JIT-compile Pure programs to fast native code.</p>
-
-<p>Pure versions ??? and later have been tested and are known to work with
-LLVM 2.7 (and continue to work with older LLVM releases >= 2.3 as well).
-</p>
-</div>
-
-
-<!--=========================================================================-->
-<div class="doc_subsection">
-<a name="ldc">LLVM D Compiler</a>
-</div>
-
-<div class="doc_text">
-<p>
-<a href="http://www.dsource.org/projects/ldc">LDC</a> is an implementation of
-the D Programming Language using the LLVM optimizer and code generator.
-The LDC project works great with the LLVM 2.6 release.  General improvements in
-this
-cycle have included new inline asm constraint handling, better debug info
-support, general bug fixes and better x86-64 support.  This has allowed
-some major improvements in LDC, getting it much closer to being as
-fully featured as the original DMD compiler from DigitalMars.
-</p>
-</div>
-
-<!--=========================================================================-->
-<div class="doc_subsection">
-<a name="RoadsendPHP">Roadsend PHP</a>
-</div>
-
-<div class="doc_text">
-<p>
-<a href="http://code.roadsend.com/rphp">Roadsend PHP</a> (rphp) is an open
-source implementation of the PHP programming 
-language that uses LLVM for its optimizer, JIT and static compiler. This is a 
-reimplementation of an earlier project that is now based on LLVM.</p>
-</div>
-
-<!--=========================================================================-->
-<div class="doc_subsection">
-<a name="UnladenSwallow">Unladen Swallow</a>
-</div>
-
-<div class="doc_text">
-<p>
-<a href="http://code.google.com/p/unladen-swallow/">Unladen Swallow</a> is a
-branch of <a href="http://python.org/">Python</a> intended to be fully
-compatible and significantly faster.  It uses LLVM's optimization passes and JIT
-compiler.</p>
-</div>
-
-<!--=========================================================================-->
-<div class="doc_subsection">
-<a name="llvm-lua">llvm-lua</a>
-</div>
-
-<div class="doc_text">
-<p>
-<a href="http://code.google.com/p/llvm-lua/">LLVM-Lua</a> uses LLVM to add JIT
-and static compiling support to the Lua VM.  Lua bytecode is analyzed to
-remove type checks, then LLVM is used to compile the bytecode down to machine
-code.</p>
-</div>
-
-<!--=========================================================================-->
-<div class="doc_subsection">
-<a name="icedtea">IcedTea Java Virtual Machine Implementation</a>
-</div>
-
-<div class="doc_text">
-<p>
-<a href="http://icedtea.classpath.org/wiki/Main_Page">IcedTea</a> provides a
-harness to build OpenJDK using only free software build tools and to provide
-replacements for the not-yet free parts of OpenJDK.  One of the extensions that
-IcedTea provides is a new JIT compiler named <a
-href="http://icedtea.classpath.org/wiki/ZeroSharkFaq">Shark</a> which uses LLVM
-to provide native code generation without introducing processor-dependent
-code.
-</p>
-</div>
-
-
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="whatsnew">What's New in LLVM 2.7?</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>This release includes a huge number of bug fixes, performance tweaks and
-minor improvements.  Some of the major improvements and new features are listed
-in this section.
-</p>
-
-</div>
-
-<!--=========================================================================-->
-<div class="doc_subsection">
-<a name="majorfeatures">Major New Features</a>
-</div>
-
-<div class="doc_text">
-
-<p>LLVM 2.7 includes several major new capabilities:</p>
-
-<ul>
-<li>...</li>
-</ul>
-
-</div>
-
-<!--=========================================================================-->
-<div class="doc_subsection">
-<a name="coreimprovements">LLVM IR and Core Improvements</a>
-</div>
-
-<div class="doc_text">
-<p>LLVM IR has several new features for better support of new targets and that
-expose new optimization opportunities:</p>
-
-<ul>
-<li>...</li>
-</ul>
-
-</div>
-
-<!--=========================================================================-->
-<div class="doc_subsection">
-<a name="optimizer">Optimizer Improvements</a>
-</div>
-
-<div class="doc_text">
-
-<p>In addition to a large array of minor performance tweaks and bug fixes, this
-release includes a few major enhancements and additions to the optimizers:</p>
-
-<ul>
-
-<li>...</li>
-
-</ul>
-
-</div>
-
-
-<!--=========================================================================-->
-<div class="doc_subsection">
-<a name="executionengine">Interpreter and JIT Improvements</a>
-</div>
-
-<div class="doc_text">
-
-<ul>
-<li>The JIT now <a
-href="http://llvm.org/viewvc/llvm-project?view=rev&revision=85295">defaults
-to compiling eagerly</a> to avoid a race condition in the lazy JIT.
-Clients that still want the lazy JIT can switch it on by calling
-<tt>ExecutionEngine::DisableLazyCompilation(false)</tt>.</li>
-<li>It is now possible to create more than one JIT instance in the same process.
-These JITs can generate machine code in parallel,
-although <a href="http://llvm.org/docs/ProgrammersManual.html#jitthreading">you
-still have to obey the other threading restrictions</a>.</li>
-</ul>
-
-</div>
-
-<!--=========================================================================-->
-<div class="doc_subsection">
-<a name="codegen">Target Independent Code Generator Improvements</a>
-</div>
-
-<div class="doc_text">
-
-<p>We have put a significant amount of work into the code generator
-infrastructure, which allows us to implement more aggressive algorithms and make
-it run faster:</p>
-
-<ul>
-
-<li>...</li>
-</ul>
-</div>
-
-<!--=========================================================================-->
-<div class="doc_subsection">
-<a name="x86">X86-32 and X86-64 Target Improvements</a>
-</div>
-
-<div class="doc_text">
-<p>New features of the X86 target include:
-</p>
-
-<ul>
-
-<li>...</li>
-
-</ul>
-
-</div>
-
-<!--=========================================================================-->
-<div class="doc_subsection">
-<a name="pic16">PIC16 Target Improvements</a>
-</div>
-
-<div class="doc_text">
-<p>New features of the PIC16 target include:
-</p>
-
-<ul>
-<li>...</li>
-</ul>
-
-<p>Things not yet supported:</p>
-
-<ul>
-<li>Variable arguments.</li>
-<li>Interrupts/programs.</li>
-</ul>
-
-</div>
-
-<!--=========================================================================-->
-<div class="doc_subsection">
-<a name="ARM">ARM Target Improvements</a>
-</div>
-
-<div class="doc_text">
-<p>New features of the ARM target include:
-</p>
-
-<ul>
-
-<li>...</li>
-</ul>
-
-
-</div>
-
-<!--=========================================================================-->
-<div class="doc_subsection">
-<a name="OtherTarget">Other Target Specific Improvements</a>
-</div>
-
-<div class="doc_text">
-<p>New features of other targets include:
-</p>
-
-<ul>
-<li>...</li>
-</ul>
-
-</div>
-
-<!--=========================================================================-->
-<div class="doc_subsection">
-<a name="newapis">New Useful APIs</a>
-</div>
-
-<div class="doc_text">
-
-<p>This release includes a number of new APIs that are used internally, which
-   may also be useful for external clients.
-</p>
-
-<ul>
-<li>...</li>
-</ul>
-
-
-</div>
-
-<!--=========================================================================-->
-<div class="doc_subsection">
-<a name="otherimprovements">Other Improvements and New Features</a>
-</div>
-
-<div class="doc_text">
-<p>Other miscellaneous features include:</p>
-
-<ul>
-<li>...</li>
-</ul>
-
-</div>
-
-
-<!--=========================================================================-->
-<div class="doc_subsection">
-<a name="changes">Major Changes and Removed Features</a>
-</div>
-
-<div class="doc_text">
-
-<p>If you're already an LLVM user or developer with out-of-tree changes based
-on LLVM 2.6, this section lists some "gotchas" that you may run into upgrading
-from the previous release.</p>
-
-<ul>
-<li>The LLVM interpreter now defaults to <em>not</em> using <tt>libffi</tt> even
-if you have it installed.  This makes it more likely that an LLVM built on one
-system will work when copied to a similar system.  To use <tt>libffi</tt>,
-configure with <tt>--enable-libffi</tt>.
-</li>
-</ul>
-
-
-<p>In addition, many APIs have changed in this release.  Some of the major LLVM
-API changes are:</p>
-
-<ul>
-<li><tt>ModuleProvider</tt> has been <a
-href="http://llvm.org/viewvc/llvm-project?view=rev&revision=94686">removed</a>
-and its methods moved to <tt>Module</tt> and <tt>GlobalValue</tt>.
-Most clients can remove uses of <tt>ExistingModuleProvider</tt>,
-replace <tt>getBitcodeModuleProvider</tt> with
-<tt>getLazyBitcodeModule</tt>, and pass their <tt>Module</tt> to
-functions that used to accept <tt>ModuleProvider</tt>.  Clients who
-wrote their own <tt>ModuleProvider</tt>s will need to derive from
-<tt>GVMaterializer</tt> instead and use
-<tt>Module::setMaterializer</tt> to attach it to a
-<tt>Module</tt>.</li>
-
-<li><tt>GhostLinkage</tt> has given up the ghost.
-<tt>GlobalValue</tt>s that have not yet been read from their backing
-storage have the same linkage they will have after being read in.
-Clients must replace calls to
-<tt>GlobalValue::hasNotBeenReadFromBitcode</tt> with
-<tt>GlobalValue::isMaterializable</tt>.</li>
-
-<li>FIXME: Debug info has been totally redone. Add pointers to new APIs. Substantial caveats about compatibility of .ll and .bc files.</li>
-
-<li>The <tt>llvm/Support/DataTypes.h</tt> header has moved
-to <tt>llvm/System/DataTypes.h</tt>.</li>
-
-</ul>
-
-</div>
-
-
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="portability">Portability and Supported Platforms</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>LLVM is known to work on the following platforms:</p>
-
-<ul>
-<li>Intel and AMD machines (IA32, X86-64, AMD64, EMT-64) running Red Hat
-    Linux, Fedora Core, FreeBSD and AuroraUX (and probably other unix-like
-    systems).</li>
-<li>PowerPC and X86-based Mac OS X systems, running 10.3 and above in 32-bit
-    and 64-bit modes.</li>
-<li>Intel and AMD machines running on Win32 using MinGW libraries (native).</li>
-<li>Intel and AMD machines running on Win32 with the Cygwin libraries (limited
-    support is available for native builds with Visual C++).</li>
-<li>Sun x86 and AMD64 machines running Solaris 10, OpenSolaris 0906.</li>
-<li>Alpha-based machines running Debian GNU/Linux.</li>
-</ul>
-
-<p>The core LLVM infrastructure uses GNU autoconf to adapt itself
-to the machine and operating system on which it is built.  However, minor
-porting may be required to get LLVM to work on new platforms.  We welcome your
-portability patches and reports of successful builds or error messages.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="knownproblems">Known Problems</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>This section contains significant known problems with the LLVM system,
-listed by component.  If you run into a problem, please check the <a
-href="http://llvm.org/bugs/">LLVM bug database</a> and submit a bug if
-there isn't already one.</p>
-
-<ul>
-<li>The llvm-gcc bootstrap will fail with some versions of binutils (e.g. 2.15)
-    with a message of "<tt><a href="http://llvm.org/PR5004">Error: can not do 8
-    byte pc-relative relocation</a></tt>" when building C++ code.  We intend to
-    fix this on mainline, but a workaround is to upgrade to binutils 2.17 or
-    later.</li>
-    
-<li>LLVM will not correctly compile on Solaris and/or OpenSolaris
-using the stock GCC 3.x.x series 'out the box',
-See: <a href="GettingStarted.html#brokengcc">Broken versions of GCC and other tools</a>.
-However, A <a href="http://pkg.auroraux.org/GCC">Modern GCC Build</a>
-for x86/x86-64 has been made available from the third party AuroraUX Project
-that has been meticulously tested for bootstrapping LLVM &amp; Clang.</li>
-</ul>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="experimental">Experimental features included with this release</a>
-</div>
-
-<div class="doc_text">
-
-<p>The following components of this LLVM release are either untested, known to
-be broken or unreliable, or are in early development.  These components should
-not be relied on, and bugs should not be filed against them, but they may be
-useful to some people.  In particular, if you would like to work on one of these
-components, please contact us on the <a
-href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">LLVMdev list</a>.</p>
-
-<ul>
-<li>The MSIL, Alpha, SPU, MIPS, PIC16, Blackfin, MSP430 and SystemZ backends are
-    experimental.</li>
-<li>The <tt>llc</tt> "<tt>-filetype=asm</tt>" (the default) is the only
-    supported value for this option.  The ELF writer is experimental.</li>
-<li>The implementation of Andersen's Alias Analysis has many known bugs.</li>
-</ul>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="x86-be">Known problems with the X86 back-end</a>
-</div>
-
-<div class="doc_text">
-
-<ul>
-  <li>The X86 backend does not yet support
-    all <a href="http://llvm.org/PR879">inline assembly that uses the X86
-    floating point stack</a>.  It supports the 'f' and 't' constraints, but not
-    'u'.</li>
-  <li>The X86 backend generates inefficient floating point code when configured
-    to generate code for systems that don't have SSE2.</li>
-  <li>Win64 code generation wasn't widely tested. Everything should work, but we
-    expect small issues to happen. Also, llvm-gcc cannot build the mingw64
-    runtime currently due
-    to <a href="http://llvm.org/PR2255">several</a>
-    <a href="http://llvm.org/PR2257">bugs</a> and due to lack of support for
-    the
-    'u' inline assembly constraint and for X87 floating point inline assembly.</li>
-  <li>The X86-64 backend does not yet support the LLVM IR instruction
-      <tt>va_arg</tt>. Currently, the llvm-gcc and front-ends support variadic
-      argument constructs on X86-64 by lowering them manually.</li>
-</ul>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="ppc-be">Known problems with the PowerPC back-end</a>
-</div>
-
-<div class="doc_text">
-
-<ul>
-<li>The Linux PPC32/ABI support needs testing for the interpreter and static
-compilation, and lacks support for debug information.</li>
-</ul>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="arm-be">Known problems with the ARM back-end</a>
-</div>
-
-<div class="doc_text">
-
-<ul>
-<li>Support for the Advanced SIMD (Neon) instruction set is still incomplete
-and not well tested.  Some features may not work at all, and the code quality
-may be poor in some cases.</li>
-<li>Thumb mode works only on ARMv6 or higher processors. On sub-ARMv6
-processors, thumb programs can crash or produce wrong
-results (<a href="http://llvm.org/PR1388">PR1388</a>).</li>
-<li>Compilation for ARM Linux OABI (old ABI) is supported but not fully tested.
-</li>
-</ul>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="sparc-be">Known problems with the SPARC back-end</a>
-</div>
-
-<div class="doc_text">
-
-<ul>
-<li>The SPARC backend only supports the 32-bit SPARC ABI (-m32); it does not
-    support the 64-bit SPARC ABI (-m64).</li>
-</ul>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="mips-be">Known problems with the MIPS back-end</a>
-</div>
-
-<div class="doc_text">
-
-<ul>
-<li>64-bit MIPS targets are not supported yet.</li>
-</ul>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="alpha-be">Known problems with the Alpha back-end</a>
-</div>
-
-<div class="doc_text">
-
-<ul>
-
-<li>On 21164s, some rare FP arithmetic sequences which may trap do not have the
-appropriate nops inserted to ensure restartability.</li>
-
-</ul>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="c-be">Known problems with the C back-end</a>
-</div>
-
-<div class="doc_text">
-
-<ul>
-<li><a href="http://llvm.org/PR802">The C backend has only basic support for
-    inline assembly code</a>.</li>
-<li><a href="http://llvm.org/PR1658">The C backend violates the ABI of common
-    C++ programs</a>, preventing intermixing between C++ compiled by the CBE and
-    C++ code compiled with <tt>llc</tt> or native compilers.</li>
-<li>The C backend does not support all exception handling constructs.</li>
-<li>The C backend does not support arbitrary precision integers.</li>
-</ul>
-
-</div>
-
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="c-fe">Known problems with the llvm-gcc C front-end</a>
-</div>
-
-<div class="doc_text">
-
-<p>The only major language feature of GCC not supported by llvm-gcc is
-    the <tt>__builtin_apply</tt> family of builtins.   However, some extensions
-    are only supported on some targets.  For example, trampolines are only
-    supported on some targets (these are used when you take the address of a
-    nested function).</p>
-
-<p>If you run into GCC extensions which are not supported, please let us know.
-</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="c++-fe">Known problems with the llvm-gcc C++ front-end</a>
-</div>
-
-<div class="doc_text">
-
-<p>The C++ front-end is considered to be fully
-tested and works for a number of non-trivial programs, including LLVM
-itself, Qt, Mozilla, etc.</p>
-
-<ul>
-<li>Exception handling works well on the X86 and PowerPC targets. Currently
-  only Linux and Darwin targets are supported (both 32 and 64 bit).</li>
-</ul>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="fortran-fe">Known problems with the llvm-gcc Fortran front-end</a>
-</div>
-
-<div class="doc_text">
-<ul>
-<li>Fortran support generally works, but there are still several unresolved bugs
-    in <a href="http://llvm.org/bugs/">Bugzilla</a>.  Please see the
-    tools/gfortran component for details.</li>
-</ul>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="ada-fe">Known problems with the llvm-gcc Ada front-end</a>
-</div>
-
-<div class="doc_text">
-The llvm-gcc 4.2 Ada compiler works fairly well; however, this is not a mature
-technology, and problems should be expected.
-<ul>
-<li>The Ada front-end currently only builds on X86-32.  This is mainly due
-to lack of trampoline support (pointers to nested functions) on other platforms.
-However, it <a href="http://llvm.org/PR2006">also fails to build on X86-64</a>
-which does support trampolines.</li>
-<li>The Ada front-end <a href="http://llvm.org/PR2007">fails to bootstrap</a>.
-This is due to lack of LLVM support for <tt>setjmp</tt>/<tt>longjmp</tt> style
-exception handling, which is used internally by the compiler.
-Workaround: configure with <tt>--disable-bootstrap</tt>.</li>
-<li>The c380004, <a href="http://llvm.org/PR2010">c393010</a>
-and <a href="http://llvm.org/PR2421">cxg2021</a> ACATS tests fail
-(c380004 also fails with gcc-4.2 mainline).
-If the compiler is built with checks disabled then <a href="http://llvm.org/PR2010">c393010</a>
-causes the compiler to go into an infinite loop, using up all system memory.</li>
-<li>Some GCC specific Ada tests continue to crash the compiler.</li>
-<li>The <tt>-E</tt> binder option (exception backtraces)
-<a href="http://llvm.org/PR1982">does not work</a> and will result in programs
-crashing if an exception is raised.  Workaround: do not use <tt>-E</tt>.</li>
-<li>Only discrete types <a href="http://llvm.org/PR1981">are allowed to start
-or finish at a non-byte offset</a> in a record.  Workaround: do not pack records
-or use representation clauses that result in a field of a non-discrete type
-starting or finishing in the middle of a byte.</li>
-<li>The <tt>lli</tt> interpreter <a href="http://llvm.org/PR2009">considers
-'main' as generated by the Ada binder to be invalid</a>.
-Workaround: hand edit the file to use pointers for <tt>argv</tt> and
-<tt>envp</tt> rather than integers.</li>
-<li>The <tt>-fstack-check</tt> option <a href="http://llvm.org/PR2008">is
-ignored</a>.</li>
-</ul>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-	<a name="ocaml-bindings">Known problems with the O'Caml bindings</a>
-</div>
-
-<div class="doc_text">
-
-<p>The <tt>Llvm.Linkage</tt> module is broken, and has incorrect values. Only
-<tt>Llvm.Linkage.External</tt>, <tt>Llvm.Linkage.Available_externally</tt>, and
-<tt>Llvm.Linkage.Link_once</tt> will be correct. If you need any of the other linkage
-modes, you'll have to write an external C library in order to expose the
-functionality. This has been fixed in the trunk.</p>
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="additionalinfo">Additional Information</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>A wide variety of additional information is available on the <a
-href="http://llvm.org">LLVM web page</a>, in particular in the <a
-href="http://llvm.org/docs/">documentation</a> section.  The web page also
-contains versions of the API documentation which is up-to-date with the
-Subversion version of the source code.
-You can access versions of these documents specific to this release by going
-into the "<tt>llvm/doc/</tt>" directory in the LLVM tree.</p>
-
-<p>If you have any questions or comments about LLVM, please feel free to contact
-us via the <a href="http://llvm.org/docs/#maillist"> mailing
-lists</a>.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-
-<hr>
-<address>
-  <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
-  src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS"></a>
-  <a href="http://validator.w3.org/check/referer"><img
-  src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
-
-  <a href="http://llvm.org/">LLVM Compiler Infrastructure</a><br>
-  Last modified: $Date$
-</address>
-
-</body>
-</html>
diff --git a/libclamav/c++/llvm/docs/SourceLevelDebugging.html b/libclamav/c++/llvm/docs/SourceLevelDebugging.html
deleted file mode 100644
index b028ee6..0000000
--- a/libclamav/c++/llvm/docs/SourceLevelDebugging.html
+++ /dev/null
@@ -1,1745 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-                      "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-  <title>Source Level Debugging with LLVM</title>
-  <link rel="stylesheet" href="llvm.css" type="text/css">
-</head>
-<body>
-
-<div class="doc_title">Source Level Debugging with LLVM</div>
-
-<table class="layout" style="width:100%">
-  <tr class="layout">
-    <td class="left">
-<ul>
-  <li><a href="#introduction">Introduction</a>
-  <ol>
-    <li><a href="#phil">Philosophy behind LLVM debugging information</a></li>
-    <li><a href="#consumers">Debug information consumers</a></li>
-    <li><a href="#debugopt">Debugging optimized code</a></li>
-  </ol></li>
-  <li><a href="#format">Debugging information format</a>
-  <ol>
-    <li><a href="#debug_info_descriptors">Debug information descriptors</a>
-    <ul>
-      <li><a href="#format_compile_units">Compile unit descriptors</a></li>
-      <li><a href="#format_global_variables">Global variable descriptors</a></li>
-      <li><a href="#format_subprograms">Subprogram descriptors</a></li>
-      <li><a href="#format_blocks">Block descriptors</a></li>
-      <li><a href="#format_basic_type">Basic type descriptors</a></li>
-      <li><a href="#format_derived_type">Derived type descriptors</a></li>
-      <li><a href="#format_composite_type">Composite type descriptors</a></li>
-      <li><a href="#format_subrange">Subrange descriptors</a></li>
-      <li><a href="#format_enumeration">Enumerator descriptors</a></li>
-      <li><a href="#format_variables">Local variables</a></li>
-    </ul></li>
-    <li><a href="#format_common_intrinsics">Debugger intrinsic functions</a>
-      <ul>
-      <li><a href="#format_common_declare">llvm.dbg.declare</a></li>
-      <li><a href="#format_common_value">llvm.dbg.value</a></li>
-    </ul></li>
-  </ol></li>
-  <li><a href="#format_common_lifetime">Object lifetimes and scoping</a></li>
-  <li><a href="#ccxx_frontend">C/C++ front-end specific debug information</a>
-  <ol>
-    <li><a href="#ccxx_compile_units">C/C++ source file information</a></li>
-    <li><a href="#ccxx_global_variable">C/C++ global variable information</a></li>
-    <li><a href="#ccxx_subprogram">C/C++ function information</a></li>
-    <li><a href="#ccxx_basic_types">C/C++ basic types</a></li>
-    <li><a href="#ccxx_derived_types">C/C++ derived types</a></li>
-    <li><a href="#ccxx_composite_types">C/C++ struct/union types</a></li>
-    <li><a href="#ccxx_enumeration_types">C/C++ enumeration types</a></li>
-  </ol></li>
-</ul>
-</td>
-<td class="right">
-<img src="img/venusflytrap.jpg" alt="A leafy and green bug eater" width="247"
-height="369">
-</td>
-</tr></table>
-
-<div class="doc_author">
-  <p>Written by <a href="mailto:sabre at nondot.org">Chris Lattner</a>
-            and <a href="mailto:jlaskey at mac.com">Jim Laskey</a></p>
-</div>
-
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="introduction">Introduction</a></div> 
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>This document is the central repository for all information pertaining to
-   debug information in LLVM.  It describes the <a href="#format">actual format
-   that the LLVM debug information</a> takes, which is useful for those
-   interested in creating front-ends or dealing directly with the information.
-   Further, this document provides specific examples of what debug information
-   for C/C++.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="phil">Philosophy behind LLVM debugging information</a>
-</div>
-
-<div class="doc_text">
-
-<p>The idea of the LLVM debugging information is to capture how the important
-   pieces of the source-language's Abstract Syntax Tree map onto LLVM code.
-   Several design aspects have shaped the solution that appears here.  The
-   important ones are:</p>
-
-<ul>
-  <li>Debugging information should have very little impact on the rest of the
-      compiler.  No transformations, analyses, or code generators should need to
-      be modified because of debugging information.</li>
-
-  <li>LLVM optimizations should interact in <a href="#debugopt">well-defined and
-      easily described ways</a> with the debugging information.</li>
-
-  <li>Because LLVM is designed to support arbitrary programming languages,
-      LLVM-to-LLVM tools should not need to know anything about the semantics of
-      the source-level-language.</li>
-
-  <li>Source-level languages are often <b>widely</b> different from one another.
-      LLVM should not put any restrictions of the flavor of the source-language,
-      and the debugging information should work with any language.</li>
-
-  <li>With code generator support, it should be possible to use an LLVM compiler
-      to compile a program to native machine code and standard debugging
-      formats.  This allows compatibility with traditional machine-code level
-      debuggers, like GDB or DBX.</li>
-</ul>
-
-<p>The approach used by the LLVM implementation is to use a small set
-   of <a href="#format_common_intrinsics">intrinsic functions</a> to define a
-   mapping between LLVM program objects and the source-level objects.  The
-   description of the source-level program is maintained in LLVM metadata
-   in an <a href="#ccxx_frontend">implementation-defined format</a>
-   (the C/C++ front-end currently uses working draft 7 of
-   the <a href="http://www.eagercon.com/dwarf/dwarf3std.htm">DWARF 3
-   standard</a>).</p>
-
-<p>When a program is being debugged, a debugger interacts with the user and
-   turns the stored debug information into source-language specific information.
-   As such, a debugger must be aware of the source-language, and is thus tied to
-   a specific language or family of languages.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="consumers">Debug information consumers</a>
-</div>
-
-<div class="doc_text">
-
-<p>The role of debug information is to provide meta information normally
-   stripped away during the compilation process.  This meta information provides
-   an LLVM user a relationship between generated code and the original program
-   source code.</p>
-
-<p>Currently, debug information is consumed by the DwarfWriter to produce dwarf
-   information used by the gdb debugger.  Other targets could use the same
-   information to produce stabs or other debug forms.</p>
-
-<p>It would also be reasonable to use debug information to feed profiling tools
-   for analysis of generated code, or, tools for reconstructing the original
-   source from generated code.</p>
-
-<p>TODO - expound a bit more.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="debugopt">Debugging optimized code</a>
-</div>
-
-<div class="doc_text">
-
-<p>An extremely high priority of LLVM debugging information is to make it
-   interact well with optimizations and analysis.  In particular, the LLVM debug
-   information provides the following guarantees:</p>
-
-<ul>
-  <li>LLVM debug information <b>always provides information to accurately read
-      the source-level state of the program</b>, regardless of which LLVM
-      optimizations have been run, and without any modification to the
-      optimizations themselves.  However, some optimizations may impact the
-      ability to modify the current state of the program with a debugger, such
-      as setting program variables, or calling functions that have been
-      deleted.</li>
-
-  <li>LLVM optimizations gracefully interact with debugging information.  If
-      they are not aware of debug information, they are automatically disabled
-      as necessary in the cases that would invalidate the debug info.  This
-      retains the LLVM features, making it easy to write new
-      transformations.</li>
-
-  <li>As desired, LLVM optimizations can be upgraded to be aware of the LLVM
-      debugging information, allowing them to update the debugging information
-      as they perform aggressive optimizations.  This means that, with effort,
-      the LLVM optimizers could optimize debug code just as well as non-debug
-      code.</li>
-
-  <li>LLVM debug information does not prevent many important optimizations from
-      happening (for example inlining, basic block reordering/merging/cleanup,
-      tail duplication, etc), further reducing the amount of the compiler that
-      eventually is "aware" of debugging information.</li>
-
-  <li>LLVM debug information is automatically optimized along with the rest of
-      the program, using existing facilities.  For example, duplicate
-      information is automatically merged by the linker, and unused information
-      is automatically removed.</li>
-</ul>
-
-<p>Basically, the debug information allows you to compile a program with
-   "<tt>-O0 -g</tt>" and get full debug information, allowing you to arbitrarily
-   modify the program as it executes from a debugger.  Compiling a program with
-   "<tt>-O3 -g</tt>" gives you full debug information that is always available
-   and accurate for reading (e.g., you get accurate stack traces despite tail
-   call elimination and inlining), but you might lose the ability to modify the
-   program and call functions where were optimized out of the program, or
-   inlined away completely.</p>
-
-<p><a href="TestingGuide.html#quicktestsuite">LLVM test suite</a> provides a
-   framework to test optimizer's handling of debugging information. It can be
-   run like this:</p>
-
-<div class="doc_code">
-<pre>
-% cd llvm/projects/test-suite/MultiSource/Benchmarks  # or some other level
-% make TEST=dbgopt
-</pre>
-</div>
-
-<p>This will test impact of debugging information on optimization passes. If
-   debugging information influences optimization passes then it will be reported
-   as a failure. See <a href="TestingGuide.html">TestingGuide</a> for more
-   information on LLVM test infrastructure and how to run various tests.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="format">Debugging information format</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>LLVM debugging information has been carefully designed to make it possible
-   for the optimizer to optimize the program and debugging information without
-   necessarily having to know anything about debugging information.  In
-   particular, te use of metadadta avoids duplicated dubgging information from
-   the beginning, and the global dead code elimination pass automatically 
-   deletes debugging information for a function if it decides to delete the 
-   function. </p>
-
-<p>To do this, most of the debugging information (descriptors for types,
-   variables, functions, source files, etc) is inserted by the language
-   front-end in the form of LLVM metadata. </p>
-
-<p>Debug information is designed to be agnostic about the target debugger and
-   debugging information representation (e.g. DWARF/Stabs/etc).  It uses a
-   generic pass to decode the information that represents variables, types, 
-   functions, namespaces, etc: this allows for arbitrary source-language 
-   semantics and type-systems to be used, as long as there is a module 
-   written for the target debugger to interpret the information. </p>
-
-<p>To provide basic functionality, the LLVM debugger does have to make some
-   assumptions about the source-level language being debugged, though it keeps
-   these to a minimum.  The only common features that the LLVM debugger assumes
-   exist are <a href="#format_compile_units">source files</a>,
-   and <a href="#format_global_variables">program objects</a>.  These abstract
-   objects are used by a debugger to form stack traces, show information about
-   local variables, etc.</p>
-
-<p>This section of the documentation first describes the representation aspects
-   common to any source-language.  The <a href="#ccxx_frontend">next section</a>
-   describes the data layout conventions used by the C and C++ front-ends.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="debug_info_descriptors">Debug information descriptors</a>
-</div>
-
-<div class="doc_text">
-
-<p>In consideration of the complexity and volume of debug information, LLVM
-   provides a specification for well formed debug descriptors. </p>
-
-<p>Consumers of LLVM debug information expect the descriptors for program
-   objects to start in a canonical format, but the descriptors can include
-   additional information appended at the end that is source-language
-   specific. All LLVM debugging information is versioned, allowing backwards
-   compatibility in the case that the core structures need to change in some
-   way.  Also, all debugging information objects start with a tag to indicate
-   what type of object it is.  The source-language is allowed to define its own
-   objects, by using unreserved tag numbers.  We recommend using with tags in
-   the range 0x1000 through 0x2000 (there is a defined enum DW_TAG_user_base =
-   0x1000.)</p>
-
-<p>The fields of debug descriptors used internally by LLVM 
-   are restricted to only the simple data types <tt>int</tt>, <tt>uint</tt>,
-   <tt>bool</tt>, <tt>float</tt>, <tt>double</tt>, <tt>mdstring</tt> and
-   <tt>mdnode</tt>. </p>
-
-<div class="doc_code">
-<pre>
-!1 = metadata !{
-  uint,   ;; A tag
-  ...
-}
-</pre>
-</div>
-
-<p><a name="LLVMDebugVersion">The first field of a descriptor is always an
-   <tt>uint</tt> containing a tag value identifying the content of the
-   descriptor.  The remaining fields are specific to the descriptor.  The values
-   of tags are loosely bound to the tag values of DWARF information entries.
-   However, that does not restrict the use of the information supplied to DWARF
-   targets.  To facilitate versioning of debug information, the tag is augmented
-   with the current debug version (LLVMDebugVersion = 7 << 16 or 0x70000 or
-   458752.)</a></p>
-
-<p>The details of the various descriptors follow.</p>  
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection">
-  <a name="format_compile_units">Compile unit descriptors</a>
-</div>
-
-<div class="doc_text">
-
-<div class="doc_code">
-<pre>
-!0 = metadata !{
-  i32,       ;; Tag = 17 + <a href="#LLVMDebugVersion">LLVMDebugVersion</a> 
-             ;; (DW_TAG_compile_unit)
-  i32,       ;; Unused field. 
-  i32,       ;; DWARF language identifier (ex. DW_LANG_C89) 
-  metadata,  ;; Source file name
-  metadata,  ;; Source file directory (includes trailing slash)
-  metadata   ;; Producer (ex. "4.0.1 LLVM (LLVM research group)")
-  i1,        ;; True if this is a main compile unit. 
-  i1,        ;; True if this is optimized.
-  metadata,  ;; Flags
-  i32        ;; Runtime version
-}
-</pre>
-</div>
-
-<p>These descriptors contain a source language ID for the file (we use the DWARF
-   3.0 ID numbers, such as <tt>DW_LANG_C89</tt>, <tt>DW_LANG_C_plus_plus</tt>,
-   <tt>DW_LANG_Cobol74</tt>, etc), three strings describing the filename,
-   working directory of the compiler, and an identifier string for the compiler
-   that produced it.</p>
-
-<p>Compile unit descriptors provide the root context for objects declared in a
-   specific source file.  Global variables and top level functions would be
-   defined using this context. Compile unit descriptors also provide context
-   for source line correspondence.</p>
-
-<p>Each input file is encoded as a separate compile unit in LLVM debugging
-   information output. However, many target specific tool chains prefer to
-   encode only one compile unit in an object file. In this situation, the LLVM
-   code generator will include debugging information entities in the compile
-   unit that is marked as main compile unit. The code generator accepts maximum
-   one main compile unit per module. If a module does not contain any main
-   compile unit then the code generator will emit multiple compile units in the
-   output object file.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection">
-  <a name="format_global_variables">Global variable descriptors</a>
-</div>
-
-<div class="doc_text">
-
-<div class="doc_code">
-<pre>
-!1 = metadata !{
-  i32,      ;; Tag = 52 + <a href="#LLVMDebugVersion">LLVMDebugVersion</a> 
-            ;; (DW_TAG_variable)
-  i32,      ;; Unused field.
-  metadata, ;; Reference to context descriptor
-  metadata, ;; Name
-  metadata, ;; Display name (fully qualified C++ name)
-  metadata, ;; MIPS linkage name (for C++)
-  metadata, ;; Reference to compile unit where defined
-  i32,      ;; Line number where defined
-  metadata, ;; Reference to type descriptor
-  i1,       ;; True if the global is local to compile unit (static)
-  i1,       ;; True if the global is defined in the compile unit (not extern)
-  {  }*     ;; Reference to the global variable
-}
-</pre>
-</div>
-
-<p>These descriptors provide debug information about globals variables.  The
-provide details such as name, type and where the variable is defined.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection">
-  <a name="format_subprograms">Subprogram descriptors</a>
-</div>
-
-<div class="doc_text">
-
-<div class="doc_code">
-<pre>
-!2 = metadata !{
-  i32,      ;; Tag = 46 + <a href="#LLVMDebugVersion">LLVMDebugVersion</a>
-            ;; (DW_TAG_subprogram)
-  i32,      ;; Unused field.
-  metadata, ;; Reference to context descriptor
-  metadata, ;; Name
-  metadata, ;; Display name (fully qualified C++ name)
-  metadata, ;; MIPS linkage name (for C++)
-  metadata, ;; Reference to compile unit where defined
-  i32,      ;; Line number where defined
-  metadata, ;; Reference to type descriptor
-  i1,       ;; True if the global is local to compile unit (static)
-  i1        ;; True if the global is defined in the compile unit (not extern)
-}
-</pre>
-</div>
-
-<p>These descriptors provide debug information about functions, methods and
-   subprograms.  They provide details such as name, return types and the source
-   location where the subprogram is defined.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection">
-  <a name="format_blocks">Block descriptors</a>
-</div>
-
-<div class="doc_text">
-
-<div class="doc_code">
-<pre>
-!3 = metadata !{
-  i32,     ;; Tag = 13 + <a href="#LLVMDebugVersion">LLVMDebugVersion</a> (DW_TAG_lexical_block)
-  metadata ;; Reference to context descriptor
-}
-</pre>
-</div>
-
-<p>These descriptors provide debug information about nested blocks within a
-   subprogram.  The array of member descriptors is used to define local
-   variables and deeper nested blocks.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection">
-  <a name="format_basic_type">Basic type descriptors</a>
-</div>
-
-<div class="doc_text">
-
-<div class="doc_code">
-<pre>
-!4 = metadata !{
-  i32,      ;; Tag = 36 + <a href="#LLVMDebugVersion">LLVMDebugVersion</a> 
-            ;; (DW_TAG_base_type)
-  metadata, ;; Reference to context (typically a compile unit)
-  metadata, ;; Name (may be "" for anonymous types)
-  metadata, ;; Reference to compile unit where defined (may be NULL)
-  i32,      ;; Line number where defined (may be 0)
-  i64,      ;; Size in bits
-  i64,      ;; Alignment in bits
-  i64,      ;; Offset in bits
-  i32,      ;; Flags
-  i32       ;; DWARF type encoding
-}
-</pre>
-</div>
-
-<p>These descriptors define primitive types used in the code. Example int, bool
-   and float.  The context provides the scope of the type, which is usually the
-   top level.  Since basic types are not usually user defined the compile unit
-   and line number can be left as NULL and 0.  The size, alignment and offset
-   are expressed in bits and can be 64 bit values.  The alignment is used to
-   round the offset when embedded in a
-   <a href="#format_composite_type">composite type</a> (example to keep float
-   doubles on 64 bit boundaries.) The offset is the bit offset if embedded in
-   a <a href="#format_composite_type">composite type</a>.</p>
-
-<p>The type encoding provides the details of the type.  The values are typically
-   one of the following:</p>
-
-<div class="doc_code">
-<pre>
-DW_ATE_address       = 1
-DW_ATE_boolean       = 2
-DW_ATE_float         = 4
-DW_ATE_signed        = 5
-DW_ATE_signed_char   = 6
-DW_ATE_unsigned      = 7
-DW_ATE_unsigned_char = 8
-</pre>
-</div>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection">
-  <a name="format_derived_type">Derived type descriptors</a>
-</div>
-
-<div class="doc_text">
-
-<div class="doc_code">
-<pre>
-!5 = metadata !{
-  i32,      ;; Tag (see below)
-  metadata, ;; Reference to context
-  metadata, ;; Name (may be "" for anonymous types)
-  metadata, ;; Reference to compile unit where defined (may be NULL)
-  i32,      ;; Line number where defined (may be 0)
-  i32,      ;; Size in bits
-  i32,      ;; Alignment in bits
-  i32,      ;; Offset in bits
-  metadata  ;; Reference to type derived from
-}
-</pre>
-</div>
-
-<p>These descriptors are used to define types derived from other types.  The
-value of the tag varies depending on the meaning.  The following are possible
-tag values:</p>
-
-<div class="doc_code">
-<pre>
-DW_TAG_formal_parameter = 5
-DW_TAG_member           = 13
-DW_TAG_pointer_type     = 15
-DW_TAG_reference_type   = 16
-DW_TAG_typedef          = 22
-DW_TAG_const_type       = 38
-DW_TAG_volatile_type    = 53
-DW_TAG_restrict_type    = 55
-</pre>
-</div>
-
-<p><tt>DW_TAG_member</tt> is used to define a member of
-   a <a href="#format_composite_type">composite type</a>
-   or <a href="#format_subprograms">subprogram</a>.  The type of the member is
-   the <a href="#format_derived_type">derived
-   type</a>. <tt>DW_TAG_formal_parameter</tt> is used to define a member which
-   is a formal argument of a subprogram.</p>
-
-<p><tt>DW_TAG_typedef</tt> is used to provide a name for the derived type.</p>
-
-<p><tt>DW_TAG_pointer_type</tt>,<tt>DW_TAG_reference_type</tt>,
-   <tt>DW_TAG_const_type</tt>, <tt>DW_TAG_volatile_type</tt>
-   and <tt>DW_TAG_restrict_type</tt> are used to qualify
-   the <a href="#format_derived_type">derived type</a>. </p>
-
-<p><a href="#format_derived_type">Derived type</a> location can be determined
-   from the compile unit and line number.  The size, alignment and offset are
-   expressed in bits and can be 64 bit values.  The alignment is used to round
-   the offset when embedded in a <a href="#format_composite_type">composite
-   type</a> (example to keep float doubles on 64 bit boundaries.) The offset is
-   the bit offset if embedded in a <a href="#format_composite_type">composite
-   type</a>.</p>
-
-<p>Note that the <tt>void *</tt> type is expressed as a
-   <tt>llvm.dbg.derivedtype.type</tt> with tag of <tt>DW_TAG_pointer_type</tt>
-   and <tt>NULL</tt> derived type.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection">
-  <a name="format_composite_type">Composite type descriptors</a>
-</div>
-
-<div class="doc_text">
-
-<div class="doc_code">
-<pre>
-!6 = metadata !{
-  i32,      ;; Tag (see below)
-  metadata, ;; Reference to context
-  metadata, ;; Name (may be "" for anonymous types)
-  metadata, ;; Reference to compile unit where defined (may be NULL)
-  i32,      ;; Line number where defined (may be 0)
-  i64,      ;; Size in bits
-  i64,      ;; Alignment in bits
-  i64,      ;; Offset in bits
-  i32,      ;; Flags
-  metadata, ;; Reference to type derived from
-  metadata, ;; Reference to array of member descriptors
-  i32       ;; Runtime languages
-}
-</pre>
-</div>
-
-<p>These descriptors are used to define types that are composed of 0 or more
-elements.  The value of the tag varies depending on the meaning.  The following
-are possible tag values:</p>
-
-<div class="doc_code">
-<pre>
-DW_TAG_array_type       = 1
-DW_TAG_enumeration_type = 4
-DW_TAG_structure_type   = 19
-DW_TAG_union_type       = 23
-DW_TAG_vector_type      = 259
-DW_TAG_subroutine_type  = 21
-DW_TAG_inheritance      = 28
-</pre>
-</div>
-
-<p>The vector flag indicates that an array type is a native packed vector.</p>
-
-<p>The members of array types (tag = <tt>DW_TAG_array_type</tt>) or vector types
-   (tag = <tt>DW_TAG_vector_type</tt>) are <a href="#format_subrange">subrange
-   descriptors</a>, each representing the range of subscripts at that level of
-   indexing.</p>
-
-<p>The members of enumeration types (tag = <tt>DW_TAG_enumeration_type</tt>) are
-   <a href="#format_enumeration">enumerator descriptors</a>, each representing
-   the definition of enumeration value for the set.</p>
-
-<p>The members of structure (tag = <tt>DW_TAG_structure_type</tt>) or union (tag
-   = <tt>DW_TAG_union_type</tt>) types are any one of
-   the <a href="#format_basic_type">basic</a>,
-   <a href="#format_derived_type">derived</a>
-   or <a href="#format_composite_type">composite</a> type descriptors, each
-   representing a field member of the structure or union.</p>
-
-<p>For C++ classes (tag = <tt>DW_TAG_structure_type</tt>), member descriptors
-   provide information about base classes, static members and member
-   functions. If a member is a <a href="#format_derived_type">derived type
-   descriptor</a> and has a tag of <tt>DW_TAG_inheritance</tt>, then the type
-   represents a base class. If the member of is
-   a <a href="#format_global_variables">global variable descriptor</a> then it
-   represents a static member.  And, if the member is
-   a <a href="#format_subprograms">subprogram descriptor</a> then it represents
-   a member function.  For static members and member
-   functions, <tt>getName()</tt> returns the members link or the C++ mangled
-   name.  <tt>getDisplayName()</tt> the simplied version of the name.</p>
-
-<p>The first member of subroutine (tag = <tt>DW_TAG_subroutine_type</tt>) type
-   elements is the return type for the subroutine.  The remaining elements are
-   the formal arguments to the subroutine.</p>
-
-<p><a href="#format_composite_type">Composite type</a> location can be
-   determined from the compile unit and line number.  The size, alignment and
-   offset are expressed in bits and can be 64 bit values.  The alignment is used
-   to round the offset when embedded in
-   a <a href="#format_composite_type">composite type</a> (as an example, to keep
-   float doubles on 64 bit boundaries.) The offset is the bit offset if embedded
-   in a <a href="#format_composite_type">composite type</a>.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection">
-  <a name="format_subrange">Subrange descriptors</a>
-</div>
-
-<div class="doc_text">
-
-<div class="doc_code">
-<pre>
-%<a href="#format_subrange">llvm.dbg.subrange.type</a> = type {
-  i32,    ;; Tag = 33 + <a href="#LLVMDebugVersion">LLVMDebugVersion</a> (DW_TAG_subrange_type)
-  i64,    ;; Low value
-  i64     ;; High value
-}
-</pre>
-</div>
-
-<p>These descriptors are used to define ranges of array subscripts for an array
-   <a href="#format_composite_type">composite type</a>.  The low value defines
-   the lower bounds typically zero for C/C++.  The high value is the upper
-   bounds.  Values are 64 bit.  High - low + 1 is the size of the array.  If low
-   == high the array will be unbounded.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection">
-  <a name="format_enumeration">Enumerator descriptors</a>
-</div>
-
-<div class="doc_text">
-
-<div class="doc_code">
-<pre>
-!6 = metadata !{
-  i32,      ;; Tag = 40 + <a href="#LLVMDebugVersion">LLVMDebugVersion</a> 
-            ;; (DW_TAG_enumerator)
-  metadata, ;; Name
-  i64       ;; Value
-}
-</pre>
-</div>
-
-<p>These descriptors are used to define members of an
-   enumeration <a href="#format_composite_type">composite type</a>, it
-   associates the name to the value.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection">
-  <a name="format_variables">Local variables</a>
-</div>
-
-<div class="doc_text">
-
-<div class="doc_code">
-<pre>
-!7 = metadata !{
-  i32,      ;; Tag (see below)
-  metadata, ;; Context
-  metadata, ;; Name
-  metadata, ;; Reference to compile unit where defined
-  i32,      ;; Line number where defined
-  metadata  ;; Type descriptor
-}
-</pre>
-</div>
-
-<p>These descriptors are used to define variables local to a sub program.  The
-   value of the tag depends on the usage of the variable:</p>
-
-<div class="doc_code">
-<pre>
-DW_TAG_auto_variable   = 256
-DW_TAG_arg_variable    = 257
-DW_TAG_return_variable = 258
-</pre>
-</div>
-
-<p>An auto variable is any variable declared in the body of the function.  An
-   argument variable is any variable that appears as a formal argument to the
-   function.  A return variable is used to track the result of a function and
-   has no source correspondent.</p>
-
-<p>The context is either the subprogram or block where the variable is defined.
-   Name the source variable name.  Compile unit and line indicate where the
-   variable was defined. Type descriptor defines the declared type of the
-   variable.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="format_common_intrinsics">Debugger intrinsic functions</a>
-</div>
-
-<div class="doc_text">
-
-<p>LLVM uses several intrinsic functions (name prefixed with "llvm.dbg") to
-   provide debug information at various points in generated code.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection">
-  <a name="format_common_declare">llvm.dbg.declare</a>
-</div>
-
-<div class="doc_text">
-<pre>
-  void %<a href="#format_common_declare">llvm.dbg.declare</a>( { } *, metadata )
-</pre>
-
-<p>This intrinsic provides information about a local element (ex. variable.) The
-   first argument is the alloca for the variable, cast to a <tt>{ }*</tt>. The
-   second argument is
-   the <tt>%<a href="#format_variables">llvm.dbg.variable</a></tt> containing
-   the description of the variable. </p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection">
-  <a name="format_common_value">llvm.dbg.value</a>
-</div>
-
-<div class="doc_text">
-<pre>
-  void %<a href="#format_common_value">llvm.dbg.value</a>( metadata, i64, metadata )
-</pre>
-
-<p>This intrinsic provides information when a user source variable is set to a
-   new value.  The first argument is the new value (wrapped as metadata).  The
-   second argument is the offset in the user source variable where the new value
-   is written.  The third argument is
-   the <tt>%<a href="#format_variables">llvm.dbg.variable</a></tt> containing
-   the description of the user source variable. </p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="format_common_lifetime">Object lifetimes and scoping</a>
-</div>
-
-<div class="doc_text">
-<p>In many languages, the local variables in functions can have their lifetimes
-   or scopes limited to a subset of a function.  In the C family of languages,
-   for example, variables are only live (readable and writable) within the
-   source block that they are defined in.  In functional languages, values are
-   only readable after they have been defined.  Though this is a very obvious
-   concept, it is non-trivial to model in LLVM, because it has no notion of
-   scoping in this sense, and does not want to be tied to a language's scoping
-   rules.</p>
-
-<p>In order to handle this, the LLVM debug format uses the metadata attached to
-   llvm instructions to encode line nuber and scoping information. Consider the
-   following C fragment, for example:</p>
-
-<div class="doc_code">
-<pre>
-1.  void foo() {
-2.    int X = 21;
-3.    int Y = 22;
-4.    {
-5.      int Z = 23;
-6.      Z = X;
-7.    }
-8.    X = Y;
-9.  }
-</pre>
-</div>
-
-<p>Compiled to LLVM, this function would be represented like this:</p>
-
-<div class="doc_code">
-<pre>
-define void @foo() nounwind ssp {
-entry:
-  %X = alloca i32, align 4                        ; &lt;i32*&gt; [#uses=4]
-  %Y = alloca i32, align 4                        ; &lt;i32*&gt; [#uses=4]
-  %Z = alloca i32, align 4                        ; &lt;i32*&gt; [#uses=3]
-  %0 = bitcast i32* %X to { }*                    ; &lt;{ }*&gt; [#uses=1]
-  call void @llvm.dbg.declare({ }* %0, metadata !0), !dbg !7
-  store i32 21, i32* %X, !dbg !8
-  %1 = bitcast i32* %Y to { }*                    ; &lt;{ }*&gt; [#uses=1]
-  call void @llvm.dbg.declare({ }* %1, metadata !9), !dbg !10
-  store i32 22, i32* %Y, !dbg !11
-  %2 = bitcast i32* %Z to { }*                    ; &lt;{ }*&gt; [#uses=1]
-  call void @llvm.dbg.declare({ }* %2, metadata !12), !dbg !14
-  store i32 23, i32* %Z, !dbg !15
-  %tmp = load i32* %X, !dbg !16                   ; &lt;i32&gt; [#uses=1]
-  %tmp1 = load i32* %Y, !dbg !16                  ; &lt;i32&gt; [#uses=1]
-  %add = add nsw i32 %tmp, %tmp1, !dbg !16        ; &lt;i32&gt; [#uses=1]
-  store i32 %add, i32* %Z, !dbg !16
-  %tmp2 = load i32* %Y, !dbg !17                  ; &lt;i32&gt; [#uses=1]
-  store i32 %tmp2, i32* %X, !dbg !17
-  ret void, !dbg !18
-}
-
-declare void @llvm.dbg.declare({ }*, metadata) nounwind readnone
-
-!0 = metadata !{i32 459008, metadata !1, metadata !"X", 
-                metadata !3, i32 2, metadata !6}; [ DW_TAG_auto_variable ]
-!1 = metadata !{i32 458763, metadata !2}; [DW_TAG_lexical_block ]
-!2 = metadata !{i32 458798, i32 0, metadata !3, metadata !"foo", metadata !"foo", 
-               metadata !"foo", metadata !3, i32 1, metadata !4, 
-               i1 false, i1 true}; [DW_TAG_subprogram ]
-!3 = metadata !{i32 458769, i32 0, i32 12, metadata !"foo.c", 
-                metadata !"/private/tmp", metadata !"clang 1.1", i1 true, 
-                i1 false, metadata !"", i32 0}; [DW_TAG_compile_unit ]
-!4 = metadata !{i32 458773, metadata !3, metadata !"", null, i32 0, i64 0, i64 0, 
-                i64 0, i32 0, null, metadata !5, i32 0}; [DW_TAG_subroutine_type ]
-!5 = metadata !{null}
-!6 = metadata !{i32 458788, metadata !3, metadata !"int", metadata !3, i32 0, 
-                i64 32, i64 32, i64 0, i32 0, i32 5}; [DW_TAG_base_type ]
-!7 = metadata !{i32 2, i32 7, metadata !1, null}
-!8 = metadata !{i32 2, i32 3, metadata !1, null}
-!9 = metadata !{i32 459008, metadata !1, metadata !"Y", metadata !3, i32 3, 
-                metadata !6}; [ DW_TAG_auto_variable ]
-!10 = metadata !{i32 3, i32 7, metadata !1, null}
-!11 = metadata !{i32 3, i32 3, metadata !1, null}
-!12 = metadata !{i32 459008, metadata !13, metadata !"Z", metadata !3, i32 5, 
-                 metadata !6}; [ DW_TAG_auto_variable ]
-!13 = metadata !{i32 458763, metadata !1}; [DW_TAG_lexical_block ]
-!14 = metadata !{i32 5, i32 9, metadata !13, null}
-!15 = metadata !{i32 5, i32 5, metadata !13, null}
-!16 = metadata !{i32 6, i32 5, metadata !13, null}
-!17 = metadata !{i32 8, i32 3, metadata !1, null}
-!18 = metadata !{i32 9, i32 1, metadata !2, null}
-</pre>
-</div>
-
-<p>This example illustrates a few important details about LLVM debugging
-   information. In particular, it shows how the <tt>llvm.dbg.declare</tt>
-   intrinsic and location information, which are attached to an instruction,
-   are applied together to allow a debugger to analyze the relationship between
-   statements, variable definitions, and the code used to implement the
-   function.</p>
-
-<div class="doc_code">
-<pre>
-call void @llvm.dbg.declare({ }* %0, metadata !0), !dbg !7   
-</pre>
-</div>
-
-<p>The first intrinsic
-   <tt>%<a href="#format_common_declare">llvm.dbg.declare</a></tt>
-   encodes debugging information for the variable <tt>X</tt>. The metadata
-   <tt>!dbg !7</tt> attached to the intrinsic provides scope information for the
-   variable <tt>X</tt>.</p>
-
-<div class="doc_code">
-<pre>
-!7 = metadata !{i32 2, i32 7, metadata !1, null}
-!1 = metadata !{i32 458763, metadata !2}; [DW_TAG_lexical_block ]
-!2 = metadata !{i32 458798, i32 0, metadata !3, metadata !"foo", 
-                metadata !"foo", metadata !"foo", metadata !3, i32 1, 
-                metadata !4, i1 false, i1 true}; [DW_TAG_subprogram ]   
-</pre>
-</div>
-
-<p>Here <tt>!7</tt> is metadata providing location information. It has four
-   fields: line number, column number, scope, and original scope. The original
-   scope represents inline location if this instruction is inlined inside a
-   caller, and is null otherwise. In this example, scope is encoded by
-   <tt>!1</tt>. <tt>!1</tt> represents a lexical block inside the scope
-   <tt>!2</tt>, where <tt>!2</tt> is a
-   <a href="#format_subprograms">subprogram descriptor</a>. This way the
-   location information attached to the intrinsics indicates that the
-   variable <tt>X</tt> is declared at line number 2 at a function level scope in
-   function <tt>foo</tt>.</p>
-
-<p>Now lets take another example.</p>
-
-<div class="doc_code">
-<pre>
-call void @llvm.dbg.declare({ }* %2, metadata !12), !dbg !14
-</pre>
-</div>
-
-<p>The second intrinsic
-   <tt>%<a href="#format_common_declare">llvm.dbg.declare</a></tt>
-   encodes debugging information for variable <tt>Z</tt>. The metadata 
-   <tt>!dbg !14</tt> attached to the intrinsic provides scope information for
-   the variable <tt>Z</tt>.</p>
-
-<div class="doc_code">
-<pre>
-!13 = metadata !{i32 458763, metadata !1}; [DW_TAG_lexical_block ]
-!14 = metadata !{i32 5, i32 9, metadata !13, null}
-</pre>
-</div>
-
-<p>Here <tt>!14</tt> indicates that <tt>Z</tt> is declaread at line number 5 and
-   column number 9 inside of lexical scope <tt>!13</tt>. The lexical scope
-   itself resides inside of lexical scope <tt>!1</tt> described above.</p>
-
-<p>The scope information attached with each instruction provides a
-   straightforward way to find instructions covered by a scope.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="ccxx_frontend">C/C++ front-end specific debug information</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>The C and C++ front-ends represent information about the program in a format
-   that is effectively identical
-   to <a href="http://www.eagercon.com/dwarf/dwarf3std.htm">DWARF 3.0</a> in
-   terms of information content.  This allows code generators to trivially
-   support native debuggers by generating standard dwarf information, and
-   contains enough information for non-dwarf targets to translate it as
-   needed.</p>
-
-<p>This section describes the forms used to represent C and C++ programs. Other
-   languages could pattern themselves after this (which itself is tuned to
-   representing programs in the same way that DWARF 3 does), or they could
-   choose to provide completely different forms if they don't fit into the DWARF
-   model.  As support for debugging information gets added to the various LLVM
-   source-language front-ends, the information used should be documented
-   here.</p>
-
-<p>The following sections provide examples of various C/C++ constructs and the
-   debug information that would best describe those constructs.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="ccxx_compile_units">C/C++ source file information</a>
-</div>
-
-<div class="doc_text">
-
-<p>Given the source files <tt>MySource.cpp</tt> and <tt>MyHeader.h</tt> located
-   in the directory <tt>/Users/mine/sources</tt>, the following code:</p>
-
-<div class="doc_code">
-<pre>
-#include "MyHeader.h"
-
-int main(int argc, char *argv[]) {
-  return 0;
-}
-</pre>
-</div>
-
-<p>a C/C++ front-end would generate the following descriptors:</p>
-
-<div class="doc_code">
-<pre>
-...
-;;
-;; Define the compile unit for the source file "/Users/mine/sources/MySource.cpp".
-;;
-!3 = metadata !{
-  i32 458769,    ;; Tag
-  i32 0,         ;; Unused
-  i32 4,         ;; Language Id
-  metadata !"MySource.cpp", 
-  metadata !"/Users/mine/sources", 
-  metadata !"4.2.1 (Based on Apple Inc. build 5649) (LLVM build 00)", 
-  i1 true,       ;; Main Compile Unit
-  i1 false,      ;; Optimized compile unit
-  metadata !"",  ;; Compiler flags
-  i32 0}         ;; Runtime version
-
-;;
-;; Define the compile unit for the header file "/Users/mine/sources/MyHeader.h".
-;;
-!1 = metadata !{
-  i32 458769,    ;; Tag
-  i32 0,         ;; Unused
-  i32 4,         ;; Language Id
-  metadata !"MyHeader.h", 
-  metadata !"/Users/mine/sources", 
-  metadata !"4.2.1 (Based on Apple Inc. build 5649) (LLVM build 00)", 
-  i1 false,      ;; Main Compile Unit
-  i1 false,      ;; Optimized compile unit
-  metadata !"",  ;; Compiler flags
-  i32 0}         ;; Runtime version
-
-...
-</pre>
-</div>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="ccxx_global_variable">C/C++ global variable information</a>
-</div>
-
-<div class="doc_text">
-
-<p>Given an integer global variable declared as follows:</p>
-
-<div class="doc_code">
-<pre>
-int MyGlobal = 100;
-</pre>
-</div>
-
-<p>a C/C++ front-end would generate the following descriptors:</p>
-
-<div class="doc_code">
-<pre>
-;;
-;; Define the global itself.
-;;
-%MyGlobal = global int 100
-...
-;;
-;; List of debug info of globals
-;;
-!llvm.dbg.gv = !{!0}
-
-;;
-;; Define the global variable descriptor.  Note the reference to the global
-;; variable anchor and the global variable itself.
-;;
-!0 = metadata !{
-  i32 458804,              ;; Tag
-  i32 0,                   ;; Unused
-  metadata !1,             ;; Context
-  metadata !"MyGlobal",    ;; Name
-  metadata !"MyGlobal",    ;; Display Name
-  metadata !"MyGlobal",    ;; Linkage Name
-  metadata !1,             ;; Compile Unit
-  i32 1,                   ;; Line Number
-  metadata !2,             ;; Type
-  i1 false,                ;; Is a local variable
-  i1 true,                 ;; Is this a definition
-  i32* @MyGlobal           ;; The global variable
-}
-
-;;
-;; Define the basic type of 32 bit signed integer.  Note that since int is an
-;; intrinsic type the source file is NULL and line 0.
-;;    
-!2 = metadata !{
-  i32 458788,              ;; Tag
-  metadata !1,             ;; Context
-  metadata !"int",         ;; Name
-  metadata !1,             ;; Compile Unit
-  i32 0,                   ;; Line number
-  i64 32,                  ;; Size in Bits
-  i64 32,                  ;; Align in Bits
-  i64 0,                   ;; Offset in Bits
-  i32 0,                   ;; Flags
-  i32 5                    ;; Encoding
-}
-
-</pre>
-</div>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="ccxx_subprogram">C/C++ function information</a>
-</div>
-
-<div class="doc_text">
-
-<p>Given a function declared as follows:</p>
-
-<div class="doc_code">
-<pre>
-int main(int argc, char *argv[]) {
-  return 0;
-}
-</pre>
-</div>
-
-<p>a C/C++ front-end would generate the following descriptors:</p>
-
-<div class="doc_code">
-<pre>
-;;
-;; Define the anchor for subprograms.  Note that the second field of the
-;; anchor is 46, which is the same as the tag for subprograms
-;; (46 = DW_TAG_subprogram.)
-;;
-!0 = metadata !{
-  i32 458798,        ;; Tag
-  i32 0,             ;; Unused
-  metadata !1,       ;; Context
-  metadata !"main",  ;; Name
-  metadata !"main",  ;; Display name
-  metadata !"main",  ;; Linkage name
-  metadata !1,       ;; Compile unit
-  i32 1,             ;; Line number
-  metadata !2,       ;; Type
-  i1 false,          ;; Is local 
-  i1 true            ;; Is definition
-}
-;;
-;; Define the subprogram itself.
-;;
-define i32 @main(i32 %argc, i8** %argv) {
-...
-}
-</pre>
-</div>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="ccxx_basic_types">C/C++ basic types</a>
-</div>
-
-<div class="doc_text">
-
-<p>The following are the basic type descriptors for C/C++ core types:</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection">
-  <a name="ccxx_basic_type_bool">bool</a>
-</div>
-
-<div class="doc_text">
-
-<div class="doc_code">
-<pre>
-!2 = metadata !{
-  i32 458788,        ;; Tag
-  metadata !1,       ;; Context
-  metadata !"bool",  ;; Name
-  metadata !1,       ;; Compile Unit
-  i32 0,             ;; Line number
-  i64 8,             ;; Size in Bits
-  i64 8,             ;; Align in Bits
-  i64 0,             ;; Offset in Bits
-  i32 0,             ;; Flags
-  i32 2              ;; Encoding
-}
-</pre>
-</div>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection">
-  <a name="ccxx_basic_char">char</a>
-</div>
-
-<div class="doc_text">
-
-<div class="doc_code">
-<pre>
-!2 = metadata !{
-  i32 458788,        ;; Tag
-  metadata !1,       ;; Context
-  metadata !"char",  ;; Name
-  metadata !1,       ;; Compile Unit
-  i32 0,             ;; Line number
-  i64 8,             ;; Size in Bits
-  i64 8,             ;; Align in Bits
-  i64 0,             ;; Offset in Bits
-  i32 0,             ;; Flags
-  i32 6              ;; Encoding
-}
-</pre>
-</div>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection">
-  <a name="ccxx_basic_unsigned_char">unsigned char</a>
-</div>
-
-<div class="doc_text">
-
-<div class="doc_code">
-<pre>
-!2 = metadata !{
-  i32 458788,        ;; Tag
-  metadata !1,       ;; Context
-  metadata !"unsigned char", 
-  metadata !1,       ;; Compile Unit
-  i32 0,             ;; Line number
-  i64 8,             ;; Size in Bits
-  i64 8,             ;; Align in Bits
-  i64 0,             ;; Offset in Bits
-  i32 0,             ;; Flags
-  i32 8              ;; Encoding
-}
-</pre>
-</div>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection">
-  <a name="ccxx_basic_short">short</a>
-</div>
-
-<div class="doc_text">
-
-<div class="doc_code">
-<pre>
-!2 = metadata !{
-  i32 458788,        ;; Tag
-  metadata !1,       ;; Context
-  metadata !"short int",
-  metadata !1,       ;; Compile Unit
-  i32 0,             ;; Line number
-  i64 16,            ;; Size in Bits
-  i64 16,            ;; Align in Bits
-  i64 0,             ;; Offset in Bits
-  i32 0,             ;; Flags
-  i32 5              ;; Encoding
-}
-</pre>
-</div>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection">
-  <a name="ccxx_basic_unsigned_short">unsigned short</a>
-</div>
-
-<div class="doc_text">
-
-<div class="doc_code">
-<pre>
-!2 = metadata !{
-  i32 458788,        ;; Tag
-  metadata !1,       ;; Context
-  metadata !"short unsigned int",
-  metadata !1,       ;; Compile Unit
-  i32 0,             ;; Line number
-  i64 16,            ;; Size in Bits
-  i64 16,            ;; Align in Bits
-  i64 0,             ;; Offset in Bits
-  i32 0,             ;; Flags
-  i32 7              ;; Encoding
-}
-</pre>
-</div>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection">
-  <a name="ccxx_basic_int">int</a>
-</div>
-
-<div class="doc_text">
-
-<div class="doc_code">
-<pre>
-!2 = metadata !{
-  i32 458788,        ;; Tag
-  metadata !1,       ;; Context
-  metadata !"int",   ;; Name
-  metadata !1,       ;; Compile Unit
-  i32 0,             ;; Line number
-  i64 32,            ;; Size in Bits
-  i64 32,            ;; Align in Bits
-  i64 0,             ;; Offset in Bits
-  i32 0,             ;; Flags
-  i32 5              ;; Encoding
-}
-</pre></div>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection">
-  <a name="ccxx_basic_unsigned_int">unsigned int</a>
-</div>
-
-<div class="doc_text">
-
-<div class="doc_code">
-<pre>
-!2 = metadata !{
-  i32 458788,        ;; Tag
-  metadata !1,       ;; Context
-  metadata !"unsigned int",
-  metadata !1,       ;; Compile Unit
-  i32 0,             ;; Line number
-  i64 32,            ;; Size in Bits
-  i64 32,            ;; Align in Bits
-  i64 0,             ;; Offset in Bits
-  i32 0,             ;; Flags
-  i32 7              ;; Encoding
-}
-</pre>
-</div>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection">
-  <a name="ccxx_basic_long_long">long long</a>
-</div>
-
-<div class="doc_text">
-
-<div class="doc_code">
-<pre>
-!2 = metadata !{
-  i32 458788,        ;; Tag
-  metadata !1,       ;; Context
-  metadata !"long long int",
-  metadata !1,       ;; Compile Unit
-  i32 0,             ;; Line number
-  i64 64,            ;; Size in Bits
-  i64 64,            ;; Align in Bits
-  i64 0,             ;; Offset in Bits
-  i32 0,             ;; Flags
-  i32 5              ;; Encoding
-}
-</pre>
-</div>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection">
-  <a name="ccxx_basic_unsigned_long_long">unsigned long long</a>
-</div>
-
-<div class="doc_text">
-
-<div class="doc_code">
-<pre>
-!2 = metadata !{
-  i32 458788,        ;; Tag
-  metadata !1,       ;; Context
-  metadata !"long long unsigned int",
-  metadata !1,       ;; Compile Unit
-  i32 0,             ;; Line number
-  i64 64,            ;; Size in Bits
-  i64 64,            ;; Align in Bits
-  i64 0,             ;; Offset in Bits
-  i32 0,             ;; Flags
-  i32 7              ;; Encoding
-}
-</pre>
-</div>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection">
-  <a name="ccxx_basic_float">float</a>
-</div>
-
-<div class="doc_text">
-
-<div class="doc_code">
-<pre>
-!2 = metadata !{
-  i32 458788,        ;; Tag
-  metadata !1,       ;; Context
-  metadata !"float",
-  metadata !1,       ;; Compile Unit
-  i32 0,             ;; Line number
-  i64 32,            ;; Size in Bits
-  i64 32,            ;; Align in Bits
-  i64 0,             ;; Offset in Bits
-  i32 0,             ;; Flags
-  i32 4              ;; Encoding
-}
-</pre>
-</div>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection">
-  <a name="ccxx_basic_double">double</a>
-</div>
-
-<div class="doc_text">
-
-<div class="doc_code">
-<pre>
-!2 = metadata !{
-  i32 458788,        ;; Tag
-  metadata !1,       ;; Context
-  metadata !"double",;; Name
-  metadata !1,       ;; Compile Unit
-  i32 0,             ;; Line number
-  i64 64,            ;; Size in Bits
-  i64 64,            ;; Align in Bits
-  i64 0,             ;; Offset in Bits
-  i32 0,             ;; Flags
-  i32 4              ;; Encoding
-}
-</pre>
-</div>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="ccxx_derived_types">C/C++ derived types</a>
-</div>
-
-<div class="doc_text">
-
-<p>Given the following as an example of C/C++ derived type:</p>
-
-<div class="doc_code">
-<pre>
-typedef const int *IntPtr;
-</pre>
-</div>
-
-<p>a C/C++ front-end would generate the following descriptors:</p>
-
-<div class="doc_code">
-<pre>
-;;
-;; Define the typedef "IntPtr".
-;;
-!2 = metadata !{
-  i32 458774,          ;; Tag
-  metadata !1,         ;; Context
-  metadata !"IntPtr",  ;; Name
-  metadata !3,         ;; Compile unit
-  i32 0,               ;; Line number
-  i64 0,               ;; Size in bits
-  i64 0,               ;; Align in bits
-  i64 0,               ;; Offset in bits
-  i32 0,               ;; Flags
-  metadata !4          ;; Derived From type
-}
-
-;;
-;; Define the pointer type.
-;;
-!4 = metadata !{
-  i32 458767,          ;; Tag
-  metadata !1,         ;; Context
-  metadata !"",        ;; Name
-  metadata !1,         ;; Compile unit
-  i32 0,               ;; Line number
-  i64 64,              ;; Size in bits
-  i64 64,              ;; Align in bits
-  i64 0,               ;; Offset in bits
-  i32 0,               ;; Flags
-  metadata !5          ;; Derived From type
-}
-;;
-;; Define the const type.
-;;
-!5 = metadata !{
-  i32 458790,          ;; Tag
-  metadata !1,         ;; Context
-  metadata !"",        ;; Name
-  metadata !1,         ;; Compile unit
-  i32 0,               ;; Line number
-  i64 32,              ;; Size in bits
-  i64 32,              ;; Align in bits
-  i64 0,               ;; Offset in bits
-  i32 0,               ;; Flags
-  metadata !6          ;; Derived From type
-}
-;;
-;; Define the int type.
-;;
-!6 = metadata !{
-  i32 458788,          ;; Tag
-  metadata !1,         ;; Context
-  metadata !"int",     ;; Name
-  metadata !1,         ;; Compile unit
-  i32 0,               ;; Line number
-  i64 32,              ;; Size in bits
-  i64 32,              ;; Align in bits
-  i64 0,               ;; Offset in bits
-  i32 0,               ;; Flags
-  5                    ;; Encoding
-}
-</pre>
-</div>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="ccxx_composite_types">C/C++ struct/union types</a>
-</div>
-
-<div class="doc_text">
-
-<p>Given the following as an example of C/C++ struct type:</p>
-
-<div class="doc_code">
-<pre>
-struct Color {
-  unsigned Red;
-  unsigned Green;
-  unsigned Blue;
-};
-</pre>
-</div>
-
-<p>a C/C++ front-end would generate the following descriptors:</p>
-
-<div class="doc_code">
-<pre>
-;;
-;; Define basic type for unsigned int.
-;;
-!5 = metadata !{
-  i32 458788,        ;; Tag
-  metadata !1,       ;; Context
-  metadata !"unsigned int",
-  metadata !1,       ;; Compile Unit
-  i32 0,             ;; Line number
-  i64 32,            ;; Size in Bits
-  i64 32,            ;; Align in Bits
-  i64 0,             ;; Offset in Bits
-  i32 0,             ;; Flags
-  i32 7              ;; Encoding
-}
-;;
-;; Define composite type for struct Color.
-;;
-!2 = metadata !{
-  i32 458771,        ;; Tag
-  metadata !1,       ;; Context
-  metadata !"Color", ;; Name
-  metadata !1,       ;; Compile unit
-  i32 1,             ;; Line number
-  i64 96,            ;; Size in bits
-  i64 32,            ;; Align in bits
-  i64 0,             ;; Offset in bits
-  i32 0,             ;; Flags
-  null,              ;; Derived From
-  metadata !3,       ;; Elements
-  i32 0              ;; Runtime Language
-}
-
-;;
-;; Define the Red field.
-;;
-!4 = metadata !{
-  i32 458765,        ;; Tag
-  metadata !1,       ;; Context
-  metadata !"Red",   ;; Name
-  metadata !1,       ;; Compile Unit
-  i32 2,             ;; Line number
-  i64 32,            ;; Size in bits
-  i64 32,            ;; Align in bits
-  i64 0,             ;; Offset in bits
-  i32 0,             ;; Flags
-  metadata !5        ;; Derived From type
-}
-
-;;
-;; Define the Green field.
-;;
-!6 = metadata !{
-  i32 458765,        ;; Tag
-  metadata !1,       ;; Context
-  metadata !"Green", ;; Name
-  metadata !1,       ;; Compile Unit
-  i32 3,             ;; Line number
-  i64 32,            ;; Size in bits
-  i64 32,            ;; Align in bits
-  i64 32,             ;; Offset in bits
-  i32 0,             ;; Flags
-  metadata !5        ;; Derived From type
-}
-
-;;
-;; Define the Blue field.
-;;
-!7 = metadata !{
-  i32 458765,        ;; Tag
-  metadata !1,       ;; Context
-  metadata !"Blue",  ;; Name
-  metadata !1,       ;; Compile Unit
-  i32 4,             ;; Line number
-  i64 32,            ;; Size in bits
-  i64 32,            ;; Align in bits
-  i64 64,             ;; Offset in bits
-  i32 0,             ;; Flags
-  metadata !5        ;; Derived From type
-}
-
-;;
-;; Define the array of fields used by the composite type Color.
-;;
-!3 = metadata !{metadata !4, metadata !6, metadata !7}
-</pre>
-</div>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="ccxx_enumeration_types">C/C++ enumeration types</a>
-</div>
-
-<div class="doc_text">
-
-<p>Given the following as an example of C/C++ enumeration type:</p>
-
-<div class="doc_code">
-<pre>
-enum Trees {
-  Spruce = 100,
-  Oak = 200,
-  Maple = 300
-};
-</pre>
-</div>
-
-<p>a C/C++ front-end would generate the following descriptors:</p>
-
-<div class="doc_code">
-<pre>
-;;
-;; Define composite type for enum Trees
-;;
-!2 = metadata !{
-  i32 458756,        ;; Tag
-  metadata !1,       ;; Context
-  metadata !"Trees", ;; Name
-  metadata !1,       ;; Compile unit
-  i32 1,             ;; Line number
-  i64 32,            ;; Size in bits
-  i64 32,            ;; Align in bits
-  i64 0,             ;; Offset in bits
-  i32 0,             ;; Flags
-  null,              ;; Derived From type
-  metadata !3,       ;; Elements
-  i32 0              ;; Runtime language
-}
-
-;;
-;; Define the array of enumerators used by composite type Trees.
-;;
-!3 = metadata !{metadata !4, metadata !5, metadata !6}
-
-;;
-;; Define Spruce enumerator.
-;;
-!4 = metadata !{i32 458792, metadata !"Spruce", i64 100}
-
-;;
-;; Define Oak enumerator.
-;;
-!5 = metadata !{i32 458792, metadata !"Oak", i64 200}
-
-;;
-;; Define Maple enumerator.
-;;
-!6 = metadata !{i32 458792, metadata !"Maple", i64 300}
-
-</pre>
-</div>
-
-</div>
-
-<!-- *********************************************************************** -->
-
-<hr>
-<address>
-  <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
-  src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS"></a>
-  <a href="http://validator.w3.org/check/referer"><img
-  src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
-
-  <a href="mailto:sabre at nondot.org">Chris Lattner</a><br>
-  <a href="http://llvm.org">LLVM Compiler Infrastructure</a><br>
-  Last modified: $Date$
-</address>
-
-</body>
-</html>
diff --git a/libclamav/c++/llvm/docs/SystemLibrary.html b/libclamav/c++/llvm/docs/SystemLibrary.html
deleted file mode 100644
index 0289a55..0000000
--- a/libclamav/c++/llvm/docs/SystemLibrary.html
+++ /dev/null
@@ -1,319 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-                      "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-  <title>System Library</title>
-  <link rel="stylesheet" href="llvm.css" type="text/css">
-</head>
-<body>
-
-<div class="doc_title">System Library</div>
-<ul>
-  <li><a href="#abstract">Abstract</a></li>
-  <li><a href="#requirements">Keeping LLVM Portable</a>
-  <ol>
-    <li><a href="#headers">Don't Include System Headers</a></li>
-    <li><a href="#expose">Don't Expose System Headers</a></li>
-    <li><a href="#c_headers">Allow Standard C Header Files</a></li>
-    <li><a href="#cpp_headers">Allow Standard C++ Header Files</a></li>
-    <li><a href="#highlev">High-Level Interface</a></li>
-    <li><a href="#nofunc">No Exposed Functions</a></li>
-    <li><a href="#nodata">No Exposed Data</a></li>
-    <li><a href="#nodupl">No Duplicate Implementations</a></li>
-    <li><a href="#nounused">No Unused Functionality</a></li>
-    <li><a href="#virtuals">No Virtual Methods</a></li>
-    <li><a href="#softerrors">Minimize Soft Errors</a></li>
-    <li><a href="#throw_spec">No throw() Specifications</a></li>
-    <li><a href="#organization">Code Organization</a></li>
-    <li><a href="#semantics">Consistent Semantics</a></li>
-    <li><a href="#bug">Tracking Bugzilla Bug: 351</a></li>
-  </ol></li>
-</ul>
-
-<div class="doc_author">
-  <p>Written by <a href="mailto:rspencer at x10sys.com">Reid Spencer</a></p>
-</div>
-
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="abstract">Abstract</a></div>
-<div class="doc_text">
-  <p>This document provides some details on LLVM's System Library, located in
-  the source at <tt>lib/System</tt> and <tt>include/llvm/System</tt>. The
-  library's purpose is to shield LLVM from the differences between operating
-  systems for the few services LLVM needs from the operating system. Much of
-  LLVM is written using portability features of standard C++. However, in a few
-  areas, system dependent facilities are needed and the System Library is the
-  wrapper around those system calls.</p>
-  <p>By centralizing LLVM's use of operating system interfaces, we make it 
-  possible for the LLVM tool chain and runtime libraries to be more easily 
-  ported to new platforms since (theoretically) only <tt>lib/System</tt> needs 
-  to be ported.  This library also unclutters the rest of LLVM from #ifdef use 
-  and special cases for specific operating systems. Such uses are replaced 
-  with simple calls to the interfaces provided in <tt>include/llvm/System</tt>.
-  </p> 
-  <p>Note that the System Library is not intended to be a complete operating 
-  system wrapper (such as the Adaptive Communications Environment (ACE) or 
-  Apache Portable Runtime (APR)), but only provides the functionality necessary
-  to support LLVM.
-  <p>The System Library was written by Reid Spencer who formulated the
-  design based on similar work originating from the eXtensible Programming 
-  System (XPS). Several people helped with the effort; especially,
-  Jeff Cohen and Henrik Bach on the Win32 port.</p>
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="requirements">Keeping LLVM Portable</a>
-</div>
-<div class="doc_text">
-  <p>In order to keep LLVM portable, LLVM developers should adhere to a set of
-  portability rules associated with the System Library. Adherence to these rules
-  should help the System Library achieve its goal of shielding LLVM from the
-  variations in operating system interfaces and doing so efficiently.  The 
-  following sections define the rules needed to fulfill this objective.</p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="headers">Don't Include System Headers</a>
-</div>
-<div class="doc_text">
-  <p>Except in <tt>lib/System</tt>, no LLVM source code should directly
-  <tt>#include</tt> a system header. Care has been taken to remove all such
-  <tt>#includes</tt> from LLVM while <tt>lib/System</tt> was being
-  developed.  Specifically this means that header files like "unistd.h", 
-  "windows.h", "stdio.h", and "string.h" are forbidden to be included by LLVM 
-  source code outside the implementation of <tt>lib/System</tt>.</p>
-  <p>To obtain system-dependent functionality, existing interfaces to the system
-  found in <tt>include/llvm/System</tt> should be used. If an appropriate 
-  interface is not available, it should be added to <tt>include/llvm/System</tt>
-  and implemented in <tt>lib/System</tt> for all supported platforms.</p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="expose">Don't Expose System Headers</a>
-</div>
-<div class="doc_text">
-  <p>The System Library must shield LLVM from <em>all</em> system headers. To 
-  obtain system level functionality, LLVM source must 
-  <tt>#include "llvm/System/Thing.h"</tt> and nothing else. This means that 
-  <tt>Thing.h</tt> cannot expose any system header files. This protects LLVM 
-  from accidentally using system specific functionality and only allows it
-  via the <tt>lib/System</tt> interface.</p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="c_headers">Use Standard C Headers</a></div>
-<div class="doc_text">
-  <p>The <em>standard</em> C headers (the ones beginning with "c") are allowed
-  to be exposed through the <tt>lib/System</tt> interface. These headers and 
-  the things they declare are considered to be platform agnostic. LLVM source 
-  files may include them directly or obtain their inclusion through 
-  <tt>lib/System</tt> interfaces.</p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="cpp_headers">Use Standard C++ Headers</a>
-</div>
-<div class="doc_text">
-  <p>The <em>standard</em> C++ headers from the standard C++ library and
-  standard template library may be exposed through the <tt>lib/System</tt>
-  interface. These headers and the things they declare are considered to be
-  platform agnostic. LLVM source files may include them or obtain their
-  inclusion through lib/System interfaces.</p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="highlev">High Level Interface</a></div>
-<div class="doc_text">
-  <p>The entry points specified in the interface of lib/System must be aimed at 
-  completing some reasonably high level task needed by LLVM. We do not want to
-  simply wrap each operating system call. It would be preferable to wrap several
-  operating system calls that are always used in conjunction with one another by
-  LLVM.</p>
-  <p>For example, consider what is needed to execute a program, wait for it to
-  complete, and return its result code. On Unix, this involves the following
-  operating system calls: <tt>getenv, fork, execve,</tt> and <tt>wait</tt>. The
-  correct thing for lib/System to provide is a function, say
-  <tt>ExecuteProgramAndWait</tt>, that implements the functionality completely.
-  what we don't want is wrappers for the operating system calls involved.</p>
-  <p>There must <em>not</em> be a one-to-one relationship between operating
-  system calls and the System library's interface. Any such interface function
-  will be suspicious.</p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="nounused">No Unused Functionality</a></div>
-<div class="doc_text">
-  <p>There must be no functionality specified in the interface of lib/System 
-  that isn't actually used by LLVM. We're not writing a general purpose
-  operating system wrapper here, just enough to satisfy LLVM's needs. And, LLVM
-  doesn't need much. This design goal aims to keep the lib/System interface
-  small and understandable which should foster its actual use and adoption.</p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="nodupl">No Duplicate Implementations</a>
-</div>
-<div class="doc_text">
-  <p>The implementation of a function for a given platform must be written
-  exactly once. This implies that it must be possible to apply a function's 
-  implementation to multiple operating systems if those operating systems can
-  share the same implementation. This rule applies to the set of operating
-  systems supported for a given class of operating system (e.g. Unix, Win32).
-  </p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="virtuals">No Virtual Methods</a></div>
-<div class="doc_text">
-  <p>The System Library interfaces can be called quite frequently by LLVM. In
-  order to make those calls as efficient as possible, we discourage the use of
-  virtual methods. There is no need to use inheritance for implementation
-  differences, it just adds complexity. The <tt>#include</tt> mechanism works
-  just fine.</p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="nofunc">No Exposed Functions</a></div>
-<div class="doc_text">
-  <p>Any functions defined by system libraries (i.e. not defined by lib/System) 
-  must not be exposed through the lib/System interface, even if the header file 
-  for that function is not exposed. This prevents inadvertent use of system
-  specific functionality.</p>
-  <p>For example, the <tt>stat</tt> system call is notorious for having
-  variations in the data it provides. <tt>lib/System</tt> must not declare 
-  <tt>stat</tt> nor allow it to be declared. Instead it should provide its own 
-  interface to discovering information about files and directories. Those 
-  interfaces may be implemented in terms of <tt>stat</tt> but that is strictly 
-  an implementation detail. The interface provided by the System Library must
-  be implemented on all platforms (even those without <tt>stat</tt>).</p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="nodata">No Exposed Data</a></div>
-<div class="doc_text">
-  <p>Any data defined by system libraries (i.e. not defined by lib/System) must
-  not be exposed through the lib/System interface, even if the header file for
-  that function is not exposed. As with functions, this prevents inadvertent use
-  of data that might not exist on all platforms.</p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="softerrors">Minimize Soft Errors</a></div>
-<div class="doc_text">
-  <p>Operating system interfaces will generally provide error results for every
-  little thing that could go wrong. In almost all cases, you can divide these
-  error results into two groups: normal/good/soft and abnormal/bad/hard. That
-  is, some of the errors are simply information like "file not found", 
-  "insufficient privileges", etc. while other errors are much harder like
-  "out of space", "bad disk sector", or "system call interrupted". We'll call 
-  the first group "<i>soft</i>" errors and the second group "<i>hard</i>" 
-  errors.<p>
-  <p>lib/System must always attempt to minimize soft errors.
-  This is a design requirement because the
-  minimization of soft errors can affect the granularity and the nature of the
-  interface. In general, if you find that you're wanting to throw soft errors,
-  you must review the granularity of the interface because it is likely you're
-  trying to implement something that is too low level. The rule of thumb is to
-  provide interface functions that <em>can't</em> fail, except when faced with 
-  hard errors.</p>
-  <p>For a trivial example, suppose we wanted to add an "OpenFileForWriting" 
-  function. For many operating systems, if the file doesn't exist, attempting 
-  to open the file will produce an error.  However, lib/System should not
-  simply throw that error if it occurs because its a soft error. The problem
-  is that the interface function, OpenFileForWriting is too low level. It should
-  be OpenOrCreateFileForWriting. In the case of the soft "doesn't exist" error, 
-  this function would just create it and then open it for writing.</p>
-  <p>This design principle needs to be maintained in lib/System because it
-  avoids the propagation of soft error handling throughout the rest of LLVM.
-  Hard errors will generally just cause a termination for an LLVM tool so don't
-  be bashful about throwing them.</p>
-  <p>Rules of thumb:</p>
-  <ol>
-    <li>Don't throw soft errors, only hard errors.</li>
-    <li>If you're tempted to throw a soft error, re-think the interface.</li>
-    <li>Handle internally the most common normal/good/soft error conditions
-    so the rest of LLVM doesn't have to.</li>
-  </ol>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="throw_spec">No throw Specifications</a>
-</div>
-<div class="doc_text">
-  <p>None of the lib/System interface functions may be declared with C++ 
-  <tt>throw()</tt> specifications on them. This requirement makes sure that the
-  compiler does not insert additional exception handling code into the interface
-  functions. This is a performance consideration: lib/System functions are at
-  the bottom of many call chains and as such can be frequently called. We
-  need them to be as efficient as possible.  However, no routines in the
-  system library should actually throw exceptions.</p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="organization">Code Organization</a></div>
-<div class="doc_text">
-  <p>Implementations of the System Library interface are separated by their
-  general class of operating system. Currently only Unix and Win32 classes are
-  defined but more could be added for other operating system classifications.
-  To distinguish which implementation to compile, the code in lib/System uses
-  the LLVM_ON_UNIX and LLVM_ON_WIN32 #defines provided via configure through the
-  llvm/Config/config.h file. Each source file in lib/System, after implementing
-  the generic (operating system independent) functionality needs to include the
-  correct implementation using a set of <tt>#if defined(LLVM_ON_XYZ)</tt> 
-  directives. For example, if we had lib/System/File.cpp, we'd expect to see in
-  that file:</p>
-  <pre><tt>
-  #if defined(LLVM_ON_UNIX)
-  #include "Unix/File.cpp"
-  #endif
-  #if defined(LLVM_ON_WIN32)
-  #include "Win32/File.cpp"
-  #endif
-  </tt></pre>
-  <p>The implementation in lib/System/Unix/File.cpp should handle all Unix
-  variants. The implementation in lib/System/Win32/File.cpp should handle all
-  Win32 variants.  What this does is quickly differentiate the basic class of 
-  operating system that will provide the implementation. The specific details
-  for a given platform must still be determined through the use of
-  <tt>#ifdef</tt>.</p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="semantics">Consistent Semantics</a></div>
-<div class="doc_text">
-  <p>The implementation of a lib/System interface can vary drastically between
-  platforms. That's okay as long as the end result of the interface function 
-  is the same. For example, a function to create a directory is pretty straight
-  forward on all operating system. System V IPC on the other hand isn't even
-  supported on all platforms. Instead of "supporting" System V IPC, lib/System
-  should provide an interface to the basic concept of inter-process 
-  communications. The implementations might use System V IPC if that was 
-  available or named pipes, or whatever gets the job done effectively for a 
-  given operating system.  In all cases, the interface and the implementation 
-  must be semantically consistent. </p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="bug">Bug 351</a></div>
-<div class="doc_text">
-  <p>See <a href="http://llvm.org/PR351">bug 351</a>
-  for further details on the progress of this work</p>
-</div>
-
-<!-- *********************************************************************** -->
-
-<hr>
-<address>
-  <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
-  src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS"></a>
-  <a href="http://validator.w3.org/check/referer"><img
-  src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
-
-  <a href="mailto:rspencer at x10sys.com">Reid Spencer</a><br>
-  <a href="http://llvm.org">LLVM Compiler Infrastructure</a><br>
-  Last modified: $Date$
-</address>
-</body>
-</html>
diff --git a/libclamav/c++/llvm/docs/TableGenFundamentals.html b/libclamav/c++/llvm/docs/TableGenFundamentals.html
deleted file mode 100644
index 457bb62..0000000
--- a/libclamav/c++/llvm/docs/TableGenFundamentals.html
+++ /dev/null
@@ -1,805 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-                      "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-  <title>TableGen Fundamentals</title>
-  <link rel="stylesheet" href="llvm.css" type="text/css">
-</head>
-<body>
-
-<div class="doc_title">TableGen Fundamentals</div>
-
-<div class="doc_text">
-<ul>
-  <li><a href="#introduction">Introduction</a>
-  <ol>
-    <li><a href="#concepts">Basic concepts</a></li>
-    <li><a href="#example">An example record</a></li>
-    <li><a href="#running">Running TableGen</a></li>
-  </ol></li>
-  <li><a href="#syntax">TableGen syntax</a>
-  <ol>
-    <li><a href="#primitives">TableGen primitives</a>
-    <ol>
-      <li><a href="#comments">TableGen comments</a></li>
-      <li><a href="#types">The TableGen type system</a></li>
-      <li><a href="#values">TableGen values and expressions</a></li>
-    </ol></li>
-    <li><a href="#classesdefs">Classes and definitions</a>
-    <ol>
-      <li><a href="#valuedef">Value definitions</a></li>
-      <li><a href="#recordlet">'let' expressions</a></li>
-      <li><a href="#templateargs">Class template arguments</a></li>
-      <li><a href="#multiclass">Multiclass definitions and instances</a></li>
-    </ol></li>
-    <li><a href="#filescope">File scope entities</a>
-    <ol>
-      <li><a href="#include">File inclusion</a></li>
-      <li><a href="#globallet">'let' expressions</a></li>
-    </ol></li>
-  </ol></li>
-  <li><a href="#backends">TableGen backends</a>
-  <ol>
-    <li><a href="#">todo</a></li>
-  </ol></li>
-</ul>
-</div>
-
-<div class="doc_author">
-  <p>Written by <a href="mailto:sabre at nondot.org">Chris Lattner</a></p>
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="introduction">Introduction</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>TableGen's purpose is to help a human develop and maintain records of
-domain-specific information.  Because there may be a large number of these
-records, it is specifically designed to allow writing flexible descriptions and
-for common features of these records to be factored out.  This reduces the
-amount of duplication in the description, reduces the chance of error, and
-makes it easier to structure domain specific information.</p>
-
-<p>The core part of TableGen <a href="#syntax">parses a file</a>, instantiates
-the declarations, and hands the result off to a domain-specific "<a
-href="#backends">TableGen backend</a>" for processing.  The current major user
-of TableGen is the <a href="CodeGenerator.html">LLVM code generator</a>.</p>
-
-<p>Note that if you work on TableGen much, and use emacs or vim, that you can
-find an emacs "TableGen mode" and a vim language file in the
-<tt>llvm/utils/emacs</tt> and <tt>llvm/utils/vim</tt> directories of your LLVM
-distribution, respectively.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="concepts">Basic concepts</a></div>
-
-<div class="doc_text">
-
-<p>TableGen files consist of two key parts: 'classes' and 'definitions', both
-of which are considered 'records'.</p>
-
-<p><b>TableGen records</b> have a unique name, a list of values, and a list of
-superclasses.  The list of values is the main data that TableGen builds for each
-record; it is this that holds the domain specific information for the
-application.  The interpretation of this data is left to a specific <a
-href="#backends">TableGen backend</a>, but the structure and format rules are
-taken care of and are fixed by TableGen.</p>
-
-<p><b>TableGen definitions</b> are the concrete form of 'records'.  These
-generally do not have any undefined values, and are marked with the
-'<tt>def</tt>' keyword.</p>
-
-<p><b>TableGen classes</b> are abstract records that are used to build and
-describe other records.  These 'classes' allow the end-user to build
-abstractions for either the domain they are targeting (such as "Register",
-"RegisterClass", and "Instruction" in the LLVM code generator) or for the
-implementor to help factor out common properties of records (such as "FPInst",
-which is used to represent floating point instructions in the X86 backend).
-TableGen keeps track of all of the classes that are used to build up a
-definition, so the backend can find all definitions of a particular class, such
-as "Instruction".</p>
-
-<p><b>TableGen multiclasses</b> are groups of abstract records that are
-instantiated all at once.  Each instantiation can result in multiple
-TableGen definitions.  If a multiclass inherits from another multiclass,
-the definitions in the sub-multiclass become part of the current
-multiclass, as if they were declared in the current multiclass.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="example">An example record</a></div>
-
-<div class="doc_text">
-
-<p>With no other arguments, TableGen parses the specified file and prints out
-all of the classes, then all of the definitions.  This is a good way to see what
-the various definitions expand to fully.  Running this on the <tt>X86.td</tt>
-file prints this (at the time of this writing):</p>
-
-<div class="doc_code">
-<pre>
-...
-<b>def</b> ADD32rr {   <i>// Instruction X86Inst I</i>
-  <b>string</b> Namespace = "X86";
-  <b>dag</b> OutOperandList = (outs GR32:$dst);
-  <b>dag</b> InOperandList = (ins GR32:$src1, GR32:$src2);
-  <b>string</b> AsmString = "add{l}\t{$src2, $dst|$dst, $src2}";
-  <b>list</b>&lt;dag&gt; Pattern = [(set GR32:$dst, (add GR32:$src1, GR32:$src2))];
-  <b>list</b>&lt;Register&gt; Uses = [];
-  <b>list</b>&lt;Register&gt; Defs = [EFLAGS];
-  <b>list</b>&lt;Predicate&gt; Predicates = [];
-  <b>int</b> CodeSize = 3;
-  <b>int</b> AddedComplexity = 0;
-  <b>bit</b> isReturn = 0;
-  <b>bit</b> isBranch = 0;
-  <b>bit</b> isIndirectBranch = 0;
-  <b>bit</b> isBarrier = 0;
-  <b>bit</b> isCall = 0;
-  <b>bit</b> canFoldAsLoad = 0;
-  <b>bit</b> mayLoad = 0;
-  <b>bit</b> mayStore = 0;
-  <b>bit</b> isImplicitDef = 0;
-  <b>bit</b> isTwoAddress = 1;
-  <b>bit</b> isConvertibleToThreeAddress = 1;
-  <b>bit</b> isCommutable = 1;
-  <b>bit</b> isTerminator = 0;
-  <b>bit</b> isReMaterializable = 0;
-  <b>bit</b> isPredicable = 0;
-  <b>bit</b> hasDelaySlot = 0;
-  <b>bit</b> usesCustomInserter = 0;
-  <b>bit</b> hasCtrlDep = 0;
-  <b>bit</b> isNotDuplicable = 0;
-  <b>bit</b> hasSideEffects = 0;
-  <b>bit</b> mayHaveSideEffects = 0;
-  <b>bit</b> neverHasSideEffects = 0;
-  InstrItinClass Itinerary = NoItinerary;
-  <b>string</b> Constraints = "";
-  <b>string</b> DisableEncoding = "";
-  <b>bits</b>&lt;8&gt; Opcode = { 0, 0, 0, 0, 0, 0, 0, 1 };
-  Format Form = MRMDestReg;
-  <b>bits</b>&lt;6&gt; FormBits = { 0, 0, 0, 0, 1, 1 };
-  ImmType ImmT = NoImm;
-  <b>bits</b>&lt;3&gt; ImmTypeBits = { 0, 0, 0 };
-  <b>bit</b> hasOpSizePrefix = 0;
-  <b>bit</b> hasAdSizePrefix = 0;
-  <b>bits</b>&lt;4&gt; Prefix = { 0, 0, 0, 0 };
-  <b>bit</b> hasREX_WPrefix = 0;
-  FPFormat FPForm = ?;
-  <b>bits</b>&lt;3&gt; FPFormBits = { 0, 0, 0 };
-}
-...
-</pre>
-</div>
-
-<p>This definition corresponds to a 32-bit register-register add instruction in
-the X86.  The string after the '<tt>def</tt>' string indicates the name of the
-record&mdash;"<tt>ADD32rr</tt>" in this case&mdash;and the comment at the end of
-the line indicates the superclasses of the definition.  The body of the record
-contains all of the data that TableGen assembled for the record, indicating that
-the instruction is part of the "X86" namespace, the pattern indicating how the
-the instruction should be emitted into the assembly file, that it is a
-two-address instruction, has a particular encoding, etc.  The contents and
-semantics of the information in the record is specific to the needs of the X86
-backend, and is only shown as an example.</p>
-
-<p>As you can see, a lot of information is needed for every instruction
-supported by the code generator, and specifying it all manually would be
-unmaintainble, prone to bugs, and tiring to do in the first place.  Because we
-are using TableGen, all of the information was derived from the following
-definition:</p>
-
-<div class="doc_code">
-<pre>
-let Defs = [EFLAGS],
-    isCommutable = 1,                  <i>// X = ADD Y,Z --&gt; X = ADD Z,Y</i>
-    isConvertibleToThreeAddress = 1 <b>in</b> <i>// Can transform into LEA.</i>
-def ADD32rr  : I&lt;0x01, MRMDestReg, (outs GR32:$dst),
-                                   (ins GR32:$src1, GR32:$src2),
-                 "add{l}\t{$src2, $dst|$dst, $src2}",
-                 [(set GR32:$dst, (add GR32:$src1, GR32:$src2))]&gt;;
-</pre>
-</div>
-
-<p>This definition makes use of the custom class <tt>I</tt> (extended from the
-custom class <tt>X86Inst</tt>), which is defined in the X86-specific TableGen
-file, to factor out the common features that instructions of its class share.  A
-key feature of TableGen is that it allows the end-user to define the
-abstractions they prefer to use when describing their information.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="running">Running TableGen</a></div>
-
-<div class="doc_text">
-
-<p>TableGen runs just like any other LLVM tool.  The first (optional) argument
-specifies the file to read.  If a filename is not specified, <tt>tblgen</tt>
-reads from standard input.</p>
-
-<p>To be useful, one of the <a href="#backends">TableGen backends</a> must be
-used.  These backends are selectable on the command line (type '<tt>tblgen
--help</tt>' for a list).  For example, to get a list of all of the definitions
-that subclass a particular type (which can be useful for building up an enum
-list of these records), use the <tt>-print-enums</tt> option:</p>
-
-<div class="doc_code">
-<pre>
-$ tblgen X86.td -print-enums -class=Register
-AH, AL, AX, BH, BL, BP, BPL, BX, CH, CL, CX, DH, DI, DIL, DL, DX, EAX, EBP, EBX,
-ECX, EDI, EDX, EFLAGS, EIP, ESI, ESP, FP0, FP1, FP2, FP3, FP4, FP5, FP6, IP,
-MM0, MM1, MM2, MM3, MM4, MM5, MM6, MM7, R10, R10B, R10D, R10W, R11, R11B, R11D,
-R11W, R12, R12B, R12D, R12W, R13, R13B, R13D, R13W, R14, R14B, R14D, R14W, R15,
-R15B, R15D, R15W, R8, R8B, R8D, R8W, R9, R9B, R9D, R9W, RAX, RBP, RBX, RCX, RDI,
-RDX, RIP, RSI, RSP, SI, SIL, SP, SPL, ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7,
-XMM0, XMM1, XMM10, XMM11, XMM12, XMM13, XMM14, XMM15, XMM2, XMM3, XMM4, XMM5,
-XMM6, XMM7, XMM8, XMM9,
-
-$ tblgen X86.td -print-enums -class=Instruction 
-ABS_F, ABS_Fp32, ABS_Fp64, ABS_Fp80, ADC32mi, ADC32mi8, ADC32mr, ADC32ri,
-ADC32ri8, ADC32rm, ADC32rr, ADC64mi32, ADC64mi8, ADC64mr, ADC64ri32, ADC64ri8,
-ADC64rm, ADC64rr, ADD16mi, ADD16mi8, ADD16mr, ADD16ri, ADD16ri8, ADD16rm,
-ADD16rr, ADD32mi, ADD32mi8, ADD32mr, ADD32ri, ADD32ri8, ADD32rm, ADD32rr,
-ADD64mi32, ADD64mi8, ADD64mr, ADD64ri32, ...
-</pre>
-</div>
-
-<p>The default backend prints out all of the records, as described <a
-href="#example">above</a>.</p>
-
-<p>If you plan to use TableGen, you will most likely have to <a
-href="#backends">write a backend</a> that extracts the information specific to
-what you need and formats it in the appropriate way.</p>
-
-</div>
-
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="syntax">TableGen syntax</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>TableGen doesn't care about the meaning of data (that is up to the backend to
-define), but it does care about syntax, and it enforces a simple type system.
-This section describes the syntax and the constructs allowed in a TableGen file.
-</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="primitives">TableGen primitives</a></div>
-
-<!-- -------------------------------------------------------------------------->
-<div class="doc_subsubsection"><a name="comments">TableGen comments</a></div>
-
-<div class="doc_text">
-
-<p>TableGen supports BCPL style "<tt>//</tt>" comments, which run to the end of
-the line, and it also supports <b>nestable</b> "<tt>/* */</tt>" comments.</p>
-
-</div>
-
-<!-- -------------------------------------------------------------------------->
-<div class="doc_subsubsection">
-  <a name="types">The TableGen type system</a>
-</div>
-
-<div class="doc_text">
-
-<p>TableGen files are strongly typed, in a simple (but complete) type-system.
-These types are used to perform automatic conversions, check for errors, and to
-help interface designers constrain the input that they allow.  Every <a
-href="#valuedef">value definition</a> is required to have an associated type.
-</p>
-
-<p>TableGen supports a mixture of very low-level types (such as <tt>bit</tt>)
-and very high-level types (such as <tt>dag</tt>).  This flexibility is what
-allows it to describe a wide range of information conveniently and compactly.
-The TableGen types are:</p>
-
-<dl>
-<dt><tt><b>bit</b></tt></dt>
-  <dd>A 'bit' is a boolean value that can hold either 0 or 1.</dd>
-
-<dt><tt><b>int</b></tt></dt>
-  <dd>The 'int' type represents a simple 32-bit integer value, such as 5.</dd>
-
-<dt><tt><b>string</b></tt></dt>
-  <dd>The 'string' type represents an ordered sequence of characters of
-  arbitrary length.</dd>
-
-<dt><tt><b>bits</b>&lt;n&gt;</tt></dt>
-  <dd>A 'bits' type is an arbitrary, but fixed, size integer that is broken up
-  into individual bits.  This type is useful because it can handle some bits
-  being defined while others are undefined.</dd>
-
-<dt><tt><b>list</b>&lt;ty&gt;</tt></dt>
-  <dd>This type represents a list whose elements are some other type.  The
-  contained type is arbitrary: it can even be another list type.</dd>
-
-<dt>Class type</dt>
-  <dd>Specifying a class name in a type context means that the defined value
-  must be a subclass of the specified class.  This is useful in conjunction with
-  the <b><tt>list</tt></b> type, for example, to constrain the elements of the
-  list to a common base class (e.g., a <tt><b>list</b>&lt;Register&gt;</tt> can
-  only contain definitions derived from the "<tt>Register</tt>" class).</dd>
-
-<dt><tt><b>dag</b></tt></dt>
-  <dd>This type represents a nestable directed graph of elements.</dd>
-
-<dt><tt><b>code</b></tt></dt>
-  <dd>This represents a big hunk of text. NOTE: I don't remember why this is
-  distinct from string!</dd>
-</dl>
-
-<p>To date, these types have been sufficient for describing things that
-TableGen has been used for, but it is straight-forward to extend this list if
-needed.</p>
-
-</div>
-
-<!-- -------------------------------------------------------------------------->
-<div class="doc_subsubsection">
-  <a name="values">TableGen values and expressions</a>
-</div>
-
-<div class="doc_text">
-
-<p>TableGen allows for a pretty reasonable number of different expression forms
-when building up values.  These forms allow the TableGen file to be written in a
-natural syntax and flavor for the application.  The current expression forms
-supported include:</p>
-
-<dl>
-<dt><tt>?</tt></dt>
-  <dd>uninitialized field</dd>
-<dt><tt>0b1001011</tt></dt>
-  <dd>binary integer value</dd>
-<dt><tt>07654321</tt></dt>
-  <dd>octal integer value (indicated by a leading 0)</dd>
-<dt><tt>7</tt></dt>
-  <dd>decimal integer value</dd>
-<dt><tt>0x7F</tt></dt>
-  <dd>hexadecimal integer value</dd>
-<dt><tt>"foo"</tt></dt>
-  <dd>string value</dd>
-<dt><tt>[{ ... }]</tt></dt>
-  <dd>code fragment</dd>
-<dt><tt>[ X, Y, Z ]&lt;type&gt;</tt></dt>
-  <dd>list value.  &lt;type&gt; is the type of the list 
-element and is usually optional.  In rare cases,
-TableGen is unable to deduce the element type in
-which case the user must specify it explicitly.</dd>
-<dt><tt>{ a, b, c }</tt></dt>
-  <dd>initializer for a "bits&lt;3&gt;" value</dd>
-<dt><tt>value</tt></dt>
-  <dd>value reference</dd>
-<dt><tt>value{17}</tt></dt>
-  <dd>access to one bit of a value</dd>
-<dt><tt>value{15-17}</tt></dt>
-  <dd>access to multiple bits of a value</dd>
-<dt><tt>DEF</tt></dt>
-  <dd>reference to a record definition</dd>
-<dt><tt>CLASS&lt;val list&gt;</tt></dt>
-  <dd>reference to a new anonymous definition of CLASS with the specified
-      template arguments.</dd>
-<dt><tt>X.Y</tt></dt>
-  <dd>reference to the subfield of a value</dd>
-<dt><tt>list[4-7,17,2-3]</tt></dt>
-  <dd>A slice of the 'list' list, including elements 4,5,6,7,17,2, and 3 from
-  it.  Elements may be included multiple times.</dd>
-<dt><tt>(DEF a, b)</tt></dt>
-  <dd>a dag value.  The first element is required to be a record definition, the
-  remaining elements in the list may be arbitrary other values, including nested
-  `<tt>dag</tt>' values.</dd>
-<dt><tt>!strconcat(a, b)</tt></dt>
-  <dd>A string value that is the result of concatenating the 'a' and 'b'
-  strings.</dd>
-<dt><tt>!cast&lt;type&gt;(a)</tt></dt>
-  <dd>A symbol of type <em>type</em> obtained by looking up the string 'a' in
-the symbol table.  If the type of 'a' does not match <em>type</em>, TableGen
-aborts with an error. !cast&lt;string&gt; is a special case in that the argument must
-be an object defined by a 'def' construct.</dd>
-<dt><tt>!nameconcat&lt;type&gt;(a, b)</tt></dt>
-  <dd>Shorthand for !cast&lt;type&gt;(!strconcat(a, b))</dd>
-<dt><tt>!subst(a, b, c)</tt></dt>
-  <dd>If 'a' and 'b' are of string type or are symbol references, substitute 
-'b' for 'a' in 'c.'  This operation is analogous to $(subst) in GNU make.</dd>
-<dt><tt>!foreach(a, b, c)</tt></dt>
-  <dd>For each member 'b' of dag or list 'a' apply operator 'c.'  'b' is a 
-dummy variable that should be declared as a member variable of an instantiated 
-class.  This operation is analogous to $(foreach) in GNU make.</dd>
-<dt><tt>!car(a)</tt></dt>
-  <dd>The first element of list 'a.'</dd>
-<dt><tt>!cdr(a)</tt></dt>
-  <dd>The 2nd-N elements of list 'a.'</dd>
-<dt><tt>!null(a)</tt></dt>
-  <dd>An integer {0,1} indicating whether list 'a' is empty.</dd>
-<dt><tt>!if(a,b,c)</tt></dt>
-  <dd>'b' if the result of integer operator 'a' is nonzero, 'c' otherwise.</dd>
-<dt><tt>!eq(a,b)</tt></dt>
-  <dd>Integer one if string a is equal to string b, zero otherwise.  This
-      only operates on string objects.  Use !cast<string> to compare other
-      types of objects.</dd>
-</dl>
-
-<p>Note that all of the values have rules specifying how they convert to values
-for different types.  These rules allow you to assign a value like "<tt>7</tt>"
-to a "<tt>bits&lt;4&gt;</tt>" value, for example.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="classesdefs">Classes and definitions</a>
-</div>
-
-<div class="doc_text">
-
-<p>As mentioned in the <a href="#concepts">intro</a>, classes and definitions
-(collectively known as 'records') in TableGen are the main high-level unit of
-information that TableGen collects.  Records are defined with a <tt>def</tt> or
-<tt>class</tt> keyword, the record name, and an optional list of "<a
-href="#templateargs">template arguments</a>".  If the record has superclasses,
-they are specified as a comma separated list that starts with a colon character
-("<tt>:</tt>").  If <a href="#valuedef">value definitions</a> or <a
-href="#recordlet">let expressions</a> are needed for the class, they are
-enclosed in curly braces ("<tt>{}</tt>"); otherwise, the record ends with a
-semicolon.</p>
-
-<p>Here is a simple TableGen file:</p>
-
-<div class="doc_code">
-<pre>
-<b>class</b> C { <b>bit</b> V = 1; }
-<b>def</b> X : C;
-<b>def</b> Y : C {
-  <b>string</b> Greeting = "hello";
-}
-</pre>
-</div>
-
-<p>This example defines two definitions, <tt>X</tt> and <tt>Y</tt>, both of
-which derive from the <tt>C</tt> class.  Because of this, they both get the
-<tt>V</tt> bit value.  The <tt>Y</tt> definition also gets the Greeting member
-as well.</p>
-
-<p>In general, classes are useful for collecting together the commonality
-between a group of records and isolating it in a single place.  Also, classes
-permit the specification of default values for their subclasses, allowing the
-subclasses to override them as they wish.</p>
-
-</div>
-
-<!---------------------------------------------------------------------------->
-<div class="doc_subsubsection">
-  <a name="valuedef">Value definitions</a>
-</div>
-
-<div class="doc_text">
-
-<p>Value definitions define named entries in records.  A value must be defined
-before it can be referred to as the operand for another value definition or
-before the value is reset with a <a href="#recordlet">let expression</a>.  A
-value is defined by specifying a <a href="#types">TableGen type</a> and a name.
-If an initial value is available, it may be specified after the type with an
-equal sign.  Value definitions require terminating semicolons.</p>
-
-</div>
-
-<!-- -------------------------------------------------------------------------->
-<div class="doc_subsubsection">
-  <a name="recordlet">'let' expressions</a>
-</div>
-
-<div class="doc_text">
-
-<p>A record-level let expression is used to change the value of a value
-definition in a record.  This is primarily useful when a superclass defines a
-value that a derived class or definition wants to override.  Let expressions
-consist of the '<tt>let</tt>' keyword followed by a value name, an equal sign
-("<tt>=</tt>"), and a new value.  For example, a new class could be added to the
-example above, redefining the <tt>V</tt> field for all of its subclasses:</p>
-
-<div class="doc_code">
-<pre>
-<b>class</b> D : C { let V = 0; }
-<b>def</b> Z : D;
-</pre>
-</div>
-
-<p>In this case, the <tt>Z</tt> definition will have a zero value for its "V"
-value, despite the fact that it derives (indirectly) from the <tt>C</tt> class,
-because the <tt>D</tt> class overrode its value.</p>
-
-</div>
-
-<!-- -------------------------------------------------------------------------->
-<div class="doc_subsubsection">
-  <a name="templateargs">Class template arguments</a>
-</div>
-
-<div class="doc_text">
-
-<p>TableGen permits the definition of parameterized classes as well as normal
-concrete classes.  Parameterized TableGen classes specify a list of variable
-bindings (which may optionally have defaults) that are bound when used.  Here is
-a simple example:</p>
-
-<div class="doc_code">
-<pre>
-<b>class</b> FPFormat&lt;<b>bits</b>&lt;3&gt; val&gt; {
-  <b>bits</b>&lt;3&gt; Value = val;
-}
-<b>def</b> NotFP      : FPFormat&lt;0&gt;;
-<b>def</b> ZeroArgFP  : FPFormat&lt;1&gt;;
-<b>def</b> OneArgFP   : FPFormat&lt;2&gt;;
-<b>def</b> OneArgFPRW : FPFormat&lt;3&gt;;
-<b>def</b> TwoArgFP   : FPFormat&lt;4&gt;;
-<b>def</b> CompareFP  : FPFormat&lt;5&gt;;
-<b>def</b> CondMovFP  : FPFormat&lt;6&gt;;
-<b>def</b> SpecialFP  : FPFormat&lt;7&gt;;
-</pre>
-</div>
-
-<p>In this case, template arguments are used as a space efficient way to specify
-a list of "enumeration values", each with a "<tt>Value</tt>" field set to the
-specified integer.</p>
-
-<p>The more esoteric forms of <a href="#values">TableGen expressions</a> are
-useful in conjunction with template arguments.  As an example:</p>
-
-<div class="doc_code">
-<pre>
-<b>class</b> ModRefVal&lt;<b>bits</b>&lt;2&gt; val&gt; {
-  <b>bits</b>&lt;2&gt; Value = val;
-}
-
-<b>def</b> None   : ModRefVal&lt;0&gt;;
-<b>def</b> Mod    : ModRefVal&lt;1&gt;;
-<b>def</b> Ref    : ModRefVal&lt;2&gt;;
-<b>def</b> ModRef : ModRefVal&lt;3&gt;;
-
-<b>class</b> Value&lt;ModRefVal MR&gt; {
-  <i>// Decode some information into a more convenient format, while providing
-  // a nice interface to the user of the "Value" class.</i>
-  <b>bit</b> isMod = MR.Value{0};
-  <b>bit</b> isRef = MR.Value{1};
-
-  <i>// other stuff...</i>
-}
-
-<i>// Example uses</i>
-<b>def</b> bork : Value&lt;Mod&gt;;
-<b>def</b> zork : Value&lt;Ref&gt;;
-<b>def</b> hork : Value&lt;ModRef&gt;;
-</pre>
-</div>
-
-<p>This is obviously a contrived example, but it shows how template arguments
-can be used to decouple the interface provided to the user of the class from the
-actual internal data representation expected by the class.  In this case,
-running <tt>tblgen</tt> on the example prints the following definitions:</p>
-
-<div class="doc_code">
-<pre>
-<b>def</b> bork {      <i>// Value</i>
-  <b>bit</b> isMod = 1;
-  <b>bit</b> isRef = 0;
-}
-<b>def</b> hork {      <i>// Value</i>
-  <b>bit</b> isMod = 1;
-  <b>bit</b> isRef = 1;
-}
-<b>def</b> zork {      <i>// Value</i>
-  <b>bit</b> isMod = 0;
-  <b>bit</b> isRef = 1;
-}
-</pre>
-</div>
-
-<p> This shows that TableGen was able to dig into the argument and extract a
-piece of information that was requested by the designer of the "Value" class.
-For more realistic examples, please see existing users of TableGen, such as the
-X86 backend.</p>
-
-</div>
-
-<!-- -------------------------------------------------------------------------->
-<div class="doc_subsubsection">
-  <a name="multiclass">Multiclass definitions and instances</a>
-</div>
-
-<div class="doc_text">
-
-<p>
-While classes with template arguments are a good way to factor commonality
-between two instances of a definition, multiclasses allow a convenient notation
-for defining multiple definitions at once (instances of implicitly constructed
-classes).  For example, consider an 3-address instruction set whose instructions
-come in two forms: "<tt>reg = reg op reg</tt>" and "<tt>reg = reg op imm</tt>"
-(e.g. SPARC). In this case, you'd like to specify in one place that this
-commonality exists, then in a separate place indicate what all the ops are.
-</p>
-
-<p>
-Here is an example TableGen fragment that shows this idea:
-</p>
-
-<div class="doc_code">
-<pre>
-<b>def</b> ops;
-<b>def</b> GPR;
-<b>def</b> Imm;
-<b>class</b> inst&lt;<b>int</b> opc, <b>string</b> asmstr, <b>dag</b> operandlist&gt;;
-
-<b>multiclass</b> ri_inst&lt;<b>int</b> opc, <b>string</b> asmstr&gt; {
-  def _rr : inst&lt;opc, !strconcat(asmstr, " $dst, $src1, $src2"),
-                 (ops GPR:$dst, GPR:$src1, GPR:$src2)&gt;;
-  def _ri : inst&lt;opc, !strconcat(asmstr, " $dst, $src1, $src2"),
-                 (ops GPR:$dst, GPR:$src1, Imm:$src2)&gt;;
-}
-
-<i>// Instantiations of the ri_inst multiclass.</i>
-<b>defm</b> ADD : ri_inst&lt;0b111, "add"&gt;;
-<b>defm</b> SUB : ri_inst&lt;0b101, "sub"&gt;;
-<b>defm</b> MUL : ri_inst&lt;0b100, "mul"&gt;;
-...
-</pre>
-</div>
-
-<p>The name of the resultant definitions has the multidef fragment names
-   appended to them, so this defines <tt>ADD_rr</tt>, <tt>ADD_ri</tt>,
-   <tt>SUB_rr</tt>, etc.  A defm may inherit from multiple multiclasses,
-   instantiating definitions from each multiclass.  Using a multiclass
-   this way is exactly equivalent to instantiating the classes multiple
-   times yourself, e.g. by writing:</p>
-
-<div class="doc_code">
-<pre>
-<b>def</b> ops;
-<b>def</b> GPR;
-<b>def</b> Imm;
-<b>class</b> inst&lt;<b>int</b> opc, <b>string</b> asmstr, <b>dag</b> operandlist&gt;;
-
-<b>class</b> rrinst&lt;<b>int</b> opc, <b>string</b> asmstr&gt;
-  : inst&lt;opc, !strconcat(asmstr, " $dst, $src1, $src2"),
-         (ops GPR:$dst, GPR:$src1, GPR:$src2)&gt;;
-
-<b>class</b> riinst&lt;<b>int</b> opc, <b>string</b> asmstr&gt;
-  : inst&lt;opc, !strconcat(asmstr, " $dst, $src1, $src2"),
-         (ops GPR:$dst, GPR:$src1, Imm:$src2)&gt;;
-
-<i>// Instantiations of the ri_inst multiclass.</i>
-<b>def</b> ADD_rr : rrinst&lt;0b111, "add"&gt;;
-<b>def</b> ADD_ri : riinst&lt;0b111, "add"&gt;;
-<b>def</b> SUB_rr : rrinst&lt;0b101, "sub"&gt;;
-<b>def</b> SUB_ri : riinst&lt;0b101, "sub"&gt;;
-<b>def</b> MUL_rr : rrinst&lt;0b100, "mul"&gt;;
-<b>def</b> MUL_ri : riinst&lt;0b100, "mul"&gt;;
-...
-</pre>
-</div>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="filescope">File scope entities</a>
-</div>
-
-<!-- -------------------------------------------------------------------------->
-<div class="doc_subsubsection">
-  <a name="include">File inclusion</a>
-</div>
-
-<div class="doc_text">
-<p>TableGen supports the '<tt>include</tt>' token, which textually substitutes
-the specified file in place of the include directive.  The filename should be
-specified as a double quoted string immediately after the '<tt>include</tt>'
-keyword.  Example:</p>
-
-<div class="doc_code">
-<pre>
-<b>include</b> "foo.td"
-</pre>
-</div>
-
-</div>
-
-<!-- -------------------------------------------------------------------------->
-<div class="doc_subsubsection">
-  <a name="globallet">'let' expressions</a>
-</div>
-
-<div class="doc_text">
-
-<p>"Let" expressions at file scope are similar to <a href="#recordlet">"let"
-expressions within a record</a>, except they can specify a value binding for
-multiple records at a time, and may be useful in certain other cases.
-File-scope let expressions are really just another way that TableGen allows the
-end-user to factor out commonality from the records.</p>
-
-<p>File-scope "let" expressions take a comma-separated list of bindings to
-apply, and one or more records to bind the values in.  Here are some
-examples:</p>
-
-<div class="doc_code">
-<pre>
-<b>let</b> isTerminator = 1, isReturn = 1, isBarrier = 1, hasCtrlDep = 1 <b>in</b>
-  <b>def</b> RET : I&lt;0xC3, RawFrm, (outs), (ins), "ret", [(X86retflag 0)]&gt;;
-
-<b>let</b> isCall = 1 <b>in</b>
-  <i>// All calls clobber the non-callee saved registers...</i>
-  <b>let</b> Defs = [EAX, ECX, EDX, FP0, FP1, FP2, FP3, FP4, FP5, FP6, ST0,
-              MM0, MM1, MM2, MM3, MM4, MM5, MM6, MM7,
-              XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7, EFLAGS] <b>in</b> {
-    <b>def</b> CALLpcrel32 : Ii32&lt;0xE8, RawFrm, (outs), (ins i32imm:$dst,variable_ops),
-                           "call\t${dst:call}", []&gt;;
-    <b>def</b> CALL32r     : I&lt;0xFF, MRM2r, (outs), (ins GR32:$dst, variable_ops),
-                        "call\t{*}$dst", [(X86call GR32:$dst)]&gt;;
-    <b>def</b> CALL32m     : I&lt;0xFF, MRM2m, (outs), (ins i32mem:$dst, variable_ops),
-                        "call\t{*}$dst", []&gt;;
-  }
-</pre>
-</div>
-
-<p>File-scope "let" expressions are often useful when a couple of definitions
-need to be added to several records, and the records do not otherwise need to be
-opened, as in the case with the <tt>CALL*</tt> instructions above.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="codegen">Code Generator backend info</a></div>
-<!-- *********************************************************************** -->
-
-<p>Expressions used by code generator to describe instructions and isel
-patterns:</p>
-
-<div class="doc_text">
-
-<dt><tt>(implicit a)</tt></dt>
-  <dd>an implicitly defined physical register.  This tells the dag instruction
-  selection emitter the input pattern's extra definitions matches implicit
-  physical register definitions.</dd>
-<dt><tt>(parallel (a), (b))</tt></dt>
-  <dd>a list of dags specifying parallel operations which map to the same
-  instruction.</dd>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="backends">TableGen backends</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>TODO: How they work, how to write one.  This section should not contain
-details about any particular backend, except maybe -print-enums as an example.
-This should highlight the APIs in <tt>TableGen/Record.h</tt>.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-
-<hr>
-<address>
-  <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
-  src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS"></a>
-  <a href="http://validator.w3.org/check/referer"><img
-  src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
-
-  <a href="mailto:sabre at nondot.org">Chris Lattner</a><br>
-  <a href="http://llvm.org">LLVM Compiler Infrastructure</a><br>
-  Last modified: $Date$
-</address>
-
-</body>
-</html>
diff --git a/libclamav/c++/llvm/docs/TestingGuide.html b/libclamav/c++/llvm/docs/TestingGuide.html
deleted file mode 100644
index 43c414d..0000000
--- a/libclamav/c++/llvm/docs/TestingGuide.html
+++ /dev/null
@@ -1,1223 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-                      "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-  <title>LLVM Testing Infrastructure Guide</title>
-  <link rel="stylesheet" href="llvm.css" type="text/css">
-</head>
-<body>
-      
-<div class="doc_title">
-  LLVM Testing Infrastructure Guide
-</div>
-
-<ol>
-  <li><a href="#overview">Overview</a></li>
-  <li><a href="#requirements">Requirements</a></li>
-  <li><a href="#org">LLVM testing infrastructure organization</a>
-    <ul>
-      <li><a href="#dejagnu">DejaGNU tests</a></li>
-      <li><a href="#testsuite">Test suite</a></li>
-    </ul>
-  </li>
-  <li><a href="#quick">Quick start</a>
-    <ul>
-      <li><a href="#quickdejagnu">DejaGNU tests</a></li>
-      <li><a href="#quicktestsuite">Test suite</a></li>
-   </ul>
-  </li>
-  <li><a href="#dgstructure">DejaGNU structure</a>
-    <ul>
-      <li><a href="#dgcustom">Writing new DejaGNU tests</a></li>
-      <li><a href="#FileCheck">The FileCheck utility</a></li>
-      <li><a href="#dgvars">Variables and substitutions</a></li>
-      <li><a href="#dgfeatures">Other features</a></li>
-   </ul>
-  </li>
-  <li><a href="#testsuitestructure">Test suite structure</a></li>
-  <li><a href="#testsuiterun">Running the test suite</a>
-    <ul>
-      <li><a href="#testsuiteexternal">Configuring External Tests</a></li>
-      <li><a href="#testsuitetests">Running different tests</a></li>
-      <li><a href="#testsuiteoutput">Generating test output</a></li>
-      <li><a href="#testsuitecustom">Writing custom tests for llvm-test</a></li>
-   </ul>
-  </li>
-  <li><a href="#nightly">Running the nightly tester</a></li>
-</ol>
-
-<div class="doc_author">
-  <p>Written by John T. Criswell, <a
-  href="http://llvm.x10sys.com/rspencer">Reid Spencer</a>, and Tanya Lattner</p>
-</div>
-
-<!--=========================================================================-->
-<div class="doc_section"><a name="overview">Overview</a></div>
-<!--=========================================================================-->
-
-<div class="doc_text">
-
-<p>This document is the reference manual for the LLVM testing infrastructure. It documents
-the structure of the LLVM testing infrastructure, the tools needed to use it,
-and how to add and run tests.</p>
-
-</div>
-
-<!--=========================================================================-->
-<div class="doc_section"><a name="requirements">Requirements</a></div>
-<!--=========================================================================-->
-
-<div class="doc_text">
-
-<p>In order to use the LLVM testing infrastructure, you will need all of the software
-required to build LLVM, plus the following:</p>
-
-<dl>
-<dt><a href="http://www.gnu.org/software/dejagnu/">DejaGNU</a></dt>
-<dd>The Feature and Regressions tests are organized and run by DejaGNU.</dd>
-<dt><a href="http://expect.nist.gov/">Expect</a></dt>
-<dd>Expect is required by DejaGNU.</dd>
-<dt><a href="http://www.tcl.tk/software/tcltk/">tcl</a></dt>
-<dd>Tcl is required by DejaGNU. </dd>
-</dl>
-
-</div>
-
-<!--=========================================================================-->
-<div class="doc_section"><a name="org">LLVM testing infrastructure organization</a></div>
-<!--=========================================================================-->
-
-<div class="doc_text">
-
-<p>The LLVM testing infrastructure contains two major categories of tests: code
-fragments and whole programs. Code fragments are referred to as the "DejaGNU
-tests" and are in the <tt>llvm</tt> module in subversion under the
-<tt>llvm/test</tt> directory. The whole programs tests are referred to as the
-"Test suite" and are in the <tt>test-suite</tt> module in subversion.
-</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsection"><a name="dejagnu">DejaGNU tests</a></div>
-<!-- _______________________________________________________________________ -->
-
-<div class="doc_text">
-
-<p>Code fragments are small pieces of code that test a specific
-feature of LLVM or trigger a specific bug in LLVM.  They are usually
-written in LLVM assembly language, but can be written in other
-languages if the test targets a particular language front end (and the
-appropriate <tt>--with-llvmgcc</tt> options were used
-at <tt>configure</tt> time of the <tt>llvm</tt> module). These tests
-are driven by the DejaGNU testing framework, which is hidden behind a
-few simple makefiles.</p>
-
-<p>These code fragments are not complete programs. The code generated
-from them is never executed to determine correct behavior.</p>
-
-<p>These code fragment tests are located in the <tt>llvm/test</tt>
-directory.</p>
-
-<p>Typically when a bug is found in LLVM, a regression test containing 
-just enough code to reproduce the problem should be written and placed 
-somewhere underneath this directory.  In most cases, this will be a small 
-piece of LLVM assembly language code, often distilled from an actual 
-application or benchmark.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsection"><a name="testsuite">Test suite</a></div>
-<!-- _______________________________________________________________________ -->
-
-<div class="doc_text">
-
-<p>The test suite contains whole programs, which are pieces of
-code which can be compiled and linked into a stand-alone program that can be
-executed.  These programs are generally written in high level languages such as
-C or C++, but sometimes they are written straight in LLVM assembly.</p>
-
-<p>These programs are compiled and then executed using several different
-methods (native compiler, LLVM C backend, LLVM JIT, LLVM native code generation,
-etc).  The output of these programs is compared to ensure that LLVM is compiling
-the program correctly.</p>
-
-<p>In addition to compiling and executing programs, whole program tests serve as
-a way of benchmarking LLVM performance, both in terms of the efficiency of the
-programs generated as well as the speed with which LLVM compiles, optimizes, and
-generates code.</p>
-
-<p>The test-suite is located in the <tt>test-suite</tt> Subversion module.</p> 
-
-</div>
-
-<!--=========================================================================-->
-<div class="doc_section"><a name="quick">Quick start</a></div>
-<!--=========================================================================-->
-
-<div class="doc_text">
-
-  <p>The tests are located in two separate Subversion modules. The
-  DejaGNU tests are in the main "llvm" module under the directory 
-  <tt>llvm/test</tt> (so you get these tests for free with the main llvm tree).
-  The more comprehensive test suite that includes whole 
-programs in C and C++ is in the <tt>test-suite</tt> module. This module should
-be checked out to the <tt>llvm/projects</tt> directory (don't use another name
-then the default "test-suite", for then the test suite will be run every time
-you run <tt>make</tt> in the main <tt>llvm</tt> directory).
-When you <tt>configure</tt> the <tt>llvm</tt> module, 
-the <tt>test-suite</tt> directory will be automatically configured. 
-Alternatively, you can configure the <tt>test-suite</tt> module manually.</p>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsection"><a name="quickdejagnu">DejaGNU tests</a></div>
-<!-- _______________________________________________________________________ -->
-<p>To run all of the simple tests in LLVM using DejaGNU, use the master Makefile
- in the <tt>llvm/test</tt> directory:</p>
-
-<div class="doc_code">
-<pre>
-% gmake -C llvm/test
-</pre>
-</div>
-
-<p>or</p>
-
-<div class="doc_code">
-<pre>
-% gmake check
-</pre>
-</div>
-
-<p>To run only a subdirectory of tests in <tt>llvm/test</tt> using DejaGNU (ie.
-Transforms), just set the TESTSUITE variable to the path of the
-subdirectory (relative to <tt>llvm/test</tt>):</p>
-
-<div class="doc_code">
-<pre>
-% gmake TESTSUITE=Transforms check
-</pre>
-</div>
-
-<p><b>Note: If you are running the tests with <tt>objdir != subdir</tt>, you
-must have run the complete testsuite before you can specify a
-subdirectory.</b></p>
-
-<p>To run only a single test, set <tt>TESTONE</tt> to its path (relative to
-<tt>llvm/test</tt>) and make the <tt>check-one</tt> target:</p>
-
-<div class="doc_code">
-<pre>
-% gmake TESTONE=Feature/basictest.ll check-one
-</pre>
-</div>
-
-<p>To run the tests with Valgrind (Memcheck by default), just append
-<tt>VG=1</tt> to the commands above, e.g.:</p>
-
-<div class="doc_code">
-<pre>
-% gmake check VG=1
-</pre>
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsection"><a name="quicktestsuite">Test suite</a></div>
-<!-- _______________________________________________________________________ -->
-
-<p>To run the comprehensive test suite (tests that compile and execute whole 
-programs), first checkout and setup the <tt>test-suite</tt> module:</p>
-
-<div class="doc_code">
-<pre>
-% cd llvm/projects
-% svn co http://llvm.org/svn/llvm-project/test-suite/trunk test-suite
-% cd ..
-% ./configure --with-llvmgccdir=$LLVM_GCC_DIR
-</pre>
-</div>
-
-<p>where <tt>$LLVM_GCC_DIR</tt> is the directory where
-you <em>installed</em> llvm-gcc, not it's src or obj
-dir. The <tt>--with-llvmgccdir</tt> option assumes that
-the <tt>llvm-gcc-4.2</tt> module was configured with
-<tt>--program-prefix=llvm-</tt>, and therefore that the C and C++
-compiler drivers are called <tt>llvm-gcc</tt> and <tt>llvm-g++</tt>
-respectively.  If this is not the case,
-use <tt>--with-llvmgcc</tt>/<tt>--with-llvmgxx</tt> to specify each
-executable's location.</p>
-
-<p>Then, run the entire test suite by running make in the <tt>test-suite</tt>
-directory:</p>
-
-<div class="doc_code">
-<pre>
-% cd projects/test-suite
-% gmake
-</pre>
-</div>
-
-<p>Usually, running the "nightly" set of tests is a good idea, and you can also
-let it generate a report by running:</p>
-
-<div class="doc_code">
-<pre>
-% cd projects/test-suite
-% gmake TEST=nightly report report.html
-</pre>
-</div>
-
-<p>Any of the above commands can also be run in a subdirectory of
-<tt>projects/test-suite</tt> to run the specified test only on the programs in
-that subdirectory.</p>
-
-</div>
-
-<!--=========================================================================-->
-<div class="doc_section"><a name="dgstructure">DejaGNU structure</a></div>
-<!--=========================================================================-->
-<div class="doc_text">
-  <p>The LLVM DejaGNU tests are driven by DejaGNU together with GNU Make and are
-  located in the <tt>llvm/test</tt> directory.
-
-  <p>This directory contains a large array of small tests
-  that exercise various features of LLVM and to ensure that regressions do not
-  occur. The directory is broken into several sub-directories, each focused on
-  a particular area of LLVM. A few of the important ones are:</p>
-
-  <ul>
-    <li><tt>Analysis</tt>: checks Analysis passes.</li>
-    <li><tt>Archive</tt>: checks the Archive library.</li>
-    <li><tt>Assembler</tt>: checks Assembly reader/writer functionality.</li>
-    <li><tt>Bitcode</tt>: checks Bitcode reader/writer functionality.</li>
-    <li><tt>CodeGen</tt>: checks code generation and each target.</li>
-    <li><tt>Features</tt>: checks various features of the LLVM language.</li>
-    <li><tt>Linker</tt>: tests bitcode linking.</li>
-    <li><tt>Transforms</tt>: tests each of the scalar, IPO, and utility
-    transforms to ensure they make the right transformations.</li>
-    <li><tt>Verifier</tt>: tests the IR verifier.</li>
-  </ul>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsection"><a name="dgcustom">Writing new DejaGNU tests</a></div>
-<!-- _______________________________________________________________________ -->
-<div class="doc_text">
-  <p>The DejaGNU structure is very simple, but does require some information to 
-  be set. This information is gathered via <tt>configure</tt> and is written 
-  to a file, <tt>site.exp</tt> in <tt>llvm/test</tt>. The <tt>llvm/test</tt> 
-  Makefile does this work for you.</p>
-
-  <p>In order for DejaGNU to work, each directory of tests must have a 
-  <tt>dg.exp</tt> file. DejaGNU looks for this file to determine how to run the
-  tests. This file is just a Tcl script and it can do anything you want, but 
-  we've standardized it for the LLVM regression tests. If you're adding a
-  directory of tests, just copy <tt>dg.exp</tt> from another directory to get
-  running. The standard <tt>dg.exp</tt> simply loads a Tcl 
-  library (<tt>test/lib/llvm.exp</tt>) and calls the <tt>llvm_runtests</tt> 
-  function defined in that library with a list of file names to run. The names 
-  are obtained by using Tcl's glob command.  Any directory that contains only
-  directories does not need the <tt>dg.exp</tt> file.</p>
-
-  <p>The <tt>llvm-runtests</tt> function lookas at each file that is passed to
-  it and gathers any lines together that match "RUN:". This are the "RUN" lines
-  that specify how the test is to be run. So, each test script must contain
-  RUN lines if it is to do anything. If there are no RUN lines, the
-  <tt>llvm-runtests</tt> function will issue an error and the test will
-  fail.</p>
-
-  <p>RUN lines are specified in the comments of the test program using the 
-  keyword <tt>RUN</tt> followed by a colon, and lastly the command (pipeline) 
-  to execute.  Together, these lines form the "script" that 
-  <tt>llvm-runtests</tt> executes to run the test case.  The syntax of the
-  RUN lines is similar to a shell's syntax for pipelines including I/O
-  redirection and variable substitution.  However, even though these lines 
-  may <i>look</i> like a shell script, they are not. RUN lines are interpreted 
-  directly by the Tcl <tt>exec</tt> command. They are never executed by a 
-  shell. Consequently the syntax differs from normal shell script syntax in a 
-  few ways.  You can specify as many RUN lines as needed.</p>
-
-  <p>Each RUN line is executed on its own, distinct from other lines unless
-  its last character is <tt>\</tt>. This continuation character causes the RUN
-  line to be concatenated with the next one. In this way you can build up long
-  pipelines of commands without making huge line lengths. The lines ending in
-  <tt>\</tt> are concatenated until a RUN line that doesn't end in <tt>\</tt> is
-  found. This concatenated set of RUN lines then constitutes one execution. 
-  Tcl will substitute variables and arrange for the pipeline to be executed. If
-  any process in the pipeline fails, the entire line (and test case) fails too.
-  </p>
-
-  <p> Below is an example of legal RUN lines in a <tt>.ll</tt> file:</p>
-
-<div class="doc_code">
-<pre>
-; RUN: llvm-as &lt; %s | llvm-dis &gt; %t1
-; RUN: llvm-dis &lt; %s.bc-13 &gt; %t2
-; RUN: diff %t1 %t2
-</pre>
-</div>
-
-  <p>As with a Unix shell, the RUN: lines permit pipelines and I/O redirection
-  to be used. However, the usage is slightly different than for Bash. To check
-  what's legal, see the documentation for the 
-  <a href="http://www.tcl.tk/man/tcl8.5/TclCmd/exec.htm#M2">Tcl exec</a>
-  command and the 
-  <a href="http://www.tcl.tk/man/tcl8.5/tutorial/Tcl26.html">tutorial</a>. 
-  The major differences are:</p>
-  <ul>
-    <li>You can't do <tt>2&gt;&amp;1</tt>. That will cause Tcl to write to a
-    file named <tt>&amp;1</tt>. Usually this is done to get stderr to go through
-    a pipe. You can do that in tcl with <tt>|&amp;</tt> so replace this idiom:
-    <tt>... 2&gt;&amp;1 | grep</tt> with <tt>... |&amp; grep</tt></li>
-    <li>You can only redirect to a file, not to another descriptor and not from
-    a here document.</li>
-    <li>tcl supports redirecting to open files with the @ syntax but you
-    shouldn't use that here.</li>
-  </ul>
-
-  <p>There are some quoting rules that you must pay attention to when writing
-  your RUN lines. In general nothing needs to be quoted. Tcl won't strip off any
-  ' or " so they will get passed to the invoked program. For example:</p>
-
-<div class="doc_code">
-<pre>
-... | grep 'find this string'
-</pre>
-</div>
-
-  <p>This will fail because the ' characters are passed to grep. This would
-  instruction grep to look for <tt>'find</tt> in the files <tt>this</tt> and
-  <tt>string'</tt>. To avoid this use curly braces to tell Tcl that it should
-  treat everything enclosed as one value. So our example would become:</p>
-
-<div class="doc_code">
-<pre>
-... | grep {find this string}
-</pre>
-</div>
-
-  <p>Additionally, the characters <tt>[</tt> and <tt>]</tt> are treated 
-  specially by Tcl. They tell Tcl to interpret the content as a command to
-  execute. Since these characters are often used in regular expressions this can
-  have disastrous results and cause the entire test run in a directory to fail.
-  For example, a common idiom is to look for some basicblock number:</p>
-
-<div class="doc_code">
-<pre>
-... | grep bb[2-8]
-</pre>
-</div>
-
-  <p>This, however, will cause Tcl to fail because its going to try to execute
-  a program named "2-8". Instead, what you want is this:</p>
-
-<div class="doc_code">
-<pre>
-... | grep {bb\[2-8\]}
-</pre>
-</div>
-
-  <p>Finally, if you need to pass the <tt>\</tt> character down to a program,
-  then it must be doubled. This is another Tcl special character. So, suppose
-  you had:
-
-<div class="doc_code">
-<pre>
-... | grep 'i32\*'
-</pre>
-</div>
-
-  <p>This will fail to match what you want (a pointer to i32). First, the
-  <tt>'</tt> do not get stripped off. Second, the <tt>\</tt> gets stripped off
-  by Tcl so what grep sees is: <tt>'i32*'</tt>. That's not likely to match
-  anything. To resolve this you must use <tt>\\</tt> and the <tt>{}</tt>, like
-  this:</p>
-
-<div class="doc_code">
-<pre>
-... | grep {i32\\*}
-</pre>
-</div>
-
-<p>If your system includes GNU <tt>grep</tt>, make sure
-that <tt>GREP_OPTIONS</tt> is not set in your environment. Otherwise,
-you may get invalid results (both false positives and false
-negatives).</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsection"><a name="FileCheck">The FileCheck utility</a></div>
-<!-- _______________________________________________________________________ -->
-
-<div class="doc_text">
-
-<p>A powerful feature of the RUN: lines is that it allows any arbitrary commands
-   to be executed as part of the test harness.  While standard (portable) unix
-   tools like 'grep' work fine on run lines, as you see above, there are a lot
-   of caveats due to interaction with Tcl syntax, and we want to make sure the
-   run lines are portable to a wide range of systems.  Another major problem is
-   that grep is not very good at checking to verify that the output of a tools
-   contains a series of different output in a specific order.  The FileCheck
-   tool was designed to help with these problems.</p>
-
-<p>FileCheck (whose basic command line arguments are described in <a
-   href="http://llvm.org/cmds/FileCheck.html">the FileCheck man page</a> is
-   designed to read a file to check from standard input, and the set of things
-   to verify from a file specified as a command line argument.  A simple example
-   of using FileCheck from a RUN line looks like this:</p>
-   
-<div class="doc_code">
-<pre>
-; RUN: llvm-as &lt; %s | llc -march=x86-64 | <b>FileCheck %s</b>
-</pre>
-</div>
-
-<p>This syntax says to pipe the current file ("%s") into llvm-as, pipe that into
-llc, then pipe the output of llc into FileCheck.  This means that FileCheck will
-be verifying its standard input (the llc output) against the filename argument
-specified (the original .ll file specified by "%s").  To see how this works,
-lets look at the rest of the .ll file (after the RUN line):</p>
-
-<div class="doc_code">
-<pre>
-define void @sub1(i32* %p, i32 %v) {
-entry:
-; <b>CHECK: sub1:</b>
-; <b>CHECK: subl</b>
-        %0 = tail call i32 @llvm.atomic.load.sub.i32.p0i32(i32* %p, i32 %v)
-        ret void
-}
-
-define void @inc4(i64* %p) {
-entry:
-; <b>CHECK: inc4:</b>
-; <b>CHECK: incq</b>
-        %0 = tail call i64 @llvm.atomic.load.add.i64.p0i64(i64* %p, i64 1)
-        ret void
-}
-</pre>
-</div>
-
-<p>Here you can see some "CHECK:" lines specified in comments.  Now you can see
-how the file is piped into llvm-as, then llc, and the machine code output is
-what we are verifying.  FileCheck checks the machine code output to verify that
-it matches what the "CHECK:" lines specify.</p>
-
-<p>The syntax of the CHECK: lines is very simple: they are fixed strings that
-must occur in order.  FileCheck defaults to ignoring horizontal whitespace
-differences (e.g. a space is allowed to match a tab) but otherwise, the contents
-of the CHECK: line is required to match some thing in the test file exactly.</p>
-
-<p>One nice thing about FileCheck (compared to grep) is that it allows merging
-test cases together into logical groups.  For example, because the test above
-is checking for the "sub1:" and "inc4:" labels, it will not match unless there
-is a "subl" in between those labels.  If it existed somewhere else in the file,
-that would not count: "grep subl" matches if subl exists anywhere in the
-file.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection"><a 
-name="FileCheck-check-prefix">The FileCheck -check-prefix option</a></div>
-
-<div class="doc_text">
-
-<p>The FileCheck -check-prefix option allows multiple test configurations to be
-driven from one .ll file.  This is useful in many circumstances, for example,
-testing different architectural variants with llc.  Here's a simple example:</p>
-
-<div class="doc_code">
-<pre>
-; RUN: llvm-as &lt; %s | llc -mtriple=i686-apple-darwin9 -mattr=sse41 \
-; RUN:              | <b>FileCheck %s -check-prefix=X32</b>
-; RUN: llvm-as &lt; %s | llc -mtriple=x86_64-apple-darwin9 -mattr=sse41 \
-; RUN:              | <b>FileCheck %s -check-prefix=X64</b>
-
-define &lt;4 x i32&gt; @pinsrd_1(i32 %s, &lt;4 x i32&gt; %tmp) nounwind {
-        %tmp1 = insertelement &lt;4 x i32&gt; %tmp, i32 %s, i32 1
-        ret &lt;4 x i32&gt; %tmp1
-; <b>X32:</b> pinsrd_1:
-; <b>X32:</b>    pinsrd $1, 4(%esp), %xmm0
-
-; <b>X64:</b> pinsrd_1:
-; <b>X64:</b>    pinsrd $1, %edi, %xmm0
-}
-</pre>
-</div>
-
-<p>In this case, we're testing that we get the expected code generation with
-both 32-bit and 64-bit code generation.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection"><a 
-name="FileCheck-CHECK-NEXT">The "CHECK-NEXT:" directive</a></div>
-
-<div class="doc_text">
-
-<p>Sometimes you want to match lines and would like to verify that matches
-happen on exactly consequtive lines with no other lines in between them.  In
-this case, you can use CHECK: and CHECK-NEXT: directives to specify this.  If
-you specified a custom check prefix, just use "&lt;PREFIX&gt;-NEXT:".  For
-example, something like this works as you'd expect:</p>
-
-<div class="doc_code">
-<pre>
-define void @t2(&lt;2 x double&gt;* %r, &lt;2 x double&gt;* %A, double %B) {
-	%tmp3 = load &lt;2 x double&gt;* %A, align 16
-	%tmp7 = insertelement &lt;2 x double&gt; undef, double %B, i32 0
-	%tmp9 = shufflevector &lt;2 x double&gt; %tmp3,
-                              &lt;2 x double&gt; %tmp7,
-                              &lt;2 x i32&gt; &lt; i32 0, i32 2 &gt;
-	store &lt;2 x double&gt; %tmp9, &lt;2 x double&gt;* %r, align 16
-	ret void
-        
-; <b>CHECK:</b> t2:
-; <b>CHECK:</b> 	movl	8(%esp), %eax
-; <b>CHECK-NEXT:</b> 	movapd	(%eax), %xmm0
-; <b>CHECK-NEXT:</b> 	movhpd	12(%esp), %xmm0
-; <b>CHECK-NEXT:</b> 	movl	4(%esp), %eax
-; <b>CHECK-NEXT:</b> 	movapd	%xmm0, (%eax)
-; <b>CHECK-NEXT:</b> 	ret
-}
-</pre>
-</div>
-
-<p>CHECK-NEXT: directives reject the input unless there is exactly one newline
-between it an the previous directive.  A CHECK-NEXT cannot be the first
-directive in a file.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection"><a 
-name="FileCheck-CHECK-NOT">The "CHECK-NOT:" directive</a></div>
-
-<div class="doc_text">
-
-<p>The CHECK-NOT: directive is used to verify that a string doesn't occur
-between two matches (or the first match and the beginning of the file).  For
-example, to verify that a load is removed by a transformation, a test like this
-can be used:</p>
-
-<div class="doc_code">
-<pre>
-define i8 @coerce_offset0(i32 %V, i32* %P) {
-  store i32 %V, i32* %P
-   
-  %P2 = bitcast i32* %P to i8*
-  %P3 = getelementptr i8* %P2, i32 2
-
-  %A = load i8* %P3
-  ret i8 %A
-; <b>CHECK:</b> @coerce_offset0
-; <b>CHECK-NOT:</b> load
-; <b>CHECK:</b> ret i8
-}
-</pre>
-</div>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection"><a 
-name="FileCheck-Matching">FileCheck Pattern Matching Syntax</a></div>
-
-<div class="doc_text">
-
-<p>The CHECK: and CHECK-NOT: directives both take a pattern to match.  For most
-uses of FileCheck, fixed string matching is perfectly sufficient.  For some
-things, a more flexible form of matching is desired.  To support this, FileCheck
-allows you to specify regular expressions in matching strings, surrounded by
-double braces: <b>{{yourregex}}</b>.  Because we want to use fixed string
-matching for a majority of what we do, FileCheck has been designed to support
-mixing and matching fixed string matching with regular expressions.  This allows
-you to write things like this:</p>
-
-<div class="doc_code">
-<pre>
-; CHECK: movhpd	<b>{{[0-9]+}}</b>(%esp), <b>{{%xmm[0-7]}}</b>
-</pre>
-</div>
-
-<p>In this case, any offset from the ESP register will be allowed, and any xmm
-register will be allowed.</p>
-
-<p>Because regular expressions are enclosed with double braces, they are
-visually distinct, and you don't need to use escape characters within the double
-braces like you would in C.  In the rare case that you want to match double
-braces explicitly from the input, you can use something ugly like
-<b>{{[{][{]}}</b> as your pattern.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection"><a 
-name="FileCheck-Variables">FileCheck Variables</a></div>
-
-<div class="doc_text">
-
-<p>It is often useful to match a pattern and then verify that it occurs again
-later in the file.  For codegen tests, this can be useful to allow any register,
-but verify that that register is used consistently later.  To do this, FileCheck
-allows named variables to be defined and substituted into patterns.  Here is a
-simple example:</p>
-
-<div class="doc_code">
-<pre>
-; CHECK: test5:
-; CHECK:    notw	<b>[[REGISTER:%[a-z]+]]</b>
-; CHECK:    andw	{{.*}}<b>[[REGISTER]]</b>
-</pre>
-</div>
-
-<p>The first check line matches a regex (<tt>%[a-z]+</tt>) and captures it into
-the variables "REGISTER".  The second line verifies that whatever is in REGISTER
-occurs later in the file after an "andw".  FileCheck variable references are
-always contained in <tt>[[ ]]</tt> pairs, are named, and their names can be
-formed with the regex "<tt>[a-zA-Z][a-zA-Z0-9]*</tt>".  If a colon follows the
-name, then it is a definition of the variable, if not, it is a use.</p>
-
-<p>FileCheck variables can be defined multiple times, and uses always get the
-latest value.  Note that variables are all read at the start of a "CHECK" line
-and are all defined at the end.  This means that if you have something like
-"<tt>CHECK: [[XYZ:.*]]x[[XYZ]]</tt>" that the check line will read the previous
-value of the XYZ variable and define a new one after the match is performed.  If
-you need to do something like this you can probably take advantage of the fact
-that FileCheck is not actually line-oriented when it matches, this allows you to
-define two separate CHECK lines that match on the same line.
-</p>
-
-
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsection"><a name="dgvars">Variables and
-substitutions</a></div>
-<!-- _______________________________________________________________________ -->
-<div class="doc_text">
-  <p>With a RUN line there are a number of substitutions that are permitted. In
-  general, any Tcl variable that is available in the <tt>substitute</tt> 
-  function (in <tt>test/lib/llvm.exp</tt>) can be substituted into a RUN line.
-  To make a substitution just write the variable's name preceded by a $. 
-  Additionally, for compatibility reasons with previous versions of the test
-  library, certain names can be accessed with an alternate syntax: a % prefix.
-  These alternates are deprecated and may go away in a future version.
-  </p>
-  <p>Here are the available variable names. The alternate syntax is listed in
-  parentheses.</p>
-
-  <dl style="margin-left: 25px">
-    <dt><b>$test</b> (%s)</dt>
-    <dd>The full path to the test case's source. This is suitable for passing
-    on the command line as the input to an llvm tool.</dd>
-
-    <dt><b>$srcdir</b></dt>
-    <dd>The source directory from where the "<tt>make check</tt>" was run.</dd>
-
-    <dt><b>objdir</b></dt>
-    <dd>The object directory that corresponds to the <tt>$srcdir</tt>.</dd>
-
-    <dt><b>subdir</b></dt>
-    <dd>A partial path from the <tt>test</tt> directory that contains the 
-    sub-directory that contains the test source being executed.</dd>
-
-    <dt><b>srcroot</b></dt>
-    <dd>The root directory of the LLVM src tree.</dd>
-
-    <dt><b>objroot</b></dt>
-    <dd>The root directory of the LLVM object tree. This could be the same
-    as the srcroot.</dd>
-
-    <dt><b>path</b><dt>
-    <dd>The path to the directory that contains the test case source.  This is 
-    for locating any supporting files that are not generated by the test, but 
-    used by the test.</dd>
-
-    <dt><b>tmp</b></dt>
-    <dd>The path to a temporary file name that could be used for this test case.
-    The file name won't conflict with other test cases. You can append to it if
-    you need multiple temporaries. This is useful as the destination of some
-    redirected output.</dd>
-
-    <dt><b>llvmlibsdir</b> (%llvmlibsdir)</dt>
-    <dd>The directory where the LLVM libraries are located.</dd>
-
-    <dt><b>target_triplet</b> (%target_triplet)</dt>
-    <dd>The target triplet that corresponds to the current host machine (the one
-    running the test cases). This should probably be called "host".<dd>
-
-    <dt><b>llvmgcc</b> (%llvmgcc)</dt>
-    <dd>The full path to the <tt>llvm-gcc</tt> executable as specified in the
-    configured LLVM environment</dd>
-
-    <dt><b>llvmgxx</b> (%llvmgxx)</dt>
-    <dd>The full path to the <tt>llvm-gxx</tt> executable as specified in the
-    configured LLVM environment</dd>
-
-    <dt><b>llvmgcc_version</b> (%llvmgcc_version)</dt>
-    <dd>The full version number of the <tt>llvm-gcc</tt> executable.</dd>
-
-    <dt><b>llvmgccmajvers</b> (%llvmgccmajvers)</dt>
-    <dd>The major version number of the <tt>llvm-gcc</tt> executable.</dd>
-
-    <dt><b>gccpath</b></dt>
-    <dd>The full path to the C compiler used to <i>build </i> LLVM. Note that 
-    this might not be gcc.</dd>
-
-    <dt><b>gxxpath</b></dt>
-    <dd>The full path to the C++ compiler used to <i>build </i> LLVM. Note that 
-    this might not be g++.</dd>
-
-    <dt><b>compile_c</b> (%compile_c)</dt>
-    <dd>The full command line used to compile LLVM C source  code. This has all 
-    the configured -I, -D and optimization options.</dd>
-
-    <dt><b>compile_cxx</b> (%compile_cxx)</dt>
-    <dd>The full command used to compile LLVM C++ source  code. This has 
-    all the configured -I, -D and optimization options.</dd>
-
-    <dt><b>link</b> (%link)</dt> 
-    <dd>This full link command used to link LLVM executables. This has all the
-    configured -I, -L and -l options.</dd>
-
-    <dt><b>shlibext</b> (%shlibext)</dt>
-    <dd>The suffix for the host platforms share library (dll) files. This
-    includes the period as the first character.</dd>
-  </dl>
-  <p>To add more variables, two things need to be changed. First, add a line in
-  the <tt>test/Makefile</tt> that creates the <tt>site.exp</tt> file. This will
-  "set" the variable as a global in the site.exp file. Second, in the
-  <tt>test/lib/llvm.exp</tt> file, in the substitute proc, add the variable name
-  to the list of "global" declarations at the beginning of the proc. That's it,
-  the variable can then be used in test scripts.</p>
-</div>
-  
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsection"><a name="dgfeatures">Other Features</a></div>
-<!-- _______________________________________________________________________ -->
-<div class="doc_text">
-  <p>To make RUN line writing easier, there are several shell scripts located
-  in the <tt>llvm/test/Scripts</tt> directory. This directory is in the PATH
-  when running tests, so you can just call these scripts using their name. For
-  example:</p>
-  <dl>
-    <dt><b>ignore</b></dt>
-    <dd>This script runs its arguments and then always returns 0. This is useful
-    in cases where the test needs to cause a tool to generate an error (e.g. to
-    check the error output). However, any program in a pipeline that returns a
-    non-zero result will cause the test to fail. This script overcomes that 
-    issue and nicely documents that the test case is purposefully ignoring the
-    result code of the tool</dd>
-
-    <dt><b>not</b></dt>
-    <dd>This script runs its arguments and then inverts the result code from 
-    it. Zero result codes become 1. Non-zero result codes become 0. This is
-    useful to invert the result of a grep. For example "not grep X" means
-    succeed only if you don't find X in the input.</dd>
-  </dl>
-
-  <p>Sometimes it is necessary to mark a test case as "expected fail" or XFAIL.
-  You can easily mark a test as XFAIL just by including  <tt>XFAIL: </tt> on a
-  line near the top of the file. This signals that the test case should succeed
-  if the test fails. Such test cases are counted separately by DejaGnu. To
-  specify an expected fail, use the XFAIL keyword in the comments of the test
-  program followed by a colon and one or more regular expressions (separated by
-  a comma). The regular expressions allow you to XFAIL the test conditionally
-  by host platform. The regular expressions following the : are matched against
-  the target triplet or llvmgcc version number for the host machine. If there is
-  a match, the test is expected to fail. If not, the test is expected to
-  succeed. To XFAIL everywhere just specify <tt>XFAIL: *</tt>. When matching
-  the llvm-gcc version, you can specify the major (e.g. 3) or full version 
-  (i.e. 3.4) number. Here is an example of an <tt>XFAIL</tt> line:</p>
-
-<div class="doc_code">
-<pre>
-; XFAIL: darwin,sun,llvmgcc4
-</pre>
-</div>
-
-  <p>To make the output more useful, the <tt>llvm_runtest</tt> function wil
-  scan the lines of the test case for ones that contain a pattern that matches
-  PR[0-9]+. This is the syntax for specifying a PR (Problem Report) number that
-  is related to the test case. The number after "PR" specifies the LLVM bugzilla
-  number. When a PR number is specified, it will be used in the pass/fail
-  reporting. This is useful to quickly get some context when a test fails.</p>
-
-  <p>Finally, any line that contains "END." will cause the special
-  interpretation of lines to terminate. This is generally done right after the
-  last RUN: line. This has two side effects: (a) it prevents special
-  interpretation of lines that are part of the test program, not the
-  instructions to the test case, and (b) it speeds things up for really big test
-  cases by avoiding interpretation of the remainder of the file.</p>
-
-</div>
-
-<!--=========================================================================-->
-<div class="doc_section"><a name="testsuitestructure">Test suite
-Structure</a></div>
-<!--=========================================================================-->
-
-<div class="doc_text">
-
-<p>The <tt>test-suite</tt> module contains a number of programs that can be compiled 
-with LLVM and executed. These programs are compiled using the native compiler
-and various LLVM backends. The output from the program compiled with the 
-native compiler is assumed correct; the results from the other programs are
-compared to the native program output and pass if they match.</p>
-
-<p>When executing tests, it is usually a good idea to start out with a subset of
-the available tests or programs. This makes test run times smaller at first and
-later on this is useful to investigate individual test failures. To run some
-test only on a subset of programs, simply change directory to the programs you
-want tested and run <tt>gmake</tt> there. Alternatively, you can run a different
-test using the <tt>TEST</tt> variable to change what tests or run on the
-selected programs (see below for more info).</p>
-
-<p>In addition for testing correctness, the <tt>llvm-test</tt> directory also
-performs timing tests of various LLVM optimizations.  It also records
-compilation times for the compilers and the JIT.  This information can be
-used to compare the effectiveness of LLVM's optimizations and code
-generation.</p>
-
-<p><tt>llvm-test</tt> tests are divided into three types of tests: MultiSource,
-SingleSource, and External.</p> 
-
-<ul>
-<li><tt>llvm-test/SingleSource</tt>
-<p>The SingleSource directory contains test programs that are only a single 
-source file in size.  These are usually small benchmark programs or small 
-programs that calculate a particular value.  Several such programs are grouped 
-together in each directory.</p></li>
-
-<li><tt>llvm-test/MultiSource</tt>
-<p>The MultiSource directory contains subdirectories which contain entire 
-programs with multiple source files.  Large benchmarks and whole applications 
-go here.</p></li>
-
-<li><tt>llvm-test/External</tt>
-<p>The External directory contains Makefiles for building code that is external
-to (i.e., not distributed with) LLVM.  The most prominent members of this
-directory are the SPEC 95 and SPEC 2000 benchmark suites. The <tt>External</tt>
-directory does not contain these actual tests, but only the Makefiles that know
-how to properly compile these programs from somewhere else. The presence and
-location of these external programs is configured by the llvm-test
-<tt>configure</tt> script.</p></li>
-</ul>
-
-<p>Each tree is then subdivided into several categories, including applications,
-benchmarks, regression tests, code that is strange grammatically, etc.  These
-organizations should be relatively self explanatory.</p>
-
-<p>Some tests are known to fail.  Some are bugs that we have not fixed yet;
-others are features that we haven't added yet (or may never add).  In DejaGNU,
-the result for such tests will be XFAIL (eXpected FAILure).  In this way, you
-can tell the difference between an expected and unexpected failure.</p>
-
-<p>The tests in the test suite have no such feature at this time. If the
-test passes, only warnings and other miscellaneous output will be generated.  If
-a test fails, a large &lt;program&gt; FAILED message will be displayed.  This
-will help you separate benign warnings from actual test failures.</p>
-
-</div>
-
-<!--=========================================================================-->
-<div class="doc_section"><a name="testsuiterun">Running the test suite</a></div>
-<!--=========================================================================-->
-
-<div class="doc_text">
-
-<p>First, all tests are executed within the LLVM object directory tree.  They
-<i>are not</i> executed inside of the LLVM source tree. This is because the
-test suite creates temporary files during execution.</p>
-
-<p>To run the test suite, you need to use the following steps:</p>
-
-<ol>
-  <li><tt>cd</tt> into the <tt>llvm/projects</tt> directory in your source tree.
-  </li>
-
-  <li><p>Check out the <tt>test-suite</tt> module with:</p>
-
-<div class="doc_code">
-<pre>
-% svn co http://llvm.org/svn/llvm-project/test-suite/trunk test-suite
-</pre>
-</div>
-    <p>This will get the test suite into <tt>llvm/projects/test-suite</tt>.</p>
-  </li>
-  <li><p>Configure and build <tt>llvm</tt>.</p></li>
-  <li><p>Configure and build <tt>llvm-gcc</tt>.</p></li>
-  <li><p>Install <tt>llvm-gcc</tt> somewhere.</p></li>
-  <li><p><em>Re-configure</em> <tt>llvm</tt> from the top level of
-      each build tree (LLVM object directory tree) in which you want
-      to run the test suite, just as you do before building LLVM.</p>
-    <p>During the <em>re-configuration</em>, you must either: (1)
-      have <tt>llvm-gcc</tt> you just built in your path, or (2)
-      specify the directory where your just-built <tt>llvm-gcc</tt> is
-      installed using <tt>--with-llvmgccdir=$LLVM_GCC_DIR</tt>.</p>
-    <p>You must also tell the configure machinery that the test suite
-      is available so it can be configured for your build tree:</p>
-<div class="doc_code">
-<pre>
-% cd $LLVM_OBJ_ROOT ; $LLVM_SRC_ROOT/configure [--with-llvmgccdir=$LLVM_GCC_DIR]
-</pre>
-</div>
-    <p>[Remember that <tt>$LLVM_GCC_DIR</tt> is the directory where you
-    <em>installed</em> llvm-gcc, not its src or obj directory.]</p>
-  </li>
-
-  <li><p>You can now run the test suite from your build tree as follows:</p>
-<div class="doc_code">
-<pre>
-% cd $LLVM_OBJ_ROOT/projects/test-suite
-% make
-</pre>
-</div>
-  </li>
-</ol>
-<p>Note that the second and third steps only need to be done once. After you
-have the suite checked out and configured, you don't need to do it again (unless
-the test code or configure script changes).</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsection">
-<a name="testsuiteexternal">Configuring External Tests</a></div>
-<!-- _______________________________________________________________________ -->
-
-<div class="doc_text">
-<p>In order to run the External tests in the <tt>test-suite</tt>
-  module, you must specify <i>--with-externals</i>.  This
-  must be done during the <em>re-configuration</em> step (see above),
-  and the <tt>llvm</tt> re-configuration must recognize the
-  previously-built <tt>llvm-gcc</tt>.  If any of these is missing or
-  neglected, the External tests won't work.</p>
-<dl>
-<dt><i>--with-externals</i></dt>
-<dt><i>--with-externals=&lt;<tt>directory</tt>&gt;</i></dt>
-</dl>
-  This tells LLVM where to find any external tests.  They are expected to be
-  in specifically named subdirectories of &lt;<tt>directory</tt>&gt;.
-  If <tt>directory</tt> is left unspecified,
-  <tt>configure</tt> uses the default value
-  <tt>/home/vadve/shared/benchmarks/speccpu2000/benchspec</tt>.
-  Subdirectory names known to LLVM include:
-  <dl>
-  <dt>spec95</dt>
-  <dt>speccpu2000</dt>
-  <dt>speccpu2006</dt>
-  <dt>povray31</dt>
-  </dl>
-  Others are added from time to time, and can be determined from 
-  <tt>configure</tt>.
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsection">
-<a name="testsuitetests">Running different tests</a></div>
-<!-- _______________________________________________________________________ -->
-<div class="doc_text">
-<p>In addition to the regular "whole program" tests, the <tt>test-suite</tt>
-module also provides a mechanism for compiling the programs in different ways.
-If the variable TEST is defined on the <tt>gmake</tt> command line, the test system will
-include a Makefile named <tt>TEST.&lt;value of TEST variable&gt;.Makefile</tt>.
-This Makefile can modify build rules to yield different results.</p>
-
-<p>For example, the LLVM nightly tester uses <tt>TEST.nightly.Makefile</tt> to
-create the nightly test reports.  To run the nightly tests, run <tt>gmake
-TEST=nightly</tt>.</p>
-
-<p>There are several TEST Makefiles available in the tree.  Some of them are
-designed for internal LLVM research and will not work outside of the LLVM
-research group.  They may still be valuable, however, as a guide to writing your
-own TEST Makefile for any optimization or analysis passes that you develop with
-LLVM.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsection">
-<a name="testsuiteoutput">Generating test output</a></div>
-<!-- _______________________________________________________________________ -->
-<div class="doc_text">
-  <p>There are a number of ways to run the tests and generate output. The most
-  simple one is simply running <tt>gmake</tt> with no arguments. This will
-  compile and run all programs in the tree using a number of different methods
-  and compare results. Any failures are reported in the output, but are likely
-  drowned in the other output. Passes are not reported explicitely.</p>
-
-  <p>Somewhat better is running <tt>gmake TEST=sometest test</tt>, which runs
-  the specified test and usually adds per-program summaries to the output
-  (depending on which sometest you use). For example, the <tt>nightly</tt> test
-  explicitely outputs TEST-PASS or TEST-FAIL for every test after each program.
-  Though these lines are still drowned in the output, it's easy to grep the
-  output logs in the Output directories.</p>
-
-  <p>Even better are the <tt>report</tt> and <tt>report.format</tt> targets
-  (where <tt>format</tt> is one of <tt>html</tt>, <tt>csv</tt>, <tt>text</tt> or
-  <tt>graphs</tt>). The exact contents of the report are dependent on which
-  <tt>TEST</tt> you are running, but the text results are always shown at the
-  end of the run and the results are always stored in the
-  <tt>report.&lt;type&gt;.format</tt> file (when running with
-  <tt>TEST=&lt;type&gt;</tt>).
-
-  The <tt>report</tt> also generate a file called
-  <tt>report.&lt;type&gt;.raw.out</tt> containing the output of the entire test
-  run.
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsection">
-<a name="testsuitecustom">Writing custom tests for the test suite</a></div>
-<!-- _______________________________________________________________________ -->
-
-<div class="doc_text">
-
-<p>Assuming you can run the test suite, (e.g. "<tt>gmake TEST=nightly report</tt>"
-should work), it is really easy to run optimizations or code generator
-components against every program in the tree, collecting statistics or running
-custom checks for correctness.  At base, this is how the nightly tester works,
-it's just one example of a general framework.</p>
-
-<p>Lets say that you have an LLVM optimization pass, and you want to see how
-many times it triggers.  First thing you should do is add an LLVM
-<a href="ProgrammersManual.html#Statistic">statistic</a> to your pass, which
-will tally counts of things you care about.</p>
-
-<p>Following this, you can set up a test and a report that collects these and
-formats them for easy viewing.  This consists of two files, an
-"<tt>test-suite/TEST.XXX.Makefile</tt>" fragment (where XXX is the name of your
-test) and an "<tt>llvm-test/TEST.XXX.report</tt>" file that indicates how to
-format the output into a table.  There are many example reports of various
-levels of sophistication included with the test suite, and the framework is very
-general.</p>
-
-<p>If you are interested in testing an optimization pass, check out the
-"libcalls" test as an example.  It can be run like this:<p>
-
-<div class="doc_code">
-<pre>
-% cd llvm/projects/test-suite/MultiSource/Benchmarks  # or some other level
-% make TEST=libcalls report
-</pre>
-</div>
-
-<p>This will do a bunch of stuff, then eventually print a table like this:</p>
-
-<div class="doc_code">
-<pre>
-Name                                  | total | #exit |
-...
-FreeBench/analyzer/analyzer           | 51    | 6     | 
-FreeBench/fourinarow/fourinarow       | 1     | 1     | 
-FreeBench/neural/neural               | 19    | 9     | 
-FreeBench/pifft/pifft                 | 5     | 3     | 
-MallocBench/cfrac/cfrac               | 1     | *     | 
-MallocBench/espresso/espresso         | 52    | 12    | 
-MallocBench/gs/gs                     | 4     | *     | 
-Prolangs-C/TimberWolfMC/timberwolfmc  | 302   | *     | 
-Prolangs-C/agrep/agrep                | 33    | 12    | 
-Prolangs-C/allroots/allroots          | *     | *     | 
-Prolangs-C/assembler/assembler        | 47    | *     | 
-Prolangs-C/bison/mybison              | 74    | *     | 
-...
-</pre>
-</div>
-
-<p>This basically is grepping the -stats output and displaying it in a table.
-You can also use the "TEST=libcalls report.html" target to get the table in HTML
-form, similarly for report.csv and report.tex.</p>
-
-<p>The source for this is in test-suite/TEST.libcalls.*.  The format is pretty
-simple: the Makefile indicates how to run the test (in this case, 
-"<tt>opt -simplify-libcalls -stats</tt>"), and the report contains one line for
-each column of the output.  The first value is the header for the column and the
-second is the regex to grep the output of the command for.  There are lots of
-example reports that can do fancy stuff.</p>
-
-</div>
-
-
-<!--=========================================================================-->
-<div class="doc_section"><a name="nightly">Running the nightly tester</a></div>
-<!--=========================================================================-->
-
-<div class="doc_text">
-
-<p>
-The <a href="http://llvm.org/nightlytest/">LLVM Nightly Testers</a>
-automatically check out an LLVM tree, build it, run the "nightly" 
-program test (described above), run all of the DejaGNU tests, 
-delete the checked out tree, and then submit the results to 
-<a href="http://llvm.org/nightlytest/">http://llvm.org/nightlytest/</a>. 
-After test results are submitted to 
-<a href="http://llvm.org/nightlytest/">http://llvm.org/nightlytest/</a>,
-they are processed and displayed on the tests page. An email to 
-<a href="http://lists.cs.uiuc.edu/pipermail/llvm-testresults/">
-llvm-testresults at cs.uiuc.edu</a> summarizing the results is also generated. 
-This testing scheme is designed to ensure that programs don't break as well 
-as keep track of LLVM's progress over time.</p>
-
-<p>If you'd like to set up an instance of the nightly tester to run on your 
-machine, take a look at the comments at the top of the 
-<tt>utils/NewNightlyTest.pl</tt> file. If you decide to set up a nightly tester 
-please choose a unique nickname and invoke <tt>utils/NewNightlyTest.pl</tt> 
-with the "-nickname [yournickname]" command line option. 
-
-<p>You can create a shell script to encapsulate the running of the script.
-The optimized x86 Linux nightly test is run from just such a script:</p>
-
-<div class="doc_code">
-<pre>
-#!/bin/bash
-BASE=/proj/work/llvm/nightlytest
-export BUILDDIR=$BASE/build 
-export WEBDIR=$BASE/testresults 
-export LLVMGCCDIR=/proj/work/llvm/cfrontend/install
-export PATH=/proj/install/bin:$LLVMGCCDIR/bin:$PATH
-export LD_LIBRARY_PATH=/proj/install/lib
-cd $BASE
-cp /proj/work/llvm/llvm/utils/NewNightlyTest.pl .
-nice ./NewNightlyTest.pl -nice -release -verbose -parallel -enable-linscan \
-   -nickname NightlyTester -noexternals &gt; output.log 2&gt;&amp;1 
-</pre>
-</div>
-
-<p>It is also possible to specify the the location your nightly test results
-are submitted. You can do this by passing the command line option
-"-submit-server [server_address]" and "-submit-script [script_on_server]" to
-<tt>utils/NewNightlyTest.pl</tt>. For example, to submit to the llvm.org 
-nightly test results page, you would invoke the nightly test script with 
-"-submit-server llvm.org -submit-script /nightlytest/NightlyTestAccept.cgi". 
-If these options are not specified, the nightly test script sends the results 
-to the llvm.org nightly test results page.</p>
-
-<p>Take a look at the <tt>NewNightlyTest.pl</tt> file to see what all of the
-flags and strings do.  If you start running the nightly tests, please let us
-know. Thanks!</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-
-<hr>
-<address>
-  <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
-  src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS"></a>
-  <a href="http://validator.w3.org/check/referer"><img
-  src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
-
-  John T. Criswell, Reid Spencer, and Tanya Lattner<br>
-  <a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
-  Last modified: $Date$
-</address>
-</body>
-</html>
diff --git a/libclamav/c++/llvm/docs/UsingLibraries.html b/libclamav/c++/llvm/docs/UsingLibraries.html
deleted file mode 100644
index b1a3b4d..0000000
--- a/libclamav/c++/llvm/docs/UsingLibraries.html
+++ /dev/null
@@ -1,439 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-	<title>Using The LLVM Libraries</title>
-  <link rel="stylesheet" href="llvm.css" type="text/css">
-</head>
-<body>
-<div class="doc_title">Using The LLVM Libraries</div>
-<ol>
-  <li><a href="#abstract">Abstract</a></li>
-  <li><a href="#introduction">Introduction</a></li>
-  <li><a href="#descriptions">Library Descriptions</a></li>
-  <li><a href="#dependencies">Library Dependencies</a></li>
-  <li><a href="#rot">Linkage Rules Of Thumb</a>
-	  <ol>
-      <li><a href="#always">Always link LLVMCore, LLVMSupport, LLVMSystem</a>
-			<li><a href="#onlyone">Never link both archive and re-linked</a>
-		</ol>
-	</li>
-</ol>
-
-<div class="doc_author">
-  <p>Written by <a href="mailto:rspencer at x10sys.com">Reid Spencer</a></p>
-</div>
-
-<p class="doc_warning">Warning: This document is out of date, please see <a href="CommandGuide/html/llvm-config.html">llvm-config</a> for more information.</p>
-
-<!-- ======================================================================= -->
-<div class="doc_section"><a name="abstract">Abstract</a></div>
-<div class="doc_text">
-  <p>Amongst other things, LLVM is a toolkit for building compilers, linkers,
-  runtime executives, virtual machines, and other program execution related
-  tools. In addition to the LLVM tool set, the functionality of LLVM is
-  available through a set of libraries.  To use LLVM as a toolkit for
-  constructing tools, a developer needs to understand what is contained in the
-  various libraries, what they depend on, and how to use them.  Fortunately,
-  there is a tool, <tt>llvm-config</tt> to aid with this. This document 
-  describes the contents of the libraries and how to use <tt>llvm-config</tt>
-  to generate command line options.
-</p>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_section"> <a name="introduction">Introduction</a></div>
-<div class="doc_text">
-  <p>If you're writing a compiler, virtual machine, or any other utility based 
-  on LLVM, you'll need to figure out which of the many libraries files you will 
-  need to link with to be successful. An understanding of the contents of these 
-  libraries will be useful in coming up with an optimal specification for the 
-  libraries to link with. The purpose of this document is to reduce some of 
-  the trial and error that the author experienced in using LLVM.</p>
-  <p>LLVM produces two types of libraries: archives (ending in <tt>.a</tt>) and
-  objects (ending in <tt>.o</tt>). However, both are libraries. Libraries ending
-  in <tt>.o</tt> are known as re-linked libraries because they contain all the
-  compilation units of the library linked together as a single <tt>.o</tt> file.
-  Furthermore, several of the libraries have <em>both</em> forms of library. The
-  re-linked libraries are used whenever you want to include all symbols from the
-  library. The archive libraries are used whenever you want to only resolve
-  outstanding symbols at that point in the link without including everything in
-  the library. </p>
-  <p>If you're using the LLVM Makefile system to link your tools,you will use 
-  the <tt>LLVMLIBS</tt> make variable. 
-  (see the <a href="MakefileGuide.html#LLVMLIBS">Makefile Guide</a> for 
-  details). This variable specifies which LLVM libraries to link into your tool 
-  and the order in which they will be linked. You specify re-linked libraries by
-  naming the library without a suffix. You specify archive libraries by naming
-  the library with a <tt>.a</tt> suffix but without the <tt>lib</tt> prefix. The
-  order in which the libraries appear in the <tt>LLVMLIBS</tt> variable
-  definition is the order in which they will be linked. Getting this order
-  correct for your tool can sometimes be challenging.
-</div>
-<!-- ======================================================================= -->
-<div class="doc_section"><a name="descriptions"></a>Library Descriptions</div>
-<div class="doc_text">
-  <p>The table below categorizes each library
-<table style="text-align:left">
-  <tr><th>Library</th><th>Forms</th><th>Description</th></tr>
-  <tr><th colspan="3">Core Libraries</th></tr>
-  <tr><td>LLVMArchive</td><td><tt>.a</tt></td>
-    <td>LLVM archive reading and writing</td></tr>
-  <tr><td>LLVMAsmParser</td><td><tt>.a</tt></td>
-    <td>LLVM assembly parsing</td></tr>
-  <tr><td>LLVMBCReader</td><td><tt>.a</tt></td>
-    <td>LLVM bitcode reading</td></tr>
-  <tr><td>LLVMBCWriter</td><td><tt>.a</tt></td>
-    <td>LLVM bitcode writing</td></tr>
-  <tr><td>LLVMCore</td><td><tt>.a</tt></td>
-    <td>LLVM core intermediate representation</td></tr>
-  <tr><td>LLVMDebugger</td><td><tt>.a</tt></td>
-    <td>Source level debugging support</td></tr>
-  <tr><td>LLVMLinker</td><td><tt>.a</tt></td>
-    <td>Bitcode and archive linking interface</td></tr>
-  <tr><td>LLVMSupport</td><td><tt>.a</tt></td>
-    <td>General support utilities</td></tr>
-  <tr><td>LLVMSystem</td><td><tt>.a</tt></td>
-    <td>Operating system abstraction layer</td></tr>
-  <tr><td>LLVMbzip2</td><td><tt>.a</tt></td>
-    <td>BZip2 compression library</td></tr>
-
-  <tr><th colspan="3">Analysis Libraries</th></tr>
-  <tr><td>LLVMAnalysis</td><td><tt>.a</tt></td>
-    <td>Various analysis passes.</td></tr>
-  <tr><td>LLVMDataStructure</td><td><tt>.o</tt></td>
-    <td>Data structure analysis passes.</td></tr>
-  <tr><td>LLVMipa</td><td><tt>.a</tt></td>
-    <td>Inter-procedural analysis passes.</td></tr>
-
-  <tr><th colspan="3">Transformation Libraries</th></tr>
-  <tr><td>LLVMInstrumentation</td><td><tt>.a</tt></td>
-    <td>Instrumentation passes.</td></tr>
-  <tr><td>LLVMipo</td><td><tt>.a</tt></td>
-    <td>All inter-procedural optimization passes.</td></tr>
-  <tr><td>LLVMScalarOpts</td><td><tt>.a</tt></td>
-    <td>All scalar optimization passes.</td></tr>
-  <tr><td>LLVMTransformUtils</td><td><tt>.a</tt></td>
-    <td>Transformation utilities used by many passes.</td></tr>
-
-  <tr><th colspan="3">Code Generation Libraries </th></tr>
-  <tr><td>LLVMCodeGen</td><td><tt>.o</tt></td>
-    <td>Native code generation infrastructure</td></tr>
-  <tr><td>LLVMSelectionDAG</td><td><tt>.o</tt></td>
-    <td>Aggressive instruction selector for directed acyclic graphs</td></tr>
-
-  <tr><th colspan="3">Target Libraries</th></tr>
-  <tr><td>LLVMAlpha</td><td><tt>.o</tt></td>
-    <td>Code generation for Alpha architecture</td></tr>
-  <tr><td>LLVMARM</td><td><tt>.o</tt></td>
-    <td>Code generation for ARM architecture</td></tr>
-  <tr><td>LLVMCBackend</td><td><tt>.o</tt></td>
-    <td>'C' language code generator.</td></tr>
-  <tr><td>LLVMPowerPC</td><td><tt>.o</tt></td>
-    <td>Code generation for PowerPC architecture</td></tr>
-  <tr><td>LLVMSparc</td><td><tt>.o</tt></td>
-    <td>Code generation for Sparc architecture</td></tr>
-  <tr><td>LLVMTarget</td><td><tt>.a</tt></td>
-    <td>Generic code generation utilities.</td></tr>
-  <tr><td>LLVMX86</td><td><tt>.o</tt></td>
-    <td>Code generation for Intel x86 architecture</td></tr>
-
-  <tr><th colspan="3">Runtime Libraries</th></tr>
-  <tr><td>LLVMInterpreter</td><td><tt>.o</tt></td>
-    <td>Bitcode Interpreter</td></tr>
-  <tr><td>LLVMJIT</td><td><tt>.o</tt></td>
-    <td>Bitcode JIT Compiler</td></tr>
-  <tr><td>LLVMExecutionEngine</td><td><tt>.o</tt></td>
-    <td>Virtual machine engine</td></tr>
-</table>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_section"><a name="dependencies"></a>Using llvm-config</div>
-<div class="doc_text">
-  <p>The <tt>llvm-config</tt> tool is a perl script that produces on its output
-  various kinds of information. For example, the source or object directories 
-  used to build LLVM can be accessed by passing options to <tt>llvm-config</tt>.
-  For complete details on this tool, please see the
-  <a href="CommandGuide/html/llvm-config.html">manual page</a>.</p>
-  <p>To understand the relationships between libraries, the <tt>llvm-config</tt>
-  can be very useful. If all you know is that you want certain libraries to
-  be available, you can generate the complete set of libraries to link with
-  using one of four options, as below:</p>
-  <ol>
-    <li><tt>--ldflags</tt>. This generates the command line options necessary to
-    be passed to the <tt>ld</tt> tool in order to link with LLVM. Most notably,
-    the <tt>-L</tt> option is provided to specify a library search directory 
-    that contains the LLVM libraries.</li>
-    <li><tt>--libs</tt>. This generates command line options suitable for
-    use with a gcc-style linker. That is, libraries are given with a -l option
-    and object files are given with a full path.</li>
-    <li><tt>--libnames</tt>. This generates a list of just the library file
-    names. If you know the directory in which these files reside (see --ldflags)
-    then you can find the libraries there.</li>
-    <li><tt>--libfiles</tt>. This generates the full path names of the
-    LLVM library files.</li>
-  </ol>
-  <p>If you wish to delve further into how <tt>llvm-config</tt> generates the
-  correct order (based on library dependencies), please see the tool named
-  <tt>GenLibDeps.pl</tt> in the <tt>utils</tt> source directory of LLVM.</p>
-
-  <!-- =======NOTE: =========================================================-->
-  <!-- === The following graphs and <dl> list are generated automatically ===-->
-  <!-- === by the util named GenLibDeps.pl in the llvm/utils directory.   ===-->
-  <!-- === This should be updated whenever new libraries are added,       ===-->
-  <!-- === removed, or changed                                            ===-->
-  <!-- =======NOTE: =========================================================-->
-  <h2>Dependency Relationships Of Libraries</h2>
-  <p>This graph shows the dependency of archive libraries on other archive 
-  libraries or objects. Where a library has both archive and object forms, only
-  the archive form is shown.</p>
-  <img src="img/libdeps.gif" alt="Library Dependencies"/>
-  <h2>Dependency Relationships Of Object Files</h2>
-  <p>This graph shows the dependency of object files on archive libraries or 
-  other objects. Where a library has both object and archive forms, only the 
-  dependency to the archive form is shown.</p> 
-  <img src="img/objdeps.gif" alt="Object File Dependencies"/>
-  <p>The following list shows the dependency relationships between libraries in
-  textual form. The information is the same as shown on the graphs but arranged
-  alphabetically.</p>
-<dl>
-  <dt><b>libLLVMAnalysis.a</b></dt><dd><ul>
-    <li>libLLVMCore.a</li>
-    <li>libLLVMSupport.a</li>
-    <li>libLLVMSystem.a</li>
-    <li>libLLVMTarget.a</li>
-  </ul></dd>
-  <dt><b>libLLVMArchive.a</b></dt><dd><ul>
-    <li>libLLVMBCReader.a</li>
-    <li>libLLVMCore.a</li>
-    <li>libLLVMSupport.a</li>
-    <li>libLLVMSystem.a</li>
-  </ul></dd>
-  <dt><b>libLLVMAsmParser.a</b></dt><dd><ul>
-    <li>libLLVMCore.a</li>
-    <li>libLLVMSystem.a</li>
-  </ul></dd>
-  <dt><b>libLLVMBCReader.a</b></dt><dd><ul>
-    <li>libLLVMCore.a</li>
-    <li>libLLVMSupport.a</li>
-    <li>libLLVMSystem.a</li>
-  </ul></dd>
-  <dt><b>libLLVMBCWriter.a</b></dt><dd><ul>
-    <li>libLLVMCore.a</li>
-    <li>libLLVMSupport.a</li>
-    <li>libLLVMSystem.a</li>
-  </ul></dd>
-  <dt><b>libLLVMCodeGen.a</b></dt><dd><ul>
-    <li>libLLVMAnalysis.a</li>
-    <li>libLLVMCore.a</li>
-    <li>libLLVMScalarOpts.a</li>
-    <li>libLLVMSupport.a</li>
-    <li>libLLVMSystem.a</li>
-    <li>libLLVMTarget.a</li>
-    <li>libLLVMTransformUtils.a</li>
-  </ul></dd>
-  <dt><b>libLLVMCore.a</b></dt><dd><ul>
-    <li>libLLVMSupport.a</li>
-    <li>libLLVMSystem.a</li>
-  </ul></dd>
-  <dt><b>libLLVMDebugger.a</b></dt><dd><ul>
-    <li>libLLVMBCReader.a</li>
-    <li>libLLVMCore.a</li>
-    <li>libLLVMSupport.a</li>
-    <li>libLLVMSystem.a</li>
-  </ul></dd>
-  <dt><b>libLLVMInstrumentation.a</b></dt><dd><ul>
-    <li>libLLVMCore.a</li>
-    <li>libLLVMScalarOpts.a</li>
-    <li>libLLVMSupport.a</li>
-    <li>libLLVMTransformUtils.a</li>
-  </ul></dd>
-  <dt><b>libLLVMLinker.a</b></dt><dd><ul>
-    <li>libLLVMArchive.a</li>
-    <li>libLLVMBCReader.a</li>
-    <li>libLLVMCore.a</li>
-    <li>libLLVMSupport.a</li>
-    <li>libLLVMSystem.a</li>
-  </ul></dd>
-  <dt><b>libLLVMScalarOpts.a</b></dt><dd><ul>
-    <li>libLLVMAnalysis.a</li>
-    <li>libLLVMCore.a</li>
-    <li>libLLVMSupport.a</li>
-    <li>libLLVMSystem.a</li>
-    <li>libLLVMTarget.a</li>
-    <li>libLLVMTransformUtils.a</li>
-  </ul></dd>
-  <dt><b>libLLVMSelectionDAG.a</b></dt><dd><ul>
-    <li>libLLVMAnalysis.a</li>
-    <li>libLLVMCodeGen.a</li>
-    <li>libLLVMCore.a</li>
-    <li>libLLVMSupport.a</li>
-    <li>libLLVMSystem.a</li>
-    <li>libLLVMTarget.a</li>
-    <li>libLLVMTransformUtils.a</li>
-  </ul></dd>
-  <dt><b>libLLVMSupport.a</b></dt><dd><ul>
-    <li>libLLVMSystem.a</li>
-    <li>libLLVMbzip2.a</li>
-  </ul></dd>
-  <dt><b>libLLVMSystem.a</b></dt><dd><ul>
-  </ul></dd>
-  <dt><b>libLLVMTarget.a</b></dt><dd><ul>
-    <li>libLLVMCore.a</li>
-    <li>libLLVMSupport.a</li>
-    <li>libLLVMSystem.a</li>
-  </ul></dd>
-  <dt><b>libLLVMTransformUtils.a</b></dt><dd><ul>
-    <li>libLLVMAnalysis.a</li>
-    <li>libLLVMCore.a</li>
-    <li>libLLVMSupport.a</li>
-    <li>libLLVMSystem.a</li>
-    <li>libLLVMTarget.a</li>
-    <li>libLLVMipa.a</li>
-  </ul></dd>
-  <dt><b>libLLVMbzip2.a</b></dt><dd><ul>
-  </ul></dd>
-  <dt><b>libLLVMipa.a</b></dt><dd><ul>
-    <li>libLLVMAnalysis.a</li>
-    <li>libLLVMCore.a</li>
-    <li>libLLVMSupport.a</li>
-    <li>libLLVMSystem.a</li>
-  </ul></dd>
-  <dt><b>libLLVMipo.a</b></dt><dd><ul>
-    <li>libLLVMAnalysis.a</li>
-    <li>libLLVMCore.a</li>
-    <li>libLLVMSupport.a</li>
-    <li>libLLVMSystem.a</li>
-    <li>libLLVMTarget.a</li>
-    <li>libLLVMTransformUtils.a</li>
-    <li>libLLVMipa.a</li>
-  </ul></dd>
-  <dt><b>libLLVMlto.a</b></dt><dd><ul>
-    <li>libLLVMAnalysis.a</li>
-    <li>libLLVMBCReader.a</li>
-    <li>libLLVMBCWriter.a</li>
-    <li>libLLVMCore.a</li>
-    <li>libLLVMLinker.a</li>
-    <li>libLLVMScalarOpts.a</li>
-    <li>libLLVMSupport.a</li>
-    <li>libLLVMSystem.a</li>
-    <li>libLLVMTarget.a</li>
-    <li>libLLVMipa.a</li>
-    <li>libLLVMipo.a</li>
-  </ul></dd>
-  <dt><b>LLVMARM.o</b></dt><dd><ul>
-    <li>libLLVMCodeGen.a</li>
-    <li>libLLVMCore.a</li>
-    <li>libLLVMSelectionDAG.a</li>
-    <li>libLLVMSupport.a</li>
-    <li>libLLVMSystem.a</li>
-    <li>libLLVMTarget.a</li>
-  </ul></dd>
-  <dt><b>LLVMAlpha.o</b></dt><dd><ul>
-    <li>libLLVMCodeGen.a</li>
-    <li>libLLVMCore.a</li>
-    <li>libLLVMSelectionDAG.a</li>
-    <li>libLLVMSupport.a</li>
-    <li>libLLVMSystem.a</li>
-    <li>libLLVMTarget.a</li>
-  </ul></dd>
-  <dt><b>LLVMCBackend.o</b></dt><dd><ul>
-    <li>libLLVMAnalysis.a</li>
-    <li>libLLVMCodeGen.a</li>
-    <li>libLLVMCore.a</li>
-    <li>libLLVMScalarOpts.a</li>
-    <li>libLLVMSupport.a</li>
-    <li>libLLVMSystem.a</li>
-    <li>libLLVMTarget.a</li>
-    <li>libLLVMTransformUtils.a</li>
-    <li>libLLVMipa.a</li>
-  </ul></dd>
-  <dt><b>LLVMExecutionEngine.o</b></dt><dd><ul>
-    <li>libLLVMCore.a</li>
-    <li>libLLVMSupport.a</li>
-    <li>libLLVMSystem.a</li>
-    <li>libLLVMTarget.a</li>
-  </ul></dd>
-  <dt><b>LLVMInterpreter.o</b></dt><dd><ul>
-    <li>LLVMExecutionEngine.o</li>
-    <li>libLLVMCodeGen.a</li>
-    <li>libLLVMCore.a</li>
-    <li>libLLVMSupport.a</li>
-    <li>libLLVMSystem.a</li>
-    <li>libLLVMTarget.a</li>
-  </ul></dd>
-  <dt><b>LLVMJIT.o</b></dt><dd><ul>
-    <li>LLVMExecutionEngine.o</li>
-    <li>libLLVMCore.a</li>
-    <li>libLLVMSupport.a</li>
-    <li>libLLVMSystem.a</li>
-    <li>libLLVMTarget.a</li>
-  </ul></dd>
-  <dt><b>LLVMPowerPC.o</b></dt><dd><ul>
-    <li>libLLVMCodeGen.a</li>
-    <li>libLLVMCore.a</li>
-    <li>libLLVMSelectionDAG.a</li>
-    <li>libLLVMSupport.a</li>
-    <li>libLLVMSystem.a</li>
-    <li>libLLVMTarget.a</li>
-  </ul></dd>
-  <dt><b>LLVMSparc.o</b></dt><dd><ul>
-    <li>libLLVMCodeGen.a</li>
-    <li>libLLVMCore.a</li>
-    <li>libLLVMSelectionDAG.a</li>
-    <li>libLLVMSupport.a</li>
-    <li>libLLVMSystem.a</li>
-    <li>libLLVMTarget.a</li>
-  </ul></dd>
-  <dt><b>LLVMX86.o</b></dt><dd><ul>
-    <li>libLLVMCodeGen.a</li>
-    <li>libLLVMCore.a</li>
-    <li>libLLVMSelectionDAG.a</li>
-    <li>libLLVMSupport.a</li>
-    <li>libLLVMSystem.a</li>
-    <li>libLLVMTarget.a</li>
-  </ul></dd>
-</dl>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_section"><a name="rot">Linkage Rules Of Thumb</a></div>
-<div class="doc_text">
-	<p>This section contains various "rules of thumb" about what files you
-	should link into your programs.</p>
-</div>
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="always">Always Link LLVMCore, LLVMSupport,
-    and LLVMSystem</a></div>
-<div class="doc_text">
-  <p>No matter what you do with LLVM, the last three entries in the value of 
-  your LLVMLIBS make variable should always be: 
-  <tt>LLVMCore LLVMSupport.a LLVMSystem.a</tt>. There are no <tt>LLVM</tt> 
-  programs that don't depend on these three.</p>
-</div>
-<!-- ======================================================================= -->
-<div class="doc_subsection"><a name="onlyone">Never link both archive and
-    re-linked library</a></div>
-<div class="doc_text">
-  <p>There is never any point to linking both the re-linked (<tt>.o</tt>) and
-  the archive (<tt>.a</tt>) versions of a library. Since the re-linked version
-  includes the entire library, the archive version will not resolve any symbols.
-  You could even end up with link error if you place the archive version before
-  the re-linked version on the linker's command line.</p>
-</div>
-<!-- ======================================================================= -->
-<hr>
-<div class="doc_footer">
-<address>
-  <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
-    src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS"/></a>
-  <a href="http://validator.w3.org/check/referer"><img
-    src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
-  <a href="mailto:rspencer at x10sys.com">Reid Spencer</a>
-</address>
-<a href="http://llvm.org">The LLVM Compiler Infrastructure</a> 
-<br>Last modified: $Date$ </div>
-</body>
-</html>
-<!-- vim: sw=2 ts=2 ai
--->
diff --git a/libclamav/c++/llvm/docs/WritingAnLLVMBackend.html b/libclamav/c++/llvm/docs/WritingAnLLVMBackend.html
deleted file mode 100644
index 43766b5..0000000
--- a/libclamav/c++/llvm/docs/WritingAnLLVMBackend.html
+++ /dev/null
@@ -1,2562 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-                      "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-  <title>Writing an LLVM Compiler Backend</title>
-  <link rel="stylesheet" href="llvm.css" type="text/css">
-</head>
-
-<body>
-
-<div class="doc_title">
-  Writing an LLVM Compiler Backend
-</div>
-
-<ol>
-  <li><a href="#intro">Introduction</a>
-  <ul>
-    <li><a href="#Audience">Audience</a></li>
-    <li><a href="#Prerequisite">Prerequisite Reading</a></li>
-    <li><a href="#Basic">Basic Steps</a></li>
-    <li><a href="#Preliminaries">Preliminaries</a></li>
-  </ul>
-  <li><a href="#TargetMachine">Target Machine</a></li>
-  <li><a href="#TargetRegistration">Target Registration</a></li>
-  <li><a href="#RegisterSet">Register Set and Register Classes</a>
-  <ul>
-    <li><a href="#RegisterDef">Defining a Register</a></li>
-    <li><a href="#RegisterClassDef">Defining a Register Class</a></li>
-    <li><a href="#implementRegister">Implement a subclass of TargetRegisterInfo</a></li>
-  </ul></li>
-  <li><a href="#InstructionSet">Instruction Set</a>
-  <ul>  
-    <li><a href="#operandMapping">Instruction Operand Mapping</a></li>
-    <li><a href="#implementInstr">Implement a subclass of TargetInstrInfo</a></li>
-    <li><a href="#branchFolding">Branch Folding and If Conversion</a></li>
-  </ul></li>
-  <li><a href="#InstructionSelector">Instruction Selector</a>
-  <ul>
-    <li><a href="#LegalizePhase">The SelectionDAG Legalize Phase</a>
-    <ul>
-      <li><a href="#promote">Promote</a></li> 
-      <li><a href="#expand">Expand</a></li> 
-      <li><a href="#custom">Custom</a></li> 
-      <li><a href="#legal">Legal</a></li>       
-    </ul></li>
-    <li><a href="#callingConventions">Calling Conventions</a></li>     
-  </ul></li>
-  <li><a href="#assemblyPrinter">Assembly Printer</a></li> 
-  <li><a href="#subtargetSupport">Subtarget Support</a></li> 
-  <li><a href="#jitSupport">JIT Support</a>
-  <ul>  
-    <li><a href="#mce">Machine Code Emitter</a></li>   
-    <li><a href="#targetJITInfo">Target JIT Info</a></li>   
-  </ul></li>
-</ol>
-
-<div class="doc_author">    
-  <p>Written by <a href="http://www.woo.com">Mason Woo</a> and
-                <a href="http://misha.brukman.net">Misha Brukman</a></p>
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="intro">Introduction</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>
-This document describes techniques for writing compiler backends that convert
-the LLVM Intermediate Representation (IR) to code for a specified machine or
-other languages. Code intended for a specific machine can take the form of
-either assembly code or binary code (usable for a JIT compiler).
-</p>
-
-<p>
-The backend of LLVM features a target-independent code generator that may create
-output for several types of target CPUs &mdash; including X86, PowerPC, Alpha,
-and SPARC. The backend may also be used to generate code targeted at SPUs of the
-Cell processor or GPUs to support the execution of compute kernels.
-</p>
-
-<p>
-The document focuses on existing examples found in subdirectories
-of <tt>llvm/lib/Target</tt> in a downloaded LLVM release. In particular, this
-document focuses on the example of creating a static compiler (one that emits
-text assembly) for a SPARC target, because SPARC has fairly standard
-characteristics, such as a RISC instruction set and straightforward calling
-conventions.
-</p>
-
-</div>
-
-<div class="doc_subsection">
-  <a name="Audience">Audience</a>
-</div>  
-
-<div class="doc_text">
-
-<p>
-The audience for this document is anyone who needs to write an LLVM backend to
-generate code for a specific hardware or software target.
-</p>
-
-</div>
-
-<div class="doc_subsection">
-  <a name="Prerequisite">Prerequisite Reading</a>
-</div>  
-
-<div class="doc_text">  
-
-<p>
-These essential documents must be read before reading this document:
-</p>
-
-<ul>
-<li><i><a href="http://www.llvm.org/docs/LangRef.html">LLVM Language Reference
-    Manual</a></i> &mdash; a reference manual for the LLVM assembly language.</li>
-
-<li><i><a href="http://www.llvm.org/docs/CodeGenerator.html">The LLVM
-    Target-Independent Code Generator</a></i> &mdash; a guide to the components
-    (classes and code generation algorithms) for translating the LLVM internal
-    representation into machine code for a specified target.  Pay particular
-    attention to the descriptions of code generation stages: Instruction
-    Selection, Scheduling and Formation, SSA-based Optimization, Register
-    Allocation, Prolog/Epilog Code Insertion, Late Machine Code Optimizations,
-    and Code Emission.</li>
-
-<li><i><a href="http://www.llvm.org/docs/TableGenFundamentals.html">TableGen
-    Fundamentals</a></i> &mdash;a document that describes the TableGen
-    (<tt>tblgen</tt>) application that manages domain-specific information to
-    support LLVM code generation. TableGen processes input from a target
-    description file (<tt>.td</tt> suffix) and generates C++ code that can be
-    used for code generation.</li>
-
-<li><i><a href="http://www.llvm.org/docs/WritingAnLLVMPass.html">Writing an LLVM
-    Pass</a></i> &mdash; The assembly printer is a <tt>FunctionPass</tt>, as are
-    several SelectionDAG processing steps.</li>
-</ul>
-
-<p>
-To follow the SPARC examples in this document, have a copy of
-<i><a href="http://www.sparc.org/standards/V8.pdf">The SPARC Architecture
-Manual, Version 8</a></i> for reference. For details about the ARM instruction
-set, refer to the <i><a href="http://infocenter.arm.com/">ARM Architecture
-Reference Manual</a></i>. For more about the GNU Assembler format
-(<tt>GAS</tt>), see
-<i><a href="http://sourceware.org/binutils/docs/as/index.html">Using As</a></i>,
-especially for the assembly printer. <i>Using As</i> contains a list of target
-machine dependent features.
-</p>
-
-</div>
-
-<div class="doc_subsection">
-  <a name="Basic">Basic Steps</a>
-</div>
-
-<div class="doc_text">
-
-<p>
-To write a compiler backend for LLVM that converts the LLVM IR to code for a
-specified target (machine or other language), follow these steps:
-</p>
-
-<ul>
-<li>Create a subclass of the TargetMachine class that describes characteristics
-    of your target machine. Copy existing examples of specific TargetMachine
-    class and header files; for example, start with
-    <tt>SparcTargetMachine.cpp</tt> and <tt>SparcTargetMachine.h</tt>, but
-    change the file names for your target. Similarly, change code that
-    references "Sparc" to reference your target. </li>
-
-<li>Describe the register set of the target. Use TableGen to generate code for
-    register definition, register aliases, and register classes from a
-    target-specific <tt>RegisterInfo.td</tt> input file. You should also write
-    additional code for a subclass of the TargetRegisterInfo class that
-    represents the class register file data used for register allocation and
-    also describes the interactions between registers.</li>
-
-<li>Describe the instruction set of the target. Use TableGen to generate code
-    for target-specific instructions from target-specific versions of
-    <tt>TargetInstrFormats.td</tt> and <tt>TargetInstrInfo.td</tt>. You should
-    write additional code for a subclass of the TargetInstrInfo class to
-    represent machine instructions supported by the target machine. </li>
-
-<li>Describe the selection and conversion of the LLVM IR from a Directed Acyclic
-    Graph (DAG) representation of instructions to native target-specific
-    instructions. Use TableGen to generate code that matches patterns and
-    selects instructions based on additional information in a target-specific
-    version of <tt>TargetInstrInfo.td</tt>. Write code
-    for <tt>XXXISelDAGToDAG.cpp</tt>, where XXX identifies the specific target,
-    to perform pattern matching and DAG-to-DAG instruction selection. Also write
-    code in <tt>XXXISelLowering.cpp</tt> to replace or remove operations and
-    data types that are not supported natively in a SelectionDAG. </li>
-
-<li>Write code for an assembly printer that converts LLVM IR to a GAS format for
-    your target machine.  You should add assembly strings to the instructions
-    defined in your target-specific version of <tt>TargetInstrInfo.td</tt>. You
-    should also write code for a subclass of AsmPrinter that performs the
-    LLVM-to-assembly conversion and a trivial subclass of TargetAsmInfo.</li>
-
-<li>Optionally, add support for subtargets (i.e., variants with different
-    capabilities). You should also write code for a subclass of the
-    TargetSubtarget class, which allows you to use the <tt>-mcpu=</tt>
-    and <tt>-mattr=</tt> command-line options.</li>
-
-<li>Optionally, add JIT support and create a machine code emitter (subclass of
-    TargetJITInfo) that is used to emit binary code directly into memory. </li>
-</ul>
-
-<p>
-In the <tt>.cpp</tt> and <tt>.h</tt>. files, initially stub up these methods and
-then implement them later. Initially, you may not know which private members
-that the class will need and which components will need to be subclassed.
-</p>
-
-</div>
-
-<div class="doc_subsection">
-  <a name="Preliminaries">Preliminaries</a>
-</div>
-
-<div class="doc_text">
-
-<p>
-To actually create your compiler backend, you need to create and modify a few
-files. The absolute minimum is discussed here. But to actually use the LLVM
-target-independent code generator, you must perform the steps described in
-the <a href="http://www.llvm.org/docs/CodeGenerator.html">LLVM
-Target-Independent Code Generator</a> document.
-</p>
-
-<p>
-First, you should create a subdirectory under <tt>lib/Target</tt> to hold all
-the files related to your target. If your target is called "Dummy," create the
-directory <tt>lib/Target/Dummy</tt>.
-</p>
-
-<p>
-In this new
-directory, create a <tt>Makefile</tt>. It is easiest to copy a
-<tt>Makefile</tt> of another target and modify it. It should at least contain
-the <tt>LEVEL</tt>, <tt>LIBRARYNAME</tt> and <tt>TARGET</tt> variables, and then
-include <tt>$(LEVEL)/Makefile.common</tt>. The library can be
-named <tt>LLVMDummy</tt> (for example, see the MIPS target). Alternatively, you
-can split the library into <tt>LLVMDummyCodeGen</tt>
-and <tt>LLVMDummyAsmPrinter</tt>, the latter of which should be implemented in a
-subdirectory below <tt>lib/Target/Dummy</tt> (for example, see the PowerPC
-target).
-</p>
-
-<p>
-Note that these two naming schemes are hardcoded into <tt>llvm-config</tt>.
-Using any other naming scheme will confuse <tt>llvm-config</tt> and produce a
-lot of (seemingly unrelated) linker errors when linking <tt>llc</tt>.
-</p>
-
-<p>
-To make your target actually do something, you need to implement a subclass of
-<tt>TargetMachine</tt>. This implementation should typically be in the file
-<tt>lib/Target/DummyTargetMachine.cpp</tt>, but any file in
-the <tt>lib/Target</tt> directory will be built and should work. To use LLVM's
-target independent code generator, you should do what all current machine
-backends do: create a subclass of <tt>LLVMTargetMachine</tt>. (To create a
-target from scratch, create a subclass of <tt>TargetMachine</tt>.)
-</p>
-
-<p>
-To get LLVM to actually build and link your target, you need to add it to
-the <tt>TARGETS_TO_BUILD</tt> variable. To do this, you modify the configure
-script to know about your target when parsing the <tt>--enable-targets</tt>
-option. Search the configure script for <tt>TARGETS_TO_BUILD</tt>, add your
-target to the lists there (some creativity required), and then
-reconfigure. Alternatively, you can change <tt>autotools/configure.ac</tt> and
-regenerate configure by running <tt>./autoconf/AutoRegen.sh</tt>.
-</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="TargetMachine">Target Machine</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>
-<tt>LLVMTargetMachine</tt> is designed as a base class for targets implemented
-with the LLVM target-independent code generator. The <tt>LLVMTargetMachine</tt>
-class should be specialized by a concrete target class that implements the
-various virtual methods. <tt>LLVMTargetMachine</tt> is defined as a subclass of
-<tt>TargetMachine</tt> in <tt>include/llvm/Target/TargetMachine.h</tt>. The
-<tt>TargetMachine</tt> class implementation (<tt>TargetMachine.cpp</tt>) also
-processes numerous command-line options.
-</p>
-
-<p>
-To create a concrete target-specific subclass of <tt>LLVMTargetMachine</tt>,
-start by copying an existing <tt>TargetMachine</tt> class and header.  You
-should name the files that you create to reflect your specific target. For
-instance, for the SPARC target, name the files <tt>SparcTargetMachine.h</tt> and
-<tt>SparcTargetMachine.cpp</tt>.
-</p>
-
-<p>
-For a target machine <tt>XXX</tt>, the implementation of
-<tt>XXXTargetMachine</tt> must have access methods to obtain objects that
-represent target components.  These methods are named <tt>get*Info</tt>, and are
-intended to obtain the instruction set (<tt>getInstrInfo</tt>), register set
-(<tt>getRegisterInfo</tt>), stack frame layout (<tt>getFrameInfo</tt>), and
-similar information. <tt>XXXTargetMachine</tt> must also implement the
-<tt>getTargetData</tt> method to access an object with target-specific data
-characteristics, such as data type size and alignment requirements.
-</p>
-
-<p>
-For instance, for the SPARC target, the header file
-<tt>SparcTargetMachine.h</tt> declares prototypes for several <tt>get*Info</tt>
-and <tt>getTargetData</tt> methods that simply return a class member.
-</p>
-
-<div class="doc_code">
-<pre>
-namespace llvm {
-
-class Module;
-
-class SparcTargetMachine : public LLVMTargetMachine {
-  const TargetData DataLayout;       // Calculates type size &amp; alignment
-  SparcSubtarget Subtarget;
-  SparcInstrInfo InstrInfo;
-  TargetFrameInfo FrameInfo;
-  
-protected:
-  virtual const TargetAsmInfo *createTargetAsmInfo() const;
-  
-public:
-  SparcTargetMachine(const Module &amp;M, const std::string &amp;FS);
-
-  virtual const SparcInstrInfo *getInstrInfo() const {return &amp;InstrInfo; }
-  virtual const TargetFrameInfo *getFrameInfo() const {return &amp;FrameInfo; }
-  virtual const TargetSubtarget *getSubtargetImpl() const{return &amp;Subtarget; }
-  virtual const TargetRegisterInfo *getRegisterInfo() const {
-    return &amp;InstrInfo.getRegisterInfo();
-  }
-  virtual const TargetData *getTargetData() const { return &amp;DataLayout; }
-  static unsigned getModuleMatchQuality(const Module &amp;M);
-
-  // Pass Pipeline Configuration
-  virtual bool addInstSelector(PassManagerBase &amp;PM, bool Fast);
-  virtual bool addPreEmitPass(PassManagerBase &amp;PM, bool Fast);
-};
-
-} // end namespace llvm
-</pre>
-</div>
-
-</div>
-
-
-<div class="doc_text">
-
-<ul>
-<li><tt>getInstrInfo()</tt></li>
-<li><tt>getRegisterInfo()</tt></li>
-<li><tt>getFrameInfo()</tt></li>
-<li><tt>getTargetData()</tt></li>
-<li><tt>getSubtargetImpl()</tt></li>
-</ul>
-
-<p>For some targets, you also need to support the following methods:</p>
-
-<ul>
-<li><tt>getTargetLowering()</tt></li>
-<li><tt>getJITInfo()</tt></li>
-</ul>
-
-<p>
-In addition, the <tt>XXXTargetMachine</tt> constructor should specify a
-<tt>TargetDescription</tt> string that determines the data layout for the target
-machine, including characteristics such as pointer size, alignment, and
-endianness. For example, the constructor for SparcTargetMachine contains the
-following:
-</p>
-
-<div class="doc_code">
-<pre>
-SparcTargetMachine::SparcTargetMachine(const Module &amp;M, const std::string &amp;FS)
-  : DataLayout("E-p:32:32-f128:128:128"),
-    Subtarget(M, FS), InstrInfo(Subtarget),
-    FrameInfo(TargetFrameInfo::StackGrowsDown, 8, 0) {
-}
-</pre>
-</div>
-
-</div>
-
-<div class="doc_text">
-
-<p>Hyphens separate portions of the <tt>TargetDescription</tt> string.</p>
-
-<ul>
-<li>An upper-case "<tt>E</tt>" in the string indicates a big-endian target data
-    model. a lower-case "<tt>e</tt>" indicates little-endian.</li>
-
-<li>"<tt>p:</tt>" is followed by pointer information: size, ABI alignment, and
-    preferred alignment. If only two figures follow "<tt>p:</tt>", then the
-    first value is pointer size, and the second value is both ABI and preferred
-    alignment.</li>
-
-<li>Then a letter for numeric type alignment: "<tt>i</tt>", "<tt>f</tt>",
-    "<tt>v</tt>", or "<tt>a</tt>" (corresponding to integer, floating point,
-    vector, or aggregate). "<tt>i</tt>", "<tt>v</tt>", or "<tt>a</tt>" are
-    followed by ABI alignment and preferred alignment. "<tt>f</tt>" is followed
-    by three values: the first indicates the size of a long double, then ABI
-    alignment, and then ABI preferred alignment.</li>
-</ul>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="TargetRegistration">Target Registration</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>
-You must also register your target with the <tt>TargetRegistry</tt>, which is
-what other LLVM tools use to be able to lookup and use your target at
-runtime. The <tt>TargetRegistry</tt> can be used directly, but for most targets
-there are helper templates which should take care of the work for you.</p>
-
-<p>
-All targets should declare a global <tt>Target</tt> object which is used to
-represent the target during registration. Then, in the target's TargetInfo
-library, the target should define that object and use
-the <tt>RegisterTarget</tt> template to register the target. For example, the Sparc registration code looks like this:
-</p>
-
-<div class="doc_code">
-<pre>
-Target llvm::TheSparcTarget;
-
-extern "C" void LLVMInitializeSparcTargetInfo() { 
-  RegisterTarget&lt;Triple::sparc, /*HasJIT=*/false&gt;
-    X(TheSparcTarget, "sparc", "Sparc");
-}
-</pre>
-</div>
-
-<p>
-This allows the <tt>TargetRegistry</tt> to look up the target by name or by
-target triple. In addition, most targets will also register additional features
-which are available in separate libraries. These registration steps are
-separate, because some clients may wish to only link in some parts of the target
--- the JIT code generator does not require the use of the assembler printer, for
-example. Here is an example of registering the Sparc assembly printer:
-</p>
-
-<div class="doc_code">
-<pre>
-extern "C" void LLVMInitializeSparcAsmPrinter() { 
-  RegisterAsmPrinter&lt;SparcAsmPrinter&gt; X(TheSparcTarget);
-}
-</pre>
-</div>
-
-<p>
-For more information, see
-"<a href="/doxygen/TargetRegistry_8h-source.html">llvm/Target/TargetRegistry.h</a>".
-</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="RegisterSet">Register Set and Register Classes</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>
-You should describe a concrete target-specific class that represents the
-register file of a target machine. This class is called <tt>XXXRegisterInfo</tt>
-(where <tt>XXX</tt> identifies the target) and represents the class register
-file data that is used for register allocation. It also describes the
-interactions between registers.
-</p>
-
-<p>
-You also need to define register classes to categorize related registers. A
-register class should be added for groups of registers that are all treated the
-same way for some instruction. Typical examples are register classes for
-integer, floating-point, or vector registers. A register allocator allows an
-instruction to use any register in a specified register class to perform the
-instruction in a similar manner. Register classes allocate virtual registers to
-instructions from these sets, and register classes let the target-independent
-register allocator automatically choose the actual registers.
-</p>
-
-<p>
-Much of the code for registers, including register definition, register aliases,
-and register classes, is generated by TableGen from <tt>XXXRegisterInfo.td</tt>
-input files and placed in <tt>XXXGenRegisterInfo.h.inc</tt> and
-<tt>XXXGenRegisterInfo.inc</tt> output files. Some of the code in the
-implementation of <tt>XXXRegisterInfo</tt> requires hand-coding.
-</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="RegisterDef">Defining a Register</a>
-</div>
-
-<div class="doc_text">
-
-<p>
-The <tt>XXXRegisterInfo.td</tt> file typically starts with register definitions
-for a target machine. The <tt>Register</tt> class (specified
-in <tt>Target.td</tt>) is used to define an object for each register. The
-specified string <tt>n</tt> becomes the <tt>Name</tt> of the register. The
-basic <tt>Register</tt> object does not have any subregisters and does not
-specify any aliases.
-</p>
-
-<div class="doc_code">
-<pre>
-class Register&lt;string n&gt; {
-  string Namespace = "";
-  string AsmName = n;
-  string Name = n;
-  int SpillSize = 0;
-  int SpillAlignment = 0;
-  list&lt;Register&gt; Aliases = [];
-  list&lt;Register&gt; SubRegs = [];
-  list&lt;int&gt; DwarfNumbers = [];
-}
-</pre>
-</div>
-
-<p>
-For example, in the <tt>X86RegisterInfo.td</tt> file, there are register
-definitions that utilize the Register class, such as:
-</p>
-
-<div class="doc_code">
-<pre>
-def AL : Register&lt;"AL"&gt;, DwarfRegNum&lt;[0, 0, 0]&gt;;
-</pre>
-</div>
-
-<p>
-This defines the register <tt>AL</tt> and assigns it values (with
-<tt>DwarfRegNum</tt>) that are used by <tt>gcc</tt>, <tt>gdb</tt>, or a debug
-information writer (such as <tt>DwarfWriter</tt>
-in <tt>llvm/lib/CodeGen/AsmPrinter</tt>) to identify a register. For register
-<tt>AL</tt>, <tt>DwarfRegNum</tt> takes an array of 3 values representing 3
-different modes: the first element is for X86-64, the second for exception
-handling (EH) on X86-32, and the third is generic. -1 is a special Dwarf number
-that indicates the gcc number is undefined, and -2 indicates the register number
-is invalid for this mode.
-</p>
-
-<p>
-From the previously described line in the <tt>X86RegisterInfo.td</tt> file,
-TableGen generates this code in the <tt>X86GenRegisterInfo.inc</tt> file:
-</p>
-
-<div class="doc_code">
-<pre>
-static const unsigned GR8[] = { X86::AL, ... };
-
-const unsigned AL_AliasSet[] = { X86::AX, X86::EAX, X86::RAX, 0 };
-
-const TargetRegisterDesc RegisterDescriptors[] = { 
-  ...
-{ "AL", "AL", AL_AliasSet, Empty_SubRegsSet, Empty_SubRegsSet, AL_SuperRegsSet }, ...
-</pre>
-</div>
-
-<p>
-From the register info file, TableGen generates a <tt>TargetRegisterDesc</tt>
-object for each register. <tt>TargetRegisterDesc</tt> is defined in
-<tt>include/llvm/Target/TargetRegisterInfo.h</tt> with the following fields:
-</p>
-
-<div class="doc_code">
-<pre>
-struct TargetRegisterDesc {
-  const char     *AsmName;      // Assembly language name for the register
-  const char     *Name;         // Printable name for the reg (for debugging)
-  const unsigned *AliasSet;     // Register Alias Set
-  const unsigned *SubRegs;      // Sub-register set
-  const unsigned *ImmSubRegs;   // Immediate sub-register set
-  const unsigned *SuperRegs;    // Super-register set
-};</pre>
-</div>
-
-<p>
-TableGen uses the entire target description file (<tt>.td</tt>) to determine
-text names for the register (in the <tt>AsmName</tt> and <tt>Name</tt> fields of
-<tt>TargetRegisterDesc</tt>) and the relationships of other registers to the
-defined register (in the other <tt>TargetRegisterDesc</tt> fields). In this
-example, other definitions establish the registers "<tt>AX</tt>",
-"<tt>EAX</tt>", and "<tt>RAX</tt>" as aliases for one another, so TableGen
-generates a null-terminated array (<tt>AL_AliasSet</tt>) for this register alias
-set.
-</p>
-
-<p>
-The <tt>Register</tt> class is commonly used as a base class for more complex
-classes. In <tt>Target.td</tt>, the <tt>Register</tt> class is the base for the
-<tt>RegisterWithSubRegs</tt> class that is used to define registers that need to
-specify subregisters in the <tt>SubRegs</tt> list, as shown here:
-</p>
-
-<div class="doc_code">
-<pre>
-class RegisterWithSubRegs&lt;string n,
-list&lt;Register&gt; subregs&gt; : Register&lt;n&gt; {
-  let SubRegs = subregs;
-}
-</pre>
-</div>
-
-<p>
-In <tt>SparcRegisterInfo.td</tt>, additional register classes are defined for
-SPARC: a Register subclass, SparcReg, and further subclasses: <tt>Ri</tt>,
-<tt>Rf</tt>, and <tt>Rd</tt>. SPARC registers are identified by 5-bit ID
-numbers, which is a feature common to these subclasses. Note the use of
-'<tt>let</tt>' expressions to override values that are initially defined in a
-superclass (such as <tt>SubRegs</tt> field in the <tt>Rd</tt> class).
-</p>
-
-<div class="doc_code">
-<pre>
-class SparcReg&lt;string n&gt; : Register&lt;n&gt; {
-  field bits&lt;5&gt; Num;
-  let Namespace = "SP";
-}
-// Ri - 32-bit integer registers
-class Ri&lt;bits&lt;5&gt; num, string n&gt; :
-SparcReg&lt;n&gt; {
-  let Num = num;
-}
-// Rf - 32-bit floating-point registers
-class Rf&lt;bits&lt;5&gt; num, string n&gt; :
-SparcReg&lt;n&gt; {
-  let Num = num;
-}
-// Rd - Slots in the FP register file for 64-bit
-floating-point values.
-class Rd&lt;bits&lt;5&gt; num, string n,
-list&lt;Register&gt; subregs&gt; : SparcReg&lt;n&gt; {
-  let Num = num;
-  let SubRegs = subregs;
-}
-</pre>
-</div>
-
-<p>
-In the <tt>SparcRegisterInfo.td</tt> file, there are register definitions that
-utilize these subclasses of <tt>Register</tt>, such as:
-</p>
-
-<div class="doc_code">
-<pre>
-def G0 : Ri&lt; 0, "G0"&gt;,
-DwarfRegNum&lt;[0]&gt;;
-def G1 : Ri&lt; 1, "G1"&gt;, DwarfRegNum&lt;[1]&gt;;
-...
-def F0 : Rf&lt; 0, "F0"&gt;,
-DwarfRegNum&lt;[32]&gt;;
-def F1 : Rf&lt; 1, "F1"&gt;,
-DwarfRegNum&lt;[33]&gt;;
-...
-def D0 : Rd&lt; 0, "F0", [F0, F1]&gt;,
-DwarfRegNum&lt;[32]&gt;;
-def D1 : Rd&lt; 2, "F2", [F2, F3]&gt;,
-DwarfRegNum&lt;[34]&gt;;
-</pre>
-</div>
-
-<p>
-The last two registers shown above (<tt>D0</tt> and <tt>D1</tt>) are
-double-precision floating-point registers that are aliases for pairs of
-single-precision floating-point sub-registers. In addition to aliases, the
-sub-register and super-register relationships of the defined register are in
-fields of a register's TargetRegisterDesc.
-</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="RegisterClassDef">Defining a Register Class</a>
-</div>
-
-<div class="doc_text">
-
-<p>
-The <tt>RegisterClass</tt> class (specified in <tt>Target.td</tt>) is used to
-define an object that represents a group of related registers and also defines
-the default allocation order of the registers. A target description file
-<tt>XXXRegisterInfo.td</tt> that uses <tt>Target.td</tt> can construct register
-classes using the following class:
-</p>
-
-<div class="doc_code">
-<pre>
-class RegisterClass&lt;string namespace,
-list&lt;ValueType&gt; regTypes, int alignment,
-                    list&lt;Register&gt; regList&gt; {
-  string Namespace = namespace;
-  list&lt;ValueType&gt; RegTypes = regTypes;
-  int Size = 0;  // spill size, in bits; zero lets tblgen pick the size
-  int Alignment = alignment;
-
-  // CopyCost is the cost of copying a value between two registers
-  // default value 1 means a single instruction
-  // A negative value means copying is extremely expensive or impossible
-  int CopyCost = 1;  
-  list&lt;Register&gt; MemberList = regList;
-  
-  // for register classes that are subregisters of this class
-  list&lt;RegisterClass&gt; SubRegClassList = [];  
-  
-  code MethodProtos = [{}];  // to insert arbitrary code
-  code MethodBodies = [{}];
-}
-</pre>
-</div>
-
-<p>To define a RegisterClass, use the following 4 arguments:</p>
-
-<ul>
-<li>The first argument of the definition is the name of the namespace.</li>
-
-<li>The second argument is a list of <tt>ValueType</tt> register type values
-    that are defined in <tt>include/llvm/CodeGen/ValueTypes.td</tt>. Defined
-    values include integer types (such as <tt>i16</tt>, <tt>i32</tt>,
-    and <tt>i1</tt> for Boolean), floating-point types
-    (<tt>f32</tt>, <tt>f64</tt>), and vector types (for example, <tt>v8i16</tt>
-    for an <tt>8 x i16</tt> vector). All registers in a <tt>RegisterClass</tt>
-    must have the same <tt>ValueType</tt>, but some registers may store vector
-    data in different configurations. For example a register that can process a
-    128-bit vector may be able to handle 16 8-bit integer elements, 8 16-bit
-    integers, 4 32-bit integers, and so on. </li>
-
-<li>The third argument of the <tt>RegisterClass</tt> definition specifies the
-    alignment required of the registers when they are stored or loaded to
-    memory.</li>
-
-<li>The final argument, <tt>regList</tt>, specifies which registers are in this
-    class.  If an <tt>allocation_order_*</tt> method is not specified,
-    then <tt>regList</tt> also defines the order of allocation used by the
-    register allocator.</li>
-</ul>
-
-<p>
-In <tt>SparcRegisterInfo.td</tt>, three RegisterClass objects are defined:
-<tt>FPRegs</tt>, <tt>DFPRegs</tt>, and <tt>IntRegs</tt>. For all three register
-classes, the first argument defines the namespace with the string
-'<tt>SP</tt>'. <tt>FPRegs</tt> defines a group of 32 single-precision
-floating-point registers (<tt>F0</tt> to <tt>F31</tt>); <tt>DFPRegs</tt> defines
-a group of 16 double-precision registers
-(<tt>D0-D15</tt>). For <tt>IntRegs</tt>, the <tt>MethodProtos</tt>
-and <tt>MethodBodies</tt> methods are used by TableGen to insert the specified
-code into generated output.
-</p>
-
-<div class="doc_code">
-<pre>
-def FPRegs : RegisterClass&lt;"SP", [f32], 32,
-  [F0, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15,
-   F16, F17, F18, F19, F20, F21, F22, F23, F24, F25, F26, F27, F28, F29, F30, F31]&gt;;
-
-def DFPRegs : RegisterClass&lt;"SP", [f64], 64,
-  [D0, D1, D2, D3, D4, D5, D6, D7, D8, D9, D10, D11, D12, D13, D14, D15]&gt;;
-&nbsp;
-def IntRegs : RegisterClass&lt;"SP", [i32], 32,
-    [L0, L1, L2, L3, L4, L5, L6, L7,
-     I0, I1, I2, I3, I4, I5,
-     O0, O1, O2, O3, O4, O5, O7,
-     G1,
-     // Non-allocatable regs:
-     G2, G3, G4, 
-     O6,        // stack ptr
-    I6,        // frame ptr
-     I7,        // return address
-     G0,        // constant zero
-     G5, G6, G7 // reserved for kernel
-    ]&gt; {
-  let MethodProtos = [{
-    iterator allocation_order_end(const MachineFunction &amp;MF) const;
-  }];
-  let MethodBodies = [{
-    IntRegsClass::iterator
-    IntRegsClass::allocation_order_end(const MachineFunction &amp;MF) const {
-      return end() - 10  // Don't allocate special registers
-         -1;
-    }
-  }];
-}
-</pre>
-</div>
-
-<p>
-Using <tt>SparcRegisterInfo.td</tt> with TableGen generates several output files
-that are intended for inclusion in other source code that you write.
-<tt>SparcRegisterInfo.td</tt> generates <tt>SparcGenRegisterInfo.h.inc</tt>,
-which should be included in the header file for the implementation of the SPARC
-register implementation that you write (<tt>SparcRegisterInfo.h</tt>). In
-<tt>SparcGenRegisterInfo.h.inc</tt> a new structure is defined called
-<tt>SparcGenRegisterInfo</tt> that uses <tt>TargetRegisterInfo</tt> as its
-base. It also specifies types, based upon the defined register
-classes: <tt>DFPRegsClass</tt>, <tt>FPRegsClass</tt>, and <tt>IntRegsClass</tt>.
-</p>
-
-<p>
-<tt>SparcRegisterInfo.td</tt> also generates <tt>SparcGenRegisterInfo.inc</tt>,
-which is included at the bottom of <tt>SparcRegisterInfo.cpp</tt>, the SPARC
-register implementation. The code below shows only the generated integer
-registers and associated register classes. The order of registers
-in <tt>IntRegs</tt> reflects the order in the definition of <tt>IntRegs</tt> in
-the target description file. Take special note of the use
-of <tt>MethodBodies</tt> in <tt>SparcRegisterInfo.td</tt> to create code in
-<tt>SparcGenRegisterInfo.inc</tt>. <tt>MethodProtos</tt> generates similar code
-in <tt>SparcGenRegisterInfo.h.inc</tt>.
-</p>
-
-<div class="doc_code">
-<pre>  // IntRegs Register Class...
-  static const unsigned IntRegs[] = {
-    SP::L0, SP::L1, SP::L2, SP::L3, SP::L4, SP::L5,
-    SP::L6, SP::L7, SP::I0, SP::I1, SP::I2, SP::I3,
-    SP::I4, SP::I5, SP::O0, SP::O1, SP::O2, SP::O3,
-    SP::O4, SP::O5, SP::O7, SP::G1, SP::G2, SP::G3,
-    SP::G4, SP::O6, SP::I6, SP::I7, SP::G0, SP::G5,
-    SP::G6, SP::G7, 
-  };
-
-  // IntRegsVTs Register Class Value Types...
-  static const MVT::ValueType IntRegsVTs[] = {
-    MVT::i32, MVT::Other
-  };
-
-namespace SP {   // Register class instances
-  DFPRegsClass&nbsp;&nbsp;&nbsp; DFPRegsRegClass;
-  FPRegsClass&nbsp;&nbsp;&nbsp;&nbsp; FPRegsRegClass;
-  IntRegsClass&nbsp;&nbsp;&nbsp; IntRegsRegClass;
-...
-  // IntRegs Sub-register Classess...
-  static const TargetRegisterClass* const IntRegsSubRegClasses [] = {
-    NULL
-  };
-...
-  // IntRegs Super-register Classess...
-  static const TargetRegisterClass* const IntRegsSuperRegClasses [] = {
-    NULL
-  };
-...
-  // IntRegs Register Class sub-classes...
-  static const TargetRegisterClass* const IntRegsSubclasses [] = {
-    NULL
-  };
-...
-  // IntRegs Register Class super-classes...
-  static const TargetRegisterClass* const IntRegsSuperclasses [] = {
-    NULL
-  };
-...
-  IntRegsClass::iterator
-  IntRegsClass::allocation_order_end(const MachineFunction &amp;MF) const {
-     return end()-10  // Don't allocate special registers
-         -1;
-  }
-  
-  IntRegsClass::IntRegsClass() : TargetRegisterClass(IntRegsRegClassID, 
-    IntRegsVTs, IntRegsSubclasses, IntRegsSuperclasses, IntRegsSubRegClasses, 
-    IntRegsSuperRegClasses, 4, 4, 1, IntRegs, IntRegs + 32) {}
-}
-</pre>
-</div>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="implementRegister">Implement a subclass of</a> 
-  <a href="http://www.llvm.org/docs/CodeGenerator.html#targetregisterinfo">TargetRegisterInfo</a>
-</div>
-
-<div class="doc_text">
-
-<p>
-The final step is to hand code portions of <tt>XXXRegisterInfo</tt>, which
-implements the interface described in <tt>TargetRegisterInfo.h</tt>. These
-functions return <tt>0</tt>, <tt>NULL</tt>, or <tt>false</tt>, unless
-overridden. Here is a list of functions that are overridden for the SPARC
-implementation in <tt>SparcRegisterInfo.cpp</tt>:
-</p>
-
-<ul>
-<li><tt>getCalleeSavedRegs</tt> &mdash; Returns a list of callee-saved registers
-    in the order of the desired callee-save stack frame offset.</li>
-
-<li><tt>getCalleeSavedRegClasses</tt> &mdash; Returns a list of preferred
-    register classes with which to spill each callee saved register.</li>
-
-<li><tt>getReservedRegs</tt> &mdash; Returns a bitset indexed by physical
-    register numbers, indicating if a particular register is unavailable.</li>
-
-<li><tt>hasFP</tt> &mdash; Return a Boolean indicating if a function should have
-    a dedicated frame pointer register.</li>
-
-<li><tt>eliminateCallFramePseudoInstr</tt> &mdash; If call frame setup or
-    destroy pseudo instructions are used, this can be called to eliminate
-    them.</li>
-
-<li><tt>eliminateFrameIndex</tt> &mdash; Eliminate abstract frame indices from
-    instructions that may use them.</li>
-
-<li><tt>emitPrologue</tt> &mdash; Insert prologue code into the function.</li>
-
-<li><tt>emitEpilogue</tt> &mdash; Insert epilogue code into the function.</li>
-</ul>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="InstructionSet">Instruction Set</a>
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_text">
-
-<p>
-During the early stages of code generation, the LLVM IR code is converted to a
-<tt>SelectionDAG</tt> with nodes that are instances of the <tt>SDNode</tt> class
-containing target instructions. An <tt>SDNode</tt> has an opcode, operands, type
-requirements, and operation properties. For example, is an operation
-commutative, does an operation load from memory. The various operation node
-types are described in the <tt>include/llvm/CodeGen/SelectionDAGNodes.h</tt>
-file (values of the <tt>NodeType</tt> enum in the <tt>ISD</tt> namespace).
-</p>
-
-<p>
-TableGen uses the following target description (<tt>.td</tt>) input files to
-generate much of the code for instruction definition:
-</p>
-
-<ul>
-<li><tt>Target.td</tt> &mdash; Where the <tt>Instruction</tt>, <tt>Operand</tt>,
-    <tt>InstrInfo</tt>, and other fundamental classes are defined.</li>
-
-<li><tt>TargetSelectionDAG.td</tt>&mdash; Used by <tt>SelectionDAG</tt>
-    instruction selection generators, contains <tt>SDTC*</tt> classes (selection
-    DAG type constraint), definitions of <tt>SelectionDAG</tt> nodes (such as
-    <tt>imm</tt>, <tt>cond</tt>, <tt>bb</tt>, <tt>add</tt>, <tt>fadd</tt>,
-    <tt>sub</tt>), and pattern support (<tt>Pattern</tt>, <tt>Pat</tt>,
-    <tt>PatFrag</tt>, <tt>PatLeaf</tt>, <tt>ComplexPattern</tt>.</li>
-
-<li><tt>XXXInstrFormats.td</tt> &mdash; Patterns for definitions of
-    target-specific instructions.</li>
-
-<li><tt>XXXInstrInfo.td</tt> &mdash; Target-specific definitions of instruction
-    templates, condition codes, and instructions of an instruction set. For
-    architecture modifications, a different file name may be used. For example,
-    for Pentium with SSE instruction, this file is <tt>X86InstrSSE.td</tt>, and
-    for Pentium with MMX, this file is <tt>X86InstrMMX.td</tt>.</li>
-</ul>
-
-<p>
-There is also a target-specific <tt>XXX.td</tt> file, where <tt>XXX</tt> is the
-name of the target. The <tt>XXX.td</tt> file includes the other <tt>.td</tt>
-input files, but its contents are only directly important for subtargets.
-</p>
-
-<p>
-You should describe a concrete target-specific class <tt>XXXInstrInfo</tt> that
-represents machine instructions supported by a target machine.
-<tt>XXXInstrInfo</tt> contains an array of <tt>XXXInstrDescriptor</tt> objects,
-each of which describes one instruction. An instruction descriptor defines:</p>
-
-<ul>
-<li>Opcode mnemonic</li>
-
-<li>Number of operands</li>
-
-<li>List of implicit register definitions and uses</li>
-
-<li>Target-independent properties (such as memory access, is commutable)</li>
-
-<li>Target-specific flags </li>
-</ul>
-
-<p>
-The Instruction class (defined in <tt>Target.td</tt>) is mostly used as a base
-for more complex instruction classes.
-</p>
-
-<div class="doc_code">
-<pre>class Instruction {
-  string Namespace = "";
-  dag OutOperandList;       // An dag containing the MI def operand list.
-  dag InOperandList;        // An dag containing the MI use operand list.
-  string AsmString = "";    // The .s format to print the instruction with.
-  list&lt;dag&gt; Pattern;  // Set to the DAG pattern for this instruction
-  list&lt;Register&gt; Uses = []; 
-  list&lt;Register&gt; Defs = [];
-  list&lt;Predicate&gt; Predicates = [];  // predicates turned into isel match code
-  ... remainder not shown for space ...
-}
-</pre>
-</div>
-
-<p>
-A <tt>SelectionDAG</tt> node (<tt>SDNode</tt>) should contain an object
-representing a target-specific instruction that is defined
-in <tt>XXXInstrInfo.td</tt>. The instruction objects should represent
-instructions from the architecture manual of the target machine (such as the
-SPARC Architecture Manual for the SPARC target).
-</p>
-
-<p>
-A single instruction from the architecture manual is often modeled as multiple
-target instructions, depending upon its operands. For example, a manual might
-describe an add instruction that takes a register or an immediate operand. An
-LLVM target could model this with two instructions named <tt>ADDri</tt> and
-<tt>ADDrr</tt>.
-</p>
-
-<p>
-You should define a class for each instruction category and define each opcode
-as a subclass of the category with appropriate parameters such as the fixed
-binary encoding of opcodes and extended opcodes. You should map the register
-bits to the bits of the instruction in which they are encoded (for the
-JIT). Also you should specify how the instruction should be printed when the
-automatic assembly printer is used.
-</p>
-
-<p>
-As is described in the SPARC Architecture Manual, Version 8, there are three
-major 32-bit formats for instructions. Format 1 is only for the <tt>CALL</tt>
-instruction. Format 2 is for branch on condition codes and <tt>SETHI</tt> (set
-high bits of a register) instructions.  Format 3 is for other instructions.
-</p>
-
-<p>
-Each of these formats has corresponding classes in <tt>SparcInstrFormat.td</tt>.
-<tt>InstSP</tt> is a base class for other instruction classes. Additional base
-classes are specified for more precise formats: for example
-in <tt>SparcInstrFormat.td</tt>, <tt>F2_1</tt> is for <tt>SETHI</tt>,
-and <tt>F2_2</tt> is for branches. There are three other base
-classes: <tt>F3_1</tt> for register/register operations, <tt>F3_2</tt> for
-register/immediate operations, and <tt>F3_3</tt> for floating-point
-operations. <tt>SparcInstrInfo.td</tt> also adds the base class Pseudo for
-synthetic SPARC instructions.
-</p>
-
-<p>
-<tt>SparcInstrInfo.td</tt> largely consists of operand and instruction
-definitions for the SPARC target. In <tt>SparcInstrInfo.td</tt>, the following
-target description file entry, <tt>LDrr</tt>, defines the Load Integer
-instruction for a Word (the <tt>LD</tt> SPARC opcode) from a memory address to a
-register. The first parameter, the value 3 (<tt>11<sub>2</sub></tt>), is the
-operation value for this category of operation. The second parameter
-(<tt>000000<sub>2</sub></tt>) is the specific operation value
-for <tt>LD</tt>/Load Word. The third parameter is the output destination, which
-is a register operand and defined in the <tt>Register</tt> target description
-file (<tt>IntRegs</tt>).
-</p>
-
-<div class="doc_code">
-<pre>def LDrr : F3_1 &lt;3, 0b000000, (outs IntRegs:$dst), (ins MEMrr:$addr),
-                 "ld [$addr], $dst",
-                 [(set IntRegs:$dst, (load ADDRrr:$addr))]&gt;;
-</pre>
-</div>
-
-<p>
-The fourth parameter is the input source, which uses the address
-operand <tt>MEMrr</tt> that is defined earlier in <tt>SparcInstrInfo.td</tt>:
-</p>
-
-<div class="doc_code">
-<pre>def MEMrr : Operand&lt;i32&gt; {
-  let PrintMethod = "printMemOperand";
-  let MIOperandInfo = (ops IntRegs, IntRegs);
-}
-</pre>
-</div>
-
-<p>
-The fifth parameter is a string that is used by the assembly printer and can be
-left as an empty string until the assembly printer interface is implemented. The
-sixth and final parameter is the pattern used to match the instruction during
-the SelectionDAG Select Phase described in
-(<a href="http://www.llvm.org/docs/CodeGenerator.html">The LLVM
-Target-Independent Code Generator</a>).  This parameter is detailed in the next
-section, <a href="#InstructionSelector">Instruction Selector</a>.
-</p>
-
-<p>
-Instruction class definitions are not overloaded for different operand types, so
-separate versions of instructions are needed for register, memory, or immediate
-value operands. For example, to perform a Load Integer instruction for a Word
-from an immediate operand to a register, the following instruction class is
-defined:
-</p>
-
-<div class="doc_code">
-<pre>def LDri : F3_2 &lt;3, 0b000000, (outs IntRegs:$dst), (ins MEMri:$addr),
-                 "ld [$addr], $dst",
-                 [(set IntRegs:$dst, (load ADDRri:$addr))]&gt;;
-</pre>
-</div>
-
-<p>
-Writing these definitions for so many similar instructions can involve a lot of
-cut and paste. In td files, the <tt>multiclass</tt> directive enables the
-creation of templates to define several instruction classes at once (using
-the <tt>defm</tt> directive). For example in <tt>SparcInstrInfo.td</tt>, the
-<tt>multiclass</tt> pattern <tt>F3_12</tt> is defined to create 2 instruction
-classes each time <tt>F3_12</tt> is invoked:
-</p>
-
-<div class="doc_code">
-<pre>multiclass F3_12 &lt;string OpcStr, bits&lt;6&gt; Op3Val, SDNode OpNode&gt; {
-  def rr  : F3_1 &lt;2, Op3Val, 
-                 (outs IntRegs:$dst), (ins IntRegs:$b, IntRegs:$c),
-                 !strconcat(OpcStr, " $b, $c, $dst"),
-                 [(set IntRegs:$dst, (OpNode IntRegs:$b, IntRegs:$c))]&gt;;
-  def ri  : F3_2 &lt;2, Op3Val,
-                 (outs IntRegs:$dst), (ins IntRegs:$b, i32imm:$c),
-                 !strconcat(OpcStr, " $b, $c, $dst"),
-                 [(set IntRegs:$dst, (OpNode IntRegs:$b, simm13:$c))]&gt;;
-}
-</pre>
-</div>
-
-<p>
-So when the <tt>defm</tt> directive is used for the <tt>XOR</tt>
-and <tt>ADD</tt> instructions, as seen below, it creates four instruction
-objects: <tt>XORrr</tt>, <tt>XORri</tt>, <tt>ADDrr</tt>, and <tt>ADDri</tt>.
-</p>
-
-<div class="doc_code">
-<pre>
-defm XOR   : F3_12&lt;"xor", 0b000011, xor&gt;;
-defm ADD   : F3_12&lt;"add", 0b000000, add&gt;;
-</pre>
-</div>
-
-<p>
-<tt>SparcInstrInfo.td</tt> also includes definitions for condition codes that
-are referenced by branch instructions. The following definitions
-in <tt>SparcInstrInfo.td</tt> indicate the bit location of the SPARC condition
-code. For example, the 10<sup>th</sup> bit represents the 'greater than'
-condition for integers, and the 22<sup>nd</sup> bit represents the 'greater
-than' condition for floats.
-</p>
-
-<div class="doc_code">
-<pre>
-def ICC_NE  : ICC_VAL&lt; 9&gt;;  // Not Equal
-def ICC_E   : ICC_VAL&lt; 1&gt;;  // Equal
-def ICC_G   : ICC_VAL&lt;10&gt;;  // Greater
-...
-def FCC_U   : FCC_VAL&lt;23&gt;;  // Unordered
-def FCC_G   : FCC_VAL&lt;22&gt;;  // Greater
-def FCC_UG  : FCC_VAL&lt;21&gt;;  // Unordered or Greater
-...
-</pre>
-</div>
-
-<p>
-(Note that <tt>Sparc.h</tt> also defines enums that correspond to the same SPARC
-condition codes. Care must be taken to ensure the values in <tt>Sparc.h</tt>
-correspond to the values in <tt>SparcInstrInfo.td</tt>. I.e.,
-<tt>SPCC::ICC_NE = 9</tt>, <tt>SPCC::FCC_U = 23</tt> and so on.)
-</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="operandMapping">Instruction Operand Mapping</a>
-</div>
-
-<div class="doc_text">
-
-<p>
-The code generator backend maps instruction operands to fields in the
-instruction.  Operands are assigned to unbound fields in the instruction in the
-order they are defined. Fields are bound when they are assigned a value.  For
-example, the Sparc target defines the <tt>XNORrr</tt> instruction as
-a <tt>F3_1</tt> format instruction having three operands.
-</p>
-
-<div class="doc_code">
-<pre>
-def XNORrr  : F3_1&lt;2, 0b000111,
-                   (outs IntRegs:$dst), (ins IntRegs:$b, IntRegs:$c),
-                   "xnor $b, $c, $dst",
-                   [(set IntRegs:$dst, (not (xor IntRegs:$b, IntRegs:$c)))]&gt;;
-</pre>
-</div>
-
-<p>
-The instruction templates in <tt>SparcInstrFormats.td</tt> show the base class
-for <tt>F3_1</tt> is <tt>InstSP</tt>.
-</p>
-
-<div class="doc_code">
-<pre>
-class InstSP&lt;dag outs, dag ins, string asmstr, list&lt;dag&gt; pattern&gt; : Instruction {
-  field bits&lt;32&gt; Inst;
-  let Namespace = "SP";
-  bits&lt;2&gt; op;
-  let Inst{31-30} = op;       
-  dag OutOperandList = outs;
-  dag InOperandList = ins;
-  let AsmString   = asmstr;
-  let Pattern = pattern;
-}
-</pre>
-</div>
-
-<p><tt>InstSP</tt> leaves the <tt>op</tt> field unbound.</p>
-
-<div class="doc_code">
-<pre>
-class F3&lt;dag outs, dag ins, string asmstr, list&lt;dag&gt; pattern&gt;
-    : InstSP&lt;outs, ins, asmstr, pattern&gt; {
-  bits&lt;5&gt; rd;
-  bits&lt;6&gt; op3;
-  bits&lt;5&gt; rs1;
-  let op{1} = 1;   // Op = 2 or 3
-  let Inst{29-25} = rd;
-  let Inst{24-19} = op3;
-  let Inst{18-14} = rs1;
-}
-</pre>
-</div>
-
-<p>
-<tt>F3</tt> binds the <tt>op</tt> field and defines the <tt>rd</tt>,
-<tt>op3</tt>, and <tt>rs1</tt> fields.  <tt>F3</tt> format instructions will
-bind the operands <tt>rd</tt>, <tt>op3</tt>, and <tt>rs1</tt> fields.
-</p>
-
-<div class="doc_code">
-<pre>
-class F3_1&lt;bits&lt;2&gt; opVal, bits&lt;6&gt; op3val, dag outs, dag ins,
-           string asmstr, list&lt;dag&gt; pattern&gt; : F3&lt;outs, ins, asmstr, pattern&gt; {
-  bits&lt;8&gt; asi = 0; // asi not currently used
-  bits&lt;5&gt; rs2;
-  let op         = opVal;
-  let op3        = op3val;
-  let Inst{13}   = 0;     // i field = 0
-  let Inst{12-5} = asi;   // address space identifier
-  let Inst{4-0}  = rs2;
-}
-</pre>
-</div>
-
-<p>
-<tt>F3_1</tt> binds the <tt>op3</tt> field and defines the <tt>rs2</tt>
-fields.  <tt>F3_1</tt> format instructions will bind the operands to the <tt>rd</tt>,
-<tt>rs1</tt>, and <tt>rs2</tt> fields. This results in the <tt>XNORrr</tt>
-instruction binding <tt>$dst</tt>, <tt>$b</tt>, and <tt>$c</tt> operands to
-the <tt>rd</tt>, <tt>rs1</tt>, and <tt>rs2</tt> fields respectively.
-</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="implementInstr">Implement a subclass of </a>
-  <a href="http://www.llvm.org/docs/CodeGenerator.html#targetinstrinfo">TargetInstrInfo</a>
-</div>
-
-<div class="doc_text">
-
-<p>
-The final step is to hand code portions of <tt>XXXInstrInfo</tt>, which
-implements the interface described in <tt>TargetInstrInfo.h</tt>. These
-functions return <tt>0</tt> or a Boolean or they assert, unless
-overridden. Here's a list of functions that are overridden for the SPARC
-implementation in <tt>SparcInstrInfo.cpp</tt>:
-</p>
-
-<ul>
-<li><tt>isMoveInstr</tt> &mdash; Return true if the instruction is a register to
-    register move; false, otherwise.</li>
-
-<li><tt>isLoadFromStackSlot</tt> &mdash; If the specified machine instruction is
-    a direct load from a stack slot, return the register number of the
-    destination and the <tt>FrameIndex</tt> of the stack slot.</li>
-
-<li><tt>isStoreToStackSlot</tt> &mdash; If the specified machine instruction is
-    a direct store to a stack slot, return the register number of the
-    destination and the <tt>FrameIndex</tt> of the stack slot.</li>
-
-<li><tt>copyRegToReg</tt> &mdash; Copy values between a pair of registers.</li>
-
-<li><tt>storeRegToStackSlot</tt> &mdash; Store a register value to a stack
-    slot.</li>
-
-<li><tt>loadRegFromStackSlot</tt> &mdash; Load a register value from a stack
-    slot.</li>
-
-<li><tt>storeRegToAddr</tt> &mdash; Store a register value to memory.</li>
-
-<li><tt>loadRegFromAddr</tt> &mdash; Load a register value from memory.</li>
-
-<li><tt>foldMemoryOperand</tt> &mdash; Attempt to combine instructions of any
-    load or store instruction for the specified operand(s).</li>
-</ul>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="branchFolding">Branch Folding and If Conversion</a>
-</div>
-<div class="doc_text">
-
-<p>
-Performance can be improved by combining instructions or by eliminating
-instructions that are never reached. The <tt>AnalyzeBranch</tt> method
-in <tt>XXXInstrInfo</tt> may be implemented to examine conditional instructions
-and remove unnecessary instructions. <tt>AnalyzeBranch</tt> looks at the end of
-a machine basic block (MBB) for opportunities for improvement, such as branch
-folding and if conversion. The <tt>BranchFolder</tt> and <tt>IfConverter</tt>
-machine function passes (see the source files <tt>BranchFolding.cpp</tt> and
-<tt>IfConversion.cpp</tt> in the <tt>lib/CodeGen</tt> directory) call
-<tt>AnalyzeBranch</tt> to improve the control flow graph that represents the
-instructions.
-</p>
-
-<p>
-Several implementations of <tt>AnalyzeBranch</tt> (for ARM, Alpha, and X86) can
-be examined as models for your own <tt>AnalyzeBranch</tt> implementation. Since
-SPARC does not implement a useful <tt>AnalyzeBranch</tt>, the ARM target
-implementation is shown below.
-</p>
-
-<p><tt>AnalyzeBranch</tt> returns a Boolean value and takes four parameters:</p>
-
-<ul>
-<li><tt>MachineBasicBlock &amp;MBB</tt> &mdash; The incoming block to be
-    examined.</li>
-
-<li><tt>MachineBasicBlock *&amp;TBB</tt> &mdash; A destination block that is
-    returned. For a conditional branch that evaluates to true, <tt>TBB</tt> is
-    the destination.</li>
-
-<li><tt>MachineBasicBlock *&amp;FBB</tt> &mdash; For a conditional branch that
-    evaluates to false, <tt>FBB</tt> is returned as the destination.</li>
-
-<li><tt>std::vector&lt;MachineOperand&gt; &amp;Cond</tt> &mdash; List of
-    operands to evaluate a condition for a conditional branch.</li>
-</ul>
-
-<p>
-In the simplest case, if a block ends without a branch, then it falls through to
-the successor block. No destination blocks are specified for either <tt>TBB</tt>
-or <tt>FBB</tt>, so both parameters return <tt>NULL</tt>. The start of
-the <tt>AnalyzeBranch</tt> (see code below for the ARM target) shows the
-function parameters and the code for the simplest case.
-</p>
-
-<div class="doc_code">
-<pre>bool ARMInstrInfo::AnalyzeBranch(MachineBasicBlock &amp;MBB,
-        MachineBasicBlock *&amp;TBB, MachineBasicBlock *&amp;FBB,
-        std::vector&lt;MachineOperand&gt; &amp;Cond) const
-{
-  MachineBasicBlock::iterator I = MBB.end();
-  if (I == MBB.begin() || !isUnpredicatedTerminator(--I))
-    return false;
-</pre>
-</div>
-
-<p>
-If a block ends with a single unconditional branch instruction, then
-<tt>AnalyzeBranch</tt> (shown below) should return the destination of that
-branch in the <tt>TBB</tt> parameter.
-</p>
-
-<div class="doc_code">
-<pre>
-  if (LastOpc == ARM::B || LastOpc == ARM::tB) {
-    TBB = LastInst-&gt;getOperand(0).getMBB();
-    return false;
-  }
-</pre>
-</div>
-
-<p>
-If a block ends with two unconditional branches, then the second branch is never
-reached. In that situation, as shown below, remove the last branch instruction
-and return the penultimate branch in the <tt>TBB</tt> parameter.
-</p>
-
-<div class="doc_code">
-<pre>
-  if ((SecondLastOpc == ARM::B || SecondLastOpc==ARM::tB) &amp;&amp;
-      (LastOpc == ARM::B || LastOpc == ARM::tB)) {
-    TBB = SecondLastInst-&gt;getOperand(0).getMBB();
-    I = LastInst;
-    I-&gt;eraseFromParent();
-    return false;
-  }
-</pre>
-</div>
-
-<p>
-A block may end with a single conditional branch instruction that falls through
-to successor block if the condition evaluates to false. In that case,
-<tt>AnalyzeBranch</tt> (shown below) should return the destination of that
-conditional branch in the <tt>TBB</tt> parameter and a list of operands in
-the <tt>Cond</tt> parameter to evaluate the condition.
-</p>
-
-<div class="doc_code">
-<pre>
-  if (LastOpc == ARM::Bcc || LastOpc == ARM::tBcc) {
-    // Block ends with fall-through condbranch.
-    TBB = LastInst-&gt;getOperand(0).getMBB();
-    Cond.push_back(LastInst-&gt;getOperand(1));
-    Cond.push_back(LastInst-&gt;getOperand(2));
-    return false;
-  }
-</pre>
-</div>
-
-<p>
-If a block ends with both a conditional branch and an ensuing unconditional
-branch, then <tt>AnalyzeBranch</tt> (shown below) should return the conditional
-branch destination (assuming it corresponds to a conditional evaluation of
-'<tt>true</tt>') in the <tt>TBB</tt> parameter and the unconditional branch
-destination in the <tt>FBB</tt> (corresponding to a conditional evaluation of
-'<tt>false</tt>').  A list of operands to evaluate the condition should be
-returned in the <tt>Cond</tt> parameter.
-</p>
-
-<div class="doc_code">
-<pre>
-  unsigned SecondLastOpc = SecondLastInst-&gt;getOpcode();
-
-  if ((SecondLastOpc == ARM::Bcc &amp;&amp; LastOpc == ARM::B) ||
-      (SecondLastOpc == ARM::tBcc &amp;&amp; LastOpc == ARM::tB)) {
-    TBB =  SecondLastInst-&gt;getOperand(0).getMBB();
-    Cond.push_back(SecondLastInst-&gt;getOperand(1));
-    Cond.push_back(SecondLastInst-&gt;getOperand(2));
-    FBB = LastInst-&gt;getOperand(0).getMBB();
-    return false;
-  }
-</pre>
-</div>
-
-<p>
-For the last two cases (ending with a single conditional branch or ending with
-one conditional and one unconditional branch), the operands returned in
-the <tt>Cond</tt> parameter can be passed to methods of other instructions to
-create new branches or perform other operations. An implementation
-of <tt>AnalyzeBranch</tt> requires the helper methods <tt>RemoveBranch</tt>
-and <tt>InsertBranch</tt> to manage subsequent operations.
-</p>
-
-<p>
-<tt>AnalyzeBranch</tt> should return false indicating success in most circumstances.
-<tt>AnalyzeBranch</tt> should only return true when the method is stumped about what to
-do, for example, if a block has three terminating branches. <tt>AnalyzeBranch</tt> may
-return true if it encounters a terminator it cannot handle, such as an indirect
-branch.
-</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="InstructionSelector">Instruction Selector</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>
-LLVM uses a <tt>SelectionDAG</tt> to represent LLVM IR instructions, and nodes
-of the <tt>SelectionDAG</tt> ideally represent native target
-instructions. During code generation, instruction selection passes are performed
-to convert non-native DAG instructions into native target-specific
-instructions. The pass described in <tt>XXXISelDAGToDAG.cpp</tt> is used to
-match patterns and perform DAG-to-DAG instruction selection. Optionally, a pass
-may be defined (in <tt>XXXBranchSelector.cpp</tt>) to perform similar DAG-to-DAG
-operations for branch instructions. Later, the code in
-<tt>XXXISelLowering.cpp</tt> replaces or removes operations and data types not
-supported natively (legalizes) in a <tt>SelectionDAG</tt>.
-</p>
-
-<p>
-TableGen generates code for instruction selection using the following target
-description input files:
-</p>
-
-<ul>
-<li><tt>XXXInstrInfo.td</tt> &mdash; Contains definitions of instructions in a
-    target-specific instruction set, generates <tt>XXXGenDAGISel.inc</tt>, which
-    is included in <tt>XXXISelDAGToDAG.cpp</tt>.</li>
-
-<li><tt>XXXCallingConv.td</tt> &mdash; Contains the calling and return value
-    conventions for the target architecture, and it generates
-    <tt>XXXGenCallingConv.inc</tt>, which is included in
-    <tt>XXXISelLowering.cpp</tt>.</li>
-</ul>
-
-<p>
-The implementation of an instruction selection pass must include a header that
-declares the <tt>FunctionPass</tt> class or a subclass of <tt>FunctionPass</tt>. In
-<tt>XXXTargetMachine.cpp</tt>, a Pass Manager (PM) should add each instruction
-selection pass into the queue of passes to run.
-</p>
-
-<p>
-The LLVM static compiler (<tt>llc</tt>) is an excellent tool for visualizing the
-contents of DAGs. To display the <tt>SelectionDAG</tt> before or after specific
-processing phases, use the command line options for <tt>llc</tt>, described
-at <a href="http://llvm.org/docs/CodeGenerator.html#selectiondag_process">
-SelectionDAG Instruction Selection Process</a>.
-</p>
-
-<p>
-To describe instruction selector behavior, you should add patterns for lowering
-LLVM code into a <tt>SelectionDAG</tt> as the last parameter of the instruction
-definitions in <tt>XXXInstrInfo.td</tt>. For example, in
-<tt>SparcInstrInfo.td</tt>, this entry defines a register store operation, and
-the last parameter describes a pattern with the store DAG operator.
-</p>
-
-<div class="doc_code">
-<pre>
-def STrr  : F3_1&lt; 3, 0b000100, (outs), (ins MEMrr:$addr, IntRegs:$src),
-                 "st $src, [$addr]", [(store IntRegs:$src, ADDRrr:$addr)]&gt;;
-</pre>
-</div>
-
-<p>
-<tt>ADDRrr</tt> is a memory mode that is also defined in
-<tt>SparcInstrInfo.td</tt>:
-</p>
-
-<div class="doc_code">
-<pre>
-def ADDRrr : ComplexPattern&lt;i32, 2, "SelectADDRrr", [], []&gt;;
-</pre>
-</div>
-
-<p>
-The definition of <tt>ADDRrr</tt> refers to <tt>SelectADDRrr</tt>, which is a
-function defined in an implementation of the Instructor Selector (such
-as <tt>SparcISelDAGToDAG.cpp</tt>).
-</p>
-
-<p>
-In <tt>lib/Target/TargetSelectionDAG.td</tt>, the DAG operator for store is
-defined below:
-</p>
-
-<div class="doc_code">
-<pre>
-def store : PatFrag&lt;(ops node:$val, node:$ptr),
-                    (st node:$val, node:$ptr), [{
-  if (StoreSDNode *ST = dyn_cast&lt;StoreSDNode&gt;(N))
-    return !ST-&gt;isTruncatingStore() &amp;&amp; 
-           ST-&gt;getAddressingMode() == ISD::UNINDEXED;
-  return false;
-}]&gt;;
-</pre>
-</div>
-
-<p>
-<tt>XXXInstrInfo.td</tt> also generates (in <tt>XXXGenDAGISel.inc</tt>) the
-<tt>SelectCode</tt> method that is used to call the appropriate processing
-method for an instruction. In this example, <tt>SelectCode</tt>
-calls <tt>Select_ISD_STORE</tt> for the <tt>ISD::STORE</tt> opcode.
-</p>
-
-<div class="doc_code">
-<pre>
-SDNode *SelectCode(SDValue N) {
-  ... 
-  MVT::ValueType NVT = N.getNode()-&gt;getValueType(0);
-  switch (N.getOpcode()) {
-  case ISD::STORE: {
-    switch (NVT) {
-    default:
-      return Select_ISD_STORE(N);
-      break;
-    }
-    break;
-  }
-  ...
-</pre>
-</div>
-
-<p>
-The pattern for <tt>STrr</tt> is matched, so elsewhere in
-<tt>XXXGenDAGISel.inc</tt>, code for <tt>STrr</tt> is created for
-<tt>Select_ISD_STORE</tt>. The <tt>Emit_22</tt> method is also generated
-in <tt>XXXGenDAGISel.inc</tt> to complete the processing of this
-instruction.
-</p>
-
-<div class="doc_code">
-<pre>
-SDNode *Select_ISD_STORE(const SDValue &amp;N) {
-  SDValue Chain = N.getOperand(0);
-  if (Predicate_store(N.getNode())) {
-    SDValue N1 = N.getOperand(1);
-    SDValue N2 = N.getOperand(2);
-    SDValue CPTmp0;
-    SDValue CPTmp1;
-
-    // Pattern: (st:void IntRegs:i32:$src, 
-    //           ADDRrr:i32:$addr)&lt;&lt;P:Predicate_store&gt;&gt;
-    // Emits: (STrr:void ADDRrr:i32:$addr, IntRegs:i32:$src)
-    // Pattern complexity = 13  cost = 1  size = 0
-    if (SelectADDRrr(N, N2, CPTmp0, CPTmp1) &amp;&amp;
-        N1.getNode()-&gt;getValueType(0) == MVT::i32 &amp;&amp;
-        N2.getNode()-&gt;getValueType(0) == MVT::i32) {
-      return Emit_22(N, SP::STrr, CPTmp0, CPTmp1);
-    }
-...
-</pre>
-</div>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="LegalizePhase">The SelectionDAG Legalize Phase</a>
-</div>
-
-<div class="doc_text">
-
-<p>
-The Legalize phase converts a DAG to use types and operations that are natively
-supported by the target. For natively unsupported types and operations, you need
-to add code to the target-specific XXXTargetLowering implementation to convert
-unsupported types and operations to supported ones.
-</p>
-
-<p>
-In the constructor for the <tt>XXXTargetLowering</tt> class, first use the
-<tt>addRegisterClass</tt> method to specify which types are supports and which
-register classes are associated with them. The code for the register classes are
-generated by TableGen from <tt>XXXRegisterInfo.td</tt> and placed
-in <tt>XXXGenRegisterInfo.h.inc</tt>. For example, the implementation of the
-constructor for the SparcTargetLowering class (in
-<tt>SparcISelLowering.cpp</tt>) starts with the following code:
-</p>
-
-<div class="doc_code">
-<pre>
-addRegisterClass(MVT::i32, SP::IntRegsRegisterClass);
-addRegisterClass(MVT::f32, SP::FPRegsRegisterClass);
-addRegisterClass(MVT::f64, SP::DFPRegsRegisterClass); 
-</pre>
-</div>
-
-<p>
-You should examine the node types in the <tt>ISD</tt> namespace
-(<tt>include/llvm/CodeGen/SelectionDAGNodes.h</tt>) and determine which
-operations the target natively supports. For operations that do <b>not</b> have
-native support, add a callback to the constructor for the XXXTargetLowering
-class, so the instruction selection process knows what to do. The TargetLowering
-class callback methods (declared in <tt>llvm/Target/TargetLowering.h</tt>) are:
-</p>
-
-<ul>
-<li><tt>setOperationAction</tt> &mdash; General operation.</li>
-
-<li><tt>setLoadExtAction</tt> &mdash; Load with extension.</li>
-
-<li><tt>setTruncStoreAction</tt> &mdash; Truncating store.</li>
-
-<li><tt>setIndexedLoadAction</tt> &mdash; Indexed load.</li>
-
-<li><tt>setIndexedStoreAction</tt> &mdash; Indexed store.</li>
-
-<li><tt>setConvertAction</tt> &mdash; Type conversion.</li>
-
-<li><tt>setCondCodeAction</tt> &mdash; Support for a given condition code.</li>
-</ul>
-
-<p>
-Note: on older releases, <tt>setLoadXAction</tt> is used instead
-of <tt>setLoadExtAction</tt>.  Also, on older releases,
-<tt>setCondCodeAction</tt> may not be supported. Examine your release
-to see what methods are specifically supported.
-</p>
-
-<p>
-These callbacks are used to determine that an operation does or does not work
-with a specified type (or types). And in all cases, the third parameter is
-a <tt>LegalAction</tt> type enum value: <tt>Promote</tt>, <tt>Expand</tt>,
-<tt>Custom</tt>, or <tt>Legal</tt>. <tt>SparcISelLowering.cpp</tt>
-contains examples of all four <tt>LegalAction</tt> values.
-</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="promote">Promote</a>
-</div>
-
-<div class="doc_text">
-
-<p>
-For an operation without native support for a given type, the specified type may
-be promoted to a larger type that is supported. For example, SPARC does not
-support a sign-extending load for Boolean values (<tt>i1</tt> type), so
-in <tt>SparcISelLowering.cpp</tt> the third parameter below, <tt>Promote</tt>,
-changes <tt>i1</tt> type values to a large type before loading.
-</p>
-
-<div class="doc_code">
-<pre>
-setLoadExtAction(ISD::SEXTLOAD, MVT::i1, Promote);
-</pre>
-</div>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="expand">Expand</a>
-</div>
-
-<div class="doc_text">
-
-<p>
-For a type without native support, a value may need to be broken down further,
-rather than promoted. For an operation without native support, a combination of
-other operations may be used to similar effect. In SPARC, the floating-point
-sine and cosine trig operations are supported by expansion to other operations,
-as indicated by the third parameter, <tt>Expand</tt>, to
-<tt>setOperationAction</tt>:
-</p>
-
-<div class="doc_code">
-<pre>
-setOperationAction(ISD::FSIN, MVT::f32, Expand);
-setOperationAction(ISD::FCOS, MVT::f32, Expand);
-</pre>
-</div>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="custom">Custom</a>
-</div>
-
-<div class="doc_text">
-
-<p>
-For some operations, simple type promotion or operation expansion may be
-insufficient. In some cases, a special intrinsic function must be implemented.
-</p>
-
-<p>
-For example, a constant value may require special treatment, or an operation may
-require spilling and restoring registers in the stack and working with register
-allocators.
-</p>
-
-<p>
-As seen in <tt>SparcISelLowering.cpp</tt> code below, to perform a type
-conversion from a floating point value to a signed integer, first the
-<tt>setOperationAction</tt> should be called with <tt>Custom</tt> as the third
-parameter:
-</p>
-
-<div class="doc_code">
-<pre>
-setOperationAction(ISD::FP_TO_SINT, MVT::i32, Custom);
-</pre>
-</div>    
-
-<p>
-In the <tt>LowerOperation</tt> method, for each <tt>Custom</tt> operation, a
-case statement should be added to indicate what function to call. In the
-following code, an <tt>FP_TO_SINT</tt> opcode will call
-the <tt>LowerFP_TO_SINT</tt> method:
-</p>
-
-<div class="doc_code">
-<pre>
-SDValue SparcTargetLowering::LowerOperation(SDValue Op, SelectionDAG &amp;DAG) {
-  switch (Op.getOpcode()) {
-  case ISD::FP_TO_SINT: return LowerFP_TO_SINT(Op, DAG);
-  ...
-  }
-}
-</pre>
-</div>
-
-<p>
-Finally, the <tt>LowerFP_TO_SINT</tt> method is implemented, using an FP
-register to convert the floating-point value to an integer.
-</p>
-
-<div class="doc_code">
-<pre>
-static SDValue LowerFP_TO_SINT(SDValue Op, SelectionDAG &amp;DAG) {
-  assert(Op.getValueType() == MVT::i32);
-  Op = DAG.getNode(SPISD::FTOI, MVT::f32, Op.getOperand(0));
-  return DAG.getNode(ISD::BIT_CONVERT, MVT::i32, Op);
-}
-</pre>
-</div>    
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="legal">Legal</a>
-</div>
-
-<div class="doc_text">
-
-<p>
-The <tt>Legal</tt> LegalizeAction enum value simply indicates that an
-operation <b>is</b> natively supported. <tt>Legal</tt> represents the default
-condition, so it is rarely used. In <tt>SparcISelLowering.cpp</tt>, the action
-for <tt>CTPOP</tt> (an operation to count the bits set in an integer) is
-natively supported only for SPARC v9. The following code enables
-the <tt>Expand</tt> conversion technique for non-v9 SPARC implementations.
-</p>
-
-<div class="doc_code">
-<pre>
-setOperationAction(ISD::CTPOP, MVT::i32, Expand);
-...
-if (TM.getSubtarget&lt;SparcSubtarget&gt;().isV9())
-  setOperationAction(ISD::CTPOP, MVT::i32, Legal);
-  case ISD::SETULT: return SPCC::ICC_CS;
-  case ISD::SETULE: return SPCC::ICC_LEU;
-  case ISD::SETUGT: return SPCC::ICC_GU;
-  case ISD::SETUGE: return SPCC::ICC_CC;
-  }
-}
-</pre>
-</div>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="callingConventions">Calling Conventions</a>
-</div>
-
-<div class="doc_text">
-
-<p>
-To support target-specific calling conventions, <tt>XXXGenCallingConv.td</tt>
-uses interfaces (such as CCIfType and CCAssignToReg) that are defined in
-<tt>lib/Target/TargetCallingConv.td</tt>. TableGen can take the target
-descriptor file <tt>XXXGenCallingConv.td</tt> and generate the header
-file <tt>XXXGenCallingConv.inc</tt>, which is typically included
-in <tt>XXXISelLowering.cpp</tt>. You can use the interfaces in
-<tt>TargetCallingConv.td</tt> to specify:
-</p>
-
-<ul>
-<li>The order of parameter allocation.</li>
-
-<li>Where parameters and return values are placed (that is, on the stack or in
-    registers).</li>
-
-<li>Which registers may be used.</li>
-
-<li>Whether the caller or callee unwinds the stack.</li>
-</ul>
-
-<p>
-The following example demonstrates the use of the <tt>CCIfType</tt> and
-<tt>CCAssignToReg</tt> interfaces. If the <tt>CCIfType</tt> predicate is true
-(that is, if the current argument is of type <tt>f32</tt> or <tt>f64</tt>), then
-the action is performed. In this case, the <tt>CCAssignToReg</tt> action assigns
-the argument value to the first available register: either <tt>R0</tt>
-or <tt>R1</tt>.
-</p>
-
-<div class="doc_code">
-<pre>
-CCIfType&lt;[f32,f64], CCAssignToReg&lt;[R0, R1]&gt;&gt;
-</pre>
-</div>
-
-<p>
-<tt>SparcCallingConv.td</tt> contains definitions for a target-specific
-return-value calling convention (RetCC_Sparc32) and a basic 32-bit C calling
-convention (<tt>CC_Sparc32</tt>). The definition of <tt>RetCC_Sparc32</tt>
-(shown below) indicates which registers are used for specified scalar return
-types. A single-precision float is returned to register <tt>F0</tt>, and a
-double-precision float goes to register <tt>D0</tt>. A 32-bit integer is
-returned in register <tt>I0</tt> or <tt>I1</tt>.
-</p>
-
-<div class="doc_code">
-<pre>
-def RetCC_Sparc32 : CallingConv&lt;[
-  CCIfType&lt;[i32], CCAssignToReg&lt;[I0, I1]&gt;&gt;,
-  CCIfType&lt;[f32], CCAssignToReg&lt;[F0]&gt;&gt;,
-  CCIfType&lt;[f64], CCAssignToReg&lt;[D0]&gt;&gt;
-]&gt;;
-</pre>
-</div>
-
-<p>
-The definition of <tt>CC_Sparc32</tt> in <tt>SparcCallingConv.td</tt> introduces
-<tt>CCAssignToStack</tt>, which assigns the value to a stack slot with the
-specified size and alignment. In the example below, the first parameter, 4,
-indicates the size of the slot, and the second parameter, also 4, indicates the
-stack alignment along 4-byte units. (Special cases: if size is zero, then the
-ABI size is used; if alignment is zero, then the ABI alignment is used.)
-</p>
-
-<div class="doc_code">
-<pre>
-def CC_Sparc32 : CallingConv&lt;[
-  // All arguments get passed in integer registers if there is space.
-  CCIfType&lt;[i32, f32, f64], CCAssignToReg&lt;[I0, I1, I2, I3, I4, I5]&gt;&gt;,
-  CCAssignToStack&lt;4, 4&gt;
-]&gt;;
-</pre>
-</div>
-
-<p>
-<tt>CCDelegateTo</tt> is another commonly used interface, which tries to find a
-specified sub-calling convention, and, if a match is found, it is invoked. In
-the following example (in <tt>X86CallingConv.td</tt>), the definition of
-<tt>RetCC_X86_32_C</tt> ends with <tt>CCDelegateTo</tt>. After the current value
-is assigned to the register <tt>ST0</tt> or <tt>ST1</tt>,
-the <tt>RetCC_X86Common</tt> is invoked.
-</p>
-
-<div class="doc_code">
-<pre>
-def RetCC_X86_32_C : CallingConv&lt;[
-  CCIfType&lt;[f32], CCAssignToReg&lt;[ST0, ST1]&gt;&gt;,
-  CCIfType&lt;[f64], CCAssignToReg&lt;[ST0, ST1]&gt;&gt;,
-  CCDelegateTo&lt;RetCC_X86Common&gt;
-]&gt;;
-</pre>
-</div>
-
-<p>
-<tt>CCIfCC</tt> is an interface that attempts to match the given name to the
-current calling convention. If the name identifies the current calling
-convention, then a specified action is invoked. In the following example (in
-<tt>X86CallingConv.td</tt>), if the <tt>Fast</tt> calling convention is in use,
-then <tt>RetCC_X86_32_Fast</tt> is invoked. If the <tt>SSECall</tt> calling
-convention is in use, then <tt>RetCC_X86_32_SSE</tt> is invoked.
-</p>
-
-<div class="doc_code">
-<pre>
-def RetCC_X86_32 : CallingConv&lt;[
-  CCIfCC&lt;"CallingConv::Fast", CCDelegateTo&lt;RetCC_X86_32_Fast&gt;&gt;,
-  CCIfCC&lt;"CallingConv::X86_SSECall", CCDelegateTo&lt;RetCC_X86_32_SSE&gt;&gt;,
-  CCDelegateTo&lt;RetCC_X86_32_C&gt;
-]&gt;;
-</pre>
-</div>
-
-<p>Other calling convention interfaces include:</p>
-
-<ul>
-<li><tt>CCIf &lt;predicate, action&gt;</tt> &mdash; If the predicate matches,
-    apply the action.</li>
-
-<li><tt>CCIfInReg &lt;action&gt;</tt> &mdash; If the argument is marked with the
-    '<tt>inreg</tt>' attribute, then apply the action.</li>
-
-<li><tt>CCIfNest &lt;action&gt;</tt> &mdash; Inf the argument is marked with the
-    '<tt>nest</tt>' attribute, then apply the action.</li>
-
-<li><tt>CCIfNotVarArg &lt;action&gt;</tt> &mdash; If the current function does
-    not take a variable number of arguments, apply the action.</li>
-
-<li><tt>CCAssignToRegWithShadow &lt;registerList, shadowList&gt;</tt> &mdash;
-    similar to <tt>CCAssignToReg</tt>, but with a shadow list of registers.</li>
-
-<li><tt>CCPassByVal &lt;size, align&gt;</tt> &mdash; Assign value to a stack
-    slot with the minimum specified size and alignment.</li>
-
-<li><tt>CCPromoteToType &lt;type&gt;</tt> &mdash; Promote the current value to
-    the specified type.</li>
-
-<li><tt>CallingConv &lt;[actions]&gt;</tt> &mdash; Define each calling
-    convention that is supported.</li>
-</ul>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="assemblyPrinter">Assembly Printer</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>
-During the code emission stage, the code generator may utilize an LLVM pass to
-produce assembly output. To do this, you want to implement the code for a
-printer that converts LLVM IR to a GAS-format assembly language for your target
-machine, using the following steps:
-</p>
-
-<ul>
-<li>Define all the assembly strings for your target, adding them to the
-    instructions defined in the <tt>XXXInstrInfo.td</tt> file.
-    (See <a href="#InstructionSet">Instruction Set</a>.)  TableGen will produce
-    an output file (<tt>XXXGenAsmWriter.inc</tt>) with an implementation of
-    the <tt>printInstruction</tt> method for the XXXAsmPrinter class.</li>
-
-<li>Write <tt>XXXTargetAsmInfo.h</tt>, which contains the bare-bones declaration
-    of the <tt>XXXTargetAsmInfo</tt> class (a subclass
-    of <tt>TargetAsmInfo</tt>).</li>
-
-<li>Write <tt>XXXTargetAsmInfo.cpp</tt>, which contains target-specific values
-    for <tt>TargetAsmInfo</tt> properties and sometimes new implementations for
-    methods.</li>
-
-<li>Write <tt>XXXAsmPrinter.cpp</tt>, which implements the <tt>AsmPrinter</tt>
-    class that performs the LLVM-to-assembly conversion.</li>
-</ul>
-
-<p>
-The code in <tt>XXXTargetAsmInfo.h</tt> is usually a trivial declaration of the
-<tt>XXXTargetAsmInfo</tt> class for use in <tt>XXXTargetAsmInfo.cpp</tt>.
-Similarly, <tt>XXXTargetAsmInfo.cpp</tt> usually has a few declarations of
-<tt>XXXTargetAsmInfo</tt> replacement values that override the default values
-in <tt>TargetAsmInfo.cpp</tt>. For example in <tt>SparcTargetAsmInfo.cpp</tt>:
-</p>
-
-<div class="doc_code">
-<pre>
-SparcTargetAsmInfo::SparcTargetAsmInfo(const SparcTargetMachine &amp;TM) {
-  Data16bitsDirective = "\t.half\t";
-  Data32bitsDirective = "\t.word\t";
-  Data64bitsDirective = 0;  // .xword is only supported by V9.
-  ZeroDirective = "\t.skip\t";
-  CommentString = "!";
-  ConstantPoolSection = "\t.section \".rodata\",#alloc\n";
-}
-</pre>
-</div>
-
-<p>
-The X86 assembly printer implementation (<tt>X86TargetAsmInfo</tt>) is an
-example where the target specific <tt>TargetAsmInfo</tt> class uses an 
-overridden methods: <tt>ExpandInlineAsm</tt>.
-</p>
-
-<p>
-A target-specific implementation of AsmPrinter is written in
-<tt>XXXAsmPrinter.cpp</tt>, which implements the <tt>AsmPrinter</tt> class that
-converts the LLVM to printable assembly. The implementation must include the
-following headers that have declarations for the <tt>AsmPrinter</tt> and
-<tt>MachineFunctionPass</tt> classes. The <tt>MachineFunctionPass</tt> is a
-subclass of <tt>FunctionPass</tt>.
-</p>
-
-<div class="doc_code">
-<pre>
-#include "llvm/CodeGen/AsmPrinter.h"
-#include "llvm/CodeGen/MachineFunctionPass.h" 
-</pre>
-</div>
-
-<p>
-As a <tt>FunctionPass</tt>, <tt>AsmPrinter</tt> first
-calls <tt>doInitialization</tt> to set up the <tt>AsmPrinter</tt>. In
-<tt>SparcAsmPrinter</tt>, a <tt>Mangler</tt> object is instantiated to process
-variable names.
-</p>
-
-<p>
-In <tt>XXXAsmPrinter.cpp</tt>, the <tt>runOnMachineFunction</tt> method
-(declared in <tt>MachineFunctionPass</tt>) must be implemented
-for <tt>XXXAsmPrinter</tt>. In <tt>MachineFunctionPass</tt>,
-the <tt>runOnFunction</tt> method invokes <tt>runOnMachineFunction</tt>.
-Target-specific implementations of <tt>runOnMachineFunction</tt> differ, but
-generally do the following to process each machine function:
-</p>
-
-<ul>
-<li>Call <tt>SetupMachineFunction</tt> to perform initialization.</li>
-
-<li>Call <tt>EmitConstantPool</tt> to print out (to the output stream) constants
-    which have been spilled to memory.</li>
-
-<li>Call <tt>EmitJumpTableInfo</tt> to print out jump tables used by the current
-    function.</li>
-
-<li>Print out the label for the current function.</li>
-
-<li>Print out the code for the function, including basic block labels and the
-    assembly for the instruction (using <tt>printInstruction</tt>)</li>
-</ul>
-
-<p>
-The <tt>XXXAsmPrinter</tt> implementation must also include the code generated
-by TableGen that is output in the <tt>XXXGenAsmWriter.inc</tt> file. The code
-in <tt>XXXGenAsmWriter.inc</tt> contains an implementation of the
-<tt>printInstruction</tt> method that may call these methods:
-</p>
-
-<ul>
-<li><tt>printOperand</tt></li>
-
-<li><tt>printMemOperand</tt></li>
-
-<li><tt>printCCOperand (for conditional statements)</tt></li>
-
-<li><tt>printDataDirective</tt></li>
-
-<li><tt>printDeclare</tt></li>
-
-<li><tt>printImplicitDef</tt></li>
-
-<li><tt>printInlineAsm</tt></li>
-</ul>
-
-<p>
-The implementations of <tt>printDeclare</tt>, <tt>printImplicitDef</tt>,
-<tt>printInlineAsm</tt>, and <tt>printLabel</tt> in <tt>AsmPrinter.cpp</tt> are
-generally adequate for printing assembly and do not need to be
-overridden.
-</p>
-
-<p>
-The <tt>printOperand</tt> method is implemented with a long switch/case
-statement for the type of operand: register, immediate, basic block, external
-symbol, global address, constant pool index, or jump table index. For an
-instruction with a memory address operand, the <tt>printMemOperand</tt> method
-should be implemented to generate the proper output. Similarly,
-<tt>printCCOperand</tt> should be used to print a conditional operand.
-</p>
-
-<p><tt>doFinalization</tt> should be overridden in <tt>XXXAsmPrinter</tt>, and
-it should be called to shut down the assembly printer. During
-<tt>doFinalization</tt>, global variables and constants are printed to
-output.
-</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="subtargetSupport">Subtarget Support</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>
-Subtarget support is used to inform the code generation process of instruction
-set variations for a given chip set.  For example, the LLVM SPARC implementation
-provided covers three major versions of the SPARC microprocessor architecture:
-Version 8 (V8, which is a 32-bit architecture), Version 9 (V9, a 64-bit
-architecture), and the UltraSPARC architecture. V8 has 16 double-precision
-floating-point registers that are also usable as either 32 single-precision or 8
-quad-precision registers.  V8 is also purely big-endian. V9 has 32
-double-precision floating-point registers that are also usable as 16
-quad-precision registers, but cannot be used as single-precision registers. The
-UltraSPARC architecture combines V9 with UltraSPARC Visual Instruction Set
-extensions.
-</p>
-
-<p>
-If subtarget support is needed, you should implement a target-specific
-XXXSubtarget class for your architecture. This class should process the
-command-line options <tt>-mcpu=</tt> and <tt>-mattr=</tt>.
-</p>
-
-<p>
-TableGen uses definitions in the <tt>Target.td</tt> and <tt>Sparc.td</tt> files
-to generate code in <tt>SparcGenSubtarget.inc</tt>. In <tt>Target.td</tt>, shown
-below, the <tt>SubtargetFeature</tt> interface is defined. The first 4 string
-parameters of the <tt>SubtargetFeature</tt> interface are a feature name, an
-attribute set by the feature, the value of the attribute, and a description of
-the feature. (The fifth parameter is a list of features whose presence is
-implied, and its default value is an empty array.)
-</p>
-
-<div class="doc_code">
-<pre>
-class SubtargetFeature&lt;string n, string a,  string v, string d,
-                       list&lt;SubtargetFeature&gt; i = []&gt; {
-  string Name = n;
-  string Attribute = a;
-  string Value = v;
-  string Desc = d;
-  list&lt;SubtargetFeature&gt; Implies = i;
-}
-</pre>
-</div>
-
-<p>
-In the <tt>Sparc.td</tt> file, the SubtargetFeature is used to define the
-following features.
-</p>
-
-<div class="doc_code">
-<pre>
-def FeatureV9 : SubtargetFeature&lt;"v9", "IsV9", "true",
-                     "Enable SPARC-V9 instructions"&gt;;
-def FeatureV8Deprecated : SubtargetFeature&lt;"deprecated-v8", 
-                     "V8DeprecatedInsts", "true",
-                     "Enable deprecated V8 instructions in V9 mode"&gt;;
-def FeatureVIS : SubtargetFeature&lt;"vis", "IsVIS", "true",
-                     "Enable UltraSPARC Visual Instruction Set extensions"&gt;;
-</pre>
-</div>
-
-<p>
-Elsewhere in <tt>Sparc.td</tt>, the Proc class is defined and then is used to
-define particular SPARC processor subtypes that may have the previously
-described features.
-</p>
-
-<div class="doc_code">
-<pre>
-class Proc&lt;string Name, list&lt;SubtargetFeature&gt; Features&gt;
-  : Processor&lt;Name, NoItineraries, Features&gt;;
-&nbsp;
-def : Proc&lt;"generic",         []&gt;;
-def : Proc&lt;"v8",              []&gt;;
-def : Proc&lt;"supersparc",      []&gt;;
-def : Proc&lt;"sparclite",       []&gt;;
-def : Proc&lt;"f934",            []&gt;;
-def : Proc&lt;"hypersparc",      []&gt;;
-def : Proc&lt;"sparclite86x",    []&gt;;
-def : Proc&lt;"sparclet",        []&gt;;
-def : Proc&lt;"tsc701",          []&gt;;
-def : Proc&lt;"v9",              [FeatureV9]&gt;;
-def : Proc&lt;"ultrasparc",      [FeatureV9, FeatureV8Deprecated]&gt;;
-def : Proc&lt;"ultrasparc3",     [FeatureV9, FeatureV8Deprecated]&gt;;
-def : Proc&lt;"ultrasparc3-vis", [FeatureV9, FeatureV8Deprecated, FeatureVIS]&gt;;
-</pre>
-</div>
-
-<p>
-From <tt>Target.td</tt> and <tt>Sparc.td</tt> files, the resulting
-SparcGenSubtarget.inc specifies enum values to identify the features, arrays of
-constants to represent the CPU features and CPU subtypes, and the
-ParseSubtargetFeatures method that parses the features string that sets
-specified subtarget options. The generated <tt>SparcGenSubtarget.inc</tt> file
-should be included in the <tt>SparcSubtarget.cpp</tt>. The target-specific
-implementation of the XXXSubtarget method should follow this pseudocode:
-</p>
-
-<div class="doc_code">
-<pre>
-XXXSubtarget::XXXSubtarget(const Module &amp;M, const std::string &amp;FS) {
-  // Set the default features
-  // Determine default and user specified characteristics of the CPU
-  // Call ParseSubtargetFeatures(FS, CPU) to parse the features string
-  // Perform any additional operations
-}
-</pre>
-</div>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="jitSupport">JIT Support</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>
-The implementation of a target machine optionally includes a Just-In-Time (JIT)
-code generator that emits machine code and auxiliary structures as binary output
-that can be written directly to memory.  To do this, implement JIT code
-generation by performing the following steps:
-</p>
-
-<ul>
-<li>Write an <tt>XXXCodeEmitter.cpp</tt> file that contains a machine function
-    pass that transforms target-machine instructions into relocatable machine
-    code.</li>
-
-<li>Write an <tt>XXXJITInfo.cpp</tt> file that implements the JIT interfaces for
-    target-specific code-generation activities, such as emitting machine code
-    and stubs.</li>
-
-<li>Modify <tt>XXXTargetMachine</tt> so that it provides a
-    <tt>TargetJITInfo</tt> object through its <tt>getJITInfo</tt> method.</li>
-</ul>
-
-<p>
-There are several different approaches to writing the JIT support code. For
-instance, TableGen and target descriptor files may be used for creating a JIT
-code generator, but are not mandatory. For the Alpha and PowerPC target
-machines, TableGen is used to generate <tt>XXXGenCodeEmitter.inc</tt>, which
-contains the binary coding of machine instructions and the
-<tt>getBinaryCodeForInstr</tt> method to access those codes. Other JIT
-implementations do not.
-</p>
-
-<p>
-Both <tt>XXXJITInfo.cpp</tt> and <tt>XXXCodeEmitter.cpp</tt> must include the
-<tt>llvm/CodeGen/MachineCodeEmitter.h</tt> header file that defines the
-<tt>MachineCodeEmitter</tt> class containing code for several callback functions
-that write data (in bytes, words, strings, etc.) to the output stream.
-</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="mce">Machine Code Emitter</a>
-</div>
-
-<div class="doc_text">
-
-<p>
-In <tt>XXXCodeEmitter.cpp</tt>, a target-specific of the <tt>Emitter</tt> class
-is implemented as a function pass (subclass
-of <tt>MachineFunctionPass</tt>). The target-specific implementation
-of <tt>runOnMachineFunction</tt> (invoked by
-<tt>runOnFunction</tt> in <tt>MachineFunctionPass</tt>) iterates through the
-<tt>MachineBasicBlock</tt> calls <tt>emitInstruction</tt> to process each
-instruction and emit binary code. <tt>emitInstruction</tt> is largely
-implemented with case statements on the instruction types defined in
-<tt>XXXInstrInfo.h</tt>. For example, in <tt>X86CodeEmitter.cpp</tt>,
-the <tt>emitInstruction</tt> method is built around the following switch/case
-statements:
-</p>
-
-<div class="doc_code">
-<pre>
-switch (Desc-&gt;TSFlags &amp; X86::FormMask) {
-case X86II::Pseudo:  // for not yet implemented instructions 
-   ...               // or pseudo-instructions
-   break;
-case X86II::RawFrm:  // for instructions with a fixed opcode value
-   ...
-   break;
-case X86II::AddRegFrm: // for instructions that have one register operand 
-   ...                 // added to their opcode
-   break;
-case X86II::MRMDestReg:// for instructions that use the Mod/RM byte
-   ...                 // to specify a destination (register)
-   break;
-case X86II::MRMDestMem:// for instructions that use the Mod/RM byte
-   ...                 // to specify a destination (memory)
-   break;
-case X86II::MRMSrcReg: // for instructions that use the Mod/RM byte
-   ...                 // to specify a source (register)
-   break;
-case X86II::MRMSrcMem: // for instructions that use the Mod/RM byte
-   ...                 // to specify a source (memory)
-   break;
-case X86II::MRM0r: case X86II::MRM1r:  // for instructions that operate on 
-case X86II::MRM2r: case X86II::MRM3r:  // a REGISTER r/m operand and
-case X86II::MRM4r: case X86II::MRM5r:  // use the Mod/RM byte and a field
-case X86II::MRM6r: case X86II::MRM7r:  // to hold extended opcode data
-   ...  
-   break;
-case X86II::MRM0m: case X86II::MRM1m:  // for instructions that operate on
-case X86II::MRM2m: case X86II::MRM3m:  // a MEMORY r/m operand and
-case X86II::MRM4m: case X86II::MRM5m:  // use the Mod/RM byte and a field
-case X86II::MRM6m: case X86II::MRM7m:  // to hold extended opcode data
-   ...  
-   break;
-case X86II::MRMInitReg: // for instructions whose source and
-   ...                  // destination are the same register
-   break;
-}
-</pre>
-</div>
-
-<p>
-The implementations of these case statements often first emit the opcode and
-then get the operand(s). Then depending upon the operand, helper methods may be
-called to process the operand(s). For example, in <tt>X86CodeEmitter.cpp</tt>,
-for the <tt>X86II::AddRegFrm</tt> case, the first data emitted
-(by <tt>emitByte</tt>) is the opcode added to the register operand. Then an
-object representing the machine operand, <tt>MO1</tt>, is extracted. The helper
-methods such as <tt>isImmediate</tt>,
-<tt>isGlobalAddress</tt>, <tt>isExternalSymbol</tt>, <tt>isConstantPoolIndex</tt>, and 
-<tt>isJumpTableIndex</tt> determine the operand
-type. (<tt>X86CodeEmitter.cpp</tt> also has private methods such
-as <tt>emitConstant</tt>, <tt>emitGlobalAddress</tt>,
-<tt>emitExternalSymbolAddress</tt>, <tt>emitConstPoolAddress</tt>,
-and <tt>emitJumpTableAddress</tt> that emit the data into the output stream.)
-</p>
-
-<div class="doc_code">
-<pre>
-case X86II::AddRegFrm:
-  MCE.emitByte(BaseOpcode + getX86RegNum(MI.getOperand(CurOp++).getReg()));
-  
-  if (CurOp != NumOps) {
-    const MachineOperand &amp;MO1 = MI.getOperand(CurOp++);
-    unsigned Size = X86InstrInfo::sizeOfImm(Desc);
-    if (MO1.isImmediate())
-      emitConstant(MO1.getImm(), Size);
-    else {
-      unsigned rt = Is64BitMode ? X86::reloc_pcrel_word
-        : (IsPIC ? X86::reloc_picrel_word : X86::reloc_absolute_word);
-      if (Opcode == X86::MOV64ri) 
-        rt = X86::reloc_absolute_dword;  // FIXME: add X86II flag?
-      if (MO1.isGlobalAddress()) {
-        bool NeedStub = isa&lt;Function&gt;(MO1.getGlobal());
-        bool isLazy = gvNeedsLazyPtr(MO1.getGlobal());
-        emitGlobalAddress(MO1.getGlobal(), rt, MO1.getOffset(), 0,
-                          NeedStub, isLazy);
-      } else if (MO1.isExternalSymbol())
-        emitExternalSymbolAddress(MO1.getSymbolName(), rt);
-      else if (MO1.isConstantPoolIndex())
-        emitConstPoolAddress(MO1.getIndex(), rt);
-      else if (MO1.isJumpTableIndex())
-        emitJumpTableAddress(MO1.getIndex(), rt);
-    }
-  }
-  break;
-</pre>
-</div>
-
-<p>
-In the previous example, <tt>XXXCodeEmitter.cpp</tt> uses the
-variable <tt>rt</tt>, which is a RelocationType enum that may be used to
-relocate addresses (for example, a global address with a PIC base offset). The
-<tt>RelocationType</tt> enum for that target is defined in the short
-target-specific <tt>XXXRelocations.h</tt> file. The <tt>RelocationType</tt> is used by
-the <tt>relocate</tt> method defined in <tt>XXXJITInfo.cpp</tt> to rewrite
-addresses for referenced global symbols.
-</p>
-
-<p>
-For example, <tt>X86Relocations.h</tt> specifies the following relocation types
-for the X86 addresses. In all four cases, the relocated value is added to the
-value already in memory. For <tt>reloc_pcrel_word</tt>
-and <tt>reloc_picrel_word</tt>, there is an additional initial adjustment.
-</p>
-
-<div class="doc_code">
-<pre>
-enum RelocationType {
-  reloc_pcrel_word = 0,    // add reloc value after adjusting for the PC loc
-  reloc_picrel_word = 1,   // add reloc value after adjusting for the PIC base
-  reloc_absolute_word = 2, // absolute relocation; no additional adjustment 
-  reloc_absolute_dword = 3 // absolute relocation; no additional adjustment
-};
-</pre>
-</div>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="targetJITInfo">Target JIT Info</a>
-</div>
-
-<div class="doc_text">
-
-<p>
-<tt>XXXJITInfo.cpp</tt> implements the JIT interfaces for target-specific
-code-generation activities, such as emitting machine code and stubs. At minimum,
-a target-specific version of <tt>XXXJITInfo</tt> implements the following:
-</p>
-
-<ul>
-<li><tt>getLazyResolverFunction</tt> &mdash; Initializes the JIT, gives the
-    target a function that is used for compilation.</li>
-
-<li><tt>emitFunctionStub</tt> &mdash; Returns a native function with a specified
-    address for a callback function.</li>
-
-<li><tt>relocate</tt> &mdash; Changes the addresses of referenced globals, based
-    on relocation types.</li>
-
-<li>Callback function that are wrappers to a function stub that is used when the
-    real target is not initially known.</li>
-</ul>
-
-<p>
-<tt>getLazyResolverFunction</tt> is generally trivial to implement. It makes the
-incoming parameter as the global <tt>JITCompilerFunction</tt> and returns the
-callback function that will be used a function wrapper. For the Alpha target
-(in <tt>AlphaJITInfo.cpp</tt>), the <tt>getLazyResolverFunction</tt>
-implementation is simply:
-</p>
-
-<div class="doc_code">
-<pre>
-TargetJITInfo::LazyResolverFn AlphaJITInfo::getLazyResolverFunction(  
-                                            JITCompilerFn F) {
-  JITCompilerFunction = F;
-  return AlphaCompilationCallback;
-}
-</pre>
-</div>
-
-<p>
-For the X86 target, the <tt>getLazyResolverFunction</tt> implementation is a
-little more complication, because it returns a different callback function for
-processors with SSE instructions and XMM registers.
-</p>
-
-<p>
-The callback function initially saves and later restores the callee register
-values, incoming arguments, and frame and return address. The callback function
-needs low-level access to the registers or stack, so it is typically implemented
-with assembler.
-</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-
-<hr>
-<address>
-  <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
-  src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS"></a>
-  <a href="http://validator.w3.org/check/referer"><img
-  src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
-
-  <a href="http://www.woo.com">Mason Woo</a> and <a href="http://misha.brukman.net">Misha Brukman</a><br>
-  <a href="http://llvm.org">The LLVM Compiler Infrastructure</a>
-  <br>
-  Last modified: $Date$
-</address>
-
-</body>
-</html>
diff --git a/libclamav/c++/llvm/docs/WritingAnLLVMPass.html b/libclamav/c++/llvm/docs/WritingAnLLVMPass.html
deleted file mode 100644
index f531a74..0000000
--- a/libclamav/c++/llvm/docs/WritingAnLLVMPass.html
+++ /dev/null
@@ -1,1836 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-                      "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-  <title>Writing an LLVM Pass</title>
-  <link rel="stylesheet" href="llvm.css" type="text/css">
-</head>
-<body>
-
-<div class="doc_title">
-  Writing an LLVM Pass
-</div>
-
-<ol>
-  <li><a href="#introduction">Introduction - What is a pass?</a></li>
-  <li><a href="#quickstart">Quick Start - Writing hello world</a>
-    <ul>
-    <li><a href="#makefile">Setting up the build environment</a></li>
-    <li><a href="#basiccode">Basic code required</a></li>
-    <li><a href="#running">Running a pass with <tt>opt</tt></a></li>
-    </ul></li>
-  <li><a href="#passtype">Pass classes and requirements</a>
-     <ul>
-     <li><a href="#ImmutablePass">The <tt>ImmutablePass</tt> class</a></li>
-     <li><a href="#ModulePass">The <tt>ModulePass</tt> class</a>
-        <ul>
-        <li><a href="#runOnModule">The <tt>runOnModule</tt> method</a></li>
-        </ul></li>
-     <li><a href="#CallGraphSCCPass">The <tt>CallGraphSCCPass</tt> class</a>
-        <ul>
-        <li><a href="#doInitialization_scc">The <tt>doInitialization(CallGraph
-                                           &amp;)</tt> method</a></li>
-        <li><a href="#runOnSCC">The <tt>runOnSCC</tt> method</a></li>
-        <li><a href="#doFinalization_scc">The <tt>doFinalization(CallGraph
-                                           &amp;)</tt> method</a></li>
-        </ul></li>
-     <li><a href="#FunctionPass">The <tt>FunctionPass</tt> class</a>
-        <ul>
-        <li><a href="#doInitialization_mod">The <tt>doInitialization(Module
-                                            &amp;)</tt> method</a></li>
-        <li><a href="#runOnFunction">The <tt>runOnFunction</tt> method</a></li>
-        <li><a href="#doFinalization_mod">The <tt>doFinalization(Module
-                                            &amp;)</tt> method</a></li>
-        </ul></li>
-     <li><a href="#LoopPass">The <tt>LoopPass</tt> class</a>
-        <ul>
-        <li><a href="#doInitialization_loop">The <tt>doInitialization(Loop *,
-                                            LPPassManager &amp;)</tt> method</a></li>
-        <li><a href="#runOnLoop">The <tt>runOnLoop</tt> method</a></li>
-        <li><a href="#doFinalization_loop">The <tt>doFinalization()
-                                            </tt> method</a></li>
-        </ul></li>
-     <li><a href="#BasicBlockPass">The <tt>BasicBlockPass</tt> class</a>
-        <ul>
-        <li><a href="#doInitialization_fn">The <tt>doInitialization(Function
-                                             &amp;)</tt> method</a></li>
-        <li><a href="#runOnBasicBlock">The <tt>runOnBasicBlock</tt>
-                                       method</a></li>
-        <li><a href="#doFinalization_fn">The <tt>doFinalization(Function
-                                         &amp;)</tt> method</a></li>
-        </ul></li>
-     <li><a href="#MachineFunctionPass">The <tt>MachineFunctionPass</tt>
-                                        class</a>
-        <ul>
-        <li><a href="#runOnMachineFunction">The
-            <tt>runOnMachineFunction(MachineFunction &amp;)</tt> method</a></li>
-        </ul></li>
-     </ul>
-  <li><a href="#registration">Pass Registration</a>
-     <ul>
-     <li><a href="#print">The <tt>print</tt> method</a></li>
-     </ul></li>
-  <li><a href="#interaction">Specifying interactions between passes</a>
-     <ul>
-     <li><a href="#getAnalysisUsage">The <tt>getAnalysisUsage</tt> 
-                                     method</a></li>
-     <li><a href="#AU::addRequired">The <tt>AnalysisUsage::addRequired&lt;&gt;</tt> and <tt>AnalysisUsage::addRequiredTransitive&lt;&gt;</tt> methods</a></li>
-     <li><a href="#AU::addPreserved">The <tt>AnalysisUsage::addPreserved&lt;&gt;</tt> method</a></li>
-     <li><a href="#AU::examples">Example implementations of <tt>getAnalysisUsage</tt></a></li>
-     <li><a href="#getAnalysis">The <tt>getAnalysis&lt;&gt;</tt> and
-<tt>getAnalysisIfAvailable&lt;&gt;</tt> methods</a></li>
-     </ul></li>
-  <li><a href="#analysisgroup">Implementing Analysis Groups</a>
-     <ul>
-     <li><a href="#agconcepts">Analysis Group Concepts</a></li>
-     <li><a href="#registerag">Using <tt>RegisterAnalysisGroup</tt></a></li>
-     </ul></li>
-  <li><a href="#passStatistics">Pass Statistics</a>
-  <li><a href="#passmanager">What PassManager does</a>
-    <ul>
-    <li><a href="#releaseMemory">The <tt>releaseMemory</tt> method</a></li>
-    </ul></li>
-  <li><a href="#registering">Registering dynamically loaded passes</a>
-    <ul>
-      <li><a href="#registering_existing">Using existing registries</a></li>
-      <li><a href="#registering_new">Creating new registries</a></li>
-    </ul></li>
-  <li><a href="#debughints">Using GDB with dynamically loaded passes</a>
-    <ul>
-    <li><a href="#breakpoint">Setting a breakpoint in your pass</a></li>
-    <li><a href="#debugmisc">Miscellaneous Problems</a></li>
-    </ul></li>
-  <li><a href="#future">Future extensions planned</a>
-    <ul>
-    <li><a href="#SMP">Multithreaded LLVM</a></li>
-    </ul></li>
-</ol>
-
-<div class="doc_author">
-  <p>Written by <a href="mailto:sabre at nondot.org">Chris Lattner</a> and
-  <a href="mailto:jlaskey at mac.com">Jim Laskey</a></p>
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="introduction">Introduction - What is a pass?</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>The LLVM Pass Framework is an important part of the LLVM system, because LLVM
-passes are where most of the interesting parts of the compiler exist.  Passes
-perform the transformations and optimizations that make up the compiler, they
-build the analysis results that are used by these transformations, and they are,
-above all, a structuring technique for compiler code.</p>
-
-<p>All LLVM passes are subclasses of the <tt><a
-href="http://llvm.org/doxygen/classllvm_1_1Pass.html">Pass</a></tt>
-class, which implement functionality by overriding virtual methods inherited
-from <tt>Pass</tt>.  Depending on how your pass works, you should inherit from
-the <tt><a href="#ModulePass">ModulePass</a></tt>, <tt><a
-href="#CallGraphSCCPass">CallGraphSCCPass</a></tt>, <tt><a
-href="#FunctionPass">FunctionPass</a></tt>, or <tt><a
-href="#LoopPass">LoopPass</a></tt>, or <tt><a
-href="#BasicBlockPass">BasicBlockPass</a></tt> classes, which gives the system
-more information about what your pass does, and how it can be combined with
-other passes.  One of the main features of the LLVM Pass Framework is that it
-schedules passes to run in an efficient way based on the constraints that your
-pass meets (which are indicated by which class they derive from).</p>
-
-<p>We start by showing you how to construct a pass, everything from setting up
-the code, to compiling, loading, and executing it.  After the basics are down,
-more advanced features are discussed.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="quickstart">Quick Start - Writing hello world</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>Here we describe how to write the "hello world" of passes.  The "Hello" pass
-is designed to simply print out the name of non-external functions that exist in
-the program being compiled.  It does not modify the program at all, it just
-inspects it.  The source code and files for this pass are available in the LLVM
-source tree in the <tt>lib/Transforms/Hello</tt> directory.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="makefile">Setting up the build environment</a>
-</div>
-
-<div class="doc_text">
-
-  <p>First, you need to create a new directory somewhere in the LLVM source 
-  base.  For this example, we'll assume that you made 
-  <tt>lib/Transforms/Hello</tt>.  Next, you must set up a build script 
-  (Makefile) that will compile the source code for the new pass.  To do this, 
-  copy the following into <tt>Makefile</tt>:</p>
-  <hr/>
-
-<div class="doc_code"><pre>
-# Makefile for hello pass
-
-# Path to top level of LLVM hierarchy
-LEVEL = ../../..
-
-# Name of the library to build
-LIBRARYNAME = Hello
-
-# Make the shared library become a loadable module so the tools can 
-# dlopen/dlsym on the resulting library.
-LOADABLE_MODULE = 1
-
-# Tell the build system which LLVM libraries your pass needs. You'll probably
-# need at least LLVMSystem.a, LLVMSupport.a, LLVMCore.a but possibly several
-# others too.
-LLVMLIBS = LLVMCore.a LLVMSupport.a LLVMSystem.a
-
-# Include the makefile implementation stuff
-include $(LEVEL)/Makefile.common
-</pre></div>
-
-<p>This makefile specifies that all of the <tt>.cpp</tt> files in the current
-directory are to be compiled and linked together into a
-<tt>Debug/lib/Hello.so</tt> shared object that can be dynamically loaded by
-the <tt>opt</tt> or <tt>bugpoint</tt> tools via their <tt>-load</tt> options.  
-If your operating system uses a suffix other than .so (such as windows or 
-Mac OS/X), the appropriate extension will be used.</p>
-
-<p>Now that we have the build scripts set up, we just need to write the code for
-the pass itself.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="basiccode">Basic code required</a>
-</div>
-
-<div class="doc_text">
-
-<p>Now that we have a way to compile our new pass, we just have to write it.
-Start out with:</p>
-
-<div class="doc_code"><pre>
-<b>#include</b> "<a href="http://llvm.org/doxygen/Pass_8h-source.html">llvm/Pass.h</a>"
-<b>#include</b> "<a href="http://llvm.org/doxygen/Function_8h-source.html">llvm/Function.h</a>"
-<b>#include</b> "<a href="http://llvm.org/doxygen/raw__ostream_8h.html">llvm/Support/raw_ostream.h</a>"
-</pre></div>
-
-<p>Which are needed because we are writing a <tt><a
-href="http://llvm.org/doxygen/classllvm_1_1Pass.html">Pass</a></tt>,
-we are operating on <tt><a
-href="http://llvm.org/doxygen/classllvm_1_1Function.html">Function</a></tt>'s,
-and we will be doing some printing.</p>
-
-<p>Next we have:</p>
-<div class="doc_code"><pre>
-<b>using namespace llvm;</b>
-</pre></div>
-<p>... which is required because the functions from the include files 
-live in the llvm namespace.
-</p>
-
-<p>Next we have:</p>
-
-<div class="doc_code"><pre>
-<b>namespace</b> {
-</pre></div>
-
-<p>... which starts out an anonymous namespace.  Anonymous namespaces are to C++
-what the "<tt>static</tt>" keyword is to C (at global scope).  It makes the
-things declared inside of the anonymous namespace only visible to the current
-file.  If you're not familiar with them, consult a decent C++ book for more
-information.</p>
-
-<p>Next, we declare our pass itself:</p>
-
-<div class="doc_code"><pre>
-  <b>struct</b> Hello : <b>public</b> <a href="#FunctionPass">FunctionPass</a> {
-</pre></div><p>
-
-<p>This declares a "<tt>Hello</tt>" class that is a subclass of <tt><a
-href="http://llvm.org/doxygen/classllvm_1_1FunctionPass.html">FunctionPass</a></tt>.
-The different builtin pass subclasses are described in detail <a
-href="#passtype">later</a>, but for now, know that <a
-href="#FunctionPass"><tt>FunctionPass</tt></a>'s operate a function at a
-time.</p>
-
-<div class="doc_code"><pre>
-     static char ID;
-     Hello() : FunctionPass(&amp;ID) {}
-</pre></div><p>
-
-<p> This declares pass identifier used by LLVM to identify pass. This allows LLVM to
-avoid using expensive C++ runtime information.</p>
-
-<div class="doc_code"><pre>
-    <b>virtual bool</b> <a href="#runOnFunction">runOnFunction</a>(Function &amp;F) {
-      errs() &lt;&lt; "<i>Hello: </i>" &lt;&lt; F.getName() &lt;&lt; "\n";
-      <b>return false</b>;
-    }
-  };  <i>// end of struct Hello</i>
-</pre></div>
-
-<p>We declare a "<a href="#runOnFunction"><tt>runOnFunction</tt></a>" method,
-which overloads an abstract virtual method inherited from <a
-href="#FunctionPass"><tt>FunctionPass</tt></a>.  This is where we are supposed
-to do our thing, so we just print out our message with the name of each
-function.</p>
-
-<div class="doc_code"><pre>
-  char Hello::ID = 0;
-</pre></div>
-
-<p> We initialize pass ID here. LLVM uses ID's address to identify pass so 
-initialization value is not important.</p>
-
-<div class="doc_code"><pre>
-  RegisterPass&lt;Hello&gt; X("<i>hello</i>", "<i>Hello World Pass</i>",
-                        false /* Only looks at CFG */,
-                        false /* Analysis Pass */);
-}  <i>// end of anonymous namespace</i>
-</pre></div>
-
-<p>Lastly, we <a href="#registration">register our class</a> <tt>Hello</tt>, 
-giving it a command line
-argument "<tt>hello</tt>", and a name "<tt>Hello World Pass</tt>".
-Last two RegisterPass arguments are optional. Their default value is false.
-If a pass walks CFG without modifying it then third argument is set to true. 
-If  a pass is an analysis pass, for example dominator tree pass, then true 
-is supplied as fourth argument. </p>
-
-<p>As a whole, the <tt>.cpp</tt> file looks like:</p>
-
-<div class="doc_code"><pre>
-<b>#include</b> "<a href="http://llvm.org/doxygen/Pass_8h-source.html">llvm/Pass.h</a>"
-<b>#include</b> "<a href="http://llvm.org/doxygen/Function_8h-source.html">llvm/Function.h</a>"
-<b>#include</b> "<a href="http://llvm.org/doxygen/raw__ostream_8h.html">llvm/Support/raw_ostream.h</a>"
-
-<b>using namespace llvm;</b>
-
-<b>namespace</b> {
-  <b>struct Hello</b> : <b>public</b> <a href="#FunctionPass">FunctionPass</a> {
-    
-    static char ID;
-    Hello() : FunctionPass(&amp;ID) {}
-
-    <b>virtual bool</b> <a href="#runOnFunction">runOnFunction</a>(Function &amp;F) {
-      errs() &lt;&lt; "<i>Hello: </i>" &lt;&lt; F.getName() &lt;&lt; "\n";
-      <b>return false</b>;
-    }
-  };
-  
-  char Hello::ID = 0;
-  RegisterPass&lt;Hello&gt; X("<i>hello</i>", "<i>Hello World Pass</i>");
-}
-</pre></div>
-
-<p>Now that it's all together, compile the file with a simple "<tt>gmake</tt>"
-command in the local directory and you should get a new
-"<tt>Debug/lib/Hello.so</tt> file.  Note that everything in this file is
-contained in an anonymous namespace: this reflects the fact that passes are self
-contained units that do not need external interfaces (although they can have
-them) to be useful.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="running">Running a pass with <tt>opt</tt></a>
-</div>
-
-<div class="doc_text">
-
-<p>Now that you have a brand new shiny shared object file, we can use the
-<tt>opt</tt> command to run an LLVM program through your pass.  Because you
-registered your pass with the <tt>RegisterPass</tt> template, you will be able to
-use the <tt>opt</tt> tool to access it, once loaded.</p>
-
-<p>To test it, follow the example at the end of the <a
-href="GettingStarted.html">Getting Started Guide</a> to compile "Hello World" to
-LLVM.  We can now run the bitcode file (<tt>hello.bc</tt>) for the program
-through our transformation like this (or course, any bitcode file will
-work):</p>
-
-<div class="doc_code"><pre>
-$ opt -load ../../../Debug/lib/Hello.so -hello &lt; hello.bc &gt; /dev/null
-Hello: __main
-Hello: puts
-Hello: main
-</pre></div>
-
-<p>The '<tt>-load</tt>' option specifies that '<tt>opt</tt>' should load your
-pass as a shared object, which makes '<tt>-hello</tt>' a valid command line
-argument (which is one reason you need to <a href="#registration">register your
-pass</a>).  Because the hello pass does not modify the program in any
-interesting way, we just throw away the result of <tt>opt</tt> (sending it to
-<tt>/dev/null</tt>).</p>
-
-<p>To see what happened to the other string you registered, try running
-<tt>opt</tt> with the <tt>--help</tt> option:</p>
-
-<div class="doc_code"><pre>
-$ opt -load ../../../Debug/lib/Hello.so --help
-OVERVIEW: llvm .bc -&gt; .bc modular optimizer
-
-USAGE: opt [options] &lt;input bitcode&gt;
-
-OPTIONS:
-  Optimizations available:
-...
-    -funcresolve    - Resolve Functions
-    -gcse           - Global Common Subexpression Elimination
-    -globaldce      - Dead Global Elimination
-    <b>-hello          - Hello World Pass</b>
-    -indvars        - Canonicalize Induction Variables
-    -inline         - Function Integration/Inlining
-    -instcombine    - Combine redundant instructions
-...
-</pre></div>
-
-<p>The pass name get added as the information string for your pass, giving some
-documentation to users of <tt>opt</tt>.  Now that you have a working pass, you
-would go ahead and make it do the cool transformations you want.  Once you get
-it all working and tested, it may become useful to find out how fast your pass
-is.  The <a href="#passManager"><tt>PassManager</tt></a> provides a nice command
-line option (<tt>--time-passes</tt>) that allows you to get information about
-the execution time of your pass along with the other passes you queue up.  For
-example:</p>
-
-<div class="doc_code"><pre>
-$ opt -load ../../../Debug/lib/Hello.so -hello -time-passes &lt; hello.bc &gt; /dev/null
-Hello: __main
-Hello: puts
-Hello: main
-===============================================================================
-                      ... Pass execution timing report ...
-===============================================================================
-  Total Execution Time: 0.02 seconds (0.0479059 wall clock)
-
-   ---User Time---   --System Time--   --User+System--   ---Wall Time---  --- Pass Name ---
-   0.0100 (100.0%)   0.0000 (  0.0%)   0.0100 ( 50.0%)   0.0402 ( 84.0%)  Bitcode Writer
-   0.0000 (  0.0%)   0.0100 (100.0%)   0.0100 ( 50.0%)   0.0031 (  6.4%)  Dominator Set Construction
-   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0013 (  2.7%)  Module Verifier
- <b>  0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0033 (  6.9%)  Hello World Pass</b>
-   0.0100 (100.0%)   0.0100 (100.0%)   0.0200 (100.0%)   0.0479 (100.0%)  TOTAL
-</pre></div>
-
-<p>As you can see, our implementation above is pretty fast :).  The additional
-passes listed are automatically inserted by the '<tt>opt</tt>' tool to verify
-that the LLVM emitted by your pass is still valid and well formed LLVM, which
-hasn't been broken somehow.</p>
-
-<p>Now that you have seen the basics of the mechanics behind passes, we can talk
-about some more details of how they work and how to use them.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="passtype">Pass classes and requirements</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>One of the first things that you should do when designing a new pass is to
-decide what class you should subclass for your pass.  The <a
-href="#basiccode">Hello World</a> example uses the <tt><a
-href="#FunctionPass">FunctionPass</a></tt> class for its implementation, but we
-did not discuss why or when this should occur.  Here we talk about the classes
-available, from the most general to the most specific.</p>
-
-<p>When choosing a superclass for your Pass, you should choose the <b>most
-specific</b> class possible, while still being able to meet the requirements
-listed.  This gives the LLVM Pass Infrastructure information necessary to
-optimize how passes are run, so that the resultant compiler isn't unnecessarily
-slow.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="ImmutablePass">The <tt>ImmutablePass</tt> class</a>
-</div>
-
-<div class="doc_text">
-
-<p>The most plain and boring type of pass is the "<tt><a
-href="http://llvm.org/doxygen/classllvm_1_1ImmutablePass.html">ImmutablePass</a></tt>"
-class.  This pass type is used for passes that do not have to be run, do not
-change state, and never need to be updated.  This is not a normal type of
-transformation or analysis, but can provide information about the current
-compiler configuration.</p>
-
-<p>Although this pass class is very infrequently used, it is important for
-providing information about the current target machine being compiled for, and
-other static information that can affect the various transformations.</p>
-
-<p><tt>ImmutablePass</tt>es never invalidate other transformations, are never
-invalidated, and are never "run".</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="ModulePass">The <tt>ModulePass</tt> class</a>
-</div>
-
-<div class="doc_text">
-
-<p>The "<tt><a
-href="http://llvm.org/doxygen/classllvm_1_1ModulePass.html">ModulePass</a></tt>"
-class is the most general of all superclasses that you can use.  Deriving from
-<tt>ModulePass</tt> indicates that your pass uses the entire program as a unit,
-referring to function bodies in no predictable order, or adding and removing
-functions.  Because nothing is known about the behavior of <tt>ModulePass</tt>
-subclasses, no optimization can be done for their execution.</p>
-
-<p>A module pass can use function level passes (e.g. dominators) using
-the getAnalysis interface
-<tt>getAnalysis&lt;DominatorTree&gt;(llvm::Function *)</tt> to provide the
-function to retrieve analysis result for, if the function pass does not require
-any module or immutable passes. Note that this can only be done for functions for which the
-analysis ran, e.g. in the case of dominators you should only ask for the
-DominatorTree for function definitions, not declarations.</p>
-
-<p>To write a correct <tt>ModulePass</tt> subclass, derive from
-<tt>ModulePass</tt> and overload the <tt>runOnModule</tt> method with the
-following signature:</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="runOnModule">The <tt>runOnModule</tt> method</a>
-</div>
-
-<div class="doc_text">
-
-<div class="doc_code"><pre>
-  <b>virtual bool</b> runOnModule(Module &amp;M) = 0;
-</pre></div>
-
-<p>The <tt>runOnModule</tt> method performs the interesting work of the pass.
-It should return true if the module was modified by the transformation and
-false otherwise.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="CallGraphSCCPass">The <tt>CallGraphSCCPass</tt> class</a>
-</div>
-
-<div class="doc_text">
-
-<p>The "<tt><a
-href="http://llvm.org/doxygen/classllvm_1_1CallGraphSCCPass.html">CallGraphSCCPass</a></tt>"
-is used by passes that need to traverse the program bottom-up on the call graph
-(callees before callers).  Deriving from CallGraphSCCPass provides some
-mechanics for building and traversing the CallGraph, but also allows the system
-to optimize execution of CallGraphSCCPass's.  If your pass meets the
-requirements outlined below, and doesn't meet the requirements of a <tt><a
-href="#FunctionPass">FunctionPass</a></tt> or <tt><a
-href="#BasicBlockPass">BasicBlockPass</a></tt>, you should derive from
-<tt>CallGraphSCCPass</tt>.</p>
-
-<p><b>TODO</b>: explain briefly what SCC, Tarjan's algo, and B-U mean.</p>
-
-<p>To be explicit, <tt>CallGraphSCCPass</tt> subclasses are:</p>
-
-<ol>
-
-<li>... <em>not allowed</em> to modify any <tt>Function</tt>s that are not in
-the current SCC.</li>
-
-<li>... <em>not allowed</em> to inspect any Function's other than those in the
-current SCC and the direct callees of the SCC.</li>
-
-<li>... <em>required</em> to preserve the current CallGraph object, updating it
-to reflect any changes made to the program.</li>
-
-<li>... <em>not allowed</em> to add or remove SCC's from the current Module,
-though they may change the contents of an SCC.</li>
-
-<li>... <em>allowed</em> to add or remove global variables from the current
-Module.</li>
-
-<li>... <em>allowed</em> to maintain state across invocations of
-    <a href="#runOnSCC"><tt>runOnSCC</tt></a> (including global data).</li>
-</ol>
-
-<p>Implementing a <tt>CallGraphSCCPass</tt> is slightly tricky in some cases
-because it has to handle SCCs with more than one node in it.  All of the virtual
-methods described below should return true if they modified the program, or
-false if they didn't.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="doInitialization_scc">The <tt>doInitialization(CallGraph &amp;)</tt>
-  method</a>
-</div>
-
-<div class="doc_text">
-
-<div class="doc_code"><pre>
-  <b>virtual bool</b> doInitialization(CallGraph &amp;CG);
-</pre></div>
-
-<p>The <tt>doIninitialize</tt> method is allowed to do most of the things that
-<tt>CallGraphSCCPass</tt>'s are not allowed to do.  They can add and remove
-functions, get pointers to functions, etc.  The <tt>doInitialization</tt> method
-is designed to do simple initialization type of stuff that does not depend on
-the SCCs being processed.  The <tt>doInitialization</tt> method call is not
-scheduled to overlap with any other pass executions (thus it should be very
-fast).</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="runOnSCC">The <tt>runOnSCC</tt> method</a>
-</div>
-
-<div class="doc_text">
-
-<div class="doc_code"><pre>
-  <b>virtual bool</b> runOnSCC(const std::vector&lt;CallGraphNode *&gt; &amp;SCCM) = 0;
-</pre></div>
-
-<p>The <tt>runOnSCC</tt> method performs the interesting work of the pass, and
-should return true if the module was modified by the transformation, false
-otherwise.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="doFinalization_scc">The <tt>doFinalization(CallGraph
-   &amp;)</tt> method</a>
-</div>
-
-<div class="doc_text">
-
-<div class="doc_code"><pre>
-  <b>virtual bool</b> doFinalization(CallGraph &amp;CG);
-</pre></div>
-
-<p>The <tt>doFinalization</tt> method is an infrequently used method that is
-called when the pass framework has finished calling <a
-href="#runOnFunction"><tt>runOnFunction</tt></a> for every function in the
-program being compiled.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="FunctionPass">The <tt>FunctionPass</tt> class</a>
-</div>
-
-<div class="doc_text">
-
-<p>In contrast to <tt>ModulePass</tt> subclasses, <tt><a
-href="http://llvm.org/doxygen/classllvm_1_1Pass.html">FunctionPass</a></tt>
-subclasses do have a predictable, local behavior that can be expected by the
-system.  All <tt>FunctionPass</tt> execute on each function in the program
-independent of all of the other functions in the program.
-<tt>FunctionPass</tt>'s do not require that they are executed in a particular
-order, and <tt>FunctionPass</tt>'s do not modify external functions.</p>
-
-<p>To be explicit, <tt>FunctionPass</tt> subclasses are not allowed to:</p>
-
-<ol>
-<li>Modify a Function other than the one currently being processed.</li>
-<li>Add or remove Function's from the current Module.</li>
-<li>Add or remove global variables from the current Module.</li>
-<li>Maintain state across invocations of
-    <a href="#runOnFunction"><tt>runOnFunction</tt></a> (including global data)</li>
-</ol>
-
-<p>Implementing a <tt>FunctionPass</tt> is usually straightforward (See the <a
-href="#basiccode">Hello World</a> pass for example).  <tt>FunctionPass</tt>'s
-may overload three virtual methods to do their work.  All of these methods
-should return true if they modified the program, or false if they didn't.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="doInitialization_mod">The <tt>doInitialization(Module &amp;)</tt>
-  method</a>
-</div>
-
-<div class="doc_text">
-
-<div class="doc_code"><pre>
-  <b>virtual bool</b> doInitialization(Module &amp;M);
-</pre></div>
-
-<p>The <tt>doIninitialize</tt> method is allowed to do most of the things that
-<tt>FunctionPass</tt>'s are not allowed to do.  They can add and remove
-functions, get pointers to functions, etc.  The <tt>doInitialization</tt> method
-is designed to do simple initialization type of stuff that does not depend on
-the functions being processed.  The <tt>doInitialization</tt> method call is not
-scheduled to overlap with any other pass executions (thus it should be very
-fast).</p>
-
-<p>A good example of how this method should be used is the <a
-href="http://llvm.org/doxygen/LowerAllocations_8cpp-source.html">LowerAllocations</a>
-pass.  This pass converts <tt>malloc</tt> and <tt>free</tt> instructions into
-platform dependent <tt>malloc()</tt> and <tt>free()</tt> function calls.  It
-uses the <tt>doInitialization</tt> method to get a reference to the malloc and
-free functions that it needs, adding prototypes to the module if necessary.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="runOnFunction">The <tt>runOnFunction</tt> method</a>
-</div>
-
-<div class="doc_text">
-
-<div class="doc_code"><pre>
-  <b>virtual bool</b> runOnFunction(Function &amp;F) = 0;
-</pre></div><p>
-
-<p>The <tt>runOnFunction</tt> method must be implemented by your subclass to do
-the transformation or analysis work of your pass.  As usual, a true value should
-be returned if the function is modified.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="doFinalization_mod">The <tt>doFinalization(Module
-  &amp;)</tt> method</a>
-</div>
-
-<div class="doc_text">
-
-<div class="doc_code"><pre>
-  <b>virtual bool</b> doFinalization(Module &amp;M);
-</pre></div>
-
-<p>The <tt>doFinalization</tt> method is an infrequently used method that is
-called when the pass framework has finished calling <a
-href="#runOnFunction"><tt>runOnFunction</tt></a> for every function in the
-program being compiled.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="LoopPass">The <tt>LoopPass</tt> class </a>
-</div>
-
-<div class="doc_text">
-
-<p> All <tt>LoopPass</tt> execute on each loop in the function independent of
-all of the other loops in the function. <tt>LoopPass</tt> processes loops in
-loop nest order such that outer most loop is processed last. </p>
-
-<p> <tt>LoopPass</tt> subclasses are allowed to update loop nest using
-<tt>LPPassManager</tt> interface. Implementing a loop pass is usually
-straightforward. <tt>Looppass</tt>'s may overload three virtual methods to
-do their work. All these methods should return true if they modified the 
-program, or false if they didn't. </p>
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="doInitialization_loop">The <tt>doInitialization(Loop *,
-                                                 LPPassManager &amp;)</tt>
-  method</a>
-</div>
-
-<div class="doc_text">
-
-<div class="doc_code"><pre>
-  <b>virtual bool</b> doInitialization(Loop *, LPPassManager &amp;LPM);
-</pre></div>
-
-<p>The <tt>doInitialization</tt> method is designed to do simple initialization 
-type of stuff that does not depend on the functions being processed.  The 
-<tt>doInitialization</tt> method call is not scheduled to overlap with any 
-other pass executions (thus it should be very fast). LPPassManager 
-interface should be used to access Function or Module level analysis
-information.</p>
-
-</div>
-
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="runOnLoop">The <tt>runOnLoop</tt> method</a>
-</div>
-
-<div class="doc_text">
-
-<div class="doc_code"><pre>
-  <b>virtual bool</b> runOnLoop(Loop *, LPPassManager &amp;LPM) = 0;
-</pre></div><p>
-
-<p>The <tt>runOnLoop</tt> method must be implemented by your subclass to do
-the transformation or analysis work of your pass.  As usual, a true value should
-be returned if the function is modified. <tt>LPPassManager</tt> interface
-should be used to update loop nest.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="doFinalization_loop">The <tt>doFinalization()</tt> method</a>
-</div>
-
-<div class="doc_text">
-
-<div class="doc_code"><pre>
-  <b>virtual bool</b> doFinalization();
-</pre></div>
-
-<p>The <tt>doFinalization</tt> method is an infrequently used method that is
-called when the pass framework has finished calling <a
-href="#runOnLoop"><tt>runOnLoop</tt></a> for every loop in the
-program being compiled. </p>
-
-</div>
-
-
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="BasicBlockPass">The <tt>BasicBlockPass</tt> class</a>
-</div>
-
-<div class="doc_text">
-
-<p><tt>BasicBlockPass</tt>'s are just like <a
-href="#FunctionPass"><tt>FunctionPass</tt></a>'s, except that they must limit
-their scope of inspection and modification to a single basic block at a time.
-As such, they are <b>not</b> allowed to do any of the following:</p>
-
-<ol>
-<li>Modify or inspect any basic blocks outside of the current one</li>
-<li>Maintain state across invocations of
-    <a href="#runOnBasicBlock"><tt>runOnBasicBlock</tt></a></li>
-<li>Modify the control flow graph (by altering terminator instructions)</li>
-<li>Any of the things forbidden for
-    <a href="#FunctionPass"><tt>FunctionPass</tt></a>es.</li>
-</ol>
-
-<p><tt>BasicBlockPass</tt>es are useful for traditional local and "peephole"
-optimizations.  They may override the same <a
-href="#doInitialization_mod"><tt>doInitialization(Module &amp;)</tt></a> and <a
-href="#doFinalization_mod"><tt>doFinalization(Module &amp;)</tt></a> methods that <a
-href="#FunctionPass"><tt>FunctionPass</tt></a>'s have, but also have the following virtual methods that may also be implemented:</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="doInitialization_fn">The <tt>doInitialization(Function
-  &amp;)</tt> method</a>
-</div>
-
-<div class="doc_text">
-
-<div class="doc_code"><pre>
-  <b>virtual bool</b> doInitialization(Function &amp;F);
-</pre></div>
-
-<p>The <tt>doIninitialize</tt> method is allowed to do most of the things that
-<tt>BasicBlockPass</tt>'s are not allowed to do, but that
-<tt>FunctionPass</tt>'s can.  The <tt>doInitialization</tt> method is designed
-to do simple initialization that does not depend on the
-BasicBlocks being processed.  The <tt>doInitialization</tt> method call is not
-scheduled to overlap with any other pass executions (thus it should be very
-fast).</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="runOnBasicBlock">The <tt>runOnBasicBlock</tt> method</a>
-</div>
-
-<div class="doc_text">
-
-<div class="doc_code"><pre>
-  <b>virtual bool</b> runOnBasicBlock(BasicBlock &amp;BB) = 0;
-</pre></div>
-
-<p>Override this function to do the work of the <tt>BasicBlockPass</tt>.  This
-function is not allowed to inspect or modify basic blocks other than the
-parameter, and are not allowed to modify the CFG.  A true value must be returned
-if the basic block is modified.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="doFinalization_fn">The <tt>doFinalization(Function &amp;)</tt> 
-  method</a>
-</div>
-
-<div class="doc_text">
-
-<div class="doc_code"><pre>
-  <b>virtual bool</b> doFinalization(Function &amp;F);
-</pre></div>
-
-<p>The <tt>doFinalization</tt> method is an infrequently used method that is
-called when the pass framework has finished calling <a
-href="#runOnBasicBlock"><tt>runOnBasicBlock</tt></a> for every BasicBlock in the
-program being compiled.  This can be used to perform per-function
-finalization.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsection">
-  <a name="MachineFunctionPass">The <tt>MachineFunctionPass</tt> class</a>
-</div>
-
-<div class="doc_text">
-
-<p>A <tt>MachineFunctionPass</tt> is a part of the LLVM code generator that
-executes on the machine-dependent representation of each LLVM function in the
-program.  A <tt>MachineFunctionPass</tt> is also a <tt>FunctionPass</tt>, so all
-the restrictions that apply to a <tt>FunctionPass</tt> also apply to it.
-<tt>MachineFunctionPass</tt>es also have additional restrictions. In particular,
-<tt>MachineFunctionPass</tt>es are not allowed to do any of the following:</p>
-
-<ol>
-<li>Modify any LLVM Instructions, BasicBlocks or Functions.</li>
-<li>Modify a MachineFunction other than the one currently being processed.</li>
-<li>Add or remove MachineFunctions from the current Module.</li>
-<li>Add or remove global variables from the current Module.</li>
-<li>Maintain state across invocations of <a
-href="#runOnMachineFunction"><tt>runOnMachineFunction</tt></a> (including global
-data)</li>
-</ol>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="runOnMachineFunction">The <tt>runOnMachineFunction(MachineFunction
-  &amp;MF)</tt> method</a>
-</div>
-
-<div class="doc_text">
-
-<div class="doc_code"><pre>
-  <b>virtual bool</b> runOnMachineFunction(MachineFunction &amp;MF) = 0;
-</pre></div>
-
-<p><tt>runOnMachineFunction</tt> can be considered the main entry point of a
-<tt>MachineFunctionPass</tt>; that is, you should override this method to do the
-work of your <tt>MachineFunctionPass</tt>.</p>
-
-<p>The <tt>runOnMachineFunction</tt> method is called on every
-<tt>MachineFunction</tt> in a <tt>Module</tt>, so that the
-<tt>MachineFunctionPass</tt> may perform optimizations on the machine-dependent
-representation of the function. If you want to get at the LLVM <tt>Function</tt>
-for the <tt>MachineFunction</tt> you're working on, use
-<tt>MachineFunction</tt>'s <tt>getFunction()</tt> accessor method -- but
-remember, you may not modify the LLVM <tt>Function</tt> or its contents from a
-<tt>MachineFunctionPass</tt>.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="registration">Pass registration</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>In the <a href="#basiccode">Hello World</a> example pass we illustrated how
-pass registration works, and discussed some of the reasons that it is used and
-what it does.  Here we discuss how and why passes are registered.</p>
-
-<p>As we saw above, passes are registered with the <b><tt>RegisterPass</tt></b>
-template, which requires you to pass at least two
-parameters.  The first parameter is the name of the pass that is to be used on
-the command line to specify that the pass should be added to a program (for
-example, with <tt>opt</tt> or <tt>bugpoint</tt>).  The second argument is the
-name of the pass, which is to be used for the <tt>--help</tt> output of
-programs, as
-well as for debug output generated by the <tt>--debug-pass</tt> option.</p>
-
-<p>If you want your pass to be easily dumpable, you should 
-implement the virtual <tt>print</tt> method:</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="print">The <tt>print</tt> method</a>
-</div>
-
-<div class="doc_text">
-
-<div class="doc_code"><pre>
-  <b>virtual void</b> print(std::ostream &amp;O, <b>const</b> Module *M) <b>const</b>;
-</pre></div>
-
-<p>The <tt>print</tt> method must be implemented by "analyses" in order to print
-a human readable version of the analysis results.  This is useful for debugging
-an analysis itself, as well as for other people to figure out how an analysis
-works.  Use the <tt>opt -analyze</tt> argument to invoke this method.</p>
-
-<p>The <tt>llvm::OStream</tt> parameter specifies the stream to write the results on,
-and the <tt>Module</tt> parameter gives a pointer to the top level module of the
-program that has been analyzed.  Note however that this pointer may be null in
-certain circumstances (such as calling the <tt>Pass::dump()</tt> from a
-debugger), so it should only be used to enhance debug output, it should not be
-depended on.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="interaction">Specifying interactions between passes</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>One of the main responsibilities of the <tt>PassManager</tt> is to make sure
-that passes interact with each other correctly.  Because <tt>PassManager</tt>
-tries to <a href="#passmanager">optimize the execution of passes</a> it must
-know how the passes interact with each other and what dependencies exist between
-the various passes.  To track this, each pass can declare the set of passes that
-are required to be executed before the current pass, and the passes which are
-invalidated by the current pass.</p>
-
-<p>Typically this functionality is used to require that analysis results are
-computed before your pass is run.  Running arbitrary transformation passes can
-invalidate the computed analysis results, which is what the invalidation set
-specifies.  If a pass does not implement the <tt><a
-href="#getAnalysisUsage">getAnalysisUsage</a></tt> method, it defaults to not
-having any prerequisite passes, and invalidating <b>all</b> other passes.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="getAnalysisUsage">The <tt>getAnalysisUsage</tt> method</a>
-</div>
-
-<div class="doc_text">
-
-<div class="doc_code"><pre>
-  <b>virtual void</b> getAnalysisUsage(AnalysisUsage &amp;Info) <b>const</b>;
-</pre></div>
-
-<p>By implementing the <tt>getAnalysisUsage</tt> method, the required and
-invalidated sets may be specified for your transformation.  The implementation
-should fill in the <tt><a
-href="http://llvm.org/doxygen/classllvm_1_1AnalysisUsage.html">AnalysisUsage</a></tt>
-object with information about which passes are required and not invalidated.  To
-do this, a pass may call any of the following methods on the AnalysisUsage
-object:</p>
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="AU::addRequired">The <tt>AnalysisUsage::addRequired&lt;&gt;</tt> and <tt>AnalysisUsage::addRequiredTransitive&lt;&gt;</tt> methods</a>
-</div>
-
-<div class="doc_text">
-<p>
-If your pass requires a previous pass to be executed (an analysis for example),
-it can use one of these methods to arrange for it to be run before your pass.
-LLVM has many different types of analyses and passes that can be required,
-spanning the range from <tt>DominatorSet</tt> to <tt>BreakCriticalEdges</tt>.
-Requiring <tt>BreakCriticalEdges</tt>, for example, guarantees that there will
-be no critical edges in the CFG when your pass has been run.
-</p>
-
-<p>
-Some analyses chain to other analyses to do their job.  For example, an <a
-href="AliasAnalysis.html">AliasAnalysis</a> implementation is required to <a
-href="AliasAnalysis.html#chaining">chain</a> to other alias analysis passes.  In
-cases where analyses chain, the <tt>addRequiredTransitive</tt> method should be
-used instead of the <tt>addRequired</tt> method.  This informs the PassManager
-that the transitively required pass should be alive as long as the requiring
-pass is.
-</p>
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="AU::addPreserved">The <tt>AnalysisUsage::addPreserved&lt;&gt;</tt> method</a>
-</div>
-
-<div class="doc_text">
-<p>
-One of the jobs of the PassManager is to optimize how and when analyses are run.
-In particular, it attempts to avoid recomputing data unless it needs to.  For
-this reason, passes are allowed to declare that they preserve (i.e., they don't
-invalidate) an existing analysis if it's available.  For example, a simple
-constant folding pass would not modify the CFG, so it can't possibly affect the
-results of dominator analysis.  By default, all passes are assumed to invalidate
-all others.
-</p>
-
-<p>
-The <tt>AnalysisUsage</tt> class provides several methods which are useful in
-certain circumstances that are related to <tt>addPreserved</tt>.  In particular,
-the <tt>setPreservesAll</tt> method can be called to indicate that the pass does
-not modify the LLVM program at all (which is true for analyses), and the
-<tt>setPreservesCFG</tt> method can be used by transformations that change
-instructions in the program but do not modify the CFG or terminator instructions
-(note that this property is implicitly set for <a
-href="#BasicBlockPass">BasicBlockPass</a>'s).
-</p>
-
-<p>
-<tt>addPreserved</tt> is particularly useful for transformations like
-<tt>BreakCriticalEdges</tt>.  This pass knows how to update a small set of loop
-and dominator related analyses if they exist, so it can preserve them, despite
-the fact that it hacks on the CFG.
-</p>
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="AU::examples">Example implementations of <tt>getAnalysisUsage</tt></a>
-</div>
-
-<div class="doc_text">
-
-<div class="doc_code"><pre>
-  <i>// This is an example implementation from an analysis, which does not modify
-  // the program at all, yet has a prerequisite.</i>
-  <b>void</b> <a href="http://llvm.org/doxygen/classllvm_1_1PostDominanceFrontier.html">PostDominanceFrontier</a>::getAnalysisUsage(AnalysisUsage &amp;AU) <b>const</b> {
-    AU.setPreservesAll();
-    AU.addRequired&lt;<a href="http://llvm.org/doxygen/classllvm_1_1PostDominatorTree.html">PostDominatorTree</a>&gt;();
-  }
-</pre></div>
-
-<p>and:</p>
-
-<div class="doc_code"><pre>
-  <i>// This example modifies the program, but does not modify the CFG</i>
-  <b>void</b> <a href="http://llvm.org/doxygen/structLICM.html">LICM</a>::getAnalysisUsage(AnalysisUsage &amp;AU) <b>const</b> {
-    AU.setPreservesCFG();
-    AU.addRequired&lt;<a href="http://llvm.org/doxygen/classllvm_1_1LoopInfo.html">LoopInfo</a>&gt;();
-  }
-</pre></div>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="getAnalysis">The <tt>getAnalysis&lt;&gt;</tt> and
-<tt>getAnalysisIfAvailable&lt;&gt;</tt> methods</a>
-</div>
-
-<div class="doc_text">
-
-<p>The <tt>Pass::getAnalysis&lt;&gt;</tt> method is automatically inherited by
-your class, providing you with access to the passes that you declared that you
-required with the <a href="#getAnalysisUsage"><tt>getAnalysisUsage</tt></a>
-method.  It takes a single template argument that specifies which pass class you
-want, and returns a reference to that pass.  For example:</p>
-
-<div class="doc_code"><pre>
-   bool LICM::runOnFunction(Function &amp;F) {
-     LoopInfo &amp;LI = getAnalysis&lt;LoopInfo&gt;();
-     ...
-   }
-</pre></div>
-
-<p>This method call returns a reference to the pass desired.  You may get a
-runtime assertion failure if you attempt to get an analysis that you did not
-declare as required in your <a
-href="#getAnalysisUsage"><tt>getAnalysisUsage</tt></a> implementation.  This
-method can be called by your <tt>run*</tt> method implementation, or by any
-other local method invoked by your <tt>run*</tt> method.
-
-A module level pass can use function level analysis info using this interface.
-For example:</p>
-
-<div class="doc_code"><pre>
-   bool ModuleLevelPass::runOnModule(Module &amp;M) {
-     ...
-     DominatorTree &amp;DT = getAnalysis&lt;DominatorTree&gt;(Func);
-     ...
-   }
-</pre></div>
-
-<p>In above example, runOnFunction for DominatorTree is called by pass manager
-before returning a reference to the desired pass.</p>
-
-<p>
-If your pass is capable of updating analyses if they exist (e.g.,
-<tt>BreakCriticalEdges</tt>, as described above), you can use the
-<tt>getAnalysisIfAvailable</tt> method, which returns a pointer to the analysis
-if it is active.  For example:</p>
-
-<div class="doc_code"><pre>
-  ...
-  if (DominatorSet *DS = getAnalysisIfAvailable&lt;DominatorSet&gt;()) {
-    <i>// A DominatorSet is active.  This code will update it.</i>
-  }
-  ...
-</pre></div>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="analysisgroup">Implementing Analysis Groups</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>Now that we understand the basics of how passes are defined, how they are
-used, and how they are required from other passes, it's time to get a little bit
-fancier.  All of the pass relationships that we have seen so far are very
-simple: one pass depends on one other specific pass to be run before it can run.
-For many applications, this is great, for others, more flexibility is
-required.</p>
-
-<p>In particular, some analyses are defined such that there is a single simple
-interface to the analysis results, but multiple ways of calculating them.
-Consider alias analysis for example.  The most trivial alias analysis returns
-"may alias" for any alias query.  The most sophisticated analysis a
-flow-sensitive, context-sensitive interprocedural analysis that can take a
-significant amount of time to execute (and obviously, there is a lot of room
-between these two extremes for other implementations).  To cleanly support
-situations like this, the LLVM Pass Infrastructure supports the notion of
-Analysis Groups.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="agconcepts">Analysis Group Concepts</a>
-</div>
-
-<div class="doc_text">
-
-<p>An Analysis Group is a single simple interface that may be implemented by
-multiple different passes.  Analysis Groups can be given human readable names
-just like passes, but unlike passes, they need not derive from the <tt>Pass</tt>
-class.  An analysis group may have one or more implementations, one of which is
-the "default" implementation.</p>
-
-<p>Analysis groups are used by client passes just like other passes are: the
-<tt>AnalysisUsage::addRequired()</tt> and <tt>Pass::getAnalysis()</tt> methods.
-In order to resolve this requirement, the <a href="#passmanager">PassManager</a>
-scans the available passes to see if any implementations of the analysis group
-are available.  If none is available, the default implementation is created for
-the pass to use.  All standard rules for <A href="#interaction">interaction
-between passes</a> still apply.</p>
-
-<p>Although <a href="#registration">Pass Registration</a> is optional for normal
-passes, all analysis group implementations must be registered, and must use the
-<A href="#registerag"><tt>RegisterAnalysisGroup</tt></a> template to join the
-implementation pool.  Also, a default implementation of the interface
-<b>must</b> be registered with <A
-href="#registerag"><tt>RegisterAnalysisGroup</tt></a>.</p>
-
-<p>As a concrete example of an Analysis Group in action, consider the <a
-href="http://llvm.org/doxygen/classllvm_1_1AliasAnalysis.html">AliasAnalysis</a>
-analysis group.  The default implementation of the alias analysis interface (the
-<tt><a
-href="http://llvm.org/doxygen/structBasicAliasAnalysis.html">basicaa</a></tt>
-pass) just does a few simple checks that don't require significant analysis to
-compute (such as: two different globals can never alias each other, etc).
-Passes that use the <tt><a
-href="http://llvm.org/doxygen/classllvm_1_1AliasAnalysis.html">AliasAnalysis</a></tt>
-interface (for example the <tt><a
-href="http://llvm.org/doxygen/structGCSE.html">gcse</a></tt> pass), do
-not care which implementation of alias analysis is actually provided, they just
-use the designated interface.</p>
-
-<p>From the user's perspective, commands work just like normal.  Issuing the
-command '<tt>opt -gcse ...</tt>' will cause the <tt>basicaa</tt> class to be
-instantiated and added to the pass sequence.  Issuing the command '<tt>opt
--somefancyaa -gcse ...</tt>' will cause the <tt>gcse</tt> pass to use the
-<tt>somefancyaa</tt> alias analysis (which doesn't actually exist, it's just a
-hypothetical example) instead.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="registerag">Using <tt>RegisterAnalysisGroup</tt></a>
-</div>
-
-<div class="doc_text">
-
-<p>The <tt>RegisterAnalysisGroup</tt> template is used to register the analysis
-group itself as well as add pass implementations to the analysis group.  First,
-an analysis should be registered, with a human readable name provided for it.
-Unlike registration of passes, there is no command line argument to be specified
-for the Analysis Group Interface itself, because it is "abstract":</p>
-
-<div class="doc_code"><pre>
-  <b>static</b> RegisterAnalysisGroup&lt;<a href="http://llvm.org/doxygen/classllvm_1_1AliasAnalysis.html">AliasAnalysis</a>&gt; A("<i>Alias Analysis</i>");
-</pre></div>
-
-<p>Once the analysis is registered, passes can declare that they are valid
-implementations of the interface by using the following code:</p>
-
-<div class="doc_code"><pre>
-<b>namespace</b> {
-  //<i> Analysis Group implementations <b>must</b> be registered normally...</i>
-  RegisterPass&lt;FancyAA&gt;
-  B("<i>somefancyaa</i>", "<i>A more complex alias analysis implementation</i>");
-
-  //<i> Declare that we implement the AliasAnalysis interface</i>
-  RegisterAnalysisGroup&lt;<a href="http://llvm.org/doxygen/classllvm_1_1AliasAnalysis.html">AliasAnalysis</a>&gt; C(B);
-}
-</pre></div>
-
-<p>This just shows a class <tt>FancyAA</tt> that is registered normally, then
-uses the <tt>RegisterAnalysisGroup</tt> template to "join" the <tt><a
-href="http://llvm.org/doxygen/classllvm_1_1AliasAnalysis.html">AliasAnalysis</a></tt>
-analysis group.  Every implementation of an analysis group should join using
-this template.  A single pass may join multiple different analysis groups with
-no problem.</p>
-
-<div class="doc_code"><pre>
-<b>namespace</b> {
-  //<i> Analysis Group implementations <b>must</b> be registered normally...</i>
-  RegisterPass&lt;<a href="http://llvm.org/doxygen/structBasicAliasAnalysis.html">BasicAliasAnalysis</a>&gt;
-  D("<i>basicaa</i>", "<i>Basic Alias Analysis (default AA impl)</i>");
-
-  //<i> Declare that we implement the AliasAnalysis interface</i>
-  RegisterAnalysisGroup&lt;<a href="http://llvm.org/doxygen/classllvm_1_1AliasAnalysis.html">AliasAnalysis</a>, <b>true</b>&gt; E(D);
-}
-</pre></div>
-
-<p>Here we show how the default implementation is specified (using the extra
-argument to the <tt>RegisterAnalysisGroup</tt> template).  There must be exactly
-one default implementation available at all times for an Analysis Group to be
-used.  Only default implementation can derive from <tt>ImmutablePass</tt>. 
-Here we declare that the
- <tt><a href="http://llvm.org/doxygen/structBasicAliasAnalysis.html">BasicAliasAnalysis</a></tt>
-pass is the default implementation for the interface.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="passStatistics">Pass Statistics</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-<p>The <a
-href="http://llvm.org/doxygen/Statistic_8h-source.html"><tt>Statistic</tt></a>
-class is designed to be an easy way to expose various success
-metrics from passes.  These statistics are printed at the end of a
-run, when the -stats command line option is enabled on the command
-line. See the <a href="http://llvm.org/docs/ProgrammersManual.html#Statistic">Statistics section</a> in the Programmer's Manual for details. 
-
-</div>
-
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="passmanager">What PassManager does</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>The <a
-href="http://llvm.org/doxygen/PassManager_8h-source.html"><tt>PassManager</tt></a>
-<a
-href="http://llvm.org/doxygen/classllvm_1_1PassManager.html">class</a>
-takes a list of passes, ensures their <a href="#interaction">prerequisites</a>
-are set up correctly, and then schedules passes to run efficiently.  All of the
-LLVM tools that run passes use the <tt>PassManager</tt> for execution of these
-passes.</p>
-
-<p>The <tt>PassManager</tt> does two main things to try to reduce the execution
-time of a series of passes:</p>
-
-<ol>
-<li><b>Share analysis results</b> - The PassManager attempts to avoid
-recomputing analysis results as much as possible.  This means keeping track of
-which analyses are available already, which analyses get invalidated, and which
-analyses are needed to be run for a pass.  An important part of work is that the
-<tt>PassManager</tt> tracks the exact lifetime of all analysis results, allowing
-it to <a href="#releaseMemory">free memory</a> allocated to holding analysis
-results as soon as they are no longer needed.</li>
-
-<li><b>Pipeline the execution of passes on the program</b> - The
-<tt>PassManager</tt> attempts to get better cache and memory usage behavior out
-of a series of passes by pipelining the passes together.  This means that, given
-a series of consequtive <a href="#FunctionPass"><tt>FunctionPass</tt></a>'s, it
-will execute all of the <a href="#FunctionPass"><tt>FunctionPass</tt></a>'s on
-the first function, then all of the <a
-href="#FunctionPass"><tt>FunctionPass</tt></a>es on the second function,
-etc... until the entire program has been run through the passes.
-
-<p>This improves the cache behavior of the compiler, because it is only touching
-the LLVM program representation for a single function at a time, instead of
-traversing the entire program.  It reduces the memory consumption of compiler,
-because, for example, only one <a
-href="http://llvm.org/doxygen/classllvm_1_1DominatorSet.html"><tt>DominatorSet</tt></a>
-needs to be calculated at a time.  This also makes it possible to implement
-some <a
-href="#SMP">interesting enhancements</a> in the future.</p></li>
-
-</ol>
-
-<p>The effectiveness of the <tt>PassManager</tt> is influenced directly by how
-much information it has about the behaviors of the passes it is scheduling.  For
-example, the "preserved" set is intentionally conservative in the face of an
-unimplemented <a href="#getAnalysisUsage"><tt>getAnalysisUsage</tt></a> method.
-Not implementing when it should be implemented will have the effect of not
-allowing any analysis results to live across the execution of your pass.</p>
-
-<p>The <tt>PassManager</tt> class exposes a <tt>--debug-pass</tt> command line
-options that is useful for debugging pass execution, seeing how things work, and
-diagnosing when you should be preserving more analyses than you currently are
-(To get information about all of the variants of the <tt>--debug-pass</tt>
-option, just type '<tt>opt --help-hidden</tt>').</p>
-
-<p>By using the <tt>--debug-pass=Structure</tt> option, for example, we can see
-how our <a href="#basiccode">Hello World</a> pass interacts with other passes.
-Lets try it out with the <tt>gcse</tt> and <tt>licm</tt> passes:</p>
-
-<div class="doc_code"><pre>
-$ opt -load ../../../Debug/lib/Hello.so -gcse -licm --debug-pass=Structure &lt; hello.bc &gt; /dev/null
-Module Pass Manager
-  Function Pass Manager
-    Dominator Set Construction
-    Immediate Dominators Construction
-    Global Common Subexpression Elimination
---  Immediate Dominators Construction
---  Global Common Subexpression Elimination
-    Natural Loop Construction
-    Loop Invariant Code Motion
---  Natural Loop Construction
---  Loop Invariant Code Motion
-    Module Verifier
---  Dominator Set Construction
---  Module Verifier
-  Bitcode Writer
---Bitcode Writer
-</pre></div>
-
-<p>This output shows us when passes are constructed and when the analysis
-results are known to be dead (prefixed with '<tt>--</tt>').  Here we see that
-GCSE uses dominator and immediate dominator information to do its job.  The LICM
-pass uses natural loop information, which uses dominator sets, but not immediate
-dominators.  Because immediate dominators are no longer useful after the GCSE
-pass, it is immediately destroyed.  The dominator sets are then reused to
-compute natural loop information, which is then used by the LICM pass.</p>
-
-<p>After the LICM pass, the module verifier runs (which is automatically added
-by the '<tt>opt</tt>' tool), which uses the dominator set to check that the
-resultant LLVM code is well formed.  After it finishes, the dominator set
-information is destroyed, after being computed once, and shared by three
-passes.</p>
-
-<p>Lets see how this changes when we run the <a href="#basiccode">Hello
-World</a> pass in between the two passes:</p>
-
-<div class="doc_code"><pre>
-$ opt -load ../../../Debug/lib/Hello.so -gcse -hello -licm --debug-pass=Structure &lt; hello.bc &gt; /dev/null
-Module Pass Manager
-  Function Pass Manager
-    Dominator Set Construction
-    Immediate Dominators Construction
-    Global Common Subexpression Elimination
-<b>--  Dominator Set Construction</b>
---  Immediate Dominators Construction
---  Global Common Subexpression Elimination
-<b>    Hello World Pass
---  Hello World Pass
-    Dominator Set Construction</b>
-    Natural Loop Construction
-    Loop Invariant Code Motion
---  Natural Loop Construction
---  Loop Invariant Code Motion
-    Module Verifier
---  Dominator Set Construction
---  Module Verifier
-  Bitcode Writer
---Bitcode Writer
-Hello: __main
-Hello: puts
-Hello: main
-</pre></div>
-
-<p>Here we see that the <a href="#basiccode">Hello World</a> pass has killed the
-Dominator Set pass, even though it doesn't modify the code at all!  To fix this,
-we need to add the following <a
-href="#getAnalysisUsage"><tt>getAnalysisUsage</tt></a> method to our pass:</p>
-
-<div class="doc_code"><pre>
-    <i>// We don't modify the program, so we preserve all analyses</i>
-    <b>virtual void</b> getAnalysisUsage(AnalysisUsage &amp;AU) <b>const</b> {
-      AU.setPreservesAll();
-    }
-</pre></div>
-
-<p>Now when we run our pass, we get this output:</p>
-
-<div class="doc_code"><pre>
-$ opt -load ../../../Debug/lib/Hello.so -gcse -hello -licm --debug-pass=Structure &lt; hello.bc &gt; /dev/null
-Pass Arguments:  -gcse -hello -licm
-Module Pass Manager
-  Function Pass Manager
-    Dominator Set Construction
-    Immediate Dominators Construction
-    Global Common Subexpression Elimination
---  Immediate Dominators Construction
---  Global Common Subexpression Elimination
-    Hello World Pass
---  Hello World Pass
-    Natural Loop Construction
-    Loop Invariant Code Motion
---  Loop Invariant Code Motion
---  Natural Loop Construction
-    Module Verifier
---  Dominator Set Construction
---  Module Verifier
-  Bitcode Writer
---Bitcode Writer
-Hello: __main
-Hello: puts
-Hello: main
-</pre></div>
-
-<p>Which shows that we don't accidentally invalidate dominator information
-anymore, and therefore do not have to compute it twice.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="releaseMemory">The <tt>releaseMemory</tt> method</a>
-</div>
-
-<div class="doc_text">
-
-<div class="doc_code"><pre>
-  <b>virtual void</b> releaseMemory();
-</pre></div>
-
-<p>The <tt>PassManager</tt> automatically determines when to compute analysis
-results, and how long to keep them around for.  Because the lifetime of the pass
-object itself is effectively the entire duration of the compilation process, we
-need some way to free analysis results when they are no longer useful.  The
-<tt>releaseMemory</tt> virtual method is the way to do this.</p>
-
-<p>If you are writing an analysis or any other pass that retains a significant
-amount of state (for use by another pass which "requires" your pass and uses the
-<a href="#getAnalysis">getAnalysis</a> method) you should implement
-<tt>releaseMemory</tt> to, well, release the memory allocated to maintain this
-internal state.  This method is called after the <tt>run*</tt> method for the
-class, before the next call of <tt>run*</tt> in your pass.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="registering">Registering dynamically loaded passes</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p><i>Size matters</i> when constructing production quality tools using llvm, 
-both for the purposes of distribution, and for regulating the resident code size
-when running on the target system. Therefore, it becomes desirable to
-selectively use some passes, while omitting others and maintain the flexibility
-to change configurations later on. You want to be able to do all this, and,
-provide feedback to the user. This is where pass registration comes into
-play.</p>
-
-<p>The fundamental mechanisms for pass registration are the
-<tt>MachinePassRegistry</tt> class and subclasses of
-<tt>MachinePassRegistryNode</tt>.</p>
-
-<p>An instance of <tt>MachinePassRegistry</tt> is used to maintain a list of
-<tt>MachinePassRegistryNode</tt> objects.  This instance maintains the list and
-communicates additions and deletions to the command line interface.</p>
-
-<p>An instance of <tt>MachinePassRegistryNode</tt> subclass is used to maintain
-information provided about a particular pass.  This information includes the
-command line name, the command help string and the address of the function used
-to create an instance of the pass.  A global static constructor of one of these
-instances <i>registers</i> with a corresponding <tt>MachinePassRegistry</tt>,
-the static destructor <i>unregisters</i>. Thus a pass that is statically linked
-in the tool will be registered at start up. A dynamically loaded pass will
-register on load and unregister at unload.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsection">
-  <a name="registering_existing">Using existing registries</a>
-</div>
-
-<div class="doc_text">
-
-<p>There are predefined registries to track instruction scheduling
-(<tt>RegisterScheduler</tt>) and register allocation (<tt>RegisterRegAlloc</tt>)
-machine passes.  Here we will describe how to <i>register</i> a register
-allocator machine pass.</p>
-
-<p>Implement your register allocator machine pass.  In your register allocator
-.cpp file add the following include;</p>
-
-<div class="doc_code"><pre>
-  #include "llvm/CodeGen/RegAllocRegistry.h"
-</pre></div>
-
-<p>Also in your register allocator .cpp file, define a creator function in the
-form; </p>
-
-<div class="doc_code"><pre>
-  FunctionPass *createMyRegisterAllocator() {
-    return new MyRegisterAllocator();
-  }
-</pre></div>
-
-<p>Note that the signature of this function should match the type of
-<tt>RegisterRegAlloc::FunctionPassCtor</tt>.  In the same file add the
-"installing" declaration, in the form;</p>
-
-<div class="doc_code"><pre>
-  static RegisterRegAlloc myRegAlloc("myregalloc",
-    "  my register allocator help string",
-    createMyRegisterAllocator);
-</pre></div>
-
-<p>Note the two spaces prior to the help string produces a tidy result on the
---help query.</p>
-
-<div class="doc_code"><pre>
-$ llc --help
-  ...
-  -regalloc                    - Register allocator to use: (default = linearscan)
-    =linearscan                -   linear scan register allocator
-    =local                     -   local register allocator
-    =simple                    -   simple register allocator
-    =myregalloc                -   my register allocator help string
-  ...
-</pre></div>
-
-<p>And that's it.  The user is now free to use <tt>-regalloc=myregalloc</tt> as
-an option.  Registering instruction schedulers is similar except use the
-<tt>RegisterScheduler</tt> class.  Note that the
-<tt>RegisterScheduler::FunctionPassCtor</tt> is significantly different from
-<tt>RegisterRegAlloc::FunctionPassCtor</tt>.</p>
-
-<p>To force the load/linking of your register allocator into the llc/lli tools,
-add your creator function's global declaration to "Passes.h" and add a "pseudo"
-call line to <tt>llvm/Codegen/LinkAllCodegenComponents.h</tt>.</p>
-
-</div>
-
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsection">
-  <a name="registering_new">Creating new registries</a>
-</div>
-
-<div class="doc_text">
-
-<p>The easiest way to get started is to clone one of the existing registries; we
-recommend <tt>llvm/CodeGen/RegAllocRegistry.h</tt>.  The key things to modify
-are the class name and the <tt>FunctionPassCtor</tt> type.</p>
-
-<p>Then you need to declare the registry.  Example: if your pass registry is
-<tt>RegisterMyPasses</tt> then define;</p>
-
-<div class="doc_code"><pre>
-MachinePassRegistry RegisterMyPasses::Registry;
-</pre></div>
-
-<p>And finally, declare the command line option for your passes.  Example:</p> 
-
-<div class="doc_code"><pre>
-  cl::opt&lt;RegisterMyPasses::FunctionPassCtor, false,
-          RegisterPassParser&lt;RegisterMyPasses&gt; &gt;
-  MyPassOpt("mypass",
-            cl::init(&amp;createDefaultMyPass),
-            cl::desc("my pass option help")); 
-</pre></div>
-
-<p>Here the command option is "mypass", with createDefaultMyPass as the default
-creator.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="debughints">Using GDB with dynamically loaded passes</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>Unfortunately, using GDB with dynamically loaded passes is not as easy as it
-should be.  First of all, you can't set a breakpoint in a shared object that has
-not been loaded yet, and second of all there are problems with inlined functions
-in shared objects.  Here are some suggestions to debugging your pass with
-GDB.</p>
-
-<p>For sake of discussion, I'm going to assume that you are debugging a
-transformation invoked by <tt>opt</tt>, although nothing described here depends
-on that.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="breakpoint">Setting a breakpoint in your pass</a>
-</div>
-
-<div class="doc_text">
-
-<p>First thing you do is start <tt>gdb</tt> on the <tt>opt</tt> process:</p>
-
-<div class="doc_code"><pre>
-$ <b>gdb opt</b>
-GNU gdb 5.0
-Copyright 2000 Free Software Foundation, Inc.
-GDB is free software, covered by the GNU General Public License, and you are
-welcome to change it and/or distribute copies of it under certain conditions.
-Type "show copying" to see the conditions.
-There is absolutely no warranty for GDB.  Type "show warranty" for details.
-This GDB was configured as "sparc-sun-solaris2.6"...
-(gdb)
-</pre></div>
-
-<p>Note that <tt>opt</tt> has a lot of debugging information in it, so it takes
-time to load.  Be patient.  Since we cannot set a breakpoint in our pass yet
-(the shared object isn't loaded until runtime), we must execute the process, and
-have it stop before it invokes our pass, but after it has loaded the shared
-object.  The most foolproof way of doing this is to set a breakpoint in
-<tt>PassManager::run</tt> and then run the process with the arguments you
-want:</p>
-
-<div class="doc_code"><pre>
-(gdb) <b>break llvm::PassManager::run</b>
-Breakpoint 1 at 0x2413bc: file Pass.cpp, line 70.
-(gdb) <b>run test.bc -load $(LLVMTOP)/llvm/Debug/lib/[libname].so -[passoption]</b>
-Starting program: opt test.bc -load $(LLVMTOP)/llvm/Debug/lib/[libname].so -[passoption]
-Breakpoint 1, PassManager::run (this=0xffbef174, M=@0x70b298) at Pass.cpp:70
-70      bool PassManager::run(Module &amp;M) { return PM-&gt;run(M); }
-(gdb)
-</pre></div>
-
-<p>Once the <tt>opt</tt> stops in the <tt>PassManager::run</tt> method you are
-now free to set breakpoints in your pass so that you can trace through execution
-or do other standard debugging stuff.</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="debugmisc">Miscellaneous Problems</a>
-</div>
-
-<div class="doc_text">
-
-<p>Once you have the basics down, there are a couple of problems that GDB has,
-some with solutions, some without.</p>
-
-<ul>
-<li>Inline functions have bogus stack information.  In general, GDB does a
-pretty good job getting stack traces and stepping through inline functions.
-When a pass is dynamically loaded however, it somehow completely loses this
-capability.  The only solution I know of is to de-inline a function (move it
-from the body of a class to a .cpp file).</li>
-
-<li>Restarting the program breaks breakpoints.  After following the information
-above, you have succeeded in getting some breakpoints planted in your pass.  Nex
-thing you know, you restart the program (i.e., you type '<tt>run</tt>' again),
-and you start getting errors about breakpoints being unsettable.  The only way I
-have found to "fix" this problem is to <tt>delete</tt> the breakpoints that are
-already set in your pass, run the program, and re-set the breakpoints once
-execution stops in <tt>PassManager::run</tt>.</li>
-
-</ul>
-
-<p>Hopefully these tips will help with common case debugging situations.  If
-you'd like to contribute some tips of your own, just contact <a
-href="mailto:sabre at nondot.org">Chris</a>.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section">
-  <a name="future">Future extensions planned</a>
-</div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>Although the LLVM Pass Infrastructure is very capable as it stands, and does
-some nifty stuff, there are things we'd like to add in the future.  Here is
-where we are going:</p>
-
-</div>
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-  <a name="SMP">Multithreaded LLVM</a>
-</div>
-
-<div class="doc_text">
-
-<p>Multiple CPU machines are becoming more common and compilation can never be
-fast enough: obviously we should allow for a multithreaded compiler.  Because of
-the semantics defined for passes above (specifically they cannot maintain state
-across invocations of their <tt>run*</tt> methods), a nice clean way to
-implement a multithreaded compiler would be for the <tt>PassManager</tt> class
-to create multiple instances of each pass object, and allow the separate
-instances to be hacking on different parts of the program at the same time.</p>
-
-<p>This implementation would prevent each of the passes from having to implement
-multithreaded constructs, requiring only the LLVM core to have locking in a few
-places (for global resources).  Although this is a simple extension, we simply
-haven't had time (or multiprocessor machines, thus a reason) to implement this.
-Despite that, we have kept the LLVM passes SMP ready, and you should too.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<hr>
-<address>
-  <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
-  src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS"></a>
-  <a href="http://validator.w3.org/check/referer"><img
-  src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
-
-  <a href="mailto:sabre at nondot.org">Chris Lattner</a><br>
-  <a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
-  Last modified: $Date$
-</address>
-
-</body>
-</html>
diff --git a/libclamav/c++/llvm/docs/doxygen.cfg.in b/libclamav/c++/llvm/docs/doxygen.cfg.in
deleted file mode 100644
index 45b8f42..0000000
--- a/libclamav/c++/llvm/docs/doxygen.cfg.in
+++ /dev/null
@@ -1,1419 +0,0 @@
-# Doxyfile 1.5.6
-
-# This file describes the settings to be used by the documentation system
-# doxygen (www.doxygen.org) for a project
-#
-# All text after a hash (#) is considered a comment and will be ignored
-# The format is:
-#       TAG = value [value, ...]
-# For lists items can also be appended using:
-#       TAG += value [value, ...]
-# Values that contain spaces should be placed between quotes (" ")
-
-#---------------------------------------------------------------------------
-# Project related configuration options 
-#---------------------------------------------------------------------------
-
-# This tag specifies the encoding used for all characters in the config file 
-# that follow. The default is UTF-8 which is also the encoding used for all 
-# text before the first occurrence of this tag. Doxygen uses libiconv (or the 
-# iconv built into libc) for the transcoding. See 
-# http://www.gnu.org/software/libiconv for the list of possible encodings.
-
-DOXYFILE_ENCODING      = UTF-8
-
-# The PROJECT_NAME tag is a single word (or a sequence of words surrounded 
-# by quotes) that should identify the project.
-
-PROJECT_NAME           = LLVM
-
-# The PROJECT_NUMBER tag can be used to enter a project or revision number. 
-# This could be handy for archiving the generated documentation or 
-# if some version control system is used.
-
-PROJECT_NUMBER         = @PACKAGE_VERSION@
-
-# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) 
-# base path where the generated documentation will be put. 
-# If a relative path is entered, it will be relative to the location 
-# where doxygen was started. If left blank the current directory will be used.
-
-OUTPUT_DIRECTORY       = @abs_top_builddir@/docs/doxygen
-
-# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 
-# 4096 sub-directories (in 2 levels) under the output directory of each output 
-# format and will distribute the generated files over these directories. 
-# Enabling this option can be useful when feeding doxygen a huge amount of 
-# source files, where putting all generated files in the same directory would 
-# otherwise cause performance problems for the file system.
-
-CREATE_SUBDIRS         = NO
-
-# The OUTPUT_LANGUAGE tag is used to specify the language in which all 
-# documentation generated by doxygen is written. Doxygen will use this 
-# information to generate all constant output in the proper language. 
-# The default language is English, other supported languages are: 
-# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, 
-# Croatian, Czech, Danish, Dutch, Farsi, Finnish, French, German, Greek, 
-# Hungarian, Italian, Japanese, Japanese-en (Japanese with English messages), 
-# Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, Polish, 
-# Portuguese, Romanian, Russian, Serbian, Slovak, Slovene, Spanish, Swedish, 
-# and Ukrainian.
-
-OUTPUT_LANGUAGE        = English
-
-# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will 
-# include brief member descriptions after the members that are listed in 
-# the file and class documentation (similar to JavaDoc). 
-# Set to NO to disable this.
-
-BRIEF_MEMBER_DESC      = YES
-
-# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend 
-# the brief description of a member or function before the detailed description. 
-# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the 
-# brief descriptions will be completely suppressed.
-
-REPEAT_BRIEF           = YES
-
-# This tag implements a quasi-intelligent brief description abbreviator 
-# that is used to form the text in various listings. Each string 
-# in this list, if found as the leading text of the brief description, will be 
-# stripped from the text and the result after processing the whole list, is 
-# used as the annotated text. Otherwise, the brief description is used as-is. 
-# If left blank, the following values are used ("$name" is automatically 
-# replaced with the name of the entity): "The $name class" "The $name widget" 
-# "The $name file" "is" "provides" "specifies" "contains" 
-# "represents" "a" "an" "the"
-
-ABBREVIATE_BRIEF       = 
-
-# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then 
-# Doxygen will generate a detailed section even if there is only a brief 
-# description.
-
-ALWAYS_DETAILED_SEC    = NO
-
-# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all 
-# inherited members of a class in the documentation of that class as if those 
-# members were ordinary class members. Constructors, destructors and assignment 
-# operators of the base classes will not be shown.
-
-INLINE_INHERITED_MEMB  = NO
-
-# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full 
-# path before files name in the file list and in the header files. If set 
-# to NO the shortest path that makes the file name unique will be used.
-
-FULL_PATH_NAMES        = NO
-
-# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag 
-# can be used to strip a user-defined part of the path. Stripping is 
-# only done if one of the specified strings matches the left-hand part of 
-# the path. The tag can be used to show relative paths in the file list. 
-# If left blank the directory from which doxygen is run is used as the 
-# path to strip.
-
-STRIP_FROM_PATH        = ../..
-
-# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of 
-# the path mentioned in the documentation of a class, which tells 
-# the reader which header file to include in order to use a class. 
-# If left blank only the name of the header file containing the class 
-# definition is used. Otherwise one should specify the include paths that 
-# are normally passed to the compiler using the -I flag.
-
-STRIP_FROM_INC_PATH    = 
-
-# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter 
-# (but less readable) file names. This can be useful is your file systems 
-# doesn't support long names like on DOS, Mac, or CD-ROM.
-
-SHORT_NAMES            = NO
-
-# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen 
-# will interpret the first line (until the first dot) of a JavaDoc-style 
-# comment as the brief description. If set to NO, the JavaDoc 
-# comments will behave just like regular Qt-style comments 
-# (thus requiring an explicit @brief command for a brief description.)
-
-JAVADOC_AUTOBRIEF      = NO
-
-# If the QT_AUTOBRIEF tag is set to YES then Doxygen will 
-# interpret the first line (until the first dot) of a Qt-style 
-# comment as the brief description. If set to NO, the comments 
-# will behave just like regular Qt-style comments (thus requiring 
-# an explicit \brief command for a brief description.)
-
-QT_AUTOBRIEF           = NO
-
-# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen 
-# treat a multi-line C++ special comment block (i.e. a block of //! or /// 
-# comments) as a brief description. This used to be the default behaviour. 
-# The new default is to treat a multi-line C++ comment block as a detailed 
-# description. Set this tag to YES if you prefer the old behaviour instead.
-
-MULTILINE_CPP_IS_BRIEF = NO
-
-# If the DETAILS_AT_TOP tag is set to YES then Doxygen 
-# will output the detailed description near the top, like JavaDoc.
-# If set to NO, the detailed description appears after the member 
-# documentation.
-
-DETAILS_AT_TOP         = NO
-
-# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented 
-# member inherits the documentation from any documented member that it 
-# re-implements.
-
-INHERIT_DOCS           = YES
-
-# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce 
-# a new page for each member. If set to NO, the documentation of a member will 
-# be part of the file/class/namespace that contains it.
-
-SEPARATE_MEMBER_PAGES  = NO
-
-# The TAB_SIZE tag can be used to set the number of spaces in a tab. 
-# Doxygen uses this value to replace tabs by spaces in code fragments.
-
-TAB_SIZE               = 2
-
-# This tag can be used to specify a number of aliases that acts 
-# as commands in the documentation. An alias has the form "name=value". 
-# For example adding "sideeffect=\par Side Effects:\n" will allow you to 
-# put the command \sideeffect (or @sideeffect) in the documentation, which 
-# will result in a user-defined paragraph with heading "Side Effects:". 
-# You can put \n's in the value part of an alias to insert newlines.
-
-ALIASES                = 
-
-# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C 
-# sources only. Doxygen will then generate output that is more tailored for C. 
-# For instance, some of the names that are used will be different. The list 
-# of all members will be omitted, etc.
-
-OPTIMIZE_OUTPUT_FOR_C  = NO
-
-# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java 
-# sources only. Doxygen will then generate output that is more tailored for 
-# Java. For instance, namespaces will be presented as packages, qualified 
-# scopes will look different, etc.
-
-OPTIMIZE_OUTPUT_JAVA   = NO
-
-# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran 
-# sources only. Doxygen will then generate output that is more tailored for 
-# Fortran.
-
-OPTIMIZE_FOR_FORTRAN   = NO
-
-# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL 
-# sources. Doxygen will then generate output that is tailored for 
-# VHDL.
-
-OPTIMIZE_OUTPUT_VHDL   = NO
-
-# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want 
-# to include (a tag file for) the STL sources as input, then you should 
-# set this tag to YES in order to let doxygen match functions declarations and 
-# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. 
-# func(std::string) {}). This also make the inheritance and collaboration 
-# diagrams that involve STL classes more complete and accurate.
-
-BUILTIN_STL_SUPPORT    = NO
-
-# If you use Microsoft's C++/CLI language, you should set this option to YES to
-# enable parsing support.
-
-CPP_CLI_SUPPORT        = NO
-
-# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. 
-# Doxygen will parse them like normal C++ but will assume all classes use public 
-# instead of private inheritance when no explicit protection keyword is present.
-
-SIP_SUPPORT            = NO
-
-# For Microsoft's IDL there are propget and propput attributes to indicate getter 
-# and setter methods for a property. Setting this option to YES (the default) 
-# will make doxygen to replace the get and set methods by a property in the 
-# documentation. This will only work if the methods are indeed getting or 
-# setting a simple type. If this is not the case, or you want to show the 
-# methods anyway, you should set this option to NO.
-
-IDL_PROPERTY_SUPPORT   = YES
-
-# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC 
-# tag is set to YES, then doxygen will reuse the documentation of the first 
-# member in the group (if any) for the other members of the group. By default 
-# all members of a group must be documented explicitly.
-
-DISTRIBUTE_GROUP_DOC   = NO
-
-# Set the SUBGROUPING tag to YES (the default) to allow class member groups of 
-# the same type (for instance a group of public functions) to be put as a 
-# subgroup of that type (e.g. under the Public Functions section). Set it to 
-# NO to prevent subgrouping. Alternatively, this can be done per class using 
-# the \nosubgrouping command.
-
-SUBGROUPING            = YES
-
-# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum 
-# is documented as struct, union, or enum with the name of the typedef. So 
-# typedef struct TypeS {} TypeT, will appear in the documentation as a struct 
-# with name TypeT. When disabled the typedef will appear as a member of a file, 
-# namespace, or class. And the struct will be named TypeS. This can typically 
-# be useful for C code in case the coding convention dictates that all compound 
-# types are typedef'ed and only the typedef is referenced, never the tag name.
-
-TYPEDEF_HIDES_STRUCT   = NO
-
-#---------------------------------------------------------------------------
-# Build related configuration options
-#---------------------------------------------------------------------------
-
-# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in 
-# documentation are documented, even if no documentation was available. 
-# Private class members and static file members will be hidden unless 
-# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
-
-EXTRACT_ALL            = YES
-
-# If the EXTRACT_PRIVATE tag is set to YES all private members of a class 
-# will be included in the documentation.
-
-EXTRACT_PRIVATE        = NO
-
-# If the EXTRACT_STATIC tag is set to YES all static members of a file 
-# will be included in the documentation.
-
-EXTRACT_STATIC         = YES
-
-# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) 
-# defined locally in source files will be included in the documentation. 
-# If set to NO only classes defined in header files are included.
-
-EXTRACT_LOCAL_CLASSES  = YES
-
-# This flag is only useful for Objective-C code. When set to YES local 
-# methods, which are defined in the implementation section but not in 
-# the interface are included in the documentation. 
-# If set to NO (the default) only methods in the interface are included.
-
-EXTRACT_LOCAL_METHODS  = NO
-
-# If this flag is set to YES, the members of anonymous namespaces will be 
-# extracted and appear in the documentation as a namespace called 
-# 'anonymous_namespace{file}', where file will be replaced with the base 
-# name of the file that contains the anonymous namespace. By default 
-# anonymous namespace are hidden.
-
-EXTRACT_ANON_NSPACES   = NO
-
-# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all 
-# undocumented members of documented classes, files or namespaces. 
-# If set to NO (the default) these members will be included in the 
-# various overviews, but no documentation section is generated. 
-# This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_MEMBERS     = NO
-
-# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all 
-# undocumented classes that are normally visible in the class hierarchy. 
-# If set to NO (the default) these classes will be included in the various 
-# overviews. This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_CLASSES     = NO
-
-# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all 
-# friend (class|struct|union) declarations. 
-# If set to NO (the default) these declarations will be included in the 
-# documentation.
-
-HIDE_FRIEND_COMPOUNDS  = NO
-
-# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any 
-# documentation blocks found inside the body of a function. 
-# If set to NO (the default) these blocks will be appended to the 
-# function's detailed documentation block.
-
-HIDE_IN_BODY_DOCS      = NO
-
-# The INTERNAL_DOCS tag determines if documentation 
-# that is typed after a \internal command is included. If the tag is set 
-# to NO (the default) then the documentation will be excluded. 
-# Set it to YES to include the internal documentation.
-
-INTERNAL_DOCS          = NO
-
-# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate 
-# file names in lower-case letters. If set to YES upper-case letters are also 
-# allowed. This is useful if you have classes or files whose names only differ 
-# in case and if your file system supports case sensitive file names. Windows 
-# and Mac users are advised to set this option to NO.
-
-CASE_SENSE_NAMES       = YES
-
-# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen 
-# will show members with their full class and namespace scopes in the 
-# documentation. If set to YES the scope will be hidden.
-
-HIDE_SCOPE_NAMES       = NO
-
-# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen 
-# will put a list of the files that are included by a file in the documentation 
-# of that file.
-
-SHOW_INCLUDE_FILES     = YES
-
-# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] 
-# is inserted in the documentation for inline members.
-
-INLINE_INFO            = YES
-
-# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen 
-# will sort the (detailed) documentation of file and class members 
-# alphabetically by member name. If set to NO the members will appear in 
-# declaration order.
-
-SORT_MEMBER_DOCS       = YES
-
-# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the 
-# brief documentation of file, namespace and class members alphabetically 
-# by member name. If set to NO (the default) the members will appear in 
-# declaration order.
-
-SORT_BRIEF_DOCS        = NO
-
-# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the 
-# hierarchy of group names into alphabetical order. If set to NO (the default) 
-# the group names will appear in their defined order.
-
-SORT_GROUP_NAMES       = NO
-
-# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be 
-# sorted by fully-qualified names, including namespaces. If set to 
-# NO (the default), the class list will be sorted only by class name, 
-# not including the namespace part. 
-# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
-# Note: This option applies only to the class list, not to the 
-# alphabetical list.
-
-SORT_BY_SCOPE_NAME     = NO
-
-# The GENERATE_TODOLIST tag can be used to enable (YES) or 
-# disable (NO) the todo list. This list is created by putting \todo 
-# commands in the documentation.
-
-GENERATE_TODOLIST      = YES
-
-# The GENERATE_TESTLIST tag can be used to enable (YES) or 
-# disable (NO) the test list. This list is created by putting \test 
-# commands in the documentation.
-
-GENERATE_TESTLIST      = YES
-
-# The GENERATE_BUGLIST tag can be used to enable (YES) or 
-# disable (NO) the bug list. This list is created by putting \bug 
-# commands in the documentation.
-
-GENERATE_BUGLIST       = YES
-
-# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or 
-# disable (NO) the deprecated list. This list is created by putting 
-# \deprecated commands in the documentation.
-
-GENERATE_DEPRECATEDLIST= YES
-
-# The ENABLED_SECTIONS tag can be used to enable conditional 
-# documentation sections, marked by \if sectionname ... \endif.
-
-ENABLED_SECTIONS       = 
-
-# The MAX_INITIALIZER_LINES tag determines the maximum number of lines 
-# the initial value of a variable or define consists of for it to appear in 
-# the documentation. If the initializer consists of more lines than specified 
-# here it will be hidden. Use a value of 0 to hide initializers completely. 
-# The appearance of the initializer of individual variables and defines in the 
-# documentation can be controlled using \showinitializer or \hideinitializer 
-# command in the documentation regardless of this setting.
-
-MAX_INITIALIZER_LINES  = 30
-
-# Set the SHOW_USED_FILES tag to NO to disable the list of files generated 
-# at the bottom of the documentation of classes and structs. If set to YES the 
-# list will mention the files that were used to generate the documentation.
-
-SHOW_USED_FILES        = YES
-
-# If the sources in your project are distributed over multiple directories 
-# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy 
-# in the documentation. The default is NO.
-
-SHOW_DIRECTORIES       = YES
-
-# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
-# This will remove the Files entry from the Quick Index and from the 
-# Folder Tree View (if specified). The default is YES.
-
-SHOW_FILES             = YES
-
-# Set the SHOW_NAMESPACES tag to NO to disable the generation of the 
-# Namespaces page.  This will remove the Namespaces entry from the Quick Index
-# and from the Folder Tree View (if specified). The default is YES.
-
-SHOW_NAMESPACES        = YES
-
-# The FILE_VERSION_FILTER tag can be used to specify a program or script that 
-# doxygen should invoke to get the current version for each file (typically from 
-# the version control system). Doxygen will invoke the program by executing (via 
-# popen()) the command <command> <input-file>, where <command> is the value of 
-# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file 
-# provided by doxygen. Whatever the program writes to standard output 
-# is used as the file version. See the manual for examples.
-
-FILE_VERSION_FILTER    = 
-
-#---------------------------------------------------------------------------
-# configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-
-# The QUIET tag can be used to turn on/off the messages that are generated 
-# by doxygen. Possible values are YES and NO. If left blank NO is used.
-
-QUIET                  = NO
-
-# The WARNINGS tag can be used to turn on/off the warning messages that are 
-# generated by doxygen. Possible values are YES and NO. If left blank 
-# NO is used.
-
-WARNINGS               = NO
-
-# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings 
-# for undocumented members. If EXTRACT_ALL is set to YES then this flag will 
-# automatically be disabled.
-
-WARN_IF_UNDOCUMENTED   = NO
-
-# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for 
-# potential errors in the documentation, such as not documenting some 
-# parameters in a documented function, or documenting parameters that 
-# don't exist or using markup commands wrongly.
-
-WARN_IF_DOC_ERROR      = YES
-
-# This WARN_NO_PARAMDOC option can be abled to get warnings for 
-# functions that are documented, but have no documentation for their parameters 
-# or return value. If set to NO (the default) doxygen will only warn about 
-# wrong or incomplete parameter documentation, but not about the absence of 
-# documentation.
-
-WARN_NO_PARAMDOC       = NO
-
-# The WARN_FORMAT tag determines the format of the warning messages that 
-# doxygen can produce. The string should contain the $file, $line, and $text 
-# tags, which will be replaced by the file and line number from which the 
-# warning originated and the warning text. Optionally the format may contain 
-# $version, which will be replaced by the version of the file (if it could 
-# be obtained via FILE_VERSION_FILTER)
-
-WARN_FORMAT            = 
-
-# The WARN_LOGFILE tag can be used to specify a file to which warning 
-# and error messages should be written. If left blank the output is written 
-# to stderr.
-
-WARN_LOGFILE           = 
-
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-
-# The INPUT tag can be used to specify the files and/or directories that contain 
-# documented source files. You may enter file names like "myfile.cpp" or 
-# directories like "/usr/src/myproject". Separate the files or directories 
-# with spaces.
-
-INPUT                  = @abs_top_srcdir@/include \
-                         @abs_top_srcdir@/lib \
-                         @abs_top_srcdir@/docs/doxygen.intro
-
-# This tag can be used to specify the character encoding of the source files 
-# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is 
-# also the default input encoding. Doxygen uses libiconv (or the iconv built 
-# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for 
-# the list of possible encodings.
-
-INPUT_ENCODING         = UTF-8
-
-# If the value of the INPUT tag contains directories, you can use the 
-# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 
-# and *.h) to filter out the source-files in the directories. If left 
-# blank the following patterns are tested: 
-# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx 
-# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
-
-FILE_PATTERNS          = 
-
-# The RECURSIVE tag can be used to turn specify whether or not subdirectories 
-# should be searched for input files as well. Possible values are YES and NO. 
-# If left blank NO is used.
-
-RECURSIVE              = YES
-
-# The EXCLUDE tag can be used to specify files and/or directories that should 
-# excluded from the INPUT source files. This way you can easily exclude a 
-# subdirectory from a directory tree whose root is specified with the INPUT tag.
-
-EXCLUDE                = 
-
-# The EXCLUDE_SYMLINKS tag can be used select whether or not files or 
-# directories that are symbolic links (a Unix filesystem feature) are excluded 
-# from the input.
-
-EXCLUDE_SYMLINKS       = NO
-
-# If the value of the INPUT tag contains directories, you can use the 
-# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude 
-# certain files from those directories. Note that the wildcards are matched 
-# against the file with absolute path, so to exclude all test directories 
-# for example use the pattern */test/*
-
-EXCLUDE_PATTERNS       = 
-
-# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names 
-# (namespaces, classes, functions, etc.) that should be excluded from the 
-# output. The symbol name can be a fully qualified name, a word, or if the 
-# wildcard * is used, a substring. Examples: ANamespace, AClass, 
-# AClass::ANamespace, ANamespace::*Test
-
-EXCLUDE_SYMBOLS        = 
-
-# The EXAMPLE_PATH tag can be used to specify one or more files or 
-# directories that contain example code fragments that are included (see 
-# the \include command).
-
-EXAMPLE_PATH           = @abs_top_srcdir@/examples
-
-# If the value of the EXAMPLE_PATH tag contains directories, you can use the 
-# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 
-# and *.h) to filter out the source-files in the directories. If left 
-# blank all files are included.
-
-EXAMPLE_PATTERNS       = 
-
-# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be 
-# searched for input files to be used with the \include or \dontinclude 
-# commands irrespective of the value of the RECURSIVE tag. 
-# Possible values are YES and NO. If left blank NO is used.
-
-EXAMPLE_RECURSIVE      = YES
-
-# The IMAGE_PATH tag can be used to specify one or more files or 
-# directories that contain image that are included in the documentation (see 
-# the \image command).
-
-IMAGE_PATH             = @abs_top_srcdir@/docs/img
-
-# The INPUT_FILTER tag can be used to specify a program that doxygen should 
-# invoke to filter for each input file. Doxygen will invoke the filter program 
-# by executing (via popen()) the command <filter> <input-file>, where <filter> 
-# is the value of the INPUT_FILTER tag, and <input-file> is the name of an 
-# input file. Doxygen will then use the output that the filter program writes 
-# to standard output.  If FILTER_PATTERNS is specified, this tag will be 
-# ignored.
-
-INPUT_FILTER           = 
-
-# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern 
-# basis.  Doxygen will compare the file name with each pattern and apply the 
-# filter if there is a match.  The filters are a list of the form: 
-# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further 
-# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER 
-# is applied to all files.
-
-FILTER_PATTERNS        = 
-
-# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using 
-# INPUT_FILTER) will be used to filter the input files when producing source 
-# files to browse (i.e. when SOURCE_BROWSER is set to YES).
-
-FILTER_SOURCE_FILES    = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to source browsing
-#---------------------------------------------------------------------------
-
-# If the SOURCE_BROWSER tag is set to YES then a list of source files will 
-# be generated. Documented entities will be cross-referenced with these sources. 
-# Note: To get rid of all source code in the generated output, make sure also 
-# VERBATIM_HEADERS is set to NO.
-
-SOURCE_BROWSER         = YES
-
-# Setting the INLINE_SOURCES tag to YES will include the body 
-# of functions and classes directly in the documentation.
-
-INLINE_SOURCES         = NO
-
-# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct 
-# doxygen to hide any special comment blocks from generated source code 
-# fragments. Normal C and C++ comments will always remain visible.
-
-STRIP_CODE_COMMENTS    = NO
-
-# If the REFERENCED_BY_RELATION tag is set to YES 
-# then for each documented function all documented 
-# functions referencing it will be listed.
-
-REFERENCED_BY_RELATION = YES
-
-# If the REFERENCES_RELATION tag is set to YES 
-# then for each documented function all documented entities 
-# called/used by that function will be listed.
-
-REFERENCES_RELATION    = YES
-
-# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
-# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
-# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
-# link to the source code.  Otherwise they will link to the documentstion.
-
-REFERENCES_LINK_SOURCE = YES
-
-# If the USE_HTAGS tag is set to YES then the references to source code 
-# will point to the HTML generated by the htags(1) tool instead of doxygen 
-# built-in source browser. The htags tool is part of GNU's global source 
-# tagging system (see http://www.gnu.org/software/global/global.html). You 
-# will need version 4.8.6 or higher.
-
-USE_HTAGS              = NO
-
-# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen 
-# will generate a verbatim copy of the header file for each class for 
-# which an include is specified. Set to NO to disable this.
-
-VERBATIM_HEADERS       = YES
-
-#---------------------------------------------------------------------------
-# configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-
-# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index 
-# of all compounds will be generated. Enable this if the project 
-# contains a lot of classes, structs, unions or interfaces.
-
-ALPHABETICAL_INDEX     = YES
-
-# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then 
-# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns 
-# in which this list will be split (can be a number in the range [1..20])
-
-COLS_IN_ALPHA_INDEX    = 4
-
-# In case all classes in a project start with a common prefix, all 
-# classes will be put under the same header in the alphabetical index. 
-# The IGNORE_PREFIX tag can be used to specify one or more prefixes that 
-# should be ignored while generating the index headers.
-
-IGNORE_PREFIX          = llvm::
-
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_HTML tag is set to YES (the default) Doxygen will 
-# generate HTML output.
-
-GENERATE_HTML          = YES
-
-# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. 
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
-# put in front of it. If left blank `html' will be used as the default path.
-
-HTML_OUTPUT            = html
-
-# The HTML_FILE_EXTENSION tag can be used to specify the file extension for 
-# each generated HTML page (for example: .htm,.php,.asp). If it is left blank 
-# doxygen will generate files with .html extension.
-
-HTML_FILE_EXTENSION    = .html
-
-# The HTML_HEADER tag can be used to specify a personal HTML header for 
-# each generated HTML page. If it is left blank doxygen will generate a 
-# standard header.
-
-HTML_HEADER            = @abs_top_srcdir@/docs/doxygen.header
-
-# The HTML_FOOTER tag can be used to specify a personal HTML footer for 
-# each generated HTML page. If it is left blank doxygen will generate a 
-# standard footer.
-
-HTML_FOOTER            = @abs_top_srcdir@/docs/doxygen.footer
-
-# The HTML_STYLESHEET tag can be used to specify a user-defined cascading 
-# style sheet that is used by each HTML page. It can be used to 
-# fine-tune the look of the HTML output. If the tag is left blank doxygen 
-# will generate a default style sheet. Note that doxygen will try to copy 
-# the style sheet file to the HTML output directory, so don't put your own 
-# stylesheet in the HTML output directory as well, or it will be erased!
-
-HTML_STYLESHEET        = @abs_top_srcdir@/docs/doxygen.css
-
-# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, 
-# files or namespaces will be aligned in HTML using tables. If set to 
-# NO a bullet list will be used.
-
-HTML_ALIGN_MEMBERS     = YES
-
-# If the GENERATE_HTMLHELP tag is set to YES, additional index files 
-# will be generated that can be used as input for tools like the 
-# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) 
-# of the generated HTML documentation.
-
-GENERATE_HTMLHELP      = NO
-
-# If the GENERATE_DOCSET tag is set to YES, additional index files 
-# will be generated that can be used as input for Apple's Xcode 3 
-# integrated development environment, introduced with OSX 10.5 (Leopard). 
-# To create a documentation set, doxygen will generate a Makefile in the 
-# HTML output directory. Running make will produce the docset in that 
-# directory and running "make install" will install the docset in 
-# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find 
-# it at startup.
-
-GENERATE_DOCSET        = NO
-
-# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the 
-# feed. A documentation feed provides an umbrella under which multiple 
-# documentation sets from a single provider (such as a company or product suite) 
-# can be grouped.
-
-DOCSET_FEEDNAME        = "Doxygen generated docs"
-
-# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that 
-# should uniquely identify the documentation set bundle. This should be a 
-# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen 
-# will append .docset to the name.
-
-DOCSET_BUNDLE_ID       = org.doxygen.Project
-
-# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML 
-# documentation will contain sections that can be hidden and shown after the 
-# page has loaded. For this to work a browser that supports 
-# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox 
-# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
-
-HTML_DYNAMIC_SECTIONS  = NO
-
-# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can 
-# be used to specify the file name of the resulting .chm file. You 
-# can add a path in front of the file if the result should not be 
-# written to the html output directory.
-
-CHM_FILE               = 
-
-# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can 
-# be used to specify the location (absolute path including file name) of 
-# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run 
-# the HTML help compiler on the generated index.hhp.
-
-HHC_LOCATION           = 
-
-# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag 
-# controls if a separate .chi index file is generated (YES) or that 
-# it should be included in the master .chm file (NO).
-
-GENERATE_CHI           = NO
-
-# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
-# is used to encode HtmlHelp index (hhk), content (hhc) and project file
-# content.
-
-CHM_INDEX_ENCODING     = 
-
-# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag 
-# controls whether a binary table of contents is generated (YES) or a 
-# normal table of contents (NO) in the .chm file.
-
-BINARY_TOC             = NO
-
-# The TOC_EXPAND flag can be set to YES to add extra items for group members 
-# to the contents of the HTML help documentation and to the tree view.
-
-TOC_EXPAND             = NO
-
-# The DISABLE_INDEX tag can be used to turn on/off the condensed index at 
-# top of each HTML page. The value NO (the default) enables the index and 
-# the value YES disables it.
-
-DISABLE_INDEX          = NO
-
-# This tag can be used to set the number of enum values (range [1..20]) 
-# that doxygen will group on one line in the generated HTML documentation.
-
-ENUM_VALUES_PER_LINE   = 4
-
-# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
-# structure should be generated to display hierarchical information.
-# If the tag value is set to FRAME, a side panel will be generated
-# containing a tree-like index structure (just like the one that 
-# is generated for HTML Help). For this to work a browser that supports 
-# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, 
-# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are 
-# probably better off using the HTML help feature. Other possible values 
-# for this tag are: HIERARCHIES, which will generate the Groups, Directories,
-# and Class Hiererachy pages using a tree view instead of an ordered list;
-# ALL, which combines the behavior of FRAME and HIERARCHIES; and NONE, which
-# disables this behavior completely. For backwards compatibility with previous
-# releases of Doxygen, the values YES and NO are equivalent to FRAME and NONE
-# respectively.
-
-GENERATE_TREEVIEW      = NO
-
-# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be 
-# used to set the initial width (in pixels) of the frame in which the tree 
-# is shown.
-
-TREEVIEW_WIDTH         = 250
-
-# Use this tag to change the font size of Latex formulas included 
-# as images in the HTML documentation. The default is 10. Note that 
-# when you change the font size after a successful doxygen run you need 
-# to manually remove any form_*.png images from the HTML output directory 
-# to force them to be regenerated.
-
-FORMULA_FONTSIZE       = 10
-
-#---------------------------------------------------------------------------
-# configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will 
-# generate Latex output.
-
-GENERATE_LATEX         = NO
-
-# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. 
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
-# put in front of it. If left blank `latex' will be used as the default path.
-
-LATEX_OUTPUT           = 
-
-# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be 
-# invoked. If left blank `latex' will be used as the default command name.
-
-LATEX_CMD_NAME         = latex
-
-# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to 
-# generate index for LaTeX. If left blank `makeindex' will be used as the 
-# default command name.
-
-MAKEINDEX_CMD_NAME     = makeindex
-
-# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact 
-# LaTeX documents. This may be useful for small projects and may help to 
-# save some trees in general.
-
-COMPACT_LATEX          = NO
-
-# The PAPER_TYPE tag can be used to set the paper type that is used 
-# by the printer. Possible values are: a4, a4wide, letter, legal and 
-# executive. If left blank a4wide will be used.
-
-PAPER_TYPE             = letter
-
-# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX 
-# packages that should be included in the LaTeX output.
-
-EXTRA_PACKAGES         = 
-
-# The LATEX_HEADER tag can be used to specify a personal LaTeX header for 
-# the generated latex document. The header should contain everything until 
-# the first chapter. If it is left blank doxygen will generate a 
-# standard header. Notice: only use this tag if you know what you are doing!
-
-LATEX_HEADER           = 
-
-# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated 
-# is prepared for conversion to pdf (using ps2pdf). The pdf file will 
-# contain links (just like the HTML output) instead of page references 
-# This makes the output suitable for online browsing using a pdf viewer.
-
-PDF_HYPERLINKS         = NO
-
-# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of 
-# plain latex in the generated Makefile. Set this option to YES to get a 
-# higher quality PDF documentation.
-
-USE_PDFLATEX           = NO
-
-# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. 
-# command to the generated LaTeX files. This will instruct LaTeX to keep 
-# running if errors occur, instead of asking the user for help. 
-# This option is also used when generating formulas in HTML.
-
-LATEX_BATCHMODE        = NO
-
-# If LATEX_HIDE_INDICES is set to YES then doxygen will not 
-# include the index chapters (such as File Index, Compound Index, etc.) 
-# in the output.
-
-LATEX_HIDE_INDICES     = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the RTF output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output 
-# The RTF output is optimized for Word 97 and may not look very pretty with 
-# other RTF readers or editors.
-
-GENERATE_RTF           = NO
-
-# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. 
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
-# put in front of it. If left blank `rtf' will be used as the default path.
-
-RTF_OUTPUT             = 
-
-# If the COMPACT_RTF tag is set to YES Doxygen generates more compact 
-# RTF documents. This may be useful for small projects and may help to 
-# save some trees in general.
-
-COMPACT_RTF            = NO
-
-# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated 
-# will contain hyperlink fields. The RTF file will 
-# contain links (just like the HTML output) instead of page references. 
-# This makes the output suitable for online browsing using WORD or other 
-# programs which support those fields. 
-# Note: wordpad (write) and others do not support links.
-
-RTF_HYPERLINKS         = NO
-
-# Load stylesheet definitions from file. Syntax is similar to doxygen's 
-# config file, i.e. a series of assignments. You only have to provide 
-# replacements, missing definitions are set to their default value.
-
-RTF_STYLESHEET_FILE    = 
-
-# Set optional variables used in the generation of an rtf document. 
-# Syntax is similar to doxygen's config file.
-
-RTF_EXTENSIONS_FILE    = 
-
-#---------------------------------------------------------------------------
-# configuration options related to the man page output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_MAN tag is set to YES (the default) Doxygen will 
-# generate man pages
-
-GENERATE_MAN           = NO
-
-# The MAN_OUTPUT tag is used to specify where the man pages will be put. 
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
-# put in front of it. If left blank `man' will be used as the default path.
-
-MAN_OUTPUT             = 
-
-# The MAN_EXTENSION tag determines the extension that is added to 
-# the generated man pages (default is the subroutine's section .3)
-
-MAN_EXTENSION          = 
-
-# If the MAN_LINKS tag is set to YES and Doxygen generates man output, 
-# then it will generate one additional man file for each entity 
-# documented in the real man page(s). These additional files 
-# only source the real man page, but without them the man command 
-# would be unable to find the correct page. The default is NO.
-
-MAN_LINKS              = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the XML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_XML tag is set to YES Doxygen will 
-# generate an XML file that captures the structure of 
-# the code including all documentation.
-
-GENERATE_XML           = NO
-
-# The XML_OUTPUT tag is used to specify where the XML pages will be put. 
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
-# put in front of it. If left blank `xml' will be used as the default path.
-
-XML_OUTPUT             = xml
-
-# The XML_SCHEMA tag can be used to specify an XML schema, 
-# which can be used by a validating XML parser to check the 
-# syntax of the XML files.
-
-XML_SCHEMA             = 
-
-# The XML_DTD tag can be used to specify an XML DTD, 
-# which can be used by a validating XML parser to check the 
-# syntax of the XML files.
-
-XML_DTD                = 
-
-# If the XML_PROGRAMLISTING tag is set to YES Doxygen will 
-# dump the program listings (including syntax highlighting 
-# and cross-referencing information) to the XML output. Note that 
-# enabling this will significantly increase the size of the XML output.
-
-XML_PROGRAMLISTING     = YES
-
-#---------------------------------------------------------------------------
-# configuration options for the AutoGen Definitions output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will 
-# generate an AutoGen Definitions (see autogen.sf.net) file 
-# that captures the structure of the code including all 
-# documentation. Note that this feature is still experimental 
-# and incomplete at the moment.
-
-GENERATE_AUTOGEN_DEF   = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the Perl module output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_PERLMOD tag is set to YES Doxygen will 
-# generate a Perl module file that captures the structure of 
-# the code including all documentation. Note that this 
-# feature is still experimental and incomplete at the 
-# moment.
-
-GENERATE_PERLMOD       = NO
-
-# If the PERLMOD_LATEX tag is set to YES Doxygen will generate 
-# the necessary Makefile rules, Perl scripts and LaTeX code to be able 
-# to generate PDF and DVI output from the Perl module output.
-
-PERLMOD_LATEX          = NO
-
-# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be 
-# nicely formatted so it can be parsed by a human reader.  This is useful 
-# if you want to understand what is going on.  On the other hand, if this 
-# tag is set to NO the size of the Perl module output will be much smaller 
-# and Perl will parse it just the same.
-
-PERLMOD_PRETTY         = YES
-
-# The names of the make variables in the generated doxyrules.make file 
-# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. 
-# This is useful so different doxyrules.make files included by the same 
-# Makefile don't overwrite each other's variables.
-
-PERLMOD_MAKEVAR_PREFIX = 
-
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor   
-#---------------------------------------------------------------------------
-
-# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will 
-# evaluate all C-preprocessor directives found in the sources and include 
-# files.
-
-ENABLE_PREPROCESSING   = YES
-
-# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro 
-# names in the source code. If set to NO (the default) only conditional 
-# compilation will be performed. Macro expansion can be done in a controlled 
-# way by setting EXPAND_ONLY_PREDEF to YES.
-
-MACRO_EXPANSION        = NO
-
-# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES 
-# then the macro expansion is limited to the macros specified with the 
-# PREDEFINED and EXPAND_AS_DEFINED tags.
-
-EXPAND_ONLY_PREDEF     = NO
-
-# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files 
-# in the INCLUDE_PATH (see below) will be search if a #include is found.
-
-SEARCH_INCLUDES        = YES
-
-# The INCLUDE_PATH tag can be used to specify one or more directories that 
-# contain include files that are not input files but should be processed by 
-# the preprocessor.
-
-INCLUDE_PATH           = ../include
-
-# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard 
-# patterns (like *.h and *.hpp) to filter out the header-files in the 
-# directories. If left blank, the patterns specified with FILE_PATTERNS will 
-# be used.
-
-INCLUDE_FILE_PATTERNS  = 
-
-# The PREDEFINED tag can be used to specify one or more macro names that 
-# are defined before the preprocessor is started (similar to the -D option of 
-# gcc). The argument of the tag is a list of macros of the form: name 
-# or name=definition (no spaces). If the definition and the = are 
-# omitted =1 is assumed. To prevent a macro definition from being 
-# undefined via #undef or recursively expanded use the := operator 
-# instead of the = operator.
-
-PREDEFINED             = 
-
-# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then 
-# this tag can be used to specify a list of macro names that should be expanded. 
-# The macro definition that is found in the sources will be used. 
-# Use the PREDEFINED tag if you want to use a different macro definition.
-
-EXPAND_AS_DEFINED      = 
-
-# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then 
-# doxygen's preprocessor will remove all function-like macros that are alone 
-# on a line, have an all uppercase name, and do not end with a semicolon. Such 
-# function macros are typically used for boiler-plate code, and will confuse 
-# the parser if not removed.
-
-SKIP_FUNCTION_MACROS   = YES
-
-#---------------------------------------------------------------------------
-# Configuration::additions related to external references   
-#---------------------------------------------------------------------------
-
-# The TAGFILES option can be used to specify one or more tagfiles. 
-# Optionally an initial location of the external documentation 
-# can be added for each tagfile. The format of a tag file without 
-# this location is as follows: 
-#   TAGFILES = file1 file2 ... 
-# Adding location for the tag files is done as follows: 
-#   TAGFILES = file1=loc1 "file2 = loc2" ... 
-# where "loc1" and "loc2" can be relative or absolute paths or 
-# URLs. If a location is present for each tag, the installdox tool 
-# does not have to be run to correct the links.
-# Note that each tag file must have a unique name
-# (where the name does NOT include the path)
-# If a tag file is not located in the directory in which doxygen 
-# is run, you must also specify the path to the tagfile here.
-
-TAGFILES               = 
-
-# When a file name is specified after GENERATE_TAGFILE, doxygen will create 
-# a tag file that is based on the input files it reads.
-
-GENERATE_TAGFILE       = 
-
-# If the ALLEXTERNALS tag is set to YES all external classes will be listed 
-# in the class index. If set to NO only the inherited external classes 
-# will be listed.
-
-ALLEXTERNALS           = YES
-
-# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed 
-# in the modules index. If set to NO, only the current project's groups will 
-# be listed.
-
-EXTERNAL_GROUPS        = YES
-
-# The PERL_PATH should be the absolute path and name of the perl script 
-# interpreter (i.e. the result of `which perl').
-
-PERL_PATH              = 
-
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool   
-#---------------------------------------------------------------------------
-
-# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will 
-# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base 
-# or super classes. Setting the tag to NO turns the diagrams off. Note that 
-# this option is superseded by the HAVE_DOT option below. This is only a 
-# fallback. It is recommended to install and use dot, since it yields more 
-# powerful graphs.
-
-CLASS_DIAGRAMS         = YES
-
-# You can define message sequence charts within doxygen comments using the \msc 
-# command. Doxygen will then run the mscgen tool (see 
-# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the 
-# documentation. The MSCGEN_PATH tag allows you to specify the directory where 
-# the mscgen tool resides. If left empty the tool is assumed to be found in the 
-# default search path.
-
-MSCGEN_PATH            = 
-
-# If set to YES, the inheritance and collaboration graphs will hide 
-# inheritance and usage relations if the target is undocumented 
-# or is not a class.
-
-HIDE_UNDOC_RELATIONS   = NO
-
-# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is 
-# available from the path. This tool is part of Graphviz, a graph visualization 
-# toolkit from AT&T and Lucent Bell Labs. The other options in this section 
-# have no effect if this option is set to NO (the default)
-
-HAVE_DOT               = YES
-
-# By default doxygen will write a font called FreeSans.ttf to the output 
-# directory and reference it in all dot files that doxygen generates. This 
-# font does not include all possible unicode characters however, so when you need 
-# these (or just want a differently looking font) you can specify the font name 
-# using DOT_FONTNAME. You need need to make sure dot is able to find the font, 
-# which can be done by putting it in a standard location or by setting the 
-# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory 
-# containing the font.
-
-DOT_FONTNAME           = FreeSans
-
-# By default doxygen will tell dot to use the output directory to look for the 
-# FreeSans.ttf font (which doxygen will put there itself). If you specify a 
-# different font using DOT_FONTNAME you can set the path where dot 
-# can find it using this tag.
-
-DOT_FONTPATH           = 
-
-# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen 
-# will generate a graph for each documented class showing the direct and 
-# indirect inheritance relations. Setting this tag to YES will force the 
-# the CLASS_DIAGRAMS tag to NO.
-
-CLASS_GRAPH            = YES
-
-# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen 
-# will generate a graph for each documented class showing the direct and 
-# indirect implementation dependencies (inheritance, containment, and 
-# class references variables) of the class with other documented classes.
-
-COLLABORATION_GRAPH    = YES
-
-# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen 
-# will generate a graph for groups, showing the direct groups dependencies
-
-GROUP_GRAPHS           = YES
-
-# If the UML_LOOK tag is set to YES doxygen will generate inheritance and 
-# collaboration diagrams in a style similar to the OMG's Unified Modeling 
-# Language.
-
-UML_LOOK               = NO
-
-# If set to YES, the inheritance and collaboration graphs will show the 
-# relations between templates and their instances.
-
-TEMPLATE_RELATIONS     = YES
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT 
-# tags are set to YES then doxygen will generate a graph for each documented 
-# file showing the direct and indirect include dependencies of the file with 
-# other documented files.
-
-INCLUDE_GRAPH          = YES
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and 
-# HAVE_DOT tags are set to YES then doxygen will generate a graph for each 
-# documented header file showing the documented files that directly or 
-# indirectly include this file.
-
-INCLUDED_BY_GRAPH      = YES
-
-# If the CALL_GRAPH and HAVE_DOT options are set to YES then 
-# doxygen will generate a call dependency graph for every global function 
-# or class method. Note that enabling this option will significantly increase 
-# the time of a run. So in most cases it will be better to enable call graphs 
-# for selected functions only using the \callgraph command.
-
-CALL_GRAPH             = NO
-
-# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then 
-# doxygen will generate a caller dependency graph for every global function 
-# or class method. Note that enabling this option will significantly increase 
-# the time of a run. So in most cases it will be better to enable caller 
-# graphs for selected functions only using the \callergraph command.
-
-CALLER_GRAPH           = NO
-
-# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen 
-# will graphical hierarchy of all classes instead of a textual one.
-
-GRAPHICAL_HIERARCHY    = YES
-
-# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES 
-# then doxygen will show the dependencies a directory has on other directories 
-# in a graphical way. The dependency relations are determined by the #include
-# relations between the files in the directories.
-
-DIRECTORY_GRAPH        = YES
-
-# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images 
-# generated by dot. Possible values are png, jpg, or gif
-# If left blank png will be used.
-
-DOT_IMAGE_FORMAT       = png
-
-# The tag DOT_PATH can be used to specify the path where the dot tool can be 
-# found. If left blank, it is assumed the dot tool can be found in the path.
-
-DOT_PATH               = @DOT@
-
-# The DOTFILE_DIRS tag can be used to specify one or more directories that 
-# contain dot files that are included in the documentation (see the 
-# \dotfile command).
-
-DOTFILE_DIRS           = 
-
-# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of 
-# nodes that will be shown in the graph. If the number of nodes in a graph 
-# becomes larger than this value, doxygen will truncate the graph, which is 
-# visualized by representing a node as a red box. Note that doxygen if the 
-# number of direct children of the root node in a graph is already larger than 
-# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note 
-# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
-
-DOT_GRAPH_MAX_NODES    = 50
-
-# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the 
-# graphs generated by dot. A depth value of 3 means that only nodes reachable 
-# from the root by following a path via at most 3 edges will be shown. Nodes 
-# that lay further from the root node will be omitted. Note that setting this 
-# option to 1 or 2 may greatly reduce the computation time needed for large 
-# code bases. Also note that the size of a graph can be further restricted by 
-# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
-
-MAX_DOT_GRAPH_DEPTH    = 0
-
-# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent 
-# background. This is enabled by default, which results in a transparent 
-# background. Warning: Depending on the platform used, enabling this option 
-# may lead to badly anti-aliased labels on the edges of a graph (i.e. they 
-# become hard to read).
-
-DOT_TRANSPARENT        = YES
-
-# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output 
-# files in one run (i.e. multiple -o and -T options on the command line). This 
-# makes dot run faster, but since only newer versions of dot (>1.8.10) 
-# support this, this feature is disabled by default.
-
-DOT_MULTI_TARGETS      = NO
-
-# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will 
-# generate a legend page explaining the meaning of the various boxes and 
-# arrows in the dot generated graphs.
-
-GENERATE_LEGEND        = YES
-
-# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will 
-# remove the intermediate dot files that are used to generate 
-# the various graphs.
-
-DOT_CLEANUP            = YES
-
-#---------------------------------------------------------------------------
-# Configuration::additions related to the search engine   
-#---------------------------------------------------------------------------
-
-# The SEARCHENGINE tag specifies whether or not a search engine should be 
-# used. If set to NO the values of all tags below this one will be ignored.
-
-SEARCHENGINE           = NO
diff --git a/libclamav/c++/llvm/docs/doxygen.css b/libclamav/c++/llvm/docs/doxygen.css
deleted file mode 100644
index 83b049b..0000000
--- a/libclamav/c++/llvm/docs/doxygen.css
+++ /dev/null
@@ -1,378 +0,0 @@
-BODY,H1,H2,H3,H4,H5,H6,P,CENTER,TD,TH,UL,DL,DIV {
-	font-family: Verdana,Geneva,Arial,Helvetica,sans-serif;
-}
-BODY,TD {
- font-size: 90%;
-}
-H1 {
- text-align: center;
- font-size: 140%;
- font-weight: bold;
-}
-H2 {
- font-size: 120%;
- font-style: italic;
-}
-H3 {
- font-size: 100%;
-}
-CAPTION { font-weight: bold }
-DIV.qindex {
-	width: 100%;
-	background-color: #eeeeff;
-	border: 1px solid #b0b0b0;
-	text-align: center;
-	margin: 2px;
-	padding: 2px;
-	line-height: 140%;
-}
-DIV.nav {
-	width: 100%;
-	background-color: #eeeeff;
-	border: 1px solid #b0b0b0;
-	text-align: center;
-	margin: 2px;
-	padding: 2px;
-	line-height: 140%;
-}
-DIV.navtab {
-       background-color: #eeeeff;
-       border: 1px solid #b0b0b0;
-       text-align: center;
-       margin: 2px;
-       margin-right: 15px;
-       padding: 2px;
-}
-TD.navtab {
-       font-size: 70%;
-}
-A.qindex {
-       text-decoration: none;
-       font-weight: bold;
-       color: #1A419D;
-}
-A.qindex:visited {
-       text-decoration: none;
-       font-weight: bold;
-       color: #1A419D
-}
-A.qindex:hover {
-	text-decoration: none;
-	background-color: #ddddff;
-}
-A.qindexHL {
-	text-decoration: none;
-	font-weight: bold;
-	background-color: #6666cc;
-	color: #ffffff;
-	border: 1px double #9295C2;
-}
-A.qindexHL:hover {
-	text-decoration: none;
-	background-color: #6666cc;
-	color: #ffffff;
-}
-A.qindexHL:visited { 
- text-decoration: none; background-color: #6666cc; color: #ffffff }
-A.el { text-decoration: none; font-weight: bold }
-A.elRef { font-weight: bold }
-A.code:link { text-decoration: none; font-weight: normal; color: #0000FF}
-A.code:visited { text-decoration: none; font-weight: normal; color: #0000FF}
-A.codeRef:link { font-weight: normal; color: #0000FF}
-A.codeRef:visited { font-weight: normal; color: #0000FF}
-A:hover { text-decoration: none; background-color: #f2f2ff }
-DL.el { margin-left: -1cm }
-.fragment {
-       font-family: Fixed, monospace;
-       font-size: 95%;
-}
-PRE.fragment {
-	border: 1px solid #CCCCCC;
-	background-color: #f5f5f5;
-	margin-top: 4px;
-	margin-bottom: 4px;
-	margin-left: 2px;
-	margin-right: 8px;
-	padding-left: 6px;
-	padding-right: 6px;
-	padding-top: 4px;
-	padding-bottom: 4px;
-}
-DIV.ah { background-color: black; font-weight: bold; color: #ffffff; margin-bottom: 3px; margin-top: 3px }
-TD.md { background-color: #F4F4FB; font-weight: bold; }
-TD.mdPrefix {
-       background-color: #F4F4FB;
-       color: #606060;
-	font-size: 80%;
-}
-TD.mdname1 { background-color: #F4F4FB; font-weight: bold; color: #602020; }
-TD.mdname { background-color: #F4F4FB; font-weight: bold; color: #602020; width: 600px; }
-DIV.groupHeader {
-       margin-left: 16px;
-       margin-top: 12px;
-       margin-bottom: 6px;
-       font-weight: bold;
-}
-DIV.groupText { margin-left: 16px; font-style: italic; font-size: 90% }
-BODY {
-	background: white;
-	color: black;
-	margin-right: 20px;
-	margin-left: 20px;
-}
-TD.indexkey {
-	background-color: #eeeeff;
-	font-weight: bold;
-	padding-right  : 10px;
-	padding-top    : 2px;
-	padding-left   : 10px;
-	padding-bottom : 2px;
-	margin-left    : 0px;
-	margin-right   : 0px;
-	margin-top     : 2px;
-	margin-bottom  : 2px;
-	border: 1px solid #CCCCCC;
-}
-TD.indexvalue {
-	background-color: #eeeeff;
-	font-style: italic;
-	padding-right  : 10px;
-	padding-top    : 2px;
-	padding-left   : 10px;
-	padding-bottom : 2px;
-	margin-left    : 0px;
-	margin-right   : 0px;
-	margin-top     : 2px;
-	margin-bottom  : 2px;
-	border: 1px solid #CCCCCC;
-}
-TR.memlist {
-   background-color: #f0f0f0; 
-}
-P.formulaDsp { text-align: center; }
-IMG.formulaDsp { }
-IMG.formulaInl { vertical-align: middle; }
-SPAN.keyword       { color: #008000 }
-SPAN.keywordtype   { color: #604020 }
-SPAN.keywordflow   { color: #e08000 }
-SPAN.comment       { color: #800000 }
-SPAN.preprocessor  { color: #806020 }
-SPAN.stringliteral { color: #002080 }
-SPAN.charliteral   { color: #008080 }
-.mdTable {
-	border: 1px solid #868686;
-	background-color: #F4F4FB;
-}
-.mdRow {
-	padding: 8px 10px;
-}
-.mdescLeft {
-       padding: 0px 8px 4px 8px;
-	font-size: 80%;
-	font-style: italic;
-	background-color: #FAFAFA;
-	border-top: 1px none #E0E0E0;
-	border-right: 1px none #E0E0E0;
-	border-bottom: 1px none #E0E0E0;
-	border-left: 1px none #E0E0E0;
-	margin: 0px;
-}
-.mdescRight {
-       padding: 0px 8px 4px 8px;
-	font-size: 80%;
-	font-style: italic;
-	background-color: #FAFAFA;
-	border-top: 1px none #E0E0E0;
-	border-right: 1px none #E0E0E0;
-	border-bottom: 1px none #E0E0E0;
-	border-left: 1px none #E0E0E0;
-	margin: 0px;
-}
-.memItemLeft {
-	padding: 1px 0px 0px 8px;
-	margin: 4px;
-	border-top-width: 1px;
-	border-right-width: 1px;
-	border-bottom-width: 1px;
-	border-left-width: 1px;
-	border-top-color: #E0E0E0;
-	border-right-color: #E0E0E0;
-	border-bottom-color: #E0E0E0;
-	border-left-color: #E0E0E0;
-	border-top-style: solid;
-	border-right-style: none;
-	border-bottom-style: none;
-	border-left-style: none;
-	background-color: #FAFAFA;
-	font-size: 80%;
-}
-.memItemRight {
-	padding: 1px 8px 0px 8px;
-	margin: 4px;
-	border-top-width: 1px;
-	border-right-width: 1px;
-	border-bottom-width: 1px;
-	border-left-width: 1px;
-	border-top-color: #E0E0E0;
-	border-right-color: #E0E0E0;
-	border-bottom-color: #E0E0E0;
-	border-left-color: #E0E0E0;
-	border-top-style: solid;
-	border-right-style: none;
-	border-bottom-style: none;
-	border-left-style: none;
-	background-color: #FAFAFA;
-	font-size: 80%;
-}
-.memTemplItemLeft {
-	padding: 1px 0px 0px 8px;
-	margin: 4px;
-	border-top-width: 1px;
-	border-right-width: 1px;
-	border-bottom-width: 1px;
-	border-left-width: 1px;
-	border-top-color: #E0E0E0;
-	border-right-color: #E0E0E0;
-	border-bottom-color: #E0E0E0;
-	border-left-color: #E0E0E0;
-	border-top-style: none;
-	border-right-style: none;
-	border-bottom-style: none;
-	border-left-style: none;
-	background-color: #FAFAFA;
-	font-size: 80%;
-}
-.memTemplItemRight {
-	padding: 1px 8px 0px 8px;
-	margin: 4px;
-	border-top-width: 1px;
-	border-right-width: 1px;
-	border-bottom-width: 1px;
-	border-left-width: 1px;
-	border-top-color: #E0E0E0;
-	border-right-color: #E0E0E0;
-	border-bottom-color: #E0E0E0;
-	border-left-color: #E0E0E0;
-	border-top-style: none;
-	border-right-style: none;
-	border-bottom-style: none;
-	border-left-style: none;
-	background-color: #FAFAFA;
-	font-size: 80%;
-}
-.memTemplParams {
-	padding: 1px 0px 0px 8px;
-	margin: 4px;
-	border-top-width: 1px;
-	border-right-width: 1px;
-	border-bottom-width: 1px;
-	border-left-width: 1px;
-	border-top-color: #E0E0E0;
-	border-right-color: #E0E0E0;
-	border-bottom-color: #E0E0E0;
-	border-left-color: #E0E0E0;
-	border-top-style: solid;
-	border-right-style: none;
-	border-bottom-style: none;
-	border-left-style: none;
-       color: #606060;
-	background-color: #FAFAFA;
-	font-size: 80%;
-}
-.search     { color: #003399;
-              font-weight: bold;
-}
-FORM.search {
-              margin-bottom: 0px;
-              margin-top: 0px;
-}
-INPUT.search { font-size: 75%;
-               color: #000080;
-               font-weight: normal;
-               background-color: #eeeeff;
-}
-TD.tiny      { font-size: 75%;
-}
-a {
-	color: #252E78;
-}
-a:visited {
-	color: #3D2185;
-}
-.dirtab { padding: 4px;
-          border-collapse: collapse;
-          border: 1px solid #b0b0b0;
-}
-TH.dirtab { background: #eeeeff;
-            font-weight: bold;
-}
-HR { height: 1px;
-     border: none;
-     border-top: 1px solid black;
-}
-
-/* 
- * LLVM Modifications.
- * Note: Everything above here is generated with "doxygen -w htlm" command. See
- * "doxygen --help" for details. What follows are CSS overrides for LLVM 
- * specific formatting. We want to keep the above so it can be replaced with
- * subsequent doxygen upgrades.
- */
-
-.footer {
-        font-size: 80%;
-        font-weight: bold;
-        text-align: center;
-        vertical-align: middle;
-}
-.title {
-  font-size: 25pt; 
-  color: black; background: url("../img/lines.gif");
-  font-weight: bold;
-  border-width: 1px;
-  border-style: solid none solid none;
-  text-align: center;
-  vertical-align: middle;
-  padding-left: 8pt;
-  padding-top: 1px;
-  padding-bottom: 2px
-}
-A:link {
-        cursor: pointer;
-        text-decoration: none;
-        font-weight: bolder;
-}
-A:visited {
-        cursor: pointer;
-        text-decoration: underline;
-        font-weight: bolder;
-}
-A:hover {
-        cursor: pointer;
-        text-decoration: underline;
-        font-weight: bolder;
-}
-A:active {
-        cursor: pointer;
-        text-decoration: underline;
-        font-weight: bolder;
-        font-style: italic;
-}
-H1 {
- text-align: center;
- font-size: 140%;
- font-weight: bold;
-}
-H2 {
- font-size: 120%;
- font-style: italic;
-}
-H3 {
- font-size: 100%;
-}
-A.qindex {}
-A.qindexRef {}
-A.el { text-decoration: none; font-weight: bold }
-A.elRef { font-weight: bold }
-A.code { text-decoration: none; font-weight: normal; color: #4444ee }
-A.codeRef { font-weight: normal; color: #4444ee }
diff --git a/libclamav/c++/llvm/docs/doxygen.footer b/libclamav/c++/llvm/docs/doxygen.footer
deleted file mode 100644
index d75fff5..0000000
--- a/libclamav/c++/llvm/docs/doxygen.footer
+++ /dev/null
@@ -1,13 +0,0 @@
-<hr>
-<p class="footer">
-Generated on $datetime for <a href="http://llvm.org">$projectname</a> by
-<a href="http://www.doxygen.org"><img src="doxygen.png" alt="Doxygen"
-align="middle" border="0"/>$doxygenversion</a><br>
-Copyright &copy; 2003-2009 University of Illinois at Urbana-Champaign.
-All Rights Reserved.</p>
-
-<hr>
-<!--#include virtual="/attrib.incl" -->
-
-</body>
-</html>
diff --git a/libclamav/c++/llvm/docs/doxygen.header b/libclamav/c++/llvm/docs/doxygen.header
deleted file mode 100644
index a520434..0000000
--- a/libclamav/c++/llvm/docs/doxygen.header
+++ /dev/null
@@ -1,9 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
-<html><head>
-<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"/>
-<meta name="keywords" content="LLVM,Low Level Virtual Machine,C++,doxygen,API,documentation"/>
-<meta name="description" content="C++ source code API documentation for the Low Level Virtual Machine (LLVM)."/>
-<title>LLVM: $title</title>
-<link href="doxygen.css" rel="stylesheet" type="text/css"/>
-</head><body>
-<p class="title">LLVM API Documentation</p>
diff --git a/libclamav/c++/llvm/docs/doxygen.intro b/libclamav/c++/llvm/docs/doxygen.intro
deleted file mode 100644
index 547730c..0000000
--- a/libclamav/c++/llvm/docs/doxygen.intro
+++ /dev/null
@@ -1,18 +0,0 @@
-/// @mainpage Low Level Virtual Machine
-///
-/// @section main_intro Introduction
-/// Welcome to the Low Level Virtual Machine (LLVM).
-///
-/// This documentation describes the @b internal software that makes 
-/// up LLVM, not the @b external use of  LLVM. There are no instructions
-/// here on how to use LLVM, only the APIs that make up the software. For usage 
-/// instructions, please see the programmer's guide or reference manual.
-///
-/// @section main_caveat Caveat 
-/// This documentation is generated directly from the source code with doxygen. 
-/// Since LLVM is constantly under active development, what you're about to
-/// read is out of date! However, it may still be useful since certain portions
-/// of LLVM are very stable. 
-///
-/// @section main_changelog Change Log
-/// - Original content written 12/30/2003 by Reid Spencer
diff --git a/libclamav/c++/llvm/docs/img/Debugging.gif b/libclamav/c++/llvm/docs/img/Debugging.gif
deleted file mode 100644
index 662d35a..0000000
Binary files a/libclamav/c++/llvm/docs/img/Debugging.gif and /dev/null differ
diff --git a/libclamav/c++/llvm/docs/img/libdeps.gif b/libclamav/c++/llvm/docs/img/libdeps.gif
deleted file mode 100644
index c5c0ed4..0000000
Binary files a/libclamav/c++/llvm/docs/img/libdeps.gif and /dev/null differ
diff --git a/libclamav/c++/llvm/docs/img/lines.gif b/libclamav/c++/llvm/docs/img/lines.gif
deleted file mode 100644
index 88f491e..0000000
Binary files a/libclamav/c++/llvm/docs/img/lines.gif and /dev/null differ
diff --git a/libclamav/c++/llvm/docs/img/objdeps.gif b/libclamav/c++/llvm/docs/img/objdeps.gif
deleted file mode 100644
index 57c3e2e..0000000
Binary files a/libclamav/c++/llvm/docs/img/objdeps.gif and /dev/null differ
diff --git a/libclamav/c++/llvm/docs/img/venusflytrap.jpg b/libclamav/c++/llvm/docs/img/venusflytrap.jpg
deleted file mode 100644
index 59340ef..0000000
Binary files a/libclamav/c++/llvm/docs/img/venusflytrap.jpg and /dev/null differ
diff --git a/libclamav/c++/llvm/docs/index.html b/libclamav/c++/llvm/docs/index.html
deleted file mode 100644
index 28f4cde..0000000
--- a/libclamav/c++/llvm/docs/index.html
+++ /dev/null
@@ -1,291 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-                      "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-  <title>Documentation for the LLVM System at SVN head</title>
-  <link rel="stylesheet" href="llvm.css" type="text/css">
-</head>
-<body>
-
-<div class="doc_title">Documentation for the LLVM System at SVN head</div>
-
-<p class="doc_warning">If you are using a released version of LLVM,
-see <a href="http://llvm.org/releases/">the download page</a> to find
-your documentation.</p>
-
-<div class="doc_text">
-<table class="layout" width="95%"><tr class="layout"><td class="left">
-<ul>
-  <li><a href="#llvmdesign">LLVM Design</a></li>
-  <li><a href="/pubs/">LLVM Publications</a></li>
-  <li><a href="#userguide">LLVM User Guides</a></li>
-  <li><a href="#llvmprog">General LLVM Programming Documentation</a></li>
-  <li><a href="#subsystems">LLVM Subsystem Documentation</a></li>
-  <li><a href="#maillist">LLVM Mailing Lists</a></li>
-</ul>
-</td><td class="right">
-  <form action="http://www.google.com/search" method=get>
-    <p>
-      <input type="hidden" name="sitesearch" value="llvm.org/docs">
-      <input type=text name=q size=25><br>
-      <input type=submit value="Search the LLVM Docs" name="submit">
-    </p>
-  </form>
-</td></tr></table>
-</div>
-
-<div class="doc_author">
-  <p>Written by <a href="http://llvm.org">The LLVM Team</a></p>
-</div>
-
-<!--=======================================================================-->
-<div class="doc_section"><a name="llvmdesign">LLVM Design &amp; Overview</a></div>
-<!--=======================================================================-->
-
-<ul>
-<li><a href="LangRef.html">LLVM Language Reference Manual</a> - Defines the LLVM
-intermediate representation.</li>
-<li><a href="http://llvm.org/pubs/2008-10-04-ACAT-LLVM-Intro.html">Introduction to the LLVM Compiler </a> - Presentation describing LLVM.</li>
-<li><a href="http://llvm.org/pubs/2004-09-22-LCPCLLVMTutorial.html">The LLVM Compiler Framework and
-Infrastructure Tutorial</a> - Tutorial for writing passes, exploring the system.</li>
-<li><a href="http://llvm.org/pubs/2004-01-30-CGO-LLVM.html">LLVM: A Compilation Framework for
-Lifelong Program Analysis &amp; Transformation</a> - Design overview.</li>
-<li><a href="http://llvm.org/pubs/2002-12-LattnerMSThesis.html">LLVM: An Infrastructure for
-Multi-Stage Optimization</a> - More details (quite old now).</li>
-<li><a href="GetElementPtr.html">GetElementPtr FAQ</a> - Answers to some very
-frequent questions about LLVM's most frequently misunderstood instruction.</li>
-</ul>
-
-<!--=======================================================================-->
-<div class="doc_section"><a name="userguide">LLVM User Guides</a></div>
-<!--=======================================================================-->
-
-<ul>
-<li><a href="GettingStarted.html">The LLVM Getting Started Guide</a> -
-Discusses how to get up and running quickly with the LLVM infrastructure.
-Everything from unpacking and compilation of the distribution to execution of
-some tools.</li>
-
-<li><a href="GettingStartedVS.html">Getting Started with the LLVM System using
-Microsoft Visual Studio</a> - An addendum to the main Getting Started guide for
-those using Visual Studio on Windows.</li>
-
-<li><a href="tutorial/">LLVM Tutorial</a> - A walk through the process of using
-LLVM for a custom language, and the facilities LLVM offers in tutorial form.</li>
-<li><a href="DeveloperPolicy.html">Developer Policy</a> - The LLVM project's
-policy towards developers and their contributions.</li>
-
-<li><a href="/docs/CommandGuide/index.html">LLVM Command Guide</a> - A reference
-manual for the LLVM command line utilities ("man" pages for LLVM tools).<br>
-Current tools:
- <a href="/cmds/llvm-ar.html">llvm-ar</a>,
- <a href="/cmds/llvm-as.html">llvm-as</a>,
- <a href="/cmds/llvm-dis.html">llvm-dis</a>,
- <a href="/cmds/llvm-extract.html">llvm-extract</a>,
- <a href="/cmds/llvm-ld.html">llvm-ld</a>,
- <a href="/cmds/llvm-link.html">llvm-link</a>,
- <a href="/cmds/llvm-nm.html">llvm-nm</a>,
- <a href="/cmds/llvm-prof.html">llvm-prof</a>,
- <a href="/cmds/llvm-ranlib.html">llvm-ranlib</a>,
- <a href="/cmds/opt.html">opt</a>,
- <a href="/cmds/llc.html">llc</a>,
- <a href="/cmds/lli.html">lli</a>,
- <a href="/cmds/llvmc.html">llvmc</a>
- <a href="/cmds/llvmgcc.html">llvm-gcc</a>,
- <a href="/cmds/llvmgxx.html">llvm-g++</a>,
- <a href="/cmds/stkrc.html">stkrc</a>,
- <a href="/cmds/bugpoint.html">bugpoint</a>,
- <a href="/cmds/llvm-bcanalyzer.html">llvm-bcanalyzer</a>,
-</li>
-
-<li><a href="Passes.html">LLVM's Analysis and Transform Passes</a> - A list of
-optimizations and analyses implemented in LLVM.</li>
-
-<li><a href="FAQ.html">Frequently Asked Questions</a> - A list of common
-questions and problems and their solutions.</li>
-
-<li><a href="ReleaseNotes.html">Release notes for the current release</a>
-- This describes new features, known bugs, and other limitations.</li>
-
-<li><a href="HowToSubmitABug.html">How to Submit A Bug Report</a> -
-Instructions for properly submitting information about any bugs you run into in
-the LLVM system.</li>
-
-<li><a href="TestingGuide.html">LLVM Testing Infrastructure Guide</a> - A reference
-manual for using the LLVM testing infrastructure.</li>
-
-<li><a href="GCCFEBuildInstrs.html">How to build the Ada/C/C++/Fortran front-ends</a> -
-Instructions for building gcc front-ends from source.</li>
-
-<li><a href="Lexicon.html">The LLVM Lexicon</a> - Definition of acronyms, terms
-and concepts used in LLVM.</li>
-
-<li><a name="irc">You can probably find help on the unofficial LLVM IRC
-channel</a>.  We often are on irc.oftc.net in the #llvm channel.  If you are
-using the mozilla browser, and have chatzilla installed, you can <a
-href="irc://irc.oftc.net/llvm">join #llvm on irc.oftc.net</a> directly.</li>
-
-</ul>
-
-
-<!--=======================================================================-->
-<div class="doc_section"><a name="llvmprog">General LLVM Programming Documentation</a></div>
-<!--=======================================================================-->
-
-<ul>
-<li><a href="LangRef.html">LLVM Language Reference Manual</a> - Defines the LLVM
-intermediate representation and the assembly form of the different nodes.</li>
-
-<li><a href="ProgrammersManual.html">The LLVM Programmers Manual</a> -
-Introduction to the general layout of the LLVM sourcebase, important classes
-and APIs, and some tips &amp; tricks.</li>
-
-<li><a href="Projects.html">LLVM Project Guide</a> - How-to guide and
-templates for new projects that <em>use</em> the LLVM infrastructure.  The
-templates (directory organization, Makefiles, and test tree) allow the project
-code to be located outside (or inside) the <tt>llvm/</tt> tree, while using LLVM
-header files and libraries.</li>
-
-<li><a href="MakefileGuide.html">LLVM Makefile Guide</a> - Describes how the
-LLVM makefiles work and how to use them.</li>
-
-<li><a href="CommandLine.html">CommandLine library Reference Manual</a> -
-Provides information on using the command line parsing library.</li>
-
-<li><a href="CodingStandards.html">LLVM Coding standards</a> -
-Details the LLVM coding standards and provides useful information on writing
-efficient C++ code.</li>
-
-<li><a href="ExtendingLLVM.html">Extending LLVM</a> - Look here to see how
-to add instructions and intrinsics to LLVM.</li>
-
-<li><a href="UsingLibraries.html">Using LLVM Libraries</a> - Look here to
-understand how to use the libraries produced when LLVM is compiled.</li>
-
-<li><a href="HowToReleaseLLVM.html">How To Release LLVM To The Public</a> - This
-is a guide to preparing LLVM releases. Most developers can ignore it.</li>
-
-<li><a href="http://llvm.org/doxygen/">Doxygen generated
-documentation</a> (<a
-href="http://llvm.org/doxygen/inherits.html">classes</a>)
-
-(<a href="http://llvm.org/doxygen/doxygen.tar.gz">tarball</a>)
-</li>
-
-<li><a href="http://llvm.org/viewvc/">ViewVC Repository Browser</a></li>
-
-</ul>
-
-<!--=======================================================================-->
-<div class="doc_section"><a name="subsystems">LLVM Subsystem Documentation</a></div>
-<!--=======================================================================-->
-
-<ul>
-
-<li><a href="WritingAnLLVMPass.html">Writing an LLVM Pass</a> - Information
-on how to write LLVM transformations and analyses.</li>
-
-<li><a href="WritingAnLLVMBackend.html">Writing an LLVM Backend</a> - Information
-on how to write LLVM backends for machine targets.</li>
-
-<li><a href="CodeGenerator.html">The LLVM Target-Independent Code
-Generator</a> - The design and implementation of the LLVM code generator.
-Useful if you are working on retargetting LLVM to a new architecture, designing
-a new codegen pass, or enhancing existing components.</li>
-
-<li><a href="TableGenFundamentals.html">TableGen Fundamentals</a> -
-Describes the TableGen tool, which is used heavily by the LLVM code
-generator.</li>
-
-<li><a href="AliasAnalysis.html">Alias Analysis in LLVM</a> - Information
-on how to write a new alias analysis implementation or how to use existing
-analyses.</li>
-
-<li><a href="GarbageCollection.html">Accurate Garbage Collection with
-LLVM</a> - The interfaces source-language compilers should use for compiling
-GC'd programs.</li>
-
-<li><a href="SourceLevelDebugging.html">Source Level Debugging with
-LLVM</a> - This document describes the design and philosophy behind the LLVM
-source-level debugger.</li>
-
-<li><a href="ExceptionHandling.html">Zero Cost Exception handling in LLVM</a>
-- This document describes the design and implementation of exception handling
-in LLVM.</li>
-
-<li><a href="Bugpoint.html">Bugpoint</a> - automatic bug finder and test-case
-reducer description and usage information.</li>
-
-<li><a href="CompilerDriverTutorial.html">Compiler Driver (llvmc) Tutorial</a>
-- This document is a tutorial introduction to the usage and
-configuration of the LLVM compiler driver tool, <tt>llvmc</tt>.</li>
-
-<li><a href="CompilerDriver.html">Compiler Driver (llvmc)
-Reference</a> - This document describes the design and configuration
-of <tt>llvmc</tt> in more detail.</li>
-
-<li><a href="BitCodeFormat.html">LLVM Bitcode File Format</a> - This describes
-the file format and encoding used for LLVM "bc" files.</li>
-
-<li><a href="SystemLibrary.html">System Library</a> - This document describes
-the LLVM System Library (<tt>lib/System</tt>) and how to keep LLVM source code
-portable</li>
-
-<li><a href="LinkTimeOptimization.html">Link Time Optimization</a> - This
-document describes the interface between LLVM intermodular optimizer and
-the linker and its design</li>
-
-<li><a href="GoldPlugin.html">The LLVM gold plugin</a> - How to build your
-programs with link-time optimization on Linux.</li>
-
-<li><a href="DebuggingJITedCode.html">The GDB JIT interface</a> - How to debug
-JITed code with GDB.</li>
-</ul>
-
-
-<!--=======================================================================-->
-<div class="doc_section"><a name="maillist">LLVM Mailing Lists</a></div>
-<!--=======================================================================-->
-
-<ul>
-<li>The <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-announce">
-LLVM Announcements List</a>: This is a low volume list that provides important
-announcements regarding LLVM.  It gets email about once a month.</li>
-
-<li>The <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">Developer's
-List</a>: This list is for people who want to be included in technical
-discussions of LLVM. People post to this list when they have questions about
-writing code for or using the LLVM tools. It is relatively low volume.</li>
-
-<li>The <a href="http://lists.cs.uiuc.edu/pipermail/llvmbugs/">Bugs &amp;
-Patches Archive</a>: This list gets emailed every time a bug is opened and
-closed, and when people submit patches to be included in LLVM.  It is higher
-volume than the LLVMdev list.</li>
-
-<li>The <a href="http://lists.cs.uiuc.edu/pipermail/llvm-commits/">Commits
-Archive</a>: This list contains all commit messages that are made when LLVM
-developers commit code changes to the repository. It is useful for those who
-want to stay on the bleeding edge of LLVM development. This list is very high
-volume.</li>
-
-<li>The <a href="http://lists.cs.uiuc.edu/pipermail/llvm-testresults/">
-Test Results Archive</a>: A message is automatically sent to this list by every
-active nightly tester when it completes.  As such, this list gets email several
-times each day, making it a high volume list.</li>
-
-</ul>
-
-<!-- *********************************************************************** -->
-
-<hr>
-<address>
-  <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
-  src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS"></a>
-  <a href="http://validator.w3.org/check/referer"><img
-  src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
-
-  <a href="http://llvm.org">LLVM Compiler Infrastructure</a><br>
-  Last modified: $Date$
-</address>
-</body></html>
-
diff --git a/libclamav/c++/llvm/docs/llvm.css b/libclamav/c++/llvm/docs/llvm.css
deleted file mode 100644
index f572b5e..0000000
--- a/libclamav/c++/llvm/docs/llvm.css
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * LLVM documentation style sheet
- */
-
-/* Common styles */
-.body { color: black; background: white; margin: 0 0 0 0 }
-
-/* No borders on image links */
-a:link img, a:visited img { border-style: none }
-
-address img { float: right; width: 88px; height: 31px; }
-address     { clear: right; }
-
-table       { text-align: center; border: 2px solid black;
-              border-collapse: collapse; margin-top: 1em; margin-left: 1em;
-              margin-right: 1em; margin-bottom: 1em; }
-tr, td      { border: 2px solid gray; padding: 4pt 4pt 2pt 2pt; }
-th          { border: 2px solid gray; font-weight: bold; font-size: 105%;
-              background: url("img/lines.gif");
-              font-family: "Georgia,Palatino,Times,Roman,SanSerif";
-              text-align: center; vertical-align: middle; }
-/*
- * Documentation
- */
-/* Common for title and header */
-.doc_title, .doc_section, .doc_subsection, h1, h2 {
-  color: black; background: url("img/lines.gif");
-  font-family: "Georgia,Palatino,Times,Roman,SanSerif"; font-weight: bold;
-  border-width: 1px;
-  border-style: solid none solid none;
-  text-align: center;
-  vertical-align: middle;
-  padding-left: 8pt;
-  padding-top: 1px;
-  padding-bottom: 2px
-}
-
-h1, .doc_section   { text-align: center; font-size: 22pt;
-                     margin: 20pt 0pt 5pt 0pt; }
-
-.doc_title, .title { text-align: left;   font-size: 25pt }
-
-h2, .doc_subsection { width: 75%;
-                      text-align: left;  font-size: 12pt;
-                      padding: 4pt 4pt 4pt 4pt;
-                      margin: 1.5em 0.5em 0.5em 0.5em }
-
-h3, .doc_subsubsection { margin: 2.0em 0.5em 0.5em 0.5em;
-                         font-weight: bold; font-style: oblique;
-                         border-bottom: 1px solid #999999; font-size: 12pt;
-                         width: 75%; }
-
-.doc_author     { text-align: left; font-weight: bold; padding-left: 20pt }
-.doc_text       { text-align: left; padding-left: 20pt; padding-right: 10pt }
-
-.doc_footer     { text-align: left; padding: 0 0 0 0 }
-
-.doc_hilite     { color: blue; font-weight: bold; }
-
-.doc_table      { text-align: center; width: 90%;
-                  padding: 1px 1px 1px 1px; border: 1px; }
-
-.doc_warning    { color: red; font-weight: bold }
-
-/* <div class="doc_code"> would use this class, and <div> adds more padding */
-.doc_code, .literal-block
-                { border: solid 1px gray; background: #eeeeee;
-                  margin: 0 1em 0 1em;
-                  padding: 0 1em 0 1em;
-                  display: table;
-                }
-
-/* It is preferrable to use <pre class="doc_code"> everywhere instead of the
- * <div class="doc_code"><pre>...</ptr></div> construct.
- *
- * Once all docs use <pre> for code regions, this style can  be merged with the
- * one above, and we can drop the [pre] qualifier.
- */
-pre.doc_code, .literal-block { padding: 1em 2em 1em 1em }
-
-.doc_notes      { background: #fafafa; border: 1px solid #cecece;
-                  display: table; padding: 0 1em 0 .1em }
-
-table.layout    { text-align: left; border: none; border-collapse: collapse;
-                  padding: 4px 4px 4px 4px; }
-tr.layout, td.layout, td.left, td.right
-                { border: none; padding: 4pt 4pt 2pt 2pt; vertical-align: top; }
-td.left         { text-align: left }
-td.right        { text-align: right }
-th.layout       { border: none; font-weight: bold; font-size: 105%;
-                  text-align: center; vertical-align: middle; }
-
-/* Left align table cell */
-.td_left        { border: 2px solid gray; text-align: left; }
-
-/* ReST-specific */
-.title { margin-top: 0 }
-.topic-title{ display: none }
-div.contents ul { list-style-type: decimal }
-.toc-backref    { color: black; text-decoration: none; }
diff --git a/libclamav/c++/llvm/docs/re_format.7 b/libclamav/c++/llvm/docs/re_format.7
deleted file mode 100644
index 0c09287..0000000
--- a/libclamav/c++/llvm/docs/re_format.7
+++ /dev/null
@@ -1,756 +0,0 @@
-.\"	$OpenBSD: re_format.7,v 1.14 2007/05/31 19:19:30 jmc Exp $
-.\"
-.\" Copyright (c) 1997, Phillip F Knaack. All rights reserved.
-.\"
-.\" Copyright (c) 1992, 1993, 1994 Henry Spencer.
-.\" Copyright (c) 1992, 1993, 1994
-.\"	The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Henry Spencer.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"	@(#)re_format.7	8.3 (Berkeley) 3/20/94
-.\"
-.Dd $Mdocdate: May 31 2007 $
-.Dt RE_FORMAT 7
-.Os
-.Sh NAME
-.Nm re_format
-.Nd POSIX regular expressions
-.Sh DESCRIPTION
-Regular expressions (REs),
-as defined in
-.St -p1003.1-2004 ,
-come in two forms:
-basic regular expressions
-(BREs)
-and extended regular expressions
-(EREs).
-Both forms of regular expressions are supported
-by the interfaces described in
-.Xr regex 3 .
-Applications dealing with regular expressions
-may use one or the other form
-(or indeed both).
-For example,
-.Xr ed 1
-uses BREs,
-whilst
-.Xr egrep 1
-talks EREs.
-Consult the manual page for the specific application to find out which
-it uses.
-.Pp
-POSIX leaves some aspects of RE syntax and semantics open;
-.Sq **
-marks decisions on these aspects that
-may not be fully portable to other POSIX implementations.
-.Pp
-This manual page first describes regular expressions in general,
-specifically extended regular expressions,
-and then discusses differences between them and basic regular expressions.
-.Sh EXTENDED REGULAR EXPRESSIONS
-An ERE is one** or more non-empty**
-.Em branches ,
-separated by
-.Sq \*(Ba .
-It matches anything that matches one of the branches.
-.Pp
-A branch is one** or more
-.Em pieces ,
-concatenated.
-It matches a match for the first, followed by a match for the second, etc.
-.Pp
-A piece is an
-.Em atom
-possibly followed by a single**
-.Sq * ,
-.Sq + ,
-.Sq ?\& ,
-or
-.Em bound .
-An atom followed by
-.Sq *
-matches a sequence of 0 or more matches of the atom.
-An atom followed by
-.Sq +
-matches a sequence of 1 or more matches of the atom.
-An atom followed by
-.Sq ?\&
-matches a sequence of 0 or 1 matches of the atom.
-.Pp
-A bound is
-.Sq {
-followed by an unsigned decimal integer,
-possibly followed by
-.Sq ,\&
-possibly followed by another unsigned decimal integer,
-always followed by
-.Sq } .
-The integers must lie between 0 and
-.Dv RE_DUP_MAX
-(255**) inclusive,
-and if there are two of them, the first may not exceed the second.
-An atom followed by a bound containing one integer
-.Ar i
-and no comma matches
-a sequence of exactly
-.Ar i
-matches of the atom.
-An atom followed by a bound
-containing one integer
-.Ar i
-and a comma matches
-a sequence of
-.Ar i
-or more matches of the atom.
-An atom followed by a bound
-containing two integers
-.Ar i
-and
-.Ar j
-matches a sequence of
-.Ar i
-through
-.Ar j
-(inclusive) matches of the atom.
-.Pp
-An atom is a regular expression enclosed in
-.Sq ()
-(matching a part of the regular expression),
-an empty set of
-.Sq ()
-(matching the null string)**,
-a
-.Em bracket expression
-(see below),
-.Sq .\&
-(matching any single character),
-.Sq ^
-(matching the null string at the beginning of a line),
-.Sq $
-(matching the null string at the end of a line),
-a
-.Sq \e
-followed by one of the characters
-.Sq ^.[$()|*+?{\e
-(matching that character taken as an ordinary character),
-a
-.Sq \e
-followed by any other character**
-(matching that character taken as an ordinary character,
-as if the
-.Sq \e
-had not been present**),
-or a single character with no other significance (matching that character).
-A
-.Sq {
-followed by a character other than a digit is an ordinary character,
-not the beginning of a bound**.
-It is illegal to end an RE with
-.Sq \e .
-.Pp
-A bracket expression is a list of characters enclosed in
-.Sq [] .
-It normally matches any single character from the list (but see below).
-If the list begins with
-.Sq ^ ,
-it matches any single character
-.Em not
-from the rest of the list
-(but see below).
-If two characters in the list are separated by
-.Sq - ,
-this is shorthand for the full
-.Em range
-of characters between those two (inclusive) in the
-collating sequence, e.g.\&
-.Sq [0-9]
-in ASCII matches any decimal digit.
-It is illegal** for two ranges to share an endpoint, e.g.\&
-.Sq a-c-e .
-Ranges are very collating-sequence-dependent,
-and portable programs should avoid relying on them.
-.Pp
-To include a literal
-.Sq ]\&
-in the list, make it the first character
-(following a possible
-.Sq ^ ) .
-To include a literal
-.Sq - ,
-make it the first or last character,
-or the second endpoint of a range.
-To use a literal
-.Sq -
-as the first endpoint of a range,
-enclose it in
-.Sq [.
-and
-.Sq .]
-to make it a collating element (see below).
-With the exception of these and some combinations using
-.Sq [
-(see next paragraphs),
-all other special characters, including
-.Sq \e ,
-lose their special significance within a bracket expression.
-.Pp
-Within a bracket expression, a collating element
-(a character,
-a multi-character sequence that collates as if it were a single character,
-or a collating-sequence name for either)
-enclosed in
-.Sq [.
-and
-.Sq .]
-stands for the sequence of characters of that collating element.
-The sequence is a single element of the bracket expression's list.
-A bracket expression containing a multi-character collating element
-can thus match more than one character,
-e.g. if the collating sequence includes a
-.Sq ch
-collating element,
-then the RE
-.Sq [[.ch.]]*c
-matches the first five characters of
-.Sq chchcc .
-.Pp
-Within a bracket expression, a collating element enclosed in
-.Sq [=
-and
-.Sq =]
-is an equivalence class, standing for the sequences of characters
-of all collating elements equivalent to that one, including itself.
-(If there are no other equivalent collating elements,
-the treatment is as if the enclosing delimiters were
-.Sq [.
-and
-.Sq .] . )
-For example, if
-.Sq x
-and
-.Sq y
-are the members of an equivalence class,
-then
-.Sq [[=x=]] ,
-.Sq [[=y=]] ,
-and
-.Sq [xy]
-are all synonymous.
-An equivalence class may not** be an endpoint of a range.
-.Pp
-Within a bracket expression, the name of a
-.Em character class
-enclosed
-in
-.Sq [:
-and
-.Sq :]
-stands for the list of all characters belonging to that class.
-Standard character class names are:
-.Bd -literal -offset indent
-alnum	digit	punct
-alpha	graph	space
-blank	lower	upper
-cntrl	print	xdigit
-.Ed
-.Pp
-These stand for the character classes defined in
-.Xr ctype 3 .
-A locale may provide others.
-A character class may not be used as an endpoint of a range.
-.Pp
-There are two special cases** of bracket expressions:
-the bracket expressions
-.Sq [[:<:]]
-and
-.Sq [[:>:]]
-match the null string at the beginning and end of a word, respectively.
-A word is defined as a sequence of
-characters starting and ending with a word character
-which is neither preceded nor followed by
-word characters.
-A word character is an
-.Em alnum
-character (as defined by
-.Xr ctype 3 )
-or an underscore.
-This is an extension,
-compatible with but not specified by POSIX,
-and should be used with
-caution in software intended to be portable to other systems.
-.Pp
-In the event that an RE could match more than one substring of a given
-string,
-the RE matches the one starting earliest in the string.
-If the RE could match more than one substring starting at that point,
-it matches the longest.
-Subexpressions also match the longest possible substrings, subject to
-the constraint that the whole match be as long as possible,
-with subexpressions starting earlier in the RE taking priority over
-ones starting later.
-Note that higher-level subexpressions thus take priority over
-their lower-level component subexpressions.
-.Pp
-Match lengths are measured in characters, not collating elements.
-A null string is considered longer than no match at all.
-For example,
-.Sq bb*
-matches the three middle characters of
-.Sq abbbc ;
-.Sq (wee|week)(knights|nights)
-matches all ten characters of
-.Sq weeknights ;
-when
-.Sq (.*).*
-is matched against
-.Sq abc ,
-the parenthesized subexpression matches all three characters;
-and when
-.Sq (a*)*
-is matched against
-.Sq bc ,
-both the whole RE and the parenthesized subexpression match the null string.
-.Pp
-If case-independent matching is specified,
-the effect is much as if all case distinctions had vanished from the
-alphabet.
-When an alphabetic that exists in multiple cases appears as an
-ordinary character outside a bracket expression, it is effectively
-transformed into a bracket expression containing both cases,
-e.g.\&
-.Sq x
-becomes
-.Sq [xX] .
-When it appears inside a bracket expression,
-all case counterparts of it are added to the bracket expression,
-so that, for example,
-.Sq [x]
-becomes
-.Sq [xX]
-and
-.Sq [^x]
-becomes
-.Sq [^xX] .
-.Pp
-No particular limit is imposed on the length of REs**.
-Programs intended to be portable should not employ REs longer
-than 256 bytes,
-as an implementation can refuse to accept such REs and remain
-POSIX-compliant.
-.Pp
-The following is a list of extended regular expressions:
-.Bl -tag -width Ds
-.It Ar c
-Any character
-.Ar c
-not listed below matches itself.
-.It \e Ns Ar c
-Any backslash-escaped character
-.Ar c
-matches itself.
-.It \&.
-Matches any single character that is not a newline
-.Pq Sq \en .
-.It Bq Ar char-class
-Matches any single character in
-.Ar char-class .
-To include a
-.Ql \&]
-in
-.Ar char-class ,
-it must be the first character.
-A range of characters may be specified by separating the end characters
-of the range with a
-.Ql - ;
-e.g.\&
-.Ar a-z
-specifies the lower case characters.
-The following literal expressions can also be used in
-.Ar char-class
-to specify sets of characters:
-.Bd -unfilled -offset indent
-[:alnum:] [:cntrl:] [:lower:] [:space:]
-[:alpha:] [:digit:] [:print:] [:upper:]
-[:blank:] [:graph:] [:punct:] [:xdigit:]
-.Ed
-.Pp
-If
-.Ql -
-appears as the first or last character of
-.Ar char-class ,
-then it matches itself.
-All other characters in
-.Ar char-class
-match themselves.
-.Pp
-Patterns in
-.Ar char-class
-of the form
-.Eo [.
-.Ar col-elm
-.Ec .]\&
-or
-.Eo [=
-.Ar col-elm
-.Ec =]\& ,
-where
-.Ar col-elm
-is a collating element, are interpreted according to
-.Xr setlocale 3
-.Pq not currently supported .
-.It Bq ^ Ns Ar char-class
-Matches any single character, other than newline, not in
-.Ar char-class .
-.Ar char-class
-is defined as above.
-.It ^
-If
-.Sq ^
-is the first character of a regular expression, then it
-anchors the regular expression to the beginning of a line.
-Otherwise, it matches itself.
-.It $
-If
-.Sq $
-is the last character of a regular expression,
-it anchors the regular expression to the end of a line.
-Otherwise, it matches itself.
-.It [[:<:]]
-Anchors the single character regular expression or subexpression
-immediately following it to the beginning of a word.
-.It [[:>:]]
-Anchors the single character regular expression or subexpression
-immediately following it to the end of a word.
-.It Pq Ar re
-Defines a subexpression
-.Ar re .
-Any set of characters enclosed in parentheses
-matches whatever the set of characters without parentheses matches
-(that is a long-winded way of saying the constructs
-.Sq (re)
-and
-.Sq re
-match identically).
-.It *
-Matches the single character regular expression or subexpression
-immediately preceding it zero or more times.
-If
-.Sq *
-is the first character of a regular expression or subexpression,
-then it matches itself.
-The
-.Sq *
-operator sometimes yields unexpected results.
-For example, the regular expression
-.Ar b*
-matches the beginning of the string
-.Qq abbb
-(as opposed to the substring
-.Qq bbb ) ,
-since a null match is the only leftmost match.
-.It +
-Matches the singular character regular expression
-or subexpression immediately preceding it
-one or more times.
-.It ?
-Matches the singular character regular expression
-or subexpression immediately preceding it
-0 or 1 times.
-.Sm off
-.It Xo
-.Pf { Ar n , m No }\ \&
-.Pf { Ar n , No }\ \&
-.Pf { Ar n No }
-.Xc
-.Sm on
-Matches the single character regular expression or subexpression
-immediately preceding it at least
-.Ar n
-and at most
-.Ar m
-times.
-If
-.Ar m
-is omitted, then it matches at least
-.Ar n
-times.
-If the comma is also omitted, then it matches exactly
-.Ar n
-times.
-.It \*(Ba
-Used to separate patterns.
-For example,
-the pattern
-.Sq cat\*(Badog
-matches either
-.Sq cat
-or
-.Sq dog .
-.El
-.Sh BASIC REGULAR EXPRESSIONS
-Basic regular expressions differ in several respects:
-.Bl -bullet -offset 3n
-.It
-.Sq \*(Ba ,
-.Sq + ,
-and
-.Sq ?\&
-are ordinary characters and there is no equivalent
-for their functionality.
-.It
-The delimiters for bounds are
-.Sq \e{
-and
-.Sq \e} ,
-with
-.Sq {
-and
-.Sq }
-by themselves ordinary characters.
-.It
-The parentheses for nested subexpressions are
-.Sq \e(
-and
-.Sq \e) ,
-with
-.Sq (
-and
-.Sq )\&
-by themselves ordinary characters.
-.It
-.Sq ^
-is an ordinary character except at the beginning of the
-RE or** the beginning of a parenthesized subexpression.
-.It
-.Sq $
-is an ordinary character except at the end of the
-RE or** the end of a parenthesized subexpression.
-.It
-.Sq *
-is an ordinary character if it appears at the beginning of the
-RE or the beginning of a parenthesized subexpression
-(after a possible leading
-.Sq ^ ) .
-.It
-Finally, there is one new type of atom, a
-.Em back-reference :
-.Sq \e
-followed by a non-zero decimal digit
-.Ar d
-matches the same sequence of characters matched by the
-.Ar d Ns th
-parenthesized subexpression
-(numbering subexpressions by the positions of their opening parentheses,
-left to right),
-so that, for example,
-.Sq \e([bc]\e)\e1
-matches
-.Sq bb\&
-or
-.Sq cc
-but not
-.Sq bc .
-.El
-.Pp
-The following is a list of basic regular expressions:
-.Bl -tag -width Ds
-.It Ar c
-Any character
-.Ar c
-not listed below matches itself.
-.It \e Ns Ar c
-Any backslash-escaped character
-.Ar c ,
-except for
-.Sq { ,
-.Sq } ,
-.Sq \&( ,
-and
-.Sq \&) ,
-matches itself.
-.It \&.
-Matches any single character that is not a newline
-.Pq Sq \en .
-.It Bq Ar char-class
-Matches any single character in
-.Ar char-class .
-To include a
-.Ql \&]
-in
-.Ar char-class ,
-it must be the first character.
-A range of characters may be specified by separating the end characters
-of the range with a
-.Ql - ;
-e.g.\&
-.Ar a-z
-specifies the lower case characters.
-The following literal expressions can also be used in
-.Ar char-class
-to specify sets of characters:
-.Bd -unfilled -offset indent
-[:alnum:] [:cntrl:] [:lower:] [:space:]
-[:alpha:] [:digit:] [:print:] [:upper:]
-[:blank:] [:graph:] [:punct:] [:xdigit:]
-.Ed
-.Pp
-If
-.Ql -
-appears as the first or last character of
-.Ar char-class ,
-then it matches itself.
-All other characters in
-.Ar char-class
-match themselves.
-.Pp
-Patterns in
-.Ar char-class
-of the form
-.Eo [.
-.Ar col-elm
-.Ec .]\&
-or
-.Eo [=
-.Ar col-elm
-.Ec =]\& ,
-where
-.Ar col-elm
-is a collating element, are interpreted according to
-.Xr setlocale 3
-.Pq not currently supported .
-.It Bq ^ Ns Ar char-class
-Matches any single character, other than newline, not in
-.Ar char-class .
-.Ar char-class
-is defined as above.
-.It ^
-If
-.Sq ^
-is the first character of a regular expression, then it
-anchors the regular expression to the beginning of a line.
-Otherwise, it matches itself.
-.It $
-If
-.Sq $
-is the last character of a regular expression,
-it anchors the regular expression to the end of a line.
-Otherwise, it matches itself.
-.It [[:<:]]
-Anchors the single character regular expression or subexpression
-immediately following it to the beginning of a word.
-.It [[:>:]]
-Anchors the single character regular expression or subexpression
-immediately following it to the end of a word.
-.It \e( Ns Ar re Ns \e)
-Defines a subexpression
-.Ar re .
-Subexpressions may be nested.
-A subsequent backreference of the form
-.Pf \e Ns Ar n ,
-where
-.Ar n
-is a number in the range [1,9], expands to the text matched by the
-.Ar n Ns th
-subexpression.
-For example, the regular expression
-.Ar \e(.*\e)\e1
-matches any string consisting of identical adjacent substrings.
-Subexpressions are ordered relative to their left delimiter.
-.It *
-Matches the single character regular expression or subexpression
-immediately preceding it zero or more times.
-If
-.Sq *
-is the first character of a regular expression or subexpression,
-then it matches itself.
-The
-.Sq *
-operator sometimes yields unexpected results.
-For example, the regular expression
-.Ar b*
-matches the beginning of the string
-.Qq abbb
-(as opposed to the substring
-.Qq bbb ) ,
-since a null match is the only leftmost match.
-.Sm off
-.It Xo
-.Pf \e{ Ar n , m No \e}\ \&
-.Pf \e{ Ar n , No \e}\ \&
-.Pf \e{ Ar n No \e}
-.Xc
-.Sm on
-Matches the single character regular expression or subexpression
-immediately preceding it at least
-.Ar n
-and at most
-.Ar m
-times.
-If
-.Ar m
-is omitted, then it matches at least
-.Ar n
-times.
-If the comma is also omitted, then it matches exactly
-.Ar n
-times.
-.El
-.Sh SEE ALSO
-.Xr ctype 3 ,
-.Xr regex 3
-.Sh STANDARDS
-.St -p1003.1-2004 :
-Base Definitions, Chapter 9 (Regular Expressions).
-.Sh BUGS
-Having two kinds of REs is a botch.
-.Pp
-The current POSIX spec says that
-.Sq )\&
-is an ordinary character in the absence of an unmatched
-.Sq ( ;
-this was an unintentional result of a wording error,
-and change is likely.
-Avoid relying on it.
-.Pp
-Back-references are a dreadful botch,
-posing major problems for efficient implementations.
-They are also somewhat vaguely defined
-(does
-.Sq a\e(\e(b\e)*\e2\e)*d
-match
-.Sq abbbd ? ) .
-Avoid using them.
-.Pp
-POSIX's specification of case-independent matching is vague.
-The
-.Dq one case implies all cases
-definition given above
-is the current consensus among implementors as to the right interpretation.
-.Pp
-The syntax for word boundaries is incredibly ugly.
diff --git a/libclamav/c++/llvm/docs/tutorial/LangImpl1.html b/libclamav/c++/llvm/docs/tutorial/LangImpl1.html
deleted file mode 100644
index 66843db..0000000
--- a/libclamav/c++/llvm/docs/tutorial/LangImpl1.html
+++ /dev/null
@@ -1,348 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-                      "http://www.w3.org/TR/html4/strict.dtd">
-
-<html>
-<head>
-  <title>Kaleidoscope: Tutorial Introduction and the Lexer</title>
-  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-  <meta name="author" content="Chris Lattner">
-  <link rel="stylesheet" href="../llvm.css" type="text/css">
-</head>
-
-<body>
-
-<div class="doc_title">Kaleidoscope: Tutorial Introduction and the Lexer</div>
-
-<ul>
-<li><a href="index.html">Up to Tutorial Index</a></li>
-<li>Chapter 1
-  <ol>
-    <li><a href="#intro">Tutorial Introduction</a></li>
-    <li><a href="#language">The Basic Language</a></li>
-    <li><a href="#lexer">The Lexer</a></li>
-  </ol>
-</li>
-<li><a href="LangImpl2.html">Chapter 2</a>: Implementing a Parser and AST</li>
-</ul>
-
-<div class="doc_author">
-  <p>Written by <a href="mailto:sabre at nondot.org">Chris Lattner</a></p>
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="intro">Tutorial Introduction</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>Welcome to the "Implementing a language with LLVM" tutorial.  This tutorial
-runs through the implementation of a simple language, showing how fun and
-easy it can be.  This tutorial will get you up and started as well as help to
-build a framework you can extend to other languages.  The code in this tutorial
-can also be used as a playground to hack on other LLVM specific things.
-</p>
-
-<p>
-The goal of this tutorial is to progressively unveil our language, describing
-how it is built up over time.  This will let us cover a fairly broad range of
-language design and LLVM-specific usage issues, showing and explaining the code
-for it all along the way, without overwhelming you with tons of details up
-front.</p>
-
-<p>It is useful to point out ahead of time that this tutorial is really about
-teaching compiler techniques and LLVM specifically, <em>not</em> about teaching
-modern and sane software engineering principles.  In practice, this means that
-we'll take a number of shortcuts to simplify the exposition.  For example, the
-code leaks memory, uses global variables all over the place, doesn't use nice
-design patterns like <a
-href="http://en.wikipedia.org/wiki/Visitor_pattern">visitors</a>, etc... but it
-is very simple.  If you dig in and use the code as a basis for future projects,
-fixing these deficiencies shouldn't be hard.</p>
-
-<p>I've tried to put this tutorial together in a way that makes chapters easy to
-skip over if you are already familiar with or are uninterested in the various
-pieces.  The structure of the tutorial is:
-</p>
-
-<ul>
-<li><b><a href="#language">Chapter #1</a>: Introduction to the Kaleidoscope
-language, and the definition of its Lexer</b> - This shows where we are going
-and the basic functionality that we want it to do.  In order to make this
-tutorial maximally understandable and hackable, we choose to implement 
-everything in C++ instead of using lexer and parser generators.  LLVM obviously
-works just fine with such tools, feel free to use one if you prefer.</li>
-<li><b><a href="LangImpl2.html">Chapter #2</a>: Implementing a Parser and
-AST</b> - With the lexer in place, we can talk about parsing techniques and
-basic AST construction.  This tutorial describes recursive descent parsing and
-operator precedence parsing.  Nothing in Chapters 1 or 2 is LLVM-specific,
-the code doesn't even link in LLVM at this point. :)</li>
-<li><b><a href="LangImpl3.html">Chapter #3</a>: Code generation to LLVM IR</b> -
-With the AST ready, we can show off how easy generation of LLVM IR really 
-is.</li>
-<li><b><a href="LangImpl4.html">Chapter #4</a>: Adding JIT and Optimizer
-Support</b> - Because a lot of people are interested in using LLVM as a JIT,
-we'll dive right into it and show you the 3 lines it takes to add JIT support.
-LLVM is also useful in many other ways, but this is one simple and "sexy" way
-to shows off its power. :)</li>
-<li><b><a href="LangImpl5.html">Chapter #5</a>: Extending the Language: Control
-Flow</b> - With the language up and running, we show how to extend it with
-control flow operations (if/then/else and a 'for' loop).  This gives us a chance
-to talk about simple SSA construction and control flow.</li>
-<li><b><a href="LangImpl6.html">Chapter #6</a>: Extending the Language: 
-User-defined Operators</b> - This is a silly but fun chapter that talks about
-extending the language to let the user program define their own arbitrary
-unary and binary operators (with assignable precedence!).  This lets us build a
-significant piece of the "language" as library routines.</li>
-<li><b><a href="LangImpl7.html">Chapter #7</a>: Extending the Language: Mutable
-Variables</b> - This chapter talks about adding user-defined local variables
-along with an assignment operator.  The interesting part about this is how
-easy and trivial it is to construct SSA form in LLVM: no, LLVM does <em>not</em>
-require your front-end to construct SSA form!</li>
-<li><b><a href="LangImpl8.html">Chapter #8</a>: Conclusion and other useful LLVM
-tidbits</b> - This chapter wraps up the series by talking about potential
-ways to extend the language, but also includes a bunch of pointers to info about
-"special topics" like adding garbage collection support, exceptions, debugging,
-support for "spaghetti stacks", and a bunch of other tips and tricks.</li>
-
-</ul>
-
-<p>By the end of the tutorial, we'll have written a bit less than 700 lines of 
-non-comment, non-blank, lines of code.  With this small amount of code, we'll
-have built up a very reasonable compiler for a non-trivial language including
-a hand-written lexer, parser, AST, as well as code generation support with a JIT
-compiler.  While other systems may have interesting "hello world" tutorials,
-I think the breadth of this tutorial is a great testament to the strengths of
-LLVM and why you should consider it if you're interested in language or compiler
-design.</p>
-
-<p>A note about this tutorial: we expect you to extend the language and play
-with it on your own.  Take the code and go crazy hacking away at it, compilers
-don't need to be scary creatures - it can be a lot of fun to play with
-languages!</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="language">The Basic Language</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>This tutorial will be illustrated with a toy language that we'll call
-"<a href="http://en.wikipedia.org/wiki/Kaleidoscope">Kaleidoscope</a>" (derived 
-from "meaning beautiful, form, and view").
-Kaleidoscope is a procedural language that allows you to define functions, use
-conditionals, math, etc.  Over the course of the tutorial, we'll extend
-Kaleidoscope to support the if/then/else construct, a for loop, user defined
-operators, JIT compilation with a simple command line interface, etc.</p>
-
-<p>Because we want to keep things simple, the only datatype in Kaleidoscope is a
-64-bit floating point type (aka 'double' in C parlance).  As such, all values
-are implicitly double precision and the language doesn't require type
-declarations.  This gives the language a very nice and simple syntax.  For
-example, the following simple example computes <a 
-href="http://en.wikipedia.org/wiki/Fibonacci_number">Fibonacci numbers:</a></p>
-
-<div class="doc_code">
-<pre>
-# Compute the x'th fibonacci number.
-def fib(x)
-  if x &lt; 3 then
-    1
-  else
-    fib(x-1)+fib(x-2)
-
-# This expression will compute the 40th number.
-fib(40)
-</pre>
-</div>
-
-<p>We also allow Kaleidoscope to call into standard library functions (the LLVM
-JIT makes this completely trivial).  This means that you can use the 'extern'
-keyword to define a function before you use it (this is also useful for mutually
-recursive functions).  For example:</p>
-
-<div class="doc_code">
-<pre>
-extern sin(arg);
-extern cos(arg);
-extern atan2(arg1 arg2);
-
-atan2(sin(.4), cos(42))
-</pre>
-</div>
-
-<p>A more interesting example is included in Chapter 6 where we write a little
-Kaleidoscope application that <a href="LangImpl6.html#example">displays 
-a Mandelbrot Set</a> at various levels of magnification.</p>
-
-<p>Lets dive into the implementation of this language!</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="lexer">The Lexer</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>When it comes to implementing a language, the first thing needed is
-the ability to process a text file and recognize what it says.  The traditional
-way to do this is to use a "<a 
-href="http://en.wikipedia.org/wiki/Lexical_analysis">lexer</a>" (aka 'scanner')
-to break the input up into "tokens".  Each token returned by the lexer includes
-a token code and potentially some metadata (e.g. the numeric value of a number).
-First, we define the possibilities:
-</p>
-
-<div class="doc_code">
-<pre>
-// The lexer returns tokens [0-255] if it is an unknown character, otherwise one
-// of these for known things.
-enum Token {
-  tok_eof = -1,
-
-  // commands
-  tok_def = -2, tok_extern = -3,
-
-  // primary
-  tok_identifier = -4, tok_number = -5,
-};
-
-static std::string IdentifierStr;  // Filled in if tok_identifier
-static double NumVal;              // Filled in if tok_number
-</pre>
-</div>
-
-<p>Each token returned by our lexer will either be one of the Token enum values
-or it will be an 'unknown' character like '+', which is returned as its ASCII
-value.  If the current token is an identifier, the <tt>IdentifierStr</tt>
-global variable holds the name of the identifier.  If the current token is a
-numeric literal (like 1.0), <tt>NumVal</tt> holds its value.  Note that we use
-global variables for simplicity, this is not the best choice for a real language
-implementation :).
-</p>
-
-<p>The actual implementation of the lexer is a single function named
-<tt>gettok</tt>. The <tt>gettok</tt> function is called to return the next token
-from standard input.  Its definition starts as:</p>
-
-<div class="doc_code">
-<pre>
-/// gettok - Return the next token from standard input.
-static int gettok() {
-  static int LastChar = ' ';
-
-  // Skip any whitespace.
-  while (isspace(LastChar))
-    LastChar = getchar();
-</pre>
-</div>
-
-<p>
-<tt>gettok</tt> works by calling the C <tt>getchar()</tt> function to read
-characters one at a time from standard input.  It eats them as it recognizes
-them and stores the last character read, but not processed, in LastChar.  The
-first thing that it has to do is ignore whitespace between tokens.  This is 
-accomplished with the loop above.</p>
-
-<p>The next thing <tt>gettok</tt> needs to do is recognize identifiers and
-specific keywords like "def".  Kaleidoscope does this with this simple loop:</p>
-
-<div class="doc_code">
-<pre>
-  if (isalpha(LastChar)) { // identifier: [a-zA-Z][a-zA-Z0-9]*
-    IdentifierStr = LastChar;
-    while (isalnum((LastChar = getchar())))
-      IdentifierStr += LastChar;
-
-    if (IdentifierStr == "def") return tok_def;
-    if (IdentifierStr == "extern") return tok_extern;
-    return tok_identifier;
-  }
-</pre>
-</div>
-
-<p>Note that this code sets the '<tt>IdentifierStr</tt>' global whenever it
-lexes an identifier.  Also, since language keywords are matched by the same
-loop, we handle them here inline.  Numeric values are similar:</p>
-
-<div class="doc_code">
-<pre>
-  if (isdigit(LastChar) || LastChar == '.') {   // Number: [0-9.]+
-    std::string NumStr;
-    do {
-      NumStr += LastChar;
-      LastChar = getchar();
-    } while (isdigit(LastChar) || LastChar == '.');
-
-    NumVal = strtod(NumStr.c_str(), 0);
-    return tok_number;
-  }
-</pre>
-</div>
-
-<p>This is all pretty straight-forward code for processing input.  When reading
-a numeric value from input, we use the C <tt>strtod</tt> function to convert it
-to a numeric value that we store in <tt>NumVal</tt>.  Note that this isn't doing
-sufficient error checking: it will incorrectly read "1.23.45.67" and handle it as
-if you typed in "1.23".  Feel free to extend it :).  Next we handle comments:
-</p>
-
-<div class="doc_code">
-<pre>
-  if (LastChar == '#') {
-    // Comment until end of line.
-    do LastChar = getchar();
-    while (LastChar != EOF &amp;&amp; LastChar != '\n' &amp;&amp; LastChar != '\r');
-    
-    if (LastChar != EOF)
-      return gettok();
-  }
-</pre>
-</div>
-
-<p>We handle comments by skipping to the end of the line and then return the
-next token.  Finally, if the input doesn't match one of the above cases, it is
-either an operator character like '+' or the end of the file.  These are handled
-with this code:</p>
-
-<div class="doc_code">
-<pre>
-  // Check for end of file.  Don't eat the EOF.
-  if (LastChar == EOF)
-    return tok_eof;
-  
-  // Otherwise, just return the character as its ascii value.
-  int ThisChar = LastChar;
-  LastChar = getchar();
-  return ThisChar;
-}
-</pre>
-</div>
-
-<p>With this, we have the complete lexer for the basic Kaleidoscope language
-(the <a href="LangImpl2.html#code">full code listing</a> for the Lexer is
-available in the <a href="LangImpl2.html">next chapter</a> of the tutorial).
-Next we'll <a href="LangImpl2.html">build a simple parser that uses this to 
-build an Abstract Syntax Tree</a>.  When we have that, we'll include a driver
-so that you can use the lexer and parser together.
-</p>
-
-<a href="LangImpl2.html">Next: Implementing a Parser and AST</a>
-</div>
-
-<!-- *********************************************************************** -->
-<hr>
-<address>
-  <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
-  src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"></a>
-  <a href="http://validator.w3.org/check/referer"><img
-  src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"></a>
-
-  <a href="mailto:sabre at nondot.org">Chris Lattner</a><br>
-  <a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
-  Last modified: $Date$
-</address>
-</body>
-</html>
diff --git a/libclamav/c++/llvm/docs/tutorial/LangImpl2.html b/libclamav/c++/llvm/docs/tutorial/LangImpl2.html
deleted file mode 100644
index 9c13b48..0000000
--- a/libclamav/c++/llvm/docs/tutorial/LangImpl2.html
+++ /dev/null
@@ -1,1233 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-                      "http://www.w3.org/TR/html4/strict.dtd">
-
-<html>
-<head>
-  <title>Kaleidoscope: Implementing a Parser and AST</title>
-  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-  <meta name="author" content="Chris Lattner">
-  <link rel="stylesheet" href="../llvm.css" type="text/css">
-</head>
-
-<body>
-
-<div class="doc_title">Kaleidoscope: Implementing a Parser and AST</div>
-
-<ul>
-<li><a href="index.html">Up to Tutorial Index</a></li>
-<li>Chapter 2
-  <ol>
-    <li><a href="#intro">Chapter 2 Introduction</a></li>
-    <li><a href="#ast">The Abstract Syntax Tree (AST)</a></li>
-    <li><a href="#parserbasics">Parser Basics</a></li>
-    <li><a href="#parserprimexprs">Basic Expression Parsing</a></li>
-    <li><a href="#parserbinops">Binary Expression Parsing</a></li>
-    <li><a href="#parsertop">Parsing the Rest</a></li>
-    <li><a href="#driver">The Driver</a></li>
-    <li><a href="#conclusions">Conclusions</a></li>
-    <li><a href="#code">Full Code Listing</a></li>
-  </ol>
-</li>
-<li><a href="LangImpl3.html">Chapter 3</a>: Code generation to LLVM IR</li>
-</ul>
-
-<div class="doc_author">
-  <p>Written by <a href="mailto:sabre at nondot.org">Chris Lattner</a></p>
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="intro">Chapter 2 Introduction</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>Welcome to Chapter 2 of the "<a href="index.html">Implementing a language
-with LLVM</a>" tutorial.  This chapter shows you how to use the lexer, built in 
-<a href="LangImpl1.html">Chapter 1</a>, to build a full <a
-href="http://en.wikipedia.org/wiki/Parsing">parser</a> for
-our Kaleidoscope language.  Once we have a parser, we'll define and build an <a 
-href="http://en.wikipedia.org/wiki/Abstract_syntax_tree">Abstract Syntax 
-Tree</a> (AST).</p>
-
-<p>The parser we will build uses a combination of <a 
-href="http://en.wikipedia.org/wiki/Recursive_descent_parser">Recursive Descent
-Parsing</a> and <a href=
-"http://en.wikipedia.org/wiki/Operator-precedence_parser">Operator-Precedence 
-Parsing</a> to parse the Kaleidoscope language (the latter for 
-binary expressions and the former for everything else).  Before we get to
-parsing though, lets talk about the output of the parser: the Abstract Syntax
-Tree.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="ast">The Abstract Syntax Tree (AST)</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>The AST for a program captures its behavior in such a way that it is easy for
-later stages of the compiler (e.g. code generation) to interpret.  We basically
-want one object for each construct in the language, and the AST should closely
-model the language.  In Kaleidoscope, we have expressions, a prototype, and a
-function object.  We'll start with expressions first:</p>
-
-<div class="doc_code">
-<pre>
-/// ExprAST - Base class for all expression nodes.
-class ExprAST {
-public:
-  virtual ~ExprAST() {}
-};
-
-/// NumberExprAST - Expression class for numeric literals like "1.0".
-class NumberExprAST : public ExprAST {
-  double Val;
-public:
-  NumberExprAST(double val) : Val(val) {}
-};
-</pre>
-</div>
-
-<p>The code above shows the definition of the base ExprAST class and one
-subclass which we use for numeric literals.  The important thing to note about
-this code is that the NumberExprAST class captures the numeric value of the
-literal as an instance variable. This allows later phases of the compiler to
-know what the stored numeric value is.</p>
-
-<p>Right now we only create the AST,  so there are no useful accessor methods on
-them.  It would be very easy to add a virtual method to pretty print the code,
-for example.  Here are the other expression AST node definitions that we'll use
-in the basic form of the Kaleidoscope language:
-</p>
-
-<div class="doc_code">
-<pre>
-/// VariableExprAST - Expression class for referencing a variable, like "a".
-class VariableExprAST : public ExprAST {
-  std::string Name;
-public:
-  VariableExprAST(const std::string &amp;name) : Name(name) {}
-};
-
-/// BinaryExprAST - Expression class for a binary operator.
-class BinaryExprAST : public ExprAST {
-  char Op;
-  ExprAST *LHS, *RHS;
-public:
-  BinaryExprAST(char op, ExprAST *lhs, ExprAST *rhs) 
-    : Op(op), LHS(lhs), RHS(rhs) {}
-};
-
-/// CallExprAST - Expression class for function calls.
-class CallExprAST : public ExprAST {
-  std::string Callee;
-  std::vector&lt;ExprAST*&gt; Args;
-public:
-  CallExprAST(const std::string &amp;callee, std::vector&lt;ExprAST*&gt; &amp;args)
-    : Callee(callee), Args(args) {}
-};
-</pre>
-</div>
-
-<p>This is all (intentionally) rather straight-forward: variables capture the
-variable name, binary operators capture their opcode (e.g. '+'), and calls
-capture a function name as well as a list of any argument expressions.  One thing 
-that is nice about our AST is that it captures the language features without 
-talking about the syntax of the language.  Note that there is no discussion about 
-precedence of binary operators, lexical structure, etc.</p>
-
-<p>For our basic language, these are all of the expression nodes we'll define.
-Because it doesn't have conditional control flow, it isn't Turing-complete;
-we'll fix that in a later installment.  The two things we need next are a way
-to talk about the interface to a function, and a way to talk about functions
-themselves:</p>
-
-<div class="doc_code">
-<pre>
-/// PrototypeAST - This class represents the "prototype" for a function,
-/// which captures its name, and its argument names (thus implicitly the number
-/// of arguments the function takes).
-class PrototypeAST {
-  std::string Name;
-  std::vector&lt;std::string&gt; Args;
-public:
-  PrototypeAST(const std::string &amp;name, const std::vector&lt;std::string&gt; &amp;args)
-    : Name(name), Args(args) {}
-};
-
-/// FunctionAST - This class represents a function definition itself.
-class FunctionAST {
-  PrototypeAST *Proto;
-  ExprAST *Body;
-public:
-  FunctionAST(PrototypeAST *proto, ExprAST *body)
-    : Proto(proto), Body(body) {}
-};
-</pre>
-</div>
-
-<p>In Kaleidoscope, functions are typed with just a count of their arguments.
-Since all values are double precision floating point, the type of each argument
-doesn't need to be stored anywhere.  In a more aggressive and realistic
-language, the "ExprAST" class would probably have a type field.</p>
-
-<p>With this scaffolding, we can now talk about parsing expressions and function
-bodies in Kaleidoscope.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="parserbasics">Parser Basics</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>Now that we have an AST to build, we need to define the parser code to build
-it.  The idea here is that we want to parse something like "x+y" (which is
-returned as three tokens by the lexer) into an AST that could be generated with
-calls like this:</p>
-
-<div class="doc_code">
-<pre>
-  ExprAST *X = new VariableExprAST("x");
-  ExprAST *Y = new VariableExprAST("y");
-  ExprAST *Result = new BinaryExprAST('+', X, Y);
-</pre>
-</div>
-
-<p>In order to do this, we'll start by defining some basic helper routines:</p>
-
-<div class="doc_code">
-<pre>
-/// CurTok/getNextToken - Provide a simple token buffer.  CurTok is the current
-/// token the parser is looking at.  getNextToken reads another token from the
-/// lexer and updates CurTok with its results.
-static int CurTok;
-static int getNextToken() {
-  return CurTok = gettok();
-}
-</pre>
-</div>
-
-<p>
-This implements a simple token buffer around the lexer.  This allows 
-us to look one token ahead at what the lexer is returning.  Every function in
-our parser will assume that CurTok is the current token that needs to be
-parsed.</p>
-
-<div class="doc_code">
-<pre>
-
-/// Error* - These are little helper functions for error handling.
-ExprAST *Error(const char *Str) { fprintf(stderr, "Error: %s\n", Str);return 0;}
-PrototypeAST *ErrorP(const char *Str) { Error(Str); return 0; }
-FunctionAST *ErrorF(const char *Str) { Error(Str); return 0; }
-</pre>
-</div>
-
-<p>
-The <tt>Error</tt> routines are simple helper routines that our parser will use
-to handle errors.  The error recovery in our parser will not be the best and
-is not particular user-friendly, but it will be enough for our tutorial.  These
-routines make it easier to handle errors in routines that have various return
-types: they always return null.</p>
-
-<p>With these basic helper functions, we can implement the first
-piece of our grammar: numeric literals.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="parserprimexprs">Basic Expression
- Parsing</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>We start with numeric literals, because they are the simplest to process.
-For each production in our grammar, we'll define a function which parses that
-production.  For numeric literals, we have:
-</p>
-
-<div class="doc_code">
-<pre>
-/// numberexpr ::= number
-static ExprAST *ParseNumberExpr() {
-  ExprAST *Result = new NumberExprAST(NumVal);
-  getNextToken(); // consume the number
-  return Result;
-}
-</pre>
-</div>
-
-<p>This routine is very simple: it expects to be called when the current token
-is a <tt>tok_number</tt> token.  It takes the current number value, creates 
-a <tt>NumberExprAST</tt> node, advances the lexer to the next token, and finally
-returns.</p>
-
-<p>There are some interesting aspects to this.  The most important one is that
-this routine eats all of the tokens that correspond to the production and
-returns the lexer buffer with the next token (which is not part of the grammar
-production) ready to go.  This is a fairly standard way to go for recursive
-descent parsers.  For a better example, the parenthesis operator is defined like
-this:</p>
-
-<div class="doc_code">
-<pre>
-/// parenexpr ::= '(' expression ')'
-static ExprAST *ParseParenExpr() {
-  getNextToken();  // eat (.
-  ExprAST *V = ParseExpression();
-  if (!V) return 0;
-  
-  if (CurTok != ')')
-    return Error("expected ')'");
-  getNextToken();  // eat ).
-  return V;
-}
-</pre>
-</div>
-
-<p>This function illustrates a number of interesting things about the 
-parser:</p>
-
-<p>
-1) It shows how we use the Error routines.  When called, this function expects
-that the current token is a '(' token, but after parsing the subexpression, it
-is possible that there is no ')' waiting.  For example, if the user types in
-"(4 x" instead of "(4)", the parser should emit an error.  Because errors can
-occur, the parser needs a way to indicate that they happened: in our parser, we
-return null on an error.</p>
-
-<p>2) Another interesting aspect of this function is that it uses recursion by
-calling <tt>ParseExpression</tt> (we will soon see that <tt>ParseExpression</tt> can call
-<tt>ParseParenExpr</tt>).  This is powerful because it allows us to handle 
-recursive grammars, and keeps each production very simple.  Note that
-parentheses do not cause construction of AST nodes themselves.  While we could
-do it this way, the most important role of parentheses are to guide the parser
-and provide grouping.  Once the parser constructs the AST, parentheses are not
-needed.</p>
-
-<p>The next simple production is for handling variable references and function
-calls:</p>
-
-<div class="doc_code">
-<pre>
-/// identifierexpr
-///   ::= identifier
-///   ::= identifier '(' expression* ')'
-static ExprAST *ParseIdentifierExpr() {
-  std::string IdName = IdentifierStr;
-  
-  getNextToken();  // eat identifier.
-  
-  if (CurTok != '(') // Simple variable ref.
-    return new VariableExprAST(IdName);
-  
-  // Call.
-  getNextToken();  // eat (
-  std::vector&lt;ExprAST*&gt; Args;
-  if (CurTok != ')') {
-    while (1) {
-      ExprAST *Arg = ParseExpression();
-      if (!Arg) return 0;
-      Args.push_back(Arg);
-
-      if (CurTok == ')') break;
-
-      if (CurTok != ',')
-        return Error("Expected ')' or ',' in argument list");
-      getNextToken();
-    }
-  }
-
-  // Eat the ')'.
-  getNextToken();
-  
-  return new CallExprAST(IdName, Args);
-}
-</pre>
-</div>
-
-<p>This routine follows the same style as the other routines.  (It expects to be
-called if the current token is a <tt>tok_identifier</tt> token).  It also has
-recursion and error handling.  One interesting aspect of this is that it uses
-<em>look-ahead</em> to determine if the current identifier is a stand alone
-variable reference or if it is a function call expression.  It handles this by
-checking to see if the token after the identifier is a '(' token, constructing
-either a <tt>VariableExprAST</tt> or <tt>CallExprAST</tt> node as appropriate.
-</p>
-
-<p>Now that we have all of our simple expression-parsing logic in place, we can
-define a helper function to wrap it together into one entry point.  We call this
-class of expressions "primary" expressions, for reasons that will become more
-clear <a href="LangImpl6.html#unary">later in the tutorial</a>.  In order to
-parse an arbitrary primary expression, we need to determine what sort of
-expression it is:</p>
-
-<div class="doc_code">
-<pre>
-/// primary
-///   ::= identifierexpr
-///   ::= numberexpr
-///   ::= parenexpr
-static ExprAST *ParsePrimary() {
-  switch (CurTok) {
-  default: return Error("unknown token when expecting an expression");
-  case tok_identifier: return ParseIdentifierExpr();
-  case tok_number:     return ParseNumberExpr();
-  case '(':            return ParseParenExpr();
-  }
-}
-</pre>
-</div>
-
-<p>Now that you see the definition of this function, it is more obvious why we
-can assume the state of CurTok in the various functions.  This uses look-ahead
-to determine which sort of expression is being inspected, and then parses it
-with a function call.</p>
-
-<p>Now that basic expressions are handled, we need to handle binary expressions.
-They are a bit more complex.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="parserbinops">Binary Expression
- Parsing</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>Binary expressions are significantly harder to parse because they are often
-ambiguous.  For example, when given the string "x+y*z", the parser can choose
-to parse it as either "(x+y)*z" or "x+(y*z)".  With common definitions from
-mathematics, we expect the later parse, because "*" (multiplication) has
-higher <em>precedence</em> than "+" (addition).</p>
-
-<p>There are many ways to handle this, but an elegant and efficient way is to
-use <a href=
-"http://en.wikipedia.org/wiki/Operator-precedence_parser">Operator-Precedence 
-Parsing</a>.  This parsing technique uses the precedence of binary operators to
-guide recursion.  To start with, we need a table of precedences:</p>
-
-<div class="doc_code">
-<pre>
-/// BinopPrecedence - This holds the precedence for each binary operator that is
-/// defined.
-static std::map&lt;char, int&gt; BinopPrecedence;
-
-/// GetTokPrecedence - Get the precedence of the pending binary operator token.
-static int GetTokPrecedence() {
-  if (!isascii(CurTok))
-    return -1;
-    
-  // Make sure it's a declared binop.
-  int TokPrec = BinopPrecedence[CurTok];
-  if (TokPrec &lt;= 0) return -1;
-  return TokPrec;
-}
-
-int main() {
-  // Install standard binary operators.
-  // 1 is lowest precedence.
-  BinopPrecedence['&lt;'] = 10;
-  BinopPrecedence['+'] = 20;
-  BinopPrecedence['-'] = 20;
-  BinopPrecedence['*'] = 40;  // highest.
-  ...
-}
-</pre>
-</div>
-
-<p>For the basic form of Kaleidoscope, we will only support 4 binary operators
-(this can obviously be extended by you, our brave and intrepid reader).  The
-<tt>GetTokPrecedence</tt> function returns the precedence for the current token,
-or -1 if the token is not a binary operator.  Having a map makes it easy to add
-new operators and makes it clear that the algorithm doesn't depend on the
-specific operators involved, but it would be easy enough to eliminate the map
-and do the comparisons in the <tt>GetTokPrecedence</tt> function.  (Or just use
-a fixed-size array).</p>
-
-<p>With the helper above defined, we can now start parsing binary expressions.
-The basic idea of operator precedence parsing is to break down an expression
-with potentially ambiguous binary operators into pieces.  Consider ,for example,
-the expression "a+b+(c+d)*e*f+g".  Operator precedence parsing considers this
-as a stream of primary expressions separated by binary operators.  As such,
-it will first parse the leading primary expression "a", then it will see the
-pairs [+, b] [+, (c+d)] [*, e] [*, f] and [+, g].  Note that because parentheses
-are primary expressions, the binary expression parser doesn't need to worry
-about nested subexpressions like (c+d) at all. 
-</p>
-
-<p>
-To start, an expression is a primary expression potentially followed by a
-sequence of [binop,primaryexpr] pairs:</p>
-
-<div class="doc_code">
-<pre>
-/// expression
-///   ::= primary binoprhs
-///
-static ExprAST *ParseExpression() {
-  ExprAST *LHS = ParsePrimary();
-  if (!LHS) return 0;
-  
-  return ParseBinOpRHS(0, LHS);
-}
-</pre>
-</div>
-
-<p><tt>ParseBinOpRHS</tt> is the function that parses the sequence of pairs for
-us.  It takes a precedence and a pointer to an expression for the part that has been
-parsed so far.   Note that "x" is a perfectly valid expression: As such, "binoprhs" is
-allowed to be empty, in which case it returns the expression that is passed into
-it. In our example above, the code passes the expression for "a" into
-<tt>ParseBinOpRHS</tt> and the current token is "+".</p>
-
-<p>The precedence value passed into <tt>ParseBinOpRHS</tt> indicates the <em>
-minimal operator precedence</em> that the function is allowed to eat.  For
-example, if the current pair stream is [+, x] and <tt>ParseBinOpRHS</tt> is
-passed in a precedence of 40, it will not consume any tokens (because the
-precedence of '+' is only 20).  With this in mind, <tt>ParseBinOpRHS</tt> starts
-with:</p>
-
-<div class="doc_code">
-<pre>
-/// binoprhs
-///   ::= ('+' primary)*
-static ExprAST *ParseBinOpRHS(int ExprPrec, ExprAST *LHS) {
-  // If this is a binop, find its precedence.
-  while (1) {
-    int TokPrec = GetTokPrecedence();
-    
-    // If this is a binop that binds at least as tightly as the current binop,
-    // consume it, otherwise we are done.
-    if (TokPrec &lt; ExprPrec)
-      return LHS;
-</pre>
-</div>
-
-<p>This code gets the precedence of the current token and checks to see if if is
-too low.  Because we defined invalid tokens to have a precedence of -1, this 
-check implicitly knows that the pair-stream ends when the token stream runs out
-of binary operators.  If this check succeeds, we know that the token is a binary
-operator and that it will be included in this expression:</p>
-
-<div class="doc_code">
-<pre>
-    // Okay, we know this is a binop.
-    int BinOp = CurTok;
-    getNextToken();  // eat binop
-    
-    // Parse the primary expression after the binary operator.
-    ExprAST *RHS = ParsePrimary();
-    if (!RHS) return 0;
-</pre>
-</div>
-
-<p>As such, this code eats (and remembers) the binary operator and then parses
-the primary expression that follows.  This builds up the whole pair, the first of
-which is [+, b] for the running example.</p>
-
-<p>Now that we parsed the left-hand side of an expression and one pair of the 
-RHS sequence, we have to decide which way the expression associates.  In
-particular, we could have "(a+b) binop unparsed"  or "a + (b binop unparsed)".
-To determine this, we look ahead at "binop" to determine its precedence and 
-compare it to BinOp's precedence (which is '+' in this case):</p>
-
-<div class="doc_code">
-<pre>
-    // If BinOp binds less tightly with RHS than the operator after RHS, let
-    // the pending operator take RHS as its LHS.
-    int NextPrec = GetTokPrecedence();
-    if (TokPrec &lt; NextPrec) {
-</pre>
-</div>
-
-<p>If the precedence of the binop to the right of "RHS" is lower or equal to the
-precedence of our current operator, then we know that the parentheses associate
-as "(a+b) binop ...".  In our example, the current operator is "+" and the next 
-operator is "+", we know that they have the same precedence.  In this case we'll
-create the AST node for "a+b", and then continue parsing:</p>
-
-<div class="doc_code">
-<pre>
-      ... if body omitted ...
-    }
-    
-    // Merge LHS/RHS.
-    LHS = new BinaryExprAST(BinOp, LHS, RHS);
-  }  // loop around to the top of the while loop.
-}
-</pre>
-</div>
-
-<p>In our example above, this will turn "a+b+" into "(a+b)" and execute the next
-iteration of the loop, with "+" as the current token.  The code above will eat, 
-remember, and parse "(c+d)" as the primary expression, which makes the
-current pair equal to [+, (c+d)].  It will then evaluate the 'if' conditional above with 
-"*" as the binop to the right of the primary.  In this case, the precedence of "*" is
-higher than the precedence of "+" so the if condition will be entered.</p>
-
-<p>The critical question left here is "how can the if condition parse the right
-hand side in full"?  In particular, to build the AST correctly for our example,
-it needs to get all of "(c+d)*e*f" as the RHS expression variable.  The code to
-do this is surprisingly simple (code from the above two blocks duplicated for
-context):</p>
-
-<div class="doc_code">
-<pre>
-    // If BinOp binds less tightly with RHS than the operator after RHS, let
-    // the pending operator take RHS as its LHS.
-    int NextPrec = GetTokPrecedence();
-    if (TokPrec &lt; NextPrec) {
-      <b>RHS = ParseBinOpRHS(TokPrec+1, RHS);
-      if (RHS == 0) return 0;</b>
-    }
-    // Merge LHS/RHS.
-    LHS = new BinaryExprAST(BinOp, LHS, RHS);
-  }  // loop around to the top of the while loop.
-}
-</pre>
-</div>
-
-<p>At this point, we know that the binary operator to the RHS of our primary
-has higher precedence than the binop we are currently parsing.  As such, we know
-that any sequence of pairs whose operators are all higher precedence than "+"
-should be parsed together and returned as "RHS".  To do this, we recursively
-invoke the <tt>ParseBinOpRHS</tt> function specifying "TokPrec+1" as the minimum
-precedence required for it to continue.  In our example above, this will cause
-it to return the AST node for "(c+d)*e*f" as RHS, which is then set as the RHS
-of the '+' expression.</p>
-
-<p>Finally, on the next iteration of the while loop, the "+g" piece is parsed
-and added to the AST.  With this little bit of code (14 non-trivial lines), we
-correctly handle fully general binary expression parsing in a very elegant way.
-This was a whirlwind tour of this code, and it is somewhat subtle.  I recommend
-running through it with a few tough examples to see how it works.
-</p>
-
-<p>This wraps up handling of expressions.  At this point, we can point the
-parser at an arbitrary token stream and build an expression from it, stopping
-at the first token that is not part of the expression.  Next up we need to
-handle function definitions, etc.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="parsertop">Parsing the Rest</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>
-The next thing missing is handling of function prototypes.  In Kaleidoscope,
-these are used both for 'extern' function declarations as well as function body
-definitions.  The code to do this is straight-forward and not very interesting
-(once you've survived expressions):
-</p>
-
-<div class="doc_code">
-<pre>
-/// prototype
-///   ::= id '(' id* ')'
-static PrototypeAST *ParsePrototype() {
-  if (CurTok != tok_identifier)
-    return ErrorP("Expected function name in prototype");
-
-  std::string FnName = IdentifierStr;
-  getNextToken();
-  
-  if (CurTok != '(')
-    return ErrorP("Expected '(' in prototype");
-  
-  // Read the list of argument names.
-  std::vector&lt;std::string&gt; ArgNames;
-  while (getNextToken() == tok_identifier)
-    ArgNames.push_back(IdentifierStr);
-  if (CurTok != ')')
-    return ErrorP("Expected ')' in prototype");
-  
-  // success.
-  getNextToken();  // eat ')'.
-  
-  return new PrototypeAST(FnName, ArgNames);
-}
-</pre>
-</div>
-
-<p>Given this, a function definition is very simple, just a prototype plus
-an expression to implement the body:</p>
-
-<div class="doc_code">
-<pre>
-/// definition ::= 'def' prototype expression
-static FunctionAST *ParseDefinition() {
-  getNextToken();  // eat def.
-  PrototypeAST *Proto = ParsePrototype();
-  if (Proto == 0) return 0;
-
-  if (ExprAST *E = ParseExpression())
-    return new FunctionAST(Proto, E);
-  return 0;
-}
-</pre>
-</div>
-
-<p>In addition, we support 'extern' to declare functions like 'sin' and 'cos' as
-well as to support forward declaration of user functions.  These 'extern's are just
-prototypes with no body:</p>
-
-<div class="doc_code">
-<pre>
-/// external ::= 'extern' prototype
-static PrototypeAST *ParseExtern() {
-  getNextToken();  // eat extern.
-  return ParsePrototype();
-}
-</pre>
-</div>
-
-<p>Finally, we'll also let the user type in arbitrary top-level expressions and
-evaluate them on the fly.  We will handle this by defining anonymous nullary
-(zero argument) functions for them:</p>
-
-<div class="doc_code">
-<pre>
-/// toplevelexpr ::= expression
-static FunctionAST *ParseTopLevelExpr() {
-  if (ExprAST *E = ParseExpression()) {
-    // Make an anonymous proto.
-    PrototypeAST *Proto = new PrototypeAST("", std::vector&lt;std::string&gt;());
-    return new FunctionAST(Proto, E);
-  }
-  return 0;
-}
-</pre>
-</div>
-
-<p>Now that we have all the pieces, let's build a little driver that will let us
-actually <em>execute</em> this code we've built!</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="driver">The Driver</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>The driver for this simply invokes all of the parsing pieces with a top-level
-dispatch loop.  There isn't much interesting here, so I'll just include the
-top-level loop.  See <a href="#code">below</a> for full code in the "Top-Level
-Parsing" section.</p>
-
-<div class="doc_code">
-<pre>
-/// top ::= definition | external | expression | ';'
-static void MainLoop() {
-  while (1) {
-    fprintf(stderr, "ready&gt; ");
-    switch (CurTok) {
-    case tok_eof:    return;
-    case ';':        getNextToken(); break;  // ignore top-level semicolons.
-    case tok_def:    HandleDefinition(); break;
-    case tok_extern: HandleExtern(); break;
-    default:         HandleTopLevelExpression(); break;
-    }
-  }
-}
-</pre>
-</div>
-
-<p>The most interesting part of this is that we ignore top-level semicolons.
-Why is this, you ask?  The basic reason is that if you type "4 + 5" at the
-command line, the parser doesn't know whether that is the end of what you will type
-or not.  For example, on the next line you could type "def foo..." in which case
-4+5 is the end of a top-level expression.  Alternatively you could type "* 6",
-which would continue the expression.  Having top-level semicolons allows you to
-type "4+5;", and the parser will know you are done.</p> 
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="conclusions">Conclusions</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>With just under 400 lines of commented code (240 lines of non-comment, 
-non-blank code), we fully defined our minimal language, including a lexer,
-parser, and AST builder.  With this done, the executable will validate 
-Kaleidoscope code and tell us if it is grammatically invalid.  For
-example, here is a sample interaction:</p>
-
-<div class="doc_code">
-<pre>
-$ <b>./a.out</b>
-ready&gt; <b>def foo(x y) x+foo(y, 4.0);</b>
-Parsed a function definition.
-ready&gt; <b>def foo(x y) x+y y;</b>
-Parsed a function definition.
-Parsed a top-level expr
-ready&gt; <b>def foo(x y) x+y );</b>
-Parsed a function definition.
-Error: unknown token when expecting an expression
-ready&gt; <b>extern sin(a);</b>
-ready&gt; Parsed an extern
-ready&gt; <b>^D</b>
-$ 
-</pre>
-</div>
-
-<p>There is a lot of room for extension here.  You can define new AST nodes,
-extend the language in many ways, etc.  In the <a href="LangImpl3.html">next
-installment</a>, we will describe how to generate LLVM Intermediate
-Representation (IR) from the AST.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="code">Full Code Listing</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>
-Here is the complete code listing for this and the previous chapter.  
-Note that it is fully self-contained: you don't need LLVM or any external
-libraries at all for this.  (Besides the C and C++ standard libraries, of
-course.)  To build this, just compile with:</p>
-
-<div class="doc_code">
-<pre>
-   # Compile
-   g++ -g -O3 toy.cpp 
-   # Run
-   ./a.out 
-</pre>
-</div>
-
-<p>Here is the code:</p>
-
-<div class="doc_code">
-<pre>
-#include &lt;cstdio&gt;
-#include &lt;cstdlib&gt;
-#include &lt;string&gt;
-#include &lt;map&gt;
-#include &lt;vector&gt;
-
-//===----------------------------------------------------------------------===//
-// Lexer
-//===----------------------------------------------------------------------===//
-
-// The lexer returns tokens [0-255] if it is an unknown character, otherwise one
-// of these for known things.
-enum Token {
-  tok_eof = -1,
-
-  // commands
-  tok_def = -2, tok_extern = -3,
-
-  // primary
-  tok_identifier = -4, tok_number = -5
-};
-
-static std::string IdentifierStr;  // Filled in if tok_identifier
-static double NumVal;              // Filled in if tok_number
-
-/// gettok - Return the next token from standard input.
-static int gettok() {
-  static int LastChar = ' ';
-
-  // Skip any whitespace.
-  while (isspace(LastChar))
-    LastChar = getchar();
-
-  if (isalpha(LastChar)) { // identifier: [a-zA-Z][a-zA-Z0-9]*
-    IdentifierStr = LastChar;
-    while (isalnum((LastChar = getchar())))
-      IdentifierStr += LastChar;
-
-    if (IdentifierStr == "def") return tok_def;
-    if (IdentifierStr == "extern") return tok_extern;
-    return tok_identifier;
-  }
-
-  if (isdigit(LastChar) || LastChar == '.') {   // Number: [0-9.]+
-    std::string NumStr;
-    do {
-      NumStr += LastChar;
-      LastChar = getchar();
-    } while (isdigit(LastChar) || LastChar == '.');
-
-    NumVal = strtod(NumStr.c_str(), 0);
-    return tok_number;
-  }
-
-  if (LastChar == '#') {
-    // Comment until end of line.
-    do LastChar = getchar();
-    while (LastChar != EOF &amp;&amp; LastChar != '\n' &amp;&amp; LastChar != '\r');
-    
-    if (LastChar != EOF)
-      return gettok();
-  }
-  
-  // Check for end of file.  Don't eat the EOF.
-  if (LastChar == EOF)
-    return tok_eof;
-
-  // Otherwise, just return the character as its ascii value.
-  int ThisChar = LastChar;
-  LastChar = getchar();
-  return ThisChar;
-}
-
-//===----------------------------------------------------------------------===//
-// Abstract Syntax Tree (aka Parse Tree)
-//===----------------------------------------------------------------------===//
-
-/// ExprAST - Base class for all expression nodes.
-class ExprAST {
-public:
-  virtual ~ExprAST() {}
-};
-
-/// NumberExprAST - Expression class for numeric literals like "1.0".
-class NumberExprAST : public ExprAST {
-  double Val;
-public:
-  NumberExprAST(double val) : Val(val) {}
-};
-
-/// VariableExprAST - Expression class for referencing a variable, like "a".
-class VariableExprAST : public ExprAST {
-  std::string Name;
-public:
-  VariableExprAST(const std::string &amp;name) : Name(name) {}
-};
-
-/// BinaryExprAST - Expression class for a binary operator.
-class BinaryExprAST : public ExprAST {
-  char Op;
-  ExprAST *LHS, *RHS;
-public:
-  BinaryExprAST(char op, ExprAST *lhs, ExprAST *rhs) 
-    : Op(op), LHS(lhs), RHS(rhs) {}
-};
-
-/// CallExprAST - Expression class for function calls.
-class CallExprAST : public ExprAST {
-  std::string Callee;
-  std::vector&lt;ExprAST*&gt; Args;
-public:
-  CallExprAST(const std::string &amp;callee, std::vector&lt;ExprAST*&gt; &amp;args)
-    : Callee(callee), Args(args) {}
-};
-
-/// PrototypeAST - This class represents the "prototype" for a function,
-/// which captures its name, and its argument names (thus implicitly the number
-/// of arguments the function takes).
-class PrototypeAST {
-  std::string Name;
-  std::vector&lt;std::string&gt; Args;
-public:
-  PrototypeAST(const std::string &amp;name, const std::vector&lt;std::string&gt; &amp;args)
-    : Name(name), Args(args) {}
-  
-};
-
-/// FunctionAST - This class represents a function definition itself.
-class FunctionAST {
-  PrototypeAST *Proto;
-  ExprAST *Body;
-public:
-  FunctionAST(PrototypeAST *proto, ExprAST *body)
-    : Proto(proto), Body(body) {}
-  
-};
-
-//===----------------------------------------------------------------------===//
-// Parser
-//===----------------------------------------------------------------------===//
-
-/// CurTok/getNextToken - Provide a simple token buffer.  CurTok is the current
-/// token the parser is looking at.  getNextToken reads another token from the
-/// lexer and updates CurTok with its results.
-static int CurTok;
-static int getNextToken() {
-  return CurTok = gettok();
-}
-
-/// BinopPrecedence - This holds the precedence for each binary operator that is
-/// defined.
-static std::map&lt;char, int&gt; BinopPrecedence;
-
-/// GetTokPrecedence - Get the precedence of the pending binary operator token.
-static int GetTokPrecedence() {
-  if (!isascii(CurTok))
-    return -1;
-  
-  // Make sure it's a declared binop.
-  int TokPrec = BinopPrecedence[CurTok];
-  if (TokPrec &lt;= 0) return -1;
-  return TokPrec;
-}
-
-/// Error* - These are little helper functions for error handling.
-ExprAST *Error(const char *Str) { fprintf(stderr, "Error: %s\n", Str);return 0;}
-PrototypeAST *ErrorP(const char *Str) { Error(Str); return 0; }
-FunctionAST *ErrorF(const char *Str) { Error(Str); return 0; }
-
-static ExprAST *ParseExpression();
-
-/// identifierexpr
-///   ::= identifier
-///   ::= identifier '(' expression* ')'
-static ExprAST *ParseIdentifierExpr() {
-  std::string IdName = IdentifierStr;
-  
-  getNextToken();  // eat identifier.
-  
-  if (CurTok != '(') // Simple variable ref.
-    return new VariableExprAST(IdName);
-  
-  // Call.
-  getNextToken();  // eat (
-  std::vector&lt;ExprAST*&gt; Args;
-  if (CurTok != ')') {
-    while (1) {
-      ExprAST *Arg = ParseExpression();
-      if (!Arg) return 0;
-      Args.push_back(Arg);
-
-      if (CurTok == ')') break;
-
-      if (CurTok != ',')
-        return Error("Expected ')' or ',' in argument list");
-      getNextToken();
-    }
-  }
-
-  // Eat the ')'.
-  getNextToken();
-  
-  return new CallExprAST(IdName, Args);
-}
-
-/// numberexpr ::= number
-static ExprAST *ParseNumberExpr() {
-  ExprAST *Result = new NumberExprAST(NumVal);
-  getNextToken(); // consume the number
-  return Result;
-}
-
-/// parenexpr ::= '(' expression ')'
-static ExprAST *ParseParenExpr() {
-  getNextToken();  // eat (.
-  ExprAST *V = ParseExpression();
-  if (!V) return 0;
-  
-  if (CurTok != ')')
-    return Error("expected ')'");
-  getNextToken();  // eat ).
-  return V;
-}
-
-/// primary
-///   ::= identifierexpr
-///   ::= numberexpr
-///   ::= parenexpr
-static ExprAST *ParsePrimary() {
-  switch (CurTok) {
-  default: return Error("unknown token when expecting an expression");
-  case tok_identifier: return ParseIdentifierExpr();
-  case tok_number:     return ParseNumberExpr();
-  case '(':            return ParseParenExpr();
-  }
-}
-
-/// binoprhs
-///   ::= ('+' primary)*
-static ExprAST *ParseBinOpRHS(int ExprPrec, ExprAST *LHS) {
-  // If this is a binop, find its precedence.
-  while (1) {
-    int TokPrec = GetTokPrecedence();
-    
-    // If this is a binop that binds at least as tightly as the current binop,
-    // consume it, otherwise we are done.
-    if (TokPrec &lt; ExprPrec)
-      return LHS;
-    
-    // Okay, we know this is a binop.
-    int BinOp = CurTok;
-    getNextToken();  // eat binop
-    
-    // Parse the primary expression after the binary operator.
-    ExprAST *RHS = ParsePrimary();
-    if (!RHS) return 0;
-    
-    // If BinOp binds less tightly with RHS than the operator after RHS, let
-    // the pending operator take RHS as its LHS.
-    int NextPrec = GetTokPrecedence();
-    if (TokPrec &lt; NextPrec) {
-      RHS = ParseBinOpRHS(TokPrec+1, RHS);
-      if (RHS == 0) return 0;
-    }
-    
-    // Merge LHS/RHS.
-    LHS = new BinaryExprAST(BinOp, LHS, RHS);
-  }
-}
-
-/// expression
-///   ::= primary binoprhs
-///
-static ExprAST *ParseExpression() {
-  ExprAST *LHS = ParsePrimary();
-  if (!LHS) return 0;
-  
-  return ParseBinOpRHS(0, LHS);
-}
-
-/// prototype
-///   ::= id '(' id* ')'
-static PrototypeAST *ParsePrototype() {
-  if (CurTok != tok_identifier)
-    return ErrorP("Expected function name in prototype");
-
-  std::string FnName = IdentifierStr;
-  getNextToken();
-  
-  if (CurTok != '(')
-    return ErrorP("Expected '(' in prototype");
-  
-  std::vector&lt;std::string&gt; ArgNames;
-  while (getNextToken() == tok_identifier)
-    ArgNames.push_back(IdentifierStr);
-  if (CurTok != ')')
-    return ErrorP("Expected ')' in prototype");
-  
-  // success.
-  getNextToken();  // eat ')'.
-  
-  return new PrototypeAST(FnName, ArgNames);
-}
-
-/// definition ::= 'def' prototype expression
-static FunctionAST *ParseDefinition() {
-  getNextToken();  // eat def.
-  PrototypeAST *Proto = ParsePrototype();
-  if (Proto == 0) return 0;
-
-  if (ExprAST *E = ParseExpression())
-    return new FunctionAST(Proto, E);
-  return 0;
-}
-
-/// toplevelexpr ::= expression
-static FunctionAST *ParseTopLevelExpr() {
-  if (ExprAST *E = ParseExpression()) {
-    // Make an anonymous proto.
-    PrototypeAST *Proto = new PrototypeAST("", std::vector&lt;std::string&gt;());
-    return new FunctionAST(Proto, E);
-  }
-  return 0;
-}
-
-/// external ::= 'extern' prototype
-static PrototypeAST *ParseExtern() {
-  getNextToken();  // eat extern.
-  return ParsePrototype();
-}
-
-//===----------------------------------------------------------------------===//
-// Top-Level parsing
-//===----------------------------------------------------------------------===//
-
-static void HandleDefinition() {
-  if (ParseDefinition()) {
-    fprintf(stderr, "Parsed a function definition.\n");
-  } else {
-    // Skip token for error recovery.
-    getNextToken();
-  }
-}
-
-static void HandleExtern() {
-  if (ParseExtern()) {
-    fprintf(stderr, "Parsed an extern\n");
-  } else {
-    // Skip token for error recovery.
-    getNextToken();
-  }
-}
-
-static void HandleTopLevelExpression() {
-  // Evaluate a top-level expression into an anonymous function.
-  if (ParseTopLevelExpr()) {
-    fprintf(stderr, "Parsed a top-level expr\n");
-  } else {
-    // Skip token for error recovery.
-    getNextToken();
-  }
-}
-
-/// top ::= definition | external | expression | ';'
-static void MainLoop() {
-  while (1) {
-    fprintf(stderr, "ready&gt; ");
-    switch (CurTok) {
-    case tok_eof:    return;
-    case ';':        getNextToken(); break;  // ignore top-level semicolons.
-    case tok_def:    HandleDefinition(); break;
-    case tok_extern: HandleExtern(); break;
-    default:         HandleTopLevelExpression(); break;
-    }
-  }
-}
-
-//===----------------------------------------------------------------------===//
-// Main driver code.
-//===----------------------------------------------------------------------===//
-
-int main() {
-  // Install standard binary operators.
-  // 1 is lowest precedence.
-  BinopPrecedence['&lt;'] = 10;
-  BinopPrecedence['+'] = 20;
-  BinopPrecedence['-'] = 20;
-  BinopPrecedence['*'] = 40;  // highest.
-
-  // Prime the first token.
-  fprintf(stderr, "ready&gt; ");
-  getNextToken();
-
-  // Run the main "interpreter loop" now.
-  MainLoop();
-
-  return 0;
-}
-</pre>
-</div>
-<a href="LangImpl3.html">Next: Implementing Code Generation to LLVM IR</a>
-</div>
-
-<!-- *********************************************************************** -->
-<hr>
-<address>
-  <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
-  src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"></a>
-  <a href="http://validator.w3.org/check/referer"><img
-  src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"></a>
-
-  <a href="mailto:sabre at nondot.org">Chris Lattner</a><br>
-  <a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
-  Last modified: $Date$
-</address>
-</body>
-</html>
diff --git a/libclamav/c++/llvm/docs/tutorial/LangImpl3.html b/libclamav/c++/llvm/docs/tutorial/LangImpl3.html
deleted file mode 100644
index 39ec628..0000000
--- a/libclamav/c++/llvm/docs/tutorial/LangImpl3.html
+++ /dev/null
@@ -1,1269 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-                      "http://www.w3.org/TR/html4/strict.dtd">
-
-<html>
-<head>
-  <title>Kaleidoscope: Implementing code generation to LLVM IR</title>
-  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-  <meta name="author" content="Chris Lattner">
-  <link rel="stylesheet" href="../llvm.css" type="text/css">
-</head>
-
-<body>
-
-<div class="doc_title">Kaleidoscope: Code generation to LLVM IR</div>
-
-<ul>
-<li><a href="index.html">Up to Tutorial Index</a></li>
-<li>Chapter 3
-  <ol>
-    <li><a href="#intro">Chapter 3 Introduction</a></li>
-    <li><a href="#basics">Code Generation Setup</a></li>
-    <li><a href="#exprs">Expression Code Generation</a></li>
-    <li><a href="#funcs">Function Code Generation</a></li>
-    <li><a href="#driver">Driver Changes and Closing Thoughts</a></li>
-    <li><a href="#code">Full Code Listing</a></li>
-  </ol>
-</li>
-<li><a href="LangImpl4.html">Chapter 4</a>: Adding JIT and Optimizer 
-Support</li>
-</ul>
-
-<div class="doc_author">
-  <p>Written by <a href="mailto:sabre at nondot.org">Chris Lattner</a></p>
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="intro">Chapter 3 Introduction</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>Welcome to Chapter 3 of the "<a href="index.html">Implementing a language
-with LLVM</a>" tutorial.  This chapter shows you how to transform the <a 
-href="LangImpl2.html">Abstract Syntax Tree</a>, built in Chapter 2, into LLVM IR.
-This will teach you a little bit about how LLVM does things, as well as
-demonstrate how easy it is to use.  It's much more work to build a lexer and
-parser than it is to generate LLVM IR code. :)
-</p>
-
-<p><b>Please note</b>: the code in this chapter and later require LLVM 2.2 or
-later.  LLVM 2.1 and before will not work with it.  Also note that you need
-to use a version of this tutorial that matches your LLVM release: If you are
-using an official LLVM release, use the version of the documentation included
-with your release or on the <a href="http://llvm.org/releases/">llvm.org 
-releases page</a>.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="basics">Code Generation Setup</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>
-In order to generate LLVM IR, we want some simple setup to get started.  First
-we define virtual code generation (codegen) methods in each AST class:</p>
-
-<div class="doc_code">
-<pre>
-/// ExprAST - Base class for all expression nodes.
-class ExprAST {
-public:
-  virtual ~ExprAST() {}
-  <b>virtual Value *Codegen() = 0;</b>
-};
-
-/// NumberExprAST - Expression class for numeric literals like "1.0".
-class NumberExprAST : public ExprAST {
-  double Val;
-public:
-  NumberExprAST(double val) : Val(val) {}
-  <b>virtual Value *Codegen();</b>
-};
-...
-</pre>
-</div>
-
-<p>The Codegen() method says to emit IR for that AST node along with all the things it
-depends on, and they all return an LLVM Value object. 
-"Value" is the class used to represent a "<a 
-href="http://en.wikipedia.org/wiki/Static_single_assignment_form">Static Single
-Assignment (SSA)</a> register" or "SSA value" in LLVM.  The most distinct aspect
-of SSA values is that their value is computed as the related instruction
-executes, and it does not get a new value until (and if) the instruction
-re-executes.  In other words, there is no way to "change" an SSA value.  For
-more information, please read up on <a 
-href="http://en.wikipedia.org/wiki/Static_single_assignment_form">Static Single
-Assignment</a> - the concepts are really quite natural once you grok them.</p>
-
-<p>Note that instead of adding virtual methods to the ExprAST class hierarchy,
-it could also make sense to use a <a
-href="http://en.wikipedia.org/wiki/Visitor_pattern">visitor pattern</a> or some
-other way to model this.  Again, this tutorial won't dwell on good software
-engineering practices: for our purposes, adding a virtual method is
-simplest.</p>
-
-<p>The
-second thing we want is an "Error" method like we used for the parser, which will
-be used to report errors found during code generation (for example, use of an
-undeclared parameter):</p>
-
-<div class="doc_code">
-<pre>
-Value *ErrorV(const char *Str) { Error(Str); return 0; }
-
-static Module *TheModule;
-static IRBuilder&lt;&gt; Builder(getGlobalContext());
-static std::map&lt;std::string, Value*&gt; NamedValues;
-</pre>
-</div>
-
-<p>The static variables will be used during code generation.  <tt>TheModule</tt>
-is the LLVM construct that contains all of the functions and global variables in
-a chunk of code.  In many ways, it is the top-level structure that the LLVM IR
-uses to contain code.</p>
-
-<p>The <tt>Builder</tt> object is a helper object that makes it easy to generate
-LLVM instructions.  Instances of the <a 
-href="http://llvm.org/doxygen/IRBuilder_8h-source.html"><tt>IRBuilder</tt></a> 
-class template keep track of the current place to insert instructions and has
-methods to create new instructions.</p>
-
-<p>The <tt>NamedValues</tt> map keeps track of which values are defined in the
-current scope and what their LLVM representation is.  (In other words, it is a
-symbol table for the code).  In this form of Kaleidoscope, the only things that
-can be referenced are function parameters.  As such, function parameters will
-be in this map when generating code for their function body.</p>
-
-<p>
-With these basics in place, we can start talking about how to generate code for
-each expression.  Note that this assumes that the <tt>Builder</tt> has been set
-up to generate code <em>into</em> something.  For now, we'll assume that this
-has already been done, and we'll just use it to emit code.
-</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="exprs">Expression Code Generation</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>Generating LLVM code for expression nodes is very straightforward: less
-than 45 lines of commented code for all four of our expression nodes.  First
-we'll do numeric literals:</p>
-
-<div class="doc_code">
-<pre>
-Value *NumberExprAST::Codegen() {
-  return ConstantFP::get(getGlobalContext(), APFloat(Val));
-}
-</pre>
-</div>
-
-<p>In the LLVM IR, numeric constants are represented with the
-<tt>ConstantFP</tt> class, which holds the numeric value in an <tt>APFloat</tt>
-internally (<tt>APFloat</tt> has the capability of holding floating point
-constants of <em>A</em>rbitrary <em>P</em>recision).  This code basically just
-creates and returns a <tt>ConstantFP</tt>.  Note that in the LLVM IR
-that constants are all uniqued together and shared.  For this reason, the API
-uses "the Context.get..." idiom instead of "new foo(..)" or "foo::Create(..)".</p>
-
-<div class="doc_code">
-<pre>
-Value *VariableExprAST::Codegen() {
-  // Look this variable up in the function.
-  Value *V = NamedValues[Name];
-  return V ? V : ErrorV("Unknown variable name");
-}
-</pre>
-</div>
-
-<p>References to variables are also quite simple using LLVM.  In the simple version
-of Kaleidoscope, we assume that the variable has already been emitted somewhere
-and its value is available.  In practice, the only values that can be in the
-<tt>NamedValues</tt> map are function arguments.  This
-code simply checks to see that the specified name is in the map (if not, an 
-unknown variable is being referenced) and returns the value for it.  In future
-chapters, we'll add support for <a href="LangImpl5.html#for">loop induction 
-variables</a> in the symbol table, and for <a 
-href="LangImpl7.html#localvars">local variables</a>.</p>
-
-<div class="doc_code">
-<pre>
-Value *BinaryExprAST::Codegen() {
-  Value *L = LHS-&gt;Codegen();
-  Value *R = RHS-&gt;Codegen();
-  if (L == 0 || R == 0) return 0;
-  
-  switch (Op) {
-  case '+': return Builder.CreateAdd(L, R, "addtmp");
-  case '-': return Builder.CreateSub(L, R, "subtmp");
-  case '*': return Builder.CreateMul(L, R, "multmp");
-  case '&lt;':
-    L = Builder.CreateFCmpULT(L, R, "cmptmp");
-    // Convert bool 0/1 to double 0.0 or 1.0
-    return Builder.CreateUIToFP(L, Type::getDoubleTy(getGlobalContext()),
-                                "booltmp");
-  default: return ErrorV("invalid binary operator");
-  }
-}
-</pre>
-</div>
-
-<p>Binary operators start to get more interesting.  The basic idea here is that
-we recursively emit code for the left-hand side of the expression, then the 
-right-hand side, then we compute the result of the binary expression.  In this
-code, we do a simple switch on the opcode to create the right LLVM instruction.
-</p>
-
-<p>In the example above, the LLVM builder class is starting to show its value.  
-IRBuilder knows where to insert the newly created instruction, all you have to
-do is specify what instruction to create (e.g. with <tt>CreateAdd</tt>), which
-operands to use (<tt>L</tt> and <tt>R</tt> here) and optionally provide a name
-for the generated instruction.</p>
-
-<p>One nice thing about LLVM is that the name is just a hint.  For instance, if
-the code above emits multiple "addtmp" variables, LLVM will automatically
-provide each one with an increasing, unique numeric suffix.  Local value names
-for instructions are purely optional, but it makes it much easier to read the
-IR dumps.</p>
-
-<p><a href="../LangRef.html#instref">LLVM instructions</a> are constrained by
-strict rules: for example, the Left and Right operators of
-an <a href="../LangRef.html#i_add">add instruction</a> must have the same
-type, and the result type of the add must match the operand types.  Because
-all values in Kaleidoscope are doubles, this makes for very simple code for add,
-sub and mul.</p>
-
-<p>On the other hand, LLVM specifies that the <a 
-href="../LangRef.html#i_fcmp">fcmp instruction</a> always returns an 'i1' value
-(a one bit integer).  The problem with this is that Kaleidoscope wants the value to be a 0.0 or 1.0 value.  In order to get these semantics, we combine the fcmp instruction with
-a <a href="../LangRef.html#i_uitofp">uitofp instruction</a>.  This instruction
-converts its input integer into a floating point value by treating the input
-as an unsigned value.  In contrast, if we used the <a 
-href="../LangRef.html#i_sitofp">sitofp instruction</a>, the Kaleidoscope '&lt;'
-operator would return 0.0 and -1.0, depending on the input value.</p>
-
-<div class="doc_code">
-<pre>
-Value *CallExprAST::Codegen() {
-  // Look up the name in the global module table.
-  Function *CalleeF = TheModule-&gt;getFunction(Callee);
-  if (CalleeF == 0)
-    return ErrorV("Unknown function referenced");
-  
-  // If argument mismatch error.
-  if (CalleeF-&gt;arg_size() != Args.size())
-    return ErrorV("Incorrect # arguments passed");
-
-  std::vector&lt;Value*&gt; ArgsV;
-  for (unsigned i = 0, e = Args.size(); i != e; ++i) {
-    ArgsV.push_back(Args[i]-&gt;Codegen());
-    if (ArgsV.back() == 0) return 0;
-  }
-  
-  return Builder.CreateCall(CalleeF, ArgsV.begin(), ArgsV.end(), "calltmp");
-}
-</pre>
-</div>
-
-<p>Code generation for function calls is quite straightforward with LLVM.  The
-code above initially does a function name lookup in the LLVM Module's symbol
-table.  Recall that the LLVM Module is the container that holds all of the
-functions we are JIT'ing.  By giving each function the same name as what the
-user specifies, we can use the LLVM symbol table to resolve function names for
-us.</p>
-
-<p>Once we have the function to call, we recursively codegen each argument that
-is to be passed in, and create an LLVM <a href="../LangRef.html#i_call">call
-instruction</a>.  Note that LLVM uses the native C calling conventions by
-default, allowing these calls to also call into standard library functions like
-"sin" and "cos", with no additional effort.</p>
-
-<p>This wraps up our handling of the four basic expressions that we have so far
-in Kaleidoscope.  Feel free to go in and add some more.  For example, by 
-browsing the <a href="../LangRef.html">LLVM language reference</a> you'll find
-several other interesting instructions that are really easy to plug into our
-basic framework.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="funcs">Function Code Generation</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>Code generation for prototypes and functions must handle a number of
-details, which make their code less beautiful than expression code
-generation, but allows us to  illustrate some important points.  First, lets
-talk about code generation for prototypes: they are used both for function 
-bodies and external function declarations.  The code starts with:</p>
-
-<div class="doc_code">
-<pre>
-Function *PrototypeAST::Codegen() {
-  // Make the function type:  double(double,double) etc.
-  std::vector&lt;const Type*&gt; Doubles(Args.size(),
-                                   Type::getDoubleTy(getGlobalContext()));
-  FunctionType *FT = FunctionType::get(Type::getDoubleTy(getGlobalContext()),
-                                       Doubles, false);
-  
-  Function *F = Function::Create(FT, Function::ExternalLinkage, Name, TheModule);
-</pre>
-</div>
-
-<p>This code packs a lot of power into a few lines.  Note first that this 
-function returns a "Function*" instead of a "Value*".  Because a "prototype"
-really talks about the external interface for a function (not the value computed
-by an expression), it makes sense for it to return the LLVM Function it
-corresponds to when codegen'd.</p>
-
-<p>The call to <tt>Context.get</tt> creates
-the <tt>FunctionType</tt> that should be used for a given Prototype.  Since all
-function arguments in Kaleidoscope are of type double, the first line creates
-a vector of "N" LLVM double types.  It then uses the <tt>Context.get</tt>
-method to create a function type that takes "N" doubles as arguments, returns
-one double as a result, and that is not vararg (the false parameter indicates
-this).  Note that Types in LLVM are uniqued just like Constants are, so you
-don't "new" a type, you "get" it.</p>
-
-<p>The final line above actually creates the function that the prototype will
-correspond to.  This indicates the type, linkage and name to use, as well as which
-module to insert into.  "<a href="../LangRef.html#linkage">external linkage</a>"
-means that the function may be defined outside the current module and/or that it
-is callable by functions outside the module.  The Name passed in is the name the
-user specified: since "<tt>TheModule</tt>" is specified, this name is registered
-in "<tt>TheModule</tt>"s symbol table, which is used by the function call code
-above.</p>
-
-<div class="doc_code">
-<pre>
-  // If F conflicted, there was already something named 'Name'.  If it has a
-  // body, don't allow redefinition or reextern.
-  if (F-&gt;getName() != Name) {
-    // Delete the one we just made and get the existing one.
-    F-&gt;eraseFromParent();
-    F = TheModule-&gt;getFunction(Name);
-</pre>
-</div>
-
-<p>The Module symbol table works just like the Function symbol table when it
-comes to name conflicts: if a new function is created with a name was previously
-added to the symbol table, it will get implicitly renamed when added to the
-Module.  The code above exploits this fact to determine if there was a previous
-definition of this function.</p>
-
-<p>In Kaleidoscope, I choose to allow redefinitions of functions in two cases:
-first, we want to allow 'extern'ing a function more than once, as long as the
-prototypes for the externs match (since all arguments have the same type, we
-just have to check that the number of arguments match).  Second, we want to
-allow 'extern'ing a function and then defining a body for it.  This is useful
-when defining mutually recursive functions.</p>
-
-<p>In order to implement this, the code above first checks to see if there is
-a collision on the name of the function.  If so, it deletes the function we just
-created (by calling <tt>eraseFromParent</tt>) and then calling 
-<tt>getFunction</tt> to get the existing function with the specified name.  Note
-that many APIs in LLVM have "erase" forms and "remove" forms.  The "remove" form
-unlinks the object from its parent (e.g. a Function from a Module) and returns
-it.  The "erase" form unlinks the object and then deletes it.</p>
-   
-<div class="doc_code">
-<pre>
-    // If F already has a body, reject this.
-    if (!F-&gt;empty()) {
-      ErrorF("redefinition of function");
-      return 0;
-    }
-    
-    // If F took a different number of args, reject.
-    if (F-&gt;arg_size() != Args.size()) {
-      ErrorF("redefinition of function with different # args");
-      return 0;
-    }
-  }
-</pre>
-</div>
-
-<p>In order to verify the logic above, we first check to see if the pre-existing
-function is "empty".  In this case, empty means that it has no basic blocks in
-it, which means it has no body.  If it has no body, it is a forward 
-declaration.  Since we don't allow anything after a full definition of the
-function, the code rejects this case.  If the previous reference to a function
-was an 'extern', we simply verify that the number of arguments for that
-definition and this one match up.  If not, we emit an error.</p>
-
-<div class="doc_code">
-<pre>
-  // Set names for all arguments.
-  unsigned Idx = 0;
-  for (Function::arg_iterator AI = F-&gt;arg_begin(); Idx != Args.size();
-       ++AI, ++Idx) {
-    AI-&gt;setName(Args[Idx]);
-    
-    // Add arguments to variable symbol table.
-    NamedValues[Args[Idx]] = AI;
-  }
-  return F;
-}
-</pre>
-</div>
-
-<p>The last bit of code for prototypes loops over all of the arguments in the
-function, setting the name of the LLVM Argument objects to match, and registering
-the arguments in the <tt>NamedValues</tt> map for future use by the
-<tt>VariableExprAST</tt> AST node.  Once this is set up, it returns the Function
-object to the caller.  Note that we don't check for conflicting 
-argument names here (e.g. "extern foo(a b a)").  Doing so would be very
-straight-forward with the mechanics we have already used above.</p>
-
-<div class="doc_code">
-<pre>
-Function *FunctionAST::Codegen() {
-  NamedValues.clear();
-  
-  Function *TheFunction = Proto-&gt;Codegen();
-  if (TheFunction == 0)
-    return 0;
-</pre>
-</div>
-
-<p>Code generation for function definitions starts out simply enough: we just
-codegen the prototype (Proto) and verify that it is ok.  We then clear out the
-<tt>NamedValues</tt> map to make sure that there isn't anything in it from the
-last function we compiled.  Code generation of the prototype ensures that there
-is an LLVM Function object that is ready to go for us.</p>
-
-<div class="doc_code">
-<pre>
-  // Create a new basic block to start insertion into.
-  BasicBlock *BB = BasicBlock::Create(getGlobalContext(), "entry", TheFunction);
-  Builder.SetInsertPoint(BB);
-  
-  if (Value *RetVal = Body-&gt;Codegen()) {
-</pre>
-</div>
-
-<p>Now we get to the point where the <tt>Builder</tt> is set up.  The first
-line creates a new <a href="http://en.wikipedia.org/wiki/Basic_block">basic
-block</a> (named "entry"), which is inserted into <tt>TheFunction</tt>.  The
-second line then tells the builder that new instructions should be inserted into
-the end of the new basic block.  Basic blocks in LLVM are an important part
-of functions that define the <a 
-href="http://en.wikipedia.org/wiki/Control_flow_graph">Control Flow Graph</a>.
-Since we don't have any control flow, our functions will only contain one 
-block at this point.  We'll fix this in <a href="LangImpl5.html">Chapter 5</a> :).</p>
-
-<div class="doc_code">
-<pre>
-  if (Value *RetVal = Body-&gt;Codegen()) {
-    // Finish off the function.
-    Builder.CreateRet(RetVal);
-
-    // Validate the generated code, checking for consistency.
-    verifyFunction(*TheFunction);
-
-    return TheFunction;
-  }
-</pre>
-</div>
-
-<p>Once the insertion point is set up, we call the <tt>CodeGen()</tt> method for
-the root expression of the function.  If no error happens, this emits code to
-compute the expression into the entry block and returns the value that was
-computed.  Assuming no error, we then create an LLVM <a 
-href="../LangRef.html#i_ret">ret instruction</a>, which completes the function.
-Once the function is built, we call <tt>verifyFunction</tt>, which
-is provided by LLVM.  This function does a variety of consistency checks on the
-generated code, to determine if our compiler is doing everything right.  Using
-this is important: it can catch a lot of bugs.  Once the function is finished
-and validated, we return it.</p>
-  
-<div class="doc_code">
-<pre>
-  // Error reading body, remove function.
-  TheFunction-&gt;eraseFromParent();
-  return 0;
-}
-</pre>
-</div>
-
-<p>The only piece left here is handling of the error case.  For simplicity, we
-handle this by merely deleting the function we produced with the 
-<tt>eraseFromParent</tt> method.  This allows the user to redefine a function
-that they incorrectly typed in before: if we didn't delete it, it would live in
-the symbol table, with a body, preventing future redefinition.</p>
-
-<p>This code does have a bug, though.  Since the <tt>PrototypeAST::Codegen</tt>
-can return a previously defined forward declaration, our code can actually delete
-a forward declaration.  There are a number of ways to fix this bug, see what you
-can come up with!  Here is a testcase:</p>
-
-<div class="doc_code">
-<pre>
-extern foo(a b);     # ok, defines foo.
-def foo(a b) c;      # error, 'c' is invalid.
-def bar() foo(1, 2); # error, unknown function "foo"
-</pre>
-</div>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="driver">Driver Changes and 
-Closing Thoughts</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>
-For now, code generation to LLVM doesn't really get us much, except that we can
-look at the pretty IR calls.  The sample code inserts calls to Codegen into the
-"<tt>HandleDefinition</tt>", "<tt>HandleExtern</tt>" etc functions, and then
-dumps out the LLVM IR.  This gives a nice way to look at the LLVM IR for simple
-functions.  For example:
-</p>
-
-<div class="doc_code">
-<pre>
-ready> <b>4+5</b>;
-Read top-level expression:
-define double @""() {
-entry:
-        %addtmp = add double 4.000000e+00, 5.000000e+00
-        ret double %addtmp
-}
-</pre>
-</div>
-
-<p>Note how the parser turns the top-level expression into anonymous functions
-for us.  This will be handy when we add <a href="LangImpl4.html#jit">JIT 
-support</a> in the next chapter.  Also note that the code is very literally
-transcribed, no optimizations are being performed.  We will 
-<a href="LangImpl4.html#trivialconstfold">add optimizations</a> explicitly in
-the next chapter.</p>
-
-<div class="doc_code">
-<pre>
-ready&gt; <b>def foo(a b) a*a + 2*a*b + b*b;</b>
-Read function definition:
-define double @foo(double %a, double %b) {
-entry:
-        %multmp = mul double %a, %a
-        %multmp1 = mul double 2.000000e+00, %a
-        %multmp2 = mul double %multmp1, %b
-        %addtmp = add double %multmp, %multmp2
-        %multmp3 = mul double %b, %b
-        %addtmp4 = add double %addtmp, %multmp3
-        ret double %addtmp4
-}
-</pre>
-</div>
-
-<p>This shows some simple arithmetic. Notice the striking similarity to the
-LLVM builder calls that we use to create the instructions.</p>
-
-<div class="doc_code">
-<pre>
-ready&gt; <b>def bar(a) foo(a, 4.0) + bar(31337);</b>
-Read function definition:
-define double @bar(double %a) {
-entry:
-        %calltmp = call double @foo( double %a, double 4.000000e+00 )
-        %calltmp1 = call double @bar( double 3.133700e+04 )
-        %addtmp = add double %calltmp, %calltmp1
-        ret double %addtmp
-}
-</pre>
-</div>
-
-<p>This shows some function calls.  Note that this function will take a long
-time to execute if you call it.  In the future we'll add conditional control 
-flow to actually make recursion useful :).</p>
-
-<div class="doc_code">
-<pre>
-ready&gt; <b>extern cos(x);</b>
-Read extern: 
-declare double @cos(double)
-
-ready&gt; <b>cos(1.234);</b>
-Read top-level expression:
-define double @""() {
-entry:
-        %calltmp = call double @cos( double 1.234000e+00 )
-        ret double %calltmp
-}
-</pre>
-</div>
-
-<p>This shows an extern for the libm "cos" function, and a call to it.</p>
-
-
-<div class="doc_code">
-<pre>
-ready&gt; <b>^D</b>
-; ModuleID = 'my cool jit'
-
-define double @""() {
-entry:
-        %addtmp = add double 4.000000e+00, 5.000000e+00
-        ret double %addtmp
-}
-
-define double @foo(double %a, double %b) {
-entry:
-        %multmp = mul double %a, %a
-        %multmp1 = mul double 2.000000e+00, %a
-        %multmp2 = mul double %multmp1, %b
-        %addtmp = add double %multmp, %multmp2
-        %multmp3 = mul double %b, %b
-        %addtmp4 = add double %addtmp, %multmp3
-        ret double %addtmp4
-}
-
-define double @bar(double %a) {
-entry:
-        %calltmp = call double @foo( double %a, double 4.000000e+00 )
-        %calltmp1 = call double @bar( double 3.133700e+04 )
-        %addtmp = add double %calltmp, %calltmp1
-        ret double %addtmp
-}
-
-declare double @cos(double)
-
-define double @""() {
-entry:
-        %calltmp = call double @cos( double 1.234000e+00 )
-        ret double %calltmp
-}
-</pre>
-</div>
-
-<p>When you quit the current demo, it dumps out the IR for the entire module
-generated.  Here you can see the big picture with all the functions referencing
-each other.</p>
-
-<p>This wraps up the third chapter of the Kaleidoscope tutorial.  Up next, we'll
-describe how to <a href="LangImpl4.html">add JIT codegen and optimizer
-support</a> to this so we can actually start running code!</p>
-
-</div>
-
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="code">Full Code Listing</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>
-Here is the complete code listing for our running example, enhanced with the
-LLVM code generator.    Because this uses the LLVM libraries, we need to link
-them in.  To do this, we use the <a 
-href="http://llvm.org/cmds/llvm-config.html">llvm-config</a> tool to inform
-our makefile/command line about which options to use:</p>
-
-<div class="doc_code">
-<pre>
-   # Compile
-   g++ -g -O3 toy.cpp `llvm-config --cppflags --ldflags --libs core` -o toy
-   # Run
-   ./toy
-</pre>
-</div>
-
-<p>Here is the code:</p>
-
-<div class="doc_code">
-<pre>
-// To build this:
-// See example below.
-
-#include "llvm/DerivedTypes.h"
-#include "llvm/LLVMContext.h"
-#include "llvm/Module.h"
-#include "llvm/Analysis/Verifier.h"
-#include "llvm/Support/IRBuilder.h"
-#include &lt;cstdio&gt;
-#include &lt;string&gt;
-#include &lt;map&gt;
-#include &lt;vector&gt;
-using namespace llvm;
-
-//===----------------------------------------------------------------------===//
-// Lexer
-//===----------------------------------------------------------------------===//
-
-// The lexer returns tokens [0-255] if it is an unknown character, otherwise one
-// of these for known things.
-enum Token {
-  tok_eof = -1,
-
-  // commands
-  tok_def = -2, tok_extern = -3,
-
-  // primary
-  tok_identifier = -4, tok_number = -5
-};
-
-static std::string IdentifierStr;  // Filled in if tok_identifier
-static double NumVal;              // Filled in if tok_number
-
-/// gettok - Return the next token from standard input.
-static int gettok() {
-  static int LastChar = ' ';
-
-  // Skip any whitespace.
-  while (isspace(LastChar))
-    LastChar = getchar();
-
-  if (isalpha(LastChar)) { // identifier: [a-zA-Z][a-zA-Z0-9]*
-    IdentifierStr = LastChar;
-    while (isalnum((LastChar = getchar())))
-      IdentifierStr += LastChar;
-
-    if (IdentifierStr == "def") return tok_def;
-    if (IdentifierStr == "extern") return tok_extern;
-    return tok_identifier;
-  }
-
-  if (isdigit(LastChar) || LastChar == '.') {   // Number: [0-9.]+
-    std::string NumStr;
-    do {
-      NumStr += LastChar;
-      LastChar = getchar();
-    } while (isdigit(LastChar) || LastChar == '.');
-
-    NumVal = strtod(NumStr.c_str(), 0);
-    return tok_number;
-  }
-
-  if (LastChar == '#') {
-    // Comment until end of line.
-    do LastChar = getchar();
-    while (LastChar != EOF &amp;&amp; LastChar != '\n' &amp;&amp; LastChar != '\r');
-    
-    if (LastChar != EOF)
-      return gettok();
-  }
-  
-  // Check for end of file.  Don't eat the EOF.
-  if (LastChar == EOF)
-    return tok_eof;
-
-  // Otherwise, just return the character as its ascii value.
-  int ThisChar = LastChar;
-  LastChar = getchar();
-  return ThisChar;
-}
-
-//===----------------------------------------------------------------------===//
-// Abstract Syntax Tree (aka Parse Tree)
-//===----------------------------------------------------------------------===//
-
-/// ExprAST - Base class for all expression nodes.
-class ExprAST {
-public:
-  virtual ~ExprAST() {}
-  virtual Value *Codegen() = 0;
-};
-
-/// NumberExprAST - Expression class for numeric literals like "1.0".
-class NumberExprAST : public ExprAST {
-  double Val;
-public:
-  NumberExprAST(double val) : Val(val) {}
-  virtual Value *Codegen();
-};
-
-/// VariableExprAST - Expression class for referencing a variable, like "a".
-class VariableExprAST : public ExprAST {
-  std::string Name;
-public:
-  VariableExprAST(const std::string &amp;name) : Name(name) {}
-  virtual Value *Codegen();
-};
-
-/// BinaryExprAST - Expression class for a binary operator.
-class BinaryExprAST : public ExprAST {
-  char Op;
-  ExprAST *LHS, *RHS;
-public:
-  BinaryExprAST(char op, ExprAST *lhs, ExprAST *rhs) 
-    : Op(op), LHS(lhs), RHS(rhs) {}
-  virtual Value *Codegen();
-};
-
-/// CallExprAST - Expression class for function calls.
-class CallExprAST : public ExprAST {
-  std::string Callee;
-  std::vector&lt;ExprAST*&gt; Args;
-public:
-  CallExprAST(const std::string &amp;callee, std::vector&lt;ExprAST*&gt; &amp;args)
-    : Callee(callee), Args(args) {}
-  virtual Value *Codegen();
-};
-
-/// PrototypeAST - This class represents the "prototype" for a function,
-/// which captures its name, and its argument names (thus implicitly the number
-/// of arguments the function takes).
-class PrototypeAST {
-  std::string Name;
-  std::vector&lt;std::string&gt; Args;
-public:
-  PrototypeAST(const std::string &amp;name, const std::vector&lt;std::string&gt; &amp;args)
-    : Name(name), Args(args) {}
-  
-  Function *Codegen();
-};
-
-/// FunctionAST - This class represents a function definition itself.
-class FunctionAST {
-  PrototypeAST *Proto;
-  ExprAST *Body;
-public:
-  FunctionAST(PrototypeAST *proto, ExprAST *body)
-    : Proto(proto), Body(body) {}
-  
-  Function *Codegen();
-};
-
-//===----------------------------------------------------------------------===//
-// Parser
-//===----------------------------------------------------------------------===//
-
-/// CurTok/getNextToken - Provide a simple token buffer.  CurTok is the current
-/// token the parser is looking at.  getNextToken reads another token from the
-/// lexer and updates CurTok with its results.
-static int CurTok;
-static int getNextToken() {
-  return CurTok = gettok();
-}
-
-/// BinopPrecedence - This holds the precedence for each binary operator that is
-/// defined.
-static std::map&lt;char, int&gt; BinopPrecedence;
-
-/// GetTokPrecedence - Get the precedence of the pending binary operator token.
-static int GetTokPrecedence() {
-  if (!isascii(CurTok))
-    return -1;
-  
-  // Make sure it's a declared binop.
-  int TokPrec = BinopPrecedence[CurTok];
-  if (TokPrec &lt;= 0) return -1;
-  return TokPrec;
-}
-
-/// Error* - These are little helper functions for error handling.
-ExprAST *Error(const char *Str) { fprintf(stderr, "Error: %s\n", Str);return 0;}
-PrototypeAST *ErrorP(const char *Str) { Error(Str); return 0; }
-FunctionAST *ErrorF(const char *Str) { Error(Str); return 0; }
-
-static ExprAST *ParseExpression();
-
-/// identifierexpr
-///   ::= identifier
-///   ::= identifier '(' expression* ')'
-static ExprAST *ParseIdentifierExpr() {
-  std::string IdName = IdentifierStr;
-  
-  getNextToken();  // eat identifier.
-  
-  if (CurTok != '(') // Simple variable ref.
-    return new VariableExprAST(IdName);
-  
-  // Call.
-  getNextToken();  // eat (
-  std::vector&lt;ExprAST*&gt; Args;
-  if (CurTok != ')') {
-    while (1) {
-      ExprAST *Arg = ParseExpression();
-      if (!Arg) return 0;
-      Args.push_back(Arg);
-
-      if (CurTok == ')') break;
-
-      if (CurTok != ',')
-        return Error("Expected ')' or ',' in argument list");
-      getNextToken();
-    }
-  }
-
-  // Eat the ')'.
-  getNextToken();
-  
-  return new CallExprAST(IdName, Args);
-}
-
-/// numberexpr ::= number
-static ExprAST *ParseNumberExpr() {
-  ExprAST *Result = new NumberExprAST(NumVal);
-  getNextToken(); // consume the number
-  return Result;
-}
-
-/// parenexpr ::= '(' expression ')'
-static ExprAST *ParseParenExpr() {
-  getNextToken();  // eat (.
-  ExprAST *V = ParseExpression();
-  if (!V) return 0;
-  
-  if (CurTok != ')')
-    return Error("expected ')'");
-  getNextToken();  // eat ).
-  return V;
-}
-
-/// primary
-///   ::= identifierexpr
-///   ::= numberexpr
-///   ::= parenexpr
-static ExprAST *ParsePrimary() {
-  switch (CurTok) {
-  default: return Error("unknown token when expecting an expression");
-  case tok_identifier: return ParseIdentifierExpr();
-  case tok_number:     return ParseNumberExpr();
-  case '(':            return ParseParenExpr();
-  }
-}
-
-/// binoprhs
-///   ::= ('+' primary)*
-static ExprAST *ParseBinOpRHS(int ExprPrec, ExprAST *LHS) {
-  // If this is a binop, find its precedence.
-  while (1) {
-    int TokPrec = GetTokPrecedence();
-    
-    // If this is a binop that binds at least as tightly as the current binop,
-    // consume it, otherwise we are done.
-    if (TokPrec &lt; ExprPrec)
-      return LHS;
-    
-    // Okay, we know this is a binop.
-    int BinOp = CurTok;
-    getNextToken();  // eat binop
-    
-    // Parse the primary expression after the binary operator.
-    ExprAST *RHS = ParsePrimary();
-    if (!RHS) return 0;
-    
-    // If BinOp binds less tightly with RHS than the operator after RHS, let
-    // the pending operator take RHS as its LHS.
-    int NextPrec = GetTokPrecedence();
-    if (TokPrec &lt; NextPrec) {
-      RHS = ParseBinOpRHS(TokPrec+1, RHS);
-      if (RHS == 0) return 0;
-    }
-    
-    // Merge LHS/RHS.
-    LHS = new BinaryExprAST(BinOp, LHS, RHS);
-  }
-}
-
-/// expression
-///   ::= primary binoprhs
-///
-static ExprAST *ParseExpression() {
-  ExprAST *LHS = ParsePrimary();
-  if (!LHS) return 0;
-  
-  return ParseBinOpRHS(0, LHS);
-}
-
-/// prototype
-///   ::= id '(' id* ')'
-static PrototypeAST *ParsePrototype() {
-  if (CurTok != tok_identifier)
-    return ErrorP("Expected function name in prototype");
-
-  std::string FnName = IdentifierStr;
-  getNextToken();
-  
-  if (CurTok != '(')
-    return ErrorP("Expected '(' in prototype");
-  
-  std::vector&lt;std::string&gt; ArgNames;
-  while (getNextToken() == tok_identifier)
-    ArgNames.push_back(IdentifierStr);
-  if (CurTok != ')')
-    return ErrorP("Expected ')' in prototype");
-  
-  // success.
-  getNextToken();  // eat ')'.
-  
-  return new PrototypeAST(FnName, ArgNames);
-}
-
-/// definition ::= 'def' prototype expression
-static FunctionAST *ParseDefinition() {
-  getNextToken();  // eat def.
-  PrototypeAST *Proto = ParsePrototype();
-  if (Proto == 0) return 0;
-
-  if (ExprAST *E = ParseExpression())
-    return new FunctionAST(Proto, E);
-  return 0;
-}
-
-/// toplevelexpr ::= expression
-static FunctionAST *ParseTopLevelExpr() {
-  if (ExprAST *E = ParseExpression()) {
-    // Make an anonymous proto.
-    PrototypeAST *Proto = new PrototypeAST("", std::vector&lt;std::string&gt;());
-    return new FunctionAST(Proto, E);
-  }
-  return 0;
-}
-
-/// external ::= 'extern' prototype
-static PrototypeAST *ParseExtern() {
-  getNextToken();  // eat extern.
-  return ParsePrototype();
-}
-
-//===----------------------------------------------------------------------===//
-// Code Generation
-//===----------------------------------------------------------------------===//
-
-static Module *TheModule;
-static IRBuilder&lt;&gt; Builder(getGlobalContext());
-static std::map&lt;std::string, Value*&gt; NamedValues;
-
-Value *ErrorV(const char *Str) { Error(Str); return 0; }
-
-Value *NumberExprAST::Codegen() {
-  return ConstantFP::get(getGlobalContext(), APFloat(Val));
-}
-
-Value *VariableExprAST::Codegen() {
-  // Look this variable up in the function.
-  Value *V = NamedValues[Name];
-  return V ? V : ErrorV("Unknown variable name");
-}
-
-Value *BinaryExprAST::Codegen() {
-  Value *L = LHS-&gt;Codegen();
-  Value *R = RHS-&gt;Codegen();
-  if (L == 0 || R == 0) return 0;
-  
-  switch (Op) {
-  case '+': return Builder.CreateAdd(L, R, "addtmp");
-  case '-': return Builder.CreateSub(L, R, "subtmp");
-  case '*': return Builder.CreateMul(L, R, "multmp");
-  case '&lt;':
-    L = Builder.CreateFCmpULT(L, R, "cmptmp");
-    // Convert bool 0/1 to double 0.0 or 1.0
-    return Builder.CreateUIToFP(L, Type::getDoubleTy(getGlobalContext()),
-                                "booltmp");
-  default: return ErrorV("invalid binary operator");
-  }
-}
-
-Value *CallExprAST::Codegen() {
-  // Look up the name in the global module table.
-  Function *CalleeF = TheModule-&gt;getFunction(Callee);
-  if (CalleeF == 0)
-    return ErrorV("Unknown function referenced");
-  
-  // If argument mismatch error.
-  if (CalleeF-&gt;arg_size() != Args.size())
-    return ErrorV("Incorrect # arguments passed");
-
-  std::vector&lt;Value*&gt; ArgsV;
-  for (unsigned i = 0, e = Args.size(); i != e; ++i) {
-    ArgsV.push_back(Args[i]-&gt;Codegen());
-    if (ArgsV.back() == 0) return 0;
-  }
-  
-  return Builder.CreateCall(CalleeF, ArgsV.begin(), ArgsV.end(), "calltmp");
-}
-
-Function *PrototypeAST::Codegen() {
-  // Make the function type:  double(double,double) etc.
-  std::vector&lt;const Type*&gt; Doubles(Args.size(),
-                                   Type::getDoubleTy(getGlobalContext()));
-  FunctionType *FT = FunctionType::get(Type::getDoubleTy(getGlobalContext()),
-                                       Doubles, false);
-  
-  Function *F = Function::Create(FT, Function::ExternalLinkage, Name, TheModule);
-  
-  // If F conflicted, there was already something named 'Name'.  If it has a
-  // body, don't allow redefinition or reextern.
-  if (F-&gt;getName() != Name) {
-    // Delete the one we just made and get the existing one.
-    F-&gt;eraseFromParent();
-    F = TheModule-&gt;getFunction(Name);
-    
-    // If F already has a body, reject this.
-    if (!F-&gt;empty()) {
-      ErrorF("redefinition of function");
-      return 0;
-    }
-    
-    // If F took a different number of args, reject.
-    if (F-&gt;arg_size() != Args.size()) {
-      ErrorF("redefinition of function with different # args");
-      return 0;
-    }
-  }
-  
-  // Set names for all arguments.
-  unsigned Idx = 0;
-  for (Function::arg_iterator AI = F-&gt;arg_begin(); Idx != Args.size();
-       ++AI, ++Idx) {
-    AI-&gt;setName(Args[Idx]);
-    
-    // Add arguments to variable symbol table.
-    NamedValues[Args[Idx]] = AI;
-  }
-  
-  return F;
-}
-
-Function *FunctionAST::Codegen() {
-  NamedValues.clear();
-  
-  Function *TheFunction = Proto-&gt;Codegen();
-  if (TheFunction == 0)
-    return 0;
-  
-  // Create a new basic block to start insertion into.
-  BasicBlock *BB = BasicBlock::Create(getGlobalContext(), "entry", TheFunction);
-  Builder.SetInsertPoint(BB);
-  
-  if (Value *RetVal = Body-&gt;Codegen()) {
-    // Finish off the function.
-    Builder.CreateRet(RetVal);
-
-    // Validate the generated code, checking for consistency.
-    verifyFunction(*TheFunction);
-
-    return TheFunction;
-  }
-  
-  // Error reading body, remove function.
-  TheFunction-&gt;eraseFromParent();
-  return 0;
-}
-
-//===----------------------------------------------------------------------===//
-// Top-Level parsing and JIT Driver
-//===----------------------------------------------------------------------===//
-
-static void HandleDefinition() {
-  if (FunctionAST *F = ParseDefinition()) {
-    if (Function *LF = F-&gt;Codegen()) {
-      fprintf(stderr, "Read function definition:");
-      LF-&gt;dump();
-    }
-  } else {
-    // Skip token for error recovery.
-    getNextToken();
-  }
-}
-
-static void HandleExtern() {
-  if (PrototypeAST *P = ParseExtern()) {
-    if (Function *F = P-&gt;Codegen()) {
-      fprintf(stderr, "Read extern: ");
-      F-&gt;dump();
-    }
-  } else {
-    // Skip token for error recovery.
-    getNextToken();
-  }
-}
-
-static void HandleTopLevelExpression() {
-  // Evaluate a top-level expression into an anonymous function.
-  if (FunctionAST *F = ParseTopLevelExpr()) {
-    if (Function *LF = F-&gt;Codegen()) {
-      fprintf(stderr, "Read top-level expression:");
-      LF-&gt;dump();
-    }
-  } else {
-    // Skip token for error recovery.
-    getNextToken();
-  }
-}
-
-/// top ::= definition | external | expression | ';'
-static void MainLoop() {
-  while (1) {
-    fprintf(stderr, "ready&gt; ");
-    switch (CurTok) {
-    case tok_eof:    return;
-    case ';':        getNextToken(); break;  // ignore top-level semicolons.
-    case tok_def:    HandleDefinition(); break;
-    case tok_extern: HandleExtern(); break;
-    default:         HandleTopLevelExpression(); break;
-    }
-  }
-}
-
-//===----------------------------------------------------------------------===//
-// "Library" functions that can be "extern'd" from user code.
-//===----------------------------------------------------------------------===//
-
-/// putchard - putchar that takes a double and returns 0.
-extern "C" 
-double putchard(double X) {
-  putchar((char)X);
-  return 0;
-}
-
-//===----------------------------------------------------------------------===//
-// Main driver code.
-//===----------------------------------------------------------------------===//
-
-int main() {
-  LLVMContext &amp;Context = getGlobalContext();
-
-  // Install standard binary operators.
-  // 1 is lowest precedence.
-  BinopPrecedence['&lt;'] = 10;
-  BinopPrecedence['+'] = 20;
-  BinopPrecedence['-'] = 20;
-  BinopPrecedence['*'] = 40;  // highest.
-
-  // Prime the first token.
-  fprintf(stderr, "ready&gt; ");
-  getNextToken();
-
-  // Make the module, which holds all the code.
-  TheModule = new Module("my cool jit", Context);
-
-  // Run the main "interpreter loop" now.
-  MainLoop();
-
-  // Print out all of the generated code.
-  TheModule-&gt;dump();
-
-  return 0;
-}
-</pre>
-</div>
-<a href="LangImpl4.html">Next: Adding JIT and Optimizer Support</a>
-</div>
-
-<!-- *********************************************************************** -->
-<hr>
-<address>
-  <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
-  src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"></a>
-  <a href="http://validator.w3.org/check/referer"><img
-  src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"></a>
-
-  <a href="mailto:sabre at nondot.org">Chris Lattner</a><br>
-  <a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
-  Last modified: $Date$
-</address>
-</body>
-</html>
diff --git a/libclamav/c++/llvm/docs/tutorial/LangImpl4.html b/libclamav/c++/llvm/docs/tutorial/LangImpl4.html
deleted file mode 100644
index 70fd673..0000000
--- a/libclamav/c++/llvm/docs/tutorial/LangImpl4.html
+++ /dev/null
@@ -1,1132 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-                      "http://www.w3.org/TR/html4/strict.dtd">
-
-<html>
-<head>
-  <title>Kaleidoscope: Adding JIT and Optimizer Support</title>
-  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-  <meta name="author" content="Chris Lattner">
-  <link rel="stylesheet" href="../llvm.css" type="text/css">
-</head>
-
-<body>
-
-<div class="doc_title">Kaleidoscope: Adding JIT and Optimizer Support</div>
-
-<ul>
-<li><a href="index.html">Up to Tutorial Index</a></li>
-<li>Chapter 4
-  <ol>
-    <li><a href="#intro">Chapter 4 Introduction</a></li>
-    <li><a href="#trivialconstfold">Trivial Constant Folding</a></li>
-    <li><a href="#optimizerpasses">LLVM Optimization Passes</a></li>
-    <li><a href="#jit">Adding a JIT Compiler</a></li>
-    <li><a href="#code">Full Code Listing</a></li>
-  </ol>
-</li>
-<li><a href="LangImpl5.html">Chapter 5</a>: Extending the Language: Control 
-Flow</li>
-</ul>
-
-<div class="doc_author">
-  <p>Written by <a href="mailto:sabre at nondot.org">Chris Lattner</a></p>
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="intro">Chapter 4 Introduction</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>Welcome to Chapter 4 of the "<a href="index.html">Implementing a language
-with LLVM</a>" tutorial.  Chapters 1-3 described the implementation of a simple
-language and added support for generating LLVM IR.  This chapter describes
-two new techniques: adding optimizer support to your language, and adding JIT
-compiler support.  These additions will demonstrate how to get nice, efficient code 
-for the Kaleidoscope language.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="trivialconstfold">Trivial Constant
-Folding</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>
-Our demonstration for Chapter 3 is elegant and easy to extend.  Unfortunately,
-it does not produce wonderful code.  The IRBuilder, however, does give us
-obvious optimizations when compiling simple code:</p>
-
-<div class="doc_code">
-<pre>
-ready&gt; <b>def test(x) 1+2+x;</b>
-Read function definition:
-define double @test(double %x) {
-entry:
-        %addtmp = add double 3.000000e+00, %x
-        ret double %addtmp
-}
-</pre>
-</div>
-
-<p>This code is not a literal transcription of the AST built by parsing the 
-input. That would be:
-
-<div class="doc_code">
-<pre>
-ready&gt; <b>def test(x) 1+2+x;</b>
-Read function definition:
-define double @test(double %x) {
-entry:
-        %addtmp = add double 2.000000e+00, 1.000000e+00
-        %addtmp1 = add double %addtmp, %x
-        ret double %addtmp1
-}
-</pre>
-</div>
-
-<p>Constant folding, as seen above, in particular, is a very common and very
-important optimization: so much so that many language implementors implement
-constant folding support in their AST representation.</p>
-
-<p>With LLVM, you don't need this support in the AST.  Since all calls to build 
-LLVM IR go through the LLVM IR builder, the builder itself checked to see if 
-there was a constant folding opportunity when you call it.  If so, it just does 
-the constant fold and return the constant instead of creating an instruction.
-
-<p>Well, that was easy :).  In practice, we recommend always using
-<tt>IRBuilder</tt> when generating code like this.  It has no
-"syntactic overhead" for its use (you don't have to uglify your compiler with
-constant checks everywhere) and it can dramatically reduce the amount of
-LLVM IR that is generated in some cases (particular for languages with a macro
-preprocessor or that use a lot of constants).</p>
-
-<p>On the other hand, the <tt>IRBuilder</tt> is limited by the fact
-that it does all of its analysis inline with the code as it is built.  If you
-take a slightly more complex example:</p>
-
-<div class="doc_code">
-<pre>
-ready&gt; <b>def test(x) (1+2+x)*(x+(1+2));</b>
-ready> Read function definition:
-define double @test(double %x) {
-entry:
-        %addtmp = add double 3.000000e+00, %x
-        %addtmp1 = add double %x, 3.000000e+00
-        %multmp = mul double %addtmp, %addtmp1
-        ret double %multmp
-}
-</pre>
-</div>
-
-<p>In this case, the LHS and RHS of the multiplication are the same value.  We'd
-really like to see this generate "<tt>tmp = x+3; result = tmp*tmp;</tt>" instead
-of computing "<tt>x+3</tt>" twice.</p>
-
-<p>Unfortunately, no amount of local analysis will be able to detect and correct
-this.  This requires two transformations: reassociation of expressions (to 
-make the add's lexically identical) and Common Subexpression Elimination (CSE)
-to  delete the redundant add instruction.  Fortunately, LLVM provides a broad
-range of optimizations that you can use, in the form of "passes".</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="optimizerpasses">LLVM Optimization
- Passes</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>LLVM provides many optimization passes, which do many different sorts of
-things and have different tradeoffs.  Unlike other systems, LLVM doesn't hold
-to the mistaken notion that one set of optimizations is right for all languages
-and for all situations.  LLVM allows a compiler implementor to make complete
-decisions about what optimizations to use, in which order, and in what
-situation.</p>
-
-<p>As a concrete example, LLVM supports both "whole module" passes, which look
-across as large of body of code as they can (often a whole file, but if run 
-at link time, this can be a substantial portion of the whole program).  It also
-supports and includes "per-function" passes which just operate on a single
-function at a time, without looking at other functions.  For more information
-on passes and how they are run, see the <a href="../WritingAnLLVMPass.html">How
-to Write a Pass</a> document and the <a href="../Passes.html">List of LLVM 
-Passes</a>.</p>
-
-<p>For Kaleidoscope, we are currently generating functions on the fly, one at
-a time, as the user types them in.  We aren't shooting for the ultimate
-optimization experience in this setting, but we also want to catch the easy and
-quick stuff where possible.  As such, we will choose to run a few per-function
-optimizations as the user types the function in.  If we wanted to make a "static
-Kaleidoscope compiler", we would use exactly the code we have now, except that
-we would defer running the optimizer until the entire file has been parsed.</p>
-
-<p>In order to get per-function optimizations going, we need to set up a
-<a href="../WritingAnLLVMPass.html#passmanager">FunctionPassManager</a> to hold and
-organize the LLVM optimizations that we want to run.  Once we have that, we can
-add a set of optimizations to run.  The code looks like this:</p>
-
-<div class="doc_code">
-<pre>
-  FunctionPassManager OurFPM(TheModule);
-
-  // Set up the optimizer pipeline.  Start with registering info about how the
-  // target lays out data structures.
-  OurFPM.add(new TargetData(*TheExecutionEngine->getTargetData()));
-  // Do simple "peephole" optimizations and bit-twiddling optzns.
-  OurFPM.add(createInstructionCombiningPass());
-  // Reassociate expressions.
-  OurFPM.add(createReassociatePass());
-  // Eliminate Common SubExpressions.
-  OurFPM.add(createGVNPass());
-  // Simplify the control flow graph (deleting unreachable blocks, etc).
-  OurFPM.add(createCFGSimplificationPass());
-
-  OurFPM.doInitialization();
-
-  // Set the global so the code gen can use this.
-  TheFPM = &amp;OurFPM;
-
-  // Run the main "interpreter loop" now.
-  MainLoop();
-</pre>
-</div>
-
-<p>This code defines a <tt>FunctionPassManager</tt>, "<tt>OurFPM</tt>".  It
-requires a pointer to the <tt>Module</tt> to construct itself.  Once it is set
-up, we use a series of "add" calls to add a bunch of LLVM passes.  The first
-pass is basically boilerplate, it adds a pass so that later optimizations know
-how the data structures in the program are laid out.  The
-"<tt>TheExecutionEngine</tt>" variable is related to the JIT, which we will get
-to in the next section.</p>
-
-<p>In this case, we choose to add 4 optimization passes.  The passes we chose
-here are a pretty standard set of "cleanup" optimizations that are useful for
-a wide variety of code.  I won't delve into what they do but, believe me,
-they are a good starting place :).</p>
-
-<p>Once the PassManager is set up, we need to make use of it.  We do this by
-running it after our newly created function is constructed (in 
-<tt>FunctionAST::Codegen</tt>), but before it is returned to the client:</p>
-
-<div class="doc_code">
-<pre>
-  if (Value *RetVal = Body->Codegen()) {
-    // Finish off the function.
-    Builder.CreateRet(RetVal);
-
-    // Validate the generated code, checking for consistency.
-    verifyFunction(*TheFunction);
-
-    <b>// Optimize the function.
-    TheFPM-&gt;run(*TheFunction);</b>
-    
-    return TheFunction;
-  }
-</pre>
-</div>
-
-<p>As you can see, this is pretty straightforward.  The 
-<tt>FunctionPassManager</tt> optimizes and updates the LLVM Function* in place,
-improving (hopefully) its body.  With this in place, we can try our test above
-again:</p>
-
-<div class="doc_code">
-<pre>
-ready&gt; <b>def test(x) (1+2+x)*(x+(1+2));</b>
-ready> Read function definition:
-define double @test(double %x) {
-entry:
-        %addtmp = add double %x, 3.000000e+00
-        %multmp = mul double %addtmp, %addtmp
-        ret double %multmp
-}
-</pre>
-</div>
-
-<p>As expected, we now get our nicely optimized code, saving a floating point
-add instruction from every execution of this function.</p>
-
-<p>LLVM provides a wide variety of optimizations that can be used in certain
-circumstances.  Some <a href="../Passes.html">documentation about the various 
-passes</a> is available, but it isn't very complete.  Another good source of
-ideas can come from looking at the passes that <tt>llvm-gcc</tt> or
-<tt>llvm-ld</tt> run to get started.  The "<tt>opt</tt>" tool allows you to 
-experiment with passes from the command line, so you can see if they do
-anything.</p>
-
-<p>Now that we have reasonable code coming out of our front-end, lets talk about
-executing it!</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="jit">Adding a JIT Compiler</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>Code that is available in LLVM IR can have a wide variety of tools 
-applied to it.  For example, you can run optimizations on it (as we did above),
-you can dump it out in textual or binary forms, you can compile the code to an
-assembly file (.s) for some target, or you can JIT compile it.  The nice thing
-about the LLVM IR representation is that it is the "common currency" between
-many different parts of the compiler.
-</p>
-
-<p>In this section, we'll add JIT compiler support to our interpreter.  The
-basic idea that we want for Kaleidoscope is to have the user enter function
-bodies as they do now, but immediately evaluate the top-level expressions they
-type in.  For example, if they type in "1 + 2;", we should evaluate and print
-out 3.  If they define a function, they should be able to call it from the 
-command line.</p>
-
-<p>In order to do this, we first declare and initialize the JIT.  This is done
-by adding a global variable and a call in <tt>main</tt>:</p>
-
-<div class="doc_code">
-<pre>
-<b>static ExecutionEngine *TheExecutionEngine;</b>
-...
-int main() {
-  ..
-  <b>// Create the JIT.  This takes ownership of the module.
-  TheExecutionEngine = EngineBuilder(TheModule).create();</b>
-  ..
-}
-</pre>
-</div>
-
-<p>This creates an abstract "Execution Engine" which can be either a JIT
-compiler or the LLVM interpreter.  LLVM will automatically pick a JIT compiler
-for you if one is available for your platform, otherwise it will fall back to
-the interpreter.</p>
-
-<p>Once the <tt>ExecutionEngine</tt> is created, the JIT is ready to be used.
-There are a variety of APIs that are useful, but the simplest one is the
-"<tt>getPointerToFunction(F)</tt>" method.  This method JIT compiles the
-specified LLVM Function and returns a function pointer to the generated machine
-code.  In our case, this means that we can change the code that parses a
-top-level expression to look like this:</p>
-
-<div class="doc_code">
-<pre>
-static void HandleTopLevelExpression() {
-  // Evaluate a top-level expression into an anonymous function.
-  if (FunctionAST *F = ParseTopLevelExpr()) {
-    if (Function *LF = F-&gt;Codegen()) {
-      LF->dump();  // Dump the function for exposition purposes.
-    
-      <b>// JIT the function, returning a function pointer.
-      void *FPtr = TheExecutionEngine-&gt;getPointerToFunction(LF);
-      
-      // Cast it to the right type (takes no arguments, returns a double) so we
-      // can call it as a native function.
-      double (*FP)() = (double (*)())(intptr_t)FPtr;
-      fprintf(stderr, "Evaluated to %f\n", FP());</b>
-    }
-</pre>
-</div>
-
-<p>Recall that we compile top-level expressions into a self-contained LLVM
-function that takes no arguments and returns the computed double.  Because the 
-LLVM JIT compiler matches the native platform ABI, this means that you can just
-cast the result pointer to a function pointer of that type and call it directly.
-This means, there is no difference between JIT compiled code and native machine
-code that is statically linked into your application.</p>
-
-<p>With just these two changes, lets see how Kaleidoscope works now!</p>
-
-<div class="doc_code">
-<pre>
-ready&gt; <b>4+5;</b>
-define double @""() {
-entry:
-        ret double 9.000000e+00
-}
-
-<em>Evaluated to 9.000000</em>
-</pre>
-</div>
-
-<p>Well this looks like it is basically working.  The dump of the function
-shows the "no argument function that always returns double" that we synthesize
-for each top-level expression that is typed in.  This demonstrates very basic
-functionality, but can we do more?</p>
-
-<div class="doc_code">
-<pre>
-ready&gt; <b>def testfunc(x y) x + y*2; </b> 
-Read function definition:
-define double @testfunc(double %x, double %y) {
-entry:
-        %multmp = mul double %y, 2.000000e+00
-        %addtmp = add double %multmp, %x
-        ret double %addtmp
-}
-
-ready&gt; <b>testfunc(4, 10);</b>
-define double @""() {
-entry:
-        %calltmp = call double @testfunc( double 4.000000e+00, double 1.000000e+01 )
-        ret double %calltmp
-}
-
-<em>Evaluated to 24.000000</em>
-</pre>
-</div>
-
-<p>This illustrates that we can now call user code, but there is something a bit
-subtle going on here.  Note that we only invoke the JIT on the anonymous
-functions that <em>call testfunc</em>, but we never invoked it
-on <em>testfunc</em> itself.  What actually happened here is that the JIT
-scanned for all non-JIT'd functions transitively called from the anonymous
-function and compiled all of them before returning
-from <tt>getPointerToFunction()</tt>.</p>
-
-<p>The JIT provides a number of other more advanced interfaces for things like
-freeing allocated machine code, rejit'ing functions to update them, etc.
-However, even with this simple code, we get some surprisingly powerful
-capabilities - check this out (I removed the dump of the anonymous functions,
-you should get the idea by now :) :</p>
-
-<div class="doc_code">
-<pre>
-ready&gt; <b>extern sin(x);</b>
-Read extern: 
-declare double @sin(double)
-
-ready&gt; <b>extern cos(x);</b>
-Read extern: 
-declare double @cos(double)
-
-ready&gt; <b>sin(1.0);</b>
-<em>Evaluated to 0.841471</em>
-
-ready&gt; <b>def foo(x) sin(x)*sin(x) + cos(x)*cos(x);</b>
-Read function definition:
-define double @foo(double %x) {
-entry:
-        %calltmp = call double @sin( double %x )
-        %multmp = mul double %calltmp, %calltmp
-        %calltmp2 = call double @cos( double %x )
-        %multmp4 = mul double %calltmp2, %calltmp2
-        %addtmp = add double %multmp, %multmp4
-        ret double %addtmp
-}
-
-ready&gt; <b>foo(4.0);</b>
-<em>Evaluated to 1.000000</em>
-</pre>
-</div>
-
-<p>Whoa, how does the JIT know about sin and cos?  The answer is surprisingly
-simple: in this
-example, the JIT started execution of a function and got to a function call.  It
-realized that the function was not yet JIT compiled and invoked the standard set
-of routines to resolve the function.  In this case, there is no body defined
-for the function, so the JIT ended up calling "<tt>dlsym("sin")</tt>" on the
-Kaleidoscope process itself.
-Since "<tt>sin</tt>" is defined within the JIT's address space, it simply
-patches up calls in the module to call the libm version of <tt>sin</tt>
-directly.</p>
-
-<p>The LLVM JIT provides a number of interfaces (look in the 
-<tt>ExecutionEngine.h</tt> file) for controlling how unknown functions get
-resolved.  It allows you to establish explicit mappings between IR objects and
-addresses (useful for LLVM global variables that you want to map to static
-tables, for example), allows you to dynamically decide on the fly based on the
-function name, and even allows you to have the JIT compile functions lazily the
-first time they're called.</p>
-
-<p>One interesting application of this is that we can now extend the language
-by writing arbitrary C++ code to implement operations.  For example, if we add:
-</p>
-
-<div class="doc_code">
-<pre>
-/// putchard - putchar that takes a double and returns 0.
-extern "C" 
-double putchard(double X) {
-  putchar((char)X);
-  return 0;
-}
-</pre>
-</div>
-
-<p>Now we can produce simple output to the console by using things like:
-"<tt>extern putchard(x); putchard(120);</tt>", which prints a lowercase 'x' on
-the console (120 is the ASCII code for 'x').  Similar code could be used to 
-implement file I/O, console input, and many other capabilities in
-Kaleidoscope.</p>
-
-<p>This completes the JIT and optimizer chapter of the Kaleidoscope tutorial. At
-this point, we can compile a non-Turing-complete programming language, optimize
-and JIT compile it in a user-driven way.  Next up we'll look into <a 
-href="LangImpl5.html">extending the language with control flow constructs</a>,
-tackling some interesting LLVM IR issues along the way.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="code">Full Code Listing</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>
-Here is the complete code listing for our running example, enhanced with the
-LLVM JIT and optimizer.  To build this example, use:
-</p>
-
-<div class="doc_code">
-<pre>
-   # Compile
-   g++ -g toy.cpp `llvm-config --cppflags --ldflags --libs core jit native` -O3 -o toy
-   # Run
-   ./toy
-</pre>
-</div>
-
-<p>
-If you are compiling this on Linux, make sure to add the "-rdynamic" option 
-as well.  This makes sure that the external functions are resolved properly 
-at runtime.</p>
-
-<p>Here is the code:</p>
-
-<div class="doc_code">
-<pre>
-#include "llvm/DerivedTypes.h"
-#include "llvm/ExecutionEngine/ExecutionEngine.h"
-#include "llvm/ExecutionEngine/JIT.h"
-#include "llvm/LLVMContext.h"
-#include "llvm/Module.h"
-#include "llvm/PassManager.h"
-#include "llvm/Analysis/Verifier.h"
-#include "llvm/Target/TargetData.h"
-#include "llvm/Target/TargetSelect.h"
-#include "llvm/Transforms/Scalar.h"
-#include "llvm/Support/IRBuilder.h"
-#include &lt;cstdio&gt;
-#include &lt;string&gt;
-#include &lt;map&gt;
-#include &lt;vector&gt;
-using namespace llvm;
-
-//===----------------------------------------------------------------------===//
-// Lexer
-//===----------------------------------------------------------------------===//
-
-// The lexer returns tokens [0-255] if it is an unknown character, otherwise one
-// of these for known things.
-enum Token {
-  tok_eof = -1,
-
-  // commands
-  tok_def = -2, tok_extern = -3,
-
-  // primary
-  tok_identifier = -4, tok_number = -5
-};
-
-static std::string IdentifierStr;  // Filled in if tok_identifier
-static double NumVal;              // Filled in if tok_number
-
-/// gettok - Return the next token from standard input.
-static int gettok() {
-  static int LastChar = ' ';
-
-  // Skip any whitespace.
-  while (isspace(LastChar))
-    LastChar = getchar();
-
-  if (isalpha(LastChar)) { // identifier: [a-zA-Z][a-zA-Z0-9]*
-    IdentifierStr = LastChar;
-    while (isalnum((LastChar = getchar())))
-      IdentifierStr += LastChar;
-
-    if (IdentifierStr == "def") return tok_def;
-    if (IdentifierStr == "extern") return tok_extern;
-    return tok_identifier;
-  }
-
-  if (isdigit(LastChar) || LastChar == '.') {   // Number: [0-9.]+
-    std::string NumStr;
-    do {
-      NumStr += LastChar;
-      LastChar = getchar();
-    } while (isdigit(LastChar) || LastChar == '.');
-
-    NumVal = strtod(NumStr.c_str(), 0);
-    return tok_number;
-  }
-
-  if (LastChar == '#') {
-    // Comment until end of line.
-    do LastChar = getchar();
-    while (LastChar != EOF &amp;&amp; LastChar != '\n' &amp;&amp; LastChar != '\r');
-    
-    if (LastChar != EOF)
-      return gettok();
-  }
-  
-  // Check for end of file.  Don't eat the EOF.
-  if (LastChar == EOF)
-    return tok_eof;
-
-  // Otherwise, just return the character as its ascii value.
-  int ThisChar = LastChar;
-  LastChar = getchar();
-  return ThisChar;
-}
-
-//===----------------------------------------------------------------------===//
-// Abstract Syntax Tree (aka Parse Tree)
-//===----------------------------------------------------------------------===//
-
-/// ExprAST - Base class for all expression nodes.
-class ExprAST {
-public:
-  virtual ~ExprAST() {}
-  virtual Value *Codegen() = 0;
-};
-
-/// NumberExprAST - Expression class for numeric literals like "1.0".
-class NumberExprAST : public ExprAST {
-  double Val;
-public:
-  NumberExprAST(double val) : Val(val) {}
-  virtual Value *Codegen();
-};
-
-/// VariableExprAST - Expression class for referencing a variable, like "a".
-class VariableExprAST : public ExprAST {
-  std::string Name;
-public:
-  VariableExprAST(const std::string &amp;name) : Name(name) {}
-  virtual Value *Codegen();
-};
-
-/// BinaryExprAST - Expression class for a binary operator.
-class BinaryExprAST : public ExprAST {
-  char Op;
-  ExprAST *LHS, *RHS;
-public:
-  BinaryExprAST(char op, ExprAST *lhs, ExprAST *rhs) 
-    : Op(op), LHS(lhs), RHS(rhs) {}
-  virtual Value *Codegen();
-};
-
-/// CallExprAST - Expression class for function calls.
-class CallExprAST : public ExprAST {
-  std::string Callee;
-  std::vector&lt;ExprAST*&gt; Args;
-public:
-  CallExprAST(const std::string &amp;callee, std::vector&lt;ExprAST*&gt; &amp;args)
-    : Callee(callee), Args(args) {}
-  virtual Value *Codegen();
-};
-
-/// PrototypeAST - This class represents the "prototype" for a function,
-/// which captures its name, and its argument names (thus implicitly the number
-/// of arguments the function takes).
-class PrototypeAST {
-  std::string Name;
-  std::vector&lt;std::string&gt; Args;
-public:
-  PrototypeAST(const std::string &amp;name, const std::vector&lt;std::string&gt; &amp;args)
-    : Name(name), Args(args) {}
-  
-  Function *Codegen();
-};
-
-/// FunctionAST - This class represents a function definition itself.
-class FunctionAST {
-  PrototypeAST *Proto;
-  ExprAST *Body;
-public:
-  FunctionAST(PrototypeAST *proto, ExprAST *body)
-    : Proto(proto), Body(body) {}
-  
-  Function *Codegen();
-};
-
-//===----------------------------------------------------------------------===//
-// Parser
-//===----------------------------------------------------------------------===//
-
-/// CurTok/getNextToken - Provide a simple token buffer.  CurTok is the current
-/// token the parser is looking at.  getNextToken reads another token from the
-/// lexer and updates CurTok with its results.
-static int CurTok;
-static int getNextToken() {
-  return CurTok = gettok();
-}
-
-/// BinopPrecedence - This holds the precedence for each binary operator that is
-/// defined.
-static std::map&lt;char, int&gt; BinopPrecedence;
-
-/// GetTokPrecedence - Get the precedence of the pending binary operator token.
-static int GetTokPrecedence() {
-  if (!isascii(CurTok))
-    return -1;
-  
-  // Make sure it's a declared binop.
-  int TokPrec = BinopPrecedence[CurTok];
-  if (TokPrec &lt;= 0) return -1;
-  return TokPrec;
-}
-
-/// Error* - These are little helper functions for error handling.
-ExprAST *Error(const char *Str) { fprintf(stderr, "Error: %s\n", Str);return 0;}
-PrototypeAST *ErrorP(const char *Str) { Error(Str); return 0; }
-FunctionAST *ErrorF(const char *Str) { Error(Str); return 0; }
-
-static ExprAST *ParseExpression();
-
-/// identifierexpr
-///   ::= identifier
-///   ::= identifier '(' expression* ')'
-static ExprAST *ParseIdentifierExpr() {
-  std::string IdName = IdentifierStr;
-  
-  getNextToken();  // eat identifier.
-  
-  if (CurTok != '(') // Simple variable ref.
-    return new VariableExprAST(IdName);
-  
-  // Call.
-  getNextToken();  // eat (
-  std::vector&lt;ExprAST*&gt; Args;
-  if (CurTok != ')') {
-    while (1) {
-      ExprAST *Arg = ParseExpression();
-      if (!Arg) return 0;
-      Args.push_back(Arg);
-
-      if (CurTok == ')') break;
-
-      if (CurTok != ',')
-        return Error("Expected ')' or ',' in argument list");
-      getNextToken();
-    }
-  }
-
-  // Eat the ')'.
-  getNextToken();
-  
-  return new CallExprAST(IdName, Args);
-}
-
-/// numberexpr ::= number
-static ExprAST *ParseNumberExpr() {
-  ExprAST *Result = new NumberExprAST(NumVal);
-  getNextToken(); // consume the number
-  return Result;
-}
-
-/// parenexpr ::= '(' expression ')'
-static ExprAST *ParseParenExpr() {
-  getNextToken();  // eat (.
-  ExprAST *V = ParseExpression();
-  if (!V) return 0;
-  
-  if (CurTok != ')')
-    return Error("expected ')'");
-  getNextToken();  // eat ).
-  return V;
-}
-
-/// primary
-///   ::= identifierexpr
-///   ::= numberexpr
-///   ::= parenexpr
-static ExprAST *ParsePrimary() {
-  switch (CurTok) {
-  default: return Error("unknown token when expecting an expression");
-  case tok_identifier: return ParseIdentifierExpr();
-  case tok_number:     return ParseNumberExpr();
-  case '(':            return ParseParenExpr();
-  }
-}
-
-/// binoprhs
-///   ::= ('+' primary)*
-static ExprAST *ParseBinOpRHS(int ExprPrec, ExprAST *LHS) {
-  // If this is a binop, find its precedence.
-  while (1) {
-    int TokPrec = GetTokPrecedence();
-    
-    // If this is a binop that binds at least as tightly as the current binop,
-    // consume it, otherwise we are done.
-    if (TokPrec &lt; ExprPrec)
-      return LHS;
-    
-    // Okay, we know this is a binop.
-    int BinOp = CurTok;
-    getNextToken();  // eat binop
-    
-    // Parse the primary expression after the binary operator.
-    ExprAST *RHS = ParsePrimary();
-    if (!RHS) return 0;
-    
-    // If BinOp binds less tightly with RHS than the operator after RHS, let
-    // the pending operator take RHS as its LHS.
-    int NextPrec = GetTokPrecedence();
-    if (TokPrec &lt; NextPrec) {
-      RHS = ParseBinOpRHS(TokPrec+1, RHS);
-      if (RHS == 0) return 0;
-    }
-    
-    // Merge LHS/RHS.
-    LHS = new BinaryExprAST(BinOp, LHS, RHS);
-  }
-}
-
-/// expression
-///   ::= primary binoprhs
-///
-static ExprAST *ParseExpression() {
-  ExprAST *LHS = ParsePrimary();
-  if (!LHS) return 0;
-  
-  return ParseBinOpRHS(0, LHS);
-}
-
-/// prototype
-///   ::= id '(' id* ')'
-static PrototypeAST *ParsePrototype() {
-  if (CurTok != tok_identifier)
-    return ErrorP("Expected function name in prototype");
-
-  std::string FnName = IdentifierStr;
-  getNextToken();
-  
-  if (CurTok != '(')
-    return ErrorP("Expected '(' in prototype");
-  
-  std::vector&lt;std::string&gt; ArgNames;
-  while (getNextToken() == tok_identifier)
-    ArgNames.push_back(IdentifierStr);
-  if (CurTok != ')')
-    return ErrorP("Expected ')' in prototype");
-  
-  // success.
-  getNextToken();  // eat ')'.
-  
-  return new PrototypeAST(FnName, ArgNames);
-}
-
-/// definition ::= 'def' prototype expression
-static FunctionAST *ParseDefinition() {
-  getNextToken();  // eat def.
-  PrototypeAST *Proto = ParsePrototype();
-  if (Proto == 0) return 0;
-
-  if (ExprAST *E = ParseExpression())
-    return new FunctionAST(Proto, E);
-  return 0;
-}
-
-/// toplevelexpr ::= expression
-static FunctionAST *ParseTopLevelExpr() {
-  if (ExprAST *E = ParseExpression()) {
-    // Make an anonymous proto.
-    PrototypeAST *Proto = new PrototypeAST("", std::vector&lt;std::string&gt;());
-    return new FunctionAST(Proto, E);
-  }
-  return 0;
-}
-
-/// external ::= 'extern' prototype
-static PrototypeAST *ParseExtern() {
-  getNextToken();  // eat extern.
-  return ParsePrototype();
-}
-
-//===----------------------------------------------------------------------===//
-// Code Generation
-//===----------------------------------------------------------------------===//
-
-static Module *TheModule;
-static IRBuilder&lt;&gt; Builder(getGlobalContext());
-static std::map&lt;std::string, Value*&gt; NamedValues;
-static FunctionPassManager *TheFPM;
-
-Value *ErrorV(const char *Str) { Error(Str); return 0; }
-
-Value *NumberExprAST::Codegen() {
-  return ConstantFP::get(getGlobalContext(), APFloat(Val));
-}
-
-Value *VariableExprAST::Codegen() {
-  // Look this variable up in the function.
-  Value *V = NamedValues[Name];
-  return V ? V : ErrorV("Unknown variable name");
-}
-
-Value *BinaryExprAST::Codegen() {
-  Value *L = LHS-&gt;Codegen();
-  Value *R = RHS-&gt;Codegen();
-  if (L == 0 || R == 0) return 0;
-  
-  switch (Op) {
-  case '+': return Builder.CreateAdd(L, R, "addtmp");
-  case '-': return Builder.CreateSub(L, R, "subtmp");
-  case '*': return Builder.CreateMul(L, R, "multmp");
-  case '&lt;':
-    L = Builder.CreateFCmpULT(L, R, "cmptmp");
-    // Convert bool 0/1 to double 0.0 or 1.0
-    return Builder.CreateUIToFP(L, Type::getDoubleTy(getGlobalContext()),
-                                "booltmp");
-  default: return ErrorV("invalid binary operator");
-  }
-}
-
-Value *CallExprAST::Codegen() {
-  // Look up the name in the global module table.
-  Function *CalleeF = TheModule-&gt;getFunction(Callee);
-  if (CalleeF == 0)
-    return ErrorV("Unknown function referenced");
-  
-  // If argument mismatch error.
-  if (CalleeF-&gt;arg_size() != Args.size())
-    return ErrorV("Incorrect # arguments passed");
-
-  std::vector&lt;Value*&gt; ArgsV;
-  for (unsigned i = 0, e = Args.size(); i != e; ++i) {
-    ArgsV.push_back(Args[i]-&gt;Codegen());
-    if (ArgsV.back() == 0) return 0;
-  }
-  
-  return Builder.CreateCall(CalleeF, ArgsV.begin(), ArgsV.end(), "calltmp");
-}
-
-Function *PrototypeAST::Codegen() {
-  // Make the function type:  double(double,double) etc.
-  std::vector&lt;const Type*&gt; Doubles(Args.size(),
-                                   Type::getDoubleTy(getGlobalContext()));
-  FunctionType *FT = FunctionType::get(Type::getDoubleTy(getGlobalContext()),
-                                       Doubles, false);
-  
-  Function *F = Function::Create(FT, Function::ExternalLinkage, Name, TheModule);
-  
-  // If F conflicted, there was already something named 'Name'.  If it has a
-  // body, don't allow redefinition or reextern.
-  if (F-&gt;getName() != Name) {
-    // Delete the one we just made and get the existing one.
-    F-&gt;eraseFromParent();
-    F = TheModule-&gt;getFunction(Name);
-    
-    // If F already has a body, reject this.
-    if (!F-&gt;empty()) {
-      ErrorF("redefinition of function");
-      return 0;
-    }
-    
-    // If F took a different number of args, reject.
-    if (F-&gt;arg_size() != Args.size()) {
-      ErrorF("redefinition of function with different # args");
-      return 0;
-    }
-  }
-  
-  // Set names for all arguments.
-  unsigned Idx = 0;
-  for (Function::arg_iterator AI = F-&gt;arg_begin(); Idx != Args.size();
-       ++AI, ++Idx) {
-    AI-&gt;setName(Args[Idx]);
-    
-    // Add arguments to variable symbol table.
-    NamedValues[Args[Idx]] = AI;
-  }
-  
-  return F;
-}
-
-Function *FunctionAST::Codegen() {
-  NamedValues.clear();
-  
-  Function *TheFunction = Proto-&gt;Codegen();
-  if (TheFunction == 0)
-    return 0;
-  
-  // Create a new basic block to start insertion into.
-  BasicBlock *BB = BasicBlock::Create(getGlobalContext(), "entry", TheFunction);
-  Builder.SetInsertPoint(BB);
-  
-  if (Value *RetVal = Body-&gt;Codegen()) {
-    // Finish off the function.
-    Builder.CreateRet(RetVal);
-
-    // Validate the generated code, checking for consistency.
-    verifyFunction(*TheFunction);
-
-    // Optimize the function.
-    TheFPM-&gt;run(*TheFunction);
-    
-    return TheFunction;
-  }
-  
-  // Error reading body, remove function.
-  TheFunction-&gt;eraseFromParent();
-  return 0;
-}
-
-//===----------------------------------------------------------------------===//
-// Top-Level parsing and JIT Driver
-//===----------------------------------------------------------------------===//
-
-static ExecutionEngine *TheExecutionEngine;
-
-static void HandleDefinition() {
-  if (FunctionAST *F = ParseDefinition()) {
-    if (Function *LF = F-&gt;Codegen()) {
-      fprintf(stderr, "Read function definition:");
-      LF-&gt;dump();
-    }
-  } else {
-    // Skip token for error recovery.
-    getNextToken();
-  }
-}
-
-static void HandleExtern() {
-  if (PrototypeAST *P = ParseExtern()) {
-    if (Function *F = P-&gt;Codegen()) {
-      fprintf(stderr, "Read extern: ");
-      F-&gt;dump();
-    }
-  } else {
-    // Skip token for error recovery.
-    getNextToken();
-  }
-}
-
-static void HandleTopLevelExpression() {
-  // Evaluate a top-level expression into an anonymous function.
-  if (FunctionAST *F = ParseTopLevelExpr()) {
-    if (Function *LF = F-&gt;Codegen()) {
-      // JIT the function, returning a function pointer.
-      void *FPtr = TheExecutionEngine-&gt;getPointerToFunction(LF);
-      
-      // Cast it to the right type (takes no arguments, returns a double) so we
-      // can call it as a native function.
-      double (*FP)() = (double (*)())(intptr_t)FPtr;
-      fprintf(stderr, "Evaluated to %f\n", FP());
-    }
-  } else {
-    // Skip token for error recovery.
-    getNextToken();
-  }
-}
-
-/// top ::= definition | external | expression | ';'
-static void MainLoop() {
-  while (1) {
-    fprintf(stderr, "ready&gt; ");
-    switch (CurTok) {
-    case tok_eof:    return;
-    case ';':        getNextToken(); break;  // ignore top-level semicolons.
-    case tok_def:    HandleDefinition(); break;
-    case tok_extern: HandleExtern(); break;
-    default:         HandleTopLevelExpression(); break;
-    }
-  }
-}
-
-//===----------------------------------------------------------------------===//
-// "Library" functions that can be "extern'd" from user code.
-//===----------------------------------------------------------------------===//
-
-/// putchard - putchar that takes a double and returns 0.
-extern "C" 
-double putchard(double X) {
-  putchar((char)X);
-  return 0;
-}
-
-//===----------------------------------------------------------------------===//
-// Main driver code.
-//===----------------------------------------------------------------------===//
-
-int main() {
-  InitializeNativeTarget();
-  LLVMContext &amp;Context = getGlobalContext();
-
-  // Install standard binary operators.
-  // 1 is lowest precedence.
-  BinopPrecedence['&lt;'] = 10;
-  BinopPrecedence['+'] = 20;
-  BinopPrecedence['-'] = 20;
-  BinopPrecedence['*'] = 40;  // highest.
-
-  // Prime the first token.
-  fprintf(stderr, "ready&gt; ");
-  getNextToken();
-
-  // Make the module, which holds all the code.
-  TheModule = new Module("my cool jit", Context);
-
-  // Create the JIT.  This takes ownership of the module.
-  std::string ErrStr;
-  TheExecutionEngine = EngineBuilder(TheModule).setErrorStr(&ErrStr).create();
-  if (!TheExecutionEngine) {
-    fprintf(stderr, "Could not create ExecutionEngine: %s\n", ErrStr.c_str());
-    exit(1);
-  }
-
-  FunctionPassManager OurFPM(TheModule);
-
-  // Set up the optimizer pipeline.  Start with registering info about how the
-  // target lays out data structures.
-  OurFPM.add(new TargetData(*TheExecutionEngine-&gt;getTargetData()));
-  // Do simple "peephole" optimizations and bit-twiddling optzns.
-  OurFPM.add(createInstructionCombiningPass());
-  // Reassociate expressions.
-  OurFPM.add(createReassociatePass());
-  // Eliminate Common SubExpressions.
-  OurFPM.add(createGVNPass());
-  // Simplify the control flow graph (deleting unreachable blocks, etc).
-  OurFPM.add(createCFGSimplificationPass());
-
-  OurFPM.doInitialization();
-
-  // Set the global so the code gen can use this.
-  TheFPM = &amp;OurFPM;
-
-  // Run the main "interpreter loop" now.
-  MainLoop();
-
-  TheFPM = 0;
-
-  // Print out all of the generated code.
-  TheModule-&gt;dump();
-
-  return 0;
-}
-</pre>
-</div>
-
-<a href="LangImpl5.html">Next: Extending the language: control flow</a>
-</div>
-
-<!-- *********************************************************************** -->
-<hr>
-<address>
-  <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
-  src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"></a>
-  <a href="http://validator.w3.org/check/referer"><img
-  src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"></a>
-
-  <a href="mailto:sabre at nondot.org">Chris Lattner</a><br>
-  <a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
-  Last modified: $Date$
-</address>
-</body>
-</html>
diff --git a/libclamav/c++/llvm/docs/tutorial/LangImpl5-cfg.png b/libclamav/c++/llvm/docs/tutorial/LangImpl5-cfg.png
deleted file mode 100644
index cdba92f..0000000
Binary files a/libclamav/c++/llvm/docs/tutorial/LangImpl5-cfg.png and /dev/null differ
diff --git a/libclamav/c++/llvm/docs/tutorial/LangImpl5.html b/libclamav/c++/llvm/docs/tutorial/LangImpl5.html
deleted file mode 100644
index 2b0450f..0000000
--- a/libclamav/c++/llvm/docs/tutorial/LangImpl5.html
+++ /dev/null
@@ -1,1777 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-                      "http://www.w3.org/TR/html4/strict.dtd">
-
-<html>
-<head>
-  <title>Kaleidoscope: Extending the Language: Control Flow</title>
-  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-  <meta name="author" content="Chris Lattner">
-  <link rel="stylesheet" href="../llvm.css" type="text/css">
-</head>
-
-<body>
-
-<div class="doc_title">Kaleidoscope: Extending the Language: Control Flow</div>
-
-<ul>
-<li><a href="index.html">Up to Tutorial Index</a></li>
-<li>Chapter 5
-  <ol>
-    <li><a href="#intro">Chapter 5 Introduction</a></li>
-    <li><a href="#ifthen">If/Then/Else</a>
-    <ol>
-      <li><a href="#iflexer">Lexer Extensions</a></li>
-      <li><a href="#ifast">AST Extensions</a></li>
-      <li><a href="#ifparser">Parser Extensions</a></li>
-      <li><a href="#ifir">LLVM IR</a></li>
-      <li><a href="#ifcodegen">Code Generation</a></li>
-    </ol>
-    </li>
-    <li><a href="#for">'for' Loop Expression</a>
-    <ol>
-      <li><a href="#forlexer">Lexer Extensions</a></li>
-      <li><a href="#forast">AST Extensions</a></li>
-      <li><a href="#forparser">Parser Extensions</a></li>
-      <li><a href="#forir">LLVM IR</a></li>
-      <li><a href="#forcodegen">Code Generation</a></li>
-    </ol>
-    </li>
-    <li><a href="#code">Full Code Listing</a></li>
-  </ol>
-</li>
-<li><a href="LangImpl6.html">Chapter 6</a>: Extending the Language: 
-User-defined Operators</li>
-</ul>
-
-<div class="doc_author">
-  <p>Written by <a href="mailto:sabre at nondot.org">Chris Lattner</a></p>
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="intro">Chapter 5 Introduction</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>Welcome to Chapter 5 of the "<a href="index.html">Implementing a language
-with LLVM</a>" tutorial.  Parts 1-4 described the implementation of the simple
-Kaleidoscope language and included support for generating LLVM IR, followed by
-optimizations and a JIT compiler.  Unfortunately, as presented, Kaleidoscope is
-mostly useless: it has no control flow other than call and return.  This means
-that you can't have conditional branches in the code, significantly limiting its
-power.  In this episode of "build that compiler", we'll extend Kaleidoscope to
-have an if/then/else expression plus a simple 'for' loop.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="ifthen">If/Then/Else</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>
-Extending Kaleidoscope to support if/then/else is quite straightforward.  It
-basically requires adding lexer support for this "new" concept to the lexer,
-parser, AST, and LLVM code emitter.  This example is nice, because it shows how
-easy it is to "grow" a language over time, incrementally extending it as new
-ideas are discovered.</p>
-
-<p>Before we get going on "how" we add this extension, lets talk about "what" we
-want.  The basic idea is that we want to be able to write this sort of thing:
-</p>
-
-<div class="doc_code">
-<pre>
-def fib(x)
-  if x &lt; 3 then
-    1
-  else
-    fib(x-1)+fib(x-2);
-</pre>
-</div>
-
-<p>In Kaleidoscope, every construct is an expression: there are no statements.
-As such, the if/then/else expression needs to return a value like any other.
-Since we're using a mostly functional form, we'll have it evaluate its
-conditional, then return the 'then' or 'else' value based on how the condition
-was resolved.  This is very similar to the C "?:" expression.</p>
-
-<p>The semantics of the if/then/else expression is that it evaluates the
-condition to a boolean equality value: 0.0 is considered to be false and
-everything else is considered to be true.
-If the condition is true, the first subexpression is evaluated and returned, if
-the condition is false, the second subexpression is evaluated and returned.
-Since Kaleidoscope allows side-effects, this behavior is important to nail down.
-</p>
-
-<p>Now that we know what we "want", lets break this down into its constituent
-pieces.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection"><a name="iflexer">Lexer Extensions for
-If/Then/Else</a></div>
-<!-- ======================================================================= -->
-
-
-<div class="doc_text">
-
-<p>The lexer extensions are straightforward.  First we add new enum values
-for the relevant tokens:</p>
-
-<div class="doc_code">
-<pre>
-  // control
-  tok_if = -6, tok_then = -7, tok_else = -8,
-</pre>
-</div>
-
-<p>Once we have that, we recognize the new keywords in the lexer. This is pretty simple
-stuff:</p>
-
-<div class="doc_code">
-<pre>
-    ...
-    if (IdentifierStr == "def") return tok_def;
-    if (IdentifierStr == "extern") return tok_extern;
-    <b>if (IdentifierStr == "if") return tok_if;
-    if (IdentifierStr == "then") return tok_then;
-    if (IdentifierStr == "else") return tok_else;</b>
-    return tok_identifier;
-</pre>
-</div>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection"><a name="ifast">AST Extensions for
- If/Then/Else</a></div>
-<!-- ======================================================================= -->
-
-<div class="doc_text">
-
-<p>To represent the new expression we add a new AST node for it:</p>
-
-<div class="doc_code">
-<pre>
-/// IfExprAST - Expression class for if/then/else.
-class IfExprAST : public ExprAST {
-  ExprAST *Cond, *Then, *Else;
-public:
-  IfExprAST(ExprAST *cond, ExprAST *then, ExprAST *_else)
-    : Cond(cond), Then(then), Else(_else) {}
-  virtual Value *Codegen();
-};
-</pre>
-</div>
-
-<p>The AST node just has pointers to the various subexpressions.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection"><a name="ifparser">Parser Extensions for
-If/Then/Else</a></div>
-<!-- ======================================================================= -->
-
-<div class="doc_text">
-
-<p>Now that we have the relevant tokens coming from the lexer and we have the
-AST node to build, our parsing logic is relatively straightforward.  First we
-define a new parsing function:</p>
-
-<div class="doc_code">
-<pre>
-/// ifexpr ::= 'if' expression 'then' expression 'else' expression
-static ExprAST *ParseIfExpr() {
-  getNextToken();  // eat the if.
-  
-  // condition.
-  ExprAST *Cond = ParseExpression();
-  if (!Cond) return 0;
-  
-  if (CurTok != tok_then)
-    return Error("expected then");
-  getNextToken();  // eat the then
-  
-  ExprAST *Then = ParseExpression();
-  if (Then == 0) return 0;
-  
-  if (CurTok != tok_else)
-    return Error("expected else");
-  
-  getNextToken();
-  
-  ExprAST *Else = ParseExpression();
-  if (!Else) return 0;
-  
-  return new IfExprAST(Cond, Then, Else);
-}
-</pre>
-</div>
-
-<p>Next we hook it up as a primary expression:</p>
-
-<div class="doc_code">
-<pre>
-static ExprAST *ParsePrimary() {
-  switch (CurTok) {
-  default: return Error("unknown token when expecting an expression");
-  case tok_identifier: return ParseIdentifierExpr();
-  case tok_number:     return ParseNumberExpr();
-  case '(':            return ParseParenExpr();
-  <b>case tok_if:         return ParseIfExpr();</b>
-  }
-}
-</pre>
-</div>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection"><a name="ifir">LLVM IR for If/Then/Else</a></div>
-<!-- ======================================================================= -->
-
-<div class="doc_text">
-
-<p>Now that we have it parsing and building the AST, the final piece is adding
-LLVM code generation support.  This is the most interesting part of the
-if/then/else example, because this is where it starts to introduce new concepts.
-All of the code above has been thoroughly described in previous chapters.
-</p>
-
-<p>To motivate the code we want to produce, lets take a look at a simple
-example.  Consider:</p>
-
-<div class="doc_code">
-<pre>
-extern foo();
-extern bar();
-def baz(x) if x then foo() else bar();
-</pre>
-</div>
-
-<p>If you disable optimizations, the code you'll (soon) get from Kaleidoscope
-looks like this:</p>
-
-<div class="doc_code">
-<pre>
-declare double @foo()
-
-declare double @bar()
-
-define double @baz(double %x) {
-entry:
-	%ifcond = fcmp one double %x, 0.000000e+00
-	br i1 %ifcond, label %then, label %else
-
-then:		; preds = %entry
-	%calltmp = call double @foo()
-	br label %ifcont
-
-else:		; preds = %entry
-	%calltmp1 = call double @bar()
-	br label %ifcont
-
-ifcont:		; preds = %else, %then
-	%iftmp = phi double [ %calltmp, %then ], [ %calltmp1, %else ]
-	ret double %iftmp
-}
-</pre>
-</div>
-
-<p>To visualize the control flow graph, you can use a nifty feature of the LLVM
-'<a href="http://llvm.org/cmds/opt.html">opt</a>' tool.  If you put this LLVM IR
-into "t.ll" and run "<tt>llvm-as &lt; t.ll | opt -analyze -view-cfg</tt>", <a
-href="../ProgrammersManual.html#ViewGraph">a window will pop up</a> and you'll
-see this graph:</p>
-
-<div style="text-align: center"><img src="LangImpl5-cfg.png" alt="Example CFG" width="423" 
-height="315"></div>
-
-<p>Another way to get this is to call "<tt>F-&gt;viewCFG()</tt>" or
-"<tt>F-&gt;viewCFGOnly()</tt>" (where F is a "<tt>Function*</tt>") either by
-inserting actual calls into the code and recompiling or by calling these in the
-debugger.  LLVM has many nice features for visualizing various graphs.</p>
-
-<p>Getting back to the generated code, it is fairly simple: the entry block 
-evaluates the conditional expression ("x" in our case here) and compares the
-result to 0.0 with the "<tt><a href="../LangRef.html#i_fcmp">fcmp</a> one</tt>"
-instruction ('one' is "Ordered and Not Equal").  Based on the result of this
-expression, the code jumps to either the "then" or "else" blocks, which contain
-the expressions for the true/false cases.</p>
-
-<p>Once the then/else blocks are finished executing, they both branch back to the
-'ifcont' block to execute the code that happens after the if/then/else.  In this
-case the only thing left to do is to return to the caller of the function.  The
-question then becomes: how does the code know which expression to return?</p>
-
-<p>The answer to this question involves an important SSA operation: the
-<a href="http://en.wikipedia.org/wiki/Static_single_assignment_form">Phi
-operation</a>.  If you're not familiar with SSA, <a 
-href="http://en.wikipedia.org/wiki/Static_single_assignment_form">the wikipedia
-article</a> is a good introduction and there are various other introductions to
-it available on your favorite search engine.  The short version is that
-"execution" of the Phi operation requires "remembering" which block control came
-from.  The Phi operation takes on the value corresponding to the input control
-block.  In this case, if control comes in from the "then" block, it gets the
-value of "calltmp".  If control comes from the "else" block, it gets the value
-of "calltmp1".</p>
-
-<p>At this point, you are probably starting to think "Oh no! This means my
-simple and elegant front-end will have to start generating SSA form in order to
-use LLVM!".  Fortunately, this is not the case, and we strongly advise
-<em>not</em> implementing an SSA construction algorithm in your front-end
-unless there is an amazingly good reason to do so.  In practice, there are two
-sorts of values that float around in code written for your average imperative
-programming language that might need Phi nodes:</p>
-
-<ol>
-<li>Code that involves user variables: <tt>x = 1; x = x + 1; </tt></li>
-<li>Values that are implicit in the structure of your AST, such as the Phi node
-in this case.</li>
-</ol>
-
-<p>In <a href="LangImpl7.html">Chapter 7</a> of this tutorial ("mutable 
-variables"), we'll talk about #1
-in depth.  For now, just believe me that you don't need SSA construction to
-handle this case.  For #2, you have the choice of using the techniques that we will 
-describe for #1, or you can insert Phi nodes directly, if convenient.  In this 
-case, it is really really easy to generate the Phi node, so we choose to do it
-directly.</p>
-
-<p>Okay, enough of the motivation and overview, lets generate code!</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection"><a name="ifcodegen">Code Generation for 
-If/Then/Else</a></div>
-<!-- ======================================================================= -->
-
-<div class="doc_text">
-
-<p>In order to generate code for this, we implement the <tt>Codegen</tt> method
-for <tt>IfExprAST</tt>:</p>
-
-<div class="doc_code">
-<pre>
-Value *IfExprAST::Codegen() {
-  Value *CondV = Cond-&gt;Codegen();
-  if (CondV == 0) return 0;
-  
-  // Convert condition to a bool by comparing equal to 0.0.
-  CondV = Builder.CreateFCmpONE(CondV, 
-                              ConstantFP::get(getGlobalContext(), APFloat(0.0)),
-                                "ifcond");
-</pre>
-</div>
-
-<p>This code is straightforward and similar to what we saw before.  We emit the
-expression for the condition, then compare that value to zero to get a truth
-value as a 1-bit (bool) value.</p>
-
-<div class="doc_code">
-<pre>
-  Function *TheFunction = Builder.GetInsertBlock()-&gt;getParent();
-  
-  // Create blocks for the then and else cases.  Insert the 'then' block at the
-  // end of the function.
-  BasicBlock *ThenBB = BasicBlock::Create(getGlobalContext(), "then", TheFunction);
-  BasicBlock *ElseBB = BasicBlock::Create(getGlobalContext(), "else");
-  BasicBlock *MergeBB = BasicBlock::Create(getGlobalContext(), "ifcont");
-
-  Builder.CreateCondBr(CondV, ThenBB, ElseBB);
-</pre>
-</div>
-
-<p>This code creates the basic blocks that are related to the if/then/else
-statement, and correspond directly to the blocks in the example above.  The
-first line gets the current Function object that is being built.  It
-gets this by asking the builder for the current BasicBlock, and asking that
-block for its "parent" (the function it is currently embedded into).</p>
-
-<p>Once it has that, it creates three blocks.  Note that it passes "TheFunction"
-into the constructor for the "then" block.  This causes the constructor to
-automatically insert the new block into the end of the specified function.  The
-other two blocks are created, but aren't yet inserted into the function.</p>
-
-<p>Once the blocks are created, we can emit the conditional branch that chooses
-between them.  Note that creating new blocks does not implicitly affect the
-IRBuilder, so it is still inserting into the block that the condition
-went into.  Also note that it is creating a branch to the "then" block and the
-"else" block, even though the "else" block isn't inserted into the function yet.
-This is all ok: it is the standard way that LLVM supports forward 
-references.</p>
-
-<div class="doc_code">
-<pre>
-  // Emit then value.
-  Builder.SetInsertPoint(ThenBB);
-  
-  Value *ThenV = Then-&gt;Codegen();
-  if (ThenV == 0) return 0;
-  
-  Builder.CreateBr(MergeBB);
-  // Codegen of 'Then' can change the current block, update ThenBB for the PHI.
-  ThenBB = Builder.GetInsertBlock();
-</pre>
-</div>
-
-<p>After the conditional branch is inserted, we move the builder to start
-inserting into the "then" block.  Strictly speaking, this call moves the
-insertion point to be at the end of the specified block.  However, since the
-"then" block is empty, it also starts out by inserting at the beginning of the
-block.  :)</p>
-
-<p>Once the insertion point is set, we recursively codegen the "then" expression
-from the AST.  To finish off the "then" block, we create an unconditional branch
-to the merge block.  One interesting (and very important) aspect of the LLVM IR
-is that it <a href="../LangRef.html#functionstructure">requires all basic blocks
-to be "terminated"</a> with a <a href="../LangRef.html#terminators">control flow
-instruction</a> such as return or branch.  This means that all control flow,
-<em>including fall throughs</em> must be made explicit in the LLVM IR.  If you
-violate this rule, the verifier will emit an error.</p>
-
-<p>The final line here is quite subtle, but is very important.  The basic issue
-is that when we create the Phi node in the merge block, we need to set up the
-block/value pairs that indicate how the Phi will work.  Importantly, the Phi
-node expects to have an entry for each predecessor of the block in the CFG.  Why
-then, are we getting the current block when we just set it to ThenBB 5 lines
-above?  The problem is that the "Then" expression may actually itself change the
-block that the Builder is emitting into if, for example, it contains a nested
-"if/then/else" expression.  Because calling Codegen recursively could
-arbitrarily change the notion of the current block, we are required to get an
-up-to-date value for code that will set up the Phi node.</p>
-
-<div class="doc_code">
-<pre>
-  // Emit else block.
-  TheFunction-&gt;getBasicBlockList().push_back(ElseBB);
-  Builder.SetInsertPoint(ElseBB);
-  
-  Value *ElseV = Else-&gt;Codegen();
-  if (ElseV == 0) return 0;
-  
-  Builder.CreateBr(MergeBB);
-  // Codegen of 'Else' can change the current block, update ElseBB for the PHI.
-  ElseBB = Builder.GetInsertBlock();
-</pre>
-</div>
-
-<p>Code generation for the 'else' block is basically identical to codegen for
-the 'then' block.  The only significant difference is the first line, which adds
-the 'else' block to the function.  Recall previously that the 'else' block was
-created, but not added to the function.  Now that the 'then' and 'else' blocks
-are emitted, we can finish up with the merge code:</p>
-
-<div class="doc_code">
-<pre>
-  // Emit merge block.
-  TheFunction->getBasicBlockList().push_back(MergeBB);
-  Builder.SetInsertPoint(MergeBB);
-  PHINode *PN = Builder.CreatePHI(Type::getDoubleTy(getGlobalContext()),
-                                  "iftmp");
-  
-  PN->addIncoming(ThenV, ThenBB);
-  PN->addIncoming(ElseV, ElseBB);
-  return PN;
-}
-</pre>
-</div>
-
-<p>The first two lines here are now familiar: the first adds the "merge" block
-to the Function object (it was previously floating, like the else block above).
-The second block changes the insertion point so that newly created code will go
-into the "merge" block.  Once that is done, we need to create the PHI node and
-set up the block/value pairs for the PHI.</p>
-
-<p>Finally, the CodeGen function returns the phi node as the value computed by
-the if/then/else expression.  In our example above, this returned value will 
-feed into the code for the top-level function, which will create the return
-instruction.</p>
-
-<p>Overall, we now have the ability to execute conditional code in
-Kaleidoscope.  With this extension, Kaleidoscope is a fairly complete language
-that can calculate a wide variety of numeric functions.  Next up we'll add
-another useful expression that is familiar from non-functional languages...</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="for">'for' Loop Expression</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>Now that we know how to add basic control flow constructs to the language,
-we have the tools to add more powerful things.  Lets add something more
-aggressive, a 'for' expression:</p>
-
-<div class="doc_code">
-<pre>
- extern putchard(char)
- def printstar(n)
-   for i = 1, i &lt; n, 1.0 in
-     putchard(42);  # ascii 42 = '*'
-     
- # print 100 '*' characters
- printstar(100);
-</pre>
-</div>
-
-<p>This expression defines a new variable ("i" in this case) which iterates from
-a starting value, while the condition ("i &lt; n" in this case) is true, 
-incrementing by an optional step value ("1.0" in this case).  If the step value
-is omitted, it defaults to 1.0.  While the loop is true, it executes its 
-body expression.  Because we don't have anything better to return, we'll just
-define the loop as always returning 0.0.  In the future when we have mutable
-variables, it will get more useful.</p>
-
-<p>As before, lets talk about the changes that we need to Kaleidoscope to
-support this.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection"><a name="forlexer">Lexer Extensions for
-the 'for' Loop</a></div>
-<!-- ======================================================================= -->
-
-<div class="doc_text">
-
-<p>The lexer extensions are the same sort of thing as for if/then/else:</p>
-
-<div class="doc_code">
-<pre>
-  ... in enum Token ...
-  // control
-  tok_if = -6, tok_then = -7, tok_else = -8,
-<b>  tok_for = -9, tok_in = -10</b>
-
-  ... in gettok ...
-  if (IdentifierStr == "def") return tok_def;
-  if (IdentifierStr == "extern") return tok_extern;
-  if (IdentifierStr == "if") return tok_if;
-  if (IdentifierStr == "then") return tok_then;
-  if (IdentifierStr == "else") return tok_else;
-  <b>if (IdentifierStr == "for") return tok_for;
-  if (IdentifierStr == "in") return tok_in;</b>
-  return tok_identifier;
-</pre>
-</div>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection"><a name="forast">AST Extensions for
-the 'for' Loop</a></div>
-<!-- ======================================================================= -->
-
-<div class="doc_text">
-
-<p>The AST node is just as simple.  It basically boils down to capturing
-the variable name and the constituent expressions in the node.</p>
-
-<div class="doc_code">
-<pre>
-/// ForExprAST - Expression class for for/in.
-class ForExprAST : public ExprAST {
-  std::string VarName;
-  ExprAST *Start, *End, *Step, *Body;
-public:
-  ForExprAST(const std::string &amp;varname, ExprAST *start, ExprAST *end,
-             ExprAST *step, ExprAST *body)
-    : VarName(varname), Start(start), End(end), Step(step), Body(body) {}
-  virtual Value *Codegen();
-};
-</pre>
-</div>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection"><a name="forparser">Parser Extensions for
-the 'for' Loop</a></div>
-<!-- ======================================================================= -->
-
-<div class="doc_text">
-
-<p>The parser code is also fairly standard.  The only interesting thing here is
-handling of the optional step value.  The parser code handles it by checking to
-see if the second comma is present.  If not, it sets the step value to null in
-the AST node:</p>
-
-<div class="doc_code">
-<pre>
-/// forexpr ::= 'for' identifier '=' expr ',' expr (',' expr)? 'in' expression
-static ExprAST *ParseForExpr() {
-  getNextToken();  // eat the for.
-
-  if (CurTok != tok_identifier)
-    return Error("expected identifier after for");
-  
-  std::string IdName = IdentifierStr;
-  getNextToken();  // eat identifier.
-  
-  if (CurTok != '=')
-    return Error("expected '=' after for");
-  getNextToken();  // eat '='.
-  
-  
-  ExprAST *Start = ParseExpression();
-  if (Start == 0) return 0;
-  if (CurTok != ',')
-    return Error("expected ',' after for start value");
-  getNextToken();
-  
-  ExprAST *End = ParseExpression();
-  if (End == 0) return 0;
-  
-  // The step value is optional.
-  ExprAST *Step = 0;
-  if (CurTok == ',') {
-    getNextToken();
-    Step = ParseExpression();
-    if (Step == 0) return 0;
-  }
-  
-  if (CurTok != tok_in)
-    return Error("expected 'in' after for");
-  getNextToken();  // eat 'in'.
-  
-  ExprAST *Body = ParseExpression();
-  if (Body == 0) return 0;
-
-  return new ForExprAST(IdName, Start, End, Step, Body);
-}
-</pre>
-</div>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection"><a name="forir">LLVM IR for 
-the 'for' Loop</a></div>
-<!-- ======================================================================= -->
-
-<div class="doc_text">
-
-<p>Now we get to the good part: the LLVM IR we want to generate for this thing.
-With the simple example above, we get this LLVM IR (note that this dump is
-generated with optimizations disabled for clarity):
-</p>
-
-<div class="doc_code">
-<pre>
-declare double @putchard(double)
-
-define double @printstar(double %n) {
-entry:
-        ; initial value = 1.0 (inlined into phi)
-	br label %loop
-
-loop:		; preds = %loop, %entry
-	%i = phi double [ 1.000000e+00, %entry ], [ %nextvar, %loop ]
-        ; body
-	%calltmp = call double @putchard( double 4.200000e+01 )
-        ; increment
-	%nextvar = add double %i, 1.000000e+00
-
-        ; termination test
-	%cmptmp = fcmp ult double %i, %n
-	%booltmp = uitofp i1 %cmptmp to double
-	%loopcond = fcmp one double %booltmp, 0.000000e+00
-	br i1 %loopcond, label %loop, label %afterloop
-
-afterloop:		; preds = %loop
-        ; loop always returns 0.0
-	ret double 0.000000e+00
-}
-</pre>
-</div>
-
-<p>This loop contains all the same constructs we saw before: a phi node, several
-expressions, and some basic blocks.  Lets see how this fits together.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection"><a name="forcodegen">Code Generation for 
-the 'for' Loop</a></div>
-<!-- ======================================================================= -->
-
-<div class="doc_text">
-
-<p>The first part of Codegen is very simple: we just output the start expression
-for the loop value:</p>
-
-<div class="doc_code">
-<pre>
-Value *ForExprAST::Codegen() {
-  // Emit the start code first, without 'variable' in scope.
-  Value *StartVal = Start-&gt;Codegen();
-  if (StartVal == 0) return 0;
-</pre>
-</div>
-
-<p>With this out of the way, the next step is to set up the LLVM basic block
-for the start of the loop body.  In the case above, the whole loop body is one
-block, but remember that the body code itself could consist of multiple blocks
-(e.g. if it contains an if/then/else or a for/in expression).</p>
-
-<div class="doc_code">
-<pre>
-  // Make the new basic block for the loop header, inserting after current
-  // block.
-  Function *TheFunction = Builder.GetInsertBlock()-&gt;getParent();
-  BasicBlock *PreheaderBB = Builder.GetInsertBlock();
-  BasicBlock *LoopBB = BasicBlock::Create(getGlobalContext(), "loop", TheFunction);
-  
-  // Insert an explicit fall through from the current block to the LoopBB.
-  Builder.CreateBr(LoopBB);
-</pre>
-</div>
-
-<p>This code is similar to what we saw for if/then/else.  Because we will need
-it to create the Phi node, we remember the block that falls through into the
-loop.  Once we have that, we create the actual block that starts the loop and
-create an unconditional branch for the fall-through between the two blocks.</p>
-  
-<div class="doc_code">
-<pre>
-  // Start insertion in LoopBB.
-  Builder.SetInsertPoint(LoopBB);
-  
-  // Start the PHI node with an entry for Start.
-  PHINode *Variable = Builder.CreatePHI(Type::getDoubleTy(getGlobalContext()), VarName.c_str());
-  Variable-&gt;addIncoming(StartVal, PreheaderBB);
-</pre>
-</div>
-
-<p>Now that the "preheader" for the loop is set up, we switch to emitting code
-for the loop body.  To begin with, we move the insertion point and create the
-PHI node for the loop induction variable.  Since we already know the incoming
-value for the starting value, we add it to the Phi node.  Note that the Phi will
-eventually get a second value for the backedge, but we can't set it up yet
-(because it doesn't exist!).</p>
-
-<div class="doc_code">
-<pre>
-  // Within the loop, the variable is defined equal to the PHI node.  If it
-  // shadows an existing variable, we have to restore it, so save it now.
-  Value *OldVal = NamedValues[VarName];
-  NamedValues[VarName] = Variable;
-  
-  // Emit the body of the loop.  This, like any other expr, can change the
-  // current BB.  Note that we ignore the value computed by the body, but don't
-  // allow an error.
-  if (Body-&gt;Codegen() == 0)
-    return 0;
-</pre>
-</div>
-
-<p>Now the code starts to get more interesting.  Our 'for' loop introduces a new
-variable to the symbol table.  This means that our symbol table can now contain
-either function arguments or loop variables.  To handle this, before we codegen
-the body of the loop, we add the loop variable as the current value for its
-name.  Note that it is possible that there is a variable of the same name in the
-outer scope.  It would be easy to make this an error (emit an error and return
-null if there is already an entry for VarName) but we choose to allow shadowing
-of variables.  In order to handle this correctly, we remember the Value that
-we are potentially shadowing in <tt>OldVal</tt> (which will be null if there is
-no shadowed variable).</p>
-
-<p>Once the loop variable is set into the symbol table, the code recursively
-codegen's the body.  This allows the body to use the loop variable: any
-references to it will naturally find it in the symbol table.</p>
-
-<div class="doc_code">
-<pre>
-  // Emit the step value.
-  Value *StepVal;
-  if (Step) {
-    StepVal = Step-&gt;Codegen();
-    if (StepVal == 0) return 0;
-  } else {
-    // If not specified, use 1.0.
-    StepVal = ConstantFP::get(getGlobalContext(), APFloat(1.0));
-  }
-  
-  Value *NextVar = Builder.CreateAdd(Variable, StepVal, "nextvar");
-</pre>
-</div>
-
-<p>Now that the body is emitted, we compute the next value of the iteration
-variable by adding the step value, or 1.0 if it isn't present. '<tt>NextVar</tt>'
-will be the value of the loop variable on the next iteration of the loop.</p>
-
-<div class="doc_code">
-<pre>
-  // Compute the end condition.
-  Value *EndCond = End-&gt;Codegen();
-  if (EndCond == 0) return EndCond;
-  
-  // Convert condition to a bool by comparing equal to 0.0.
-  EndCond = Builder.CreateFCmpONE(EndCond, 
-                              ConstantFP::get(getGlobalContext(), APFloat(0.0)),
-                                  "loopcond");
-</pre>
-</div>
-
-<p>Finally, we evaluate the exit value of the loop, to determine whether the
-loop should exit.  This mirrors the condition evaluation for the if/then/else
-statement.</p>
-      
-<div class="doc_code">
-<pre>
-  // Create the "after loop" block and insert it.
-  BasicBlock *LoopEndBB = Builder.GetInsertBlock();
-  BasicBlock *AfterBB = BasicBlock::Create(getGlobalContext(), "afterloop", TheFunction);
-  
-  // Insert the conditional branch into the end of LoopEndBB.
-  Builder.CreateCondBr(EndCond, LoopBB, AfterBB);
-  
-  // Any new code will be inserted in AfterBB.
-  Builder.SetInsertPoint(AfterBB);
-</pre>
-</div>
-
-<p>With the code for the body of the loop complete, we just need to finish up
-the control flow for it.  This code remembers the end block (for the phi node), then creates the block for the loop exit ("afterloop").  Based on the value of the
-exit condition, it creates a conditional branch that chooses between executing
-the loop again and exiting the loop.  Any future code is emitted in the
-"afterloop" block, so it sets the insertion position to it.</p>
-  
-<div class="doc_code">
-<pre>
-  // Add a new entry to the PHI node for the backedge.
-  Variable-&gt;addIncoming(NextVar, LoopEndBB);
-  
-  // Restore the unshadowed variable.
-  if (OldVal)
-    NamedValues[VarName] = OldVal;
-  else
-    NamedValues.erase(VarName);
-  
-  // for expr always returns 0.0.
-  return Constant::getNullValue(Type::getDoubleTy(getGlobalContext()));
-}
-</pre>
-</div>
-
-<p>The final code handles various cleanups: now that we have the "NextVar"
-value, we can add the incoming value to the loop PHI node.  After that, we
-remove the loop variable from the symbol table, so that it isn't in scope after
-the for loop.  Finally, code generation of the for loop always returns 0.0, so
-that is what we return from <tt>ForExprAST::Codegen</tt>.</p>
-
-<p>With this, we conclude the "adding control flow to Kaleidoscope" chapter of
-the tutorial.  In this chapter we added two control flow constructs, and used them to motivate a couple of aspects of the LLVM IR that are important for front-end implementors
-to know.  In the next chapter of our saga, we will get a bit crazier and add
-<a href="LangImpl6.html">user-defined operators</a> to our poor innocent 
-language.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="code">Full Code Listing</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>
-Here is the complete code listing for our running example, enhanced with the
-if/then/else and for expressions..  To build this example, use:
-</p>
-
-<div class="doc_code">
-<pre>
-   # Compile
-   g++ -g toy.cpp `llvm-config --cppflags --ldflags --libs core jit native` -O3 -o toy
-   # Run
-   ./toy
-</pre>
-</div>
-
-<p>Here is the code:</p>
-
-<div class="doc_code">
-<pre>
-#include "llvm/DerivedTypes.h"
-#include "llvm/ExecutionEngine/ExecutionEngine.h"
-#include "llvm/ExecutionEngine/JIT.h"
-#include "llvm/LLVMContext.h"
-#include "llvm/Module.h"
-#include "llvm/PassManager.h"
-#include "llvm/Analysis/Verifier.h"
-#include "llvm/Target/TargetData.h"
-#include "llvm/Target/TargetSelect.h"
-#include "llvm/Transforms/Scalar.h"
-#include "llvm/Support/IRBuilder.h"
-#include &lt;cstdio&gt;
-#include &lt;string&gt;
-#include &lt;map&gt;
-#include &lt;vector&gt;
-using namespace llvm;
-
-//===----------------------------------------------------------------------===//
-// Lexer
-//===----------------------------------------------------------------------===//
-
-// The lexer returns tokens [0-255] if it is an unknown character, otherwise one
-// of these for known things.
-enum Token {
-  tok_eof = -1,
-
-  // commands
-  tok_def = -2, tok_extern = -3,
-
-  // primary
-  tok_identifier = -4, tok_number = -5,
-  
-  // control
-  tok_if = -6, tok_then = -7, tok_else = -8,
-  tok_for = -9, tok_in = -10
-};
-
-static std::string IdentifierStr;  // Filled in if tok_identifier
-static double NumVal;              // Filled in if tok_number
-
-/// gettok - Return the next token from standard input.
-static int gettok() {
-  static int LastChar = ' ';
-
-  // Skip any whitespace.
-  while (isspace(LastChar))
-    LastChar = getchar();
-
-  if (isalpha(LastChar)) { // identifier: [a-zA-Z][a-zA-Z0-9]*
-    IdentifierStr = LastChar;
-    while (isalnum((LastChar = getchar())))
-      IdentifierStr += LastChar;
-
-    if (IdentifierStr == "def") return tok_def;
-    if (IdentifierStr == "extern") return tok_extern;
-    if (IdentifierStr == "if") return tok_if;
-    if (IdentifierStr == "then") return tok_then;
-    if (IdentifierStr == "else") return tok_else;
-    if (IdentifierStr == "for") return tok_for;
-    if (IdentifierStr == "in") return tok_in;
-    return tok_identifier;
-  }
-
-  if (isdigit(LastChar) || LastChar == '.') {   // Number: [0-9.]+
-    std::string NumStr;
-    do {
-      NumStr += LastChar;
-      LastChar = getchar();
-    } while (isdigit(LastChar) || LastChar == '.');
-
-    NumVal = strtod(NumStr.c_str(), 0);
-    return tok_number;
-  }
-
-  if (LastChar == '#') {
-    // Comment until end of line.
-    do LastChar = getchar();
-    while (LastChar != EOF &amp;&amp; LastChar != '\n' &amp;&amp; LastChar != '\r');
-    
-    if (LastChar != EOF)
-      return gettok();
-  }
-  
-  // Check for end of file.  Don't eat the EOF.
-  if (LastChar == EOF)
-    return tok_eof;
-
-  // Otherwise, just return the character as its ascii value.
-  int ThisChar = LastChar;
-  LastChar = getchar();
-  return ThisChar;
-}
-
-//===----------------------------------------------------------------------===//
-// Abstract Syntax Tree (aka Parse Tree)
-//===----------------------------------------------------------------------===//
-
-/// ExprAST - Base class for all expression nodes.
-class ExprAST {
-public:
-  virtual ~ExprAST() {}
-  virtual Value *Codegen() = 0;
-};
-
-/// NumberExprAST - Expression class for numeric literals like "1.0".
-class NumberExprAST : public ExprAST {
-  double Val;
-public:
-  NumberExprAST(double val) : Val(val) {}
-  virtual Value *Codegen();
-};
-
-/// VariableExprAST - Expression class for referencing a variable, like "a".
-class VariableExprAST : public ExprAST {
-  std::string Name;
-public:
-  VariableExprAST(const std::string &amp;name) : Name(name) {}
-  virtual Value *Codegen();
-};
-
-/// BinaryExprAST - Expression class for a binary operator.
-class BinaryExprAST : public ExprAST {
-  char Op;
-  ExprAST *LHS, *RHS;
-public:
-  BinaryExprAST(char op, ExprAST *lhs, ExprAST *rhs) 
-    : Op(op), LHS(lhs), RHS(rhs) {}
-  virtual Value *Codegen();
-};
-
-/// CallExprAST - Expression class for function calls.
-class CallExprAST : public ExprAST {
-  std::string Callee;
-  std::vector&lt;ExprAST*&gt; Args;
-public:
-  CallExprAST(const std::string &amp;callee, std::vector&lt;ExprAST*&gt; &amp;args)
-    : Callee(callee), Args(args) {}
-  virtual Value *Codegen();
-};
-
-/// IfExprAST - Expression class for if/then/else.
-class IfExprAST : public ExprAST {
-  ExprAST *Cond, *Then, *Else;
-public:
-  IfExprAST(ExprAST *cond, ExprAST *then, ExprAST *_else)
-  : Cond(cond), Then(then), Else(_else) {}
-  virtual Value *Codegen();
-};
-
-/// ForExprAST - Expression class for for/in.
-class ForExprAST : public ExprAST {
-  std::string VarName;
-  ExprAST *Start, *End, *Step, *Body;
-public:
-  ForExprAST(const std::string &amp;varname, ExprAST *start, ExprAST *end,
-             ExprAST *step, ExprAST *body)
-    : VarName(varname), Start(start), End(end), Step(step), Body(body) {}
-  virtual Value *Codegen();
-};
-
-/// PrototypeAST - This class represents the "prototype" for a function,
-/// which captures its name, and its argument names (thus implicitly the number
-/// of arguments the function takes).
-class PrototypeAST {
-  std::string Name;
-  std::vector&lt;std::string&gt; Args;
-public:
-  PrototypeAST(const std::string &amp;name, const std::vector&lt;std::string&gt; &amp;args)
-    : Name(name), Args(args) {}
-  
-  Function *Codegen();
-};
-
-/// FunctionAST - This class represents a function definition itself.
-class FunctionAST {
-  PrototypeAST *Proto;
-  ExprAST *Body;
-public:
-  FunctionAST(PrototypeAST *proto, ExprAST *body)
-    : Proto(proto), Body(body) {}
-  
-  Function *Codegen();
-};
-
-//===----------------------------------------------------------------------===//
-// Parser
-//===----------------------------------------------------------------------===//
-
-/// CurTok/getNextToken - Provide a simple token buffer.  CurTok is the current
-/// token the parser is looking at.  getNextToken reads another token from the
-/// lexer and updates CurTok with its results.
-static int CurTok;
-static int getNextToken() {
-  return CurTok = gettok();
-}
-
-/// BinopPrecedence - This holds the precedence for each binary operator that is
-/// defined.
-static std::map&lt;char, int&gt; BinopPrecedence;
-
-/// GetTokPrecedence - Get the precedence of the pending binary operator token.
-static int GetTokPrecedence() {
-  if (!isascii(CurTok))
-    return -1;
-  
-  // Make sure it's a declared binop.
-  int TokPrec = BinopPrecedence[CurTok];
-  if (TokPrec &lt;= 0) return -1;
-  return TokPrec;
-}
-
-/// Error* - These are little helper functions for error handling.
-ExprAST *Error(const char *Str) { fprintf(stderr, "Error: %s\n", Str);return 0;}
-PrototypeAST *ErrorP(const char *Str) { Error(Str); return 0; }
-FunctionAST *ErrorF(const char *Str) { Error(Str); return 0; }
-
-static ExprAST *ParseExpression();
-
-/// identifierexpr
-///   ::= identifier
-///   ::= identifier '(' expression* ')'
-static ExprAST *ParseIdentifierExpr() {
-  std::string IdName = IdentifierStr;
-  
-  getNextToken();  // eat identifier.
-  
-  if (CurTok != '(') // Simple variable ref.
-    return new VariableExprAST(IdName);
-  
-  // Call.
-  getNextToken();  // eat (
-  std::vector&lt;ExprAST*&gt; Args;
-  if (CurTok != ')') {
-    while (1) {
-      ExprAST *Arg = ParseExpression();
-      if (!Arg) return 0;
-      Args.push_back(Arg);
-
-      if (CurTok == ')') break;
-
-      if (CurTok != ',')
-        return Error("Expected ')' or ',' in argument list");
-      getNextToken();
-    }
-  }
-
-  // Eat the ')'.
-  getNextToken();
-  
-  return new CallExprAST(IdName, Args);
-}
-
-/// numberexpr ::= number
-static ExprAST *ParseNumberExpr() {
-  ExprAST *Result = new NumberExprAST(NumVal);
-  getNextToken(); // consume the number
-  return Result;
-}
-
-/// parenexpr ::= '(' expression ')'
-static ExprAST *ParseParenExpr() {
-  getNextToken();  // eat (.
-  ExprAST *V = ParseExpression();
-  if (!V) return 0;
-  
-  if (CurTok != ')')
-    return Error("expected ')'");
-  getNextToken();  // eat ).
-  return V;
-}
-
-/// ifexpr ::= 'if' expression 'then' expression 'else' expression
-static ExprAST *ParseIfExpr() {
-  getNextToken();  // eat the if.
-  
-  // condition.
-  ExprAST *Cond = ParseExpression();
-  if (!Cond) return 0;
-  
-  if (CurTok != tok_then)
-    return Error("expected then");
-  getNextToken();  // eat the then
-  
-  ExprAST *Then = ParseExpression();
-  if (Then == 0) return 0;
-  
-  if (CurTok != tok_else)
-    return Error("expected else");
-  
-  getNextToken();
-  
-  ExprAST *Else = ParseExpression();
-  if (!Else) return 0;
-  
-  return new IfExprAST(Cond, Then, Else);
-}
-
-/// forexpr ::= 'for' identifier '=' expr ',' expr (',' expr)? 'in' expression
-static ExprAST *ParseForExpr() {
-  getNextToken();  // eat the for.
-
-  if (CurTok != tok_identifier)
-    return Error("expected identifier after for");
-  
-  std::string IdName = IdentifierStr;
-  getNextToken();  // eat identifier.
-  
-  if (CurTok != '=')
-    return Error("expected '=' after for");
-  getNextToken();  // eat '='.
-  
-  
-  ExprAST *Start = ParseExpression();
-  if (Start == 0) return 0;
-  if (CurTok != ',')
-    return Error("expected ',' after for start value");
-  getNextToken();
-  
-  ExprAST *End = ParseExpression();
-  if (End == 0) return 0;
-  
-  // The step value is optional.
-  ExprAST *Step = 0;
-  if (CurTok == ',') {
-    getNextToken();
-    Step = ParseExpression();
-    if (Step == 0) return 0;
-  }
-  
-  if (CurTok != tok_in)
-    return Error("expected 'in' after for");
-  getNextToken();  // eat 'in'.
-  
-  ExprAST *Body = ParseExpression();
-  if (Body == 0) return 0;
-
-  return new ForExprAST(IdName, Start, End, Step, Body);
-}
-
-/// primary
-///   ::= identifierexpr
-///   ::= numberexpr
-///   ::= parenexpr
-///   ::= ifexpr
-///   ::= forexpr
-static ExprAST *ParsePrimary() {
-  switch (CurTok) {
-  default: return Error("unknown token when expecting an expression");
-  case tok_identifier: return ParseIdentifierExpr();
-  case tok_number:     return ParseNumberExpr();
-  case '(':            return ParseParenExpr();
-  case tok_if:         return ParseIfExpr();
-  case tok_for:        return ParseForExpr();
-  }
-}
-
-/// binoprhs
-///   ::= ('+' primary)*
-static ExprAST *ParseBinOpRHS(int ExprPrec, ExprAST *LHS) {
-  // If this is a binop, find its precedence.
-  while (1) {
-    int TokPrec = GetTokPrecedence();
-    
-    // If this is a binop that binds at least as tightly as the current binop,
-    // consume it, otherwise we are done.
-    if (TokPrec &lt; ExprPrec)
-      return LHS;
-    
-    // Okay, we know this is a binop.
-    int BinOp = CurTok;
-    getNextToken();  // eat binop
-    
-    // Parse the primary expression after the binary operator.
-    ExprAST *RHS = ParsePrimary();
-    if (!RHS) return 0;
-    
-    // If BinOp binds less tightly with RHS than the operator after RHS, let
-    // the pending operator take RHS as its LHS.
-    int NextPrec = GetTokPrecedence();
-    if (TokPrec &lt; NextPrec) {
-      RHS = ParseBinOpRHS(TokPrec+1, RHS);
-      if (RHS == 0) return 0;
-    }
-    
-    // Merge LHS/RHS.
-    LHS = new BinaryExprAST(BinOp, LHS, RHS);
-  }
-}
-
-/// expression
-///   ::= primary binoprhs
-///
-static ExprAST *ParseExpression() {
-  ExprAST *LHS = ParsePrimary();
-  if (!LHS) return 0;
-  
-  return ParseBinOpRHS(0, LHS);
-}
-
-/// prototype
-///   ::= id '(' id* ')'
-static PrototypeAST *ParsePrototype() {
-  if (CurTok != tok_identifier)
-    return ErrorP("Expected function name in prototype");
-
-  std::string FnName = IdentifierStr;
-  getNextToken();
-  
-  if (CurTok != '(')
-    return ErrorP("Expected '(' in prototype");
-  
-  std::vector&lt;std::string&gt; ArgNames;
-  while (getNextToken() == tok_identifier)
-    ArgNames.push_back(IdentifierStr);
-  if (CurTok != ')')
-    return ErrorP("Expected ')' in prototype");
-  
-  // success.
-  getNextToken();  // eat ')'.
-  
-  return new PrototypeAST(FnName, ArgNames);
-}
-
-/// definition ::= 'def' prototype expression
-static FunctionAST *ParseDefinition() {
-  getNextToken();  // eat def.
-  PrototypeAST *Proto = ParsePrototype();
-  if (Proto == 0) return 0;
-
-  if (ExprAST *E = ParseExpression())
-    return new FunctionAST(Proto, E);
-  return 0;
-}
-
-/// toplevelexpr ::= expression
-static FunctionAST *ParseTopLevelExpr() {
-  if (ExprAST *E = ParseExpression()) {
-    // Make an anonymous proto.
-    PrototypeAST *Proto = new PrototypeAST("", std::vector&lt;std::string&gt;());
-    return new FunctionAST(Proto, E);
-  }
-  return 0;
-}
-
-/// external ::= 'extern' prototype
-static PrototypeAST *ParseExtern() {
-  getNextToken();  // eat extern.
-  return ParsePrototype();
-}
-
-//===----------------------------------------------------------------------===//
-// Code Generation
-//===----------------------------------------------------------------------===//
-
-static Module *TheModule;
-static IRBuilder&lt;&gt; Builder(getGlobalContext());
-static std::map&lt;std::string, Value*&gt; NamedValues;
-static FunctionPassManager *TheFPM;
-
-Value *ErrorV(const char *Str) { Error(Str); return 0; }
-
-Value *NumberExprAST::Codegen() {
-  return ConstantFP::get(getGlobalContext(), APFloat(Val));
-}
-
-Value *VariableExprAST::Codegen() {
-  // Look this variable up in the function.
-  Value *V = NamedValues[Name];
-  return V ? V : ErrorV("Unknown variable name");
-}
-
-Value *BinaryExprAST::Codegen() {
-  Value *L = LHS-&gt;Codegen();
-  Value *R = RHS-&gt;Codegen();
-  if (L == 0 || R == 0) return 0;
-  
-  switch (Op) {
-  case '+': return Builder.CreateAdd(L, R, "addtmp");
-  case '-': return Builder.CreateSub(L, R, "subtmp");
-  case '*': return Builder.CreateMul(L, R, "multmp");
-  case '&lt;':
-    L = Builder.CreateFCmpULT(L, R, "cmptmp");
-    // Convert bool 0/1 to double 0.0 or 1.0
-    return Builder.CreateUIToFP(L, Type::getDoubleTy(getGlobalContext()),
-                                "booltmp");
-  default: return ErrorV("invalid binary operator");
-  }
-}
-
-Value *CallExprAST::Codegen() {
-  // Look up the name in the global module table.
-  Function *CalleeF = TheModule-&gt;getFunction(Callee);
-  if (CalleeF == 0)
-    return ErrorV("Unknown function referenced");
-  
-  // If argument mismatch error.
-  if (CalleeF-&gt;arg_size() != Args.size())
-    return ErrorV("Incorrect # arguments passed");
-
-  std::vector&lt;Value*&gt; ArgsV;
-  for (unsigned i = 0, e = Args.size(); i != e; ++i) {
-    ArgsV.push_back(Args[i]-&gt;Codegen());
-    if (ArgsV.back() == 0) return 0;
-  }
-  
-  return Builder.CreateCall(CalleeF, ArgsV.begin(), ArgsV.end(), "calltmp");
-}
-
-Value *IfExprAST::Codegen() {
-  Value *CondV = Cond-&gt;Codegen();
-  if (CondV == 0) return 0;
-  
-  // Convert condition to a bool by comparing equal to 0.0.
-  CondV = Builder.CreateFCmpONE(CondV, 
-                              ConstantFP::get(getGlobalContext(), APFloat(0.0)),
-                                "ifcond");
-  
-  Function *TheFunction = Builder.GetInsertBlock()-&gt;getParent();
-  
-  // Create blocks for the then and else cases.  Insert the 'then' block at the
-  // end of the function.
-  BasicBlock *ThenBB = BasicBlock::Create(getGlobalContext(), "then", TheFunction);
-  BasicBlock *ElseBB = BasicBlock::Create(getGlobalContext(), "else");
-  BasicBlock *MergeBB = BasicBlock::Create(getGlobalContext(), "ifcont");
-  
-  Builder.CreateCondBr(CondV, ThenBB, ElseBB);
-  
-  // Emit then value.
-  Builder.SetInsertPoint(ThenBB);
-  
-  Value *ThenV = Then-&gt;Codegen();
-  if (ThenV == 0) return 0;
-  
-  Builder.CreateBr(MergeBB);
-  // Codegen of 'Then' can change the current block, update ThenBB for the PHI.
-  ThenBB = Builder.GetInsertBlock();
-  
-  // Emit else block.
-  TheFunction-&gt;getBasicBlockList().push_back(ElseBB);
-  Builder.SetInsertPoint(ElseBB);
-  
-  Value *ElseV = Else-&gt;Codegen();
-  if (ElseV == 0) return 0;
-  
-  Builder.CreateBr(MergeBB);
-  // Codegen of 'Else' can change the current block, update ElseBB for the PHI.
-  ElseBB = Builder.GetInsertBlock();
-  
-  // Emit merge block.
-  TheFunction-&gt;getBasicBlockList().push_back(MergeBB);
-  Builder.SetInsertPoint(MergeBB);
-  PHINode *PN = Builder.CreatePHI(Type::getDoubleTy(getGlobalContext()),
-                                  "iftmp");
-  
-  PN-&gt;addIncoming(ThenV, ThenBB);
-  PN-&gt;addIncoming(ElseV, ElseBB);
-  return PN;
-}
-
-Value *ForExprAST::Codegen() {
-  // Output this as:
-  //   ...
-  //   start = startexpr
-  //   goto loop
-  // loop: 
-  //   variable = phi [start, loopheader], [nextvariable, loopend]
-  //   ...
-  //   bodyexpr
-  //   ...
-  // loopend:
-  //   step = stepexpr
-  //   nextvariable = variable + step
-  //   endcond = endexpr
-  //   br endcond, loop, endloop
-  // outloop:
-  
-  // Emit the start code first, without 'variable' in scope.
-  Value *StartVal = Start-&gt;Codegen();
-  if (StartVal == 0) return 0;
-  
-  // Make the new basic block for the loop header, inserting after current
-  // block.
-  Function *TheFunction = Builder.GetInsertBlock()-&gt;getParent();
-  BasicBlock *PreheaderBB = Builder.GetInsertBlock();
-  BasicBlock *LoopBB = BasicBlock::Create(getGlobalContext(), "loop", TheFunction);
-  
-  // Insert an explicit fall through from the current block to the LoopBB.
-  Builder.CreateBr(LoopBB);
-
-  // Start insertion in LoopBB.
-  Builder.SetInsertPoint(LoopBB);
-  
-  // Start the PHI node with an entry for Start.
-  PHINode *Variable = Builder.CreatePHI(Type::getDoubleTy(getGlobalContext()), VarName.c_str());
-  Variable-&gt;addIncoming(StartVal, PreheaderBB);
-  
-  // Within the loop, the variable is defined equal to the PHI node.  If it
-  // shadows an existing variable, we have to restore it, so save it now.
-  Value *OldVal = NamedValues[VarName];
-  NamedValues[VarName] = Variable;
-  
-  // Emit the body of the loop.  This, like any other expr, can change the
-  // current BB.  Note that we ignore the value computed by the body, but don't
-  // allow an error.
-  if (Body-&gt;Codegen() == 0)
-    return 0;
-  
-  // Emit the step value.
-  Value *StepVal;
-  if (Step) {
-    StepVal = Step-&gt;Codegen();
-    if (StepVal == 0) return 0;
-  } else {
-    // If not specified, use 1.0.
-    StepVal = ConstantFP::get(getGlobalContext(), APFloat(1.0));
-  }
-  
-  Value *NextVar = Builder.CreateAdd(Variable, StepVal, "nextvar");
-
-  // Compute the end condition.
-  Value *EndCond = End-&gt;Codegen();
-  if (EndCond == 0) return EndCond;
-  
-  // Convert condition to a bool by comparing equal to 0.0.
-  EndCond = Builder.CreateFCmpONE(EndCond, 
-                              ConstantFP::get(getGlobalContext(), APFloat(0.0)),
-                                  "loopcond");
-  
-  // Create the "after loop" block and insert it.
-  BasicBlock *LoopEndBB = Builder.GetInsertBlock();
-  BasicBlock *AfterBB = BasicBlock::Create(getGlobalContext(), "afterloop", TheFunction);
-  
-  // Insert the conditional branch into the end of LoopEndBB.
-  Builder.CreateCondBr(EndCond, LoopBB, AfterBB);
-  
-  // Any new code will be inserted in AfterBB.
-  Builder.SetInsertPoint(AfterBB);
-  
-  // Add a new entry to the PHI node for the backedge.
-  Variable-&gt;addIncoming(NextVar, LoopEndBB);
-  
-  // Restore the unshadowed variable.
-  if (OldVal)
-    NamedValues[VarName] = OldVal;
-  else
-    NamedValues.erase(VarName);
-
-  
-  // for expr always returns 0.0.
-  return Constant::getNullValue(Type::getDoubleTy(getGlobalContext()));
-}
-
-Function *PrototypeAST::Codegen() {
-  // Make the function type:  double(double,double) etc.
-  std::vector&lt;const Type*&gt; Doubles(Args.size(),
-                                   Type::getDoubleTy(getGlobalContext()));
-  FunctionType *FT = FunctionType::get(Type::getDoubleTy(getGlobalContext()),
-                                       Doubles, false);
-  
-  Function *F = Function::Create(FT, Function::ExternalLinkage, Name, TheModule);
-  
-  // If F conflicted, there was already something named 'Name'.  If it has a
-  // body, don't allow redefinition or reextern.
-  if (F-&gt;getName() != Name) {
-    // Delete the one we just made and get the existing one.
-    F-&gt;eraseFromParent();
-    F = TheModule-&gt;getFunction(Name);
-    
-    // If F already has a body, reject this.
-    if (!F-&gt;empty()) {
-      ErrorF("redefinition of function");
-      return 0;
-    }
-    
-    // If F took a different number of args, reject.
-    if (F-&gt;arg_size() != Args.size()) {
-      ErrorF("redefinition of function with different # args");
-      return 0;
-    }
-  }
-  
-  // Set names for all arguments.
-  unsigned Idx = 0;
-  for (Function::arg_iterator AI = F-&gt;arg_begin(); Idx != Args.size();
-       ++AI, ++Idx) {
-    AI-&gt;setName(Args[Idx]);
-    
-    // Add arguments to variable symbol table.
-    NamedValues[Args[Idx]] = AI;
-  }
-  
-  return F;
-}
-
-Function *FunctionAST::Codegen() {
-  NamedValues.clear();
-  
-  Function *TheFunction = Proto-&gt;Codegen();
-  if (TheFunction == 0)
-    return 0;
-  
-  // Create a new basic block to start insertion into.
-  BasicBlock *BB = BasicBlock::Create(getGlobalContext(), "entry", TheFunction);
-  Builder.SetInsertPoint(BB);
-  
-  if (Value *RetVal = Body-&gt;Codegen()) {
-    // Finish off the function.
-    Builder.CreateRet(RetVal);
-
-    // Validate the generated code, checking for consistency.
-    verifyFunction(*TheFunction);
-
-    // Optimize the function.
-    TheFPM-&gt;run(*TheFunction);
-    
-    return TheFunction;
-  }
-  
-  // Error reading body, remove function.
-  TheFunction-&gt;eraseFromParent();
-  return 0;
-}
-
-//===----------------------------------------------------------------------===//
-// Top-Level parsing and JIT Driver
-//===----------------------------------------------------------------------===//
-
-static ExecutionEngine *TheExecutionEngine;
-
-static void HandleDefinition() {
-  if (FunctionAST *F = ParseDefinition()) {
-    if (Function *LF = F-&gt;Codegen()) {
-      fprintf(stderr, "Read function definition:");
-      LF-&gt;dump();
-    }
-  } else {
-    // Skip token for error recovery.
-    getNextToken();
-  }
-}
-
-static void HandleExtern() {
-  if (PrototypeAST *P = ParseExtern()) {
-    if (Function *F = P-&gt;Codegen()) {
-      fprintf(stderr, "Read extern: ");
-      F-&gt;dump();
-    }
-  } else {
-    // Skip token for error recovery.
-    getNextToken();
-  }
-}
-
-static void HandleTopLevelExpression() {
-  // Evaluate a top-level expression into an anonymous function.
-  if (FunctionAST *F = ParseTopLevelExpr()) {
-    if (Function *LF = F-&gt;Codegen()) {
-      // JIT the function, returning a function pointer.
-      void *FPtr = TheExecutionEngine-&gt;getPointerToFunction(LF);
-      
-      // Cast it to the right type (takes no arguments, returns a double) so we
-      // can call it as a native function.
-      double (*FP)() = (double (*)())(intptr_t)FPtr;
-      fprintf(stderr, "Evaluated to %f\n", FP());
-    }
-  } else {
-    // Skip token for error recovery.
-    getNextToken();
-  }
-}
-
-/// top ::= definition | external | expression | ';'
-static void MainLoop() {
-  while (1) {
-    fprintf(stderr, "ready&gt; ");
-    switch (CurTok) {
-    case tok_eof:    return;
-    case ';':        getNextToken(); break;  // ignore top-level semicolons.
-    case tok_def:    HandleDefinition(); break;
-    case tok_extern: HandleExtern(); break;
-    default:         HandleTopLevelExpression(); break;
-    }
-  }
-}
-
-//===----------------------------------------------------------------------===//
-// "Library" functions that can be "extern'd" from user code.
-//===----------------------------------------------------------------------===//
-
-/// putchard - putchar that takes a double and returns 0.
-extern "C" 
-double putchard(double X) {
-  putchar((char)X);
-  return 0;
-}
-
-//===----------------------------------------------------------------------===//
-// Main driver code.
-//===----------------------------------------------------------------------===//
-
-int main() {
-  InitializeNativeTarget();
-  LLVMContext &amp;Context = getGlobalContext();
-
-  // Install standard binary operators.
-  // 1 is lowest precedence.
-  BinopPrecedence['&lt;'] = 10;
-  BinopPrecedence['+'] = 20;
-  BinopPrecedence['-'] = 20;
-  BinopPrecedence['*'] = 40;  // highest.
-
-  // Prime the first token.
-  fprintf(stderr, "ready&gt; ");
-  getNextToken();
-
-  // Make the module, which holds all the code.
-  TheModule = new Module("my cool jit", Context);
-
-  // Create the JIT.  This takes ownership of the module.
-  std::string ErrStr;
-  TheExecutionEngine = EngineBuilder(TheModule).setErrorStr(&ErrStr).create();
-  if (!TheExecutionEngine) {
-    fprintf(stderr, "Could not create ExecutionEngine: %s\n", ErrStr.c_str());
-    exit(1);
-  }
-
-  FunctionPassManager OurFPM(TheModule);
-
-  // Set up the optimizer pipeline.  Start with registering info about how the
-  // target lays out data structures.
-  OurFPM.add(new TargetData(*TheExecutionEngine-&gt;getTargetData()));
-  // Do simple "peephole" optimizations and bit-twiddling optzns.
-  OurFPM.add(createInstructionCombiningPass());
-  // Reassociate expressions.
-  OurFPM.add(createReassociatePass());
-  // Eliminate Common SubExpressions.
-  OurFPM.add(createGVNPass());
-  // Simplify the control flow graph (deleting unreachable blocks, etc).
-  OurFPM.add(createCFGSimplificationPass());
-
-  OurFPM.doInitialization();
-
-  // Set the global so the code gen can use this.
-  TheFPM = &amp;OurFPM;
-
-  // Run the main "interpreter loop" now.
-  MainLoop();
-
-  TheFPM = 0;
-
-  // Print out all of the generated code.
-  TheModule-&gt;dump();
-
-  return 0;
-}
-</pre>
-</div>
-
-<a href="LangImpl6.html">Next: Extending the language: user-defined operators</a>
-</div>
-
-<!-- *********************************************************************** -->
-<hr>
-<address>
-  <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
-  src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"></a>
-  <a href="http://validator.w3.org/check/referer"><img
-  src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"></a>
-
-  <a href="mailto:sabre at nondot.org">Chris Lattner</a><br>
-  <a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
-  Last modified: $Date$
-</address>
-</body>
-</html>
diff --git a/libclamav/c++/llvm/docs/tutorial/LangImpl6.html b/libclamav/c++/llvm/docs/tutorial/LangImpl6.html
deleted file mode 100644
index 5fae906..0000000
--- a/libclamav/c++/llvm/docs/tutorial/LangImpl6.html
+++ /dev/null
@@ -1,1814 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-                      "http://www.w3.org/TR/html4/strict.dtd">
-
-<html>
-<head>
-  <title>Kaleidoscope: Extending the Language: User-defined Operators</title>
-  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-  <meta name="author" content="Chris Lattner">
-  <link rel="stylesheet" href="../llvm.css" type="text/css">
-</head>
-
-<body>
-
-<div class="doc_title">Kaleidoscope: Extending the Language: User-defined Operators</div>
-
-<ul>
-<li><a href="index.html">Up to Tutorial Index</a></li>
-<li>Chapter 6
-  <ol>
-    <li><a href="#intro">Chapter 6 Introduction</a></li>
-    <li><a href="#idea">User-defined Operators: the Idea</a></li>
-    <li><a href="#binary">User-defined Binary Operators</a></li>
-    <li><a href="#unary">User-defined Unary Operators</a></li>
-    <li><a href="#example">Kicking the Tires</a></li>
-    <li><a href="#code">Full Code Listing</a></li>
-  </ol>
-</li>
-<li><a href="LangImpl7.html">Chapter 7</a>: Extending the Language: Mutable
-Variables / SSA Construction</li>
-</ul>
-
-<div class="doc_author">
-  <p>Written by <a href="mailto:sabre at nondot.org">Chris Lattner</a></p>
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="intro">Chapter 6 Introduction</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>Welcome to Chapter 6 of the "<a href="index.html">Implementing a language
-with LLVM</a>" tutorial.  At this point in our tutorial, we now have a fully
-functional language that is fairly minimal, but also useful.  There
-is still one big problem with it, however. Our language doesn't have many 
-useful operators (like division, logical negation, or even any comparisons 
-besides less-than).</p>
-
-<p>This chapter of the tutorial takes a wild digression into adding user-defined
-operators to the simple and beautiful Kaleidoscope language. This digression now gives 
-us a simple and ugly language in some ways, but also a powerful one at the same time.
-One of the great things about creating your own language is that you get to
-decide what is good or bad.  In this tutorial we'll assume that it is okay to
-use this as a way to show some interesting parsing techniques.</p>
-
-<p>At the end of this tutorial, we'll run through an example Kaleidoscope 
-application that <a href="#example">renders the Mandelbrot set</a>.  This gives 
-an example of what you can build with Kaleidoscope and its feature set.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="idea">User-defined Operators: the Idea</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>
-The "operator overloading" that we will add to Kaleidoscope is more general than
-languages like C++.  In C++, you are only allowed to redefine existing
-operators: you can't programatically change the grammar, introduce new
-operators, change precedence levels, etc.  In this chapter, we will add this
-capability to Kaleidoscope, which will let the user round out the set of
-operators that are supported.</p>
-
-<p>The point of going into user-defined operators in a tutorial like this is to
-show the power and flexibility of using a hand-written parser.  Thus far, the parser
-we have been implementing uses recursive descent for most parts of the grammar and 
-operator precedence parsing for the expressions.  See <a 
-href="LangImpl2.html">Chapter 2</a> for details.  Without using operator
-precedence parsing, it would be very difficult to allow the programmer to
-introduce new operators into the grammar: the grammar is dynamically extensible
-as the JIT runs.</p>
-
-<p>The two specific features we'll add are programmable unary operators (right
-now, Kaleidoscope has no unary operators at all) as well as binary operators.
-An example of this is:</p>
-
-<div class="doc_code">
-<pre>
-# Logical unary not.
-def unary!(v)
-  if v then
-    0
-  else
-    1;
-
-# Define &gt; with the same precedence as &lt;.
-def binary&gt; 10 (LHS RHS)
-  RHS &lt; LHS;
-
-# Binary "logical or", (note that it does not "short circuit")
-def binary| 5 (LHS RHS)
-  if LHS then
-    1
-  else if RHS then
-    1
-  else
-    0;
-
-# Define = with slightly lower precedence than relationals.
-def binary= 9 (LHS RHS)
-  !(LHS &lt; RHS | LHS &gt; RHS);
-</pre>
-</div>
-
-<p>Many languages aspire to being able to implement their standard runtime
-library in the language itself.  In Kaleidoscope, we can implement significant
-parts of the language in the library!</p>
-
-<p>We will break down implementation of these features into two parts:
-implementing support for user-defined binary operators and adding unary
-operators.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="binary">User-defined Binary Operators</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>Adding support for user-defined binary operators is pretty simple with our
-current framework.  We'll first add support for the unary/binary keywords:</p>
-
-<div class="doc_code">
-<pre>
-enum Token {
-  ...
-  <b>// operators
-  tok_binary = -11, tok_unary = -12</b>
-};
-...
-static int gettok() {
-...
-    if (IdentifierStr == "for") return tok_for;
-    if (IdentifierStr == "in") return tok_in;
-    <b>if (IdentifierStr == "binary") return tok_binary;
-    if (IdentifierStr == "unary") return tok_unary;</b>
-    return tok_identifier;
-</pre>
-</div>
-
-<p>This just adds lexer support for the unary and binary keywords, like we
-did in <a href="LangImpl5.html#iflexer">previous chapters</a>.  One nice thing
-about our current AST, is that we represent binary operators with full generalisation
-by using their ASCII code as the opcode.  For our extended operators, we'll use this
-same representation, so we don't need any new AST or parser support.</p>
-
-<p>On the other hand, we have to be able to represent the definitions of these
-new operators, in the "def binary| 5" part of the function definition.  In our
-grammar so far, the "name" for the function definition is parsed as the
-"prototype" production and into the <tt>PrototypeAST</tt> AST node.  To
-represent our new user-defined operators as prototypes, we have to extend
-the  <tt>PrototypeAST</tt> AST node like this:</p>
-
-<div class="doc_code">
-<pre>
-/// PrototypeAST - This class represents the "prototype" for a function,
-/// which captures its argument names as well as if it is an operator.
-class PrototypeAST {
-  std::string Name;
-  std::vector&lt;std::string&gt; Args;
-  <b>bool isOperator;
-  unsigned Precedence;  // Precedence if a binary op.</b>
-public:
-  PrototypeAST(const std::string &amp;name, const std::vector&lt;std::string&gt; &amp;args,
-               <b>bool isoperator = false, unsigned prec = 0</b>)
-  : Name(name), Args(args), <b>isOperator(isoperator), Precedence(prec)</b> {}
-  
-  <b>bool isUnaryOp() const { return isOperator &amp;&amp; Args.size() == 1; }
-  bool isBinaryOp() const { return isOperator &amp;&amp; Args.size() == 2; }
-  
-  char getOperatorName() const {
-    assert(isUnaryOp() || isBinaryOp());
-    return Name[Name.size()-1];
-  }
-  
-  unsigned getBinaryPrecedence() const { return Precedence; }</b>
-  
-  Function *Codegen();
-};
-</pre>
-</div>
-
-<p>Basically, in addition to knowing a name for the prototype, we now keep track
-of whether it was an operator, and if it was, what precedence level the operator
-is at.  The precedence is only used for binary operators (as you'll see below,
-it just doesn't apply for unary operators).  Now that we have a way to represent
-the prototype for a user-defined operator, we need to parse it:</p>
-
-<div class="doc_code">
-<pre>
-/// prototype
-///   ::= id '(' id* ')'
-<b>///   ::= binary LETTER number? (id, id)</b>
-static PrototypeAST *ParsePrototype() {
-  std::string FnName;
-  
-  <b>unsigned Kind = 0;  // 0 = identifier, 1 = unary, 2 = binary.
-  unsigned BinaryPrecedence = 30;</b>
-  
-  switch (CurTok) {
-  default:
-    return ErrorP("Expected function name in prototype");
-  case tok_identifier:
-    FnName = IdentifierStr;
-    Kind = 0;
-    getNextToken();
-    break;
-  <b>case tok_binary:
-    getNextToken();
-    if (!isascii(CurTok))
-      return ErrorP("Expected binary operator");
-    FnName = "binary";
-    FnName += (char)CurTok;
-    Kind = 2;
-    getNextToken();
-    
-    // Read the precedence if present.
-    if (CurTok == tok_number) {
-      if (NumVal &lt; 1 || NumVal &gt; 100)
-        return ErrorP("Invalid precedecnce: must be 1..100");
-      BinaryPrecedence = (unsigned)NumVal;
-      getNextToken();
-    }
-    break;</b>
-  }
-  
-  if (CurTok != '(')
-    return ErrorP("Expected '(' in prototype");
-  
-  std::vector&lt;std::string&gt; ArgNames;
-  while (getNextToken() == tok_identifier)
-    ArgNames.push_back(IdentifierStr);
-  if (CurTok != ')')
-    return ErrorP("Expected ')' in prototype");
-  
-  // success.
-  getNextToken();  // eat ')'.
-  
-  <b>// Verify right number of names for operator.
-  if (Kind &amp;&amp; ArgNames.size() != Kind)
-    return ErrorP("Invalid number of operands for operator");
-  
-  return new PrototypeAST(FnName, ArgNames, Kind != 0, BinaryPrecedence);</b>
-}
-</pre>
-</div>
-
-<p>This is all fairly straightforward parsing code, and we have already seen
-a lot of similar code in the past.  One interesting part about the code above is 
-the couple lines that set up <tt>FnName</tt> for binary operators.  This builds names 
-like "binary@" for a newly defined "@" operator.  This then takes advantage of the 
-fact that symbol names in the LLVM symbol table are allowed to have any character in
-them, including embedded nul characters.</p>
-
-<p>The next interesting thing to add, is codegen support for these binary operators.
-Given our current structure, this is a simple addition of a default case for our
-existing binary operator node:</p>
-
-<div class="doc_code">
-<pre>
-Value *BinaryExprAST::Codegen() {
-  Value *L = LHS-&gt;Codegen();
-  Value *R = RHS-&gt;Codegen();
-  if (L == 0 || R == 0) return 0;
-  
-  switch (Op) {
-  case '+': return Builder.CreateAdd(L, R, "addtmp");
-  case '-': return Builder.CreateSub(L, R, "subtmp");
-  case '*': return Builder.CreateMul(L, R, "multmp");
-  case '&lt;':
-    L = Builder.CreateFCmpULT(L, R, "cmptmp");
-    // Convert bool 0/1 to double 0.0 or 1.0
-    return Builder.CreateUIToFP(L, Type::getDoubleTy(getGlobalContext()),
-                                "booltmp");
-  <b>default: break;</b>
-  }
-  
-  <b>// If it wasn't a builtin binary operator, it must be a user defined one. Emit
-  // a call to it.
-  Function *F = TheModule-&gt;getFunction(std::string("binary")+Op);
-  assert(F &amp;&amp; "binary operator not found!");
-  
-  Value *Ops[] = { L, R };
-  return Builder.CreateCall(F, Ops, Ops+2, "binop");</b>
-}
-
-</pre>
-</div>
-
-<p>As you can see above, the new code is actually really simple.  It just does
-a lookup for the appropriate operator in the symbol table and generates a 
-function call to it.  Since user-defined operators are just built as normal
-functions (because the "prototype" boils down to a function with the right
-name) everything falls into place.</p>
-
-<p>The final piece of code we are missing, is a bit of top-level magic:</p>
-
-<div class="doc_code">
-<pre>
-Function *FunctionAST::Codegen() {
-  NamedValues.clear();
-  
-  Function *TheFunction = Proto->Codegen();
-  if (TheFunction == 0)
-    return 0;
-  
-  <b>// If this is an operator, install it.
-  if (Proto-&gt;isBinaryOp())
-    BinopPrecedence[Proto->getOperatorName()] = Proto->getBinaryPrecedence();</b>
-  
-  // Create a new basic block to start insertion into.
-  BasicBlock *BB = BasicBlock::Create(getGlobalContext(), "entry", TheFunction);
-  Builder.SetInsertPoint(BB);
-  
-  if (Value *RetVal = Body-&gt;Codegen()) {
-    ...
-</pre>
-</div>
-
-<p>Basically, before codegening a function, if it is a user-defined operator, we
-register it in the precedence table.  This allows the binary operator parsing
-logic we already have in place to handle it.  Since we are working on a fully-general operator precedence parser, this is all we need to do to "extend the grammar".</p>
-
-<p>Now we have useful user-defined binary operators.  This builds a lot
-on the previous framework we built for other operators.  Adding unary operators
-is a bit more challenging, because we don't have any framework for it yet - lets
-see what it takes.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="unary">User-defined Unary Operators</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>Since we don't currently support unary operators in the Kaleidoscope
-language, we'll need to add everything to support them.  Above, we added simple
-support for the 'unary' keyword to the lexer.  In addition to that, we need an
-AST node:</p>
-
-<div class="doc_code">
-<pre>
-/// UnaryExprAST - Expression class for a unary operator.
-class UnaryExprAST : public ExprAST {
-  char Opcode;
-  ExprAST *Operand;
-public:
-  UnaryExprAST(char opcode, ExprAST *operand) 
-    : Opcode(opcode), Operand(operand) {}
-  virtual Value *Codegen();
-};
-</pre>
-</div>
-
-<p>This AST node is very simple and obvious by now.  It directly mirrors the
-binary operator AST node, except that it only has one child.  With this, we
-need to add the parsing logic.  Parsing a unary operator is pretty simple: we'll
-add a new function to do it:</p>
-
-<div class="doc_code">
-<pre>
-/// unary
-///   ::= primary
-///   ::= '!' unary
-static ExprAST *ParseUnary() {
-  // If the current token is not an operator, it must be a primary expr.
-  if (!isascii(CurTok) || CurTok == '(' || CurTok == ',')
-    return ParsePrimary();
-  
-  // If this is a unary operator, read it.
-  int Opc = CurTok;
-  getNextToken();
-  if (ExprAST *Operand = ParseUnary())
-    return new UnaryExprAST(Opc, Operand);
-  return 0;
-}
-</pre>
-</div>
-
-<p>The grammar we add is pretty straightforward here.  If we see a unary
-operator when parsing a primary operator, we eat the operator as a prefix and
-parse the remaining piece as another unary operator.  This allows us to handle
-multiple unary operators (e.g. "!!x").  Note that unary operators can't have 
-ambiguous parses like binary operators can, so there is no need for precedence
-information.</p>
-
-<p>The problem with this function, is that we need to call ParseUnary from somewhere.
-To do this, we change previous callers of ParsePrimary to call ParseUnary
-instead:</p>
-
-<div class="doc_code">
-<pre>
-/// binoprhs
-///   ::= ('+' unary)*
-static ExprAST *ParseBinOpRHS(int ExprPrec, ExprAST *LHS) {
-  ...
-    <b>// Parse the unary expression after the binary operator.
-    ExprAST *RHS = ParseUnary();
-    if (!RHS) return 0;</b>
-  ...
-}
-/// expression
-///   ::= unary binoprhs
-///
-static ExprAST *ParseExpression() {
-  <b>ExprAST *LHS = ParseUnary();</b>
-  if (!LHS) return 0;
-  
-  return ParseBinOpRHS(0, LHS);
-}
-</pre>
-</div>
-
-<p>With these two simple changes, we are now able to parse unary operators and build the
-AST for them.  Next up, we need to add parser support for prototypes, to parse
-the unary operator prototype.  We extend the binary operator code above 
-with:</p>
-
-<div class="doc_code">
-<pre>
-/// prototype
-///   ::= id '(' id* ')'
-///   ::= binary LETTER number? (id, id)
-<b>///   ::= unary LETTER (id)</b>
-static PrototypeAST *ParsePrototype() {
-  std::string FnName;
-  
-  unsigned Kind = 0;  // 0 = identifier, 1 = unary, 2 = binary.
-  unsigned BinaryPrecedence = 30;
-  
-  switch (CurTok) {
-  default:
-    return ErrorP("Expected function name in prototype");
-  case tok_identifier:
-    FnName = IdentifierStr;
-    Kind = 0;
-    getNextToken();
-    break;
-  <b>case tok_unary:
-    getNextToken();
-    if (!isascii(CurTok))
-      return ErrorP("Expected unary operator");
-    FnName = "unary";
-    FnName += (char)CurTok;
-    Kind = 1;
-    getNextToken();
-    break;</b>
-  case tok_binary:
-    ...
-</pre>
-</div>
-
-<p>As with binary operators, we name unary operators with a name that includes
-the operator character.  This assists us at code generation time.  Speaking of,
-the final piece we need to add is codegen support for unary operators.  It looks
-like this:</p>
-
-<div class="doc_code">
-<pre>
-Value *UnaryExprAST::Codegen() {
-  Value *OperandV = Operand->Codegen();
-  if (OperandV == 0) return 0;
-  
-  Function *F = TheModule->getFunction(std::string("unary")+Opcode);
-  if (F == 0)
-    return ErrorV("Unknown unary operator");
-  
-  return Builder.CreateCall(F, OperandV, "unop");
-}
-</pre>
-</div>
-
-<p>This code is similar to, but simpler than, the code for binary operators.  It
-is simpler primarily because it doesn't need to handle any predefined operators.
-</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="example">Kicking the Tires</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>It is somewhat hard to believe, but with a few simple extensions we've
-covered in the last chapters, we have grown a real-ish language.  With this, we 
-can do a lot of interesting things, including I/O, math, and a bunch of other
-things.  For example, we can now add a nice sequencing operator (printd is
-defined to print out the specified value and a newline):</p>
-
-<div class="doc_code">
-<pre>
-ready&gt; <b>extern printd(x);</b>
-Read extern: declare double @printd(double)
-ready&gt; <b>def binary : 1 (x y) 0;  # Low-precedence operator that ignores operands.</b>
-..
-ready&gt; <b>printd(123) : printd(456) : printd(789);</b>
-123.000000
-456.000000
-789.000000
-Evaluated to 0.000000
-</pre>
-</div>
-
-<p>We can also define a bunch of other "primitive" operations, such as:</p>
-
-<div class="doc_code">
-<pre>
-# Logical unary not.
-def unary!(v)
-  if v then
-    0
-  else
-    1;
-    
-# Unary negate.
-def unary-(v)
-  0-v;
-
-# Define &gt; with the same precedence as &gt;.
-def binary&gt; 10 (LHS RHS)
-  RHS &lt; LHS;
-
-# Binary logical or, which does not short circuit. 
-def binary| 5 (LHS RHS)
-  if LHS then
-    1
-  else if RHS then
-    1
-  else
-    0;
-
-# Binary logical and, which does not short circuit. 
-def binary&amp; 6 (LHS RHS)
-  if !LHS then
-    0
-  else
-    !!RHS;
-
-# Define = with slightly lower precedence than relationals.
-def binary = 9 (LHS RHS)
-  !(LHS &lt; RHS | LHS &gt; RHS);
-
-</pre>
-</div>
-
-
-<p>Given the previous if/then/else support, we can also define interesting
-functions for I/O.  For example, the following prints out a character whose
-"density" reflects the value passed in: the lower the value, the denser the
-character:</p>
-
-<div class="doc_code">
-<pre>
-ready&gt;
-<b>
-extern putchard(char)
-def printdensity(d)
-  if d &gt; 8 then
-    putchard(32)  # ' '
-  else if d &gt; 4 then
-    putchard(46)  # '.'
-  else if d &gt; 2 then
-    putchard(43)  # '+'
-  else
-    putchard(42); # '*'</b>
-...
-ready&gt; <b>printdensity(1): printdensity(2): printdensity(3) : 
-          printdensity(4): printdensity(5): printdensity(9): putchard(10);</b>
-*++.. 
-Evaluated to 0.000000
-</pre>
-</div>
-
-<p>Based on these simple primitive operations, we can start to define more
-interesting things.  For example, here's a little function that solves for the
-number of iterations it takes a function in the complex plane to
-converge:</p>
-
-<div class="doc_code">
-<pre>
-# determine whether the specific location diverges.
-# Solve for z = z^2 + c in the complex plane.
-def mandleconverger(real imag iters creal cimag)
-  if iters &gt; 255 | (real*real + imag*imag &gt; 4) then
-    iters
-  else
-    mandleconverger(real*real - imag*imag + creal,
-                    2*real*imag + cimag,
-                    iters+1, creal, cimag);
-
-# return the number of iterations required for the iteration to escape
-def mandleconverge(real imag)
-  mandleconverger(real, imag, 0, real, imag);
-</pre>
-</div>
-
-<p>This "z = z<sup>2</sup> + c" function is a beautiful little creature that is the basis
-for computation of the <a 
-href="http://en.wikipedia.org/wiki/Mandelbrot_set">Mandelbrot Set</a>.  Our
-<tt>mandelconverge</tt> function returns the number of iterations that it takes
-for a complex orbit to escape, saturating to 255.  This is not a very useful
-function by itself, but if you plot its value over a two-dimensional plane,
-you can see the Mandelbrot set.  Given that we are limited to using putchard
-here, our amazing graphical output is limited, but we can whip together
-something using the density plotter above:</p>
-
-<div class="doc_code">
-<pre>
-# compute and plot the mandlebrot set with the specified 2 dimensional range
-# info.
-def mandelhelp(xmin xmax xstep   ymin ymax ystep)
-  for y = ymin, y &lt; ymax, ystep in (
-    (for x = xmin, x &lt; xmax, xstep in
-       printdensity(mandleconverge(x,y)))
-    : putchard(10)
-  )
- 
-# mandel - This is a convenient helper function for ploting the mandelbrot set
-# from the specified position with the specified Magnification.
-def mandel(realstart imagstart realmag imagmag) 
-  mandelhelp(realstart, realstart+realmag*78, realmag,
-             imagstart, imagstart+imagmag*40, imagmag);
-</pre>
-</div>
-
-<p>Given this, we can try plotting out the mandlebrot set!  Lets try it out:</p>
-
-<div class="doc_code">
-<pre>
-ready&gt; <b>mandel(-2.3, -1.3, 0.05, 0.07);</b>
-*******************************+++++++++++*************************************
-*************************+++++++++++++++++++++++*******************************
-**********************+++++++++++++++++++++++++++++****************************
-*******************+++++++++++++++++++++.. ...++++++++*************************
-*****************++++++++++++++++++++++.... ...+++++++++***********************
-***************+++++++++++++++++++++++.....   ...+++++++++*********************
-**************+++++++++++++++++++++++....     ....+++++++++********************
-*************++++++++++++++++++++++......      .....++++++++*******************
-************+++++++++++++++++++++.......       .......+++++++******************
-***********+++++++++++++++++++....                ... .+++++++*****************
-**********+++++++++++++++++.......                     .+++++++****************
-*********++++++++++++++...........                    ...+++++++***************
-********++++++++++++............                      ...++++++++**************
-********++++++++++... ..........                        .++++++++**************
-*******+++++++++.....                                   .+++++++++*************
-*******++++++++......                                  ..+++++++++*************
-*******++++++.......                                   ..+++++++++*************
-*******+++++......                                     ..+++++++++*************
-*******.... ....                                      ...+++++++++*************
-*******.... .                                         ...+++++++++*************
-*******+++++......                                    ...+++++++++*************
-*******++++++.......                                   ..+++++++++*************
-*******++++++++......                                   .+++++++++*************
-*******+++++++++.....                                  ..+++++++++*************
-********++++++++++... ..........                        .++++++++**************
-********++++++++++++............                      ...++++++++**************
-*********++++++++++++++..........                     ...+++++++***************
-**********++++++++++++++++........                     .+++++++****************
-**********++++++++++++++++++++....                ... ..+++++++****************
-***********++++++++++++++++++++++.......       .......++++++++*****************
-************+++++++++++++++++++++++......      ......++++++++******************
-**************+++++++++++++++++++++++....      ....++++++++********************
-***************+++++++++++++++++++++++.....   ...+++++++++*********************
-*****************++++++++++++++++++++++....  ...++++++++***********************
-*******************+++++++++++++++++++++......++++++++*************************
-*********************++++++++++++++++++++++.++++++++***************************
-*************************+++++++++++++++++++++++*******************************
-******************************+++++++++++++************************************
-*******************************************************************************
-*******************************************************************************
-*******************************************************************************
-Evaluated to 0.000000
-ready&gt; <b>mandel(-2, -1, 0.02, 0.04);</b>
-**************************+++++++++++++++++++++++++++++++++++++++++++++++++++++
-***********************++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-*********************+++++++++++++++++++++++++++++++++++++++++++++++++++++++++.
-*******************+++++++++++++++++++++++++++++++++++++++++++++++++++++++++...
-*****************+++++++++++++++++++++++++++++++++++++++++++++++++++++++++.....
-***************++++++++++++++++++++++++++++++++++++++++++++++++++++++++........
-**************++++++++++++++++++++++++++++++++++++++++++++++++++++++...........
-************+++++++++++++++++++++++++++++++++++++++++++++++++++++..............
-***********++++++++++++++++++++++++++++++++++++++++++++++++++........        . 
-**********++++++++++++++++++++++++++++++++++++++++++++++.............          
-********+++++++++++++++++++++++++++++++++++++++++++..................          
-*******+++++++++++++++++++++++++++++++++++++++.......................          
-******+++++++++++++++++++++++++++++++++++...........................           
-*****++++++++++++++++++++++++++++++++............................              
-*****++++++++++++++++++++++++++++...............................               
-****++++++++++++++++++++++++++......   .........................               
-***++++++++++++++++++++++++.........     ......    ...........                 
-***++++++++++++++++++++++............                                          
-**+++++++++++++++++++++..............                                          
-**+++++++++++++++++++................                                          
-*++++++++++++++++++.................                                           
-*++++++++++++++++............ ...                                              
-*++++++++++++++..............                                                  
-*+++....++++................                                                   
-*..........  ...........                                                       
-*                                                                              
-*..........  ...........                                                       
-*+++....++++................                                                   
-*++++++++++++++..............                                                  
-*++++++++++++++++............ ...                                              
-*++++++++++++++++++.................                                           
-**+++++++++++++++++++................                                          
-**+++++++++++++++++++++..............                                          
-***++++++++++++++++++++++............                                          
-***++++++++++++++++++++++++.........     ......    ...........                 
-****++++++++++++++++++++++++++......   .........................               
-*****++++++++++++++++++++++++++++...............................               
-*****++++++++++++++++++++++++++++++++............................              
-******+++++++++++++++++++++++++++++++++++...........................           
-*******+++++++++++++++++++++++++++++++++++++++.......................          
-********+++++++++++++++++++++++++++++++++++++++++++..................          
-Evaluated to 0.000000
-ready&gt; <b>mandel(-0.9, -1.4, 0.02, 0.03);</b>
-*******************************************************************************
-*******************************************************************************
-*******************************************************************************
-**********+++++++++++++++++++++************************************************
-*+++++++++++++++++++++++++++++++++++++++***************************************
-+++++++++++++++++++++++++++++++++++++++++++++**********************************
-++++++++++++++++++++++++++++++++++++++++++++++++++*****************************
-++++++++++++++++++++++++++++++++++++++++++++++++++++++*************************
-+++++++++++++++++++++++++++++++++++++++++++++++++++++++++**********************
-+++++++++++++++++++++++++++++++++.........++++++++++++++++++*******************
-+++++++++++++++++++++++++++++++....   ......+++++++++++++++++++****************
-+++++++++++++++++++++++++++++.......  ........+++++++++++++++++++**************
-++++++++++++++++++++++++++++........   ........++++++++++++++++++++************
-+++++++++++++++++++++++++++.........     ..  ...+++++++++++++++++++++**********
-++++++++++++++++++++++++++...........        ....++++++++++++++++++++++********
-++++++++++++++++++++++++.............       .......++++++++++++++++++++++******
-+++++++++++++++++++++++.............        ........+++++++++++++++++++++++****
-++++++++++++++++++++++...........           ..........++++++++++++++++++++++***
-++++++++++++++++++++...........                .........++++++++++++++++++++++*
-++++++++++++++++++............                  ...........++++++++++++++++++++
-++++++++++++++++...............                 .............++++++++++++++++++
-++++++++++++++.................                 ...............++++++++++++++++
-++++++++++++..................                  .................++++++++++++++
-+++++++++..................                      .................+++++++++++++
-++++++........        .                               .........  ..++++++++++++
-++............                                         ......    ....++++++++++
-..............                                                    ...++++++++++
-..............                                                    ....+++++++++
-..............                                                    .....++++++++
-.............                                                    ......++++++++
-...........                                                     .......++++++++
-.........                                                       ........+++++++
-.........                                                       ........+++++++
-.........                                                           ....+++++++
-........                                                             ...+++++++
-.......                                                              ...+++++++
-                                                                    ....+++++++
-                                                                   .....+++++++
-                                                                    ....+++++++
-                                                                    ....+++++++
-                                                                    ....+++++++
-Evaluated to 0.000000
-ready&gt; <b>^D</b>
-</pre>
-</div>
-
-<p>At this point, you may be starting to realize that Kaleidoscope is a real
-and powerful language.  It may not be self-similar :), but it can be used to
-plot things that are!</p>
-
-<p>With this, we conclude the "adding user-defined operators" chapter of the
-tutorial.  We have successfully augmented our language, adding the ability to extend the
-language in the library, and we have shown how this can be used to build a simple but
-interesting end-user application in Kaleidoscope.  At this point, Kaleidoscope
-can build a variety of applications that are functional and can call functions
-with side-effects, but it can't actually define and mutate a variable itself.
-</p>
-
-<p>Strikingly, variable mutation is an important feature of some
-languages, and it is not at all obvious how to <a href="LangImpl7.html">add
-support for mutable variables</a> without having to add an "SSA construction"
-phase to your front-end.  In the next chapter, we will describe how you can
-add variable mutation without building SSA in your front-end.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="code">Full Code Listing</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>
-Here is the complete code listing for our running example, enhanced with the
-if/then/else and for expressions..  To build this example, use:
-</p>
-
-<div class="doc_code">
-<pre>
-   # Compile
-   g++ -g toy.cpp `llvm-config --cppflags --ldflags --libs core jit native` -O3 -o toy
-   # Run
-   ./toy
-</pre>
-</div>
-
-<p>Here is the code:</p>
-
-<div class="doc_code">
-<pre>
-#include "llvm/DerivedTypes.h"
-#include "llvm/ExecutionEngine/ExecutionEngine.h"
-#include "llvm/ExecutionEngine/JIT.h"
-#include "llvm/LLVMContext.h"
-#include "llvm/Module.h"
-#include "llvm/PassManager.h"
-#include "llvm/Analysis/Verifier.h"
-#include "llvm/Target/TargetData.h"
-#include "llvm/Target/TargetSelect.h"
-#include "llvm/Transforms/Scalar.h"
-#include "llvm/Support/IRBuilder.h"
-#include &lt;cstdio&gt;
-#include &lt;string&gt;
-#include &lt;map&gt;
-#include &lt;vector&gt;
-using namespace llvm;
-
-//===----------------------------------------------------------------------===//
-// Lexer
-//===----------------------------------------------------------------------===//
-
-// The lexer returns tokens [0-255] if it is an unknown character, otherwise one
-// of these for known things.
-enum Token {
-  tok_eof = -1,
-
-  // commands
-  tok_def = -2, tok_extern = -3,
-
-  // primary
-  tok_identifier = -4, tok_number = -5,
-  
-  // control
-  tok_if = -6, tok_then = -7, tok_else = -8,
-  tok_for = -9, tok_in = -10,
-  
-  // operators
-  tok_binary = -11, tok_unary = -12
-};
-
-static std::string IdentifierStr;  // Filled in if tok_identifier
-static double NumVal;              // Filled in if tok_number
-
-/// gettok - Return the next token from standard input.
-static int gettok() {
-  static int LastChar = ' ';
-
-  // Skip any whitespace.
-  while (isspace(LastChar))
-    LastChar = getchar();
-
-  if (isalpha(LastChar)) { // identifier: [a-zA-Z][a-zA-Z0-9]*
-    IdentifierStr = LastChar;
-    while (isalnum((LastChar = getchar())))
-      IdentifierStr += LastChar;
-
-    if (IdentifierStr == "def") return tok_def;
-    if (IdentifierStr == "extern") return tok_extern;
-    if (IdentifierStr == "if") return tok_if;
-    if (IdentifierStr == "then") return tok_then;
-    if (IdentifierStr == "else") return tok_else;
-    if (IdentifierStr == "for") return tok_for;
-    if (IdentifierStr == "in") return tok_in;
-    if (IdentifierStr == "binary") return tok_binary;
-    if (IdentifierStr == "unary") return tok_unary;
-    return tok_identifier;
-  }
-
-  if (isdigit(LastChar) || LastChar == '.') {   // Number: [0-9.]+
-    std::string NumStr;
-    do {
-      NumStr += LastChar;
-      LastChar = getchar();
-    } while (isdigit(LastChar) || LastChar == '.');
-
-    NumVal = strtod(NumStr.c_str(), 0);
-    return tok_number;
-  }
-
-  if (LastChar == '#') {
-    // Comment until end of line.
-    do LastChar = getchar();
-    while (LastChar != EOF &amp;&amp; LastChar != '\n' &amp;&amp; LastChar != '\r');
-    
-    if (LastChar != EOF)
-      return gettok();
-  }
-  
-  // Check for end of file.  Don't eat the EOF.
-  if (LastChar == EOF)
-    return tok_eof;
-
-  // Otherwise, just return the character as its ascii value.
-  int ThisChar = LastChar;
-  LastChar = getchar();
-  return ThisChar;
-}
-
-//===----------------------------------------------------------------------===//
-// Abstract Syntax Tree (aka Parse Tree)
-//===----------------------------------------------------------------------===//
-
-/// ExprAST - Base class for all expression nodes.
-class ExprAST {
-public:
-  virtual ~ExprAST() {}
-  virtual Value *Codegen() = 0;
-};
-
-/// NumberExprAST - Expression class for numeric literals like "1.0".
-class NumberExprAST : public ExprAST {
-  double Val;
-public:
-  NumberExprAST(double val) : Val(val) {}
-  virtual Value *Codegen();
-};
-
-/// VariableExprAST - Expression class for referencing a variable, like "a".
-class VariableExprAST : public ExprAST {
-  std::string Name;
-public:
-  VariableExprAST(const std::string &amp;name) : Name(name) {}
-  virtual Value *Codegen();
-};
-
-/// UnaryExprAST - Expression class for a unary operator.
-class UnaryExprAST : public ExprAST {
-  char Opcode;
-  ExprAST *Operand;
-public:
-  UnaryExprAST(char opcode, ExprAST *operand) 
-    : Opcode(opcode), Operand(operand) {}
-  virtual Value *Codegen();
-};
-
-/// BinaryExprAST - Expression class for a binary operator.
-class BinaryExprAST : public ExprAST {
-  char Op;
-  ExprAST *LHS, *RHS;
-public:
-  BinaryExprAST(char op, ExprAST *lhs, ExprAST *rhs) 
-    : Op(op), LHS(lhs), RHS(rhs) {}
-  virtual Value *Codegen();
-};
-
-/// CallExprAST - Expression class for function calls.
-class CallExprAST : public ExprAST {
-  std::string Callee;
-  std::vector&lt;ExprAST*&gt; Args;
-public:
-  CallExprAST(const std::string &amp;callee, std::vector&lt;ExprAST*&gt; &amp;args)
-    : Callee(callee), Args(args) {}
-  virtual Value *Codegen();
-};
-
-/// IfExprAST - Expression class for if/then/else.
-class IfExprAST : public ExprAST {
-  ExprAST *Cond, *Then, *Else;
-public:
-  IfExprAST(ExprAST *cond, ExprAST *then, ExprAST *_else)
-  : Cond(cond), Then(then), Else(_else) {}
-  virtual Value *Codegen();
-};
-
-/// ForExprAST - Expression class for for/in.
-class ForExprAST : public ExprAST {
-  std::string VarName;
-  ExprAST *Start, *End, *Step, *Body;
-public:
-  ForExprAST(const std::string &amp;varname, ExprAST *start, ExprAST *end,
-             ExprAST *step, ExprAST *body)
-    : VarName(varname), Start(start), End(end), Step(step), Body(body) {}
-  virtual Value *Codegen();
-};
-
-/// PrototypeAST - This class represents the "prototype" for a function,
-/// which captures its name, and its argument names (thus implicitly the number
-/// of arguments the function takes), as well as if it is an operator.
-class PrototypeAST {
-  std::string Name;
-  std::vector&lt;std::string&gt; Args;
-  bool isOperator;
-  unsigned Precedence;  // Precedence if a binary op.
-public:
-  PrototypeAST(const std::string &amp;name, const std::vector&lt;std::string&gt; &amp;args,
-               bool isoperator = false, unsigned prec = 0)
-  : Name(name), Args(args), isOperator(isoperator), Precedence(prec) {}
-  
-  bool isUnaryOp() const { return isOperator &amp;&amp; Args.size() == 1; }
-  bool isBinaryOp() const { return isOperator &amp;&amp; Args.size() == 2; }
-  
-  char getOperatorName() const {
-    assert(isUnaryOp() || isBinaryOp());
-    return Name[Name.size()-1];
-  }
-  
-  unsigned getBinaryPrecedence() const { return Precedence; }
-  
-  Function *Codegen();
-};
-
-/// FunctionAST - This class represents a function definition itself.
-class FunctionAST {
-  PrototypeAST *Proto;
-  ExprAST *Body;
-public:
-  FunctionAST(PrototypeAST *proto, ExprAST *body)
-    : Proto(proto), Body(body) {}
-  
-  Function *Codegen();
-};
-
-//===----------------------------------------------------------------------===//
-// Parser
-//===----------------------------------------------------------------------===//
-
-/// CurTok/getNextToken - Provide a simple token buffer.  CurTok is the current
-/// token the parser is looking at.  getNextToken reads another token from the
-/// lexer and updates CurTok with its results.
-static int CurTok;
-static int getNextToken() {
-  return CurTok = gettok();
-}
-
-/// BinopPrecedence - This holds the precedence for each binary operator that is
-/// defined.
-static std::map&lt;char, int&gt; BinopPrecedence;
-
-/// GetTokPrecedence - Get the precedence of the pending binary operator token.
-static int GetTokPrecedence() {
-  if (!isascii(CurTok))
-    return -1;
-  
-  // Make sure it's a declared binop.
-  int TokPrec = BinopPrecedence[CurTok];
-  if (TokPrec &lt;= 0) return -1;
-  return TokPrec;
-}
-
-/// Error* - These are little helper functions for error handling.
-ExprAST *Error(const char *Str) { fprintf(stderr, "Error: %s\n", Str);return 0;}
-PrototypeAST *ErrorP(const char *Str) { Error(Str); return 0; }
-FunctionAST *ErrorF(const char *Str) { Error(Str); return 0; }
-
-static ExprAST *ParseExpression();
-
-/// identifierexpr
-///   ::= identifier
-///   ::= identifier '(' expression* ')'
-static ExprAST *ParseIdentifierExpr() {
-  std::string IdName = IdentifierStr;
-  
-  getNextToken();  // eat identifier.
-  
-  if (CurTok != '(') // Simple variable ref.
-    return new VariableExprAST(IdName);
-  
-  // Call.
-  getNextToken();  // eat (
-  std::vector&lt;ExprAST*&gt; Args;
-  if (CurTok != ')') {
-    while (1) {
-      ExprAST *Arg = ParseExpression();
-      if (!Arg) return 0;
-      Args.push_back(Arg);
-
-      if (CurTok == ')') break;
-
-      if (CurTok != ',')
-        return Error("Expected ')' or ',' in argument list");
-      getNextToken();
-    }
-  }
-
-  // Eat the ')'.
-  getNextToken();
-  
-  return new CallExprAST(IdName, Args);
-}
-
-/// numberexpr ::= number
-static ExprAST *ParseNumberExpr() {
-  ExprAST *Result = new NumberExprAST(NumVal);
-  getNextToken(); // consume the number
-  return Result;
-}
-
-/// parenexpr ::= '(' expression ')'
-static ExprAST *ParseParenExpr() {
-  getNextToken();  // eat (.
-  ExprAST *V = ParseExpression();
-  if (!V) return 0;
-  
-  if (CurTok != ')')
-    return Error("expected ')'");
-  getNextToken();  // eat ).
-  return V;
-}
-
-/// ifexpr ::= 'if' expression 'then' expression 'else' expression
-static ExprAST *ParseIfExpr() {
-  getNextToken();  // eat the if.
-  
-  // condition.
-  ExprAST *Cond = ParseExpression();
-  if (!Cond) return 0;
-  
-  if (CurTok != tok_then)
-    return Error("expected then");
-  getNextToken();  // eat the then
-  
-  ExprAST *Then = ParseExpression();
-  if (Then == 0) return 0;
-  
-  if (CurTok != tok_else)
-    return Error("expected else");
-  
-  getNextToken();
-  
-  ExprAST *Else = ParseExpression();
-  if (!Else) return 0;
-  
-  return new IfExprAST(Cond, Then, Else);
-}
-
-/// forexpr ::= 'for' identifier '=' expr ',' expr (',' expr)? 'in' expression
-static ExprAST *ParseForExpr() {
-  getNextToken();  // eat the for.
-
-  if (CurTok != tok_identifier)
-    return Error("expected identifier after for");
-  
-  std::string IdName = IdentifierStr;
-  getNextToken();  // eat identifier.
-  
-  if (CurTok != '=')
-    return Error("expected '=' after for");
-  getNextToken();  // eat '='.
-  
-  
-  ExprAST *Start = ParseExpression();
-  if (Start == 0) return 0;
-  if (CurTok != ',')
-    return Error("expected ',' after for start value");
-  getNextToken();
-  
-  ExprAST *End = ParseExpression();
-  if (End == 0) return 0;
-  
-  // The step value is optional.
-  ExprAST *Step = 0;
-  if (CurTok == ',') {
-    getNextToken();
-    Step = ParseExpression();
-    if (Step == 0) return 0;
-  }
-  
-  if (CurTok != tok_in)
-    return Error("expected 'in' after for");
-  getNextToken();  // eat 'in'.
-  
-  ExprAST *Body = ParseExpression();
-  if (Body == 0) return 0;
-
-  return new ForExprAST(IdName, Start, End, Step, Body);
-}
-
-/// primary
-///   ::= identifierexpr
-///   ::= numberexpr
-///   ::= parenexpr
-///   ::= ifexpr
-///   ::= forexpr
-static ExprAST *ParsePrimary() {
-  switch (CurTok) {
-  default: return Error("unknown token when expecting an expression");
-  case tok_identifier: return ParseIdentifierExpr();
-  case tok_number:     return ParseNumberExpr();
-  case '(':            return ParseParenExpr();
-  case tok_if:         return ParseIfExpr();
-  case tok_for:        return ParseForExpr();
-  }
-}
-
-/// unary
-///   ::= primary
-///   ::= '!' unary
-static ExprAST *ParseUnary() {
-  // If the current token is not an operator, it must be a primary expr.
-  if (!isascii(CurTok) || CurTok == '(' || CurTok == ',')
-    return ParsePrimary();
-  
-  // If this is a unary operator, read it.
-  int Opc = CurTok;
-  getNextToken();
-  if (ExprAST *Operand = ParseUnary())
-    return new UnaryExprAST(Opc, Operand);
-  return 0;
-}
-
-/// binoprhs
-///   ::= ('+' unary)*
-static ExprAST *ParseBinOpRHS(int ExprPrec, ExprAST *LHS) {
-  // If this is a binop, find its precedence.
-  while (1) {
-    int TokPrec = GetTokPrecedence();
-    
-    // If this is a binop that binds at least as tightly as the current binop,
-    // consume it, otherwise we are done.
-    if (TokPrec &lt; ExprPrec)
-      return LHS;
-    
-    // Okay, we know this is a binop.
-    int BinOp = CurTok;
-    getNextToken();  // eat binop
-    
-    // Parse the unary expression after the binary operator.
-    ExprAST *RHS = ParseUnary();
-    if (!RHS) return 0;
-    
-    // If BinOp binds less tightly with RHS than the operator after RHS, let
-    // the pending operator take RHS as its LHS.
-    int NextPrec = GetTokPrecedence();
-    if (TokPrec &lt; NextPrec) {
-      RHS = ParseBinOpRHS(TokPrec+1, RHS);
-      if (RHS == 0) return 0;
-    }
-    
-    // Merge LHS/RHS.
-    LHS = new BinaryExprAST(BinOp, LHS, RHS);
-  }
-}
-
-/// expression
-///   ::= unary binoprhs
-///
-static ExprAST *ParseExpression() {
-  ExprAST *LHS = ParseUnary();
-  if (!LHS) return 0;
-  
-  return ParseBinOpRHS(0, LHS);
-}
-
-/// prototype
-///   ::= id '(' id* ')'
-///   ::= binary LETTER number? (id, id)
-///   ::= unary LETTER (id)
-static PrototypeAST *ParsePrototype() {
-  std::string FnName;
-  
-  unsigned Kind = 0; // 0 = identifier, 1 = unary, 2 = binary.
-  unsigned BinaryPrecedence = 30;
-  
-  switch (CurTok) {
-  default:
-    return ErrorP("Expected function name in prototype");
-  case tok_identifier:
-    FnName = IdentifierStr;
-    Kind = 0;
-    getNextToken();
-    break;
-  case tok_unary:
-    getNextToken();
-    if (!isascii(CurTok))
-      return ErrorP("Expected unary operator");
-    FnName = "unary";
-    FnName += (char)CurTok;
-    Kind = 1;
-    getNextToken();
-    break;
-  case tok_binary:
-    getNextToken();
-    if (!isascii(CurTok))
-      return ErrorP("Expected binary operator");
-    FnName = "binary";
-    FnName += (char)CurTok;
-    Kind = 2;
-    getNextToken();
-    
-    // Read the precedence if present.
-    if (CurTok == tok_number) {
-      if (NumVal &lt; 1 || NumVal &gt; 100)
-        return ErrorP("Invalid precedecnce: must be 1..100");
-      BinaryPrecedence = (unsigned)NumVal;
-      getNextToken();
-    }
-    break;
-  }
-  
-  if (CurTok != '(')
-    return ErrorP("Expected '(' in prototype");
-  
-  std::vector&lt;std::string&gt; ArgNames;
-  while (getNextToken() == tok_identifier)
-    ArgNames.push_back(IdentifierStr);
-  if (CurTok != ')')
-    return ErrorP("Expected ')' in prototype");
-  
-  // success.
-  getNextToken();  // eat ')'.
-  
-  // Verify right number of names for operator.
-  if (Kind &amp;&amp; ArgNames.size() != Kind)
-    return ErrorP("Invalid number of operands for operator");
-  
-  return new PrototypeAST(FnName, ArgNames, Kind != 0, BinaryPrecedence);
-}
-
-/// definition ::= 'def' prototype expression
-static FunctionAST *ParseDefinition() {
-  getNextToken();  // eat def.
-  PrototypeAST *Proto = ParsePrototype();
-  if (Proto == 0) return 0;
-
-  if (ExprAST *E = ParseExpression())
-    return new FunctionAST(Proto, E);
-  return 0;
-}
-
-/// toplevelexpr ::= expression
-static FunctionAST *ParseTopLevelExpr() {
-  if (ExprAST *E = ParseExpression()) {
-    // Make an anonymous proto.
-    PrototypeAST *Proto = new PrototypeAST("", std::vector&lt;std::string&gt;());
-    return new FunctionAST(Proto, E);
-  }
-  return 0;
-}
-
-/// external ::= 'extern' prototype
-static PrototypeAST *ParseExtern() {
-  getNextToken();  // eat extern.
-  return ParsePrototype();
-}
-
-//===----------------------------------------------------------------------===//
-// Code Generation
-//===----------------------------------------------------------------------===//
-
-static Module *TheModule;
-static IRBuilder&lt;&gt; Builder(getGlobalContext());
-static std::map&lt;std::string, Value*&gt; NamedValues;
-static FunctionPassManager *TheFPM;
-
-Value *ErrorV(const char *Str) { Error(Str); return 0; }
-
-Value *NumberExprAST::Codegen() {
-  return ConstantFP::get(getGlobalContext(), APFloat(Val));
-}
-
-Value *VariableExprAST::Codegen() {
-  // Look this variable up in the function.
-  Value *V = NamedValues[Name];
-  return V ? V : ErrorV("Unknown variable name");
-}
-
-Value *UnaryExprAST::Codegen() {
-  Value *OperandV = Operand-&gt;Codegen();
-  if (OperandV == 0) return 0;
-  
-  Function *F = TheModule-&gt;getFunction(std::string("unary")+Opcode);
-  if (F == 0)
-    return ErrorV("Unknown unary operator");
-  
-  return Builder.CreateCall(F, OperandV, "unop");
-}
-
-Value *BinaryExprAST::Codegen() {
-  Value *L = LHS-&gt;Codegen();
-  Value *R = RHS-&gt;Codegen();
-  if (L == 0 || R == 0) return 0;
-  
-  switch (Op) {
-  case '+': return Builder.CreateAdd(L, R, "addtmp");
-  case '-': return Builder.CreateSub(L, R, "subtmp");
-  case '*': return Builder.CreateMul(L, R, "multmp");
-  case '&lt;':
-    L = Builder.CreateFCmpULT(L, R, "cmptmp");
-    // Convert bool 0/1 to double 0.0 or 1.0
-    return Builder.CreateUIToFP(L, Type::getDoubleTy(getGlobalContext()),
-                                "booltmp");
-  default: break;
-  }
-  
-  // If it wasn't a builtin binary operator, it must be a user defined one. Emit
-  // a call to it.
-  Function *F = TheModule-&gt;getFunction(std::string("binary")+Op);
-  assert(F &amp;&amp; "binary operator not found!");
-  
-  Value *Ops[] = { L, R };
-  return Builder.CreateCall(F, Ops, Ops+2, "binop");
-}
-
-Value *CallExprAST::Codegen() {
-  // Look up the name in the global module table.
-  Function *CalleeF = TheModule-&gt;getFunction(Callee);
-  if (CalleeF == 0)
-    return ErrorV("Unknown function referenced");
-  
-  // If argument mismatch error.
-  if (CalleeF-&gt;arg_size() != Args.size())
-    return ErrorV("Incorrect # arguments passed");
-
-  std::vector&lt;Value*&gt; ArgsV;
-  for (unsigned i = 0, e = Args.size(); i != e; ++i) {
-    ArgsV.push_back(Args[i]-&gt;Codegen());
-    if (ArgsV.back() == 0) return 0;
-  }
-  
-  return Builder.CreateCall(CalleeF, ArgsV.begin(), ArgsV.end(), "calltmp");
-}
-
-Value *IfExprAST::Codegen() {
-  Value *CondV = Cond-&gt;Codegen();
-  if (CondV == 0) return 0;
-  
-  // Convert condition to a bool by comparing equal to 0.0.
-  CondV = Builder.CreateFCmpONE(CondV, 
-                              ConstantFP::get(getGlobalContext(), APFloat(0.0)),
-                                "ifcond");
-  
-  Function *TheFunction = Builder.GetInsertBlock()-&gt;getParent();
-  
-  // Create blocks for the then and else cases.  Insert the 'then' block at the
-  // end of the function.
-  BasicBlock *ThenBB = BasicBlock::Create(getGlobalContext(), "then", TheFunction);
-  BasicBlock *ElseBB = BasicBlock::Create(getGlobalContext(), "else");
-  BasicBlock *MergeBB = BasicBlock::Create(getGlobalContext(), "ifcont");
-  
-  Builder.CreateCondBr(CondV, ThenBB, ElseBB);
-  
-  // Emit then value.
-  Builder.SetInsertPoint(ThenBB);
-  
-  Value *ThenV = Then-&gt;Codegen();
-  if (ThenV == 0) return 0;
-  
-  Builder.CreateBr(MergeBB);
-  // Codegen of 'Then' can change the current block, update ThenBB for the PHI.
-  ThenBB = Builder.GetInsertBlock();
-  
-  // Emit else block.
-  TheFunction-&gt;getBasicBlockList().push_back(ElseBB);
-  Builder.SetInsertPoint(ElseBB);
-  
-  Value *ElseV = Else-&gt;Codegen();
-  if (ElseV == 0) return 0;
-  
-  Builder.CreateBr(MergeBB);
-  // Codegen of 'Else' can change the current block, update ElseBB for the PHI.
-  ElseBB = Builder.GetInsertBlock();
-  
-  // Emit merge block.
-  TheFunction-&gt;getBasicBlockList().push_back(MergeBB);
-  Builder.SetInsertPoint(MergeBB);
-  PHINode *PN = Builder.CreatePHI(Type::getDoubleTy(getGlobalContext()),
-                                  "iftmp");
-  
-  PN-&gt;addIncoming(ThenV, ThenBB);
-  PN-&gt;addIncoming(ElseV, ElseBB);
-  return PN;
-}
-
-Value *ForExprAST::Codegen() {
-  // Output this as:
-  //   ...
-  //   start = startexpr
-  //   goto loop
-  // loop: 
-  //   variable = phi [start, loopheader], [nextvariable, loopend]
-  //   ...
-  //   bodyexpr
-  //   ...
-  // loopend:
-  //   step = stepexpr
-  //   nextvariable = variable + step
-  //   endcond = endexpr
-  //   br endcond, loop, endloop
-  // outloop:
-  
-  // Emit the start code first, without 'variable' in scope.
-  Value *StartVal = Start-&gt;Codegen();
-  if (StartVal == 0) return 0;
-  
-  // Make the new basic block for the loop header, inserting after current
-  // block.
-  Function *TheFunction = Builder.GetInsertBlock()-&gt;getParent();
-  BasicBlock *PreheaderBB = Builder.GetInsertBlock();
-  BasicBlock *LoopBB = BasicBlock::Create(getGlobalContext(), "loop", TheFunction);
-  
-  // Insert an explicit fall through from the current block to the LoopBB.
-  Builder.CreateBr(LoopBB);
-
-  // Start insertion in LoopBB.
-  Builder.SetInsertPoint(LoopBB);
-  
-  // Start the PHI node with an entry for Start.
-  PHINode *Variable = Builder.CreatePHI(Type::getDoubleTy(getGlobalContext()), VarName.c_str());
-  Variable-&gt;addIncoming(StartVal, PreheaderBB);
-  
-  // Within the loop, the variable is defined equal to the PHI node.  If it
-  // shadows an existing variable, we have to restore it, so save it now.
-  Value *OldVal = NamedValues[VarName];
-  NamedValues[VarName] = Variable;
-  
-  // Emit the body of the loop.  This, like any other expr, can change the
-  // current BB.  Note that we ignore the value computed by the body, but don't
-  // allow an error.
-  if (Body-&gt;Codegen() == 0)
-    return 0;
-  
-  // Emit the step value.
-  Value *StepVal;
-  if (Step) {
-    StepVal = Step-&gt;Codegen();
-    if (StepVal == 0) return 0;
-  } else {
-    // If not specified, use 1.0.
-    StepVal = ConstantFP::get(getGlobalContext(), APFloat(1.0));
-  }
-  
-  Value *NextVar = Builder.CreateAdd(Variable, StepVal, "nextvar");
-
-  // Compute the end condition.
-  Value *EndCond = End-&gt;Codegen();
-  if (EndCond == 0) return EndCond;
-  
-  // Convert condition to a bool by comparing equal to 0.0.
-  EndCond = Builder.CreateFCmpONE(EndCond, 
-                              ConstantFP::get(getGlobalContext(), APFloat(0.0)),
-                                  "loopcond");
-  
-  // Create the "after loop" block and insert it.
-  BasicBlock *LoopEndBB = Builder.GetInsertBlock();
-  BasicBlock *AfterBB = BasicBlock::Create(getGlobalContext(), "afterloop", TheFunction);
-  
-  // Insert the conditional branch into the end of LoopEndBB.
-  Builder.CreateCondBr(EndCond, LoopBB, AfterBB);
-  
-  // Any new code will be inserted in AfterBB.
-  Builder.SetInsertPoint(AfterBB);
-  
-  // Add a new entry to the PHI node for the backedge.
-  Variable-&gt;addIncoming(NextVar, LoopEndBB);
-  
-  // Restore the unshadowed variable.
-  if (OldVal)
-    NamedValues[VarName] = OldVal;
-  else
-    NamedValues.erase(VarName);
-
-  
-  // for expr always returns 0.0.
-  return Constant::getNullValue(Type::getDoubleTy(getGlobalContext()));
-}
-
-Function *PrototypeAST::Codegen() {
-  // Make the function type:  double(double,double) etc.
-  std::vector&lt;const Type*&gt; Doubles(Args.size(),
-                                   Type::getDoubleTy(getGlobalContext()));
-  FunctionType *FT = FunctionType::get(Type::getDoubleTy(getGlobalContext()),
-                                       Doubles, false);
-  
-  Function *F = Function::Create(FT, Function::ExternalLinkage, Name, TheModule);
-  
-  // If F conflicted, there was already something named 'Name'.  If it has a
-  // body, don't allow redefinition or reextern.
-  if (F-&gt;getName() != Name) {
-    // Delete the one we just made and get the existing one.
-    F-&gt;eraseFromParent();
-    F = TheModule-&gt;getFunction(Name);
-    
-    // If F already has a body, reject this.
-    if (!F-&gt;empty()) {
-      ErrorF("redefinition of function");
-      return 0;
-    }
-    
-    // If F took a different number of args, reject.
-    if (F-&gt;arg_size() != Args.size()) {
-      ErrorF("redefinition of function with different # args");
-      return 0;
-    }
-  }
-  
-  // Set names for all arguments.
-  unsigned Idx = 0;
-  for (Function::arg_iterator AI = F-&gt;arg_begin(); Idx != Args.size();
-       ++AI, ++Idx) {
-    AI-&gt;setName(Args[Idx]);
-    
-    // Add arguments to variable symbol table.
-    NamedValues[Args[Idx]] = AI;
-  }
-  
-  return F;
-}
-
-Function *FunctionAST::Codegen() {
-  NamedValues.clear();
-  
-  Function *TheFunction = Proto-&gt;Codegen();
-  if (TheFunction == 0)
-    return 0;
-  
-  // If this is an operator, install it.
-  if (Proto-&gt;isBinaryOp())
-    BinopPrecedence[Proto-&gt;getOperatorName()] = Proto-&gt;getBinaryPrecedence();
-  
-  // Create a new basic block to start insertion into.
-  BasicBlock *BB = BasicBlock::Create(getGlobalContext(), "entry", TheFunction);
-  Builder.SetInsertPoint(BB);
-  
-  if (Value *RetVal = Body-&gt;Codegen()) {
-    // Finish off the function.
-    Builder.CreateRet(RetVal);
-
-    // Validate the generated code, checking for consistency.
-    verifyFunction(*TheFunction);
-
-    // Optimize the function.
-    TheFPM-&gt;run(*TheFunction);
-    
-    return TheFunction;
-  }
-  
-  // Error reading body, remove function.
-  TheFunction-&gt;eraseFromParent();
-
-  if (Proto-&gt;isBinaryOp())
-    BinopPrecedence.erase(Proto-&gt;getOperatorName());
-  return 0;
-}
-
-//===----------------------------------------------------------------------===//
-// Top-Level parsing and JIT Driver
-//===----------------------------------------------------------------------===//
-
-static ExecutionEngine *TheExecutionEngine;
-
-static void HandleDefinition() {
-  if (FunctionAST *F = ParseDefinition()) {
-    if (Function *LF = F-&gt;Codegen()) {
-      fprintf(stderr, "Read function definition:");
-      LF-&gt;dump();
-    }
-  } else {
-    // Skip token for error recovery.
-    getNextToken();
-  }
-}
-
-static void HandleExtern() {
-  if (PrototypeAST *P = ParseExtern()) {
-    if (Function *F = P-&gt;Codegen()) {
-      fprintf(stderr, "Read extern: ");
-      F-&gt;dump();
-    }
-  } else {
-    // Skip token for error recovery.
-    getNextToken();
-  }
-}
-
-static void HandleTopLevelExpression() {
-  // Evaluate a top-level expression into an anonymous function.
-  if (FunctionAST *F = ParseTopLevelExpr()) {
-    if (Function *LF = F-&gt;Codegen()) {
-      // JIT the function, returning a function pointer.
-      void *FPtr = TheExecutionEngine-&gt;getPointerToFunction(LF);
-      
-      // Cast it to the right type (takes no arguments, returns a double) so we
-      // can call it as a native function.
-      double (*FP)() = (double (*)())(intptr_t)FPtr;
-      fprintf(stderr, "Evaluated to %f\n", FP());
-    }
-  } else {
-    // Skip token for error recovery.
-    getNextToken();
-  }
-}
-
-/// top ::= definition | external | expression | ';'
-static void MainLoop() {
-  while (1) {
-    fprintf(stderr, "ready&gt; ");
-    switch (CurTok) {
-    case tok_eof:    return;
-    case ';':        getNextToken(); break;  // ignore top-level semicolons.
-    case tok_def:    HandleDefinition(); break;
-    case tok_extern: HandleExtern(); break;
-    default:         HandleTopLevelExpression(); break;
-    }
-  }
-}
-
-//===----------------------------------------------------------------------===//
-// "Library" functions that can be "extern'd" from user code.
-//===----------------------------------------------------------------------===//
-
-/// putchard - putchar that takes a double and returns 0.
-extern "C" 
-double putchard(double X) {
-  putchar((char)X);
-  return 0;
-}
-
-/// printd - printf that takes a double prints it as "%f\n", returning 0.
-extern "C" 
-double printd(double X) {
-  printf("%f\n", X);
-  return 0;
-}
-
-//===----------------------------------------------------------------------===//
-// Main driver code.
-//===----------------------------------------------------------------------===//
-
-int main() {
-  InitializeNativeTarget();
-  LLVMContext &amp;Context = getGlobalContext();
-
-  // Install standard binary operators.
-  // 1 is lowest precedence.
-  BinopPrecedence['&lt;'] = 10;
-  BinopPrecedence['+'] = 20;
-  BinopPrecedence['-'] = 20;
-  BinopPrecedence['*'] = 40;  // highest.
-
-  // Prime the first token.
-  fprintf(stderr, "ready&gt; ");
-  getNextToken();
-
-  // Make the module, which holds all the code.
-  TheModule = new Module("my cool jit", Context);
-
-  // Create the JIT.  This takes ownership of the module.
-  std::string ErrStr;
-  TheExecutionEngine = EngineBuilder(TheModule).setErrorStr(&ErrStr).create();
-  if (!TheExecutionEngine) {
-    fprintf(stderr, "Could not create ExecutionEngine: %s\n", ErrStr.c_str());
-    exit(1);
-  }
-
-  FunctionPassManager OurFPM(TheModule);
-
-  // Set up the optimizer pipeline.  Start with registering info about how the
-  // target lays out data structures.
-  OurFPM.add(new TargetData(*TheExecutionEngine-&gt;getTargetData()));
-  // Do simple "peephole" optimizations and bit-twiddling optzns.
-  OurFPM.add(createInstructionCombiningPass());
-  // Reassociate expressions.
-  OurFPM.add(createReassociatePass());
-  // Eliminate Common SubExpressions.
-  OurFPM.add(createGVNPass());
-  // Simplify the control flow graph (deleting unreachable blocks, etc).
-  OurFPM.add(createCFGSimplificationPass());
-
-  OurFPM.doInitialization();
-
-  // Set the global so the code gen can use this.
-  TheFPM = &amp;OurFPM;
-
-  // Run the main "interpreter loop" now.
-  MainLoop();
-
-  TheFPM = 0;
-
-  // Print out all of the generated code.
-  TheModule-&gt;dump();
-
-  return 0;
-}
-</pre>
-</div>
-
-<a href="LangImpl7.html">Next: Extending the language: mutable variables / SSA construction</a>
-</div>
-
-<!-- *********************************************************************** -->
-<hr>
-<address>
-  <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
-  src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"></a>
-  <a href="http://validator.w3.org/check/referer"><img
-  src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"></a>
-
-  <a href="mailto:sabre at nondot.org">Chris Lattner</a><br>
-  <a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
-  Last modified: $Date$
-</address>
-</body>
-</html>
diff --git a/libclamav/c++/llvm/docs/tutorial/LangImpl7.html b/libclamav/c++/llvm/docs/tutorial/LangImpl7.html
deleted file mode 100644
index f0a03c3..0000000
--- a/libclamav/c++/llvm/docs/tutorial/LangImpl7.html
+++ /dev/null
@@ -1,2164 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-                      "http://www.w3.org/TR/html4/strict.dtd">
-
-<html>
-<head>
-  <title>Kaleidoscope: Extending the Language: Mutable Variables / SSA
-         construction</title>
-  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-  <meta name="author" content="Chris Lattner">
-  <link rel="stylesheet" href="../llvm.css" type="text/css">
-</head>
-
-<body>
-
-<div class="doc_title">Kaleidoscope: Extending the Language: Mutable Variables</div>
-
-<ul>
-<li><a href="index.html">Up to Tutorial Index</a></li>
-<li>Chapter 7
-  <ol>
-    <li><a href="#intro">Chapter 7 Introduction</a></li>
-    <li><a href="#why">Why is this a hard problem?</a></li>
-    <li><a href="#memory">Memory in LLVM</a></li>
-    <li><a href="#kalvars">Mutable Variables in Kaleidoscope</a></li>
-    <li><a href="#adjustments">Adjusting Existing Variables for
-     Mutation</a></li>
-    <li><a href="#assignment">New Assignment Operator</a></li>
-    <li><a href="#localvars">User-defined Local Variables</a></li>
-    <li><a href="#code">Full Code Listing</a></li>
-  </ol>
-</li>
-<li><a href="LangImpl8.html">Chapter 8</a>: Conclusion and other useful LLVM
- tidbits</li>
-</ul>
-
-<div class="doc_author">
-  <p>Written by <a href="mailto:sabre at nondot.org">Chris Lattner</a></p>
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="intro">Chapter 7 Introduction</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>Welcome to Chapter 7 of the "<a href="index.html">Implementing a language
-with LLVM</a>" tutorial.  In chapters 1 through 6, we've built a very
-respectable, albeit simple, <a 
-href="http://en.wikipedia.org/wiki/Functional_programming">functional
-programming language</a>.  In our journey, we learned some parsing techniques,
-how to build and represent an AST, how to build LLVM IR, and how to optimize
-the resultant code as well as JIT compile it.</p>
-
-<p>While Kaleidoscope is interesting as a functional language, the fact that it
-is functional makes it "too easy" to generate LLVM IR for it.  In particular, a 
-functional language makes it very easy to build LLVM IR directly in <a 
-href="http://en.wikipedia.org/wiki/Static_single_assignment_form">SSA form</a>.
-Since LLVM requires that the input code be in SSA form, this is a very nice
-property and it is often unclear to newcomers how to generate code for an
-imperative language with mutable variables.</p>
-
-<p>The short (and happy) summary of this chapter is that there is no need for
-your front-end to build SSA form: LLVM provides highly tuned and well tested
-support for this, though the way it works is a bit unexpected for some.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="why">Why is this a hard problem?</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>
-To understand why mutable variables cause complexities in SSA construction, 
-consider this extremely simple C example:
-</p>
-
-<div class="doc_code">
-<pre>
-int G, H;
-int test(_Bool Condition) {
-  int X;
-  if (Condition)
-    X = G;
-  else
-    X = H;
-  return X;
-}
-</pre>
-</div>
-
-<p>In this case, we have the variable "X", whose value depends on the path 
-executed in the program.  Because there are two different possible values for X
-before the return instruction, a PHI node is inserted to merge the two values.
-The LLVM IR that we want for this example looks like this:</p>
-
-<div class="doc_code">
-<pre>
- at G = weak global i32 0   ; type of @G is i32*
- at H = weak global i32 0   ; type of @H is i32*
-
-define i32 @test(i1 %Condition) {
-entry:
-	br i1 %Condition, label %cond_true, label %cond_false
-
-cond_true:
-	%X.0 = load i32* @G
-	br label %cond_next
-
-cond_false:
-	%X.1 = load i32* @H
-	br label %cond_next
-
-cond_next:
-	%X.2 = phi i32 [ %X.1, %cond_false ], [ %X.0, %cond_true ]
-	ret i32 %X.2
-}
-</pre>
-</div>
-
-<p>In this example, the loads from the G and H global variables are explicit in
-the LLVM IR, and they live in the then/else branches of the if statement
-(cond_true/cond_false).  In order to merge the incoming values, the X.2 phi node
-in the cond_next block selects the right value to use based on where control 
-flow is coming from: if control flow comes from the cond_false block, X.2 gets
-the value of X.1.  Alternatively, if control flow comes from cond_true, it gets
-the value of X.0.  The intent of this chapter is not to explain the details of
-SSA form.  For more information, see one of the many <a 
-href="http://en.wikipedia.org/wiki/Static_single_assignment_form">online 
-references</a>.</p>
-
-<p>The question for this article is "who places the phi nodes when lowering 
-assignments to mutable variables?".  The issue here is that LLVM 
-<em>requires</em> that its IR be in SSA form: there is no "non-ssa" mode for it.
-However, SSA construction requires non-trivial algorithms and data structures,
-so it is inconvenient and wasteful for every front-end to have to reproduce this
-logic.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="memory">Memory in LLVM</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>The 'trick' here is that while LLVM does require all register values to be
-in SSA form, it does not require (or permit) memory objects to be in SSA form.
-In the example above, note that the loads from G and H are direct accesses to
-G and H: they are not renamed or versioned.  This differs from some other
-compiler systems, which do try to version memory objects.  In LLVM, instead of
-encoding dataflow analysis of memory into the LLVM IR, it is handled with <a 
-href="../WritingAnLLVMPass.html">Analysis Passes</a> which are computed on
-demand.</p>
-
-<p>
-With this in mind, the high-level idea is that we want to make a stack variable
-(which lives in memory, because it is on the stack) for each mutable object in
-a function.  To take advantage of this trick, we need to talk about how LLVM
-represents stack variables.
-</p>
-
-<p>In LLVM, all memory accesses are explicit with load/store instructions, and
-it is carefully designed not to have (or need) an "address-of" operator.  Notice
-how the type of the @G/@H global variables is actually "i32*" even though the 
-variable is defined as "i32".  What this means is that @G defines <em>space</em>
-for an i32 in the global data area, but its <em>name</em> actually refers to the
-address for that space.  Stack variables work the same way, except that instead of 
-being declared with global variable definitions, they are declared with the 
-<a href="../LangRef.html#i_alloca">LLVM alloca instruction</a>:</p>
-
-<div class="doc_code">
-<pre>
-define i32 @example() {
-entry:
-	%X = alloca i32           ; type of %X is i32*.
-	...
-	%tmp = load i32* %X       ; load the stack value %X from the stack.
-	%tmp2 = add i32 %tmp, 1   ; increment it
-	store i32 %tmp2, i32* %X  ; store it back
-	...
-</pre>
-</div>
-
-<p>This code shows an example of how you can declare and manipulate a stack
-variable in the LLVM IR.  Stack memory allocated with the alloca instruction is
-fully general: you can pass the address of the stack slot to functions, you can
-store it in other variables, etc.  In our example above, we could rewrite the
-example to use the alloca technique to avoid using a PHI node:</p>
-
-<div class="doc_code">
-<pre>
- at G = weak global i32 0   ; type of @G is i32*
- at H = weak global i32 0   ; type of @H is i32*
-
-define i32 @test(i1 %Condition) {
-entry:
-	%X = alloca i32           ; type of %X is i32*.
-	br i1 %Condition, label %cond_true, label %cond_false
-
-cond_true:
-	%X.0 = load i32* @G
-        store i32 %X.0, i32* %X   ; Update X
-	br label %cond_next
-
-cond_false:
-	%X.1 = load i32* @H
-        store i32 %X.1, i32* %X   ; Update X
-	br label %cond_next
-
-cond_next:
-	%X.2 = load i32* %X       ; Read X
-	ret i32 %X.2
-}
-</pre>
-</div>
-
-<p>With this, we have discovered a way to handle arbitrary mutable variables
-without the need to create Phi nodes at all:</p>
-
-<ol>
-<li>Each mutable variable becomes a stack allocation.</li>
-<li>Each read of the variable becomes a load from the stack.</li>
-<li>Each update of the variable becomes a store to the stack.</li>
-<li>Taking the address of a variable just uses the stack address directly.</li>
-</ol>
-
-<p>While this solution has solved our immediate problem, it introduced another
-one: we have now apparently introduced a lot of stack traffic for very simple
-and common operations, a major performance problem.  Fortunately for us, the
-LLVM optimizer has a highly-tuned optimization pass named "mem2reg" that handles
-this case, promoting allocas like this into SSA registers, inserting Phi nodes
-as appropriate.  If you run this example through the pass, for example, you'll
-get:</p>
-
-<div class="doc_code">
-<pre>
-$ <b>llvm-as &lt; example.ll | opt -mem2reg | llvm-dis</b>
- at G = weak global i32 0
- at H = weak global i32 0
-
-define i32 @test(i1 %Condition) {
-entry:
-	br i1 %Condition, label %cond_true, label %cond_false
-
-cond_true:
-	%X.0 = load i32* @G
-	br label %cond_next
-
-cond_false:
-	%X.1 = load i32* @H
-	br label %cond_next
-
-cond_next:
-	%X.01 = phi i32 [ %X.1, %cond_false ], [ %X.0, %cond_true ]
-	ret i32 %X.01
-}
-</pre>
-</div>
-
-<p>The mem2reg pass implements the standard "iterated dominance frontier"
-algorithm for constructing SSA form and has a number of optimizations that speed
-up (very common) degenerate cases. The mem2reg optimization pass is the answer to dealing 
-with mutable variables, and we highly recommend that you depend on it.  Note that
-mem2reg only works on variables in certain circumstances:</p>
-
-<ol>
-<li>mem2reg is alloca-driven: it looks for allocas and if it can handle them, it
-promotes them.  It does not apply to global variables or heap allocations.</li>
-
-<li>mem2reg only looks for alloca instructions in the entry block of the
-function.  Being in the entry block guarantees that the alloca is only executed
-once, which makes analysis simpler.</li>
-
-<li>mem2reg only promotes allocas whose uses are direct loads and stores.  If
-the address of the stack object is passed to a function, or if any funny pointer
-arithmetic is involved, the alloca will not be promoted.</li>
-
-<li>mem2reg only works on allocas of <a 
-href="../LangRef.html#t_classifications">first class</a> 
-values (such as pointers, scalars and vectors), and only if the array size
-of the allocation is 1 (or missing in the .ll file).  mem2reg is not capable of
-promoting structs or arrays to registers.  Note that the "scalarrepl" pass is
-more powerful and can promote structs, "unions", and arrays in many cases.</li>
-
-</ol>
-
-<p>
-All of these properties are easy to satisfy for most imperative languages, and
-we'll illustrate it below with Kaleidoscope.  The final question you may be
-asking is: should I bother with this nonsense for my front-end?  Wouldn't it be
-better if I just did SSA construction directly, avoiding use of the mem2reg
-optimization pass?  In short, we strongly recommend that you use this technique
-for building SSA form, unless there is an extremely good reason not to.  Using
-this technique is:</p>
-
-<ul>
-<li>Proven and well tested: llvm-gcc and clang both use this technique for local
-mutable variables.  As such, the most common clients of LLVM are using this to
-handle a bulk of their variables.  You can be sure that bugs are found fast and
-fixed early.</li>
-
-<li>Extremely Fast: mem2reg has a number of special cases that make it fast in
-common cases as well as fully general.  For example, it has fast-paths for
-variables that are only used in a single block, variables that only have one
-assignment point, good heuristics to avoid insertion of unneeded phi nodes, etc.
-</li>
-
-<li>Needed for debug info generation: <a href="../SourceLevelDebugging.html">
-Debug information in LLVM</a> relies on having the address of the variable
-exposed so that debug info can be attached to it.  This technique dovetails 
-very naturally with this style of debug info.</li>
-</ul>
-
-<p>If nothing else, this makes it much easier to get your front-end up and 
-running, and is very simple to implement.  Lets extend Kaleidoscope with mutable
-variables now!
-</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="kalvars">Mutable Variables in 
-Kaleidoscope</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>Now that we know the sort of problem we want to tackle, lets see what this
-looks like in the context of our little Kaleidoscope language.  We're going to
-add two features:</p>
-
-<ol>
-<li>The ability to mutate variables with the '=' operator.</li>
-<li>The ability to define new variables.</li>
-</ol>
-
-<p>While the first item is really what this is about, we only have variables
-for incoming arguments as well as for induction variables, and redefining those only
-goes so far :).  Also, the ability to define new variables is a
-useful thing regardless of whether you will be mutating them.  Here's a
-motivating example that shows how we could use these:</p>
-
-<div class="doc_code">
-<pre>
-# Define ':' for sequencing: as a low-precedence operator that ignores operands
-# and just returns the RHS.
-def binary : 1 (x y) y;
-
-# Recursive fib, we could do this before.
-def fib(x)
-  if (x &lt; 3) then
-    1
-  else
-    fib(x-1)+fib(x-2);
-
-# Iterative fib.
-def fibi(x)
-  <b>var a = 1, b = 1, c in</b>
-  (for i = 3, i &lt; x in 
-     <b>c = a + b</b> :
-     <b>a = b</b> :
-     <b>b = c</b>) :
-  b;
-
-# Call it. 
-fibi(10);
-</pre>
-</div>
-
-<p>
-In order to mutate variables, we have to change our existing variables to use
-the "alloca trick".  Once we have that, we'll add our new operator, then extend
-Kaleidoscope to support new variable definitions.
-</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="adjustments">Adjusting Existing Variables for
-Mutation</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>
-The symbol table in Kaleidoscope is managed at code generation time by the 
-'<tt>NamedValues</tt>' map.  This map currently keeps track of the LLVM "Value*"
-that holds the double value for the named variable.  In order to support
-mutation, we need to change this slightly, so that it <tt>NamedValues</tt> holds
-the <em>memory location</em> of the variable in question.  Note that this 
-change is a refactoring: it changes the structure of the code, but does not
-(by itself) change the behavior of the compiler.  All of these changes are 
-isolated in the Kaleidoscope code generator.</p>
-
-<p>
-At this point in Kaleidoscope's development, it only supports variables for two
-things: incoming arguments to functions and the induction variable of 'for'
-loops.  For consistency, we'll allow mutation of these variables in addition to
-other user-defined variables.  This means that these will both need memory
-locations.
-</p>
-
-<p>To start our transformation of Kaleidoscope, we'll change the NamedValues
-map so that it maps to AllocaInst* instead of Value*.  Once we do this, the C++ 
-compiler will tell us what parts of the code we need to update:</p>
-
-<div class="doc_code">
-<pre>
-static std::map&lt;std::string, AllocaInst*&gt; NamedValues;
-</pre>
-</div>
-
-<p>Also, since we will need to create these alloca's, we'll use a helper
-function that ensures that the allocas are created in the entry block of the
-function:</p>
-
-<div class="doc_code">
-<pre>
-/// CreateEntryBlockAlloca - Create an alloca instruction in the entry block of
-/// the function.  This is used for mutable variables etc.
-static AllocaInst *CreateEntryBlockAlloca(Function *TheFunction,
-                                          const std::string &amp;VarName) {
-  IRBuilder&lt;&gt; TmpB(&amp;TheFunction-&gt;getEntryBlock(),
-                 TheFunction-&gt;getEntryBlock().begin());
-  return TmpB.CreateAlloca(Type::getDoubleTy(getGlobalContext()), 0,
-                           VarName.c_str());
-}
-</pre>
-</div>
-
-<p>This funny looking code creates an IRBuilder object that is pointing at
-the first instruction (.begin()) of the entry block.  It then creates an alloca
-with the expected name and returns it.  Because all values in Kaleidoscope are
-doubles, there is no need to pass in a type to use.</p>
-
-<p>With this in place, the first functionality change we want to make is to
-variable references.  In our new scheme, variables live on the stack, so code
-generating a reference to them actually needs to produce a load from the stack
-slot:</p>
-
-<div class="doc_code">
-<pre>
-Value *VariableExprAST::Codegen() {
-  // Look this variable up in the function.
-  Value *V = NamedValues[Name];
-  if (V == 0) return ErrorV("Unknown variable name");
-
-  <b>// Load the value.
-  return Builder.CreateLoad(V, Name.c_str());</b>
-}
-</pre>
-</div>
-
-<p>As you can see, this is pretty straightforward.  Now we need to update the
-things that define the variables to set up the alloca.  We'll start with 
-<tt>ForExprAST::Codegen</tt> (see the <a href="#code">full code listing</a> for
-the unabridged code):</p>
-
-<div class="doc_code">
-<pre>
-  Function *TheFunction = Builder.GetInsertBlock()->getParent();
-
-  <b>// Create an alloca for the variable in the entry block.
-  AllocaInst *Alloca = CreateEntryBlockAlloca(TheFunction, VarName);</b>
-  
-    // Emit the start code first, without 'variable' in scope.
-  Value *StartVal = Start-&gt;Codegen();
-  if (StartVal == 0) return 0;
-  
-  <b>// Store the value into the alloca.
-  Builder.CreateStore(StartVal, Alloca);</b>
-  ...
-
-  // Compute the end condition.
-  Value *EndCond = End-&gt;Codegen();
-  if (EndCond == 0) return EndCond;
-  
-  <b>// Reload, increment, and restore the alloca.  This handles the case where
-  // the body of the loop mutates the variable.
-  Value *CurVar = Builder.CreateLoad(Alloca);
-  Value *NextVar = Builder.CreateAdd(CurVar, StepVal, "nextvar");
-  Builder.CreateStore(NextVar, Alloca);</b>
-  ...
-</pre>
-</div>
-
-<p>This code is virtually identical to the code <a 
-href="LangImpl5.html#forcodegen">before we allowed mutable variables</a>.  The
-big difference is that we no longer have to construct a PHI node, and we use
-load/store to access the variable as needed.</p>
-
-<p>To support mutable argument variables, we need to also make allocas for them.
-The code for this is also pretty simple:</p>
-
-<div class="doc_code">
-<pre>
-/// CreateArgumentAllocas - Create an alloca for each argument and register the
-/// argument in the symbol table so that references to it will succeed.
-void PrototypeAST::CreateArgumentAllocas(Function *F) {
-  Function::arg_iterator AI = F-&gt;arg_begin();
-  for (unsigned Idx = 0, e = Args.size(); Idx != e; ++Idx, ++AI) {
-    // Create an alloca for this variable.
-    AllocaInst *Alloca = CreateEntryBlockAlloca(F, Args[Idx]);
-
-    // Store the initial value into the alloca.
-    Builder.CreateStore(AI, Alloca);
-
-    // Add arguments to variable symbol table.
-    NamedValues[Args[Idx]] = Alloca;
-  }
-}
-</pre>
-</div>
-
-<p>For each argument, we make an alloca, store the input value to the function
-into the alloca, and register the alloca as the memory location for the
-argument.  This method gets invoked by <tt>FunctionAST::Codegen</tt> right after
-it sets up the entry block for the function.</p>
-
-<p>The final missing piece is adding the mem2reg pass, which allows us to get
-good codegen once again:</p>
-
-<div class="doc_code">
-<pre>
-    // Set up the optimizer pipeline.  Start with registering info about how the
-    // target lays out data structures.
-    OurFPM.add(new TargetData(*TheExecutionEngine-&gt;getTargetData()));
-    <b>// Promote allocas to registers.
-    OurFPM.add(createPromoteMemoryToRegisterPass());</b>
-    // Do simple "peephole" optimizations and bit-twiddling optzns.
-    OurFPM.add(createInstructionCombiningPass());
-    // Reassociate expressions.
-    OurFPM.add(createReassociatePass());
-</pre>
-</div>
-
-<p>It is interesting to see what the code looks like before and after the
-mem2reg optimization runs.  For example, this is the before/after code for our
-recursive fib function.  Before the optimization:</p>
-
-<div class="doc_code">
-<pre>
-define double @fib(double %x) {
-entry:
-	<b>%x1 = alloca double
-	store double %x, double* %x1
-	%x2 = load double* %x1</b>
-	%cmptmp = fcmp ult double %x2, 3.000000e+00
-	%booltmp = uitofp i1 %cmptmp to double
-	%ifcond = fcmp one double %booltmp, 0.000000e+00
-	br i1 %ifcond, label %then, label %else
-
-then:		; preds = %entry
-	br label %ifcont
-
-else:		; preds = %entry
-	<b>%x3 = load double* %x1</b>
-	%subtmp = sub double %x3, 1.000000e+00
-	%calltmp = call double @fib( double %subtmp )
-	<b>%x4 = load double* %x1</b>
-	%subtmp5 = sub double %x4, 2.000000e+00
-	%calltmp6 = call double @fib( double %subtmp5 )
-	%addtmp = add double %calltmp, %calltmp6
-	br label %ifcont
-
-ifcont:		; preds = %else, %then
-	%iftmp = phi double [ 1.000000e+00, %then ], [ %addtmp, %else ]
-	ret double %iftmp
-}
-</pre>
-</div>
-
-<p>Here there is only one variable (x, the input argument) but you can still
-see the extremely simple-minded code generation strategy we are using.  In the
-entry block, an alloca is created, and the initial input value is stored into
-it.  Each reference to the variable does a reload from the stack.  Also, note
-that we didn't modify the if/then/else expression, so it still inserts a PHI
-node.  While we could make an alloca for it, it is actually easier to create a 
-PHI node for it, so we still just make the PHI.</p>
-
-<p>Here is the code after the mem2reg pass runs:</p>
-
-<div class="doc_code">
-<pre>
-define double @fib(double %x) {
-entry:
-	%cmptmp = fcmp ult double <b>%x</b>, 3.000000e+00
-	%booltmp = uitofp i1 %cmptmp to double
-	%ifcond = fcmp one double %booltmp, 0.000000e+00
-	br i1 %ifcond, label %then, label %else
-
-then:
-	br label %ifcont
-
-else:
-	%subtmp = sub double <b>%x</b>, 1.000000e+00
-	%calltmp = call double @fib( double %subtmp )
-	%subtmp5 = sub double <b>%x</b>, 2.000000e+00
-	%calltmp6 = call double @fib( double %subtmp5 )
-	%addtmp = add double %calltmp, %calltmp6
-	br label %ifcont
-
-ifcont:		; preds = %else, %then
-	%iftmp = phi double [ 1.000000e+00, %then ], [ %addtmp, %else ]
-	ret double %iftmp
-}
-</pre>
-</div>
-
-<p>This is a trivial case for mem2reg, since there are no redefinitions of the
-variable.  The point of showing this is to calm your tension about inserting
-such blatent inefficiencies :).</p>
-
-<p>After the rest of the optimizers run, we get:</p>
-
-<div class="doc_code">
-<pre>
-define double @fib(double %x) {
-entry:
-	%cmptmp = fcmp ult double %x, 3.000000e+00
-	%booltmp = uitofp i1 %cmptmp to double
-	%ifcond = fcmp ueq double %booltmp, 0.000000e+00
-	br i1 %ifcond, label %else, label %ifcont
-
-else:
-	%subtmp = sub double %x, 1.000000e+00
-	%calltmp = call double @fib( double %subtmp )
-	%subtmp5 = sub double %x, 2.000000e+00
-	%calltmp6 = call double @fib( double %subtmp5 )
-	%addtmp = add double %calltmp, %calltmp6
-	ret double %addtmp
-
-ifcont:
-	ret double 1.000000e+00
-}
-</pre>
-</div>
-
-<p>Here we see that the simplifycfg pass decided to clone the return instruction
-into the end of the 'else' block.  This allowed it to eliminate some branches
-and the PHI node.</p>
-
-<p>Now that all symbol table references are updated to use stack variables, 
-we'll add the assignment operator.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="assignment">New Assignment Operator</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>With our current framework, adding a new assignment operator is really
-simple.  We will parse it just like any other binary operator, but handle it
-internally (instead of allowing the user to define it).  The first step is to
-set a precedence:</p>
-
-<div class="doc_code">
-<pre>
- int main() {
-   // Install standard binary operators.
-   // 1 is lowest precedence.
-   <b>BinopPrecedence['='] = 2;</b>
-   BinopPrecedence['&lt;'] = 10;
-   BinopPrecedence['+'] = 20;
-   BinopPrecedence['-'] = 20;
-</pre>
-</div>
-
-<p>Now that the parser knows the precedence of the binary operator, it takes
-care of all the parsing and AST generation.  We just need to implement codegen
-for the assignment operator.  This looks like:</p> 
-
-<div class="doc_code">
-<pre>
-Value *BinaryExprAST::Codegen() {
-  // Special case '=' because we don't want to emit the LHS as an expression.
-  if (Op == '=') {
-    // Assignment requires the LHS to be an identifier.
-    VariableExprAST *LHSE = dynamic_cast&lt;VariableExprAST*&gt;(LHS);
-    if (!LHSE)
-      return ErrorV("destination of '=' must be a variable");
-</pre>
-</div>
-
-<p>Unlike the rest of the binary operators, our assignment operator doesn't
-follow the "emit LHS, emit RHS, do computation" model.  As such, it is handled
-as a special case before the other binary operators are handled.  The other 
-strange thing is that it requires the LHS to be a variable.  It is invalid to
-have "(x+1) = expr" - only things like "x = expr" are allowed.
-</p>
-
-<div class="doc_code">
-<pre>
-    // Codegen the RHS.
-    Value *Val = RHS-&gt;Codegen();
-    if (Val == 0) return 0;
-
-    // Look up the name.
-    Value *Variable = NamedValues[LHSE-&gt;getName()];
-    if (Variable == 0) return ErrorV("Unknown variable name");
-
-    Builder.CreateStore(Val, Variable);
-    return Val;
-  }
-  ...  
-</pre>
-</div>
-
-<p>Once we have the variable, codegen'ing the assignment is straightforward:
-we emit the RHS of the assignment, create a store, and return the computed
-value.  Returning a value allows for chained assignments like "X = (Y = Z)".</p>
-
-<p>Now that we have an assignment operator, we can mutate loop variables and
-arguments.  For example, we can now run code like this:</p>
-
-<div class="doc_code">
-<pre>
-# Function to print a double.
-extern printd(x);
-
-# Define ':' for sequencing: as a low-precedence operator that ignores operands
-# and just returns the RHS.
-def binary : 1 (x y) y;
-
-def test(x)
-  printd(x) :
-  x = 4 :
-  printd(x);
-
-test(123);
-</pre>
-</div>
-
-<p>When run, this example prints "123" and then "4", showing that we did
-actually mutate the value!  Okay, we have now officially implemented our goal:
-getting this to work requires SSA construction in the general case.  However,
-to be really useful, we want the ability to define our own local variables, lets
-add this next! 
-</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="localvars">User-defined Local 
-Variables</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>Adding var/in is just like any other other extensions we made to 
-Kaleidoscope: we extend the lexer, the parser, the AST and the code generator.
-The first step for adding our new 'var/in' construct is to extend the lexer.
-As before, this is pretty trivial, the code looks like this:</p>
-
-<div class="doc_code">
-<pre>
-enum Token {
-  ...
-  <b>// var definition
-  tok_var = -13</b>
-...
-}
-...
-static int gettok() {
-...
-    if (IdentifierStr == "in") return tok_in;
-    if (IdentifierStr == "binary") return tok_binary;
-    if (IdentifierStr == "unary") return tok_unary;
-    <b>if (IdentifierStr == "var") return tok_var;</b>
-    return tok_identifier;
-...
-</pre>
-</div>
-
-<p>The next step is to define the AST node that we will construct.  For var/in,
-it looks like this:</p>
-
-<div class="doc_code">
-<pre>
-/// VarExprAST - Expression class for var/in
-class VarExprAST : public ExprAST {
-  std::vector&lt;std::pair&lt;std::string, ExprAST*&gt; &gt; VarNames;
-  ExprAST *Body;
-public:
-  VarExprAST(const std::vector&lt;std::pair&lt;std::string, ExprAST*&gt; &gt; &amp;varnames,
-             ExprAST *body)
-  : VarNames(varnames), Body(body) {}
-  
-  virtual Value *Codegen();
-};
-</pre>
-</div>
-
-<p>var/in allows a list of names to be defined all at once, and each name can
-optionally have an initializer value.  As such, we capture this information in
-the VarNames vector.  Also, var/in has a body, this body is allowed to access
-the variables defined by the var/in.</p>
-
-<p>With this in place, we can define the parser pieces.  The first thing we do is add
-it as a primary expression:</p>
-
-<div class="doc_code">
-<pre>
-/// primary
-///   ::= identifierexpr
-///   ::= numberexpr
-///   ::= parenexpr
-///   ::= ifexpr
-///   ::= forexpr
-<b>///   ::= varexpr</b>
-static ExprAST *ParsePrimary() {
-  switch (CurTok) {
-  default: return Error("unknown token when expecting an expression");
-  case tok_identifier: return ParseIdentifierExpr();
-  case tok_number:     return ParseNumberExpr();
-  case '(':            return ParseParenExpr();
-  case tok_if:         return ParseIfExpr();
-  case tok_for:        return ParseForExpr();
-  <b>case tok_var:        return ParseVarExpr();</b>
-  }
-}
-</pre>
-</div>
-
-<p>Next we define ParseVarExpr:</p>
-
-<div class="doc_code">
-<pre>
-/// varexpr ::= 'var' identifier ('=' expression)? 
-//                    (',' identifier ('=' expression)?)* 'in' expression
-static ExprAST *ParseVarExpr() {
-  getNextToken();  // eat the var.
-
-  std::vector&lt;std::pair&lt;std::string, ExprAST*&gt; &gt; VarNames;
-
-  // At least one variable name is required.
-  if (CurTok != tok_identifier)
-    return Error("expected identifier after var");
-</pre>
-</div>
-
-<p>The first part of this code parses the list of identifier/expr pairs into the
-local <tt>VarNames</tt> vector.  
-
-<div class="doc_code">
-<pre>
-  while (1) {
-    std::string Name = IdentifierStr;
-    getNextToken();  // eat identifier.
-
-    // Read the optional initializer.
-    ExprAST *Init = 0;
-    if (CurTok == '=') {
-      getNextToken(); // eat the '='.
-      
-      Init = ParseExpression();
-      if (Init == 0) return 0;
-    }
-    
-    VarNames.push_back(std::make_pair(Name, Init));
-    
-    // End of var list, exit loop.
-    if (CurTok != ',') break;
-    getNextToken(); // eat the ','.
-    
-    if (CurTok != tok_identifier)
-      return Error("expected identifier list after var");
-  }
-</pre>
-</div>
-
-<p>Once all the variables are parsed, we then parse the body and create the
-AST node:</p>
-
-<div class="doc_code">
-<pre>
-  // At this point, we have to have 'in'.
-  if (CurTok != tok_in)
-    return Error("expected 'in' keyword after 'var'");
-  getNextToken();  // eat 'in'.
-  
-  ExprAST *Body = ParseExpression();
-  if (Body == 0) return 0;
-  
-  return new VarExprAST(VarNames, Body);
-}
-</pre>
-</div>
-
-<p>Now that we can parse and represent the code, we need to support emission of
-LLVM IR for it.  This code starts out with:</p>
-
-<div class="doc_code">
-<pre>
-Value *VarExprAST::Codegen() {
-  std::vector&lt;AllocaInst *&gt; OldBindings;
-  
-  Function *TheFunction = Builder.GetInsertBlock()-&gt;getParent();
-
-  // Register all variables and emit their initializer.
-  for (unsigned i = 0, e = VarNames.size(); i != e; ++i) {
-    const std::string &amp;VarName = VarNames[i].first;
-    ExprAST *Init = VarNames[i].second;
-</pre>
-</div>
-
-<p>Basically it loops over all the variables, installing them one at a time.
-For each variable we put into the symbol table, we remember the previous value
-that we replace in OldBindings.</p>
-
-<div class="doc_code">
-<pre>
-    // Emit the initializer before adding the variable to scope, this prevents
-    // the initializer from referencing the variable itself, and permits stuff
-    // like this:
-    //  var a = 1 in
-    //    var a = a in ...   # refers to outer 'a'.
-    Value *InitVal;
-    if (Init) {
-      InitVal = Init-&gt;Codegen();
-      if (InitVal == 0) return 0;
-    } else { // If not specified, use 0.0.
-      InitVal = ConstantFP::get(getGlobalContext(), APFloat(0.0));
-    }
-    
-    AllocaInst *Alloca = CreateEntryBlockAlloca(TheFunction, VarName);
-    Builder.CreateStore(InitVal, Alloca);
-
-    // Remember the old variable binding so that we can restore the binding when
-    // we unrecurse.
-    OldBindings.push_back(NamedValues[VarName]);
-    
-    // Remember this binding.
-    NamedValues[VarName] = Alloca;
-  }
-</pre>
-</div>
-
-<p>There are more comments here than code.  The basic idea is that we emit the
-initializer, create the alloca, then update the symbol table to point to it.
-Once all the variables are installed in the symbol table, we evaluate the body
-of the var/in expression:</p>
-
-<div class="doc_code">
-<pre>
-  // Codegen the body, now that all vars are in scope.
-  Value *BodyVal = Body-&gt;Codegen();
-  if (BodyVal == 0) return 0;
-</pre>
-</div>
-
-<p>Finally, before returning, we restore the previous variable bindings:</p>
-
-<div class="doc_code">
-<pre>
-  // Pop all our variables from scope.
-  for (unsigned i = 0, e = VarNames.size(); i != e; ++i)
-    NamedValues[VarNames[i].first] = OldBindings[i];
-
-  // Return the body computation.
-  return BodyVal;
-}
-</pre>
-</div>
-
-<p>The end result of all of this is that we get properly scoped variable 
-definitions, and we even (trivially) allow mutation of them :).</p>
-
-<p>With this, we completed what we set out to do.  Our nice iterative fib
-example from the intro compiles and runs just fine.  The mem2reg pass optimizes
-all of our stack variables into SSA registers, inserting PHI nodes where needed,
-and our front-end remains simple: no "iterated dominance frontier" computation
-anywhere in sight.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="code">Full Code Listing</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>
-Here is the complete code listing for our running example, enhanced with mutable
-variables and var/in support.  To build this example, use:
-</p>
-
-<div class="doc_code">
-<pre>
-   # Compile
-   g++ -g toy.cpp `llvm-config --cppflags --ldflags --libs core jit native` -O3 -o toy
-   # Run
-   ./toy
-</pre>
-</div>
-
-<p>Here is the code:</p>
-
-<div class="doc_code">
-<pre>
-#include "llvm/DerivedTypes.h"
-#include "llvm/ExecutionEngine/ExecutionEngine.h"
-#include "llvm/ExecutionEngine/JIT.h"
-#include "llvm/LLVMContext.h"
-#include "llvm/Module.h"
-#include "llvm/PassManager.h"
-#include "llvm/Analysis/Verifier.h"
-#include "llvm/Target/TargetData.h"
-#include "llvm/Target/TargetSelect.h"
-#include "llvm/Transforms/Scalar.h"
-#include "llvm/Support/IRBuilder.h"
-#include &lt;cstdio&gt;
-#include &lt;string&gt;
-#include &lt;map&gt;
-#include &lt;vector&gt;
-using namespace llvm;
-
-//===----------------------------------------------------------------------===//
-// Lexer
-//===----------------------------------------------------------------------===//
-
-// The lexer returns tokens [0-255] if it is an unknown character, otherwise one
-// of these for known things.
-enum Token {
-  tok_eof = -1,
-
-  // commands
-  tok_def = -2, tok_extern = -3,
-
-  // primary
-  tok_identifier = -4, tok_number = -5,
-  
-  // control
-  tok_if = -6, tok_then = -7, tok_else = -8,
-  tok_for = -9, tok_in = -10,
-  
-  // operators
-  tok_binary = -11, tok_unary = -12,
-  
-  // var definition
-  tok_var = -13
-};
-
-static std::string IdentifierStr;  // Filled in if tok_identifier
-static double NumVal;              // Filled in if tok_number
-
-/// gettok - Return the next token from standard input.
-static int gettok() {
-  static int LastChar = ' ';
-
-  // Skip any whitespace.
-  while (isspace(LastChar))
-    LastChar = getchar();
-
-  if (isalpha(LastChar)) { // identifier: [a-zA-Z][a-zA-Z0-9]*
-    IdentifierStr = LastChar;
-    while (isalnum((LastChar = getchar())))
-      IdentifierStr += LastChar;
-
-    if (IdentifierStr == "def") return tok_def;
-    if (IdentifierStr == "extern") return tok_extern;
-    if (IdentifierStr == "if") return tok_if;
-    if (IdentifierStr == "then") return tok_then;
-    if (IdentifierStr == "else") return tok_else;
-    if (IdentifierStr == "for") return tok_for;
-    if (IdentifierStr == "in") return tok_in;
-    if (IdentifierStr == "binary") return tok_binary;
-    if (IdentifierStr == "unary") return tok_unary;
-    if (IdentifierStr == "var") return tok_var;
-    return tok_identifier;
-  }
-
-  if (isdigit(LastChar) || LastChar == '.') {   // Number: [0-9.]+
-    std::string NumStr;
-    do {
-      NumStr += LastChar;
-      LastChar = getchar();
-    } while (isdigit(LastChar) || LastChar == '.');
-
-    NumVal = strtod(NumStr.c_str(), 0);
-    return tok_number;
-  }
-
-  if (LastChar == '#') {
-    // Comment until end of line.
-    do LastChar = getchar();
-    while (LastChar != EOF &amp;&amp; LastChar != '\n' &amp;&amp; LastChar != '\r');
-    
-    if (LastChar != EOF)
-      return gettok();
-  }
-  
-  // Check for end of file.  Don't eat the EOF.
-  if (LastChar == EOF)
-    return tok_eof;
-
-  // Otherwise, just return the character as its ascii value.
-  int ThisChar = LastChar;
-  LastChar = getchar();
-  return ThisChar;
-}
-
-//===----------------------------------------------------------------------===//
-// Abstract Syntax Tree (aka Parse Tree)
-//===----------------------------------------------------------------------===//
-
-/// ExprAST - Base class for all expression nodes.
-class ExprAST {
-public:
-  virtual ~ExprAST() {}
-  virtual Value *Codegen() = 0;
-};
-
-/// NumberExprAST - Expression class for numeric literals like "1.0".
-class NumberExprAST : public ExprAST {
-  double Val;
-public:
-  NumberExprAST(double val) : Val(val) {}
-  virtual Value *Codegen();
-};
-
-/// VariableExprAST - Expression class for referencing a variable, like "a".
-class VariableExprAST : public ExprAST {
-  std::string Name;
-public:
-  VariableExprAST(const std::string &amp;name) : Name(name) {}
-  const std::string &amp;getName() const { return Name; }
-  virtual Value *Codegen();
-};
-
-/// UnaryExprAST - Expression class for a unary operator.
-class UnaryExprAST : public ExprAST {
-  char Opcode;
-  ExprAST *Operand;
-public:
-  UnaryExprAST(char opcode, ExprAST *operand) 
-    : Opcode(opcode), Operand(operand) {}
-  virtual Value *Codegen();
-};
-
-/// BinaryExprAST - Expression class for a binary operator.
-class BinaryExprAST : public ExprAST {
-  char Op;
-  ExprAST *LHS, *RHS;
-public:
-  BinaryExprAST(char op, ExprAST *lhs, ExprAST *rhs) 
-    : Op(op), LHS(lhs), RHS(rhs) {}
-  virtual Value *Codegen();
-};
-
-/// CallExprAST - Expression class for function calls.
-class CallExprAST : public ExprAST {
-  std::string Callee;
-  std::vector&lt;ExprAST*&gt; Args;
-public:
-  CallExprAST(const std::string &amp;callee, std::vector&lt;ExprAST*&gt; &amp;args)
-    : Callee(callee), Args(args) {}
-  virtual Value *Codegen();
-};
-
-/// IfExprAST - Expression class for if/then/else.
-class IfExprAST : public ExprAST {
-  ExprAST *Cond, *Then, *Else;
-public:
-  IfExprAST(ExprAST *cond, ExprAST *then, ExprAST *_else)
-  : Cond(cond), Then(then), Else(_else) {}
-  virtual Value *Codegen();
-};
-
-/// ForExprAST - Expression class for for/in.
-class ForExprAST : public ExprAST {
-  std::string VarName;
-  ExprAST *Start, *End, *Step, *Body;
-public:
-  ForExprAST(const std::string &amp;varname, ExprAST *start, ExprAST *end,
-             ExprAST *step, ExprAST *body)
-    : VarName(varname), Start(start), End(end), Step(step), Body(body) {}
-  virtual Value *Codegen();
-};
-
-/// VarExprAST - Expression class for var/in
-class VarExprAST : public ExprAST {
-  std::vector&lt;std::pair&lt;std::string, ExprAST*&gt; &gt; VarNames;
-  ExprAST *Body;
-public:
-  VarExprAST(const std::vector&lt;std::pair&lt;std::string, ExprAST*&gt; &gt; &amp;varnames,
-             ExprAST *body)
-  : VarNames(varnames), Body(body) {}
-  
-  virtual Value *Codegen();
-};
-
-/// PrototypeAST - This class represents the "prototype" for a function,
-/// which captures its name, and its argument names (thus implicitly the number
-/// of arguments the function takes), as well as if it is an operator.
-class PrototypeAST {
-  std::string Name;
-  std::vector&lt;std::string&gt; Args;
-  bool isOperator;
-  unsigned Precedence;  // Precedence if a binary op.
-public:
-  PrototypeAST(const std::string &amp;name, const std::vector&lt;std::string&gt; &amp;args,
-               bool isoperator = false, unsigned prec = 0)
-  : Name(name), Args(args), isOperator(isoperator), Precedence(prec) {}
-  
-  bool isUnaryOp() const { return isOperator &amp;&amp; Args.size() == 1; }
-  bool isBinaryOp() const { return isOperator &amp;&amp; Args.size() == 2; }
-  
-  char getOperatorName() const {
-    assert(isUnaryOp() || isBinaryOp());
-    return Name[Name.size()-1];
-  }
-  
-  unsigned getBinaryPrecedence() const { return Precedence; }
-  
-  Function *Codegen();
-  
-  void CreateArgumentAllocas(Function *F);
-};
-
-/// FunctionAST - This class represents a function definition itself.
-class FunctionAST {
-  PrototypeAST *Proto;
-  ExprAST *Body;
-public:
-  FunctionAST(PrototypeAST *proto, ExprAST *body)
-    : Proto(proto), Body(body) {}
-  
-  Function *Codegen();
-};
-
-//===----------------------------------------------------------------------===//
-// Parser
-//===----------------------------------------------------------------------===//
-
-/// CurTok/getNextToken - Provide a simple token buffer.  CurTok is the current
-/// token the parser is looking at.  getNextToken reads another token from the
-/// lexer and updates CurTok with its results.
-static int CurTok;
-static int getNextToken() {
-  return CurTok = gettok();
-}
-
-/// BinopPrecedence - This holds the precedence for each binary operator that is
-/// defined.
-static std::map&lt;char, int&gt; BinopPrecedence;
-
-/// GetTokPrecedence - Get the precedence of the pending binary operator token.
-static int GetTokPrecedence() {
-  if (!isascii(CurTok))
-    return -1;
-  
-  // Make sure it's a declared binop.
-  int TokPrec = BinopPrecedence[CurTok];
-  if (TokPrec &lt;= 0) return -1;
-  return TokPrec;
-}
-
-/// Error* - These are little helper functions for error handling.
-ExprAST *Error(const char *Str) { fprintf(stderr, "Error: %s\n", Str);return 0;}
-PrototypeAST *ErrorP(const char *Str) { Error(Str); return 0; }
-FunctionAST *ErrorF(const char *Str) { Error(Str); return 0; }
-
-static ExprAST *ParseExpression();
-
-/// identifierexpr
-///   ::= identifier
-///   ::= identifier '(' expression* ')'
-static ExprAST *ParseIdentifierExpr() {
-  std::string IdName = IdentifierStr;
-  
-  getNextToken();  // eat identifier.
-  
-  if (CurTok != '(') // Simple variable ref.
-    return new VariableExprAST(IdName);
-  
-  // Call.
-  getNextToken();  // eat (
-  std::vector&lt;ExprAST*&gt; Args;
-  if (CurTok != ')') {
-    while (1) {
-      ExprAST *Arg = ParseExpression();
-      if (!Arg) return 0;
-      Args.push_back(Arg);
-
-      if (CurTok == ')') break;
-
-      if (CurTok != ',')
-        return Error("Expected ')' or ',' in argument list");
-      getNextToken();
-    }
-  }
-
-  // Eat the ')'.
-  getNextToken();
-  
-  return new CallExprAST(IdName, Args);
-}
-
-/// numberexpr ::= number
-static ExprAST *ParseNumberExpr() {
-  ExprAST *Result = new NumberExprAST(NumVal);
-  getNextToken(); // consume the number
-  return Result;
-}
-
-/// parenexpr ::= '(' expression ')'
-static ExprAST *ParseParenExpr() {
-  getNextToken();  // eat (.
-  ExprAST *V = ParseExpression();
-  if (!V) return 0;
-  
-  if (CurTok != ')')
-    return Error("expected ')'");
-  getNextToken();  // eat ).
-  return V;
-}
-
-/// ifexpr ::= 'if' expression 'then' expression 'else' expression
-static ExprAST *ParseIfExpr() {
-  getNextToken();  // eat the if.
-  
-  // condition.
-  ExprAST *Cond = ParseExpression();
-  if (!Cond) return 0;
-  
-  if (CurTok != tok_then)
-    return Error("expected then");
-  getNextToken();  // eat the then
-  
-  ExprAST *Then = ParseExpression();
-  if (Then == 0) return 0;
-  
-  if (CurTok != tok_else)
-    return Error("expected else");
-  
-  getNextToken();
-  
-  ExprAST *Else = ParseExpression();
-  if (!Else) return 0;
-  
-  return new IfExprAST(Cond, Then, Else);
-}
-
-/// forexpr ::= 'for' identifier '=' expr ',' expr (',' expr)? 'in' expression
-static ExprAST *ParseForExpr() {
-  getNextToken();  // eat the for.
-
-  if (CurTok != tok_identifier)
-    return Error("expected identifier after for");
-  
-  std::string IdName = IdentifierStr;
-  getNextToken();  // eat identifier.
-  
-  if (CurTok != '=')
-    return Error("expected '=' after for");
-  getNextToken();  // eat '='.
-  
-  
-  ExprAST *Start = ParseExpression();
-  if (Start == 0) return 0;
-  if (CurTok != ',')
-    return Error("expected ',' after for start value");
-  getNextToken();
-  
-  ExprAST *End = ParseExpression();
-  if (End == 0) return 0;
-  
-  // The step value is optional.
-  ExprAST *Step = 0;
-  if (CurTok == ',') {
-    getNextToken();
-    Step = ParseExpression();
-    if (Step == 0) return 0;
-  }
-  
-  if (CurTok != tok_in)
-    return Error("expected 'in' after for");
-  getNextToken();  // eat 'in'.
-  
-  ExprAST *Body = ParseExpression();
-  if (Body == 0) return 0;
-
-  return new ForExprAST(IdName, Start, End, Step, Body);
-}
-
-/// varexpr ::= 'var' identifier ('=' expression)? 
-//                    (',' identifier ('=' expression)?)* 'in' expression
-static ExprAST *ParseVarExpr() {
-  getNextToken();  // eat the var.
-
-  std::vector&lt;std::pair&lt;std::string, ExprAST*&gt; &gt; VarNames;
-
-  // At least one variable name is required.
-  if (CurTok != tok_identifier)
-    return Error("expected identifier after var");
-  
-  while (1) {
-    std::string Name = IdentifierStr;
-    getNextToken();  // eat identifier.
-
-    // Read the optional initializer.
-    ExprAST *Init = 0;
-    if (CurTok == '=') {
-      getNextToken(); // eat the '='.
-      
-      Init = ParseExpression();
-      if (Init == 0) return 0;
-    }
-    
-    VarNames.push_back(std::make_pair(Name, Init));
-    
-    // End of var list, exit loop.
-    if (CurTok != ',') break;
-    getNextToken(); // eat the ','.
-    
-    if (CurTok != tok_identifier)
-      return Error("expected identifier list after var");
-  }
-  
-  // At this point, we have to have 'in'.
-  if (CurTok != tok_in)
-    return Error("expected 'in' keyword after 'var'");
-  getNextToken();  // eat 'in'.
-  
-  ExprAST *Body = ParseExpression();
-  if (Body == 0) return 0;
-  
-  return new VarExprAST(VarNames, Body);
-}
-
-/// primary
-///   ::= identifierexpr
-///   ::= numberexpr
-///   ::= parenexpr
-///   ::= ifexpr
-///   ::= forexpr
-///   ::= varexpr
-static ExprAST *ParsePrimary() {
-  switch (CurTok) {
-  default: return Error("unknown token when expecting an expression");
-  case tok_identifier: return ParseIdentifierExpr();
-  case tok_number:     return ParseNumberExpr();
-  case '(':            return ParseParenExpr();
-  case tok_if:         return ParseIfExpr();
-  case tok_for:        return ParseForExpr();
-  case tok_var:        return ParseVarExpr();
-  }
-}
-
-/// unary
-///   ::= primary
-///   ::= '!' unary
-static ExprAST *ParseUnary() {
-  // If the current token is not an operator, it must be a primary expr.
-  if (!isascii(CurTok) || CurTok == '(' || CurTok == ',')
-    return ParsePrimary();
-  
-  // If this is a unary operator, read it.
-  int Opc = CurTok;
-  getNextToken();
-  if (ExprAST *Operand = ParseUnary())
-    return new UnaryExprAST(Opc, Operand);
-  return 0;
-}
-
-/// binoprhs
-///   ::= ('+' unary)*
-static ExprAST *ParseBinOpRHS(int ExprPrec, ExprAST *LHS) {
-  // If this is a binop, find its precedence.
-  while (1) {
-    int TokPrec = GetTokPrecedence();
-    
-    // If this is a binop that binds at least as tightly as the current binop,
-    // consume it, otherwise we are done.
-    if (TokPrec &lt; ExprPrec)
-      return LHS;
-    
-    // Okay, we know this is a binop.
-    int BinOp = CurTok;
-    getNextToken();  // eat binop
-    
-    // Parse the unary expression after the binary operator.
-    ExprAST *RHS = ParseUnary();
-    if (!RHS) return 0;
-    
-    // If BinOp binds less tightly with RHS than the operator after RHS, let
-    // the pending operator take RHS as its LHS.
-    int NextPrec = GetTokPrecedence();
-    if (TokPrec &lt; NextPrec) {
-      RHS = ParseBinOpRHS(TokPrec+1, RHS);
-      if (RHS == 0) return 0;
-    }
-    
-    // Merge LHS/RHS.
-    LHS = new BinaryExprAST(BinOp, LHS, RHS);
-  }
-}
-
-/// expression
-///   ::= unary binoprhs
-///
-static ExprAST *ParseExpression() {
-  ExprAST *LHS = ParseUnary();
-  if (!LHS) return 0;
-  
-  return ParseBinOpRHS(0, LHS);
-}
-
-/// prototype
-///   ::= id '(' id* ')'
-///   ::= binary LETTER number? (id, id)
-///   ::= unary LETTER (id)
-static PrototypeAST *ParsePrototype() {
-  std::string FnName;
-  
-  unsigned Kind = 0; // 0 = identifier, 1 = unary, 2 = binary.
-  unsigned BinaryPrecedence = 30;
-  
-  switch (CurTok) {
-  default:
-    return ErrorP("Expected function name in prototype");
-  case tok_identifier:
-    FnName = IdentifierStr;
-    Kind = 0;
-    getNextToken();
-    break;
-  case tok_unary:
-    getNextToken();
-    if (!isascii(CurTok))
-      return ErrorP("Expected unary operator");
-    FnName = "unary";
-    FnName += (char)CurTok;
-    Kind = 1;
-    getNextToken();
-    break;
-  case tok_binary:
-    getNextToken();
-    if (!isascii(CurTok))
-      return ErrorP("Expected binary operator");
-    FnName = "binary";
-    FnName += (char)CurTok;
-    Kind = 2;
-    getNextToken();
-    
-    // Read the precedence if present.
-    if (CurTok == tok_number) {
-      if (NumVal &lt; 1 || NumVal &gt; 100)
-        return ErrorP("Invalid precedecnce: must be 1..100");
-      BinaryPrecedence = (unsigned)NumVal;
-      getNextToken();
-    }
-    break;
-  }
-  
-  if (CurTok != '(')
-    return ErrorP("Expected '(' in prototype");
-  
-  std::vector&lt;std::string&gt; ArgNames;
-  while (getNextToken() == tok_identifier)
-    ArgNames.push_back(IdentifierStr);
-  if (CurTok != ')')
-    return ErrorP("Expected ')' in prototype");
-  
-  // success.
-  getNextToken();  // eat ')'.
-  
-  // Verify right number of names for operator.
-  if (Kind &amp;&amp; ArgNames.size() != Kind)
-    return ErrorP("Invalid number of operands for operator");
-  
-  return new PrototypeAST(FnName, ArgNames, Kind != 0, BinaryPrecedence);
-}
-
-/// definition ::= 'def' prototype expression
-static FunctionAST *ParseDefinition() {
-  getNextToken();  // eat def.
-  PrototypeAST *Proto = ParsePrototype();
-  if (Proto == 0) return 0;
-
-  if (ExprAST *E = ParseExpression())
-    return new FunctionAST(Proto, E);
-  return 0;
-}
-
-/// toplevelexpr ::= expression
-static FunctionAST *ParseTopLevelExpr() {
-  if (ExprAST *E = ParseExpression()) {
-    // Make an anonymous proto.
-    PrototypeAST *Proto = new PrototypeAST("", std::vector&lt;std::string&gt;());
-    return new FunctionAST(Proto, E);
-  }
-  return 0;
-}
-
-/// external ::= 'extern' prototype
-static PrototypeAST *ParseExtern() {
-  getNextToken();  // eat extern.
-  return ParsePrototype();
-}
-
-//===----------------------------------------------------------------------===//
-// Code Generation
-//===----------------------------------------------------------------------===//
-
-static Module *TheModule;
-static IRBuilder&lt;&gt; Builder(getGlobalContext());
-static std::map&lt;std::string, AllocaInst*&gt; NamedValues;
-static FunctionPassManager *TheFPM;
-
-Value *ErrorV(const char *Str) { Error(Str); return 0; }
-
-/// CreateEntryBlockAlloca - Create an alloca instruction in the entry block of
-/// the function.  This is used for mutable variables etc.
-static AllocaInst *CreateEntryBlockAlloca(Function *TheFunction,
-                                          const std::string &amp;VarName) {
-  IRBuilder&lt;&gt; TmpB(&amp;TheFunction-&gt;getEntryBlock(),
-                 TheFunction-&gt;getEntryBlock().begin());
-  return TmpB.CreateAlloca(Type::getDoubleTy(getGlobalContext()), 0,
-                           VarName.c_str());
-}
-
-Value *NumberExprAST::Codegen() {
-  return ConstantFP::get(getGlobalContext(), APFloat(Val));
-}
-
-Value *VariableExprAST::Codegen() {
-  // Look this variable up in the function.
-  Value *V = NamedValues[Name];
-  if (V == 0) return ErrorV("Unknown variable name");
-
-  // Load the value.
-  return Builder.CreateLoad(V, Name.c_str());
-}
-
-Value *UnaryExprAST::Codegen() {
-  Value *OperandV = Operand-&gt;Codegen();
-  if (OperandV == 0) return 0;
-  
-  Function *F = TheModule-&gt;getFunction(std::string("unary")+Opcode);
-  if (F == 0)
-    return ErrorV("Unknown unary operator");
-  
-  return Builder.CreateCall(F, OperandV, "unop");
-}
-
-Value *BinaryExprAST::Codegen() {
-  // Special case '=' because we don't want to emit the LHS as an expression.
-  if (Op == '=') {
-    // Assignment requires the LHS to be an identifier.
-    VariableExprAST *LHSE = dynamic_cast&lt;VariableExprAST*&gt;(LHS);
-    if (!LHSE)
-      return ErrorV("destination of '=' must be a variable");
-    // Codegen the RHS.
-    Value *Val = RHS-&gt;Codegen();
-    if (Val == 0) return 0;
-
-    // Look up the name.
-    Value *Variable = NamedValues[LHSE-&gt;getName()];
-    if (Variable == 0) return ErrorV("Unknown variable name");
-
-    Builder.CreateStore(Val, Variable);
-    return Val;
-  }
-  
-  Value *L = LHS-&gt;Codegen();
-  Value *R = RHS-&gt;Codegen();
-  if (L == 0 || R == 0) return 0;
-  
-  switch (Op) {
-  case '+': return Builder.CreateAdd(L, R, "addtmp");
-  case '-': return Builder.CreateSub(L, R, "subtmp");
-  case '*': return Builder.CreateMul(L, R, "multmp");
-  case '&lt;':
-    L = Builder.CreateFCmpULT(L, R, "cmptmp");
-    // Convert bool 0/1 to double 0.0 or 1.0
-    return Builder.CreateUIToFP(L, Type::getDoubleTy(getGlobalContext()),
-                                "booltmp");
-  default: break;
-  }
-  
-  // If it wasn't a builtin binary operator, it must be a user defined one. Emit
-  // a call to it.
-  Function *F = TheModule-&gt;getFunction(std::string("binary")+Op);
-  assert(F &amp;&amp; "binary operator not found!");
-  
-  Value *Ops[] = { L, R };
-  return Builder.CreateCall(F, Ops, Ops+2, "binop");
-}
-
-Value *CallExprAST::Codegen() {
-  // Look up the name in the global module table.
-  Function *CalleeF = TheModule-&gt;getFunction(Callee);
-  if (CalleeF == 0)
-    return ErrorV("Unknown function referenced");
-  
-  // If argument mismatch error.
-  if (CalleeF-&gt;arg_size() != Args.size())
-    return ErrorV("Incorrect # arguments passed");
-
-  std::vector&lt;Value*&gt; ArgsV;
-  for (unsigned i = 0, e = Args.size(); i != e; ++i) {
-    ArgsV.push_back(Args[i]-&gt;Codegen());
-    if (ArgsV.back() == 0) return 0;
-  }
-  
-  return Builder.CreateCall(CalleeF, ArgsV.begin(), ArgsV.end(), "calltmp");
-}
-
-Value *IfExprAST::Codegen() {
-  Value *CondV = Cond-&gt;Codegen();
-  if (CondV == 0) return 0;
-  
-  // Convert condition to a bool by comparing equal to 0.0.
-  CondV = Builder.CreateFCmpONE(CondV, 
-                              ConstantFP::get(getGlobalContext(), APFloat(0.0)),
-                                "ifcond");
-  
-  Function *TheFunction = Builder.GetInsertBlock()-&gt;getParent();
-  
-  // Create blocks for the then and else cases.  Insert the 'then' block at the
-  // end of the function.
-  BasicBlock *ThenBB = BasicBlock::Create(getGlobalContext(), "then", TheFunction);
-  BasicBlock *ElseBB = BasicBlock::Create(getGlobalContext(), "else");
-  BasicBlock *MergeBB = BasicBlock::Create(getGlobalContext(), "ifcont");
-  
-  Builder.CreateCondBr(CondV, ThenBB, ElseBB);
-  
-  // Emit then value.
-  Builder.SetInsertPoint(ThenBB);
-  
-  Value *ThenV = Then-&gt;Codegen();
-  if (ThenV == 0) return 0;
-  
-  Builder.CreateBr(MergeBB);
-  // Codegen of 'Then' can change the current block, update ThenBB for the PHI.
-  ThenBB = Builder.GetInsertBlock();
-  
-  // Emit else block.
-  TheFunction-&gt;getBasicBlockList().push_back(ElseBB);
-  Builder.SetInsertPoint(ElseBB);
-  
-  Value *ElseV = Else-&gt;Codegen();
-  if (ElseV == 0) return 0;
-  
-  Builder.CreateBr(MergeBB);
-  // Codegen of 'Else' can change the current block, update ElseBB for the PHI.
-  ElseBB = Builder.GetInsertBlock();
-  
-  // Emit merge block.
-  TheFunction-&gt;getBasicBlockList().push_back(MergeBB);
-  Builder.SetInsertPoint(MergeBB);
-  PHINode *PN = Builder.CreatePHI(Type::getDoubleTy(getGlobalContext()),
-                                  "iftmp");
-  
-  PN-&gt;addIncoming(ThenV, ThenBB);
-  PN-&gt;addIncoming(ElseV, ElseBB);
-  return PN;
-}
-
-Value *ForExprAST::Codegen() {
-  // Output this as:
-  //   var = alloca double
-  //   ...
-  //   start = startexpr
-  //   store start -&gt; var
-  //   goto loop
-  // loop: 
-  //   ...
-  //   bodyexpr
-  //   ...
-  // loopend:
-  //   step = stepexpr
-  //   endcond = endexpr
-  //
-  //   curvar = load var
-  //   nextvar = curvar + step
-  //   store nextvar -&gt; var
-  //   br endcond, loop, endloop
-  // outloop:
-  
-  Function *TheFunction = Builder.GetInsertBlock()-&gt;getParent();
-
-  // Create an alloca for the variable in the entry block.
-  AllocaInst *Alloca = CreateEntryBlockAlloca(TheFunction, VarName);
-  
-  // Emit the start code first, without 'variable' in scope.
-  Value *StartVal = Start-&gt;Codegen();
-  if (StartVal == 0) return 0;
-  
-  // Store the value into the alloca.
-  Builder.CreateStore(StartVal, Alloca);
-  
-  // Make the new basic block for the loop header, inserting after current
-  // block.
-  BasicBlock *LoopBB = BasicBlock::Create(getGlobalContext(), "loop", TheFunction);
-  
-  // Insert an explicit fall through from the current block to the LoopBB.
-  Builder.CreateBr(LoopBB);
-
-  // Start insertion in LoopBB.
-  Builder.SetInsertPoint(LoopBB);
-  
-  // Within the loop, the variable is defined equal to the PHI node.  If it
-  // shadows an existing variable, we have to restore it, so save it now.
-  AllocaInst *OldVal = NamedValues[VarName];
-  NamedValues[VarName] = Alloca;
-  
-  // Emit the body of the loop.  This, like any other expr, can change the
-  // current BB.  Note that we ignore the value computed by the body, but don't
-  // allow an error.
-  if (Body-&gt;Codegen() == 0)
-    return 0;
-  
-  // Emit the step value.
-  Value *StepVal;
-  if (Step) {
-    StepVal = Step-&gt;Codegen();
-    if (StepVal == 0) return 0;
-  } else {
-    // If not specified, use 1.0.
-    StepVal = ConstantFP::get(getGlobalContext(), APFloat(1.0));
-  }
-  
-  // Compute the end condition.
-  Value *EndCond = End-&gt;Codegen();
-  if (EndCond == 0) return EndCond;
-  
-  // Reload, increment, and restore the alloca.  This handles the case where
-  // the body of the loop mutates the variable.
-  Value *CurVar = Builder.CreateLoad(Alloca, VarName.c_str());
-  Value *NextVar = Builder.CreateAdd(CurVar, StepVal, "nextvar");
-  Builder.CreateStore(NextVar, Alloca);
-  
-  // Convert condition to a bool by comparing equal to 0.0.
-  EndCond = Builder.CreateFCmpONE(EndCond, 
-                              ConstantFP::get(getGlobalContext(), APFloat(0.0)),
-                                  "loopcond");
-  
-  // Create the "after loop" block and insert it.
-  BasicBlock *AfterBB = BasicBlock::Create(getGlobalContext(), "afterloop", TheFunction);
-  
-  // Insert the conditional branch into the end of LoopEndBB.
-  Builder.CreateCondBr(EndCond, LoopBB, AfterBB);
-  
-  // Any new code will be inserted in AfterBB.
-  Builder.SetInsertPoint(AfterBB);
-  
-  // Restore the unshadowed variable.
-  if (OldVal)
-    NamedValues[VarName] = OldVal;
-  else
-    NamedValues.erase(VarName);
-
-  
-  // for expr always returns 0.0.
-  return Constant::getNullValue(Type::getDoubleTy(getGlobalContext()));
-}
-
-Value *VarExprAST::Codegen() {
-  std::vector&lt;AllocaInst *&gt; OldBindings;
-  
-  Function *TheFunction = Builder.GetInsertBlock()-&gt;getParent();
-
-  // Register all variables and emit their initializer.
-  for (unsigned i = 0, e = VarNames.size(); i != e; ++i) {
-    const std::string &amp;VarName = VarNames[i].first;
-    ExprAST *Init = VarNames[i].second;
-    
-    // Emit the initializer before adding the variable to scope, this prevents
-    // the initializer from referencing the variable itself, and permits stuff
-    // like this:
-    //  var a = 1 in
-    //    var a = a in ...   # refers to outer 'a'.
-    Value *InitVal;
-    if (Init) {
-      InitVal = Init-&gt;Codegen();
-      if (InitVal == 0) return 0;
-    } else { // If not specified, use 0.0.
-      InitVal = ConstantFP::get(getGlobalContext(), APFloat(0.0));
-    }
-    
-    AllocaInst *Alloca = CreateEntryBlockAlloca(TheFunction, VarName);
-    Builder.CreateStore(InitVal, Alloca);
-
-    // Remember the old variable binding so that we can restore the binding when
-    // we unrecurse.
-    OldBindings.push_back(NamedValues[VarName]);
-    
-    // Remember this binding.
-    NamedValues[VarName] = Alloca;
-  }
-  
-  // Codegen the body, now that all vars are in scope.
-  Value *BodyVal = Body-&gt;Codegen();
-  if (BodyVal == 0) return 0;
-  
-  // Pop all our variables from scope.
-  for (unsigned i = 0, e = VarNames.size(); i != e; ++i)
-    NamedValues[VarNames[i].first] = OldBindings[i];
-
-  // Return the body computation.
-  return BodyVal;
-}
-
-Function *PrototypeAST::Codegen() {
-  // Make the function type:  double(double,double) etc.
-  std::vector&lt;const Type*&gt; Doubles(Args.size(),
-                                   Type::getDoubleTy(getGlobalContext()));
-  FunctionType *FT = FunctionType::get(Type::getDoubleTy(getGlobalContext()),
-                                       Doubles, false);
-  
-  Function *F = Function::Create(FT, Function::ExternalLinkage, Name, TheModule);
-  
-  // If F conflicted, there was already something named 'Name'.  If it has a
-  // body, don't allow redefinition or reextern.
-  if (F-&gt;getName() != Name) {
-    // Delete the one we just made and get the existing one.
-    F-&gt;eraseFromParent();
-    F = TheModule-&gt;getFunction(Name);
-    
-    // If F already has a body, reject this.
-    if (!F-&gt;empty()) {
-      ErrorF("redefinition of function");
-      return 0;
-    }
-    
-    // If F took a different number of args, reject.
-    if (F-&gt;arg_size() != Args.size()) {
-      ErrorF("redefinition of function with different # args");
-      return 0;
-    }
-  }
-  
-  // Set names for all arguments.
-  unsigned Idx = 0;
-  for (Function::arg_iterator AI = F-&gt;arg_begin(); Idx != Args.size();
-       ++AI, ++Idx)
-    AI-&gt;setName(Args[Idx]);
-    
-  return F;
-}
-
-/// CreateArgumentAllocas - Create an alloca for each argument and register the
-/// argument in the symbol table so that references to it will succeed.
-void PrototypeAST::CreateArgumentAllocas(Function *F) {
-  Function::arg_iterator AI = F-&gt;arg_begin();
-  for (unsigned Idx = 0, e = Args.size(); Idx != e; ++Idx, ++AI) {
-    // Create an alloca for this variable.
-    AllocaInst *Alloca = CreateEntryBlockAlloca(F, Args[Idx]);
-
-    // Store the initial value into the alloca.
-    Builder.CreateStore(AI, Alloca);
-
-    // Add arguments to variable symbol table.
-    NamedValues[Args[Idx]] = Alloca;
-  }
-}
-
-Function *FunctionAST::Codegen() {
-  NamedValues.clear();
-  
-  Function *TheFunction = Proto-&gt;Codegen();
-  if (TheFunction == 0)
-    return 0;
-  
-  // If this is an operator, install it.
-  if (Proto-&gt;isBinaryOp())
-    BinopPrecedence[Proto-&gt;getOperatorName()] = Proto-&gt;getBinaryPrecedence();
-  
-  // Create a new basic block to start insertion into.
-  BasicBlock *BB = BasicBlock::Create(getGlobalContext(), "entry", TheFunction);
-  Builder.SetInsertPoint(BB);
-  
-  // Add all arguments to the symbol table and create their allocas.
-  Proto-&gt;CreateArgumentAllocas(TheFunction);
-
-  if (Value *RetVal = Body-&gt;Codegen()) {
-    // Finish off the function.
-    Builder.CreateRet(RetVal);
-
-    // Validate the generated code, checking for consistency.
-    verifyFunction(*TheFunction);
-
-    // Optimize the function.
-    TheFPM-&gt;run(*TheFunction);
-    
-    return TheFunction;
-  }
-  
-  // Error reading body, remove function.
-  TheFunction-&gt;eraseFromParent();
-
-  if (Proto-&gt;isBinaryOp())
-    BinopPrecedence.erase(Proto-&gt;getOperatorName());
-  return 0;
-}
-
-//===----------------------------------------------------------------------===//
-// Top-Level parsing and JIT Driver
-//===----------------------------------------------------------------------===//
-
-static ExecutionEngine *TheExecutionEngine;
-
-static void HandleDefinition() {
-  if (FunctionAST *F = ParseDefinition()) {
-    if (Function *LF = F-&gt;Codegen()) {
-      fprintf(stderr, "Read function definition:");
-      LF-&gt;dump();
-    }
-  } else {
-    // Skip token for error recovery.
-    getNextToken();
-  }
-}
-
-static void HandleExtern() {
-  if (PrototypeAST *P = ParseExtern()) {
-    if (Function *F = P-&gt;Codegen()) {
-      fprintf(stderr, "Read extern: ");
-      F-&gt;dump();
-    }
-  } else {
-    // Skip token for error recovery.
-    getNextToken();
-  }
-}
-
-static void HandleTopLevelExpression() {
-  // Evaluate a top-level expression into an anonymous function.
-  if (FunctionAST *F = ParseTopLevelExpr()) {
-    if (Function *LF = F-&gt;Codegen()) {
-      // JIT the function, returning a function pointer.
-      void *FPtr = TheExecutionEngine-&gt;getPointerToFunction(LF);
-      
-      // Cast it to the right type (takes no arguments, returns a double) so we
-      // can call it as a native function.
-      double (*FP)() = (double (*)())(intptr_t)FPtr;
-      fprintf(stderr, "Evaluated to %f\n", FP());
-    }
-  } else {
-    // Skip token for error recovery.
-    getNextToken();
-  }
-}
-
-/// top ::= definition | external | expression | ';'
-static void MainLoop() {
-  while (1) {
-    fprintf(stderr, "ready&gt; ");
-    switch (CurTok) {
-    case tok_eof:    return;
-    case ';':        getNextToken(); break;  // ignore top-level semicolons.
-    case tok_def:    HandleDefinition(); break;
-    case tok_extern: HandleExtern(); break;
-    default:         HandleTopLevelExpression(); break;
-    }
-  }
-}
-
-//===----------------------------------------------------------------------===//
-// "Library" functions that can be "extern'd" from user code.
-//===----------------------------------------------------------------------===//
-
-/// putchard - putchar that takes a double and returns 0.
-extern "C" 
-double putchard(double X) {
-  putchar((char)X);
-  return 0;
-}
-
-/// printd - printf that takes a double prints it as "%f\n", returning 0.
-extern "C" 
-double printd(double X) {
-  printf("%f\n", X);
-  return 0;
-}
-
-//===----------------------------------------------------------------------===//
-// Main driver code.
-//===----------------------------------------------------------------------===//
-
-int main() {
-  InitializeNativeTarget();
-  LLVMContext &amp;Context = getGlobalContext();
-
-  // Install standard binary operators.
-  // 1 is lowest precedence.
-  BinopPrecedence['='] = 2;
-  BinopPrecedence['&lt;'] = 10;
-  BinopPrecedence['+'] = 20;
-  BinopPrecedence['-'] = 20;
-  BinopPrecedence['*'] = 40;  // highest.
-
-  // Prime the first token.
-  fprintf(stderr, "ready&gt; ");
-  getNextToken();
-
-  // Make the module, which holds all the code.
-  TheModule = new Module("my cool jit", Context);
-
-  // Create the JIT.  This takes ownership of the module.
-  std::string ErrStr;
-  TheExecutionEngine = EngineBuilder(TheModule).setErrorStr(&amp;ErrStr).create();
-  if (!TheExecutionEngine) {
-    fprintf(stderr, "Could not create ExecutionEngine: %s\n", ErrStr.c_str());
-    exit(1);
-  }
-
-  FunctionPassManager OurFPM(TheModule);
-
-  // Set up the optimizer pipeline.  Start with registering info about how the
-  // target lays out data structures.
-  OurFPM.add(new TargetData(*TheExecutionEngine-&gt;getTargetData()));
-  // Promote allocas to registers.
-  OurFPM.add(createPromoteMemoryToRegisterPass());
-  // Do simple "peephole" optimizations and bit-twiddling optzns.
-  OurFPM.add(createInstructionCombiningPass());
-  // Reassociate expressions.
-  OurFPM.add(createReassociatePass());
-  // Eliminate Common SubExpressions.
-  OurFPM.add(createGVNPass());
-  // Simplify the control flow graph (deleting unreachable blocks, etc).
-  OurFPM.add(createCFGSimplificationPass());
-
-  OurFPM.doInitialization();
-
-  // Set the global so the code gen can use this.
-  TheFPM = &amp;OurFPM;
-
-  // Run the main "interpreter loop" now.
-  MainLoop();
-
-  TheFPM = 0;
-
-  // Print out all of the generated code.
-  TheModule-&gt;dump();
-
-  return 0;
-}
-</pre>
-</div>
-
-<a href="LangImpl8.html">Next: Conclusion and other useful LLVM tidbits</a>
-</div>
-
-<!-- *********************************************************************** -->
-<hr>
-<address>
-  <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
-  src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"></a>
-  <a href="http://validator.w3.org/check/referer"><img
-  src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"></a>
-
-  <a href="mailto:sabre at nondot.org">Chris Lattner</a><br>
-  <a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
-  Last modified: $Date$
-</address>
-</body>
-</html>
diff --git a/libclamav/c++/llvm/docs/tutorial/LangImpl8.html b/libclamav/c++/llvm/docs/tutorial/LangImpl8.html
deleted file mode 100644
index 64a6200..0000000
--- a/libclamav/c++/llvm/docs/tutorial/LangImpl8.html
+++ /dev/null
@@ -1,365 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-                      "http://www.w3.org/TR/html4/strict.dtd">
-
-<html>
-<head>
-  <title>Kaleidoscope: Conclusion and other useful LLVM tidbits</title>
-  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-  <meta name="author" content="Chris Lattner">
-  <link rel="stylesheet" href="../llvm.css" type="text/css">
-</head>
-
-<body>
-
-<div class="doc_title">Kaleidoscope: Conclusion and other useful LLVM
- tidbits</div>
-
-<ul>
-<li><a href="index.html">Up to Tutorial Index</a></li>
-<li>Chapter 8
-  <ol>
-    <li><a href="#conclusion">Tutorial Conclusion</a></li>
-    <li><a href="#llvmirproperties">Properties of LLVM IR</a>
-    <ul>
-      <li><a href="#targetindep">Target Independence</a></li>
-      <li><a href="#safety">Safety Guarantees</a></li>
-      <li><a href="#langspecific">Language-Specific Optimizations</a></li>
-    </ul>
-    </li>
-    <li><a href="#tipsandtricks">Tips and Tricks</a>
-    <ul>
-      <li><a href="#offsetofsizeof">Implementing portable 
-                                    offsetof/sizeof</a></li>
-      <li><a href="#gcstack">Garbage Collected Stack Frames</a></li>
-    </ul>
-    </li>
-  </ol>
-</li>
-</ul>
-
-
-<div class="doc_author">
-  <p>Written by <a href="mailto:sabre at nondot.org">Chris Lattner</a></p>
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="conclusion">Tutorial Conclusion</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>Welcome to the the final chapter of the "<a href="index.html">Implementing a
-language with LLVM</a>" tutorial.  In the course of this tutorial, we have grown
-our little Kaleidoscope language from being a useless toy, to being a
-semi-interesting (but probably still useless) toy. :)</p>
-
-<p>It is interesting to see how far we've come, and how little code it has
-taken.  We built the entire lexer, parser, AST, code generator, and an 
-interactive run-loop (with a JIT!) by-hand in under 700 lines of
-(non-comment/non-blank) code.</p>
-
-<p>Our little language supports a couple of interesting features: it supports
-user defined binary and unary operators, it uses JIT compilation for immediate
-evaluation, and it supports a few control flow constructs with SSA construction.
-</p>
-
-<p>Part of the idea of this tutorial was to show you how easy and fun it can be
-to define, build, and play with languages.  Building a compiler need not be a
-scary or mystical process!  Now that you've seen some of the basics, I strongly
-encourage you to take the code and hack on it.  For example, try adding:</p>
-
-<ul>
-<li><b>global variables</b> - While global variables have questional value in
-modern software engineering, they are often useful when putting together quick
-little hacks like the Kaleidoscope compiler itself.  Fortunately, our current
-setup makes it very easy to add global variables: just have value lookup check
-to see if an unresolved variable is in the global variable symbol table before
-rejecting it.  To create a new global variable, make an instance of the LLVM
-<tt>GlobalVariable</tt> class.</li>
-
-<li><b>typed variables</b> - Kaleidoscope currently only supports variables of
-type double.  This gives the language a very nice elegance, because only
-supporting one type means that you never have to specify types.  Different
-languages have different ways of handling this.  The easiest way is to require
-the user to specify types for every variable definition, and record the type
-of the variable in the symbol table along with its Value*.</li>
-
-<li><b>arrays, structs, vectors, etc</b> - Once you add types, you can start
-extending the type system in all sorts of interesting ways.  Simple arrays are
-very easy and are quite useful for many different applications.  Adding them is
-mostly an exercise in learning how the LLVM <a 
-href="../LangRef.html#i_getelementptr">getelementptr</a> instruction works: it
-is so nifty/unconventional, it <a 
-href="../GetElementPtr.html">has its own FAQ</a>!  If you add support
-for recursive types (e.g. linked lists), make sure to read the <a 
-href="../ProgrammersManual.html#TypeResolve">section in the LLVM
-Programmer's Manual</a> that describes how to construct them.</li>
-
-<li><b>standard runtime</b> - Our current language allows the user to access
-arbitrary external functions, and we use it for things like "printd" and
-"putchard".  As you extend the language to add higher-level constructs, often
-these constructs make the most sense if they are lowered to calls into a
-language-supplied runtime.  For example, if you add hash tables to the language,
-it would probably make sense to add the routines to a runtime, instead of 
-inlining them all the way.</li>
-
-<li><b>memory management</b> - Currently we can only access the stack in
-Kaleidoscope.  It would also be useful to be able to allocate heap memory,
-either with calls to the standard libc malloc/free interface or with a garbage
-collector.  If you would like to use garbage collection, note that LLVM fully
-supports <a href="../GarbageCollection.html">Accurate Garbage Collection</a>
-including algorithms that move objects and need to scan/update the stack.</li>
-
-<li><b>debugger support</b> - LLVM supports generation of <a 
-href="../SourceLevelDebugging.html">DWARF Debug info</a> which is understood by
-common debuggers like GDB.  Adding support for debug info is fairly 
-straightforward.  The best way to understand it is to compile some C/C++ code
-with "<tt>llvm-gcc -g -O0</tt>" and taking a look at what it produces.</li>
-
-<li><b>exception handling support</b> - LLVM supports generation of <a 
-href="../ExceptionHandling.html">zero cost exceptions</a> which interoperate
-with code compiled in other languages.  You could also generate code by
-implicitly making every function return an error value and checking it.  You 
-could also make explicit use of setjmp/longjmp.  There are many different ways
-to go here.</li>
-
-<li><b>object orientation, generics, database access, complex numbers,
-geometric programming, ...</b> - Really, there is
-no end of crazy features that you can add to the language.</li>
-
-<li><b>unusual domains</b> - We've been talking about applying LLVM to a domain
-that many people are interested in: building a compiler for a specific language.
-However, there are many other domains that can use compiler technology that are
-not typically considered.  For example, LLVM has been used to implement OpenGL
-graphics acceleration, translate C++ code to ActionScript, and many other
-cute and clever things.  Maybe you will be the first to JIT compile a regular
-expression interpreter into native code with LLVM?</li>
-
-</ul>
-
-<p>
-Have fun - try doing something crazy and unusual.  Building a language like
-everyone else always has, is much less fun than trying something a little crazy
-or off the wall and seeing how it turns out.  If you get stuck or want to talk
-about it, feel free to email the <a 
-href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">llvmdev mailing 
-list</a>: it has lots of people who are interested in languages and are often
-willing to help out.
-</p>
-
-<p>Before we end this tutorial, I want to talk about some "tips and tricks" for generating
-LLVM IR.  These are some of the more subtle things that may not be obvious, but
-are very useful if you want to take advantage of LLVM's capabilities.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="llvmirproperties">Properties of the LLVM 
-IR</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>We have a couple common questions about code in the LLVM IR form - lets just
-get these out of the way right now, shall we?</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection"><a name="targetindep">Target 
-Independence</a></div>
-<!-- ======================================================================= -->
-
-<div class="doc_text">
-
-<p>Kaleidoscope is an example of a "portable language": any program written in
-Kaleidoscope will work the same way on any target that it runs on.  Many other
-languages have this property, e.g. lisp, java, haskell, javascript, python, etc
-(note that while these languages are portable, not all their libraries are).</p>
-
-<p>One nice aspect of LLVM is that it is often capable of preserving target
-independence in the IR: you can take the LLVM IR for a Kaleidoscope-compiled 
-program and run it on any target that LLVM supports, even emitting C code and
-compiling that on targets that LLVM doesn't support natively.  You can trivially
-tell that the Kaleidoscope compiler generates target-independent code because it
-never queries for any target-specific information when generating code.</p>
-
-<p>The fact that LLVM provides a compact, target-independent, representation for
-code gets a lot of people excited.  Unfortunately, these people are usually
-thinking about C or a language from the C family when they are asking questions
-about language portability.  I say "unfortunately", because there is really no
-way to make (fully general) C code portable, other than shipping the source code
-around (and of course, C source code is not actually portable in general
-either - ever port a really old application from 32- to 64-bits?).</p>
-
-<p>The problem with C (again, in its full generality) is that it is heavily
-laden with target specific assumptions.  As one simple example, the preprocessor
-often destructively removes target-independence from the code when it processes
-the input text:</p>
-
-<div class="doc_code">
-<pre>
-#ifdef __i386__
-  int X = 1;
-#else
-  int X = 42;
-#endif
-</pre>
-</div>
-
-<p>While it is possible to engineer more and more complex solutions to problems
-like this, it cannot be solved in full generality in a way that is better than shipping
-the actual source code.</p>
-
-<p>That said, there are interesting subsets of C that can be made portable.  If
-you are willing to fix primitive types to a fixed size (say int = 32-bits, 
-and long = 64-bits), don't care about ABI compatibility with existing binaries,
-and are willing to give up some other minor features, you can have portable
-code.  This can make sense for specialized domains such as an
-in-kernel language.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection"><a name="safety">Safety Guarantees</a></div>
-<!-- ======================================================================= -->
-
-<div class="doc_text">
-
-<p>Many of the languages above are also "safe" languages: it is impossible for
-a program written in Java to corrupt its address space and crash the process
-(assuming the JVM has no bugs).
-Safety is an interesting property that requires a combination of language
-design, runtime support, and often operating system support.</p>
-
-<p>It is certainly possible to implement a safe language in LLVM, but LLVM IR
-does not itself guarantee safety.  The LLVM IR allows unsafe pointer casts,
-use after free bugs, buffer over-runs, and a variety of other problems.  Safety
-needs to be implemented as a layer on top of LLVM and, conveniently, several
-groups have investigated this.  Ask on the <a 
-href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">llvmdev mailing 
-list</a> if you are interested in more details.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection"><a name="langspecific">Language-Specific 
-Optimizations</a></div>
-<!-- ======================================================================= -->
-
-<div class="doc_text">
-
-<p>One thing about LLVM that turns off many people is that it does not solve all
-the world's problems in one system (sorry 'world hunger', someone else will have
-to solve you some other day).  One specific complaint is that people perceive
-LLVM as being incapable of performing high-level language-specific optimization:
-LLVM "loses too much information".</p>
-
-<p>Unfortunately, this is really not the place to give you a full and unified
-version of "Chris Lattner's theory of compiler design".  Instead, I'll make a
-few observations:</p>
-
-<p>First, you're right that LLVM does lose information.  For example, as of this
-writing, there is no way to distinguish in the LLVM IR whether an SSA-value came
-from a C "int" or a C "long" on an ILP32 machine (other than debug info).  Both
-get compiled down to an 'i32' value and the information about what it came from
-is lost.  The more general issue here, is that the LLVM type system uses
-"structural equivalence" instead of "name equivalence".  Another place this
-surprises people is if you have two types in a high-level language that have the
-same structure (e.g. two different structs that have a single int field): these
-types will compile down into a single LLVM type and it will be impossible to
-tell what it came from.</p>
-
-<p>Second, while LLVM does lose information, LLVM is not a fixed target: we 
-continue to enhance and improve it in many different ways.  In addition to
-adding new features (LLVM did not always support exceptions or debug info), we
-also extend the IR to capture important information for optimization (e.g.
-whether an argument is sign or zero extended, information about pointers
-aliasing, etc).  Many of the enhancements are user-driven: people want LLVM to
-include some specific feature, so they go ahead and extend it.</p>
-
-<p>Third, it is <em>possible and easy</em> to add language-specific
-optimizations, and you have a number of choices in how to do it.  As one trivial
-example, it is easy to add language-specific optimization passes that
-"know" things about code compiled for a language.  In the case of the C family,
-there is an optimization pass that "knows" about the standard C library
-functions.  If you call "exit(0)" in main(), it knows that it is safe to
-optimize that into "return 0;" because C specifies what the 'exit'
-function does.</p>
-
-<p>In addition to simple library knowledge, it is possible to embed a variety of
-other language-specific information into the LLVM IR.  If you have a specific
-need and run into a wall, please bring the topic up on the llvmdev list.  At the
-very worst, you can always treat LLVM as if it were a "dumb code generator" and
-implement the high-level optimizations you desire in your front-end, on the
-language-specific AST.
-</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="tipsandtricks">Tips and Tricks</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>There is a variety of useful tips and tricks that you come to know after
-working on/with LLVM that aren't obvious at first glance.  Instead of letting
-everyone rediscover them, this section talks about some of these issues.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection"><a name="offsetofsizeof">Implementing portable
-offsetof/sizeof</a></div>
-<!-- ======================================================================= -->
-
-<div class="doc_text">
-
-<p>One interesting thing that comes up, if you are trying to keep the code 
-generated by your compiler "target independent", is that you often need to know
-the size of some LLVM type or the offset of some field in an llvm structure.
-For example, you might need to pass the size of a type into a function that
-allocates memory.</p>
-
-<p>Unfortunately, this can vary widely across targets: for example the width of
-a pointer is trivially target-specific.  However, there is a <a 
-href="http://nondot.org/sabre/LLVMNotes/SizeOf-OffsetOf-VariableSizedStructs.txt">clever
-way to use the getelementptr instruction</a> that allows you to compute this
-in a portable way.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection"><a name="gcstack">Garbage Collected 
-Stack Frames</a></div>
-<!-- ======================================================================= -->
-
-<div class="doc_text">
-
-<p>Some languages want to explicitly manage their stack frames, often so that
-they are garbage collected or to allow easy implementation of closures.  There
-are often better ways to implement these features than explicit stack frames,
-but <a 
-href="http://nondot.org/sabre/LLVMNotes/ExplicitlyManagedStackFrames.txt">LLVM
-does support them,</a> if you want.  It requires your front-end to convert the
-code into <a 
-href="http://en.wikipedia.org/wiki/Continuation-passing_style">Continuation
-Passing Style</a> and the use of tail calls (which LLVM also supports).</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<hr>
-<address>
-  <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
-  src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"></a>
-  <a href="http://validator.w3.org/check/referer"><img
-  src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"></a>
-
-  <a href="mailto:sabre at nondot.org">Chris Lattner</a><br>
-  <a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
-  Last modified: $Date$
-</address>
-</body>
-</html>
diff --git a/libclamav/c++/llvm/docs/tutorial/Makefile b/libclamav/c++/llvm/docs/tutorial/Makefile
deleted file mode 100644
index 6169bb8..0000000
--- a/libclamav/c++/llvm/docs/tutorial/Makefile
+++ /dev/null
@@ -1,28 +0,0 @@
-##===- docs/tutorial/Makefile ------------------------------*- Makefile -*-===##
-#
-#                     The LLVM Compiler Infrastructure
-#
-# This file is distributed under the University of Illinois Open Source
-# License. See LICENSE.TXT for details.
-#
-##===----------------------------------------------------------------------===##
-
-LEVEL := ../..
-include $(LEVEL)/Makefile.common
-
-HTML       := $(wildcard $(PROJ_SRC_DIR)/*.html)
-EXTRA_DIST := $(HTML) index.html
-HTML_DIR   := $(PROJ_docsdir)/html/tutorial
-
-install-local:: $(HTML)
-	$(Echo) Installing HTML Tutorial Documentation
-	$(Verb) $(MKDIR) $(HTML_DIR)
-	$(Verb) $(DataInstall) $(HTML) $(HTML_DIR)
-	$(Verb) $(DataInstall) $(PROJ_SRC_DIR)/index.html $(HTML_DIR)
-
-uninstall-local::
-	$(Echo) Uninstalling Tutorial Documentation
-	$(Verb) $(RM) -rf $(HTML_DIR)
-
-printvars::
-	$(Echo) "HTML           : " '$(HTML)'
diff --git a/libclamav/c++/llvm/docs/tutorial/OCamlLangImpl1.html b/libclamav/c++/llvm/docs/tutorial/OCamlLangImpl1.html
deleted file mode 100644
index 98c1124..0000000
--- a/libclamav/c++/llvm/docs/tutorial/OCamlLangImpl1.html
+++ /dev/null
@@ -1,365 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-                      "http://www.w3.org/TR/html4/strict.dtd">
-
-<html>
-<head>
-  <title>Kaleidoscope: Tutorial Introduction and the Lexer</title>
-  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-  <meta name="author" content="Chris Lattner">
-  <meta name="author" content="Erick Tryzelaar">
-  <link rel="stylesheet" href="../llvm.css" type="text/css">
-</head>
-
-<body>
-
-<div class="doc_title">Kaleidoscope: Tutorial Introduction and the Lexer</div>
-
-<ul>
-<li><a href="index.html">Up to Tutorial Index</a></li>
-<li>Chapter 1
-  <ol>
-    <li><a href="#intro">Tutorial Introduction</a></li>
-    <li><a href="#language">The Basic Language</a></li>
-    <li><a href="#lexer">The Lexer</a></li>
-  </ol>
-</li>
-<li><a href="OCamlLangImpl2.html">Chapter 2</a>: Implementing a Parser and
-AST</li>
-</ul>
-
-<div class="doc_author">
-	<p>
-		Written by <a href="mailto:sabre at nondot.org">Chris Lattner</a>
-		and <a href="mailto:idadesub at users.sourceforge.net">Erick Tryzelaar</a>
-	</p>
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="intro">Tutorial Introduction</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>Welcome to the "Implementing a language with LLVM" tutorial.  This tutorial
-runs through the implementation of a simple language, showing how fun and
-easy it can be.  This tutorial will get you up and started as well as help to
-build a framework you can extend to other languages.  The code in this tutorial
-can also be used as a playground to hack on other LLVM specific things.
-</p>
-
-<p>
-The goal of this tutorial is to progressively unveil our language, describing
-how it is built up over time.  This will let us cover a fairly broad range of
-language design and LLVM-specific usage issues, showing and explaining the code
-for it all along the way, without overwhelming you with tons of details up
-front.</p>
-
-<p>It is useful to point out ahead of time that this tutorial is really about
-teaching compiler techniques and LLVM specifically, <em>not</em> about teaching
-modern and sane software engineering principles.  In practice, this means that
-we'll take a number of shortcuts to simplify the exposition.  For example, the
-code leaks memory, uses global variables all over the place, doesn't use nice
-design patterns like <a
-href="http://en.wikipedia.org/wiki/Visitor_pattern">visitors</a>, etc... but it
-is very simple.  If you dig in and use the code as a basis for future projects,
-fixing these deficiencies shouldn't be hard.</p>
-
-<p>I've tried to put this tutorial together in a way that makes chapters easy to
-skip over if you are already familiar with or are uninterested in the various
-pieces.  The structure of the tutorial is:
-</p>
-
-<ul>
-<li><b><a href="#language">Chapter #1</a>: Introduction to the Kaleidoscope
-language, and the definition of its Lexer</b> - This shows where we are going
-and the basic functionality that we want it to do.  In order to make this
-tutorial maximally understandable and hackable, we choose to implement
-everything in Objective Caml instead of using lexer and parser generators.
-LLVM obviously works just fine with such tools, feel free to use one if you
-prefer.</li>
-<li><b><a href="OCamlLangImpl2.html">Chapter #2</a>: Implementing a Parser and
-AST</b> - With the lexer in place, we can talk about parsing techniques and
-basic AST construction.  This tutorial describes recursive descent parsing and
-operator precedence parsing.  Nothing in Chapters 1 or 2 is LLVM-specific,
-the code doesn't even link in LLVM at this point. :)</li>
-<li><b><a href="OCamlLangImpl3.html">Chapter #3</a>: Code generation to LLVM
-IR</b> - With the AST ready, we can show off how easy generation of LLVM IR
-really is.</li>
-<li><b><a href="OCamlLangImpl4.html">Chapter #4</a>: Adding JIT and Optimizer
-Support</b> - Because a lot of people are interested in using LLVM as a JIT,
-we'll dive right into it and show you the 3 lines it takes to add JIT support.
-LLVM is also useful in many other ways, but this is one simple and "sexy" way
-to shows off its power. :)</li>
-<li><b><a href="OCamlLangImpl5.html">Chapter #5</a>: Extending the Language:
-Control Flow</b> - With the language up and running, we show how to extend it
-with control flow operations (if/then/else and a 'for' loop).  This gives us a
-chance to talk about simple SSA construction and control flow.</li>
-<li><b><a href="OCamlLangImpl6.html">Chapter #6</a>: Extending the Language:
-User-defined Operators</b> - This is a silly but fun chapter that talks about
-extending the language to let the user program define their own arbitrary
-unary and binary operators (with assignable precedence!).  This lets us build a
-significant piece of the "language" as library routines.</li>
-<li><b><a href="OCamlLangImpl7.html">Chapter #7</a>: Extending the Language:
-Mutable Variables</b> - This chapter talks about adding user-defined local
-variables along with an assignment operator.  The interesting part about this
-is how easy and trivial it is to construct SSA form in LLVM: no, LLVM does
-<em>not</em> require your front-end to construct SSA form!</li>
-<li><b><a href="OCamlLangImpl8.html">Chapter #8</a>: Conclusion and other
-useful LLVM tidbits</b> - This chapter wraps up the series by talking about
-potential ways to extend the language, but also includes a bunch of pointers to
-info about "special topics" like adding garbage collection support, exceptions,
-debugging, support for "spaghetti stacks", and a bunch of other tips and
-tricks.</li>
-
-</ul>
-
-<p>By the end of the tutorial, we'll have written a bit less than 700 lines of
-non-comment, non-blank, lines of code.  With this small amount of code, we'll
-have built up a very reasonable compiler for a non-trivial language including
-a hand-written lexer, parser, AST, as well as code generation support with a JIT
-compiler.  While other systems may have interesting "hello world" tutorials,
-I think the breadth of this tutorial is a great testament to the strengths of
-LLVM and why you should consider it if you're interested in language or compiler
-design.</p>
-
-<p>A note about this tutorial: we expect you to extend the language and play
-with it on your own.  Take the code and go crazy hacking away at it, compilers
-don't need to be scary creatures - it can be a lot of fun to play with
-languages!</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="language">The Basic Language</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>This tutorial will be illustrated with a toy language that we'll call
-"<a href="http://en.wikipedia.org/wiki/Kaleidoscope">Kaleidoscope</a>" (derived
-from "meaning beautiful, form, and view").
-Kaleidoscope is a procedural language that allows you to define functions, use
-conditionals, math, etc.  Over the course of the tutorial, we'll extend
-Kaleidoscope to support the if/then/else construct, a for loop, user defined
-operators, JIT compilation with a simple command line interface, etc.</p>
-
-<p>Because we want to keep things simple, the only datatype in Kaleidoscope is a
-64-bit floating point type (aka 'float' in O'Caml parlance).  As such, all
-values are implicitly double precision and the language doesn't require type
-declarations.  This gives the language a very nice and simple syntax.  For
-example, the following simple example computes <a
-href="http://en.wikipedia.org/wiki/Fibonacci_number">Fibonacci numbers:</a></p>
-
-<div class="doc_code">
-<pre>
-# Compute the x'th fibonacci number.
-def fib(x)
-  if x &lt; 3 then
-    1
-  else
-    fib(x-1)+fib(x-2)
-
-# This expression will compute the 40th number.
-fib(40)
-</pre>
-</div>
-
-<p>We also allow Kaleidoscope to call into standard library functions (the LLVM
-JIT makes this completely trivial).  This means that you can use the 'extern'
-keyword to define a function before you use it (this is also useful for mutually
-recursive functions).  For example:</p>
-
-<div class="doc_code">
-<pre>
-extern sin(arg);
-extern cos(arg);
-extern atan2(arg1 arg2);
-
-atan2(sin(.4), cos(42))
-</pre>
-</div>
-
-<p>A more interesting example is included in Chapter 6 where we write a little
-Kaleidoscope application that <a href="OCamlLangImpl6.html#example">displays
-a Mandelbrot Set</a> at various levels of magnification.</p>
-
-<p>Lets dive into the implementation of this language!</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="lexer">The Lexer</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>When it comes to implementing a language, the first thing needed is
-the ability to process a text file and recognize what it says.  The traditional
-way to do this is to use a "<a
-href="http://en.wikipedia.org/wiki/Lexical_analysis">lexer</a>" (aka 'scanner')
-to break the input up into "tokens".  Each token returned by the lexer includes
-a token code and potentially some metadata (e.g. the numeric value of a number).
-First, we define the possibilities:
-</p>
-
-<div class="doc_code">
-<pre>
-(* The lexer returns these 'Kwd' if it is an unknown character, otherwise one of
- * these others for known things. *)
-type token =
-  (* commands *)
-  | Def | Extern
-
-  (* primary *)
-  | Ident of string | Number of float
-
-  (* unknown *)
-  | Kwd of char
-</pre>
-</div>
-
-<p>Each token returned by our lexer will be one of the token variant values.
-An unknown character like '+' will be returned as <tt>Token.Kwd '+'</tt>.  If
-the curr token is an identifier, the value will be <tt>Token.Ident s</tt>.  If
-the current token is a numeric literal (like 1.0), the value will be
-<tt>Token.Number 1.0</tt>.
-</p>
-
-<p>The actual implementation of the lexer is a collection of functions driven
-by a function named <tt>Lexer.lex</tt>.  The <tt>Lexer.lex</tt> function is
-called to return the next token from standard input.  We will use
-<a href="http://caml.inria.fr/pub/docs/manual-camlp4/index.html">Camlp4</a>
-to simplify the tokenization of the standard input.  Its definition starts
-as:</p>
-
-<div class="doc_code">
-<pre>
-(*===----------------------------------------------------------------------===
- * Lexer
- *===----------------------------------------------------------------------===*)
-
-let rec lex = parser
-  (* Skip any whitespace. *)
-  | [&lt; ' (' ' | '\n' | '\r' | '\t'); stream &gt;] -&gt; lex stream
-</pre>
-</div>
-
-<p>
-<tt>Lexer.lex</tt> works by recursing over a <tt>char Stream.t</tt> to read
-characters one at a time from the standard input.  It eats them as it recognizes
-them and stores them in in a <tt>Token.token</tt> variant.  The first thing that
-it has to do is ignore whitespace between tokens.  This is accomplished with the
-recursive call above.</p>
-
-<p>The next thing <tt>Lexer.lex</tt> needs to do is recognize identifiers and
-specific keywords like "def".  Kaleidoscope does this with a pattern match
-and a helper function.<p>
-
-<div class="doc_code">
-<pre>
-  (* identifier: [a-zA-Z][a-zA-Z0-9] *)
-  | [&lt; ' ('A' .. 'Z' | 'a' .. 'z' as c); stream &gt;] -&gt;
-      let buffer = Buffer.create 1 in
-      Buffer.add_char buffer c;
-      lex_ident buffer stream
-
-...
-
-and lex_ident buffer = parser
-  | [&lt; ' ('A' .. 'Z' | 'a' .. 'z' | '0' .. '9' as c); stream &gt;] -&gt;
-      Buffer.add_char buffer c;
-      lex_ident buffer stream
-  | [&lt; stream=lex &gt;] -&gt;
-      match Buffer.contents buffer with
-      | "def" -&gt; [&lt; 'Token.Def; stream &gt;]
-      | "extern" -&gt; [&lt; 'Token.Extern; stream &gt;]
-      | id -&gt; [&lt; 'Token.Ident id; stream &gt;]
-</pre>
-</div>
-
-<p>Numeric values are similar:</p>
-
-<div class="doc_code">
-<pre>
-  (* number: [0-9.]+ *)
-  | [&lt; ' ('0' .. '9' as c); stream &gt;] -&gt;
-      let buffer = Buffer.create 1 in
-      Buffer.add_char buffer c;
-      lex_number buffer stream
-
-...
-
-and lex_number buffer = parser
-  | [&lt; ' ('0' .. '9' | '.' as c); stream &gt;] -&gt;
-      Buffer.add_char buffer c;
-      lex_number buffer stream
-  | [&lt; stream=lex &gt;] -&gt;
-      [&lt; 'Token.Number (float_of_string (Buffer.contents buffer)); stream &gt;]
-</pre>
-</div>
-
-<p>This is all pretty straight-forward code for processing input.  When reading
-a numeric value from input, we use the ocaml <tt>float_of_string</tt> function
-to convert it to a numeric value that we store in <tt>Token.Number</tt>.  Note
-that this isn't doing sufficient error checking: it will raise <tt>Failure</tt>
-if the string "1.23.45.67".  Feel free to extend it :).  Next we handle
-comments:
-</p>
-
-<div class="doc_code">
-<pre>
-  (* Comment until end of line. *)
-  | [&lt; ' ('#'); stream &gt;] -&gt;
-      lex_comment stream
-
-...
-
-and lex_comment = parser
-  | [&lt; ' ('\n'); stream=lex &gt;] -&gt; stream
-  | [&lt; 'c; e=lex_comment &gt;] -&gt; e
-  | [&lt; &gt;] -&gt; [&lt; &gt;]
-</pre>
-</div>
-
-<p>We handle comments by skipping to the end of the line and then return the
-next token.  Finally, if the input doesn't match one of the above cases, it is
-either an operator character like '+' or the end of the file.  These are handled
-with this code:</p>
-
-<div class="doc_code">
-<pre>
-  (* Otherwise, just return the character as its ascii value. *)
-  | [&lt; 'c; stream &gt;] -&gt;
-      [&lt; 'Token.Kwd c; lex stream &gt;]
-
-  (* end of stream. *)
-  | [&lt; &gt;] -&gt; [&lt; &gt;]
-</pre>
-</div>
-
-<p>With this, we have the complete lexer for the basic Kaleidoscope language
-(the <a href="OCamlLangImpl2.html#code">full code listing</a> for the Lexer is
-available in the <a href="OCamlLangImpl2.html">next chapter</a> of the
-tutorial).  Next we'll <a href="OCamlLangImpl2.html">build a simple parser that
-uses this to build an Abstract Syntax Tree</a>.  When we have that, we'll
-include a driver so that you can use the lexer and parser together.
-</p>
-
-<a href="OCamlLangImpl2.html">Next: Implementing a Parser and AST</a>
-</div>
-
-<!-- *********************************************************************** -->
-<hr>
-<address>
-  <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
-  src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"></a>
-  <a href="http://validator.w3.org/check/referer"><img
-  src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"></a>
-
-  <a href="mailto:sabre at nondot.org">Chris Lattner</a><br>
-  <a href="mailto:idadesub at users.sourceforge.net">Erick Tryzelaar</a><br>
-  <a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
-  Last modified: $Date$
-</address>
-</body>
-</html>
diff --git a/libclamav/c++/llvm/docs/tutorial/OCamlLangImpl2.html b/libclamav/c++/llvm/docs/tutorial/OCamlLangImpl2.html
deleted file mode 100644
index 6665109..0000000
--- a/libclamav/c++/llvm/docs/tutorial/OCamlLangImpl2.html
+++ /dev/null
@@ -1,1045 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-                      "http://www.w3.org/TR/html4/strict.dtd">
-
-<html>
-<head>
-  <title>Kaleidoscope: Implementing a Parser and AST</title>
-  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-  <meta name="author" content="Chris Lattner">
-  <meta name="author" content="Erick Tryzelaar">
-  <link rel="stylesheet" href="../llvm.css" type="text/css">
-</head>
-
-<body>
-
-<div class="doc_title">Kaleidoscope: Implementing a Parser and AST</div>
-
-<ul>
-<li><a href="index.html">Up to Tutorial Index</a></li>
-<li>Chapter 2
-  <ol>
-    <li><a href="#intro">Chapter 2 Introduction</a></li>
-    <li><a href="#ast">The Abstract Syntax Tree (AST)</a></li>
-    <li><a href="#parserbasics">Parser Basics</a></li>
-    <li><a href="#parserprimexprs">Basic Expression Parsing</a></li>
-    <li><a href="#parserbinops">Binary Expression Parsing</a></li>
-    <li><a href="#parsertop">Parsing the Rest</a></li>
-    <li><a href="#driver">The Driver</a></li>
-    <li><a href="#conclusions">Conclusions</a></li>
-    <li><a href="#code">Full Code Listing</a></li>
-  </ol>
-</li>
-<li><a href="OCamlLangImpl3.html">Chapter 3</a>: Code generation to LLVM IR</li>
-</ul>
-
-<div class="doc_author">
-	<p>
-		Written by <a href="mailto:sabre at nondot.org">Chris Lattner</a>
-		and <a href="mailto:idadesub at users.sourceforge.net">Erick Tryzelaar</a>
-	</p>
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="intro">Chapter 2 Introduction</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>Welcome to Chapter 2 of the "<a href="index.html">Implementing a language
-with LLVM in Objective Caml</a>" tutorial.  This chapter shows you how to use
-the lexer, built in <a href="OCamlLangImpl1.html">Chapter 1</a>, to build a
-full <a href="http://en.wikipedia.org/wiki/Parsing">parser</a> for our
-Kaleidoscope language.  Once we have a parser, we'll define and build an <a
-href="http://en.wikipedia.org/wiki/Abstract_syntax_tree">Abstract Syntax
-Tree</a> (AST).</p>
-
-<p>The parser we will build uses a combination of <a
-href="http://en.wikipedia.org/wiki/Recursive_descent_parser">Recursive Descent
-Parsing</a> and <a href=
-"http://en.wikipedia.org/wiki/Operator-precedence_parser">Operator-Precedence
-Parsing</a> to parse the Kaleidoscope language (the latter for
-binary expressions and the former for everything else).  Before we get to
-parsing though, lets talk about the output of the parser: the Abstract Syntax
-Tree.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="ast">The Abstract Syntax Tree (AST)</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>The AST for a program captures its behavior in such a way that it is easy for
-later stages of the compiler (e.g. code generation) to interpret.  We basically
-want one object for each construct in the language, and the AST should closely
-model the language.  In Kaleidoscope, we have expressions, a prototype, and a
-function object.  We'll start with expressions first:</p>
-
-<div class="doc_code">
-<pre>
-(* expr - Base type for all expression nodes. *)
-type expr =
-  (* variant for numeric literals like "1.0". *)
-  | Number of float
-</pre>
-</div>
-
-<p>The code above shows the definition of the base ExprAST class and one
-subclass which we use for numeric literals.  The important thing to note about
-this code is that the Number variant captures the numeric value of the
-literal as an instance variable. This allows later phases of the compiler to
-know what the stored numeric value is.</p>
-
-<p>Right now we only create the AST,  so there are no useful functions on
-them.  It would be very easy to add a function to pretty print the code,
-for example.  Here are the other expression AST node definitions that we'll use
-in the basic form of the Kaleidoscope language:
-</p>
-
-<div class="doc_code">
-<pre>
-  (* variant for referencing a variable, like "a". *)
-  | Variable of string
-
-  (* variant for a binary operator. *)
-  | Binary of char * expr * expr
-
-  (* variant for function calls. *)
-  | Call of string * expr array
-</pre>
-</div>
-
-<p>This is all (intentionally) rather straight-forward: variables capture the
-variable name, binary operators capture their opcode (e.g. '+'), and calls
-capture a function name as well as a list of any argument expressions.  One thing
-that is nice about our AST is that it captures the language features without
-talking about the syntax of the language.  Note that there is no discussion about
-precedence of binary operators, lexical structure, etc.</p>
-
-<p>For our basic language, these are all of the expression nodes we'll define.
-Because it doesn't have conditional control flow, it isn't Turing-complete;
-we'll fix that in a later installment.  The two things we need next are a way
-to talk about the interface to a function, and a way to talk about functions
-themselves:</p>
-
-<div class="doc_code">
-<pre>
-(* proto - This type represents the "prototype" for a function, which captures
- * its name, and its argument names (thus implicitly the number of arguments the
- * function takes). *)
-type proto = Prototype of string * string array
-
-(* func - This type represents a function definition itself. *)
-type func = Function of proto * expr
-</pre>
-</div>
-
-<p>In Kaleidoscope, functions are typed with just a count of their arguments.
-Since all values are double precision floating point, the type of each argument
-doesn't need to be stored anywhere.  In a more aggressive and realistic
-language, the "expr" variants would probably have a type field.</p>
-
-<p>With this scaffolding, we can now talk about parsing expressions and function
-bodies in Kaleidoscope.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="parserbasics">Parser Basics</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>Now that we have an AST to build, we need to define the parser code to build
-it.  The idea here is that we want to parse something like "x+y" (which is
-returned as three tokens by the lexer) into an AST that could be generated with
-calls like this:</p>
-
-<div class="doc_code">
-<pre>
-  let x = Variable "x" in
-  let y = Variable "y" in
-  let result = Binary ('+', x, y) in
-  ...
-</pre>
-</div>
-
-<p>
-The error handling routines make use of the builtin <tt>Stream.Failure</tt> and
-<tt>Stream.Error</tt>s.  <tt>Stream.Failure</tt> is raised when the parser is
-unable to find any matching token in the first position of a pattern.
-<tt>Stream.Error</tt> is raised when the first token matches, but the rest do
-not.  The error recovery in our parser will not be the best and is not
-particular user-friendly, but it will be enough for our tutorial.  These
-exceptions make it easier to handle errors in routines that have various return
-types.</p>
-
-<p>With these basic types and exceptions, we can implement the first
-piece of our grammar: numeric literals.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="parserprimexprs">Basic Expression
- Parsing</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>We start with numeric literals, because they are the simplest to process.
-For each production in our grammar, we'll define a function which parses that
-production.  We call this class of expressions "primary" expressions, for
-reasons that will become more clear <a href="OCamlLangImpl6.html#unary">
-later in the tutorial</a>.  In order to parse an arbitrary primary expression,
-we need to determine what sort of expression it is.  For numeric literals, we
-have:</p>
-
-<div class="doc_code">
-<pre>
-(* primary
- *   ::= identifier
- *   ::= numberexpr
- *   ::= parenexpr *)
-parse_primary = parser
-  (* numberexpr ::= number *)
-  | [&lt; 'Token.Number n &gt;] -&gt; Ast.Number n
-</pre>
-</div>
-
-<p>This routine is very simple: it expects to be called when the current token
-is a <tt>Token.Number</tt> token.  It takes the current number value, creates
-a <tt>Ast.Number</tt> node, advances the lexer to the next token, and finally
-returns.</p>
-
-<p>There are some interesting aspects to this.  The most important one is that
-this routine eats all of the tokens that correspond to the production and
-returns the lexer buffer with the next token (which is not part of the grammar
-production) ready to go.  This is a fairly standard way to go for recursive
-descent parsers.  For a better example, the parenthesis operator is defined like
-this:</p>
-
-<div class="doc_code">
-<pre>
-  (* parenexpr ::= '(' expression ')' *)
-  | [&lt; 'Token.Kwd '('; e=parse_expr; 'Token.Kwd ')' ?? "expected ')'" &gt;] -&gt; e
-</pre>
-</div>
-
-<p>This function illustrates a number of interesting things about the
-parser:</p>
-
-<p>
-1) It shows how we use the <tt>Stream.Error</tt> exception.  When called, this
-function expects that the current token is a '(' token, but after parsing the
-subexpression, it is possible that there is no ')' waiting.  For example, if
-the user types in "(4 x" instead of "(4)", the parser should emit an error.
-Because errors can occur, the parser needs a way to indicate that they
-happened. In our parser, we use the camlp4 shortcut syntax <tt>token ?? "parse
-error"</tt>, where if the token before the <tt>??</tt> does not match, then
-<tt>Stream.Error "parse error"</tt> will be raised.</p>
-
-<p>2) Another interesting aspect of this function is that it uses recursion by
-calling <tt>Parser.parse_primary</tt> (we will soon see that
-<tt>Parser.parse_primary</tt> can call <tt>Parser.parse_primary</tt>).  This is
-powerful because it allows us to handle recursive grammars, and keeps each
-production very simple.  Note that parentheses do not cause construction of AST
-nodes themselves.  While we could do it this way, the most important role of
-parentheses are to guide the parser and provide grouping.  Once the parser
-constructs the AST, parentheses are not needed.</p>
-
-<p>The next simple production is for handling variable references and function
-calls:</p>
-
-<div class="doc_code">
-<pre>
-  (* identifierexpr
-   *   ::= identifier
-   *   ::= identifier '(' argumentexpr ')' *)
-  | [&lt; 'Token.Ident id; stream &gt;] -&gt;
-      let rec parse_args accumulator = parser
-        | [&lt; e=parse_expr; stream &gt;] -&gt;
-            begin parser
-              | [&lt; 'Token.Kwd ','; e=parse_args (e :: accumulator) &gt;] -&gt; e
-              | [&lt; &gt;] -&gt; e :: accumulator
-            end stream
-        | [&lt; &gt;] -&gt; accumulator
-      in
-      let rec parse_ident id = parser
-        (* Call. *)
-        | [&lt; 'Token.Kwd '(';
-             args=parse_args [];
-             'Token.Kwd ')' ?? "expected ')'"&gt;] -&gt;
-            Ast.Call (id, Array.of_list (List.rev args))
-
-        (* Simple variable ref. *)
-        | [&lt; &gt;] -&gt; Ast.Variable id
-      in
-      parse_ident id stream
-</pre>
-</div>
-
-<p>This routine follows the same style as the other routines.  (It expects to be
-called if the current token is a <tt>Token.Ident</tt> token).  It also has
-recursion and error handling.  One interesting aspect of this is that it uses
-<em>look-ahead</em> to determine if the current identifier is a stand alone
-variable reference or if it is a function call expression.  It handles this by
-checking to see if the token after the identifier is a '(' token, constructing
-either a <tt>Ast.Variable</tt> or <tt>Ast.Call</tt> node as appropriate.
-</p>
-
-<p>We finish up by raising an exception if we received a token we didn't
-expect:</p>
-
-<div class="doc_code">
-<pre>
-  | [&lt; &gt;] -&gt; raise (Stream.Error "unknown token when expecting an expression.")
-</pre>
-</div>
-
-<p>Now that basic expressions are handled, we need to handle binary expressions.
-They are a bit more complex.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="parserbinops">Binary Expression
- Parsing</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>Binary expressions are significantly harder to parse because they are often
-ambiguous.  For example, when given the string "x+y*z", the parser can choose
-to parse it as either "(x+y)*z" or "x+(y*z)".  With common definitions from
-mathematics, we expect the later parse, because "*" (multiplication) has
-higher <em>precedence</em> than "+" (addition).</p>
-
-<p>There are many ways to handle this, but an elegant and efficient way is to
-use <a href=
-"http://en.wikipedia.org/wiki/Operator-precedence_parser">Operator-Precedence
-Parsing</a>.  This parsing technique uses the precedence of binary operators to
-guide recursion.  To start with, we need a table of precedences:</p>
-
-<div class="doc_code">
-<pre>
-(* binop_precedence - This holds the precedence for each binary operator that is
- * defined *)
-let binop_precedence:(char, int) Hashtbl.t = Hashtbl.create 10
-
-(* precedence - Get the precedence of the pending binary operator token. *)
-let precedence c = try Hashtbl.find binop_precedence c with Not_found -&gt; -1
-
-...
-
-let main () =
-  (* Install standard binary operators.
-   * 1 is the lowest precedence. *)
-  Hashtbl.add Parser.binop_precedence '&lt;' 10;
-  Hashtbl.add Parser.binop_precedence '+' 20;
-  Hashtbl.add Parser.binop_precedence '-' 20;
-  Hashtbl.add Parser.binop_precedence '*' 40;    (* highest. *)
-  ...
-</pre>
-</div>
-
-<p>For the basic form of Kaleidoscope, we will only support 4 binary operators
-(this can obviously be extended by you, our brave and intrepid reader).  The
-<tt>Parser.precedence</tt> function returns the precedence for the current
-token, or -1 if the token is not a binary operator.  Having a <tt>Hashtbl.t</tt>
-makes it easy to add new operators and makes it clear that the algorithm doesn't
-depend on the specific operators involved, but it would be easy enough to
-eliminate the <tt>Hashtbl.t</tt> and do the comparisons in the
-<tt>Parser.precedence</tt> function.  (Or just use a fixed-size array).</p>
-
-<p>With the helper above defined, we can now start parsing binary expressions.
-The basic idea of operator precedence parsing is to break down an expression
-with potentially ambiguous binary operators into pieces.  Consider ,for example,
-the expression "a+b+(c+d)*e*f+g".  Operator precedence parsing considers this
-as a stream of primary expressions separated by binary operators.  As such,
-it will first parse the leading primary expression "a", then it will see the
-pairs [+, b] [+, (c+d)] [*, e] [*, f] and [+, g].  Note that because parentheses
-are primary expressions, the binary expression parser doesn't need to worry
-about nested subexpressions like (c+d) at all.
-</p>
-
-<p>
-To start, an expression is a primary expression potentially followed by a
-sequence of [binop,primaryexpr] pairs:</p>
-
-<div class="doc_code">
-<pre>
-(* expression
- *   ::= primary binoprhs *)
-and parse_expr = parser
-  | [&lt; lhs=parse_primary; stream &gt;] -&gt; parse_bin_rhs 0 lhs stream
-</pre>
-</div>
-
-<p><tt>Parser.parse_bin_rhs</tt> is the function that parses the sequence of
-pairs for us.  It takes a precedence and a pointer to an expression for the part
-that has been parsed so far.   Note that "x" is a perfectly valid expression: As
-such, "binoprhs" is allowed to be empty, in which case it returns the expression
-that is passed into it. In our example above, the code passes the expression for
-"a" into <tt>Parser.parse_bin_rhs</tt> and the current token is "+".</p>
-
-<p>The precedence value passed into <tt>Parser.parse_bin_rhs</tt> indicates the
-<em>minimal operator precedence</em> that the function is allowed to eat.  For
-example, if the current pair stream is [+, x] and <tt>Parser.parse_bin_rhs</tt>
-is passed in a precedence of 40, it will not consume any tokens (because the
-precedence of '+' is only 20).  With this in mind, <tt>Parser.parse_bin_rhs</tt>
-starts with:</p>
-
-<div class="doc_code">
-<pre>
-(* binoprhs
- *   ::= ('+' primary)* *)
-and parse_bin_rhs expr_prec lhs stream =
-  match Stream.peek stream with
-  (* If this is a binop, find its precedence. *)
-  | Some (Token.Kwd c) when Hashtbl.mem binop_precedence c -&gt;
-      let token_prec = precedence c in
-
-      (* If this is a binop that binds at least as tightly as the current binop,
-       * consume it, otherwise we are done. *)
-      if token_prec &lt; expr_prec then lhs else begin
-</pre>
-</div>
-
-<p>This code gets the precedence of the current token and checks to see if if is
-too low.  Because we defined invalid tokens to have a precedence of -1, this
-check implicitly knows that the pair-stream ends when the token stream runs out
-of binary operators.  If this check succeeds, we know that the token is a binary
-operator and that it will be included in this expression:</p>
-
-<div class="doc_code">
-<pre>
-        (* Eat the binop. *)
-        Stream.junk stream;
-
-        (* Okay, we know this is a binop. *)
-        let rhs =
-          match Stream.peek stream with
-          | Some (Token.Kwd c2) -&gt;
-</pre>
-</div>
-
-<p>As such, this code eats (and remembers) the binary operator and then parses
-the primary expression that follows.  This builds up the whole pair, the first of
-which is [+, b] for the running example.</p>
-
-<p>Now that we parsed the left-hand side of an expression and one pair of the
-RHS sequence, we have to decide which way the expression associates.  In
-particular, we could have "(a+b) binop unparsed"  or "a + (b binop unparsed)".
-To determine this, we look ahead at "binop" to determine its precedence and
-compare it to BinOp's precedence (which is '+' in this case):</p>
-
-<div class="doc_code">
-<pre>
-              (* If BinOp binds less tightly with rhs than the operator after
-               * rhs, let the pending operator take rhs as its lhs. *)
-              let next_prec = precedence c2 in
-              if token_prec &lt; next_prec
-</pre>
-</div>
-
-<p>If the precedence of the binop to the right of "RHS" is lower or equal to the
-precedence of our current operator, then we know that the parentheses associate
-as "(a+b) binop ...".  In our example, the current operator is "+" and the next
-operator is "+", we know that they have the same precedence.  In this case we'll
-create the AST node for "a+b", and then continue parsing:</p>
-
-<div class="doc_code">
-<pre>
-          ... if body omitted ...
-        in
-
-        (* Merge lhs/rhs. *)
-        let lhs = Ast.Binary (c, lhs, rhs) in
-        parse_bin_rhs expr_prec lhs stream
-      end
-</pre>
-</div>
-
-<p>In our example above, this will turn "a+b+" into "(a+b)" and execute the next
-iteration of the loop, with "+" as the current token.  The code above will eat,
-remember, and parse "(c+d)" as the primary expression, which makes the
-current pair equal to [+, (c+d)].  It will then evaluate the 'if' conditional above with
-"*" as the binop to the right of the primary.  In this case, the precedence of "*" is
-higher than the precedence of "+" so the if condition will be entered.</p>
-
-<p>The critical question left here is "how can the if condition parse the right
-hand side in full"?  In particular, to build the AST correctly for our example,
-it needs to get all of "(c+d)*e*f" as the RHS expression variable.  The code to
-do this is surprisingly simple (code from the above two blocks duplicated for
-context):</p>
-
-<div class="doc_code">
-<pre>
-          match Stream.peek stream with
-          | Some (Token.Kwd c2) -&gt;
-              (* If BinOp binds less tightly with rhs than the operator after
-               * rhs, let the pending operator take rhs as its lhs. *)
-              if token_prec &lt; precedence c2
-              then <b>parse_bin_rhs (token_prec + 1) rhs stream</b>
-              else rhs
-          | _ -&gt; rhs
-        in
-
-        (* Merge lhs/rhs. *)
-        let lhs = Ast.Binary (c, lhs, rhs) in
-        parse_bin_rhs expr_prec lhs stream
-      end
-</pre>
-</div>
-
-<p>At this point, we know that the binary operator to the RHS of our primary
-has higher precedence than the binop we are currently parsing.  As such, we know
-that any sequence of pairs whose operators are all higher precedence than "+"
-should be parsed together and returned as "RHS".  To do this, we recursively
-invoke the <tt>Parser.parse_bin_rhs</tt> function specifying "token_prec+1" as
-the minimum precedence required for it to continue.  In our example above, this
-will cause it to return the AST node for "(c+d)*e*f" as RHS, which is then set
-as the RHS of the '+' expression.</p>
-
-<p>Finally, on the next iteration of the while loop, the "+g" piece is parsed
-and added to the AST.  With this little bit of code (14 non-trivial lines), we
-correctly handle fully general binary expression parsing in a very elegant way.
-This was a whirlwind tour of this code, and it is somewhat subtle.  I recommend
-running through it with a few tough examples to see how it works.
-</p>
-
-<p>This wraps up handling of expressions.  At this point, we can point the
-parser at an arbitrary token stream and build an expression from it, stopping
-at the first token that is not part of the expression.  Next up we need to
-handle function definitions, etc.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="parsertop">Parsing the Rest</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>
-The next thing missing is handling of function prototypes.  In Kaleidoscope,
-these are used both for 'extern' function declarations as well as function body
-definitions.  The code to do this is straight-forward and not very interesting
-(once you've survived expressions):
-</p>
-
-<div class="doc_code">
-<pre>
-(* prototype
- *   ::= id '(' id* ')' *)
-let parse_prototype =
-  let rec parse_args accumulator = parser
-    | [&lt; 'Token.Ident id; e=parse_args (id::accumulator) &gt;] -&gt; e
-    | [&lt; &gt;] -&gt; accumulator
-  in
-
-  parser
-  | [&lt; 'Token.Ident id;
-       'Token.Kwd '(' ?? "expected '(' in prototype";
-       args=parse_args [];
-       'Token.Kwd ')' ?? "expected ')' in prototype" &gt;] -&gt;
-      (* success. *)
-      Ast.Prototype (id, Array.of_list (List.rev args))
-
-  | [&lt; &gt;] -&gt;
-      raise (Stream.Error "expected function name in prototype")
-</pre>
-</div>
-
-<p>Given this, a function definition is very simple, just a prototype plus
-an expression to implement the body:</p>
-
-<div class="doc_code">
-<pre>
-(* definition ::= 'def' prototype expression *)
-let parse_definition = parser
-  | [&lt; 'Token.Def; p=parse_prototype; e=parse_expr &gt;] -&gt;
-      Ast.Function (p, e)
-</pre>
-</div>
-
-<p>In addition, we support 'extern' to declare functions like 'sin' and 'cos' as
-well as to support forward declaration of user functions.  These 'extern's are just
-prototypes with no body:</p>
-
-<div class="doc_code">
-<pre>
-(*  external ::= 'extern' prototype *)
-let parse_extern = parser
-  | [&lt; 'Token.Extern; e=parse_prototype &gt;] -&gt; e
-</pre>
-</div>
-
-<p>Finally, we'll also let the user type in arbitrary top-level expressions and
-evaluate them on the fly.  We will handle this by defining anonymous nullary
-(zero argument) functions for them:</p>
-
-<div class="doc_code">
-<pre>
-(* toplevelexpr ::= expression *)
-let parse_toplevel = parser
-  | [&lt; e=parse_expr &gt;] -&gt;
-      (* Make an anonymous proto. *)
-      Ast.Function (Ast.Prototype ("", [||]), e)
-</pre>
-</div>
-
-<p>Now that we have all the pieces, let's build a little driver that will let us
-actually <em>execute</em> this code we've built!</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="driver">The Driver</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>The driver for this simply invokes all of the parsing pieces with a top-level
-dispatch loop.  There isn't much interesting here, so I'll just include the
-top-level loop.  See <a href="#code">below</a> for full code in the "Top-Level
-Parsing" section.</p>
-
-<div class="doc_code">
-<pre>
-(* top ::= definition | external | expression | ';' *)
-let rec main_loop stream =
-  match Stream.peek stream with
-  | None -&gt; ()
-
-  (* ignore top-level semicolons. *)
-  | Some (Token.Kwd ';') -&gt;
-      Stream.junk stream;
-      main_loop stream
-
-  | Some token -&gt;
-      begin
-        try match token with
-        | Token.Def -&gt;
-            ignore(Parser.parse_definition stream);
-            print_endline "parsed a function definition.";
-        | Token.Extern -&gt;
-            ignore(Parser.parse_extern stream);
-            print_endline "parsed an extern.";
-        | _ -&gt;
-            (* Evaluate a top-level expression into an anonymous function. *)
-            ignore(Parser.parse_toplevel stream);
-            print_endline "parsed a top-level expr";
-        with Stream.Error s -&gt;
-          (* Skip token for error recovery. *)
-          Stream.junk stream;
-          print_endline s;
-      end;
-      print_string "ready&gt; "; flush stdout;
-      main_loop stream
-</pre>
-</div>
-
-<p>The most interesting part of this is that we ignore top-level semicolons.
-Why is this, you ask?  The basic reason is that if you type "4 + 5" at the
-command line, the parser doesn't know whether that is the end of what you will type
-or not.  For example, on the next line you could type "def foo..." in which case
-4+5 is the end of a top-level expression.  Alternatively you could type "* 6",
-which would continue the expression.  Having top-level semicolons allows you to
-type "4+5;", and the parser will know you are done.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="conclusions">Conclusions</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>With just under 300 lines of commented code (240 lines of non-comment,
-non-blank code), we fully defined our minimal language, including a lexer,
-parser, and AST builder.  With this done, the executable will validate
-Kaleidoscope code and tell us if it is grammatically invalid.  For
-example, here is a sample interaction:</p>
-
-<div class="doc_code">
-<pre>
-$ <b>./toy.byte</b>
-ready&gt; <b>def foo(x y) x+foo(y, 4.0);</b>
-Parsed a function definition.
-ready&gt; <b>def foo(x y) x+y y;</b>
-Parsed a function definition.
-Parsed a top-level expr
-ready&gt; <b>def foo(x y) x+y );</b>
-Parsed a function definition.
-Error: unknown token when expecting an expression
-ready&gt; <b>extern sin(a);</b>
-ready&gt; Parsed an extern
-ready&gt; <b>^D</b>
-$
-</pre>
-</div>
-
-<p>There is a lot of room for extension here.  You can define new AST nodes,
-extend the language in many ways, etc.  In the <a href="OCamlLangImpl3.html">
-next installment</a>, we will describe how to generate LLVM Intermediate
-Representation (IR) from the AST.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="code">Full Code Listing</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>
-Here is the complete code listing for this and the previous chapter.
-Note that it is fully self-contained: you don't need LLVM or any external
-libraries at all for this.  (Besides the ocaml standard libraries, of
-course.)  To build this, just compile with:</p>
-
-<div class="doc_code">
-<pre>
-# Compile
-ocamlbuild toy.byte
-# Run
-./toy.byte
-</pre>
-</div>
-
-<p>Here is the code:</p>
-
-<dl>
-<dt>_tags:</dt>
-<dd class="doc_code">
-<pre>
-&lt;{lexer,parser}.ml&gt;: use_camlp4, pp(camlp4of)
-</pre>
-</dd>
-
-<dt>token.ml:</dt>
-<dd class="doc_code">
-<pre>
-(*===----------------------------------------------------------------------===
- * Lexer Tokens
- *===----------------------------------------------------------------------===*)
-
-(* The lexer returns these 'Kwd' if it is an unknown character, otherwise one of
- * these others for known things. *)
-type token =
-  (* commands *)
-  | Def | Extern
-
-  (* primary *)
-  | Ident of string | Number of float
-
-  (* unknown *)
-  | Kwd of char
-</pre>
-</dd>
-
-<dt>lexer.ml:</dt>
-<dd class="doc_code">
-<pre>
-(*===----------------------------------------------------------------------===
- * Lexer
- *===----------------------------------------------------------------------===*)
-
-let rec lex = parser
-  (* Skip any whitespace. *)
-  | [&lt; ' (' ' | '\n' | '\r' | '\t'); stream &gt;] -&gt; lex stream
-
-  (* identifier: [a-zA-Z][a-zA-Z0-9] *)
-  | [&lt; ' ('A' .. 'Z' | 'a' .. 'z' as c); stream &gt;] -&gt;
-      let buffer = Buffer.create 1 in
-      Buffer.add_char buffer c;
-      lex_ident buffer stream
-
-  (* number: [0-9.]+ *)
-  | [&lt; ' ('0' .. '9' as c); stream &gt;] -&gt;
-      let buffer = Buffer.create 1 in
-      Buffer.add_char buffer c;
-      lex_number buffer stream
-
-  (* Comment until end of line. *)
-  | [&lt; ' ('#'); stream &gt;] -&gt;
-      lex_comment stream
-
-  (* Otherwise, just return the character as its ascii value. *)
-  | [&lt; 'c; stream &gt;] -&gt;
-      [&lt; 'Token.Kwd c; lex stream &gt;]
-
-  (* end of stream. *)
-  | [&lt; &gt;] -&gt; [&lt; &gt;]
-
-and lex_number buffer = parser
-  | [&lt; ' ('0' .. '9' | '.' as c); stream &gt;] -&gt;
-      Buffer.add_char buffer c;
-      lex_number buffer stream
-  | [&lt; stream=lex &gt;] -&gt;
-      [&lt; 'Token.Number (float_of_string (Buffer.contents buffer)); stream &gt;]
-
-and lex_ident buffer = parser
-  | [&lt; ' ('A' .. 'Z' | 'a' .. 'z' | '0' .. '9' as c); stream &gt;] -&gt;
-      Buffer.add_char buffer c;
-      lex_ident buffer stream
-  | [&lt; stream=lex &gt;] -&gt;
-      match Buffer.contents buffer with
-      | "def" -&gt; [&lt; 'Token.Def; stream &gt;]
-      | "extern" -&gt; [&lt; 'Token.Extern; stream &gt;]
-      | id -&gt; [&lt; 'Token.Ident id; stream &gt;]
-
-and lex_comment = parser
-  | [&lt; ' ('\n'); stream=lex &gt;] -&gt; stream
-  | [&lt; 'c; e=lex_comment &gt;] -&gt; e
-  | [&lt; &gt;] -&gt; [&lt; &gt;]
-</pre>
-</dd>
-
-<dt>ast.ml:</dt>
-<dd class="doc_code">
-<pre>
-(*===----------------------------------------------------------------------===
- * Abstract Syntax Tree (aka Parse Tree)
- *===----------------------------------------------------------------------===*)
-
-(* expr - Base type for all expression nodes. *)
-type expr =
-  (* variant for numeric literals like "1.0". *)
-  | Number of float
-
-  (* variant for referencing a variable, like "a". *)
-  | Variable of string
-
-  (* variant for a binary operator. *)
-  | Binary of char * expr * expr
-
-  (* variant for function calls. *)
-  | Call of string * expr array
-
-(* proto - This type represents the "prototype" for a function, which captures
- * its name, and its argument names (thus implicitly the number of arguments the
- * function takes). *)
-type proto = Prototype of string * string array
-
-(* func - This type represents a function definition itself. *)
-type func = Function of proto * expr
-</pre>
-</dd>
-
-<dt>parser.ml:</dt>
-<dd class="doc_code">
-<pre>
-(*===---------------------------------------------------------------------===
- * Parser
- *===---------------------------------------------------------------------===*)
-
-(* binop_precedence - This holds the precedence for each binary operator that is
- * defined *)
-let binop_precedence:(char, int) Hashtbl.t = Hashtbl.create 10
-
-(* precedence - Get the precedence of the pending binary operator token. *)
-let precedence c = try Hashtbl.find binop_precedence c with Not_found -&gt; -1
-
-(* primary
- *   ::= identifier
- *   ::= numberexpr
- *   ::= parenexpr *)
-let rec parse_primary = parser
-  (* numberexpr ::= number *)
-  | [&lt; 'Token.Number n &gt;] -&gt; Ast.Number n
-
-  (* parenexpr ::= '(' expression ')' *)
-  | [&lt; 'Token.Kwd '('; e=parse_expr; 'Token.Kwd ')' ?? "expected ')'" &gt;] -&gt; e
-
-  (* identifierexpr
-   *   ::= identifier
-   *   ::= identifier '(' argumentexpr ')' *)
-  | [&lt; 'Token.Ident id; stream &gt;] -&gt;
-      let rec parse_args accumulator = parser
-        | [&lt; e=parse_expr; stream &gt;] -&gt;
-            begin parser
-              | [&lt; 'Token.Kwd ','; e=parse_args (e :: accumulator) &gt;] -&gt; e
-              | [&lt; &gt;] -&gt; e :: accumulator
-            end stream
-        | [&lt; &gt;] -&gt; accumulator
-      in
-      let rec parse_ident id = parser
-        (* Call. *)
-        | [&lt; 'Token.Kwd '(';
-             args=parse_args [];
-             'Token.Kwd ')' ?? "expected ')'"&gt;] -&gt;
-            Ast.Call (id, Array.of_list (List.rev args))
-
-        (* Simple variable ref. *)
-        | [&lt; &gt;] -&gt; Ast.Variable id
-      in
-      parse_ident id stream
-
-  | [&lt; &gt;] -&gt; raise (Stream.Error "unknown token when expecting an expression.")
-
-(* binoprhs
- *   ::= ('+' primary)* *)
-and parse_bin_rhs expr_prec lhs stream =
-  match Stream.peek stream with
-  (* If this is a binop, find its precedence. *)
-  | Some (Token.Kwd c) when Hashtbl.mem binop_precedence c -&gt;
-      let token_prec = precedence c in
-
-      (* If this is a binop that binds at least as tightly as the current binop,
-       * consume it, otherwise we are done. *)
-      if token_prec &lt; expr_prec then lhs else begin
-        (* Eat the binop. *)
-        Stream.junk stream;
-
-        (* Parse the primary expression after the binary operator. *)
-        let rhs = parse_primary stream in
-
-        (* Okay, we know this is a binop. *)
-        let rhs =
-          match Stream.peek stream with
-          | Some (Token.Kwd c2) -&gt;
-              (* If BinOp binds less tightly with rhs than the operator after
-               * rhs, let the pending operator take rhs as its lhs. *)
-              let next_prec = precedence c2 in
-              if token_prec &lt; next_prec
-              then parse_bin_rhs (token_prec + 1) rhs stream
-              else rhs
-          | _ -&gt; rhs
-        in
-
-        (* Merge lhs/rhs. *)
-        let lhs = Ast.Binary (c, lhs, rhs) in
-        parse_bin_rhs expr_prec lhs stream
-      end
-  | _ -&gt; lhs
-
-(* expression
- *   ::= primary binoprhs *)
-and parse_expr = parser
-  | [&lt; lhs=parse_primary; stream &gt;] -&gt; parse_bin_rhs 0 lhs stream
-
-(* prototype
- *   ::= id '(' id* ')' *)
-let parse_prototype =
-  let rec parse_args accumulator = parser
-    | [&lt; 'Token.Ident id; e=parse_args (id::accumulator) &gt;] -&gt; e
-    | [&lt; &gt;] -&gt; accumulator
-  in
-
-  parser
-  | [&lt; 'Token.Ident id;
-       'Token.Kwd '(' ?? "expected '(' in prototype";
-       args=parse_args [];
-       'Token.Kwd ')' ?? "expected ')' in prototype" &gt;] -&gt;
-      (* success. *)
-      Ast.Prototype (id, Array.of_list (List.rev args))
-
-  | [&lt; &gt;] -&gt;
-      raise (Stream.Error "expected function name in prototype")
-
-(* definition ::= 'def' prototype expression *)
-let parse_definition = parser
-  | [&lt; 'Token.Def; p=parse_prototype; e=parse_expr &gt;] -&gt;
-      Ast.Function (p, e)
-
-(* toplevelexpr ::= expression *)
-let parse_toplevel = parser
-  | [&lt; e=parse_expr &gt;] -&gt;
-      (* Make an anonymous proto. *)
-      Ast.Function (Ast.Prototype ("", [||]), e)
-
-(*  external ::= 'extern' prototype *)
-let parse_extern = parser
-  | [&lt; 'Token.Extern; e=parse_prototype &gt;] -&gt; e
-</pre>
-</dd>
-
-<dt>toplevel.ml:</dt>
-<dd class="doc_code">
-<pre>
-(*===----------------------------------------------------------------------===
- * Top-Level parsing and JIT Driver
- *===----------------------------------------------------------------------===*)
-
-(* top ::= definition | external | expression | ';' *)
-let rec main_loop stream =
-  match Stream.peek stream with
-  | None -&gt; ()
-
-  (* ignore top-level semicolons. *)
-  | Some (Token.Kwd ';') -&gt;
-      Stream.junk stream;
-      main_loop stream
-
-  | Some token -&gt;
-      begin
-        try match token with
-        | Token.Def -&gt;
-            ignore(Parser.parse_definition stream);
-            print_endline "parsed a function definition.";
-        | Token.Extern -&gt;
-            ignore(Parser.parse_extern stream);
-            print_endline "parsed an extern.";
-        | _ -&gt;
-            (* Evaluate a top-level expression into an anonymous function. *)
-            ignore(Parser.parse_toplevel stream);
-            print_endline "parsed a top-level expr";
-        with Stream.Error s -&gt;
-          (* Skip token for error recovery. *)
-          Stream.junk stream;
-          print_endline s;
-      end;
-      print_string "ready&gt; "; flush stdout;
-      main_loop stream
-</pre>
-</dd>
-
-<dt>toy.ml:</dt>
-<dd class="doc_code">
-<pre>
-(*===----------------------------------------------------------------------===
- * Main driver code.
- *===----------------------------------------------------------------------===*)
-
-let main () =
-  (* Install standard binary operators.
-   * 1 is the lowest precedence. *)
-  Hashtbl.add Parser.binop_precedence '&lt;' 10;
-  Hashtbl.add Parser.binop_precedence '+' 20;
-  Hashtbl.add Parser.binop_precedence '-' 20;
-  Hashtbl.add Parser.binop_precedence '*' 40;    (* highest. *)
-
-  (* Prime the first token. *)
-  print_string "ready&gt; "; flush stdout;
-  let stream = Lexer.lex (Stream.of_channel stdin) in
-
-  (* Run the main "interpreter loop" now. *)
-  Toplevel.main_loop stream;
-;;
-
-main ()
-</pre>
-</dd>
-</dl>
-
-<a href="OCamlLangImpl3.html">Next: Implementing Code Generation to LLVM IR</a>
-</div>
-
-<!-- *********************************************************************** -->
-<hr>
-<address>
-  <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
-  src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"></a>
-  <a href="http://validator.w3.org/check/referer"><img
-  src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"></a>
-
-  <a href="mailto:sabre at nondot.org">Chris Lattner</a>
-  <a href="mailto:erickt at users.sourceforge.net">Erick Tryzelaar</a><br>
-  <a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
-  Last modified: $Date$
-</address>
-</body>
-</html>
diff --git a/libclamav/c++/llvm/docs/tutorial/OCamlLangImpl3.html b/libclamav/c++/llvm/docs/tutorial/OCamlLangImpl3.html
deleted file mode 100644
index f3814c8..0000000
--- a/libclamav/c++/llvm/docs/tutorial/OCamlLangImpl3.html
+++ /dev/null
@@ -1,1091 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-                      "http://www.w3.org/TR/html4/strict.dtd">
-
-<html>
-<head>
-  <title>Kaleidoscope: Implementing code generation to LLVM IR</title>
-  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-  <meta name="author" content="Chris Lattner">
-  <meta name="author" content="Erick Tryzelaar">
-  <link rel="stylesheet" href="../llvm.css" type="text/css">
-</head>
-
-<body>
-
-<div class="doc_title">Kaleidoscope: Code generation to LLVM IR</div>
-
-<ul>
-<li><a href="index.html">Up to Tutorial Index</a></li>
-<li>Chapter 3
-  <ol>
-    <li><a href="#intro">Chapter 3 Introduction</a></li>
-    <li><a href="#basics">Code Generation Setup</a></li>
-    <li><a href="#exprs">Expression Code Generation</a></li>
-    <li><a href="#funcs">Function Code Generation</a></li>
-    <li><a href="#driver">Driver Changes and Closing Thoughts</a></li>
-    <li><a href="#code">Full Code Listing</a></li>
-  </ol>
-</li>
-<li><a href="OCamlLangImpl4.html">Chapter 4</a>: Adding JIT and Optimizer
-Support</li>
-</ul>
-
-<div class="doc_author">
-	<p>
-		Written by <a href="mailto:sabre at nondot.org">Chris Lattner</a>
-		and <a href="mailto:idadesub at users.sourceforge.net">Erick Tryzelaar</a>
-	</p>
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="intro">Chapter 3 Introduction</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>Welcome to Chapter 3 of the "<a href="index.html">Implementing a language
-with LLVM</a>" tutorial.  This chapter shows you how to transform the <a
-href="OCamlLangImpl2.html">Abstract Syntax Tree</a>, built in Chapter 2, into
-LLVM IR.  This will teach you a little bit about how LLVM does things, as well
-as demonstrate how easy it is to use.  It's much more work to build a lexer and
-parser than it is to generate LLVM IR code. :)
-</p>
-
-<p><b>Please note</b>: the code in this chapter and later require LLVM 2.3 or
-LLVM SVN to work.  LLVM 2.2 and before will not work with it.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="basics">Code Generation Setup</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>
-In order to generate LLVM IR, we want some simple setup to get started.  First
-we define virtual code generation (codegen) methods in each AST class:</p>
-
-<div class="doc_code">
-<pre>
-let rec codegen_expr = function
-  | Ast.Number n -&gt; ...
-  | Ast.Variable name -&gt; ...
-</pre>
-</div>
-
-<p>The <tt>Codegen.codegen_expr</tt> function says to emit IR for that AST node
-along with all the things it depends on, and they all return an LLVM Value
-object.  "Value" is the class used to represent a "<a
-href="http://en.wikipedia.org/wiki/Static_single_assignment_form">Static Single
-Assignment (SSA)</a> register" or "SSA value" in LLVM.  The most distinct aspect
-of SSA values is that their value is computed as the related instruction
-executes, and it does not get a new value until (and if) the instruction
-re-executes.  In other words, there is no way to "change" an SSA value.  For
-more information, please read up on <a
-href="http://en.wikipedia.org/wiki/Static_single_assignment_form">Static Single
-Assignment</a> - the concepts are really quite natural once you grok them.</p>
-
-<p>The
-second thing we want is an "Error" exception like we used for the parser, which
-will be used to report errors found during code generation (for example, use of
-an undeclared parameter):</p>
-
-<div class="doc_code">
-<pre>
-exception Error of string
-
-let the_module = create_module (global_context ()) "my cool jit"
-let builder = builder (global_context ())
-let named_values:(string, llvalue) Hashtbl.t = Hashtbl.create 10
-</pre>
-</div>
-
-<p>The static variables will be used during code generation.
-<tt>Codgen.the_module</tt> is the LLVM construct that contains all of the
-functions and global variables in a chunk of code.  In many ways, it is the
-top-level structure that the LLVM IR uses to contain code.</p>
-
-<p>The <tt>Codegen.builder</tt> object is a helper object that makes it easy to
-generate LLVM instructions.  Instances of the <a
-href="http://llvm.org/doxygen/IRBuilder_8h-source.html"><tt>IRBuilder</tt></a>
-class keep track of the current place to insert instructions and has methods to
-create new instructions.</p>
-
-<p>The <tt>Codegen.named_values</tt> map keeps track of which values are defined
-in the current scope and what their LLVM representation is.  (In other words, it
-is a symbol table for the code).  In this form of Kaleidoscope, the only things
-that can be referenced are function parameters.  As such, function parameters
-will be in this map when generating code for their function body.</p>
-
-<p>
-With these basics in place, we can start talking about how to generate code for
-each expression.  Note that this assumes that the <tt>Codgen.builder</tt> has
-been set up to generate code <em>into</em> something.  For now, we'll assume
-that this has already been done, and we'll just use it to emit code.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="exprs">Expression Code Generation</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>Generating LLVM code for expression nodes is very straightforward: less
-than 30 lines of commented code for all four of our expression nodes.  First
-we'll do numeric literals:</p>
-
-<div class="doc_code">
-<pre>
-  | Ast.Number n -&gt; const_float double_type n
-</pre>
-</div>
-
-<p>In the LLVM IR, numeric constants are represented with the
-<tt>ConstantFP</tt> class, which holds the numeric value in an <tt>APFloat</tt>
-internally (<tt>APFloat</tt> has the capability of holding floating point
-constants of <em>A</em>rbitrary <em>P</em>recision).  This code basically just
-creates and returns a <tt>ConstantFP</tt>.  Note that in the LLVM IR
-that constants are all uniqued together and shared.  For this reason, the API
-uses "the foo::get(..)" idiom instead of "new foo(..)" or "foo::Create(..)".</p>
-
-<div class="doc_code">
-<pre>
-  | Ast.Variable name -&gt;
-      (try Hashtbl.find named_values name with
-        | Not_found -&gt; raise (Error "unknown variable name"))
-</pre>
-</div>
-
-<p>References to variables are also quite simple using LLVM.  In the simple
-version of Kaleidoscope, we assume that the variable has already been emitted
-somewhere and its value is available.  In practice, the only values that can be
-in the <tt>Codegen.named_values</tt> map are function arguments.  This code
-simply checks to see that the specified name is in the map (if not, an unknown
-variable is being referenced) and returns the value for it.  In future chapters,
-we'll add support for <a href="LangImpl5.html#for">loop induction variables</a>
-in the symbol table, and for <a href="LangImpl7.html#localvars">local
-variables</a>.</p>
-
-<div class="doc_code">
-<pre>
-  | Ast.Binary (op, lhs, rhs) -&gt;
-      let lhs_val = codegen_expr lhs in
-      let rhs_val = codegen_expr rhs in
-      begin
-        match op with
-        | '+' -&gt; build_add lhs_val rhs_val "addtmp" builder
-        | '-' -&gt; build_sub lhs_val rhs_val "subtmp" builder
-        | '*' -&gt; build_mul lhs_val rhs_val "multmp" builder
-        | '&lt;' -&gt;
-            (* Convert bool 0/1 to double 0.0 or 1.0 *)
-            let i = build_fcmp Fcmp.Ult lhs_val rhs_val "cmptmp" builder in
-            build_uitofp i double_type "booltmp" builder
-        | _ -&gt; raise (Error "invalid binary operator")
-      end
-</pre>
-</div>
-
-<p>Binary operators start to get more interesting.  The basic idea here is that
-we recursively emit code for the left-hand side of the expression, then the
-right-hand side, then we compute the result of the binary expression.  In this
-code, we do a simple switch on the opcode to create the right LLVM instruction.
-</p>
-
-<p>In the example above, the LLVM builder class is starting to show its value.
-IRBuilder knows where to insert the newly created instruction, all you have to
-do is specify what instruction to create (e.g. with <tt>Llvm.create_add</tt>),
-which operands to use (<tt>lhs</tt> and <tt>rhs</tt> here) and optionally
-provide a name for the generated instruction.</p>
-
-<p>One nice thing about LLVM is that the name is just a hint.  For instance, if
-the code above emits multiple "addtmp" variables, LLVM will automatically
-provide each one with an increasing, unique numeric suffix.  Local value names
-for instructions are purely optional, but it makes it much easier to read the
-IR dumps.</p>
-
-<p><a href="../LangRef.html#instref">LLVM instructions</a> are constrained by
-strict rules: for example, the Left and Right operators of
-an <a href="../LangRef.html#i_add">add instruction</a> must have the same
-type, and the result type of the add must match the operand types.  Because
-all values in Kaleidoscope are doubles, this makes for very simple code for add,
-sub and mul.</p>
-
-<p>On the other hand, LLVM specifies that the <a
-href="../LangRef.html#i_fcmp">fcmp instruction</a> always returns an 'i1' value
-(a one bit integer).  The problem with this is that Kaleidoscope wants the value to be a 0.0 or 1.0 value.  In order to get these semantics, we combine the fcmp instruction with
-a <a href="../LangRef.html#i_uitofp">uitofp instruction</a>.  This instruction
-converts its input integer into a floating point value by treating the input
-as an unsigned value.  In contrast, if we used the <a
-href="../LangRef.html#i_sitofp">sitofp instruction</a>, the Kaleidoscope '&lt;'
-operator would return 0.0 and -1.0, depending on the input value.</p>
-
-<div class="doc_code">
-<pre>
-  | Ast.Call (callee, args) -&gt;
-      (* Look up the name in the module table. *)
-      let callee =
-        match lookup_function callee the_module with
-        | Some callee -&gt; callee
-        | None -&gt; raise (Error "unknown function referenced")
-      in
-      let params = params callee in
-
-      (* If argument mismatch error. *)
-      if Array.length params == Array.length args then () else
-        raise (Error "incorrect # arguments passed");
-      let args = Array.map codegen_expr args in
-      build_call callee args "calltmp" builder
-</pre>
-</div>
-
-<p>Code generation for function calls is quite straightforward with LLVM.  The
-code above initially does a function name lookup in the LLVM Module's symbol
-table.  Recall that the LLVM Module is the container that holds all of the
-functions we are JIT'ing.  By giving each function the same name as what the
-user specifies, we can use the LLVM symbol table to resolve function names for
-us.</p>
-
-<p>Once we have the function to call, we recursively codegen each argument that
-is to be passed in, and create an LLVM <a href="../LangRef.html#i_call">call
-instruction</a>.  Note that LLVM uses the native C calling conventions by
-default, allowing these calls to also call into standard library functions like
-"sin" and "cos", with no additional effort.</p>
-
-<p>This wraps up our handling of the four basic expressions that we have so far
-in Kaleidoscope.  Feel free to go in and add some more.  For example, by
-browsing the <a href="../LangRef.html">LLVM language reference</a> you'll find
-several other interesting instructions that are really easy to plug into our
-basic framework.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="funcs">Function Code Generation</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>Code generation for prototypes and functions must handle a number of
-details, which make their code less beautiful than expression code
-generation, but allows us to illustrate some important points.  First, lets
-talk about code generation for prototypes: they are used both for function
-bodies and external function declarations.  The code starts with:</p>
-
-<div class="doc_code">
-<pre>
-let codegen_proto = function
-  | Ast.Prototype (name, args) -&gt;
-      (* Make the function type: double(double,double) etc. *)
-      let doubles = Array.make (Array.length args) double_type in
-      let ft = function_type double_type doubles in
-      let f =
-        match lookup_function name the_module with
-</pre>
-</div>
-
-<p>This code packs a lot of power into a few lines.  Note first that this
-function returns a "Function*" instead of a "Value*" (although at the moment
-they both are modeled by <tt>llvalue</tt> in ocaml).  Because a "prototype"
-really talks about the external interface for a function (not the value computed
-by an expression), it makes sense for it to return the LLVM Function it
-corresponds to when codegen'd.</p>
-
-<p>The call to <tt>Llvm.function_type</tt> creates the <tt>Llvm.llvalue</tt>
-that should be used for a given Prototype.  Since all function arguments in
-Kaleidoscope are of type double, the first line creates a vector of "N" LLVM
-double types.  It then uses the <tt>Llvm.function_type</tt> method to create a
-function type that takes "N" doubles as arguments, returns one double as a
-result, and that is not vararg (that uses the function
-<tt>Llvm.var_arg_function_type</tt>).  Note that Types in LLVM are uniqued just
-like <tt>Constant</tt>s are, so you don't "new" a type, you "get" it.</p>
-
-<p>The final line above checks if the function has already been defined in
-<tt>Codegen.the_module</tt>. If not, we will create it.</p>
-
-<div class="doc_code">
-<pre>
-        | None -&gt; declare_function name ft the_module
-</pre>
-</div>
-
-<p>This indicates the type and name to use, as well as which module to insert
-into.  By default we assume a function has
-<tt>Llvm.Linkage.ExternalLinkage</tt>.  "<a href="LangRef.html#linkage">external
-linkage</a>" means that the function may be defined outside the current module
-and/or that it is callable by functions outside the module.  The "<tt>name</tt>"
-passed in is the name the user specified: this name is registered in
-"<tt>Codegen.the_module</tt>"s symbol table, which is used by the function call
-code above.</p>
-
-<p>In Kaleidoscope, I choose to allow redefinitions of functions in two cases:
-first, we want to allow 'extern'ing a function more than once, as long as the
-prototypes for the externs match (since all arguments have the same type, we
-just have to check that the number of arguments match).  Second, we want to
-allow 'extern'ing a function and then defining a body for it.  This is useful
-when defining mutually recursive functions.</p>
-
-<div class="doc_code">
-<pre>
-        (* If 'f' conflicted, there was already something named 'name'. If it
-         * has a body, don't allow redefinition or reextern. *)
-        | Some f -&gt;
-            (* If 'f' already has a body, reject this. *)
-            if Array.length (basic_blocks f) == 0 then () else
-              raise (Error "redefinition of function");
-
-            (* If 'f' took a different number of arguments, reject. *)
-            if Array.length (params f) == Array.length args then () else
-              raise (Error "redefinition of function with different # args");
-            f
-      in
-</pre>
-</div>
-
-<p>In order to verify the logic above, we first check to see if the pre-existing
-function is "empty".  In this case, empty means that it has no basic blocks in
-it, which means it has no body.  If it has no body, it is a forward
-declaration.  Since we don't allow anything after a full definition of the
-function, the code rejects this case.  If the previous reference to a function
-was an 'extern', we simply verify that the number of arguments for that
-definition and this one match up.  If not, we emit an error.</p>
-
-<div class="doc_code">
-<pre>
-      (* Set names for all arguments. *)
-      Array.iteri (fun i a -&gt;
-        let n = args.(i) in
-        set_value_name n a;
-        Hashtbl.add named_values n a;
-      ) (params f);
-      f
-</pre>
-</div>
-
-<p>The last bit of code for prototypes loops over all of the arguments in the
-function, setting the name of the LLVM Argument objects to match, and registering
-the arguments in the <tt>Codegen.named_values</tt> map for future use by the
-<tt>Ast.Variable</tt> variant.  Once this is set up, it returns the Function
-object to the caller.  Note that we don't check for conflicting
-argument names here (e.g. "extern foo(a b a)").  Doing so would be very
-straight-forward with the mechanics we have already used above.</p>
-
-<div class="doc_code">
-<pre>
-let codegen_func = function
-  | Ast.Function (proto, body) -&gt;
-      Hashtbl.clear named_values;
-      let the_function = codegen_proto proto in
-</pre>
-</div>
-
-<p>Code generation for function definitions starts out simply enough: we just
-codegen the prototype (Proto) and verify that it is ok.  We then clear out the
-<tt>Codegen.named_values</tt> map to make sure that there isn't anything in it
-from the last function we compiled.  Code generation of the prototype ensures
-that there is an LLVM Function object that is ready to go for us.</p>
-
-<div class="doc_code">
-<pre>
-      (* Create a new basic block to start insertion into. *)
-      let bb = append_block "entry" the_function in
-      position_at_end bb builder;
-
-      try
-        let ret_val = codegen_expr body in
-</pre>
-</div>
-
-<p>Now we get to the point where the <tt>Codegen.builder</tt> is set up.  The
-first line creates a new
-<a href="http://en.wikipedia.org/wiki/Basic_block">basic block</a> (named
-"entry"), which is inserted into <tt>the_function</tt>.  The second line then
-tells the builder that new instructions should be inserted into the end of the
-new basic block.  Basic blocks in LLVM are an important part of functions that
-define the <a
-href="http://en.wikipedia.org/wiki/Control_flow_graph">Control Flow Graph</a>.
-Since we don't have any control flow, our functions will only contain one
-block at this point.  We'll fix this in <a href="OCamlLangImpl5.html">Chapter
-5</a> :).</p>
-
-<div class="doc_code">
-<pre>
-        let ret_val = codegen_expr body in
-
-        (* Finish off the function. *)
-        let _ = build_ret ret_val builder in
-
-        (* Validate the generated code, checking for consistency. *)
-        Llvm_analysis.assert_valid_function the_function;
-
-        the_function
-</pre>
-</div>
-
-<p>Once the insertion point is set up, we call the <tt>Codegen.codegen_func</tt>
-method for the root expression of the function.  If no error happens, this emits
-code to compute the expression into the entry block and returns the value that
-was computed.  Assuming no error, we then create an LLVM <a
-href="../LangRef.html#i_ret">ret instruction</a>, which completes the function.
-Once the function is built, we call
-<tt>Llvm_analysis.assert_valid_function</tt>, which is provided by LLVM.  This
-function does a variety of consistency checks on the generated code, to
-determine if our compiler is doing everything right.  Using this is important:
-it can catch a lot of bugs.  Once the function is finished and validated, we
-return it.</p>
-
-<div class="doc_code">
-<pre>
-      with e -&gt;
-        delete_function the_function;
-        raise e
-</pre>
-</div>
-
-<p>The only piece left here is handling of the error case.  For simplicity, we
-handle this by merely deleting the function we produced with the
-<tt>Llvm.delete_function</tt> method.  This allows the user to redefine a
-function that they incorrectly typed in before: if we didn't delete it, it
-would live in the symbol table, with a body, preventing future redefinition.</p>
-
-<p>This code does have a bug, though.  Since the <tt>Codegen.codegen_proto</tt>
-can return a previously defined forward declaration, our code can actually delete
-a forward declaration.  There are a number of ways to fix this bug, see what you
-can come up with!  Here is a testcase:</p>
-
-<div class="doc_code">
-<pre>
-extern foo(a b);     # ok, defines foo.
-def foo(a b) c;      # error, 'c' is invalid.
-def bar() foo(1, 2); # error, unknown function "foo"
-</pre>
-</div>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="driver">Driver Changes and
-Closing Thoughts</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>
-For now, code generation to LLVM doesn't really get us much, except that we can
-look at the pretty IR calls.  The sample code inserts calls to Codegen into the
-"<tt>Toplevel.main_loop</tt>", and then dumps out the LLVM IR.  This gives a
-nice way to look at the LLVM IR for simple functions.  For example:
-</p>
-
-<div class="doc_code">
-<pre>
-ready&gt; <b>4+5</b>;
-Read top-level expression:
-define double @""() {
-entry:
-        %addtmp = add double 4.000000e+00, 5.000000e+00
-        ret double %addtmp
-}
-</pre>
-</div>
-
-<p>Note how the parser turns the top-level expression into anonymous functions
-for us.  This will be handy when we add <a href="OCamlLangImpl4.html#jit">JIT
-support</a> in the next chapter.  Also note that the code is very literally
-transcribed, no optimizations are being performed.  We will
-<a href="OCamlLangImpl4.html#trivialconstfold">add optimizations</a> explicitly
-in the next chapter.</p>
-
-<div class="doc_code">
-<pre>
-ready&gt; <b>def foo(a b) a*a + 2*a*b + b*b;</b>
-Read function definition:
-define double @foo(double %a, double %b) {
-entry:
-        %multmp = mul double %a, %a
-        %multmp1 = mul double 2.000000e+00, %a
-        %multmp2 = mul double %multmp1, %b
-        %addtmp = add double %multmp, %multmp2
-        %multmp3 = mul double %b, %b
-        %addtmp4 = add double %addtmp, %multmp3
-        ret double %addtmp4
-}
-</pre>
-</div>
-
-<p>This shows some simple arithmetic. Notice the striking similarity to the
-LLVM builder calls that we use to create the instructions.</p>
-
-<div class="doc_code">
-<pre>
-ready&gt; <b>def bar(a) foo(a, 4.0) + bar(31337);</b>
-Read function definition:
-define double @bar(double %a) {
-entry:
-        %calltmp = call double @foo( double %a, double 4.000000e+00 )
-        %calltmp1 = call double @bar( double 3.133700e+04 )
-        %addtmp = add double %calltmp, %calltmp1
-        ret double %addtmp
-}
-</pre>
-</div>
-
-<p>This shows some function calls.  Note that this function will take a long
-time to execute if you call it.  In the future we'll add conditional control
-flow to actually make recursion useful :).</p>
-
-<div class="doc_code">
-<pre>
-ready&gt; <b>extern cos(x);</b>
-Read extern:
-declare double @cos(double)
-
-ready&gt; <b>cos(1.234);</b>
-Read top-level expression:
-define double @""() {
-entry:
-        %calltmp = call double @cos( double 1.234000e+00 )
-        ret double %calltmp
-}
-</pre>
-</div>
-
-<p>This shows an extern for the libm "cos" function, and a call to it.</p>
-
-
-<div class="doc_code">
-<pre>
-ready&gt; <b>^D</b>
-; ModuleID = 'my cool jit'
-
-define double @""() {
-entry:
-        %addtmp = add double 4.000000e+00, 5.000000e+00
-        ret double %addtmp
-}
-
-define double @foo(double %a, double %b) {
-entry:
-        %multmp = mul double %a, %a
-        %multmp1 = mul double 2.000000e+00, %a
-        %multmp2 = mul double %multmp1, %b
-        %addtmp = add double %multmp, %multmp2
-        %multmp3 = mul double %b, %b
-        %addtmp4 = add double %addtmp, %multmp3
-        ret double %addtmp4
-}
-
-define double @bar(double %a) {
-entry:
-        %calltmp = call double @foo( double %a, double 4.000000e+00 )
-        %calltmp1 = call double @bar( double 3.133700e+04 )
-        %addtmp = add double %calltmp, %calltmp1
-        ret double %addtmp
-}
-
-declare double @cos(double)
-
-define double @""() {
-entry:
-        %calltmp = call double @cos( double 1.234000e+00 )
-        ret double %calltmp
-}
-</pre>
-</div>
-
-<p>When you quit the current demo, it dumps out the IR for the entire module
-generated.  Here you can see the big picture with all the functions referencing
-each other.</p>
-
-<p>This wraps up the third chapter of the Kaleidoscope tutorial.  Up next, we'll
-describe how to <a href="OCamlLangImpl4.html">add JIT codegen and optimizer
-support</a> to this so we can actually start running code!</p>
-
-</div>
-
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="code">Full Code Listing</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>
-Here is the complete code listing for our running example, enhanced with the
-LLVM code generator.    Because this uses the LLVM libraries, we need to link
-them in.  To do this, we use the <a
-href="http://llvm.org/cmds/llvm-config.html">llvm-config</a> tool to inform
-our makefile/command line about which options to use:</p>
-
-<div class="doc_code">
-<pre>
-# Compile
-ocamlbuild toy.byte
-# Run
-./toy.byte
-</pre>
-</div>
-
-<p>Here is the code:</p>
-
-<dl>
-<dt>_tags:</dt>
-<dd class="doc_code">
-<pre>
-&lt;{lexer,parser}.ml&gt;: use_camlp4, pp(camlp4of)
-&lt;*.{byte,native}&gt;: g++, use_llvm, use_llvm_analysis
-</pre>
-</dd>
-
-<dt>myocamlbuild.ml:</dt>
-<dd class="doc_code">
-<pre>
-open Ocamlbuild_plugin;;
-
-ocaml_lib ~extern:true "llvm";;
-ocaml_lib ~extern:true "llvm_analysis";;
-
-flag ["link"; "ocaml"; "g++"] (S[A"-cc"; A"g++"]);;
-</pre>
-</dd>
-
-<dt>token.ml:</dt>
-<dd class="doc_code">
-<pre>
-(*===----------------------------------------------------------------------===
- * Lexer Tokens
- *===----------------------------------------------------------------------===*)
-
-(* The lexer returns these 'Kwd' if it is an unknown character, otherwise one of
- * these others for known things. *)
-type token =
-  (* commands *)
-  | Def | Extern
-
-  (* primary *)
-  | Ident of string | Number of float
-
-  (* unknown *)
-  | Kwd of char
-</pre>
-</dd>
-
-<dt>lexer.ml:</dt>
-<dd class="doc_code">
-<pre>
-(*===----------------------------------------------------------------------===
- * Lexer
- *===----------------------------------------------------------------------===*)
-
-let rec lex = parser
-  (* Skip any whitespace. *)
-  | [&lt; ' (' ' | '\n' | '\r' | '\t'); stream &gt;] -&gt; lex stream
-
-  (* identifier: [a-zA-Z][a-zA-Z0-9] *)
-  | [&lt; ' ('A' .. 'Z' | 'a' .. 'z' as c); stream &gt;] -&gt;
-      let buffer = Buffer.create 1 in
-      Buffer.add_char buffer c;
-      lex_ident buffer stream
-
-  (* number: [0-9.]+ *)
-  | [&lt; ' ('0' .. '9' as c); stream &gt;] -&gt;
-      let buffer = Buffer.create 1 in
-      Buffer.add_char buffer c;
-      lex_number buffer stream
-
-  (* Comment until end of line. *)
-  | [&lt; ' ('#'); stream &gt;] -&gt;
-      lex_comment stream
-
-  (* Otherwise, just return the character as its ascii value. *)
-  | [&lt; 'c; stream &gt;] -&gt;
-      [&lt; 'Token.Kwd c; lex stream &gt;]
-
-  (* end of stream. *)
-  | [&lt; &gt;] -&gt; [&lt; &gt;]
-
-and lex_number buffer = parser
-  | [&lt; ' ('0' .. '9' | '.' as c); stream &gt;] -&gt;
-      Buffer.add_char buffer c;
-      lex_number buffer stream
-  | [&lt; stream=lex &gt;] -&gt;
-      [&lt; 'Token.Number (float_of_string (Buffer.contents buffer)); stream &gt;]
-
-and lex_ident buffer = parser
-  | [&lt; ' ('A' .. 'Z' | 'a' .. 'z' | '0' .. '9' as c); stream &gt;] -&gt;
-      Buffer.add_char buffer c;
-      lex_ident buffer stream
-  | [&lt; stream=lex &gt;] -&gt;
-      match Buffer.contents buffer with
-      | "def" -&gt; [&lt; 'Token.Def; stream &gt;]
-      | "extern" -&gt; [&lt; 'Token.Extern; stream &gt;]
-      | id -&gt; [&lt; 'Token.Ident id; stream &gt;]
-
-and lex_comment = parser
-  | [&lt; ' ('\n'); stream=lex &gt;] -&gt; stream
-  | [&lt; 'c; e=lex_comment &gt;] -&gt; e
-  | [&lt; &gt;] -&gt; [&lt; &gt;]
-</pre>
-</dd>
-
-<dt>ast.ml:</dt>
-<dd class="doc_code">
-<pre>
-(*===----------------------------------------------------------------------===
- * Abstract Syntax Tree (aka Parse Tree)
- *===----------------------------------------------------------------------===*)
-
-(* expr - Base type for all expression nodes. *)
-type expr =
-  (* variant for numeric literals like "1.0". *)
-  | Number of float
-
-  (* variant for referencing a variable, like "a". *)
-  | Variable of string
-
-  (* variant for a binary operator. *)
-  | Binary of char * expr * expr
-
-  (* variant for function calls. *)
-  | Call of string * expr array
-
-(* proto - This type represents the "prototype" for a function, which captures
- * its name, and its argument names (thus implicitly the number of arguments the
- * function takes). *)
-type proto = Prototype of string * string array
-
-(* func - This type represents a function definition itself. *)
-type func = Function of proto * expr
-</pre>
-</dd>
-
-<dt>parser.ml:</dt>
-<dd class="doc_code">
-<pre>
-(*===---------------------------------------------------------------------===
- * Parser
- *===---------------------------------------------------------------------===*)
-
-(* binop_precedence - This holds the precedence for each binary operator that is
- * defined *)
-let binop_precedence:(char, int) Hashtbl.t = Hashtbl.create 10
-
-(* precedence - Get the precedence of the pending binary operator token. *)
-let precedence c = try Hashtbl.find binop_precedence c with Not_found -&gt; -1
-
-(* primary
- *   ::= identifier
- *   ::= numberexpr
- *   ::= parenexpr *)
-let rec parse_primary = parser
-  (* numberexpr ::= number *)
-  | [&lt; 'Token.Number n &gt;] -&gt; Ast.Number n
-
-  (* parenexpr ::= '(' expression ')' *)
-  | [&lt; 'Token.Kwd '('; e=parse_expr; 'Token.Kwd ')' ?? "expected ')'" &gt;] -&gt; e
-
-  (* identifierexpr
-   *   ::= identifier
-   *   ::= identifier '(' argumentexpr ')' *)
-  | [&lt; 'Token.Ident id; stream &gt;] -&gt;
-      let rec parse_args accumulator = parser
-        | [&lt; e=parse_expr; stream &gt;] -&gt;
-            begin parser
-              | [&lt; 'Token.Kwd ','; e=parse_args (e :: accumulator) &gt;] -&gt; e
-              | [&lt; &gt;] -&gt; e :: accumulator
-            end stream
-        | [&lt; &gt;] -&gt; accumulator
-      in
-      let rec parse_ident id = parser
-        (* Call. *)
-        | [&lt; 'Token.Kwd '(';
-             args=parse_args [];
-             'Token.Kwd ')' ?? "expected ')'"&gt;] -&gt;
-            Ast.Call (id, Array.of_list (List.rev args))
-
-        (* Simple variable ref. *)
-        | [&lt; &gt;] -&gt; Ast.Variable id
-      in
-      parse_ident id stream
-
-  | [&lt; &gt;] -&gt; raise (Stream.Error "unknown token when expecting an expression.")
-
-(* binoprhs
- *   ::= ('+' primary)* *)
-and parse_bin_rhs expr_prec lhs stream =
-  match Stream.peek stream with
-  (* If this is a binop, find its precedence. *)
-  | Some (Token.Kwd c) when Hashtbl.mem binop_precedence c -&gt;
-      let token_prec = precedence c in
-
-      (* If this is a binop that binds at least as tightly as the current binop,
-       * consume it, otherwise we are done. *)
-      if token_prec &lt; expr_prec then lhs else begin
-        (* Eat the binop. *)
-        Stream.junk stream;
-
-        (* Parse the primary expression after the binary operator. *)
-        let rhs = parse_primary stream in
-
-        (* Okay, we know this is a binop. *)
-        let rhs =
-          match Stream.peek stream with
-          | Some (Token.Kwd c2) -&gt;
-              (* If BinOp binds less tightly with rhs than the operator after
-               * rhs, let the pending operator take rhs as its lhs. *)
-              let next_prec = precedence c2 in
-              if token_prec &lt; next_prec
-              then parse_bin_rhs (token_prec + 1) rhs stream
-              else rhs
-          | _ -&gt; rhs
-        in
-
-        (* Merge lhs/rhs. *)
-        let lhs = Ast.Binary (c, lhs, rhs) in
-        parse_bin_rhs expr_prec lhs stream
-      end
-  | _ -&gt; lhs
-
-(* expression
- *   ::= primary binoprhs *)
-and parse_expr = parser
-  | [&lt; lhs=parse_primary; stream &gt;] -&gt; parse_bin_rhs 0 lhs stream
-
-(* prototype
- *   ::= id '(' id* ')' *)
-let parse_prototype =
-  let rec parse_args accumulator = parser
-    | [&lt; 'Token.Ident id; e=parse_args (id::accumulator) &gt;] -&gt; e
-    | [&lt; &gt;] -&gt; accumulator
-  in
-
-  parser
-  | [&lt; 'Token.Ident id;
-       'Token.Kwd '(' ?? "expected '(' in prototype";
-       args=parse_args [];
-       'Token.Kwd ')' ?? "expected ')' in prototype" &gt;] -&gt;
-      (* success. *)
-      Ast.Prototype (id, Array.of_list (List.rev args))
-
-  | [&lt; &gt;] -&gt;
-      raise (Stream.Error "expected function name in prototype")
-
-(* definition ::= 'def' prototype expression *)
-let parse_definition = parser
-  | [&lt; 'Token.Def; p=parse_prototype; e=parse_expr &gt;] -&gt;
-      Ast.Function (p, e)
-
-(* toplevelexpr ::= expression *)
-let parse_toplevel = parser
-  | [&lt; e=parse_expr &gt;] -&gt;
-      (* Make an anonymous proto. *)
-      Ast.Function (Ast.Prototype ("", [||]), e)
-
-(*  external ::= 'extern' prototype *)
-let parse_extern = parser
-  | [&lt; 'Token.Extern; e=parse_prototype &gt;] -&gt; e
-</pre>
-</dd>
-
-<dt>codegen.ml:</dt>
-<dd class="doc_code">
-<pre>
-(*===----------------------------------------------------------------------===
- * Code Generation
- *===----------------------------------------------------------------------===*)
-
-open Llvm
-
-exception Error of string
-
-let context = global_context ()
-let the_module = create_module context "my cool jit"
-let builder = builder context
-let named_values:(string, llvalue) Hashtbl.t = Hashtbl.create 10
-
-let rec codegen_expr = function
-  | Ast.Number n -&gt; const_float double_type n
-  | Ast.Variable name -&gt;
-      (try Hashtbl.find named_values name with
-        | Not_found -&gt; raise (Error "unknown variable name"))
-  | Ast.Binary (op, lhs, rhs) -&gt;
-      let lhs_val = codegen_expr lhs in
-      let rhs_val = codegen_expr rhs in
-      begin
-        match op with
-        | '+' -&gt; build_add lhs_val rhs_val "addtmp" builder
-        | '-' -&gt; build_sub lhs_val rhs_val "subtmp" builder
-        | '*' -&gt; build_mul lhs_val rhs_val "multmp" builder
-        | '&lt;' -&gt;
-            (* Convert bool 0/1 to double 0.0 or 1.0 *)
-            let i = build_fcmp Fcmp.Ult lhs_val rhs_val "cmptmp" builder in
-            build_uitofp i double_type "booltmp" builder
-        | _ -&gt; raise (Error "invalid binary operator")
-      end
-  | Ast.Call (callee, args) -&gt;
-      (* Look up the name in the module table. *)
-      let callee =
-        match lookup_function callee the_module with
-        | Some callee -&gt; callee
-        | None -&gt; raise (Error "unknown function referenced")
-      in
-      let params = params callee in
-
-      (* If argument mismatch error. *)
-      if Array.length params == Array.length args then () else
-        raise (Error "incorrect # arguments passed");
-      let args = Array.map codegen_expr args in
-      build_call callee args "calltmp" builder
-
-let codegen_proto = function
-  | Ast.Prototype (name, args) -&gt;
-      (* Make the function type: double(double,double) etc. *)
-      let doubles = Array.make (Array.length args) double_type in
-      let ft = function_type double_type doubles in
-      let f =
-        match lookup_function name the_module with
-        | None -&gt; declare_function name ft the_module
-
-        (* If 'f' conflicted, there was already something named 'name'. If it
-         * has a body, don't allow redefinition or reextern. *)
-        | Some f -&gt;
-            (* If 'f' already has a body, reject this. *)
-            if block_begin f &lt;&gt; At_end f then
-              raise (Error "redefinition of function");
-
-            (* If 'f' took a different number of arguments, reject. *)
-            if element_type (type_of f) &lt;&gt; ft then
-              raise (Error "redefinition of function with different # args");
-            f
-      in
-
-      (* Set names for all arguments. *)
-      Array.iteri (fun i a -&gt;
-        let n = args.(i) in
-        set_value_name n a;
-        Hashtbl.add named_values n a;
-      ) (params f);
-      f
-
-let codegen_func = function
-  | Ast.Function (proto, body) -&gt;
-      Hashtbl.clear named_values;
-      let the_function = codegen_proto proto in
-
-      (* Create a new basic block to start insertion into. *)
-      let bb = append_block "entry" the_function in
-      position_at_end bb builder;
-
-      try
-        let ret_val = codegen_expr body in
-
-        (* Finish off the function. *)
-        let _ = build_ret ret_val builder in
-
-        (* Validate the generated code, checking for consistency. *)
-        Llvm_analysis.assert_valid_function the_function;
-
-        the_function
-      with e -&gt;
-        delete_function the_function;
-        raise e
-</pre>
-</dd>
-
-<dt>toplevel.ml:</dt>
-<dd class="doc_code">
-<pre>
-(*===----------------------------------------------------------------------===
- * Top-Level parsing and JIT Driver
- *===----------------------------------------------------------------------===*)
-
-open Llvm
-
-(* top ::= definition | external | expression | ';' *)
-let rec main_loop stream =
-  match Stream.peek stream with
-  | None -&gt; ()
-
-  (* ignore top-level semicolons. *)
-  | Some (Token.Kwd ';') -&gt;
-      Stream.junk stream;
-      main_loop stream
-
-  | Some token -&gt;
-      begin
-        try match token with
-        | Token.Def -&gt;
-            let e = Parser.parse_definition stream in
-            print_endline "parsed a function definition.";
-            dump_value (Codegen.codegen_func e);
-        | Token.Extern -&gt;
-            let e = Parser.parse_extern stream in
-            print_endline "parsed an extern.";
-            dump_value (Codegen.codegen_proto e);
-        | _ -&gt;
-            (* Evaluate a top-level expression into an anonymous function. *)
-            let e = Parser.parse_toplevel stream in
-            print_endline "parsed a top-level expr";
-            dump_value (Codegen.codegen_func e);
-        with Stream.Error s | Codegen.Error s -&gt;
-          (* Skip token for error recovery. *)
-          Stream.junk stream;
-          print_endline s;
-      end;
-      print_string "ready&gt; "; flush stdout;
-      main_loop stream
-</pre>
-</dd>
-
-<dt>toy.ml:</dt>
-<dd class="doc_code">
-<pre>
-(*===----------------------------------------------------------------------===
- * Main driver code.
- *===----------------------------------------------------------------------===*)
-
-open Llvm
-
-let main () =
-  (* Install standard binary operators.
-   * 1 is the lowest precedence. *)
-  Hashtbl.add Parser.binop_precedence '&lt;' 10;
-  Hashtbl.add Parser.binop_precedence '+' 20;
-  Hashtbl.add Parser.binop_precedence '-' 20;
-  Hashtbl.add Parser.binop_precedence '*' 40;    (* highest. *)
-
-  (* Prime the first token. *)
-  print_string "ready&gt; "; flush stdout;
-  let stream = Lexer.lex (Stream.of_channel stdin) in
-
-  (* Run the main "interpreter loop" now. *)
-  Toplevel.main_loop stream;
-
-  (* Print out all the generated code. *)
-  dump_module Codegen.the_module
-;;
-
-main ()
-</pre>
-</dd>
-</dl>
-
-<a href="OCamlLangImpl4.html">Next: Adding JIT and Optimizer Support</a>
-</div>
-
-<!-- *********************************************************************** -->
-<hr>
-<address>
-  <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
-  src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"></a>
-  <a href="http://validator.w3.org/check/referer"><img
-  src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"></a>
-
-  <a href="mailto:sabre at nondot.org">Chris Lattner</a><br>
-  <a href="mailto:idadesub at users.sourceforge.net">Erick Tryzelaar</a><br>
-  <a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
-  Last modified: $Date$
-</address>
-</body>
-</html>
diff --git a/libclamav/c++/llvm/docs/tutorial/OCamlLangImpl4.html b/libclamav/c++/llvm/docs/tutorial/OCamlLangImpl4.html
deleted file mode 100644
index 534502d..0000000
--- a/libclamav/c++/llvm/docs/tutorial/OCamlLangImpl4.html
+++ /dev/null
@@ -1,1038 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-                      "http://www.w3.org/TR/html4/strict.dtd">
-
-<html>
-<head>
-  <title>Kaleidoscope: Adding JIT and Optimizer Support</title>
-  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-  <meta name="author" content="Chris Lattner">
-  <meta name="author" content="Erick Tryzelaar">
-  <link rel="stylesheet" href="../llvm.css" type="text/css">
-</head>
-
-<body>
-
-<div class="doc_title">Kaleidoscope: Adding JIT and Optimizer Support</div>
-
-<ul>
-<li><a href="index.html">Up to Tutorial Index</a></li>
-<li>Chapter 4
-  <ol>
-    <li><a href="#intro">Chapter 4 Introduction</a></li>
-    <li><a href="#trivialconstfold">Trivial Constant Folding</a></li>
-    <li><a href="#optimizerpasses">LLVM Optimization Passes</a></li>
-    <li><a href="#jit">Adding a JIT Compiler</a></li>
-    <li><a href="#code">Full Code Listing</a></li>
-  </ol>
-</li>
-<li><a href="OCamlLangImpl5.html">Chapter 5</a>: Extending the Language: Control
-Flow</li>
-</ul>
-
-<div class="doc_author">
-	<p>
-		Written by <a href="mailto:sabre at nondot.org">Chris Lattner</a>
-		and <a href="mailto:idadesub at users.sourceforge.net">Erick Tryzelaar</a>
-	</p>
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="intro">Chapter 4 Introduction</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>Welcome to Chapter 4 of the "<a href="index.html">Implementing a language
-with LLVM</a>" tutorial.  Chapters 1-3 described the implementation of a simple
-language and added support for generating LLVM IR.  This chapter describes
-two new techniques: adding optimizer support to your language, and adding JIT
-compiler support.  These additions will demonstrate how to get nice, efficient code
-for the Kaleidoscope language.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="trivialconstfold">Trivial Constant
-Folding</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p><b>Note:</b> the default <tt>IRBuilder</tt> now always includes the constant 
-folding optimisations below.<p>
-
-<p>
-Our demonstration for Chapter 3 is elegant and easy to extend.  Unfortunately,
-it does not produce wonderful code.  For example, when compiling simple code,
-we don't get obvious optimizations:</p>
-
-<div class="doc_code">
-<pre>
-ready&gt; <b>def test(x) 1+2+x;</b>
-Read function definition:
-define double @test(double %x) {
-entry:
-        %addtmp = add double 1.000000e+00, 2.000000e+00
-        %addtmp1 = add double %addtmp, %x
-        ret double %addtmp1
-}
-</pre>
-</div>
-
-<p>This code is a very, very literal transcription of the AST built by parsing
-the input. As such, this transcription lacks optimizations like constant folding
-(we'd like to get "<tt>add x, 3.0</tt>" in the example above) as well as other
-more important optimizations.  Constant folding, in particular, is a very common
-and very important optimization: so much so that many language implementors
-implement constant folding support in their AST representation.</p>
-
-<p>With LLVM, you don't need this support in the AST.  Since all calls to build
-LLVM IR go through the LLVM builder, it would be nice if the builder itself
-checked to see if there was a constant folding opportunity when you call it.
-If so, it could just do the constant fold and return the constant instead of
-creating an instruction.  This is exactly what the <tt>LLVMFoldingBuilder</tt>
-class does.
-
-<p>All we did was switch from <tt>LLVMBuilder</tt> to
-<tt>LLVMFoldingBuilder</tt>.  Though we change no other code, we now have all of our
-instructions implicitly constant folded without us having to do anything
-about it.  For example, the input above now compiles to:</p>
-
-<div class="doc_code">
-<pre>
-ready&gt; <b>def test(x) 1+2+x;</b>
-Read function definition:
-define double @test(double %x) {
-entry:
-        %addtmp = add double 3.000000e+00, %x
-        ret double %addtmp
-}
-</pre>
-</div>
-
-<p>Well, that was easy :).  In practice, we recommend always using
-<tt>LLVMFoldingBuilder</tt> when generating code like this.  It has no
-"syntactic overhead" for its use (you don't have to uglify your compiler with
-constant checks everywhere) and it can dramatically reduce the amount of
-LLVM IR that is generated in some cases (particular for languages with a macro
-preprocessor or that use a lot of constants).</p>
-
-<p>On the other hand, the <tt>LLVMFoldingBuilder</tt> is limited by the fact
-that it does all of its analysis inline with the code as it is built.  If you
-take a slightly more complex example:</p>
-
-<div class="doc_code">
-<pre>
-ready&gt; <b>def test(x) (1+2+x)*(x+(1+2));</b>
-ready&gt; Read function definition:
-define double @test(double %x) {
-entry:
-        %addtmp = add double 3.000000e+00, %x
-        %addtmp1 = add double %x, 3.000000e+00
-        %multmp = mul double %addtmp, %addtmp1
-        ret double %multmp
-}
-</pre>
-</div>
-
-<p>In this case, the LHS and RHS of the multiplication are the same value.  We'd
-really like to see this generate "<tt>tmp = x+3; result = tmp*tmp;</tt>" instead
-of computing "<tt>x*3</tt>" twice.</p>
-
-<p>Unfortunately, no amount of local analysis will be able to detect and correct
-this.  This requires two transformations: reassociation of expressions (to
-make the add's lexically identical) and Common Subexpression Elimination (CSE)
-to  delete the redundant add instruction.  Fortunately, LLVM provides a broad
-range of optimizations that you can use, in the form of "passes".</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="optimizerpasses">LLVM Optimization
- Passes</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>LLVM provides many optimization passes, which do many different sorts of
-things and have different tradeoffs.  Unlike other systems, LLVM doesn't hold
-to the mistaken notion that one set of optimizations is right for all languages
-and for all situations.  LLVM allows a compiler implementor to make complete
-decisions about what optimizations to use, in which order, and in what
-situation.</p>
-
-<p>As a concrete example, LLVM supports both "whole module" passes, which look
-across as large of body of code as they can (often a whole file, but if run
-at link time, this can be a substantial portion of the whole program).  It also
-supports and includes "per-function" passes which just operate on a single
-function at a time, without looking at other functions.  For more information
-on passes and how they are run, see the <a href="../WritingAnLLVMPass.html">How
-to Write a Pass</a> document and the <a href="../Passes.html">List of LLVM
-Passes</a>.</p>
-
-<p>For Kaleidoscope, we are currently generating functions on the fly, one at
-a time, as the user types them in.  We aren't shooting for the ultimate
-optimization experience in this setting, but we also want to catch the easy and
-quick stuff where possible.  As such, we will choose to run a few per-function
-optimizations as the user types the function in.  If we wanted to make a "static
-Kaleidoscope compiler", we would use exactly the code we have now, except that
-we would defer running the optimizer until the entire file has been parsed.</p>
-
-<p>In order to get per-function optimizations going, we need to set up a
-<a href="../WritingAnLLVMPass.html#passmanager">Llvm.PassManager</a> to hold and
-organize the LLVM optimizations that we want to run.  Once we have that, we can
-add a set of optimizations to run.  The code looks like this:</p>
-
-<div class="doc_code">
-<pre>
-  (* Create the JIT. *)
-  let the_module_provider = ModuleProvider.create Codegen.the_module in
-  let the_execution_engine = ExecutionEngine.create the_module_provider in
-  let the_fpm = PassManager.create_function the_module_provider in
-
-  (* Set up the optimizer pipeline.  Start with registering info about how the
-   * target lays out data structures. *)
-  TargetData.add (ExecutionEngine.target_data the_execution_engine) the_fpm;
-
-  (* Do simple "peephole" optimizations and bit-twiddling optzn. *)
-  add_instruction_combining the_fpm;
-
-  (* reassociate expressions. *)
-  add_reassociation the_fpm;
-
-  (* Eliminate Common SubExpressions. *)
-  add_gvn the_fpm;
-
-  (* Simplify the control flow graph (deleting unreachable blocks, etc). *)
-  add_cfg_simplification the_fpm;
-
-  ignore (PassManager.initialize the_fpm);
-
-  (* Run the main "interpreter loop" now. *)
-  Toplevel.main_loop the_fpm the_execution_engine stream;
-</pre>
-</div>
-
-<p>This code defines two values, an <tt>Llvm.llmoduleprovider</tt> and a
-<tt>Llvm.PassManager.t</tt>.  The former is basically a wrapper around our
-<tt>Llvm.llmodule</tt> that the <tt>Llvm.PassManager.t</tt> requires.  It
-provides certain flexibility that we're not going to take advantage of here,
-so I won't dive into any details about it.</p>
-
-<p>The meat of the matter here, is the definition of "<tt>the_fpm</tt>".  It
-requires a pointer to the <tt>the_module</tt> (through the
-<tt>the_module_provider</tt>) to construct itself.  Once it is set up, we use a
-series of "add" calls to add a bunch of LLVM passes.  The first pass is
-basically boilerplate, it adds a pass so that later optimizations know how the
-data structures in the program are laid out.  The
-"<tt>the_execution_engine</tt>" variable is related to the JIT, which we will
-get to in the next section.</p>
-
-<p>In this case, we choose to add 4 optimization passes.  The passes we chose
-here are a pretty standard set of "cleanup" optimizations that are useful for
-a wide variety of code.  I won't delve into what they do but, believe me,
-they are a good starting place :).</p>
-
-<p>Once the <tt>Llvm.PassManager.</tt> is set up, we need to make use of it.
-We do this by running it after our newly created function is constructed (in
-<tt>Codegen.codegen_func</tt>), but before it is returned to the client:</p>
-
-<div class="doc_code">
-<pre>
-let codegen_func the_fpm = function
-      ...
-      try
-        let ret_val = codegen_expr body in
-
-        (* Finish off the function. *)
-        let _ = build_ret ret_val builder in
-
-        (* Validate the generated code, checking for consistency. *)
-        Llvm_analysis.assert_valid_function the_function;
-
-        (* Optimize the function. *)
-        let _ = PassManager.run_function the_function the_fpm in
-
-        the_function
-</pre>
-</div>
-
-<p>As you can see, this is pretty straightforward.  The <tt>the_fpm</tt>
-optimizes and updates the LLVM Function* in place, improving (hopefully) its
-body.  With this in place, we can try our test above again:</p>
-
-<div class="doc_code">
-<pre>
-ready&gt; <b>def test(x) (1+2+x)*(x+(1+2));</b>
-ready&gt; Read function definition:
-define double @test(double %x) {
-entry:
-        %addtmp = add double %x, 3.000000e+00
-        %multmp = mul double %addtmp, %addtmp
-        ret double %multmp
-}
-</pre>
-</div>
-
-<p>As expected, we now get our nicely optimized code, saving a floating point
-add instruction from every execution of this function.</p>
-
-<p>LLVM provides a wide variety of optimizations that can be used in certain
-circumstances.  Some <a href="../Passes.html">documentation about the various
-passes</a> is available, but it isn't very complete.  Another good source of
-ideas can come from looking at the passes that <tt>llvm-gcc</tt> or
-<tt>llvm-ld</tt> run to get started.  The "<tt>opt</tt>" tool allows you to
-experiment with passes from the command line, so you can see if they do
-anything.</p>
-
-<p>Now that we have reasonable code coming out of our front-end, lets talk about
-executing it!</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="jit">Adding a JIT Compiler</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>Code that is available in LLVM IR can have a wide variety of tools
-applied to it.  For example, you can run optimizations on it (as we did above),
-you can dump it out in textual or binary forms, you can compile the code to an
-assembly file (.s) for some target, or you can JIT compile it.  The nice thing
-about the LLVM IR representation is that it is the "common currency" between
-many different parts of the compiler.
-</p>
-
-<p>In this section, we'll add JIT compiler support to our interpreter.  The
-basic idea that we want for Kaleidoscope is to have the user enter function
-bodies as they do now, but immediately evaluate the top-level expressions they
-type in.  For example, if they type in "1 + 2;", we should evaluate and print
-out 3.  If they define a function, they should be able to call it from the
-command line.</p>
-
-<p>In order to do this, we first declare and initialize the JIT.  This is done
-by adding a global variable and a call in <tt>main</tt>:</p>
-
-<div class="doc_code">
-<pre>
-...
-let main () =
-  ...
-  <b>(* Create the JIT. *)
-  let the_module_provider = ModuleProvider.create Codegen.the_module in
-  let the_execution_engine = ExecutionEngine.create the_module_provider in</b>
-  ...
-</pre>
-</div>
-
-<p>This creates an abstract "Execution Engine" which can be either a JIT
-compiler or the LLVM interpreter.  LLVM will automatically pick a JIT compiler
-for you if one is available for your platform, otherwise it will fall back to
-the interpreter.</p>
-
-<p>Once the <tt>Llvm_executionengine.ExecutionEngine.t</tt> is created, the JIT
-is ready to be used.  There are a variety of APIs that are useful, but the
-simplest one is the "<tt>Llvm_executionengine.ExecutionEngine.run_function</tt>"
-function.  This method JIT compiles the specified LLVM Function and returns a
-function pointer to the generated machine code.  In our case, this means that we
-can change the code that parses a top-level expression to look like this:</p>
-
-<div class="doc_code">
-<pre>
-            (* Evaluate a top-level expression into an anonymous function. *)
-            let e = Parser.parse_toplevel stream in
-            print_endline "parsed a top-level expr";
-            let the_function = Codegen.codegen_func the_fpm e in
-            dump_value the_function;
-
-            (* JIT the function, returning a function pointer. *)
-            let result = ExecutionEngine.run_function the_function [||]
-              the_execution_engine in
-
-            print_string "Evaluated to ";
-            print_float (GenericValue.as_float double_type result);
-            print_newline ();
-</pre>
-</div>
-
-<p>Recall that we compile top-level expressions into a self-contained LLVM
-function that takes no arguments and returns the computed double.  Because the
-LLVM JIT compiler matches the native platform ABI, this means that you can just
-cast the result pointer to a function pointer of that type and call it directly.
-This means, there is no difference between JIT compiled code and native machine
-code that is statically linked into your application.</p>
-
-<p>With just these two changes, lets see how Kaleidoscope works now!</p>
-
-<div class="doc_code">
-<pre>
-ready&gt; <b>4+5;</b>
-define double @""() {
-entry:
-        ret double 9.000000e+00
-}
-
-<em>Evaluated to 9.000000</em>
-</pre>
-</div>
-
-<p>Well this looks like it is basically working.  The dump of the function
-shows the "no argument function that always returns double" that we synthesize
-for each top level expression that is typed in.  This demonstrates very basic
-functionality, but can we do more?</p>
-
-<div class="doc_code">
-<pre>
-ready&gt; <b>def testfunc(x y) x + y*2; </b>
-Read function definition:
-define double @testfunc(double %x, double %y) {
-entry:
-        %multmp = mul double %y, 2.000000e+00
-        %addtmp = add double %multmp, %x
-        ret double %addtmp
-}
-
-ready&gt; <b>testfunc(4, 10);</b>
-define double @""() {
-entry:
-        %calltmp = call double @testfunc( double 4.000000e+00, double 1.000000e+01 )
-        ret double %calltmp
-}
-
-<em>Evaluated to 24.000000</em>
-</pre>
-</div>
-
-<p>This illustrates that we can now call user code, but there is something a bit
-subtle going on here.  Note that we only invoke the JIT on the anonymous
-functions that <em>call testfunc</em>, but we never invoked it
-on <em>testfunc</em> itself.  What actually happened here is that the JIT
-scanned for all non-JIT'd functions transitively called from the anonymous
-function and compiled all of them before returning
-from <tt>run_function</tt>.</p>
-
-<p>The JIT provides a number of other more advanced interfaces for things like
-freeing allocated machine code, rejit'ing functions to update them, etc.
-However, even with this simple code, we get some surprisingly powerful
-capabilities - check this out (I removed the dump of the anonymous functions,
-you should get the idea by now :) :</p>
-
-<div class="doc_code">
-<pre>
-ready&gt; <b>extern sin(x);</b>
-Read extern:
-declare double @sin(double)
-
-ready&gt; <b>extern cos(x);</b>
-Read extern:
-declare double @cos(double)
-
-ready&gt; <b>sin(1.0);</b>
-<em>Evaluated to 0.841471</em>
-
-ready&gt; <b>def foo(x) sin(x)*sin(x) + cos(x)*cos(x);</b>
-Read function definition:
-define double @foo(double %x) {
-entry:
-        %calltmp = call double @sin( double %x )
-        %multmp = mul double %calltmp, %calltmp
-        %calltmp2 = call double @cos( double %x )
-        %multmp4 = mul double %calltmp2, %calltmp2
-        %addtmp = add double %multmp, %multmp4
-        ret double %addtmp
-}
-
-ready&gt; <b>foo(4.0);</b>
-<em>Evaluated to 1.000000</em>
-</pre>
-</div>
-
-<p>Whoa, how does the JIT know about sin and cos?  The answer is surprisingly
-simple: in this example, the JIT started execution of a function and got to a
-function call.  It realized that the function was not yet JIT compiled and
-invoked the standard set of routines to resolve the function.  In this case,
-there is no body defined for the function, so the JIT ended up calling
-"<tt>dlsym("sin")</tt>" on the Kaleidoscope process itself.  Since
-"<tt>sin</tt>" is defined within the JIT's address space, it simply patches up
-calls in the module to call the libm version of <tt>sin</tt> directly.</p>
-
-<p>The LLVM JIT provides a number of interfaces (look in the
-<tt>llvm_executionengine.mli</tt> file) for controlling how unknown functions
-get resolved.  It allows you to establish explicit mappings between IR objects
-and addresses (useful for LLVM global variables that you want to map to static
-tables, for example), allows you to dynamically decide on the fly based on the
-function name, and even allows you to have the JIT compile functions lazily the
-first time they're called.</p>
-
-<p>One interesting application of this is that we can now extend the language
-by writing arbitrary C code to implement operations.  For example, if we add:
-</p>
-
-<div class="doc_code">
-<pre>
-/* putchard - putchar that takes a double and returns 0. */
-extern "C"
-double putchard(double X) {
-  putchar((char)X);
-  return 0;
-}
-</pre>
-</div>
-
-<p>Now we can produce simple output to the console by using things like:
-"<tt>extern putchard(x); putchard(120);</tt>", which prints a lowercase 'x' on
-the console (120 is the ASCII code for 'x').  Similar code could be used to
-implement file I/O, console input, and many other capabilities in
-Kaleidoscope.</p>
-
-<p>This completes the JIT and optimizer chapter of the Kaleidoscope tutorial. At
-this point, we can compile a non-Turing-complete programming language, optimize
-and JIT compile it in a user-driven way.  Next up we'll look into <a
-href="OCamlLangImpl5.html">extending the language with control flow
-constructs</a>, tackling some interesting LLVM IR issues along the way.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="code">Full Code Listing</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>
-Here is the complete code listing for our running example, enhanced with the
-LLVM JIT and optimizer.  To build this example, use:
-</p>
-
-<div class="doc_code">
-<pre>
-# Compile
-ocamlbuild toy.byte
-# Run
-./toy.byte
-</pre>
-</div>
-
-<p>Here is the code:</p>
-
-<dl>
-<dt>_tags:</dt>
-<dd class="doc_code">
-<pre>
-&lt;{lexer,parser}.ml&gt;: use_camlp4, pp(camlp4of)
-&lt;*.{byte,native}&gt;: g++, use_llvm, use_llvm_analysis
-&lt;*.{byte,native}&gt;: use_llvm_executionengine, use_llvm_target
-&lt;*.{byte,native}&gt;: use_llvm_scalar_opts, use_bindings
-</pre>
-</dd>
-
-<dt>myocamlbuild.ml:</dt>
-<dd class="doc_code">
-<pre>
-open Ocamlbuild_plugin;;
-
-ocaml_lib ~extern:true "llvm";;
-ocaml_lib ~extern:true "llvm_analysis";;
-ocaml_lib ~extern:true "llvm_executionengine";;
-ocaml_lib ~extern:true "llvm_target";;
-ocaml_lib ~extern:true "llvm_scalar_opts";;
-
-flag ["link"; "ocaml"; "g++"] (S[A"-cc"; A"g++"]);;
-dep ["link"; "ocaml"; "use_bindings"] ["bindings.o"];;
-</pre>
-</dd>
-
-<dt>token.ml:</dt>
-<dd class="doc_code">
-<pre>
-(*===----------------------------------------------------------------------===
- * Lexer Tokens
- *===----------------------------------------------------------------------===*)
-
-(* The lexer returns these 'Kwd' if it is an unknown character, otherwise one of
- * these others for known things. *)
-type token =
-  (* commands *)
-  | Def | Extern
-
-  (* primary *)
-  | Ident of string | Number of float
-
-  (* unknown *)
-  | Kwd of char
-</pre>
-</dd>
-
-<dt>lexer.ml:</dt>
-<dd class="doc_code">
-<pre>
-(*===----------------------------------------------------------------------===
- * Lexer
- *===----------------------------------------------------------------------===*)
-
-let rec lex = parser
-  (* Skip any whitespace. *)
-  | [&lt; ' (' ' | '\n' | '\r' | '\t'); stream &gt;] -&gt; lex stream
-
-  (* identifier: [a-zA-Z][a-zA-Z0-9] *)
-  | [&lt; ' ('A' .. 'Z' | 'a' .. 'z' as c); stream &gt;] -&gt;
-      let buffer = Buffer.create 1 in
-      Buffer.add_char buffer c;
-      lex_ident buffer stream
-
-  (* number: [0-9.]+ *)
-  | [&lt; ' ('0' .. '9' as c); stream &gt;] -&gt;
-      let buffer = Buffer.create 1 in
-      Buffer.add_char buffer c;
-      lex_number buffer stream
-
-  (* Comment until end of line. *)
-  | [&lt; ' ('#'); stream &gt;] -&gt;
-      lex_comment stream
-
-  (* Otherwise, just return the character as its ascii value. *)
-  | [&lt; 'c; stream &gt;] -&gt;
-      [&lt; 'Token.Kwd c; lex stream &gt;]
-
-  (* end of stream. *)
-  | [&lt; &gt;] -&gt; [&lt; &gt;]
-
-and lex_number buffer = parser
-  | [&lt; ' ('0' .. '9' | '.' as c); stream &gt;] -&gt;
-      Buffer.add_char buffer c;
-      lex_number buffer stream
-  | [&lt; stream=lex &gt;] -&gt;
-      [&lt; 'Token.Number (float_of_string (Buffer.contents buffer)); stream &gt;]
-
-and lex_ident buffer = parser
-  | [&lt; ' ('A' .. 'Z' | 'a' .. 'z' | '0' .. '9' as c); stream &gt;] -&gt;
-      Buffer.add_char buffer c;
-      lex_ident buffer stream
-  | [&lt; stream=lex &gt;] -&gt;
-      match Buffer.contents buffer with
-      | "def" -&gt; [&lt; 'Token.Def; stream &gt;]
-      | "extern" -&gt; [&lt; 'Token.Extern; stream &gt;]
-      | id -&gt; [&lt; 'Token.Ident id; stream &gt;]
-
-and lex_comment = parser
-  | [&lt; ' ('\n'); stream=lex &gt;] -&gt; stream
-  | [&lt; 'c; e=lex_comment &gt;] -&gt; e
-  | [&lt; &gt;] -&gt; [&lt; &gt;]
-</pre>
-</dd>
-
-<dt>ast.ml:</dt>
-<dd class="doc_code">
-<pre>
-(*===----------------------------------------------------------------------===
- * Abstract Syntax Tree (aka Parse Tree)
- *===----------------------------------------------------------------------===*)
-
-(* expr - Base type for all expression nodes. *)
-type expr =
-  (* variant for numeric literals like "1.0". *)
-  | Number of float
-
-  (* variant for referencing a variable, like "a". *)
-  | Variable of string
-
-  (* variant for a binary operator. *)
-  | Binary of char * expr * expr
-
-  (* variant for function calls. *)
-  | Call of string * expr array
-
-(* proto - This type represents the "prototype" for a function, which captures
- * its name, and its argument names (thus implicitly the number of arguments the
- * function takes). *)
-type proto = Prototype of string * string array
-
-(* func - This type represents a function definition itself. *)
-type func = Function of proto * expr
-</pre>
-</dd>
-
-<dt>parser.ml:</dt>
-<dd class="doc_code">
-<pre>
-(*===---------------------------------------------------------------------===
- * Parser
- *===---------------------------------------------------------------------===*)
-
-(* binop_precedence - This holds the precedence for each binary operator that is
- * defined *)
-let binop_precedence:(char, int) Hashtbl.t = Hashtbl.create 10
-
-(* precedence - Get the precedence of the pending binary operator token. *)
-let precedence c = try Hashtbl.find binop_precedence c with Not_found -&gt; -1
-
-(* primary
- *   ::= identifier
- *   ::= numberexpr
- *   ::= parenexpr *)
-let rec parse_primary = parser
-  (* numberexpr ::= number *)
-  | [&lt; 'Token.Number n &gt;] -&gt; Ast.Number n
-
-  (* parenexpr ::= '(' expression ')' *)
-  | [&lt; 'Token.Kwd '('; e=parse_expr; 'Token.Kwd ')' ?? "expected ')'" &gt;] -&gt; e
-
-  (* identifierexpr
-   *   ::= identifier
-   *   ::= identifier '(' argumentexpr ')' *)
-  | [&lt; 'Token.Ident id; stream &gt;] -&gt;
-      let rec parse_args accumulator = parser
-        | [&lt; e=parse_expr; stream &gt;] -&gt;
-            begin parser
-              | [&lt; 'Token.Kwd ','; e=parse_args (e :: accumulator) &gt;] -&gt; e
-              | [&lt; &gt;] -&gt; e :: accumulator
-            end stream
-        | [&lt; &gt;] -&gt; accumulator
-      in
-      let rec parse_ident id = parser
-        (* Call. *)
-        | [&lt; 'Token.Kwd '(';
-             args=parse_args [];
-             'Token.Kwd ')' ?? "expected ')'"&gt;] -&gt;
-            Ast.Call (id, Array.of_list (List.rev args))
-
-        (* Simple variable ref. *)
-        | [&lt; &gt;] -&gt; Ast.Variable id
-      in
-      parse_ident id stream
-
-  | [&lt; &gt;] -&gt; raise (Stream.Error "unknown token when expecting an expression.")
-
-(* binoprhs
- *   ::= ('+' primary)* *)
-and parse_bin_rhs expr_prec lhs stream =
-  match Stream.peek stream with
-  (* If this is a binop, find its precedence. *)
-  | Some (Token.Kwd c) when Hashtbl.mem binop_precedence c -&gt;
-      let token_prec = precedence c in
-
-      (* If this is a binop that binds at least as tightly as the current binop,
-       * consume it, otherwise we are done. *)
-      if token_prec &lt; expr_prec then lhs else begin
-        (* Eat the binop. *)
-        Stream.junk stream;
-
-        (* Parse the primary expression after the binary operator. *)
-        let rhs = parse_primary stream in
-
-        (* Okay, we know this is a binop. *)
-        let rhs =
-          match Stream.peek stream with
-          | Some (Token.Kwd c2) -&gt;
-              (* If BinOp binds less tightly with rhs than the operator after
-               * rhs, let the pending operator take rhs as its lhs. *)
-              let next_prec = precedence c2 in
-              if token_prec &lt; next_prec
-              then parse_bin_rhs (token_prec + 1) rhs stream
-              else rhs
-          | _ -&gt; rhs
-        in
-
-        (* Merge lhs/rhs. *)
-        let lhs = Ast.Binary (c, lhs, rhs) in
-        parse_bin_rhs expr_prec lhs stream
-      end
-  | _ -&gt; lhs
-
-(* expression
- *   ::= primary binoprhs *)
-and parse_expr = parser
-  | [&lt; lhs=parse_primary; stream &gt;] -&gt; parse_bin_rhs 0 lhs stream
-
-(* prototype
- *   ::= id '(' id* ')' *)
-let parse_prototype =
-  let rec parse_args accumulator = parser
-    | [&lt; 'Token.Ident id; e=parse_args (id::accumulator) &gt;] -&gt; e
-    | [&lt; &gt;] -&gt; accumulator
-  in
-
-  parser
-  | [&lt; 'Token.Ident id;
-       'Token.Kwd '(' ?? "expected '(' in prototype";
-       args=parse_args [];
-       'Token.Kwd ')' ?? "expected ')' in prototype" &gt;] -&gt;
-      (* success. *)
-      Ast.Prototype (id, Array.of_list (List.rev args))
-
-  | [&lt; &gt;] -&gt;
-      raise (Stream.Error "expected function name in prototype")
-
-(* definition ::= 'def' prototype expression *)
-let parse_definition = parser
-  | [&lt; 'Token.Def; p=parse_prototype; e=parse_expr &gt;] -&gt;
-      Ast.Function (p, e)
-
-(* toplevelexpr ::= expression *)
-let parse_toplevel = parser
-  | [&lt; e=parse_expr &gt;] -&gt;
-      (* Make an anonymous proto. *)
-      Ast.Function (Ast.Prototype ("", [||]), e)
-
-(*  external ::= 'extern' prototype *)
-let parse_extern = parser
-  | [&lt; 'Token.Extern; e=parse_prototype &gt;] -&gt; e
-</pre>
-</dd>
-
-<dt>codegen.ml:</dt>
-<dd class="doc_code">
-<pre>
-(*===----------------------------------------------------------------------===
- * Code Generation
- *===----------------------------------------------------------------------===*)
-
-open Llvm
-
-exception Error of string
-
-let context = global_context ()
-let the_module = create_module context "my cool jit"
-let builder = builder context
-let named_values:(string, llvalue) Hashtbl.t = Hashtbl.create 10
-
-let rec codegen_expr = function
-  | Ast.Number n -&gt; const_float double_type n
-  | Ast.Variable name -&gt;
-      (try Hashtbl.find named_values name with
-        | Not_found -&gt; raise (Error "unknown variable name"))
-  | Ast.Binary (op, lhs, rhs) -&gt;
-      let lhs_val = codegen_expr lhs in
-      let rhs_val = codegen_expr rhs in
-      begin
-        match op with
-        | '+' -&gt; build_add lhs_val rhs_val "addtmp" builder
-        | '-' -&gt; build_sub lhs_val rhs_val "subtmp" builder
-        | '*' -&gt; build_mul lhs_val rhs_val "multmp" builder
-        | '&lt;' -&gt;
-            (* Convert bool 0/1 to double 0.0 or 1.0 *)
-            let i = build_fcmp Fcmp.Ult lhs_val rhs_val "cmptmp" builder in
-            build_uitofp i double_type "booltmp" builder
-        | _ -&gt; raise (Error "invalid binary operator")
-      end
-  | Ast.Call (callee, args) -&gt;
-      (* Look up the name in the module table. *)
-      let callee =
-        match lookup_function callee the_module with
-        | Some callee -&gt; callee
-        | None -&gt; raise (Error "unknown function referenced")
-      in
-      let params = params callee in
-
-      (* If argument mismatch error. *)
-      if Array.length params == Array.length args then () else
-        raise (Error "incorrect # arguments passed");
-      let args = Array.map codegen_expr args in
-      build_call callee args "calltmp" builder
-
-let codegen_proto = function
-  | Ast.Prototype (name, args) -&gt;
-      (* Make the function type: double(double,double) etc. *)
-      let doubles = Array.make (Array.length args) double_type in
-      let ft = function_type double_type doubles in
-      let f =
-        match lookup_function name the_module with
-        | None -&gt; declare_function name ft the_module
-
-        (* If 'f' conflicted, there was already something named 'name'. If it
-         * has a body, don't allow redefinition or reextern. *)
-        | Some f -&gt;
-            (* If 'f' already has a body, reject this. *)
-            if block_begin f &lt;&gt; At_end f then
-              raise (Error "redefinition of function");
-
-            (* If 'f' took a different number of arguments, reject. *)
-            if element_type (type_of f) &lt;&gt; ft then
-              raise (Error "redefinition of function with different # args");
-            f
-      in
-
-      (* Set names for all arguments. *)
-      Array.iteri (fun i a -&gt;
-        let n = args.(i) in
-        set_value_name n a;
-        Hashtbl.add named_values n a;
-      ) (params f);
-      f
-
-let codegen_func the_fpm = function
-  | Ast.Function (proto, body) -&gt;
-      Hashtbl.clear named_values;
-      let the_function = codegen_proto proto in
-
-      (* Create a new basic block to start insertion into. *)
-      let bb = append_block "entry" the_function in
-      position_at_end bb builder;
-
-      try
-        let ret_val = codegen_expr body in
-
-        (* Finish off the function. *)
-        let _ = build_ret ret_val builder in
-
-        (* Validate the generated code, checking for consistency. *)
-        Llvm_analysis.assert_valid_function the_function;
-
-        (* Optimize the function. *)
-        let _ = PassManager.run_function the_function the_fpm in
-
-        the_function
-      with e -&gt;
-        delete_function the_function;
-        raise e
-</pre>
-</dd>
-
-<dt>toplevel.ml:</dt>
-<dd class="doc_code">
-<pre>
-(*===----------------------------------------------------------------------===
- * Top-Level parsing and JIT Driver
- *===----------------------------------------------------------------------===*)
-
-open Llvm
-open Llvm_executionengine
-
-(* top ::= definition | external | expression | ';' *)
-let rec main_loop the_fpm the_execution_engine stream =
-  match Stream.peek stream with
-  | None -&gt; ()
-
-  (* ignore top-level semicolons. *)
-  | Some (Token.Kwd ';') -&gt;
-      Stream.junk stream;
-      main_loop the_fpm the_execution_engine stream
-
-  | Some token -&gt;
-      begin
-        try match token with
-        | Token.Def -&gt;
-            let e = Parser.parse_definition stream in
-            print_endline "parsed a function definition.";
-            dump_value (Codegen.codegen_func the_fpm e);
-        | Token.Extern -&gt;
-            let e = Parser.parse_extern stream in
-            print_endline "parsed an extern.";
-            dump_value (Codegen.codegen_proto e);
-        | _ -&gt;
-            (* Evaluate a top-level expression into an anonymous function. *)
-            let e = Parser.parse_toplevel stream in
-            print_endline "parsed a top-level expr";
-            let the_function = Codegen.codegen_func the_fpm e in
-            dump_value the_function;
-
-            (* JIT the function, returning a function pointer. *)
-            let result = ExecutionEngine.run_function the_function [||]
-              the_execution_engine in
-
-            print_string "Evaluated to ";
-            print_float (GenericValue.as_float double_type result);
-            print_newline ();
-        with Stream.Error s | Codegen.Error s -&gt;
-          (* Skip token for error recovery. *)
-          Stream.junk stream;
-          print_endline s;
-      end;
-      print_string "ready&gt; "; flush stdout;
-      main_loop the_fpm the_execution_engine stream
-</pre>
-</dd>
-
-<dt>toy.ml:</dt>
-<dd class="doc_code">
-<pre>
-(*===----------------------------------------------------------------------===
- * Main driver code.
- *===----------------------------------------------------------------------===*)
-
-open Llvm
-open Llvm_executionengine
-open Llvm_target
-open Llvm_scalar_opts
-
-let main () =
-  ignore (initialize_native_target ());
-
-  (* Install standard binary operators.
-   * 1 is the lowest precedence. *)
-  Hashtbl.add Parser.binop_precedence '&lt;' 10;
-  Hashtbl.add Parser.binop_precedence '+' 20;
-  Hashtbl.add Parser.binop_precedence '-' 20;
-  Hashtbl.add Parser.binop_precedence '*' 40;    (* highest. *)
-
-  (* Prime the first token. *)
-  print_string "ready&gt; "; flush stdout;
-  let stream = Lexer.lex (Stream.of_channel stdin) in
-
-  (* Create the JIT. *)
-  let the_module_provider = ModuleProvider.create Codegen.the_module in
-  let the_execution_engine = ExecutionEngine.create the_module_provider in
-  let the_fpm = PassManager.create_function the_module_provider in
-
-  (* Set up the optimizer pipeline.  Start with registering info about how the
-   * target lays out data structures. *)
-  TargetData.add (ExecutionEngine.target_data the_execution_engine) the_fpm;
-
-  (* Do simple "peephole" optimizations and bit-twiddling optzn. *)
-  add_instruction_combining the_fpm;
-
-  (* reassociate expressions. *)
-  add_reassociation the_fpm;
-
-  (* Eliminate Common SubExpressions. *)
-  add_gvn the_fpm;
-
-  (* Simplify the control flow graph (deleting unreachable blocks, etc). *)
-  add_cfg_simplification the_fpm;
-
-  ignore (PassManager.initialize the_fpm);
-
-  (* Run the main "interpreter loop" now. *)
-  Toplevel.main_loop the_fpm the_execution_engine stream;
-
-  (* Print out all the generated code. *)
-  dump_module Codegen.the_module
-;;
-
-main ()
-</pre>
-</dd>
-
-<dt>bindings.c</dt>
-<dd class="doc_code">
-<pre>
-#include &lt;stdio.h&gt;
-
-/* putchard - putchar that takes a double and returns 0. */
-extern double putchard(double X) {
-  putchar((char)X);
-  return 0;
-}
-</pre>
-</dd>
-</dl>
-
-<a href="OCamlLangImpl5.html">Next: Extending the language: control flow</a>
-</div>
-
-<!-- *********************************************************************** -->
-<hr>
-<address>
-  <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
-  src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"></a>
-  <a href="http://validator.w3.org/check/referer"><img
-  src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"></a>
-
-  <a href="mailto:sabre at nondot.org">Chris Lattner</a><br>
-  <a href="mailto:idadesub at users.sourceforge.net">Erick Tryzelaar</a><br>
-  <a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
-  Last modified: $Date$
-</address>
-</body>
-</html>
diff --git a/libclamav/c++/llvm/docs/tutorial/OCamlLangImpl5.html b/libclamav/c++/llvm/docs/tutorial/OCamlLangImpl5.html
deleted file mode 100644
index 01e1255..0000000
--- a/libclamav/c++/llvm/docs/tutorial/OCamlLangImpl5.html
+++ /dev/null
@@ -1,1569 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-                      "http://www.w3.org/TR/html4/strict.dtd">
-
-<html>
-<head>
-  <title>Kaleidoscope: Extending the Language: Control Flow</title>
-  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-  <meta name="author" content="Chris Lattner">
-  <meta name="author" content="Erick Tryzelaar">
-  <link rel="stylesheet" href="../llvm.css" type="text/css">
-</head>
-
-<body>
-
-<div class="doc_title">Kaleidoscope: Extending the Language: Control Flow</div>
-
-<ul>
-<li><a href="index.html">Up to Tutorial Index</a></li>
-<li>Chapter 5
-  <ol>
-    <li><a href="#intro">Chapter 5 Introduction</a></li>
-    <li><a href="#ifthen">If/Then/Else</a>
-    <ol>
-      <li><a href="#iflexer">Lexer Extensions</a></li>
-      <li><a href="#ifast">AST Extensions</a></li>
-      <li><a href="#ifparser">Parser Extensions</a></li>
-      <li><a href="#ifir">LLVM IR</a></li>
-      <li><a href="#ifcodegen">Code Generation</a></li>
-    </ol>
-    </li>
-    <li><a href="#for">'for' Loop Expression</a>
-    <ol>
-      <li><a href="#forlexer">Lexer Extensions</a></li>
-      <li><a href="#forast">AST Extensions</a></li>
-      <li><a href="#forparser">Parser Extensions</a></li>
-      <li><a href="#forir">LLVM IR</a></li>
-      <li><a href="#forcodegen">Code Generation</a></li>
-    </ol>
-    </li>
-    <li><a href="#code">Full Code Listing</a></li>
-  </ol>
-</li>
-<li><a href="OCamlLangImpl6.html">Chapter 6</a>: Extending the Language:
-User-defined Operators</li>
-</ul>
-
-<div class="doc_author">
-	<p>
-		Written by <a href="mailto:sabre at nondot.org">Chris Lattner</a>
-		and <a href="mailto:idadesub at users.sourceforge.net">Erick Tryzelaar</a>
-	</p>
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="intro">Chapter 5 Introduction</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>Welcome to Chapter 5 of the "<a href="index.html">Implementing a language
-with LLVM</a>" tutorial.  Parts 1-4 described the implementation of the simple
-Kaleidoscope language and included support for generating LLVM IR, followed by
-optimizations and a JIT compiler.  Unfortunately, as presented, Kaleidoscope is
-mostly useless: it has no control flow other than call and return.  This means
-that you can't have conditional branches in the code, significantly limiting its
-power.  In this episode of "build that compiler", we'll extend Kaleidoscope to
-have an if/then/else expression plus a simple 'for' loop.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="ifthen">If/Then/Else</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>
-Extending Kaleidoscope to support if/then/else is quite straightforward.  It
-basically requires adding lexer support for this "new" concept to the lexer,
-parser, AST, and LLVM code emitter.  This example is nice, because it shows how
-easy it is to "grow" a language over time, incrementally extending it as new
-ideas are discovered.</p>
-
-<p>Before we get going on "how" we add this extension, lets talk about "what" we
-want.  The basic idea is that we want to be able to write this sort of thing:
-</p>
-
-<div class="doc_code">
-<pre>
-def fib(x)
-  if x &lt; 3 then
-    1
-  else
-    fib(x-1)+fib(x-2);
-</pre>
-</div>
-
-<p>In Kaleidoscope, every construct is an expression: there are no statements.
-As such, the if/then/else expression needs to return a value like any other.
-Since we're using a mostly functional form, we'll have it evaluate its
-conditional, then return the 'then' or 'else' value based on how the condition
-was resolved.  This is very similar to the C "?:" expression.</p>
-
-<p>The semantics of the if/then/else expression is that it evaluates the
-condition to a boolean equality value: 0.0 is considered to be false and
-everything else is considered to be true.
-If the condition is true, the first subexpression is evaluated and returned, if
-the condition is false, the second subexpression is evaluated and returned.
-Since Kaleidoscope allows side-effects, this behavior is important to nail down.
-</p>
-
-<p>Now that we know what we "want", lets break this down into its constituent
-pieces.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection"><a name="iflexer">Lexer Extensions for
-If/Then/Else</a></div>
-<!-- ======================================================================= -->
-
-
-<div class="doc_text">
-
-<p>The lexer extensions are straightforward.  First we add new variants
-for the relevant tokens:</p>
-
-<div class="doc_code">
-<pre>
-  (* control *)
-  | If | Then | Else | For | In
-</pre>
-</div>
-
-<p>Once we have that, we recognize the new keywords in the lexer. This is pretty simple
-stuff:</p>
-
-<div class="doc_code">
-<pre>
-      ...
-      match Buffer.contents buffer with
-      | "def" -&gt; [&lt; 'Token.Def; stream &gt;]
-      | "extern" -&gt; [&lt; 'Token.Extern; stream &gt;]
-      | "if" -&gt; [&lt; 'Token.If; stream &gt;]
-      | "then" -&gt; [&lt; 'Token.Then; stream &gt;]
-      | "else" -&gt; [&lt; 'Token.Else; stream &gt;]
-      | "for" -&gt; [&lt; 'Token.For; stream &gt;]
-      | "in" -&gt; [&lt; 'Token.In; stream &gt;]
-      | id -&gt; [&lt; 'Token.Ident id; stream &gt;]
-</pre>
-</div>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection"><a name="ifast">AST Extensions for
- If/Then/Else</a></div>
-<!-- ======================================================================= -->
-
-<div class="doc_text">
-
-<p>To represent the new expression we add a new AST variant for it:</p>
-
-<div class="doc_code">
-<pre>
-type expr =
-  ...
-  (* variant for if/then/else. *)
-  | If of expr * expr * expr
-</pre>
-</div>
-
-<p>The AST variant just has pointers to the various subexpressions.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection"><a name="ifparser">Parser Extensions for
-If/Then/Else</a></div>
-<!-- ======================================================================= -->
-
-<div class="doc_text">
-
-<p>Now that we have the relevant tokens coming from the lexer and we have the
-AST node to build, our parsing logic is relatively straightforward.  First we
-define a new parsing function:</p>
-
-<div class="doc_code">
-<pre>
-let rec parse_primary = parser
-  ...
-  (* ifexpr ::= 'if' expr 'then' expr 'else' expr *)
-  | [&lt; 'Token.If; c=parse_expr;
-       'Token.Then ?? "expected 'then'"; t=parse_expr;
-       'Token.Else ?? "expected 'else'"; e=parse_expr &gt;] -&gt;
-      Ast.If (c, t, e)
-</pre>
-</div>
-
-<p>Next we hook it up as a primary expression:</p>
-
-<div class="doc_code">
-<pre>
-let rec parse_primary = parser
-  ...
-  (* ifexpr ::= 'if' expr 'then' expr 'else' expr *)
-  | [&lt; 'Token.If; c=parse_expr;
-       'Token.Then ?? "expected 'then'"; t=parse_expr;
-       'Token.Else ?? "expected 'else'"; e=parse_expr &gt;] -&gt;
-      Ast.If (c, t, e)
-</pre>
-</div>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection"><a name="ifir">LLVM IR for If/Then/Else</a></div>
-<!-- ======================================================================= -->
-
-<div class="doc_text">
-
-<p>Now that we have it parsing and building the AST, the final piece is adding
-LLVM code generation support.  This is the most interesting part of the
-if/then/else example, because this is where it starts to introduce new concepts.
-All of the code above has been thoroughly described in previous chapters.
-</p>
-
-<p>To motivate the code we want to produce, lets take a look at a simple
-example.  Consider:</p>
-
-<div class="doc_code">
-<pre>
-extern foo();
-extern bar();
-def baz(x) if x then foo() else bar();
-</pre>
-</div>
-
-<p>If you disable optimizations, the code you'll (soon) get from Kaleidoscope
-looks like this:</p>
-
-<div class="doc_code">
-<pre>
-declare double @foo()
-
-declare double @bar()
-
-define double @baz(double %x) {
-entry:
-  %ifcond = fcmp one double %x, 0.000000e+00
-  br i1 %ifcond, label %then, label %else
-
-then:    ; preds = %entry
-  %calltmp = call double @foo()
-  br label %ifcont
-
-else:    ; preds = %entry
-  %calltmp1 = call double @bar()
-  br label %ifcont
-
-ifcont:    ; preds = %else, %then
-  %iftmp = phi double [ %calltmp, %then ], [ %calltmp1, %else ]
-  ret double %iftmp
-}
-</pre>
-</div>
-
-<p>To visualize the control flow graph, you can use a nifty feature of the LLVM
-'<a href="http://llvm.org/cmds/opt.html">opt</a>' tool.  If you put this LLVM IR
-into "t.ll" and run "<tt>llvm-as &lt; t.ll | opt -analyze -view-cfg</tt>", <a
-href="../ProgrammersManual.html#ViewGraph">a window will pop up</a> and you'll
-see this graph:</p>
-
-<div style="text-align: center"><img src="LangImpl5-cfg.png" alt="Example CFG" width="423"
-height="315"></div>
-
-<p>Another way to get this is to call "<tt>Llvm_analysis.view_function_cfg
-f</tt>" or "<tt>Llvm_analysis.view_function_cfg_only f</tt>" (where <tt>f</tt>
-is a "<tt>Function</tt>") either by inserting actual calls into the code and
-recompiling or by calling these in the debugger.  LLVM has many nice features
-for visualizing various graphs.</p>
-
-<p>Getting back to the generated code, it is fairly simple: the entry block
-evaluates the conditional expression ("x" in our case here) and compares the
-result to 0.0 with the "<tt><a href="../LangRef.html#i_fcmp">fcmp</a> one</tt>"
-instruction ('one' is "Ordered and Not Equal").  Based on the result of this
-expression, the code jumps to either the "then" or "else" blocks, which contain
-the expressions for the true/false cases.</p>
-
-<p>Once the then/else blocks are finished executing, they both branch back to the
-'ifcont' block to execute the code that happens after the if/then/else.  In this
-case the only thing left to do is to return to the caller of the function.  The
-question then becomes: how does the code know which expression to return?</p>
-
-<p>The answer to this question involves an important SSA operation: the
-<a href="http://en.wikipedia.org/wiki/Static_single_assignment_form">Phi
-operation</a>.  If you're not familiar with SSA, <a
-href="http://en.wikipedia.org/wiki/Static_single_assignment_form">the wikipedia
-article</a> is a good introduction and there are various other introductions to
-it available on your favorite search engine.  The short version is that
-"execution" of the Phi operation requires "remembering" which block control came
-from.  The Phi operation takes on the value corresponding to the input control
-block.  In this case, if control comes in from the "then" block, it gets the
-value of "calltmp".  If control comes from the "else" block, it gets the value
-of "calltmp1".</p>
-
-<p>At this point, you are probably starting to think "Oh no! This means my
-simple and elegant front-end will have to start generating SSA form in order to
-use LLVM!".  Fortunately, this is not the case, and we strongly advise
-<em>not</em> implementing an SSA construction algorithm in your front-end
-unless there is an amazingly good reason to do so.  In practice, there are two
-sorts of values that float around in code written for your average imperative
-programming language that might need Phi nodes:</p>
-
-<ol>
-<li>Code that involves user variables: <tt>x = 1; x = x + 1; </tt></li>
-<li>Values that are implicit in the structure of your AST, such as the Phi node
-in this case.</li>
-</ol>
-
-<p>In <a href="OCamlLangImpl7.html">Chapter 7</a> of this tutorial ("mutable
-variables"), we'll talk about #1
-in depth.  For now, just believe me that you don't need SSA construction to
-handle this case.  For #2, you have the choice of using the techniques that we will
-describe for #1, or you can insert Phi nodes directly, if convenient.  In this
-case, it is really really easy to generate the Phi node, so we choose to do it
-directly.</p>
-
-<p>Okay, enough of the motivation and overview, lets generate code!</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection"><a name="ifcodegen">Code Generation for
-If/Then/Else</a></div>
-<!-- ======================================================================= -->
-
-<div class="doc_text">
-
-<p>In order to generate code for this, we implement the <tt>Codegen</tt> method
-for <tt>IfExprAST</tt>:</p>
-
-<div class="doc_code">
-<pre>
-let rec codegen_expr = function
-  ...
-  | Ast.If (cond, then_, else_) -&gt;
-      let cond = codegen_expr cond in
-
-      (* Convert condition to a bool by comparing equal to 0.0 *)
-      let zero = const_float double_type 0.0 in
-      let cond_val = build_fcmp Fcmp.One cond zero "ifcond" builder in
-</pre>
-</div>
-
-<p>This code is straightforward and similar to what we saw before.  We emit the
-expression for the condition, then compare that value to zero to get a truth
-value as a 1-bit (bool) value.</p>
-
-<div class="doc_code">
-<pre>
-      (* Grab the first block so that we might later add the conditional branch
-       * to it at the end of the function. *)
-      let start_bb = insertion_block builder in
-      let the_function = block_parent start_bb in
-
-      let then_bb = append_block "then" the_function in
-      position_at_end then_bb builder;
-</pre>
-</div>
-
-<p>
-As opposed to the <a href="LangImpl5.html">C++ tutorial</a>, we have to build
-our basic blocks bottom up since we can't have dangling BasicBlocks.  We start
-off by saving a pointer to the first block (which might not be the entry
-block), which we'll need to build a conditional branch later.  We do this by
-asking the <tt>builder</tt> for the current BasicBlock.  The fourth line
-gets the current Function object that is being built.  It gets this by the
-<tt>start_bb</tt> for its "parent" (the function it is currently embedded
-into).</p>
-
-<p>Once it has that, it creates one block.  It is automatically appended into
-the function's list of blocks.</p>
-
-<div class="doc_code">
-<pre>
-      (* Emit 'then' value. *)
-      position_at_end then_bb builder;
-      let then_val = codegen_expr then_ in
-
-      (* Codegen of 'then' can change the current block, update then_bb for the
-       * phi. We create a new name because one is used for the phi node, and the
-       * other is used for the conditional branch. *)
-      let new_then_bb = insertion_block builder in
-</pre>
-</div>
-
-<p>We move the builder to start inserting into the "then" block.  Strictly
-speaking, this call moves the insertion point to be at the end of the specified
-block.  However, since the "then" block is empty, it also starts out by
-inserting at the beginning of the block.  :)</p>
-
-<p>Once the insertion point is set, we recursively codegen the "then" expression
-from the AST.</p>
-
-<p>The final line here is quite subtle, but is very important.  The basic issue
-is that when we create the Phi node in the merge block, we need to set up the
-block/value pairs that indicate how the Phi will work.  Importantly, the Phi
-node expects to have an entry for each predecessor of the block in the CFG.  Why
-then, are we getting the current block when we just set it to ThenBB 5 lines
-above?  The problem is that the "Then" expression may actually itself change the
-block that the Builder is emitting into if, for example, it contains a nested
-"if/then/else" expression.  Because calling Codegen recursively could
-arbitrarily change the notion of the current block, we are required to get an
-up-to-date value for code that will set up the Phi node.</p>
-
-<div class="doc_code">
-<pre>
-      (* Emit 'else' value. *)
-      let else_bb = append_block "else" the_function in
-      position_at_end else_bb builder;
-      let else_val = codegen_expr else_ in
-
-      (* Codegen of 'else' can change the current block, update else_bb for the
-       * phi. *)
-      let new_else_bb = insertion_block builder in
-</pre>
-</div>
-
-<p>Code generation for the 'else' block is basically identical to codegen for
-the 'then' block.</p>
-
-<div class="doc_code">
-<pre>
-      (* Emit merge block. *)
-      let merge_bb = append_block "ifcont" the_function in
-      position_at_end merge_bb builder;
-      let incoming = [(then_val, new_then_bb); (else_val, new_else_bb)] in
-      let phi = build_phi incoming "iftmp" builder in
-</pre>
-</div>
-
-<p>The first two lines here are now familiar: the first adds the "merge" block
-to the Function object.  The second block changes the insertion point so that
-newly created code will go into the "merge" block.  Once that is done, we need
-to create the PHI node and set up the block/value pairs for the PHI.</p>
-
-<div class="doc_code">
-<pre>
-      (* Return to the start block to add the conditional branch. *)
-      position_at_end start_bb builder;
-      ignore (build_cond_br cond_val then_bb else_bb builder);
-</pre>
-</div>
-
-<p>Once the blocks are created, we can emit the conditional branch that chooses
-between them.  Note that creating new blocks does not implicitly affect the
-IRBuilder, so it is still inserting into the block that the condition
-went into.  This is why we needed to save the "start" block.</p>
-
-<div class="doc_code">
-<pre>
-      (* Set a unconditional branch at the end of the 'then' block and the
-       * 'else' block to the 'merge' block. *)
-      position_at_end new_then_bb builder; ignore (build_br merge_bb builder);
-      position_at_end new_else_bb builder; ignore (build_br merge_bb builder);
-
-      (* Finally, set the builder to the end of the merge block. *)
-      position_at_end merge_bb builder;
-
-      phi
-</pre>
-</div>
-
-<p>To finish off the blocks, we create an unconditional branch
-to the merge block.  One interesting (and very important) aspect of the LLVM IR
-is that it <a href="../LangRef.html#functionstructure">requires all basic blocks
-to be "terminated"</a> with a <a href="../LangRef.html#terminators">control flow
-instruction</a> such as return or branch.  This means that all control flow,
-<em>including fall throughs</em> must be made explicit in the LLVM IR.  If you
-violate this rule, the verifier will emit an error.
-
-<p>Finally, the CodeGen function returns the phi node as the value computed by
-the if/then/else expression.  In our example above, this returned value will
-feed into the code for the top-level function, which will create the return
-instruction.</p>
-
-<p>Overall, we now have the ability to execute conditional code in
-Kaleidoscope.  With this extension, Kaleidoscope is a fairly complete language
-that can calculate a wide variety of numeric functions.  Next up we'll add
-another useful expression that is familiar from non-functional languages...</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="for">'for' Loop Expression</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>Now that we know how to add basic control flow constructs to the language,
-we have the tools to add more powerful things.  Lets add something more
-aggressive, a 'for' expression:</p>
-
-<div class="doc_code">
-<pre>
- extern putchard(char);
- def printstar(n)
-   for i = 1, i &lt; n, 1.0 in
-     putchard(42);  # ascii 42 = '*'
-
- # print 100 '*' characters
- printstar(100);
-</pre>
-</div>
-
-<p>This expression defines a new variable ("i" in this case) which iterates from
-a starting value, while the condition ("i &lt; n" in this case) is true,
-incrementing by an optional step value ("1.0" in this case).  If the step value
-is omitted, it defaults to 1.0.  While the loop is true, it executes its
-body expression.  Because we don't have anything better to return, we'll just
-define the loop as always returning 0.0.  In the future when we have mutable
-variables, it will get more useful.</p>
-
-<p>As before, lets talk about the changes that we need to Kaleidoscope to
-support this.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection"><a name="forlexer">Lexer Extensions for
-the 'for' Loop</a></div>
-<!-- ======================================================================= -->
-
-<div class="doc_text">
-
-<p>The lexer extensions are the same sort of thing as for if/then/else:</p>
-
-<div class="doc_code">
-<pre>
-  ... in Token.token ...
-  (* control *)
-  | If | Then | Else
-  <b>| For | In</b>
-
-  ... in Lexer.lex_ident...
-      match Buffer.contents buffer with
-      | "def" -&gt; [&lt; 'Token.Def; stream &gt;]
-      | "extern" -&gt; [&lt; 'Token.Extern; stream &gt;]
-      | "if" -&gt; [&lt; 'Token.If; stream &gt;]
-      | "then" -&gt; [&lt; 'Token.Then; stream &gt;]
-      | "else" -&gt; [&lt; 'Token.Else; stream &gt;]
-      <b>| "for" -&gt; [&lt; 'Token.For; stream &gt;]
-      | "in" -&gt; [&lt; 'Token.In; stream &gt;]</b>
-      | id -&gt; [&lt; 'Token.Ident id; stream &gt;]
-</pre>
-</div>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection"><a name="forast">AST Extensions for
-the 'for' Loop</a></div>
-<!-- ======================================================================= -->
-
-<div class="doc_text">
-
-<p>The AST variant is just as simple.  It basically boils down to capturing
-the variable name and the constituent expressions in the node.</p>
-
-<div class="doc_code">
-<pre>
-type expr =
-  ...
-  (* variant for for/in. *)
-  | For of string * expr * expr * expr option * expr
-</pre>
-</div>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection"><a name="forparser">Parser Extensions for
-the 'for' Loop</a></div>
-<!-- ======================================================================= -->
-
-<div class="doc_text">
-
-<p>The parser code is also fairly standard.  The only interesting thing here is
-handling of the optional step value.  The parser code handles it by checking to
-see if the second comma is present.  If not, it sets the step value to null in
-the AST node:</p>
-
-<div class="doc_code">
-<pre>
-let rec parse_primary = parser
-  ...
-  (* forexpr
-        ::= 'for' identifier '=' expr ',' expr (',' expr)? 'in' expression *)
-  | [&lt; 'Token.For;
-       'Token.Ident id ?? "expected identifier after for";
-       'Token.Kwd '=' ?? "expected '=' after for";
-       stream &gt;] -&gt;
-      begin parser
-        | [&lt;
-             start=parse_expr;
-             'Token.Kwd ',' ?? "expected ',' after for";
-             end_=parse_expr;
-             stream &gt;] -&gt;
-            let step =
-              begin parser
-              | [&lt; 'Token.Kwd ','; step=parse_expr &gt;] -&gt; Some step
-              | [&lt; &gt;] -&gt; None
-              end stream
-            in
-            begin parser
-            | [&lt; 'Token.In; body=parse_expr &gt;] -&gt;
-                Ast.For (id, start, end_, step, body)
-            | [&lt; &gt;] -&gt;
-                raise (Stream.Error "expected 'in' after for")
-            end stream
-        | [&lt; &gt;] -&gt;
-            raise (Stream.Error "expected '=' after for")
-      end stream
-</pre>
-</div>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection"><a name="forir">LLVM IR for
-the 'for' Loop</a></div>
-<!-- ======================================================================= -->
-
-<div class="doc_text">
-
-<p>Now we get to the good part: the LLVM IR we want to generate for this thing.
-With the simple example above, we get this LLVM IR (note that this dump is
-generated with optimizations disabled for clarity):
-</p>
-
-<div class="doc_code">
-<pre>
-declare double @putchard(double)
-
-define double @printstar(double %n) {
-entry:
-        ; initial value = 1.0 (inlined into phi)
-  br label %loop
-
-loop:    ; preds = %loop, %entry
-  %i = phi double [ 1.000000e+00, %entry ], [ %nextvar, %loop ]
-        ; body
-  %calltmp = call double @putchard( double 4.200000e+01 )
-        ; increment
-  %nextvar = add double %i, 1.000000e+00
-
-        ; termination test
-  %cmptmp = fcmp ult double %i, %n
-  %booltmp = uitofp i1 %cmptmp to double
-  %loopcond = fcmp one double %booltmp, 0.000000e+00
-  br i1 %loopcond, label %loop, label %afterloop
-
-afterloop:    ; preds = %loop
-        ; loop always returns 0.0
-  ret double 0.000000e+00
-}
-</pre>
-</div>
-
-<p>This loop contains all the same constructs we saw before: a phi node, several
-expressions, and some basic blocks.  Lets see how this fits together.</p>
-
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection"><a name="forcodegen">Code Generation for
-the 'for' Loop</a></div>
-<!-- ======================================================================= -->
-
-<div class="doc_text">
-
-<p>The first part of Codegen is very simple: we just output the start expression
-for the loop value:</p>
-
-<div class="doc_code">
-<pre>
-let rec codegen_expr = function
-  ...
-  | Ast.For (var_name, start, end_, step, body) -&gt;
-      (* Emit the start code first, without 'variable' in scope. *)
-      let start_val = codegen_expr start in
-</pre>
-</div>
-
-<p>With this out of the way, the next step is to set up the LLVM basic block
-for the start of the loop body.  In the case above, the whole loop body is one
-block, but remember that the body code itself could consist of multiple blocks
-(e.g. if it contains an if/then/else or a for/in expression).</p>
-
-<div class="doc_code">
-<pre>
-      (* Make the new basic block for the loop header, inserting after current
-       * block. *)
-      let preheader_bb = insertion_block builder in
-      let the_function = block_parent preheader_bb in
-      let loop_bb = append_block "loop" the_function in
-
-      (* Insert an explicit fall through from the current block to the
-       * loop_bb. *)
-      ignore (build_br loop_bb builder);
-</pre>
-</div>
-
-<p>This code is similar to what we saw for if/then/else.  Because we will need
-it to create the Phi node, we remember the block that falls through into the
-loop.  Once we have that, we create the actual block that starts the loop and
-create an unconditional branch for the fall-through between the two blocks.</p>
-
-<div class="doc_code">
-<pre>
-      (* Start insertion in loop_bb. *)
-      position_at_end loop_bb builder;
-
-      (* Start the PHI node with an entry for start. *)
-      let variable = build_phi [(start_val, preheader_bb)] var_name builder in
-</pre>
-</div>
-
-<p>Now that the "preheader" for the loop is set up, we switch to emitting code
-for the loop body.  To begin with, we move the insertion point and create the
-PHI node for the loop induction variable.  Since we already know the incoming
-value for the starting value, we add it to the Phi node.  Note that the Phi will
-eventually get a second value for the backedge, but we can't set it up yet
-(because it doesn't exist!).</p>
-
-<div class="doc_code">
-<pre>
-      (* Within the loop, the variable is defined equal to the PHI node. If it
-       * shadows an existing variable, we have to restore it, so save it
-       * now. *)
-      let old_val =
-        try Some (Hashtbl.find named_values var_name) with Not_found -&gt; None
-      in
-      Hashtbl.add named_values var_name variable;
-
-      (* Emit the body of the loop.  This, like any other expr, can change the
-       * current BB.  Note that we ignore the value computed by the body, but
-       * don't allow an error *)
-      ignore (codegen_expr body);
-</pre>
-</div>
-
-<p>Now the code starts to get more interesting.  Our 'for' loop introduces a new
-variable to the symbol table.  This means that our symbol table can now contain
-either function arguments or loop variables.  To handle this, before we codegen
-the body of the loop, we add the loop variable as the current value for its
-name.  Note that it is possible that there is a variable of the same name in the
-outer scope.  It would be easy to make this an error (emit an error and return
-null if there is already an entry for VarName) but we choose to allow shadowing
-of variables.  In order to handle this correctly, we remember the Value that
-we are potentially shadowing in <tt>old_val</tt> (which will be None if there is
-no shadowed variable).</p>
-
-<p>Once the loop variable is set into the symbol table, the code recursively
-codegen's the body.  This allows the body to use the loop variable: any
-references to it will naturally find it in the symbol table.</p>
-
-<div class="doc_code">
-<pre>
-      (* Emit the step value. *)
-      let step_val =
-        match step with
-        | Some step -&gt; codegen_expr step
-        (* If not specified, use 1.0. *)
-        | None -&gt; const_float double_type 1.0
-      in
-
-      let next_var = build_add variable step_val "nextvar" builder in
-</pre>
-</div>
-
-<p>Now that the body is emitted, we compute the next value of the iteration
-variable by adding the step value, or 1.0 if it isn't present.
-'<tt>next_var</tt>' will be the value of the loop variable on the next iteration
-of the loop.</p>
-
-<div class="doc_code">
-<pre>
-      (* Compute the end condition. *)
-      let end_cond = codegen_expr end_ in
-
-      (* Convert condition to a bool by comparing equal to 0.0. *)
-      let zero = const_float double_type 0.0 in
-      let end_cond = build_fcmp Fcmp.One end_cond zero "loopcond" builder in
-</pre>
-</div>
-
-<p>Finally, we evaluate the exit value of the loop, to determine whether the
-loop should exit.  This mirrors the condition evaluation for the if/then/else
-statement.</p>
-
-<div class="doc_code">
-<pre>
-      (* Create the "after loop" block and insert it. *)
-      let loop_end_bb = insertion_block builder in
-      let after_bb = append_block "afterloop" the_function in
-
-      (* Insert the conditional branch into the end of loop_end_bb. *)
-      ignore (build_cond_br end_cond loop_bb after_bb builder);
-
-      (* Any new code will be inserted in after_bb. *)
-      position_at_end after_bb builder;
-</pre>
-</div>
-
-<p>With the code for the body of the loop complete, we just need to finish up
-the control flow for it.  This code remembers the end block (for the phi node), then creates the block for the loop exit ("afterloop").  Based on the value of the
-exit condition, it creates a conditional branch that chooses between executing
-the loop again and exiting the loop.  Any future code is emitted in the
-"afterloop" block, so it sets the insertion position to it.</p>
-
-<div class="doc_code">
-<pre>
-      (* Add a new entry to the PHI node for the backedge. *)
-      add_incoming (next_var, loop_end_bb) variable;
-
-      (* Restore the unshadowed variable. *)
-      begin match old_val with
-      | Some old_val -&gt; Hashtbl.add named_values var_name old_val
-      | None -&gt; ()
-      end;
-
-      (* for expr always returns 0.0. *)
-      const_null double_type
-</pre>
-</div>
-
-<p>The final code handles various cleanups: now that we have the
-"<tt>next_var</tt>" value, we can add the incoming value to the loop PHI node.
-After that, we remove the loop variable from the symbol table, so that it isn't
-in scope after the for loop.  Finally, code generation of the for loop always
-returns 0.0, so that is what we return from <tt>Codegen.codegen_expr</tt>.</p>
-
-<p>With this, we conclude the "adding control flow to Kaleidoscope" chapter of
-the tutorial.  In this chapter we added two control flow constructs, and used
-them to motivate a couple of aspects of the LLVM IR that are important for
-front-end implementors to know.  In the next chapter of our saga, we will get
-a bit crazier and add <a href="OCamlLangImpl6.html">user-defined operators</a>
-to our poor innocent language.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="code">Full Code Listing</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>
-Here is the complete code listing for our running example, enhanced with the
-if/then/else and for expressions..  To build this example, use:
-</p>
-
-<div class="doc_code">
-<pre>
-# Compile
-ocamlbuild toy.byte
-# Run
-./toy.byte
-</pre>
-</div>
-
-<p>Here is the code:</p>
-
-<dl>
-<dt>_tags:</dt>
-<dd class="doc_code">
-<pre>
-&lt;{lexer,parser}.ml&gt;: use_camlp4, pp(camlp4of)
-&lt;*.{byte,native}&gt;: g++, use_llvm, use_llvm_analysis
-&lt;*.{byte,native}&gt;: use_llvm_executionengine, use_llvm_target
-&lt;*.{byte,native}&gt;: use_llvm_scalar_opts, use_bindings
-</pre>
-</dd>
-
-<dt>myocamlbuild.ml:</dt>
-<dd class="doc_code">
-<pre>
-open Ocamlbuild_plugin;;
-
-ocaml_lib ~extern:true "llvm";;
-ocaml_lib ~extern:true "llvm_analysis";;
-ocaml_lib ~extern:true "llvm_executionengine";;
-ocaml_lib ~extern:true "llvm_target";;
-ocaml_lib ~extern:true "llvm_scalar_opts";;
-
-flag ["link"; "ocaml"; "g++"] (S[A"-cc"; A"g++"]);;
-dep ["link"; "ocaml"; "use_bindings"] ["bindings.o"];;
-</pre>
-</dd>
-
-<dt>token.ml:</dt>
-<dd class="doc_code">
-<pre>
-(*===----------------------------------------------------------------------===
- * Lexer Tokens
- *===----------------------------------------------------------------------===*)
-
-(* The lexer returns these 'Kwd' if it is an unknown character, otherwise one of
- * these others for known things. *)
-type token =
-  (* commands *)
-  | Def | Extern
-
-  (* primary *)
-  | Ident of string | Number of float
-
-  (* unknown *)
-  | Kwd of char
-
-  (* control *)
-  | If | Then | Else
-  | For | In
-</pre>
-</dd>
-
-<dt>lexer.ml:</dt>
-<dd class="doc_code">
-<pre>
-(*===----------------------------------------------------------------------===
- * Lexer
- *===----------------------------------------------------------------------===*)
-
-let rec lex = parser
-  (* Skip any whitespace. *)
-  | [&lt; ' (' ' | '\n' | '\r' | '\t'); stream &gt;] -&gt; lex stream
-
-  (* identifier: [a-zA-Z][a-zA-Z0-9] *)
-  | [&lt; ' ('A' .. 'Z' | 'a' .. 'z' as c); stream &gt;] -&gt;
-      let buffer = Buffer.create 1 in
-      Buffer.add_char buffer c;
-      lex_ident buffer stream
-
-  (* number: [0-9.]+ *)
-  | [&lt; ' ('0' .. '9' as c); stream &gt;] -&gt;
-      let buffer = Buffer.create 1 in
-      Buffer.add_char buffer c;
-      lex_number buffer stream
-
-  (* Comment until end of line. *)
-  | [&lt; ' ('#'); stream &gt;] -&gt;
-      lex_comment stream
-
-  (* Otherwise, just return the character as its ascii value. *)
-  | [&lt; 'c; stream &gt;] -&gt;
-      [&lt; 'Token.Kwd c; lex stream &gt;]
-
-  (* end of stream. *)
-  | [&lt; &gt;] -&gt; [&lt; &gt;]
-
-and lex_number buffer = parser
-  | [&lt; ' ('0' .. '9' | '.' as c); stream &gt;] -&gt;
-      Buffer.add_char buffer c;
-      lex_number buffer stream
-  | [&lt; stream=lex &gt;] -&gt;
-      [&lt; 'Token.Number (float_of_string (Buffer.contents buffer)); stream &gt;]
-
-and lex_ident buffer = parser
-  | [&lt; ' ('A' .. 'Z' | 'a' .. 'z' | '0' .. '9' as c); stream &gt;] -&gt;
-      Buffer.add_char buffer c;
-      lex_ident buffer stream
-  | [&lt; stream=lex &gt;] -&gt;
-      match Buffer.contents buffer with
-      | "def" -&gt; [&lt; 'Token.Def; stream &gt;]
-      | "extern" -&gt; [&lt; 'Token.Extern; stream &gt;]
-      | "if" -&gt; [&lt; 'Token.If; stream &gt;]
-      | "then" -&gt; [&lt; 'Token.Then; stream &gt;]
-      | "else" -&gt; [&lt; 'Token.Else; stream &gt;]
-      | "for" -&gt; [&lt; 'Token.For; stream &gt;]
-      | "in" -&gt; [&lt; 'Token.In; stream &gt;]
-      | id -&gt; [&lt; 'Token.Ident id; stream &gt;]
-
-and lex_comment = parser
-  | [&lt; ' ('\n'); stream=lex &gt;] -&gt; stream
-  | [&lt; 'c; e=lex_comment &gt;] -&gt; e
-  | [&lt; &gt;] -&gt; [&lt; &gt;]
-</pre>
-</dd>
-
-<dt>ast.ml:</dt>
-<dd class="doc_code">
-<pre>
-(*===----------------------------------------------------------------------===
- * Abstract Syntax Tree (aka Parse Tree)
- *===----------------------------------------------------------------------===*)
-
-(* expr - Base type for all expression nodes. *)
-type expr =
-  (* variant for numeric literals like "1.0". *)
-  | Number of float
-
-  (* variant for referencing a variable, like "a". *)
-  | Variable of string
-
-  (* variant for a binary operator. *)
-  | Binary of char * expr * expr
-
-  (* variant for function calls. *)
-  | Call of string * expr array
-
-  (* variant for if/then/else. *)
-  | If of expr * expr * expr
-
-  (* variant for for/in. *)
-  | For of string * expr * expr * expr option * expr
-
-(* proto - This type represents the "prototype" for a function, which captures
- * its name, and its argument names (thus implicitly the number of arguments the
- * function takes). *)
-type proto = Prototype of string * string array
-
-(* func - This type represents a function definition itself. *)
-type func = Function of proto * expr
-</pre>
-</dd>
-
-<dt>parser.ml:</dt>
-<dd class="doc_code">
-<pre>
-(*===---------------------------------------------------------------------===
- * Parser
- *===---------------------------------------------------------------------===*)
-
-(* binop_precedence - This holds the precedence for each binary operator that is
- * defined *)
-let binop_precedence:(char, int) Hashtbl.t = Hashtbl.create 10
-
-(* precedence - Get the precedence of the pending binary operator token. *)
-let precedence c = try Hashtbl.find binop_precedence c with Not_found -&gt; -1
-
-(* primary
- *   ::= identifier
- *   ::= numberexpr
- *   ::= parenexpr
- *   ::= ifexpr
- *   ::= forexpr *)
-let rec parse_primary = parser
-  (* numberexpr ::= number *)
-  | [&lt; 'Token.Number n &gt;] -&gt; Ast.Number n
-
-  (* parenexpr ::= '(' expression ')' *)
-  | [&lt; 'Token.Kwd '('; e=parse_expr; 'Token.Kwd ')' ?? "expected ')'" &gt;] -&gt; e
-
-  (* identifierexpr
-   *   ::= identifier
-   *   ::= identifier '(' argumentexpr ')' *)
-  | [&lt; 'Token.Ident id; stream &gt;] -&gt;
-      let rec parse_args accumulator = parser
-        | [&lt; e=parse_expr; stream &gt;] -&gt;
-            begin parser
-              | [&lt; 'Token.Kwd ','; e=parse_args (e :: accumulator) &gt;] -&gt; e
-              | [&lt; &gt;] -&gt; e :: accumulator
-            end stream
-        | [&lt; &gt;] -&gt; accumulator
-      in
-      let rec parse_ident id = parser
-        (* Call. *)
-        | [&lt; 'Token.Kwd '(';
-             args=parse_args [];
-             'Token.Kwd ')' ?? "expected ')'"&gt;] -&gt;
-            Ast.Call (id, Array.of_list (List.rev args))
-
-        (* Simple variable ref. *)
-        | [&lt; &gt;] -&gt; Ast.Variable id
-      in
-      parse_ident id stream
-
-  (* ifexpr ::= 'if' expr 'then' expr 'else' expr *)
-  | [&lt; 'Token.If; c=parse_expr;
-       'Token.Then ?? "expected 'then'"; t=parse_expr;
-       'Token.Else ?? "expected 'else'"; e=parse_expr &gt;] -&gt;
-      Ast.If (c, t, e)
-
-  (* forexpr
-        ::= 'for' identifier '=' expr ',' expr (',' expr)? 'in' expression *)
-  | [&lt; 'Token.For;
-       'Token.Ident id ?? "expected identifier after for";
-       'Token.Kwd '=' ?? "expected '=' after for";
-       stream &gt;] -&gt;
-      begin parser
-        | [&lt;
-             start=parse_expr;
-             'Token.Kwd ',' ?? "expected ',' after for";
-             end_=parse_expr;
-             stream &gt;] -&gt;
-            let step =
-              begin parser
-              | [&lt; 'Token.Kwd ','; step=parse_expr &gt;] -&gt; Some step
-              | [&lt; &gt;] -&gt; None
-              end stream
-            in
-            begin parser
-            | [&lt; 'Token.In; body=parse_expr &gt;] -&gt;
-                Ast.For (id, start, end_, step, body)
-            | [&lt; &gt;] -&gt;
-                raise (Stream.Error "expected 'in' after for")
-            end stream
-        | [&lt; &gt;] -&gt;
-            raise (Stream.Error "expected '=' after for")
-      end stream
-
-  | [&lt; &gt;] -&gt; raise (Stream.Error "unknown token when expecting an expression.")
-
-(* binoprhs
- *   ::= ('+' primary)* *)
-and parse_bin_rhs expr_prec lhs stream =
-  match Stream.peek stream with
-  (* If this is a binop, find its precedence. *)
-  | Some (Token.Kwd c) when Hashtbl.mem binop_precedence c -&gt;
-      let token_prec = precedence c in
-
-      (* If this is a binop that binds at least as tightly as the current binop,
-       * consume it, otherwise we are done. *)
-      if token_prec &lt; expr_prec then lhs else begin
-        (* Eat the binop. *)
-        Stream.junk stream;
-
-        (* Parse the primary expression after the binary operator. *)
-        let rhs = parse_primary stream in
-
-        (* Okay, we know this is a binop. *)
-        let rhs =
-          match Stream.peek stream with
-          | Some (Token.Kwd c2) -&gt;
-              (* If BinOp binds less tightly with rhs than the operator after
-               * rhs, let the pending operator take rhs as its lhs. *)
-              let next_prec = precedence c2 in
-              if token_prec &lt; next_prec
-              then parse_bin_rhs (token_prec + 1) rhs stream
-              else rhs
-          | _ -&gt; rhs
-        in
-
-        (* Merge lhs/rhs. *)
-        let lhs = Ast.Binary (c, lhs, rhs) in
-        parse_bin_rhs expr_prec lhs stream
-      end
-  | _ -&gt; lhs
-
-(* expression
- *   ::= primary binoprhs *)
-and parse_expr = parser
-  | [&lt; lhs=parse_primary; stream &gt;] -&gt; parse_bin_rhs 0 lhs stream
-
-(* prototype
- *   ::= id '(' id* ')' *)
-let parse_prototype =
-  let rec parse_args accumulator = parser
-    | [&lt; 'Token.Ident id; e=parse_args (id::accumulator) &gt;] -&gt; e
-    | [&lt; &gt;] -&gt; accumulator
-  in
-
-  parser
-  | [&lt; 'Token.Ident id;
-       'Token.Kwd '(' ?? "expected '(' in prototype";
-       args=parse_args [];
-       'Token.Kwd ')' ?? "expected ')' in prototype" &gt;] -&gt;
-      (* success. *)
-      Ast.Prototype (id, Array.of_list (List.rev args))
-
-  | [&lt; &gt;] -&gt;
-      raise (Stream.Error "expected function name in prototype")
-
-(* definition ::= 'def' prototype expression *)
-let parse_definition = parser
-  | [&lt; 'Token.Def; p=parse_prototype; e=parse_expr &gt;] -&gt;
-      Ast.Function (p, e)
-
-(* toplevelexpr ::= expression *)
-let parse_toplevel = parser
-  | [&lt; e=parse_expr &gt;] -&gt;
-      (* Make an anonymous proto. *)
-      Ast.Function (Ast.Prototype ("", [||]), e)
-
-(*  external ::= 'extern' prototype *)
-let parse_extern = parser
-  | [&lt; 'Token.Extern; e=parse_prototype &gt;] -&gt; e
-</pre>
-</dd>
-
-<dt>codegen.ml:</dt>
-<dd class="doc_code">
-<pre>
-(*===----------------------------------------------------------------------===
- * Code Generation
- *===----------------------------------------------------------------------===*)
-
-open Llvm
-
-exception Error of string
-
-let context = global_context ()
-let the_module = create_module context "my cool jit"
-let builder = builder context
-let named_values:(string, llvalue) Hashtbl.t = Hashtbl.create 10
-
-let rec codegen_expr = function
-  | Ast.Number n -&gt; const_float double_type n
-  | Ast.Variable name -&gt;
-      (try Hashtbl.find named_values name with
-        | Not_found -&gt; raise (Error "unknown variable name"))
-  | Ast.Binary (op, lhs, rhs) -&gt;
-      let lhs_val = codegen_expr lhs in
-      let rhs_val = codegen_expr rhs in
-      begin
-        match op with
-        | '+' -&gt; build_add lhs_val rhs_val "addtmp" builder
-        | '-' -&gt; build_sub lhs_val rhs_val "subtmp" builder
-        | '*' -&gt; build_mul lhs_val rhs_val "multmp" builder
-        | '&lt;' -&gt;
-            (* Convert bool 0/1 to double 0.0 or 1.0 *)
-            let i = build_fcmp Fcmp.Ult lhs_val rhs_val "cmptmp" builder in
-            build_uitofp i double_type "booltmp" builder
-        | _ -&gt; raise (Error "invalid binary operator")
-      end
-  | Ast.Call (callee, args) -&gt;
-      (* Look up the name in the module table. *)
-      let callee =
-        match lookup_function callee the_module with
-        | Some callee -&gt; callee
-        | None -&gt; raise (Error "unknown function referenced")
-      in
-      let params = params callee in
-
-      (* If argument mismatch error. *)
-      if Array.length params == Array.length args then () else
-        raise (Error "incorrect # arguments passed");
-      let args = Array.map codegen_expr args in
-      build_call callee args "calltmp" builder
-  | Ast.If (cond, then_, else_) -&gt;
-      let cond = codegen_expr cond in
-
-      (* Convert condition to a bool by comparing equal to 0.0 *)
-      let zero = const_float double_type 0.0 in
-      let cond_val = build_fcmp Fcmp.One cond zero "ifcond" builder in
-
-      (* Grab the first block so that we might later add the conditional branch
-       * to it at the end of the function. *)
-      let start_bb = insertion_block builder in
-      let the_function = block_parent start_bb in
-
-      let then_bb = append_block "then" the_function in
-
-      (* Emit 'then' value. *)
-      position_at_end then_bb builder;
-      let then_val = codegen_expr then_ in
-
-      (* Codegen of 'then' can change the current block, update then_bb for the
-       * phi. We create a new name because one is used for the phi node, and the
-       * other is used for the conditional branch. *)
-      let new_then_bb = insertion_block builder in
-
-      (* Emit 'else' value. *)
-      let else_bb = append_block "else" the_function in
-      position_at_end else_bb builder;
-      let else_val = codegen_expr else_ in
-
-      (* Codegen of 'else' can change the current block, update else_bb for the
-       * phi. *)
-      let new_else_bb = insertion_block builder in
-
-      (* Emit merge block. *)
-      let merge_bb = append_block "ifcont" the_function in
-      position_at_end merge_bb builder;
-      let incoming = [(then_val, new_then_bb); (else_val, new_else_bb)] in
-      let phi = build_phi incoming "iftmp" builder in
-
-      (* Return to the start block to add the conditional branch. *)
-      position_at_end start_bb builder;
-      ignore (build_cond_br cond_val then_bb else_bb builder);
-
-      (* Set a unconditional branch at the end of the 'then' block and the
-       * 'else' block to the 'merge' block. *)
-      position_at_end new_then_bb builder; ignore (build_br merge_bb builder);
-      position_at_end new_else_bb builder; ignore (build_br merge_bb builder);
-
-      (* Finally, set the builder to the end of the merge block. *)
-      position_at_end merge_bb builder;
-
-      phi
-  | Ast.For (var_name, start, end_, step, body) -&gt;
-      (* Emit the start code first, without 'variable' in scope. *)
-      let start_val = codegen_expr start in
-
-      (* Make the new basic block for the loop header, inserting after current
-       * block. *)
-      let preheader_bb = insertion_block builder in
-      let the_function = block_parent preheader_bb in
-      let loop_bb = append_block "loop" the_function in
-
-      (* Insert an explicit fall through from the current block to the
-       * loop_bb. *)
-      ignore (build_br loop_bb builder);
-
-      (* Start insertion in loop_bb. *)
-      position_at_end loop_bb builder;
-
-      (* Start the PHI node with an entry for start. *)
-      let variable = build_phi [(start_val, preheader_bb)] var_name builder in
-
-      (* Within the loop, the variable is defined equal to the PHI node. If it
-       * shadows an existing variable, we have to restore it, so save it
-       * now. *)
-      let old_val =
-        try Some (Hashtbl.find named_values var_name) with Not_found -&gt; None
-      in
-      Hashtbl.add named_values var_name variable;
-
-      (* Emit the body of the loop.  This, like any other expr, can change the
-       * current BB.  Note that we ignore the value computed by the body, but
-       * don't allow an error *)
-      ignore (codegen_expr body);
-
-      (* Emit the step value. *)
-      let step_val =
-        match step with
-        | Some step -&gt; codegen_expr step
-        (* If not specified, use 1.0. *)
-        | None -&gt; const_float double_type 1.0
-      in
-
-      let next_var = build_add variable step_val "nextvar" builder in
-
-      (* Compute the end condition. *)
-      let end_cond = codegen_expr end_ in
-
-      (* Convert condition to a bool by comparing equal to 0.0. *)
-      let zero = const_float double_type 0.0 in
-      let end_cond = build_fcmp Fcmp.One end_cond zero "loopcond" builder in
-
-      (* Create the "after loop" block and insert it. *)
-      let loop_end_bb = insertion_block builder in
-      let after_bb = append_block "afterloop" the_function in
-
-      (* Insert the conditional branch into the end of loop_end_bb. *)
-      ignore (build_cond_br end_cond loop_bb after_bb builder);
-
-      (* Any new code will be inserted in after_bb. *)
-      position_at_end after_bb builder;
-
-      (* Add a new entry to the PHI node for the backedge. *)
-      add_incoming (next_var, loop_end_bb) variable;
-
-      (* Restore the unshadowed variable. *)
-      begin match old_val with
-      | Some old_val -&gt; Hashtbl.add named_values var_name old_val
-      | None -&gt; ()
-      end;
-
-      (* for expr always returns 0.0. *)
-      const_null double_type
-
-let codegen_proto = function
-  | Ast.Prototype (name, args) -&gt;
-      (* Make the function type: double(double,double) etc. *)
-      let doubles = Array.make (Array.length args) double_type in
-      let ft = function_type double_type doubles in
-      let f =
-        match lookup_function name the_module with
-        | None -&gt; declare_function name ft the_module
-
-        (* If 'f' conflicted, there was already something named 'name'. If it
-         * has a body, don't allow redefinition or reextern. *)
-        | Some f -&gt;
-            (* If 'f' already has a body, reject this. *)
-            if block_begin f &lt;&gt; At_end f then
-              raise (Error "redefinition of function");
-
-            (* If 'f' took a different number of arguments, reject. *)
-            if element_type (type_of f) &lt;&gt; ft then
-              raise (Error "redefinition of function with different # args");
-            f
-      in
-
-      (* Set names for all arguments. *)
-      Array.iteri (fun i a -&gt;
-        let n = args.(i) in
-        set_value_name n a;
-        Hashtbl.add named_values n a;
-      ) (params f);
-      f
-
-let codegen_func the_fpm = function
-  | Ast.Function (proto, body) -&gt;
-      Hashtbl.clear named_values;
-      let the_function = codegen_proto proto in
-
-      (* Create a new basic block to start insertion into. *)
-      let bb = append_block "entry" the_function in
-      position_at_end bb builder;
-
-      try
-        let ret_val = codegen_expr body in
-
-        (* Finish off the function. *)
-        let _ = build_ret ret_val builder in
-
-        (* Validate the generated code, checking for consistency. *)
-        Llvm_analysis.assert_valid_function the_function;
-
-        (* Optimize the function. *)
-        let _ = PassManager.run_function the_function the_fpm in
-
-        the_function
-      with e -&gt;
-        delete_function the_function;
-        raise e
-</pre>
-</dd>
-
-<dt>toplevel.ml:</dt>
-<dd class="doc_code">
-<pre>
-(*===----------------------------------------------------------------------===
- * Top-Level parsing and JIT Driver
- *===----------------------------------------------------------------------===*)
-
-open Llvm
-open Llvm_executionengine
-
-(* top ::= definition | external | expression | ';' *)
-let rec main_loop the_fpm the_execution_engine stream =
-  match Stream.peek stream with
-  | None -&gt; ()
-
-  (* ignore top-level semicolons. *)
-  | Some (Token.Kwd ';') -&gt;
-      Stream.junk stream;
-      main_loop the_fpm the_execution_engine stream
-
-  | Some token -&gt;
-      begin
-        try match token with
-        | Token.Def -&gt;
-            let e = Parser.parse_definition stream in
-            print_endline "parsed a function definition.";
-            dump_value (Codegen.codegen_func the_fpm e);
-        | Token.Extern -&gt;
-            let e = Parser.parse_extern stream in
-            print_endline "parsed an extern.";
-            dump_value (Codegen.codegen_proto e);
-        | _ -&gt;
-            (* Evaluate a top-level expression into an anonymous function. *)
-            let e = Parser.parse_toplevel stream in
-            print_endline "parsed a top-level expr";
-            let the_function = Codegen.codegen_func the_fpm e in
-            dump_value the_function;
-
-            (* JIT the function, returning a function pointer. *)
-            let result = ExecutionEngine.run_function the_function [||]
-              the_execution_engine in
-
-            print_string "Evaluated to ";
-            print_float (GenericValue.as_float double_type result);
-            print_newline ();
-        with Stream.Error s | Codegen.Error s -&gt;
-          (* Skip token for error recovery. *)
-          Stream.junk stream;
-          print_endline s;
-      end;
-      print_string "ready&gt; "; flush stdout;
-      main_loop the_fpm the_execution_engine stream
-</pre>
-</dd>
-
-<dt>toy.ml:</dt>
-<dd class="doc_code">
-<pre>
-(*===----------------------------------------------------------------------===
- * Main driver code.
- *===----------------------------------------------------------------------===*)
-
-open Llvm
-open Llvm_executionengine
-open Llvm_target
-open Llvm_scalar_opts
-
-let main () =
-  ignore (initialize_native_target ());
-
-  (* Install standard binary operators.
-   * 1 is the lowest precedence. *)
-  Hashtbl.add Parser.binop_precedence '&lt;' 10;
-  Hashtbl.add Parser.binop_precedence '+' 20;
-  Hashtbl.add Parser.binop_precedence '-' 20;
-  Hashtbl.add Parser.binop_precedence '*' 40;    (* highest. *)
-
-  (* Prime the first token. *)
-  print_string "ready&gt; "; flush stdout;
-  let stream = Lexer.lex (Stream.of_channel stdin) in
-
-  (* Create the JIT. *)
-  let the_module_provider = ModuleProvider.create Codegen.the_module in
-  let the_execution_engine = ExecutionEngine.create the_module_provider in
-  let the_fpm = PassManager.create_function the_module_provider in
-
-  (* Set up the optimizer pipeline.  Start with registering info about how the
-   * target lays out data structures. *)
-  TargetData.add (ExecutionEngine.target_data the_execution_engine) the_fpm;
-
-  (* Do simple "peephole" optimizations and bit-twiddling optzn. *)
-  add_instruction_combining the_fpm;
-
-  (* reassociate expressions. *)
-  add_reassociation the_fpm;
-
-  (* Eliminate Common SubExpressions. *)
-  add_gvn the_fpm;
-
-  (* Simplify the control flow graph (deleting unreachable blocks, etc). *)
-  add_cfg_simplification the_fpm;
-
-  ignore (PassManager.initialize the_fpm);
-
-  (* Run the main "interpreter loop" now. *)
-  Toplevel.main_loop the_fpm the_execution_engine stream;
-
-  (* Print out all the generated code. *)
-  dump_module Codegen.the_module
-;;
-
-main ()
-</pre>
-</dd>
-
-<dt>bindings.c</dt>
-<dd class="doc_code">
-<pre>
-#include &lt;stdio.h&gt;
-
-/* putchard - putchar that takes a double and returns 0. */
-extern double putchard(double X) {
-  putchar((char)X);
-  return 0;
-}
-</pre>
-</dd>
-</dl>
-
-<a href="OCamlLangImpl6.html">Next: Extending the language: user-defined
-operators</a>
-</div>
-
-<!-- *********************************************************************** -->
-<hr>
-<address>
-  <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
-  src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"></a>
-  <a href="http://validator.w3.org/check/referer"><img
-  src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"></a>
-
-  <a href="mailto:sabre at nondot.org">Chris Lattner</a><br>
-  <a href="mailto:idadesub at users.sourceforge.net">Erick Tryzelaar</a><br>
-  <a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
-  Last modified: $Date$
-</address>
-</body>
-</html>
diff --git a/libclamav/c++/llvm/docs/tutorial/OCamlLangImpl6.html b/libclamav/c++/llvm/docs/tutorial/OCamlLangImpl6.html
deleted file mode 100644
index b5606e7..0000000
--- a/libclamav/c++/llvm/docs/tutorial/OCamlLangImpl6.html
+++ /dev/null
@@ -1,1574 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-                      "http://www.w3.org/TR/html4/strict.dtd">
-
-<html>
-<head>
-  <title>Kaleidoscope: Extending the Language: User-defined Operators</title>
-  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-  <meta name="author" content="Chris Lattner">
-  <meta name="author" content="Erick Tryzelaar">
-  <link rel="stylesheet" href="../llvm.css" type="text/css">
-</head>
-
-<body>
-
-<div class="doc_title">Kaleidoscope: Extending the Language: User-defined Operators</div>
-
-<ul>
-<li><a href="index.html">Up to Tutorial Index</a></li>
-<li>Chapter 6
-  <ol>
-    <li><a href="#intro">Chapter 6 Introduction</a></li>
-    <li><a href="#idea">User-defined Operators: the Idea</a></li>
-    <li><a href="#binary">User-defined Binary Operators</a></li>
-    <li><a href="#unary">User-defined Unary Operators</a></li>
-    <li><a href="#example">Kicking the Tires</a></li>
-    <li><a href="#code">Full Code Listing</a></li>
-  </ol>
-</li>
-<li><a href="OCamlLangImpl7.html">Chapter 7</a>: Extending the Language: Mutable
-Variables / SSA Construction</li>
-</ul>
-
-<div class="doc_author">
-	<p>
-		Written by <a href="mailto:sabre at nondot.org">Chris Lattner</a>
-		and <a href="mailto:idadesub at users.sourceforge.net">Erick Tryzelaar</a>
-	</p>
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="intro">Chapter 6 Introduction</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>Welcome to Chapter 6 of the "<a href="index.html">Implementing a language
-with LLVM</a>" tutorial.  At this point in our tutorial, we now have a fully
-functional language that is fairly minimal, but also useful.  There
-is still one big problem with it, however. Our language doesn't have many
-useful operators (like division, logical negation, or even any comparisons
-besides less-than).</p>
-
-<p>This chapter of the tutorial takes a wild digression into adding user-defined
-operators to the simple and beautiful Kaleidoscope language. This digression now
-gives us a simple and ugly language in some ways, but also a powerful one at the
-same time.  One of the great things about creating your own language is that you
-get to decide what is good or bad.  In this tutorial we'll assume that it is
-okay to use this as a way to show some interesting parsing techniques.</p>
-
-<p>At the end of this tutorial, we'll run through an example Kaleidoscope
-application that <a href="#example">renders the Mandelbrot set</a>.  This gives
-an example of what you can build with Kaleidoscope and its feature set.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="idea">User-defined Operators: the Idea</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>
-The "operator overloading" that we will add to Kaleidoscope is more general than
-languages like C++.  In C++, you are only allowed to redefine existing
-operators: you can't programatically change the grammar, introduce new
-operators, change precedence levels, etc.  In this chapter, we will add this
-capability to Kaleidoscope, which will let the user round out the set of
-operators that are supported.</p>
-
-<p>The point of going into user-defined operators in a tutorial like this is to
-show the power and flexibility of using a hand-written parser.  Thus far, the parser
-we have been implementing uses recursive descent for most parts of the grammar and
-operator precedence parsing for the expressions.  See <a
-href="OCamlLangImpl2.html">Chapter 2</a> for details.  Without using operator
-precedence parsing, it would be very difficult to allow the programmer to
-introduce new operators into the grammar: the grammar is dynamically extensible
-as the JIT runs.</p>
-
-<p>The two specific features we'll add are programmable unary operators (right
-now, Kaleidoscope has no unary operators at all) as well as binary operators.
-An example of this is:</p>
-
-<div class="doc_code">
-<pre>
-# Logical unary not.
-def unary!(v)
-  if v then
-    0
-  else
-    1;
-
-# Define &gt; with the same precedence as &lt;.
-def binary&gt; 10 (LHS RHS)
-  RHS &lt; LHS;
-
-# Binary "logical or", (note that it does not "short circuit")
-def binary| 5 (LHS RHS)
-  if LHS then
-    1
-  else if RHS then
-    1
-  else
-    0;
-
-# Define = with slightly lower precedence than relationals.
-def binary= 9 (LHS RHS)
-  !(LHS &lt; RHS | LHS &gt; RHS);
-</pre>
-</div>
-
-<p>Many languages aspire to being able to implement their standard runtime
-library in the language itself.  In Kaleidoscope, we can implement significant
-parts of the language in the library!</p>
-
-<p>We will break down implementation of these features into two parts:
-implementing support for user-defined binary operators and adding unary
-operators.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="binary">User-defined Binary Operators</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>Adding support for user-defined binary operators is pretty simple with our
-current framework.  We'll first add support for the unary/binary keywords:</p>
-
-<div class="doc_code">
-<pre>
-type token =
-  ...
-  <b>(* operators *)
-  | Binary | Unary</b>
-
-...
-
-and lex_ident buffer = parser
-  ...
-      | "for" -&gt; [&lt; 'Token.For; stream &gt;]
-      | "in" -&gt; [&lt; 'Token.In; stream &gt;]
-      <b>| "binary" -&gt; [&lt; 'Token.Binary; stream &gt;]
-      | "unary" -&gt; [&lt; 'Token.Unary; stream &gt;]</b>
-</pre>
-</div>
-
-<p>This just adds lexer support for the unary and binary keywords, like we
-did in <a href="OCamlLangImpl5.html#iflexer">previous chapters</a>.  One nice
-thing about our current AST, is that we represent binary operators with full
-generalisation by using their ASCII code as the opcode.  For our extended
-operators, we'll use this same representation, so we don't need any new AST or
-parser support.</p>
-
-<p>On the other hand, we have to be able to represent the definitions of these
-new operators, in the "def binary| 5" part of the function definition.  In our
-grammar so far, the "name" for the function definition is parsed as the
-"prototype" production and into the <tt>Ast.Prototype</tt> AST node.  To
-represent our new user-defined operators as prototypes, we have to extend
-the  <tt>Ast.Prototype</tt> AST node like this:</p>
-
-<div class="doc_code">
-<pre>
-(* proto - This type represents the "prototype" for a function, which captures
- * its name, and its argument names (thus implicitly the number of arguments the
- * function takes). *)
-type proto =
-  | Prototype of string * string array
-  <b>| BinOpPrototype of string * string array * int</b>
-</pre>
-</div>
-
-<p>Basically, in addition to knowing a name for the prototype, we now keep track
-of whether it was an operator, and if it was, what precedence level the operator
-is at.  The precedence is only used for binary operators (as you'll see below,
-it just doesn't apply for unary operators).  Now that we have a way to represent
-the prototype for a user-defined operator, we need to parse it:</p>
-
-<div class="doc_code">
-<pre>
-(* prototype
- *   ::= id '(' id* ')'
- <b>*   ::= binary LETTER number? (id, id)
- *   ::= unary LETTER number? (id) *)</b>
-let parse_prototype =
-  let rec parse_args accumulator = parser
-    | [&lt; 'Token.Ident id; e=parse_args (id::accumulator) &gt;] -&gt; e
-    | [&lt; &gt;] -&gt; accumulator
-  in
-  let parse_operator = parser
-    | [&lt; 'Token.Unary &gt;] -&gt; "unary", 1
-    | [&lt; 'Token.Binary &gt;] -&gt; "binary", 2
-  in
-  let parse_binary_precedence = parser
-    | [&lt; 'Token.Number n &gt;] -&gt; int_of_float n
-    | [&lt; &gt;] -&gt; 30
-  in
-  parser
-  | [&lt; 'Token.Ident id;
-       'Token.Kwd '(' ?? "expected '(' in prototype";
-       args=parse_args [];
-       'Token.Kwd ')' ?? "expected ')' in prototype" &gt;] -&gt;
-      (* success. *)
-      Ast.Prototype (id, Array.of_list (List.rev args))
-  <b>| [&lt; (prefix, kind)=parse_operator;
-       'Token.Kwd op ?? "expected an operator";
-       (* Read the precedence if present. *)
-       binary_precedence=parse_binary_precedence;
-       'Token.Kwd '(' ?? "expected '(' in prototype";
-        args=parse_args [];
-       'Token.Kwd ')' ?? "expected ')' in prototype" &gt;] -&gt;
-      let name = prefix ^ (String.make 1 op) in
-      let args = Array.of_list (List.rev args) in
-
-      (* Verify right number of arguments for operator. *)
-      if Array.length args != kind
-      then raise (Stream.Error "invalid number of operands for operator")
-      else
-        if kind == 1 then
-          Ast.Prototype (name, args)
-        else
-          Ast.BinOpPrototype (name, args, binary_precedence)</b>
-  | [&lt; &gt;] -&gt;
-      raise (Stream.Error "expected function name in prototype")
-</pre>
-</div>
-
-<p>This is all fairly straightforward parsing code, and we have already seen
-a lot of similar code in the past.  One interesting part about the code above is
-the couple lines that set up <tt>name</tt> for binary operators.  This builds
-names like "binary@" for a newly defined "@" operator.  This then takes
-advantage of the fact that symbol names in the LLVM symbol table are allowed to
-have any character in them, including embedded nul characters.</p>
-
-<p>The next interesting thing to add, is codegen support for these binary
-operators.  Given our current structure, this is a simple addition of a default
-case for our existing binary operator node:</p>
-
-<div class="doc_code">
-<pre>
-let codegen_expr = function
-  ...
-  | Ast.Binary (op, lhs, rhs) -&gt;
-      let lhs_val = codegen_expr lhs in
-      let rhs_val = codegen_expr rhs in
-      begin
-        match op with
-        | '+' -&gt; build_add lhs_val rhs_val "addtmp" builder
-        | '-' -&gt; build_sub lhs_val rhs_val "subtmp" builder
-        | '*' -&gt; build_mul lhs_val rhs_val "multmp" builder
-        | '&lt;' -&gt;
-            (* Convert bool 0/1 to double 0.0 or 1.0 *)
-            let i = build_fcmp Fcmp.Ult lhs_val rhs_val "cmptmp" builder in
-            build_uitofp i double_type "booltmp" builder
-        <b>| _ -&gt;
-            (* If it wasn't a builtin binary operator, it must be a user defined
-             * one. Emit a call to it. *)
-            let callee = "binary" ^ (String.make 1 op) in
-            let callee =
-              match lookup_function callee the_module with
-              | Some callee -&gt; callee
-              | None -&gt; raise (Error "binary operator not found!")
-            in
-            build_call callee [|lhs_val; rhs_val|] "binop" builder</b>
-      end
-</pre>
-</div>
-
-<p>As you can see above, the new code is actually really simple.  It just does
-a lookup for the appropriate operator in the symbol table and generates a
-function call to it.  Since user-defined operators are just built as normal
-functions (because the "prototype" boils down to a function with the right
-name) everything falls into place.</p>
-
-<p>The final piece of code we are missing, is a bit of top level magic:</p>
-
-<div class="doc_code">
-<pre>
-let codegen_func the_fpm = function
-  | Ast.Function (proto, body) -&gt;
-      Hashtbl.clear named_values;
-      let the_function = codegen_proto proto in
-
-      <b>(* If this is an operator, install it. *)
-      begin match proto with
-      | Ast.BinOpPrototype (name, args, prec) -&gt;
-          let op = name.[String.length name - 1] in
-          Hashtbl.add Parser.binop_precedence op prec;
-      | _ -&gt; ()
-      end;</b>
-
-      (* Create a new basic block to start insertion into. *)
-      let bb = append_block "entry" the_function in
-      position_at_end bb builder;
-      ...
-</pre>
-</div>
-
-<p>Basically, before codegening a function, if it is a user-defined operator, we
-register it in the precedence table.  This allows the binary operator parsing
-logic we already have in place to handle it.  Since we are working on a
-fully-general operator precedence parser, this is all we need to do to "extend
-the grammar".</p>
-
-<p>Now we have useful user-defined binary operators.  This builds a lot
-on the previous framework we built for other operators.  Adding unary operators
-is a bit more challenging, because we don't have any framework for it yet - lets
-see what it takes.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="unary">User-defined Unary Operators</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>Since we don't currently support unary operators in the Kaleidoscope
-language, we'll need to add everything to support them.  Above, we added simple
-support for the 'unary' keyword to the lexer.  In addition to that, we need an
-AST node:</p>
-
-<div class="doc_code">
-<pre>
-type expr =
-  ...
-  (* variant for a unary operator. *)
-  | Unary of char * expr
-  ...
-</pre>
-</div>
-
-<p>This AST node is very simple and obvious by now.  It directly mirrors the
-binary operator AST node, except that it only has one child.  With this, we
-need to add the parsing logic.  Parsing a unary operator is pretty simple: we'll
-add a new function to do it:</p>
-
-<div class="doc_code">
-<pre>
-(* unary
- *   ::= primary
- *   ::= '!' unary *)
-and parse_unary = parser
-  (* If this is a unary operator, read it. *)
-  | [&lt; 'Token.Kwd op when op != '(' &amp;&amp; op != ')'; operand=parse_expr &gt;] -&gt;
-      Ast.Unary (op, operand)
-
-  (* If the current token is not an operator, it must be a primary expr. *)
-  | [&lt; stream &gt;] -&gt; parse_primary stream
-</pre>
-</div>
-
-<p>The grammar we add is pretty straightforward here.  If we see a unary
-operator when parsing a primary operator, we eat the operator as a prefix and
-parse the remaining piece as another unary operator.  This allows us to handle
-multiple unary operators (e.g. "!!x").  Note that unary operators can't have
-ambiguous parses like binary operators can, so there is no need for precedence
-information.</p>
-
-<p>The problem with this function, is that we need to call ParseUnary from
-somewhere.  To do this, we change previous callers of ParsePrimary to call
-<tt>parse_unary</tt> instead:</p>
-
-<div class="doc_code">
-<pre>
-(* binoprhs
- *   ::= ('+' primary)* *)
-and parse_bin_rhs expr_prec lhs stream =
-        ...
-        <b>(* Parse the unary expression after the binary operator. *)
-        let rhs = parse_unary stream in</b>
-        ...
-
-...
-
-(* expression
- *   ::= primary binoprhs *)
-and parse_expr = parser
-  | [&lt; lhs=<b>parse_unary</b>; stream &gt;] -&gt; parse_bin_rhs 0 lhs stream
-</pre>
-</div>
-
-<p>With these two simple changes, we are now able to parse unary operators and build the
-AST for them.  Next up, we need to add parser support for prototypes, to parse
-the unary operator prototype.  We extend the binary operator code above
-with:</p>
-
-<div class="doc_code">
-<pre>
-(* prototype
- *   ::= id '(' id* ')'
- *   ::= binary LETTER number? (id, id)
- <b>*   ::= unary LETTER number? (id)</b> *)
-let parse_prototype =
-  let rec parse_args accumulator = parser
-    | [&lt; 'Token.Ident id; e=parse_args (id::accumulator) &gt;] -&gt; e
-    | [&lt; &gt;] -&gt; accumulator
-  in
-  <b>let parse_operator = parser
-    | [&lt; 'Token.Unary &gt;] -&gt; "unary", 1
-    | [&lt; 'Token.Binary &gt;] -&gt; "binary", 2
-  in</b>
-  let parse_binary_precedence = parser
-    | [&lt; 'Token.Number n &gt;] -&gt; int_of_float n
-    | [&lt; &gt;] -&gt; 30
-  in
-  parser
-  | [&lt; 'Token.Ident id;
-       'Token.Kwd '(' ?? "expected '(' in prototype";
-       args=parse_args [];
-       'Token.Kwd ')' ?? "expected ')' in prototype" &gt;] -&gt;
-      (* success. *)
-      Ast.Prototype (id, Array.of_list (List.rev args))
-  <b>| [&lt; (prefix, kind)=parse_operator;
-       'Token.Kwd op ?? "expected an operator";
-       (* Read the precedence if present. *)
-       binary_precedence=parse_binary_precedence;
-       'Token.Kwd '(' ?? "expected '(' in prototype";
-        args=parse_args [];
-       'Token.Kwd ')' ?? "expected ')' in prototype" &gt;] -&gt;
-      let name = prefix ^ (String.make 1 op) in
-      let args = Array.of_list (List.rev args) in
-
-      (* Verify right number of arguments for operator. *)
-      if Array.length args != kind
-      then raise (Stream.Error "invalid number of operands for operator")
-      else
-        if kind == 1 then
-          Ast.Prototype (name, args)
-        else
-          Ast.BinOpPrototype (name, args, binary_precedence)</b>
-  | [&lt; &gt;] -&gt;
-      raise (Stream.Error "expected function name in prototype")
-</pre>
-</div>
-
-<p>As with binary operators, we name unary operators with a name that includes
-the operator character.  This assists us at code generation time.  Speaking of,
-the final piece we need to add is codegen support for unary operators.  It looks
-like this:</p>
-
-<div class="doc_code">
-<pre>
-let rec codegen_expr = function
-  ...
-  | Ast.Unary (op, operand) -&gt;
-      let operand = codegen_expr operand in
-      let callee = "unary" ^ (String.make 1 op) in
-      let callee =
-        match lookup_function callee the_module with
-        | Some callee -&gt; callee
-        | None -&gt; raise (Error "unknown unary operator")
-      in
-      build_call callee [|operand|] "unop" builder
-</pre>
-</div>
-
-<p>This code is similar to, but simpler than, the code for binary operators.  It
-is simpler primarily because it doesn't need to handle any predefined operators.
-</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="example">Kicking the Tires</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>It is somewhat hard to believe, but with a few simple extensions we've
-covered in the last chapters, we have grown a real-ish language.  With this, we
-can do a lot of interesting things, including I/O, math, and a bunch of other
-things.  For example, we can now add a nice sequencing operator (printd is
-defined to print out the specified value and a newline):</p>
-
-<div class="doc_code">
-<pre>
-ready&gt; <b>extern printd(x);</b>
-Read extern: declare double @printd(double)
-ready&gt; <b>def binary : 1 (x y) 0;  # Low-precedence operator that ignores operands.</b>
-..
-ready&gt; <b>printd(123) : printd(456) : printd(789);</b>
-123.000000
-456.000000
-789.000000
-Evaluated to 0.000000
-</pre>
-</div>
-
-<p>We can also define a bunch of other "primitive" operations, such as:</p>
-
-<div class="doc_code">
-<pre>
-# Logical unary not.
-def unary!(v)
-  if v then
-    0
-  else
-    1;
-
-# Unary negate.
-def unary-(v)
-  0-v;
-
-# Define &gt; with the same precedence as &gt;.
-def binary&gt; 10 (LHS RHS)
-  RHS &lt; LHS;
-
-# Binary logical or, which does not short circuit.
-def binary| 5 (LHS RHS)
-  if LHS then
-    1
-  else if RHS then
-    1
-  else
-    0;
-
-# Binary logical and, which does not short circuit.
-def binary&amp; 6 (LHS RHS)
-  if !LHS then
-    0
-  else
-    !!RHS;
-
-# Define = with slightly lower precedence than relationals.
-def binary = 9 (LHS RHS)
-  !(LHS &lt; RHS | LHS &gt; RHS);
-
-</pre>
-</div>
-
-
-<p>Given the previous if/then/else support, we can also define interesting
-functions for I/O.  For example, the following prints out a character whose
-"density" reflects the value passed in: the lower the value, the denser the
-character:</p>
-
-<div class="doc_code">
-<pre>
-ready&gt;
-<b>
-extern putchard(char)
-def printdensity(d)
-  if d &gt; 8 then
-    putchard(32)  # ' '
-  else if d &gt; 4 then
-    putchard(46)  # '.'
-  else if d &gt; 2 then
-    putchard(43)  # '+'
-  else
-    putchard(42); # '*'</b>
-...
-ready&gt; <b>printdensity(1): printdensity(2): printdensity(3) :
-          printdensity(4): printdensity(5): printdensity(9): putchard(10);</b>
-*++..
-Evaluated to 0.000000
-</pre>
-</div>
-
-<p>Based on these simple primitive operations, we can start to define more
-interesting things.  For example, here's a little function that solves for the
-number of iterations it takes a function in the complex plane to
-converge:</p>
-
-<div class="doc_code">
-<pre>
-# determine whether the specific location diverges.
-# Solve for z = z^2 + c in the complex plane.
-def mandleconverger(real imag iters creal cimag)
-  if iters &gt; 255 | (real*real + imag*imag &gt; 4) then
-    iters
-  else
-    mandleconverger(real*real - imag*imag + creal,
-                    2*real*imag + cimag,
-                    iters+1, creal, cimag);
-
-# return the number of iterations required for the iteration to escape
-def mandleconverge(real imag)
-  mandleconverger(real, imag, 0, real, imag);
-</pre>
-</div>
-
-<p>This "z = z<sup>2</sup> + c" function is a beautiful little creature that is the basis
-for computation of the <a
-href="http://en.wikipedia.org/wiki/Mandelbrot_set">Mandelbrot Set</a>.  Our
-<tt>mandelconverge</tt> function returns the number of iterations that it takes
-for a complex orbit to escape, saturating to 255.  This is not a very useful
-function by itself, but if you plot its value over a two-dimensional plane,
-you can see the Mandelbrot set.  Given that we are limited to using putchard
-here, our amazing graphical output is limited, but we can whip together
-something using the density plotter above:</p>
-
-<div class="doc_code">
-<pre>
-# compute and plot the mandlebrot set with the specified 2 dimensional range
-# info.
-def mandelhelp(xmin xmax xstep   ymin ymax ystep)
-  for y = ymin, y &lt; ymax, ystep in (
-    (for x = xmin, x &lt; xmax, xstep in
-       printdensity(mandleconverge(x,y)))
-    : putchard(10)
-  )
-
-# mandel - This is a convenient helper function for ploting the mandelbrot set
-# from the specified position with the specified Magnification.
-def mandel(realstart imagstart realmag imagmag)
-  mandelhelp(realstart, realstart+realmag*78, realmag,
-             imagstart, imagstart+imagmag*40, imagmag);
-</pre>
-</div>
-
-<p>Given this, we can try plotting out the mandlebrot set!  Lets try it out:</p>
-
-<div class="doc_code">
-<pre>
-ready&gt; <b>mandel(-2.3, -1.3, 0.05, 0.07);</b>
-*******************************+++++++++++*************************************
-*************************+++++++++++++++++++++++*******************************
-**********************+++++++++++++++++++++++++++++****************************
-*******************+++++++++++++++++++++.. ...++++++++*************************
-*****************++++++++++++++++++++++.... ...+++++++++***********************
-***************+++++++++++++++++++++++.....   ...+++++++++*********************
-**************+++++++++++++++++++++++....     ....+++++++++********************
-*************++++++++++++++++++++++......      .....++++++++*******************
-************+++++++++++++++++++++.......       .......+++++++******************
-***********+++++++++++++++++++....                ... .+++++++*****************
-**********+++++++++++++++++.......                     .+++++++****************
-*********++++++++++++++...........                    ...+++++++***************
-********++++++++++++............                      ...++++++++**************
-********++++++++++... ..........                        .++++++++**************
-*******+++++++++.....                                   .+++++++++*************
-*******++++++++......                                  ..+++++++++*************
-*******++++++.......                                   ..+++++++++*************
-*******+++++......                                     ..+++++++++*************
-*******.... ....                                      ...+++++++++*************
-*******.... .                                         ...+++++++++*************
-*******+++++......                                    ...+++++++++*************
-*******++++++.......                                   ..+++++++++*************
-*******++++++++......                                   .+++++++++*************
-*******+++++++++.....                                  ..+++++++++*************
-********++++++++++... ..........                        .++++++++**************
-********++++++++++++............                      ...++++++++**************
-*********++++++++++++++..........                     ...+++++++***************
-**********++++++++++++++++........                     .+++++++****************
-**********++++++++++++++++++++....                ... ..+++++++****************
-***********++++++++++++++++++++++.......       .......++++++++*****************
-************+++++++++++++++++++++++......      ......++++++++******************
-**************+++++++++++++++++++++++....      ....++++++++********************
-***************+++++++++++++++++++++++.....   ...+++++++++*********************
-*****************++++++++++++++++++++++....  ...++++++++***********************
-*******************+++++++++++++++++++++......++++++++*************************
-*********************++++++++++++++++++++++.++++++++***************************
-*************************+++++++++++++++++++++++*******************************
-******************************+++++++++++++************************************
-*******************************************************************************
-*******************************************************************************
-*******************************************************************************
-Evaluated to 0.000000
-ready&gt; <b>mandel(-2, -1, 0.02, 0.04);</b>
-**************************+++++++++++++++++++++++++++++++++++++++++++++++++++++
-***********************++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-*********************+++++++++++++++++++++++++++++++++++++++++++++++++++++++++.
-*******************+++++++++++++++++++++++++++++++++++++++++++++++++++++++++...
-*****************+++++++++++++++++++++++++++++++++++++++++++++++++++++++++.....
-***************++++++++++++++++++++++++++++++++++++++++++++++++++++++++........
-**************++++++++++++++++++++++++++++++++++++++++++++++++++++++...........
-************+++++++++++++++++++++++++++++++++++++++++++++++++++++..............
-***********++++++++++++++++++++++++++++++++++++++++++++++++++........        .
-**********++++++++++++++++++++++++++++++++++++++++++++++.............
-********+++++++++++++++++++++++++++++++++++++++++++..................
-*******+++++++++++++++++++++++++++++++++++++++.......................
-******+++++++++++++++++++++++++++++++++++...........................
-*****++++++++++++++++++++++++++++++++............................
-*****++++++++++++++++++++++++++++...............................
-****++++++++++++++++++++++++++......   .........................
-***++++++++++++++++++++++++.........     ......    ...........
-***++++++++++++++++++++++............
-**+++++++++++++++++++++..............
-**+++++++++++++++++++................
-*++++++++++++++++++.................
-*++++++++++++++++............ ...
-*++++++++++++++..............
-*+++....++++................
-*..........  ...........
-*
-*..........  ...........
-*+++....++++................
-*++++++++++++++..............
-*++++++++++++++++............ ...
-*++++++++++++++++++.................
-**+++++++++++++++++++................
-**+++++++++++++++++++++..............
-***++++++++++++++++++++++............
-***++++++++++++++++++++++++.........     ......    ...........
-****++++++++++++++++++++++++++......   .........................
-*****++++++++++++++++++++++++++++...............................
-*****++++++++++++++++++++++++++++++++............................
-******+++++++++++++++++++++++++++++++++++...........................
-*******+++++++++++++++++++++++++++++++++++++++.......................
-********+++++++++++++++++++++++++++++++++++++++++++..................
-Evaluated to 0.000000
-ready&gt; <b>mandel(-0.9, -1.4, 0.02, 0.03);</b>
-*******************************************************************************
-*******************************************************************************
-*******************************************************************************
-**********+++++++++++++++++++++************************************************
-*+++++++++++++++++++++++++++++++++++++++***************************************
-+++++++++++++++++++++++++++++++++++++++++++++**********************************
-++++++++++++++++++++++++++++++++++++++++++++++++++*****************************
-++++++++++++++++++++++++++++++++++++++++++++++++++++++*************************
-+++++++++++++++++++++++++++++++++++++++++++++++++++++++++**********************
-+++++++++++++++++++++++++++++++++.........++++++++++++++++++*******************
-+++++++++++++++++++++++++++++++....   ......+++++++++++++++++++****************
-+++++++++++++++++++++++++++++.......  ........+++++++++++++++++++**************
-++++++++++++++++++++++++++++........   ........++++++++++++++++++++************
-+++++++++++++++++++++++++++.........     ..  ...+++++++++++++++++++++**********
-++++++++++++++++++++++++++...........        ....++++++++++++++++++++++********
-++++++++++++++++++++++++.............       .......++++++++++++++++++++++******
-+++++++++++++++++++++++.............        ........+++++++++++++++++++++++****
-++++++++++++++++++++++...........           ..........++++++++++++++++++++++***
-++++++++++++++++++++...........                .........++++++++++++++++++++++*
-++++++++++++++++++............                  ...........++++++++++++++++++++
-++++++++++++++++...............                 .............++++++++++++++++++
-++++++++++++++.................                 ...............++++++++++++++++
-++++++++++++..................                  .................++++++++++++++
-+++++++++..................                      .................+++++++++++++
-++++++........        .                               .........  ..++++++++++++
-++............                                         ......    ....++++++++++
-..............                                                    ...++++++++++
-..............                                                    ....+++++++++
-..............                                                    .....++++++++
-.............                                                    ......++++++++
-...........                                                     .......++++++++
-.........                                                       ........+++++++
-.........                                                       ........+++++++
-.........                                                           ....+++++++
-........                                                             ...+++++++
-.......                                                              ...+++++++
-                                                                    ....+++++++
-                                                                   .....+++++++
-                                                                    ....+++++++
-                                                                    ....+++++++
-                                                                    ....+++++++
-Evaluated to 0.000000
-ready&gt; <b>^D</b>
-</pre>
-</div>
-
-<p>At this point, you may be starting to realize that Kaleidoscope is a real
-and powerful language.  It may not be self-similar :), but it can be used to
-plot things that are!</p>
-
-<p>With this, we conclude the "adding user-defined operators" chapter of the
-tutorial.  We have successfully augmented our language, adding the ability to
-extend the language in the library, and we have shown how this can be used to
-build a simple but interesting end-user application in Kaleidoscope.  At this
-point, Kaleidoscope can build a variety of applications that are functional and
-can call functions with side-effects, but it can't actually define and mutate a
-variable itself.</p>
-
-<p>Strikingly, variable mutation is an important feature of some
-languages, and it is not at all obvious how to <a href="OCamlLangImpl7.html">add
-support for mutable variables</a> without having to add an "SSA construction"
-phase to your front-end.  In the next chapter, we will describe how you can
-add variable mutation without building SSA in your front-end.</p>
-
-</div>
-
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="code">Full Code Listing</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>
-Here is the complete code listing for our running example, enhanced with the
-if/then/else and for expressions..  To build this example, use:
-</p>
-
-<div class="doc_code">
-<pre>
-# Compile
-ocamlbuild toy.byte
-# Run
-./toy.byte
-</pre>
-</div>
-
-<p>Here is the code:</p>
-
-<dl>
-<dt>_tags:</dt>
-<dd class="doc_code">
-<pre>
-&lt;{lexer,parser}.ml&gt;: use_camlp4, pp(camlp4of)
-&lt;*.{byte,native}&gt;: g++, use_llvm, use_llvm_analysis
-&lt;*.{byte,native}&gt;: use_llvm_executionengine, use_llvm_target
-&lt;*.{byte,native}&gt;: use_llvm_scalar_opts, use_bindings
-</pre>
-</dd>
-
-<dt>myocamlbuild.ml:</dt>
-<dd class="doc_code">
-<pre>
-open Ocamlbuild_plugin;;
-
-ocaml_lib ~extern:true "llvm";;
-ocaml_lib ~extern:true "llvm_analysis";;
-ocaml_lib ~extern:true "llvm_executionengine";;
-ocaml_lib ~extern:true "llvm_target";;
-ocaml_lib ~extern:true "llvm_scalar_opts";;
-
-flag ["link"; "ocaml"; "g++"] (S[A"-cc"; A"g++"]);;
-dep ["link"; "ocaml"; "use_bindings"] ["bindings.o"];;
-</pre>
-</dd>
-
-<dt>token.ml:</dt>
-<dd class="doc_code">
-<pre>
-(*===----------------------------------------------------------------------===
- * Lexer Tokens
- *===----------------------------------------------------------------------===*)
-
-(* The lexer returns these 'Kwd' if it is an unknown character, otherwise one of
- * these others for known things. *)
-type token =
-  (* commands *)
-  | Def | Extern
-
-  (* primary *)
-  | Ident of string | Number of float
-
-  (* unknown *)
-  | Kwd of char
-
-  (* control *)
-  | If | Then | Else
-  | For | In
-
-  (* operators *)
-  | Binary | Unary
-</pre>
-</dd>
-
-<dt>lexer.ml:</dt>
-<dd class="doc_code">
-<pre>
-(*===----------------------------------------------------------------------===
- * Lexer
- *===----------------------------------------------------------------------===*)
-
-let rec lex = parser
-  (* Skip any whitespace. *)
-  | [&lt; ' (' ' | '\n' | '\r' | '\t'); stream &gt;] -&gt; lex stream
-
-  (* identifier: [a-zA-Z][a-zA-Z0-9] *)
-  | [&lt; ' ('A' .. 'Z' | 'a' .. 'z' as c); stream &gt;] -&gt;
-      let buffer = Buffer.create 1 in
-      Buffer.add_char buffer c;
-      lex_ident buffer stream
-
-  (* number: [0-9.]+ *)
-  | [&lt; ' ('0' .. '9' as c); stream &gt;] -&gt;
-      let buffer = Buffer.create 1 in
-      Buffer.add_char buffer c;
-      lex_number buffer stream
-
-  (* Comment until end of line. *)
-  | [&lt; ' ('#'); stream &gt;] -&gt;
-      lex_comment stream
-
-  (* Otherwise, just return the character as its ascii value. *)
-  | [&lt; 'c; stream &gt;] -&gt;
-      [&lt; 'Token.Kwd c; lex stream &gt;]
-
-  (* end of stream. *)
-  | [&lt; &gt;] -&gt; [&lt; &gt;]
-
-and lex_number buffer = parser
-  | [&lt; ' ('0' .. '9' | '.' as c); stream &gt;] -&gt;
-      Buffer.add_char buffer c;
-      lex_number buffer stream
-  | [&lt; stream=lex &gt;] -&gt;
-      [&lt; 'Token.Number (float_of_string (Buffer.contents buffer)); stream &gt;]
-
-and lex_ident buffer = parser
-  | [&lt; ' ('A' .. 'Z' | 'a' .. 'z' | '0' .. '9' as c); stream &gt;] -&gt;
-      Buffer.add_char buffer c;
-      lex_ident buffer stream
-  | [&lt; stream=lex &gt;] -&gt;
-      match Buffer.contents buffer with
-      | "def" -&gt; [&lt; 'Token.Def; stream &gt;]
-      | "extern" -&gt; [&lt; 'Token.Extern; stream &gt;]
-      | "if" -&gt; [&lt; 'Token.If; stream &gt;]
-      | "then" -&gt; [&lt; 'Token.Then; stream &gt;]
-      | "else" -&gt; [&lt; 'Token.Else; stream &gt;]
-      | "for" -&gt; [&lt; 'Token.For; stream &gt;]
-      | "in" -&gt; [&lt; 'Token.In; stream &gt;]
-      | "binary" -&gt; [&lt; 'Token.Binary; stream &gt;]
-      | "unary" -&gt; [&lt; 'Token.Unary; stream &gt;]
-      | id -&gt; [&lt; 'Token.Ident id; stream &gt;]
-
-and lex_comment = parser
-  | [&lt; ' ('\n'); stream=lex &gt;] -&gt; stream
-  | [&lt; 'c; e=lex_comment &gt;] -&gt; e
-  | [&lt; &gt;] -&gt; [&lt; &gt;]
-</pre>
-</dd>
-
-<dt>ast.ml:</dt>
-<dd class="doc_code">
-<pre>
-(*===----------------------------------------------------------------------===
- * Abstract Syntax Tree (aka Parse Tree)
- *===----------------------------------------------------------------------===*)
-
-(* expr - Base type for all expression nodes. *)
-type expr =
-  (* variant for numeric literals like "1.0". *)
-  | Number of float
-
-  (* variant for referencing a variable, like "a". *)
-  | Variable of string
-
-  (* variant for a unary operator. *)
-  | Unary of char * expr
-
-  (* variant for a binary operator. *)
-  | Binary of char * expr * expr
-
-  (* variant for function calls. *)
-  | Call of string * expr array
-
-  (* variant for if/then/else. *)
-  | If of expr * expr * expr
-
-  (* variant for for/in. *)
-  | For of string * expr * expr * expr option * expr
-
-(* proto - This type represents the "prototype" for a function, which captures
- * its name, and its argument names (thus implicitly the number of arguments the
- * function takes). *)
-type proto =
-  | Prototype of string * string array
-  | BinOpPrototype of string * string array * int
-
-(* func - This type represents a function definition itself. *)
-type func = Function of proto * expr
-</pre>
-</dd>
-
-<dt>parser.ml:</dt>
-<dd class="doc_code">
-<pre>
-(*===---------------------------------------------------------------------===
- * Parser
- *===---------------------------------------------------------------------===*)
-
-(* binop_precedence - This holds the precedence for each binary operator that is
- * defined *)
-let binop_precedence:(char, int) Hashtbl.t = Hashtbl.create 10
-
-(* precedence - Get the precedence of the pending binary operator token. *)
-let precedence c = try Hashtbl.find binop_precedence c with Not_found -&gt; -1
-
-(* primary
- *   ::= identifier
- *   ::= numberexpr
- *   ::= parenexpr
- *   ::= ifexpr
- *   ::= forexpr *)
-let rec parse_primary = parser
-  (* numberexpr ::= number *)
-  | [&lt; 'Token.Number n &gt;] -&gt; Ast.Number n
-
-  (* parenexpr ::= '(' expression ')' *)
-  | [&lt; 'Token.Kwd '('; e=parse_expr; 'Token.Kwd ')' ?? "expected ')'" &gt;] -&gt; e
-
-  (* identifierexpr
-   *   ::= identifier
-   *   ::= identifier '(' argumentexpr ')' *)
-  | [&lt; 'Token.Ident id; stream &gt;] -&gt;
-      let rec parse_args accumulator = parser
-        | [&lt; e=parse_expr; stream &gt;] -&gt;
-            begin parser
-              | [&lt; 'Token.Kwd ','; e=parse_args (e :: accumulator) &gt;] -&gt; e
-              | [&lt; &gt;] -&gt; e :: accumulator
-            end stream
-        | [&lt; &gt;] -&gt; accumulator
-      in
-      let rec parse_ident id = parser
-        (* Call. *)
-        | [&lt; 'Token.Kwd '(';
-             args=parse_args [];
-             'Token.Kwd ')' ?? "expected ')'"&gt;] -&gt;
-            Ast.Call (id, Array.of_list (List.rev args))
-
-        (* Simple variable ref. *)
-        | [&lt; &gt;] -&gt; Ast.Variable id
-      in
-      parse_ident id stream
-
-  (* ifexpr ::= 'if' expr 'then' expr 'else' expr *)
-  | [&lt; 'Token.If; c=parse_expr;
-       'Token.Then ?? "expected 'then'"; t=parse_expr;
-       'Token.Else ?? "expected 'else'"; e=parse_expr &gt;] -&gt;
-      Ast.If (c, t, e)
-
-  (* forexpr
-        ::= 'for' identifier '=' expr ',' expr (',' expr)? 'in' expression *)
-  | [&lt; 'Token.For;
-       'Token.Ident id ?? "expected identifier after for";
-       'Token.Kwd '=' ?? "expected '=' after for";
-       stream &gt;] -&gt;
-      begin parser
-        | [&lt;
-             start=parse_expr;
-             'Token.Kwd ',' ?? "expected ',' after for";
-             end_=parse_expr;
-             stream &gt;] -&gt;
-            let step =
-              begin parser
-              | [&lt; 'Token.Kwd ','; step=parse_expr &gt;] -&gt; Some step
-              | [&lt; &gt;] -&gt; None
-              end stream
-            in
-            begin parser
-            | [&lt; 'Token.In; body=parse_expr &gt;] -&gt;
-                Ast.For (id, start, end_, step, body)
-            | [&lt; &gt;] -&gt;
-                raise (Stream.Error "expected 'in' after for")
-            end stream
-        | [&lt; &gt;] -&gt;
-            raise (Stream.Error "expected '=' after for")
-      end stream
-
-  | [&lt; &gt;] -&gt; raise (Stream.Error "unknown token when expecting an expression.")
-
-(* unary
- *   ::= primary
- *   ::= '!' unary *)
-and parse_unary = parser
-  (* If this is a unary operator, read it. *)
-  | [&lt; 'Token.Kwd op when op != '(' &amp;&amp; op != ')'; operand=parse_expr &gt;] -&gt;
-      Ast.Unary (op, operand)
-
-  (* If the current token is not an operator, it must be a primary expr. *)
-  | [&lt; stream &gt;] -&gt; parse_primary stream
-
-(* binoprhs
- *   ::= ('+' primary)* *)
-and parse_bin_rhs expr_prec lhs stream =
-  match Stream.peek stream with
-  (* If this is a binop, find its precedence. *)
-  | Some (Token.Kwd c) when Hashtbl.mem binop_precedence c -&gt;
-      let token_prec = precedence c in
-
-      (* If this is a binop that binds at least as tightly as the current binop,
-       * consume it, otherwise we are done. *)
-      if token_prec &lt; expr_prec then lhs else begin
-        (* Eat the binop. *)
-        Stream.junk stream;
-
-        (* Parse the unary expression after the binary operator. *)
-        let rhs = parse_unary stream in
-
-        (* Okay, we know this is a binop. *)
-        let rhs =
-          match Stream.peek stream with
-          | Some (Token.Kwd c2) -&gt;
-              (* If BinOp binds less tightly with rhs than the operator after
-               * rhs, let the pending operator take rhs as its lhs. *)
-              let next_prec = precedence c2 in
-              if token_prec &lt; next_prec
-              then parse_bin_rhs (token_prec + 1) rhs stream
-              else rhs
-          | _ -&gt; rhs
-        in
-
-        (* Merge lhs/rhs. *)
-        let lhs = Ast.Binary (c, lhs, rhs) in
-        parse_bin_rhs expr_prec lhs stream
-      end
-  | _ -&gt; lhs
-
-(* expression
- *   ::= primary binoprhs *)
-and parse_expr = parser
-  | [&lt; lhs=parse_unary; stream &gt;] -&gt; parse_bin_rhs 0 lhs stream
-
-(* prototype
- *   ::= id '(' id* ')'
- *   ::= binary LETTER number? (id, id)
- *   ::= unary LETTER number? (id) *)
-let parse_prototype =
-  let rec parse_args accumulator = parser
-    | [&lt; 'Token.Ident id; e=parse_args (id::accumulator) &gt;] -&gt; e
-    | [&lt; &gt;] -&gt; accumulator
-  in
-  let parse_operator = parser
-    | [&lt; 'Token.Unary &gt;] -&gt; "unary", 1
-    | [&lt; 'Token.Binary &gt;] -&gt; "binary", 2
-  in
-  let parse_binary_precedence = parser
-    | [&lt; 'Token.Number n &gt;] -&gt; int_of_float n
-    | [&lt; &gt;] -&gt; 30
-  in
-  parser
-  | [&lt; 'Token.Ident id;
-       'Token.Kwd '(' ?? "expected '(' in prototype";
-       args=parse_args [];
-       'Token.Kwd ')' ?? "expected ')' in prototype" &gt;] -&gt;
-      (* success. *)
-      Ast.Prototype (id, Array.of_list (List.rev args))
-  | [&lt; (prefix, kind)=parse_operator;
-       'Token.Kwd op ?? "expected an operator";
-       (* Read the precedence if present. *)
-       binary_precedence=parse_binary_precedence;
-       'Token.Kwd '(' ?? "expected '(' in prototype";
-        args=parse_args [];
-       'Token.Kwd ')' ?? "expected ')' in prototype" &gt;] -&gt;
-      let name = prefix ^ (String.make 1 op) in
-      let args = Array.of_list (List.rev args) in
-
-      (* Verify right number of arguments for operator. *)
-      if Array.length args != kind
-      then raise (Stream.Error "invalid number of operands for operator")
-      else
-        if kind == 1 then
-          Ast.Prototype (name, args)
-        else
-          Ast.BinOpPrototype (name, args, binary_precedence)
-  | [&lt; &gt;] -&gt;
-      raise (Stream.Error "expected function name in prototype")
-
-(* definition ::= 'def' prototype expression *)
-let parse_definition = parser
-  | [&lt; 'Token.Def; p=parse_prototype; e=parse_expr &gt;] -&gt;
-      Ast.Function (p, e)
-
-(* toplevelexpr ::= expression *)
-let parse_toplevel = parser
-  | [&lt; e=parse_expr &gt;] -&gt;
-      (* Make an anonymous proto. *)
-      Ast.Function (Ast.Prototype ("", [||]), e)
-
-(*  external ::= 'extern' prototype *)
-let parse_extern = parser
-  | [&lt; 'Token.Extern; e=parse_prototype &gt;] -&gt; e
-</pre>
-</dd>
-
-<dt>codegen.ml:</dt>
-<dd class="doc_code">
-<pre>
-(*===----------------------------------------------------------------------===
- * Code Generation
- *===----------------------------------------------------------------------===*)
-
-open Llvm
-
-exception Error of string
-
-let context = global_context ()
-let the_module = create_module context "my cool jit"
-let builder = builder context
-let named_values:(string, llvalue) Hashtbl.t = Hashtbl.create 10
-
-let rec codegen_expr = function
-  | Ast.Number n -&gt; const_float double_type n
-  | Ast.Variable name -&gt;
-      (try Hashtbl.find named_values name with
-        | Not_found -&gt; raise (Error "unknown variable name"))
-  | Ast.Unary (op, operand) -&gt;
-      let operand = codegen_expr operand in
-      let callee = "unary" ^ (String.make 1 op) in
-      let callee =
-        match lookup_function callee the_module with
-        | Some callee -&gt; callee
-        | None -&gt; raise (Error "unknown unary operator")
-      in
-      build_call callee [|operand|] "unop" builder
-  | Ast.Binary (op, lhs, rhs) -&gt;
-      let lhs_val = codegen_expr lhs in
-      let rhs_val = codegen_expr rhs in
-      begin
-        match op with
-        | '+' -&gt; build_add lhs_val rhs_val "addtmp" builder
-        | '-' -&gt; build_sub lhs_val rhs_val "subtmp" builder
-        | '*' -&gt; build_mul lhs_val rhs_val "multmp" builder
-        | '&lt;' -&gt;
-            (* Convert bool 0/1 to double 0.0 or 1.0 *)
-            let i = build_fcmp Fcmp.Ult lhs_val rhs_val "cmptmp" builder in
-            build_uitofp i double_type "booltmp" builder
-        | _ -&gt;
-            (* If it wasn't a builtin binary operator, it must be a user defined
-             * one. Emit a call to it. *)
-            let callee = "binary" ^ (String.make 1 op) in
-            let callee =
-              match lookup_function callee the_module with
-              | Some callee -&gt; callee
-              | None -&gt; raise (Error "binary operator not found!")
-            in
-            build_call callee [|lhs_val; rhs_val|] "binop" builder
-      end
-  | Ast.Call (callee, args) -&gt;
-      (* Look up the name in the module table. *)
-      let callee =
-        match lookup_function callee the_module with
-        | Some callee -&gt; callee
-        | None -&gt; raise (Error "unknown function referenced")
-      in
-      let params = params callee in
-
-      (* If argument mismatch error. *)
-      if Array.length params == Array.length args then () else
-        raise (Error "incorrect # arguments passed");
-      let args = Array.map codegen_expr args in
-      build_call callee args "calltmp" builder
-  | Ast.If (cond, then_, else_) -&gt;
-      let cond = codegen_expr cond in
-
-      (* Convert condition to a bool by comparing equal to 0.0 *)
-      let zero = const_float double_type 0.0 in
-      let cond_val = build_fcmp Fcmp.One cond zero "ifcond" builder in
-
-      (* Grab the first block so that we might later add the conditional branch
-       * to it at the end of the function. *)
-      let start_bb = insertion_block builder in
-      let the_function = block_parent start_bb in
-
-      let then_bb = append_block "then" the_function in
-
-      (* Emit 'then' value. *)
-      position_at_end then_bb builder;
-      let then_val = codegen_expr then_ in
-
-      (* Codegen of 'then' can change the current block, update then_bb for the
-       * phi. We create a new name because one is used for the phi node, and the
-       * other is used for the conditional branch. *)
-      let new_then_bb = insertion_block builder in
-
-      (* Emit 'else' value. *)
-      let else_bb = append_block "else" the_function in
-      position_at_end else_bb builder;
-      let else_val = codegen_expr else_ in
-
-      (* Codegen of 'else' can change the current block, update else_bb for the
-       * phi. *)
-      let new_else_bb = insertion_block builder in
-
-      (* Emit merge block. *)
-      let merge_bb = append_block "ifcont" the_function in
-      position_at_end merge_bb builder;
-      let incoming = [(then_val, new_then_bb); (else_val, new_else_bb)] in
-      let phi = build_phi incoming "iftmp" builder in
-
-      (* Return to the start block to add the conditional branch. *)
-      position_at_end start_bb builder;
-      ignore (build_cond_br cond_val then_bb else_bb builder);
-
-      (* Set a unconditional branch at the end of the 'then' block and the
-       * 'else' block to the 'merge' block. *)
-      position_at_end new_then_bb builder; ignore (build_br merge_bb builder);
-      position_at_end new_else_bb builder; ignore (build_br merge_bb builder);
-
-      (* Finally, set the builder to the end of the merge block. *)
-      position_at_end merge_bb builder;
-
-      phi
-  | Ast.For (var_name, start, end_, step, body) -&gt;
-      (* Emit the start code first, without 'variable' in scope. *)
-      let start_val = codegen_expr start in
-
-      (* Make the new basic block for the loop header, inserting after current
-       * block. *)
-      let preheader_bb = insertion_block builder in
-      let the_function = block_parent preheader_bb in
-      let loop_bb = append_block "loop" the_function in
-
-      (* Insert an explicit fall through from the current block to the
-       * loop_bb. *)
-      ignore (build_br loop_bb builder);
-
-      (* Start insertion in loop_bb. *)
-      position_at_end loop_bb builder;
-
-      (* Start the PHI node with an entry for start. *)
-      let variable = build_phi [(start_val, preheader_bb)] var_name builder in
-
-      (* Within the loop, the variable is defined equal to the PHI node. If it
-       * shadows an existing variable, we have to restore it, so save it
-       * now. *)
-      let old_val =
-        try Some (Hashtbl.find named_values var_name) with Not_found -&gt; None
-      in
-      Hashtbl.add named_values var_name variable;
-
-      (* Emit the body of the loop.  This, like any other expr, can change the
-       * current BB.  Note that we ignore the value computed by the body, but
-       * don't allow an error *)
-      ignore (codegen_expr body);
-
-      (* Emit the step value. *)
-      let step_val =
-        match step with
-        | Some step -&gt; codegen_expr step
-        (* If not specified, use 1.0. *)
-        | None -&gt; const_float double_type 1.0
-      in
-
-      let next_var = build_add variable step_val "nextvar" builder in
-
-      (* Compute the end condition. *)
-      let end_cond = codegen_expr end_ in
-
-      (* Convert condition to a bool by comparing equal to 0.0. *)
-      let zero = const_float double_type 0.0 in
-      let end_cond = build_fcmp Fcmp.One end_cond zero "loopcond" builder in
-
-      (* Create the "after loop" block and insert it. *)
-      let loop_end_bb = insertion_block builder in
-      let after_bb = append_block "afterloop" the_function in
-
-      (* Insert the conditional branch into the end of loop_end_bb. *)
-      ignore (build_cond_br end_cond loop_bb after_bb builder);
-
-      (* Any new code will be inserted in after_bb. *)
-      position_at_end after_bb builder;
-
-      (* Add a new entry to the PHI node for the backedge. *)
-      add_incoming (next_var, loop_end_bb) variable;
-
-      (* Restore the unshadowed variable. *)
-      begin match old_val with
-      | Some old_val -&gt; Hashtbl.add named_values var_name old_val
-      | None -&gt; ()
-      end;
-
-      (* for expr always returns 0.0. *)
-      const_null double_type
-
-let codegen_proto = function
-  | Ast.Prototype (name, args) | Ast.BinOpPrototype (name, args, _) -&gt;
-      (* Make the function type: double(double,double) etc. *)
-      let doubles = Array.make (Array.length args) double_type in
-      let ft = function_type double_type doubles in
-      let f =
-        match lookup_function name the_module with
-        | None -&gt; declare_function name ft the_module
-
-        (* If 'f' conflicted, there was already something named 'name'. If it
-         * has a body, don't allow redefinition or reextern. *)
-        | Some f -&gt;
-            (* If 'f' already has a body, reject this. *)
-            if block_begin f &lt;&gt; At_end f then
-              raise (Error "redefinition of function");
-
-            (* If 'f' took a different number of arguments, reject. *)
-            if element_type (type_of f) &lt;&gt; ft then
-              raise (Error "redefinition of function with different # args");
-            f
-      in
-
-      (* Set names for all arguments. *)
-      Array.iteri (fun i a -&gt;
-        let n = args.(i) in
-        set_value_name n a;
-        Hashtbl.add named_values n a;
-      ) (params f);
-      f
-
-let codegen_func the_fpm = function
-  | Ast.Function (proto, body) -&gt;
-      Hashtbl.clear named_values;
-      let the_function = codegen_proto proto in
-
-      (* If this is an operator, install it. *)
-      begin match proto with
-      | Ast.BinOpPrototype (name, args, prec) -&gt;
-          let op = name.[String.length name - 1] in
-          Hashtbl.add Parser.binop_precedence op prec;
-      | _ -&gt; ()
-      end;
-
-      (* Create a new basic block to start insertion into. *)
-      let bb = append_block "entry" the_function in
-      position_at_end bb builder;
-
-      try
-        let ret_val = codegen_expr body in
-
-        (* Finish off the function. *)
-        let _ = build_ret ret_val builder in
-
-        (* Validate the generated code, checking for consistency. *)
-        Llvm_analysis.assert_valid_function the_function;
-
-        (* Optimize the function. *)
-        let _ = PassManager.run_function the_function the_fpm in
-
-        the_function
-      with e -&gt;
-        delete_function the_function;
-        raise e
-</pre>
-</dd>
-
-<dt>toplevel.ml:</dt>
-<dd class="doc_code">
-<pre>
-(*===----------------------------------------------------------------------===
- * Top-Level parsing and JIT Driver
- *===----------------------------------------------------------------------===*)
-
-open Llvm
-open Llvm_executionengine
-
-(* top ::= definition | external | expression | ';' *)
-let rec main_loop the_fpm the_execution_engine stream =
-  match Stream.peek stream with
-  | None -&gt; ()
-
-  (* ignore top-level semicolons. *)
-  | Some (Token.Kwd ';') -&gt;
-      Stream.junk stream;
-      main_loop the_fpm the_execution_engine stream
-
-  | Some token -&gt;
-      begin
-        try match token with
-        | Token.Def -&gt;
-            let e = Parser.parse_definition stream in
-            print_endline "parsed a function definition.";
-            dump_value (Codegen.codegen_func the_fpm e);
-        | Token.Extern -&gt;
-            let e = Parser.parse_extern stream in
-            print_endline "parsed an extern.";
-            dump_value (Codegen.codegen_proto e);
-        | _ -&gt;
-            (* Evaluate a top-level expression into an anonymous function. *)
-            let e = Parser.parse_toplevel stream in
-            print_endline "parsed a top-level expr";
-            let the_function = Codegen.codegen_func the_fpm e in
-            dump_value the_function;
-
-            (* JIT the function, returning a function pointer. *)
-            let result = ExecutionEngine.run_function the_function [||]
-              the_execution_engine in
-
-            print_string "Evaluated to ";
-            print_float (GenericValue.as_float double_type result);
-            print_newline ();
-        with Stream.Error s | Codegen.Error s -&gt;
-          (* Skip token for error recovery. *)
-          Stream.junk stream;
-          print_endline s;
-      end;
-      print_string "ready&gt; "; flush stdout;
-      main_loop the_fpm the_execution_engine stream
-</pre>
-</dd>
-
-<dt>toy.ml:</dt>
-<dd class="doc_code">
-<pre>
-(*===----------------------------------------------------------------------===
- * Main driver code.
- *===----------------------------------------------------------------------===*)
-
-open Llvm
-open Llvm_executionengine
-open Llvm_target
-open Llvm_scalar_opts
-
-let main () =
-  ignore (initialize_native_target ());
-
-  (* Install standard binary operators.
-   * 1 is the lowest precedence. *)
-  Hashtbl.add Parser.binop_precedence '&lt;' 10;
-  Hashtbl.add Parser.binop_precedence '+' 20;
-  Hashtbl.add Parser.binop_precedence '-' 20;
-  Hashtbl.add Parser.binop_precedence '*' 40;    (* highest. *)
-
-  (* Prime the first token. *)
-  print_string "ready&gt; "; flush stdout;
-  let stream = Lexer.lex (Stream.of_channel stdin) in
-
-  (* Create the JIT. *)
-  let the_module_provider = ModuleProvider.create Codegen.the_module in
-  let the_execution_engine = ExecutionEngine.create the_module_provider in
-  let the_fpm = PassManager.create_function the_module_provider in
-
-  (* Set up the optimizer pipeline.  Start with registering info about how the
-   * target lays out data structures. *)
-  TargetData.add (ExecutionEngine.target_data the_execution_engine) the_fpm;
-
-  (* Do simple "peephole" optimizations and bit-twiddling optzn. *)
-  add_instruction_combining the_fpm;
-
-  (* reassociate expressions. *)
-  add_reassociation the_fpm;
-
-  (* Eliminate Common SubExpressions. *)
-  add_gvn the_fpm;
-
-  (* Simplify the control flow graph (deleting unreachable blocks, etc). *)
-  add_cfg_simplification the_fpm;
-
-  ignore (PassManager.initialize the_fpm);
-
-  (* Run the main "interpreter loop" now. *)
-  Toplevel.main_loop the_fpm the_execution_engine stream;
-
-  (* Print out all the generated code. *)
-  dump_module Codegen.the_module
-;;
-
-main ()
-</pre>
-</dd>
-
-<dt>bindings.c</dt>
-<dd class="doc_code">
-<pre>
-#include &lt;stdio.h&gt;
-
-/* putchard - putchar that takes a double and returns 0. */
-extern double putchard(double X) {
-  putchar((char)X);
-  return 0;
-}
-
-/* printd - printf that takes a double prints it as "%f\n", returning 0. */
-extern double printd(double X) {
-  printf("%f\n", X);
-  return 0;
-}
-</pre>
-</dd>
-</dl>
-
-<a href="OCamlLangImpl7.html">Next: Extending the language: mutable variables /
-SSA construction</a>
-</div>
-
-<!-- *********************************************************************** -->
-<hr>
-<address>
-  <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
-  src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"></a>
-  <a href="http://validator.w3.org/check/referer"><img
-  src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"></a>
-
-  <a href="mailto:sabre at nondot.org">Chris Lattner</a><br>
-  <a href="mailto:idadesub at users.sourceforge.net">Erick Tryzelaar</a><br>
-  <a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
-  Last modified: $Date$
-</address>
-</body>
-</html>
diff --git a/libclamav/c++/llvm/docs/tutorial/OCamlLangImpl7.html b/libclamav/c++/llvm/docs/tutorial/OCamlLangImpl7.html
deleted file mode 100644
index aff97c4..0000000
--- a/libclamav/c++/llvm/docs/tutorial/OCamlLangImpl7.html
+++ /dev/null
@@ -1,1907 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-                      "http://www.w3.org/TR/html4/strict.dtd">
-
-<html>
-<head>
-  <title>Kaleidoscope: Extending the Language: Mutable Variables / SSA
-         construction</title>
-  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-  <meta name="author" content="Chris Lattner">
-  <meta name="author" content="Erick Tryzelaar">
-  <link rel="stylesheet" href="../llvm.css" type="text/css">
-</head>
-
-<body>
-
-<div class="doc_title">Kaleidoscope: Extending the Language: Mutable Variables</div>
-
-<ul>
-<li><a href="index.html">Up to Tutorial Index</a></li>
-<li>Chapter 7
-  <ol>
-    <li><a href="#intro">Chapter 7 Introduction</a></li>
-    <li><a href="#why">Why is this a hard problem?</a></li>
-    <li><a href="#memory">Memory in LLVM</a></li>
-    <li><a href="#kalvars">Mutable Variables in Kaleidoscope</a></li>
-    <li><a href="#adjustments">Adjusting Existing Variables for
-     Mutation</a></li>
-    <li><a href="#assignment">New Assignment Operator</a></li>
-    <li><a href="#localvars">User-defined Local Variables</a></li>
-    <li><a href="#code">Full Code Listing</a></li>
-  </ol>
-</li>
-<li><a href="LangImpl8.html">Chapter 8</a>: Conclusion and other useful LLVM
- tidbits</li>
-</ul>
-
-<div class="doc_author">
-	<p>
-		Written by <a href="mailto:sabre at nondot.org">Chris Lattner</a>
-		and <a href="mailto:idadesub at users.sourceforge.net">Erick Tryzelaar</a>
-	</p>
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="intro">Chapter 7 Introduction</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>Welcome to Chapter 7 of the "<a href="index.html">Implementing a language
-with LLVM</a>" tutorial.  In chapters 1 through 6, we've built a very
-respectable, albeit simple, <a
-href="http://en.wikipedia.org/wiki/Functional_programming">functional
-programming language</a>.  In our journey, we learned some parsing techniques,
-how to build and represent an AST, how to build LLVM IR, and how to optimize
-the resultant code as well as JIT compile it.</p>
-
-<p>While Kaleidoscope is interesting as a functional language, the fact that it
-is functional makes it "too easy" to generate LLVM IR for it.  In particular, a
-functional language makes it very easy to build LLVM IR directly in <a
-href="http://en.wikipedia.org/wiki/Static_single_assignment_form">SSA form</a>.
-Since LLVM requires that the input code be in SSA form, this is a very nice
-property and it is often unclear to newcomers how to generate code for an
-imperative language with mutable variables.</p>
-
-<p>The short (and happy) summary of this chapter is that there is no need for
-your front-end to build SSA form: LLVM provides highly tuned and well tested
-support for this, though the way it works is a bit unexpected for some.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="why">Why is this a hard problem?</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>
-To understand why mutable variables cause complexities in SSA construction,
-consider this extremely simple C example:
-</p>
-
-<div class="doc_code">
-<pre>
-int G, H;
-int test(_Bool Condition) {
-  int X;
-  if (Condition)
-    X = G;
-  else
-    X = H;
-  return X;
-}
-</pre>
-</div>
-
-<p>In this case, we have the variable "X", whose value depends on the path
-executed in the program.  Because there are two different possible values for X
-before the return instruction, a PHI node is inserted to merge the two values.
-The LLVM IR that we want for this example looks like this:</p>
-
-<div class="doc_code">
-<pre>
- at G = weak global i32 0   ; type of @G is i32*
- at H = weak global i32 0   ; type of @H is i32*
-
-define i32 @test(i1 %Condition) {
-entry:
-  br i1 %Condition, label %cond_true, label %cond_false
-
-cond_true:
-  %X.0 = load i32* @G
-  br label %cond_next
-
-cond_false:
-  %X.1 = load i32* @H
-  br label %cond_next
-
-cond_next:
-  %X.2 = phi i32 [ %X.1, %cond_false ], [ %X.0, %cond_true ]
-  ret i32 %X.2
-}
-</pre>
-</div>
-
-<p>In this example, the loads from the G and H global variables are explicit in
-the LLVM IR, and they live in the then/else branches of the if statement
-(cond_true/cond_false).  In order to merge the incoming values, the X.2 phi node
-in the cond_next block selects the right value to use based on where control
-flow is coming from: if control flow comes from the cond_false block, X.2 gets
-the value of X.1.  Alternatively, if control flow comes from cond_true, it gets
-the value of X.0.  The intent of this chapter is not to explain the details of
-SSA form.  For more information, see one of the many <a
-href="http://en.wikipedia.org/wiki/Static_single_assignment_form">online
-references</a>.</p>
-
-<p>The question for this article is "who places the phi nodes when lowering
-assignments to mutable variables?".  The issue here is that LLVM
-<em>requires</em> that its IR be in SSA form: there is no "non-ssa" mode for it.
-However, SSA construction requires non-trivial algorithms and data structures,
-so it is inconvenient and wasteful for every front-end to have to reproduce this
-logic.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="memory">Memory in LLVM</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>The 'trick' here is that while LLVM does require all register values to be
-in SSA form, it does not require (or permit) memory objects to be in SSA form.
-In the example above, note that the loads from G and H are direct accesses to
-G and H: they are not renamed or versioned.  This differs from some other
-compiler systems, which do try to version memory objects.  In LLVM, instead of
-encoding dataflow analysis of memory into the LLVM IR, it is handled with <a
-href="../WritingAnLLVMPass.html">Analysis Passes</a> which are computed on
-demand.</p>
-
-<p>
-With this in mind, the high-level idea is that we want to make a stack variable
-(which lives in memory, because it is on the stack) for each mutable object in
-a function.  To take advantage of this trick, we need to talk about how LLVM
-represents stack variables.
-</p>
-
-<p>In LLVM, all memory accesses are explicit with load/store instructions, and
-it is carefully designed not to have (or need) an "address-of" operator.  Notice
-how the type of the @G/@H global variables is actually "i32*" even though the
-variable is defined as "i32".  What this means is that @G defines <em>space</em>
-for an i32 in the global data area, but its <em>name</em> actually refers to the
-address for that space.  Stack variables work the same way, except that instead of
-being declared with global variable definitions, they are declared with the
-<a href="../LangRef.html#i_alloca">LLVM alloca instruction</a>:</p>
-
-<div class="doc_code">
-<pre>
-define i32 @example() {
-entry:
-  %X = alloca i32           ; type of %X is i32*.
-  ...
-  %tmp = load i32* %X       ; load the stack value %X from the stack.
-  %tmp2 = add i32 %tmp, 1   ; increment it
-  store i32 %tmp2, i32* %X  ; store it back
-  ...
-</pre>
-</div>
-
-<p>This code shows an example of how you can declare and manipulate a stack
-variable in the LLVM IR.  Stack memory allocated with the alloca instruction is
-fully general: you can pass the address of the stack slot to functions, you can
-store it in other variables, etc.  In our example above, we could rewrite the
-example to use the alloca technique to avoid using a PHI node:</p>
-
-<div class="doc_code">
-<pre>
- at G = weak global i32 0   ; type of @G is i32*
- at H = weak global i32 0   ; type of @H is i32*
-
-define i32 @test(i1 %Condition) {
-entry:
-  %X = alloca i32           ; type of %X is i32*.
-  br i1 %Condition, label %cond_true, label %cond_false
-
-cond_true:
-  %X.0 = load i32* @G
-        store i32 %X.0, i32* %X   ; Update X
-  br label %cond_next
-
-cond_false:
-  %X.1 = load i32* @H
-        store i32 %X.1, i32* %X   ; Update X
-  br label %cond_next
-
-cond_next:
-  %X.2 = load i32* %X       ; Read X
-  ret i32 %X.2
-}
-</pre>
-</div>
-
-<p>With this, we have discovered a way to handle arbitrary mutable variables
-without the need to create Phi nodes at all:</p>
-
-<ol>
-<li>Each mutable variable becomes a stack allocation.</li>
-<li>Each read of the variable becomes a load from the stack.</li>
-<li>Each update of the variable becomes a store to the stack.</li>
-<li>Taking the address of a variable just uses the stack address directly.</li>
-</ol>
-
-<p>While this solution has solved our immediate problem, it introduced another
-one: we have now apparently introduced a lot of stack traffic for very simple
-and common operations, a major performance problem.  Fortunately for us, the
-LLVM optimizer has a highly-tuned optimization pass named "mem2reg" that handles
-this case, promoting allocas like this into SSA registers, inserting Phi nodes
-as appropriate.  If you run this example through the pass, for example, you'll
-get:</p>
-
-<div class="doc_code">
-<pre>
-$ <b>llvm-as &lt; example.ll | opt -mem2reg | llvm-dis</b>
- at G = weak global i32 0
- at H = weak global i32 0
-
-define i32 @test(i1 %Condition) {
-entry:
-  br i1 %Condition, label %cond_true, label %cond_false
-
-cond_true:
-  %X.0 = load i32* @G
-  br label %cond_next
-
-cond_false:
-  %X.1 = load i32* @H
-  br label %cond_next
-
-cond_next:
-  %X.01 = phi i32 [ %X.1, %cond_false ], [ %X.0, %cond_true ]
-  ret i32 %X.01
-}
-</pre>
-</div>
-
-<p>The mem2reg pass implements the standard "iterated dominance frontier"
-algorithm for constructing SSA form and has a number of optimizations that speed
-up (very common) degenerate cases. The mem2reg optimization pass is the answer
-to dealing with mutable variables, and we highly recommend that you depend on
-it.  Note that mem2reg only works on variables in certain circumstances:</p>
-
-<ol>
-<li>mem2reg is alloca-driven: it looks for allocas and if it can handle them, it
-promotes them.  It does not apply to global variables or heap allocations.</li>
-
-<li>mem2reg only looks for alloca instructions in the entry block of the
-function.  Being in the entry block guarantees that the alloca is only executed
-once, which makes analysis simpler.</li>
-
-<li>mem2reg only promotes allocas whose uses are direct loads and stores.  If
-the address of the stack object is passed to a function, or if any funny pointer
-arithmetic is involved, the alloca will not be promoted.</li>
-
-<li>mem2reg only works on allocas of <a
-href="../LangRef.html#t_classifications">first class</a>
-values (such as pointers, scalars and vectors), and only if the array size
-of the allocation is 1 (or missing in the .ll file).  mem2reg is not capable of
-promoting structs or arrays to registers.  Note that the "scalarrepl" pass is
-more powerful and can promote structs, "unions", and arrays in many cases.</li>
-
-</ol>
-
-<p>
-All of these properties are easy to satisfy for most imperative languages, and
-we'll illustrate it below with Kaleidoscope.  The final question you may be
-asking is: should I bother with this nonsense for my front-end?  Wouldn't it be
-better if I just did SSA construction directly, avoiding use of the mem2reg
-optimization pass?  In short, we strongly recommend that you use this technique
-for building SSA form, unless there is an extremely good reason not to.  Using
-this technique is:</p>
-
-<ul>
-<li>Proven and well tested: llvm-gcc and clang both use this technique for local
-mutable variables.  As such, the most common clients of LLVM are using this to
-handle a bulk of their variables.  You can be sure that bugs are found fast and
-fixed early.</li>
-
-<li>Extremely Fast: mem2reg has a number of special cases that make it fast in
-common cases as well as fully general.  For example, it has fast-paths for
-variables that are only used in a single block, variables that only have one
-assignment point, good heuristics to avoid insertion of unneeded phi nodes, etc.
-</li>
-
-<li>Needed for debug info generation: <a href="../SourceLevelDebugging.html">
-Debug information in LLVM</a> relies on having the address of the variable
-exposed so that debug info can be attached to it.  This technique dovetails
-very naturally with this style of debug info.</li>
-</ul>
-
-<p>If nothing else, this makes it much easier to get your front-end up and
-running, and is very simple to implement.  Lets extend Kaleidoscope with mutable
-variables now!
-</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="kalvars">Mutable Variables in
-Kaleidoscope</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>Now that we know the sort of problem we want to tackle, lets see what this
-looks like in the context of our little Kaleidoscope language.  We're going to
-add two features:</p>
-
-<ol>
-<li>The ability to mutate variables with the '=' operator.</li>
-<li>The ability to define new variables.</li>
-</ol>
-
-<p>While the first item is really what this is about, we only have variables
-for incoming arguments as well as for induction variables, and redefining those only
-goes so far :).  Also, the ability to define new variables is a
-useful thing regardless of whether you will be mutating them.  Here's a
-motivating example that shows how we could use these:</p>
-
-<div class="doc_code">
-<pre>
-# Define ':' for sequencing: as a low-precedence operator that ignores operands
-# and just returns the RHS.
-def binary : 1 (x y) y;
-
-# Recursive fib, we could do this before.
-def fib(x)
-  if (x &lt; 3) then
-    1
-  else
-    fib(x-1)+fib(x-2);
-
-# Iterative fib.
-def fibi(x)
-  <b>var a = 1, b = 1, c in</b>
-  (for i = 3, i &lt; x in
-     <b>c = a + b</b> :
-     <b>a = b</b> :
-     <b>b = c</b>) :
-  b;
-
-# Call it.
-fibi(10);
-</pre>
-</div>
-
-<p>
-In order to mutate variables, we have to change our existing variables to use
-the "alloca trick".  Once we have that, we'll add our new operator, then extend
-Kaleidoscope to support new variable definitions.
-</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="adjustments">Adjusting Existing Variables for
-Mutation</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>
-The symbol table in Kaleidoscope is managed at code generation time by the
-'<tt>named_values</tt>' map.  This map currently keeps track of the LLVM
-"Value*" that holds the double value for the named variable.  In order to
-support mutation, we need to change this slightly, so that it
-<tt>named_values</tt> holds the <em>memory location</em> of the variable in
-question.  Note that this change is a refactoring: it changes the structure of
-the code, but does not (by itself) change the behavior of the compiler.  All of
-these changes are isolated in the Kaleidoscope code generator.</p>
-
-<p>
-At this point in Kaleidoscope's development, it only supports variables for two
-things: incoming arguments to functions and the induction variable of 'for'
-loops.  For consistency, we'll allow mutation of these variables in addition to
-other user-defined variables.  This means that these will both need memory
-locations.
-</p>
-
-<p>To start our transformation of Kaleidoscope, we'll change the
-<tt>named_values</tt> map so that it maps to AllocaInst* instead of Value*.
-Once we do this, the C++ compiler will tell us what parts of the code we need to
-update:</p>
-
-<p><b>Note:</b> the ocaml bindings currently model both <tt>Value*</tt>s and
-<tt>AllocInst*</tt>s as <tt>Llvm.llvalue</tt>s, but this may change in the
-future to be more type safe.</p>
-
-<div class="doc_code">
-<pre>
-let named_values:(string, llvalue) Hashtbl.t = Hashtbl.create 10
-</pre>
-</div>
-
-<p>Also, since we will need to create these alloca's, we'll use a helper
-function that ensures that the allocas are created in the entry block of the
-function:</p>
-
-<div class="doc_code">
-<pre>
-(* Create an alloca instruction in the entry block of the function. This
- * is used for mutable variables etc. *)
-let create_entry_block_alloca the_function var_name =
-  let builder = builder_at (instr_begin (entry_block the_function)) in
-  build_alloca double_type var_name builder
-</pre>
-</div>
-
-<p>This funny looking code creates an <tt>Llvm.llbuilder</tt> object that is
-pointing at the first instruction of the entry block.  It then creates an alloca
-with the expected name and returns it.  Because all values in Kaleidoscope are
-doubles, there is no need to pass in a type to use.</p>
-
-<p>With this in place, the first functionality change we want to make is to
-variable references.  In our new scheme, variables live on the stack, so code
-generating a reference to them actually needs to produce a load from the stack
-slot:</p>
-
-<div class="doc_code">
-<pre>
-let rec codegen_expr = function
-  ...
-  | Ast.Variable name -&gt;
-      let v = try Hashtbl.find named_values name with
-        | Not_found -&gt; raise (Error "unknown variable name")
-      in
-      <b>(* Load the value. *)
-      build_load v name builder</b>
-</pre>
-</div>
-
-<p>As you can see, this is pretty straightforward.  Now we need to update the
-things that define the variables to set up the alloca.  We'll start with
-<tt>codegen_expr Ast.For ...</tt> (see the <a href="#code">full code listing</a>
-for the unabridged code):</p>
-
-<div class="doc_code">
-<pre>
-  | Ast.For (var_name, start, end_, step, body) -&gt;
-      let the_function = block_parent (insertion_block builder) in
-
-      (* Create an alloca for the variable in the entry block. *)
-      <b>let alloca = create_entry_block_alloca the_function var_name in</b>
-
-      (* Emit the start code first, without 'variable' in scope. *)
-      let start_val = codegen_expr start in
-
-      <b>(* Store the value into the alloca. *)
-      ignore(build_store start_val alloca builder);</b>
-
-      ...
-
-      (* Within the loop, the variable is defined equal to the PHI node. If it
-       * shadows an existing variable, we have to restore it, so save it
-       * now. *)
-      let old_val =
-        try Some (Hashtbl.find named_values var_name) with Not_found -&gt; None
-      in
-      <b>Hashtbl.add named_values var_name alloca;</b>
-
-      ...
-
-      (* Compute the end condition. *)
-      let end_cond = codegen_expr end_ in
-
-      <b>(* Reload, increment, and restore the alloca. This handles the case where
-       * the body of the loop mutates the variable. *)
-      let cur_var = build_load alloca var_name builder in
-      let next_var = build_add cur_var step_val "nextvar" builder in
-      ignore(build_store next_var alloca builder);</b>
-      ...
-</pre>
-</div>
-
-<p>This code is virtually identical to the code <a
-href="OCamlLangImpl5.html#forcodegen">before we allowed mutable variables</a>.
-The big difference is that we no longer have to construct a PHI node, and we use
-load/store to access the variable as needed.</p>
-
-<p>To support mutable argument variables, we need to also make allocas for them.
-The code for this is also pretty simple:</p>
-
-<div class="doc_code">
-<pre>
-(* Create an alloca for each argument and register the argument in the symbol
- * table so that references to it will succeed. *)
-let create_argument_allocas the_function proto =
-  let args = match proto with
-    | Ast.Prototype (_, args) | Ast.BinOpPrototype (_, args, _) -&gt; args
-  in
-  Array.iteri (fun i ai -&gt;
-    let var_name = args.(i) in
-    (* Create an alloca for this variable. *)
-    let alloca = create_entry_block_alloca the_function var_name in
-
-    (* Store the initial value into the alloca. *)
-    ignore(build_store ai alloca builder);
-
-    (* Add arguments to variable symbol table. *)
-    Hashtbl.add named_values var_name alloca;
-  ) (params the_function)
-</pre>
-</div>
-
-<p>For each argument, we make an alloca, store the input value to the function
-into the alloca, and register the alloca as the memory location for the
-argument.  This method gets invoked by <tt>Codegen.codegen_func</tt> right after
-it sets up the entry block for the function.</p>
-
-<p>The final missing piece is adding the mem2reg pass, which allows us to get
-good codegen once again:</p>
-
-<div class="doc_code">
-<pre>
-let main () =
-  ...
-  let the_fpm = PassManager.create_function the_module_provider in
-
-  (* Set up the optimizer pipeline.  Start with registering info about how the
-   * target lays out data structures. *)
-  TargetData.add (ExecutionEngine.target_data the_execution_engine) the_fpm;
-
-  <b>(* Promote allocas to registers. *)
-  add_memory_to_register_promotion the_fpm;</b>
-
-  (* Do simple "peephole" optimizations and bit-twiddling optzn. *)
-  add_instruction_combining the_fpm;
-
-  (* reassociate expressions. *)
-  add_reassociation the_fpm;
-</pre>
-</div>
-
-<p>It is interesting to see what the code looks like before and after the
-mem2reg optimization runs.  For example, this is the before/after code for our
-recursive fib function.  Before the optimization:</p>
-
-<div class="doc_code">
-<pre>
-define double @fib(double %x) {
-entry:
-  <b>%x1 = alloca double
-  store double %x, double* %x1
-  %x2 = load double* %x1</b>
-  %cmptmp = fcmp ult double %x2, 3.000000e+00
-  %booltmp = uitofp i1 %cmptmp to double
-  %ifcond = fcmp one double %booltmp, 0.000000e+00
-  br i1 %ifcond, label %then, label %else
-
-then:    ; preds = %entry
-  br label %ifcont
-
-else:    ; preds = %entry
-  <b>%x3 = load double* %x1</b>
-  %subtmp = sub double %x3, 1.000000e+00
-  %calltmp = call double @fib( double %subtmp )
-  <b>%x4 = load double* %x1</b>
-  %subtmp5 = sub double %x4, 2.000000e+00
-  %calltmp6 = call double @fib( double %subtmp5 )
-  %addtmp = add double %calltmp, %calltmp6
-  br label %ifcont
-
-ifcont:    ; preds = %else, %then
-  %iftmp = phi double [ 1.000000e+00, %then ], [ %addtmp, %else ]
-  ret double %iftmp
-}
-</pre>
-</div>
-
-<p>Here there is only one variable (x, the input argument) but you can still
-see the extremely simple-minded code generation strategy we are using.  In the
-entry block, an alloca is created, and the initial input value is stored into
-it.  Each reference to the variable does a reload from the stack.  Also, note
-that we didn't modify the if/then/else expression, so it still inserts a PHI
-node.  While we could make an alloca for it, it is actually easier to create a
-PHI node for it, so we still just make the PHI.</p>
-
-<p>Here is the code after the mem2reg pass runs:</p>
-
-<div class="doc_code">
-<pre>
-define double @fib(double %x) {
-entry:
-  %cmptmp = fcmp ult double <b>%x</b>, 3.000000e+00
-  %booltmp = uitofp i1 %cmptmp to double
-  %ifcond = fcmp one double %booltmp, 0.000000e+00
-  br i1 %ifcond, label %then, label %else
-
-then:
-  br label %ifcont
-
-else:
-  %subtmp = sub double <b>%x</b>, 1.000000e+00
-  %calltmp = call double @fib( double %subtmp )
-  %subtmp5 = sub double <b>%x</b>, 2.000000e+00
-  %calltmp6 = call double @fib( double %subtmp5 )
-  %addtmp = add double %calltmp, %calltmp6
-  br label %ifcont
-
-ifcont:    ; preds = %else, %then
-  %iftmp = phi double [ 1.000000e+00, %then ], [ %addtmp, %else ]
-  ret double %iftmp
-}
-</pre>
-</div>
-
-<p>This is a trivial case for mem2reg, since there are no redefinitions of the
-variable.  The point of showing this is to calm your tension about inserting
-such blatent inefficiencies :).</p>
-
-<p>After the rest of the optimizers run, we get:</p>
-
-<div class="doc_code">
-<pre>
-define double @fib(double %x) {
-entry:
-  %cmptmp = fcmp ult double %x, 3.000000e+00
-  %booltmp = uitofp i1 %cmptmp to double
-  %ifcond = fcmp ueq double %booltmp, 0.000000e+00
-  br i1 %ifcond, label %else, label %ifcont
-
-else:
-  %subtmp = sub double %x, 1.000000e+00
-  %calltmp = call double @fib( double %subtmp )
-  %subtmp5 = sub double %x, 2.000000e+00
-  %calltmp6 = call double @fib( double %subtmp5 )
-  %addtmp = add double %calltmp, %calltmp6
-  ret double %addtmp
-
-ifcont:
-  ret double 1.000000e+00
-}
-</pre>
-</div>
-
-<p>Here we see that the simplifycfg pass decided to clone the return instruction
-into the end of the 'else' block.  This allowed it to eliminate some branches
-and the PHI node.</p>
-
-<p>Now that all symbol table references are updated to use stack variables,
-we'll add the assignment operator.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="assignment">New Assignment Operator</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>With our current framework, adding a new assignment operator is really
-simple.  We will parse it just like any other binary operator, but handle it
-internally (instead of allowing the user to define it).  The first step is to
-set a precedence:</p>
-
-<div class="doc_code">
-<pre>
-let main () =
-  (* Install standard binary operators.
-   * 1 is the lowest precedence. *)
-  <b>Hashtbl.add Parser.binop_precedence '=' 2;</b>
-  Hashtbl.add Parser.binop_precedence '&lt;' 10;
-  Hashtbl.add Parser.binop_precedence '+' 20;
-  Hashtbl.add Parser.binop_precedence '-' 20;
-  ...
-</pre>
-</div>
-
-<p>Now that the parser knows the precedence of the binary operator, it takes
-care of all the parsing and AST generation.  We just need to implement codegen
-for the assignment operator.  This looks like:</p>
-
-<div class="doc_code">
-<pre>
-let rec codegen_expr = function
-      begin match op with
-      | '=' -&gt;
-          (* Special case '=' because we don't want to emit the LHS as an
-           * expression. *)
-          let name =
-            match lhs with
-            | Ast.Variable name -&gt; name
-            | _ -&gt; raise (Error "destination of '=' must be a variable")
-          in
-</pre>
-</div>
-
-<p>Unlike the rest of the binary operators, our assignment operator doesn't
-follow the "emit LHS, emit RHS, do computation" model.  As such, it is handled
-as a special case before the other binary operators are handled.  The other
-strange thing is that it requires the LHS to be a variable.  It is invalid to
-have "(x+1) = expr" - only things like "x = expr" are allowed.
-</p>
-
-
-<div class="doc_code">
-<pre>
-          (* Codegen the rhs. *)
-          let val_ = codegen_expr rhs in
-
-          (* Lookup the name. *)
-          let variable = try Hashtbl.find named_values name with
-          | Not_found -&gt; raise (Error "unknown variable name")
-          in
-          ignore(build_store val_ variable builder);
-          val_
-      | _ -&gt;
-			...
-</pre>
-</div>
-
-<p>Once we have the variable, codegen'ing the assignment is straightforward:
-we emit the RHS of the assignment, create a store, and return the computed
-value.  Returning a value allows for chained assignments like "X = (Y = Z)".</p>
-
-<p>Now that we have an assignment operator, we can mutate loop variables and
-arguments.  For example, we can now run code like this:</p>
-
-<div class="doc_code">
-<pre>
-# Function to print a double.
-extern printd(x);
-
-# Define ':' for sequencing: as a low-precedence operator that ignores operands
-# and just returns the RHS.
-def binary : 1 (x y) y;
-
-def test(x)
-  printd(x) :
-  x = 4 :
-  printd(x);
-
-test(123);
-</pre>
-</div>
-
-<p>When run, this example prints "123" and then "4", showing that we did
-actually mutate the value!  Okay, we have now officially implemented our goal:
-getting this to work requires SSA construction in the general case.  However,
-to be really useful, we want the ability to define our own local variables, lets
-add this next!
-</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="localvars">User-defined Local
-Variables</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>Adding var/in is just like any other other extensions we made to
-Kaleidoscope: we extend the lexer, the parser, the AST and the code generator.
-The first step for adding our new 'var/in' construct is to extend the lexer.
-As before, this is pretty trivial, the code looks like this:</p>
-
-<div class="doc_code">
-<pre>
-type token =
-  ...
-  <b>(* var definition *)
-  | Var</b>
-
-...
-
-and lex_ident buffer = parser
-      ...
-      | "in" -&gt; [&lt; 'Token.In; stream &gt;]
-      | "binary" -&gt; [&lt; 'Token.Binary; stream &gt;]
-      | "unary" -&gt; [&lt; 'Token.Unary; stream &gt;]
-      <b>| "var" -&gt; [&lt; 'Token.Var; stream &gt;]</b>
-      ...
-</pre>
-</div>
-
-<p>The next step is to define the AST node that we will construct.  For var/in,
-it looks like this:</p>
-
-<div class="doc_code">
-<pre>
-type expr =
-  ...
-  (* variant for var/in. *)
-  | Var of (string * expr option) array * expr
-  ...
-</pre>
-</div>
-
-<p>var/in allows a list of names to be defined all at once, and each name can
-optionally have an initializer value.  As such, we capture this information in
-the VarNames vector.  Also, var/in has a body, this body is allowed to access
-the variables defined by the var/in.</p>
-
-<p>With this in place, we can define the parser pieces.  The first thing we do
-is add it as a primary expression:</p>
-
-<div class="doc_code">
-<pre>
-(* primary
- *   ::= identifier
- *   ::= numberexpr
- *   ::= parenexpr
- *   ::= ifexpr
- *   ::= forexpr
- <b>*   ::= varexpr</b> *)
-let rec parse_primary = parser
-  ...
-  <b>(* varexpr
-   *   ::= 'var' identifier ('=' expression?
-   *             (',' identifier ('=' expression)?)* 'in' expression *)
-  | [&lt; 'Token.Var;
-       (* At least one variable name is required. *)
-       'Token.Ident id ?? "expected identifier after var";
-       init=parse_var_init;
-       var_names=parse_var_names [(id, init)];
-       (* At this point, we have to have 'in'. *)
-       'Token.In ?? "expected 'in' keyword after 'var'";
-       body=parse_expr &gt;] -&gt;
-      Ast.Var (Array.of_list (List.rev var_names), body)</b>
-
-...
-
-and parse_var_init = parser
-  (* read in the optional initializer. *)
-  | [&lt; 'Token.Kwd '='; e=parse_expr &gt;] -&gt; Some e
-  | [&lt; &gt;] -&gt; None
-
-and parse_var_names accumulator = parser
-  | [&lt; 'Token.Kwd ',';
-       'Token.Ident id ?? "expected identifier list after var";
-       init=parse_var_init;
-       e=parse_var_names ((id, init) :: accumulator) &gt;] -&gt; e
-  | [&lt; &gt;] -&gt; accumulator
-</pre>
-</div>
-
-<p>Now that we can parse and represent the code, we need to support emission of
-LLVM IR for it.  This code starts out with:</p>
-
-<div class="doc_code">
-<pre>
-let rec codegen_expr = function
-  ...
-  | Ast.Var (var_names, body)
-      let old_bindings = ref [] in
-
-      let the_function = block_parent (insertion_block builder) in
-
-      (* Register all variables and emit their initializer. *)
-      Array.iter (fun (var_name, init) -&gt;
-</pre>
-</div>
-
-<p>Basically it loops over all the variables, installing them one at a time.
-For each variable we put into the symbol table, we remember the previous value
-that we replace in OldBindings.</p>
-
-<div class="doc_code">
-<pre>
-        (* Emit the initializer before adding the variable to scope, this
-         * prevents the initializer from referencing the variable itself, and
-         * permits stuff like this:
-         *   var a = 1 in
-         *     var a = a in ...   # refers to outer 'a'. *)
-        let init_val =
-          match init with
-          | Some init -&gt; codegen_expr init
-          (* If not specified, use 0.0. *)
-          | None -&gt; const_float double_type 0.0
-        in
-
-        let alloca = create_entry_block_alloca the_function var_name in
-        ignore(build_store init_val alloca builder);
-
-        (* Remember the old variable binding so that we can restore the binding
-         * when we unrecurse. *)
-
-        begin
-          try
-            let old_value = Hashtbl.find named_values var_name in
-            old_bindings := (var_name, old_value) :: !old_bindings;
-          with Not_found &gt; ()
-        end;
-
-        (* Remember this binding. *)
-        Hashtbl.add named_values var_name alloca;
-      ) var_names;
-</pre>
-</div>
-
-<p>There are more comments here than code.  The basic idea is that we emit the
-initializer, create the alloca, then update the symbol table to point to it.
-Once all the variables are installed in the symbol table, we evaluate the body
-of the var/in expression:</p>
-
-<div class="doc_code">
-<pre>
-      (* Codegen the body, now that all vars are in scope. *)
-      let body_val = codegen_expr body in
-</pre>
-</div>
-
-<p>Finally, before returning, we restore the previous variable bindings:</p>
-
-<div class="doc_code">
-<pre>
-      (* Pop all our variables from scope. *)
-      List.iter (fun (var_name, old_value) -&gt;
-        Hashtbl.add named_values var_name old_value
-      ) !old_bindings;
-
-      (* Return the body computation. *)
-      body_val
-</pre>
-</div>
-
-<p>The end result of all of this is that we get properly scoped variable
-definitions, and we even (trivially) allow mutation of them :).</p>
-
-<p>With this, we completed what we set out to do.  Our nice iterative fib
-example from the intro compiles and runs just fine.  The mem2reg pass optimizes
-all of our stack variables into SSA registers, inserting PHI nodes where needed,
-and our front-end remains simple: no "iterated dominance frontier" computation
-anywhere in sight.</p>
-
-</div>
-
-<!-- *********************************************************************** -->
-<div class="doc_section"><a name="code">Full Code Listing</a></div>
-<!-- *********************************************************************** -->
-
-<div class="doc_text">
-
-<p>
-Here is the complete code listing for our running example, enhanced with mutable
-variables and var/in support.  To build this example, use:
-</p>
-
-<div class="doc_code">
-<pre>
-# Compile
-ocamlbuild toy.byte
-# Run
-./toy.byte
-</pre>
-</div>
-
-<p>Here is the code:</p>
-
-<dl>
-<dt>_tags:</dt>
-<dd class="doc_code">
-<pre>
-&lt;{lexer,parser}.ml&gt;: use_camlp4, pp(camlp4of)
-&lt;*.{byte,native}&gt;: g++, use_llvm, use_llvm_analysis
-&lt;*.{byte,native}&gt;: use_llvm_executionengine, use_llvm_target
-&lt;*.{byte,native}&gt;: use_llvm_scalar_opts, use_bindings
-</pre>
-</dd>
-
-<dt>myocamlbuild.ml:</dt>
-<dd class="doc_code">
-<pre>
-open Ocamlbuild_plugin;;
-
-ocaml_lib ~extern:true "llvm";;
-ocaml_lib ~extern:true "llvm_analysis";;
-ocaml_lib ~extern:true "llvm_executionengine";;
-ocaml_lib ~extern:true "llvm_target";;
-ocaml_lib ~extern:true "llvm_scalar_opts";;
-
-flag ["link"; "ocaml"; "g++"] (S[A"-cc"; A"g++"]);;
-dep ["link"; "ocaml"; "use_bindings"] ["bindings.o"];;
-</pre>
-</dd>
-
-<dt>token.ml:</dt>
-<dd class="doc_code">
-<pre>
-(*===----------------------------------------------------------------------===
- * Lexer Tokens
- *===----------------------------------------------------------------------===*)
-
-(* The lexer returns these 'Kwd' if it is an unknown character, otherwise one of
- * these others for known things. *)
-type token =
-  (* commands *)
-  | Def | Extern
-
-  (* primary *)
-  | Ident of string | Number of float
-
-  (* unknown *)
-  | Kwd of char
-
-  (* control *)
-  | If | Then | Else
-  | For | In
-
-  (* operators *)
-  | Binary | Unary
-
-  (* var definition *)
-  | Var
-</pre>
-</dd>
-
-<dt>lexer.ml:</dt>
-<dd class="doc_code">
-<pre>
-(*===----------------------------------------------------------------------===
- * Lexer
- *===----------------------------------------------------------------------===*)
-
-let rec lex = parser
-  (* Skip any whitespace. *)
-  | [&lt; ' (' ' | '\n' | '\r' | '\t'); stream &gt;] -&gt; lex stream
-
-  (* identifier: [a-zA-Z][a-zA-Z0-9] *)
-  | [&lt; ' ('A' .. 'Z' | 'a' .. 'z' as c); stream &gt;] -&gt;
-      let buffer = Buffer.create 1 in
-      Buffer.add_char buffer c;
-      lex_ident buffer stream
-
-  (* number: [0-9.]+ *)
-  | [&lt; ' ('0' .. '9' as c); stream &gt;] -&gt;
-      let buffer = Buffer.create 1 in
-      Buffer.add_char buffer c;
-      lex_number buffer stream
-
-  (* Comment until end of line. *)
-  | [&lt; ' ('#'); stream &gt;] -&gt;
-      lex_comment stream
-
-  (* Otherwise, just return the character as its ascii value. *)
-  | [&lt; 'c; stream &gt;] -&gt;
-      [&lt; 'Token.Kwd c; lex stream &gt;]
-
-  (* end of stream. *)
-  | [&lt; &gt;] -&gt; [&lt; &gt;]
-
-and lex_number buffer = parser
-  | [&lt; ' ('0' .. '9' | '.' as c); stream &gt;] -&gt;
-      Buffer.add_char buffer c;
-      lex_number buffer stream
-  | [&lt; stream=lex &gt;] -&gt;
-      [&lt; 'Token.Number (float_of_string (Buffer.contents buffer)); stream &gt;]
-
-and lex_ident buffer = parser
-  | [&lt; ' ('A' .. 'Z' | 'a' .. 'z' | '0' .. '9' as c); stream &gt;] -&gt;
-      Buffer.add_char buffer c;
-      lex_ident buffer stream
-  | [&lt; stream=lex &gt;] -&gt;
-      match Buffer.contents buffer with
-      | "def" -&gt; [&lt; 'Token.Def; stream &gt;]
-      | "extern" -&gt; [&lt; 'Token.Extern; stream &gt;]
-      | "if" -&gt; [&lt; 'Token.If; stream &gt;]
-      | "then" -&gt; [&lt; 'Token.Then; stream &gt;]
-      | "else" -&gt; [&lt; 'Token.Else; stream &gt;]
-      | "for" -&gt; [&lt; 'Token.For; stream &gt;]
-      | "in" -&gt; [&lt; 'Token.In; stream &gt;]
-      | "binary" -&gt; [&lt; 'Token.Binary; stream &gt;]
-      | "unary" -&gt; [&lt; 'Token.Unary; stream &gt;]
-      | "var" -&gt; [&lt; 'Token.Var; stream &gt;]
-      | id -&gt; [&lt; 'Token.Ident id; stream &gt;]
-
-and lex_comment = parser
-  | [&lt; ' ('\n'); stream=lex &gt;] -&gt; stream
-  | [&lt; 'c; e=lex_comment &gt;] -&gt; e
-  | [&lt; &gt;] -&gt; [&lt; &gt;]
-</pre>
-</dd>
-
-<dt>ast.ml:</dt>
-<dd class="doc_code">
-<pre>
-(*===----------------------------------------------------------------------===
- * Abstract Syntax Tree (aka Parse Tree)
- *===----------------------------------------------------------------------===*)
-
-(* expr - Base type for all expression nodes. *)
-type expr =
-  (* variant for numeric literals like "1.0". *)
-  | Number of float
-
-  (* variant for referencing a variable, like "a". *)
-  | Variable of string
-
-  (* variant for a unary operator. *)
-  | Unary of char * expr
-
-  (* variant for a binary operator. *)
-  | Binary of char * expr * expr
-
-  (* variant for function calls. *)
-  | Call of string * expr array
-
-  (* variant for if/then/else. *)
-  | If of expr * expr * expr
-
-  (* variant for for/in. *)
-  | For of string * expr * expr * expr option * expr
-
-  (* variant for var/in. *)
-  | Var of (string * expr option) array * expr
-
-(* proto - This type represents the "prototype" for a function, which captures
- * its name, and its argument names (thus implicitly the number of arguments the
- * function takes). *)
-type proto =
-  | Prototype of string * string array
-  | BinOpPrototype of string * string array * int
-
-(* func - This type represents a function definition itself. *)
-type func = Function of proto * expr
-</pre>
-</dd>
-
-<dt>parser.ml:</dt>
-<dd class="doc_code">
-<pre>
-(*===---------------------------------------------------------------------===
- * Parser
- *===---------------------------------------------------------------------===*)
-
-(* binop_precedence - This holds the precedence for each binary operator that is
- * defined *)
-let binop_precedence:(char, int) Hashtbl.t = Hashtbl.create 10
-
-(* precedence - Get the precedence of the pending binary operator token. *)
-let precedence c = try Hashtbl.find binop_precedence c with Not_found -&gt; -1
-
-(* primary
- *   ::= identifier
- *   ::= numberexpr
- *   ::= parenexpr
- *   ::= ifexpr
- *   ::= forexpr
- *   ::= varexpr *)
-let rec parse_primary = parser
-  (* numberexpr ::= number *)
-  | [&lt; 'Token.Number n &gt;] -&gt; Ast.Number n
-
-  (* parenexpr ::= '(' expression ')' *)
-  | [&lt; 'Token.Kwd '('; e=parse_expr; 'Token.Kwd ')' ?? "expected ')'" &gt;] -&gt; e
-
-  (* identifierexpr
-   *   ::= identifier
-   *   ::= identifier '(' argumentexpr ')' *)
-  | [&lt; 'Token.Ident id; stream &gt;] -&gt;
-      let rec parse_args accumulator = parser
-        | [&lt; e=parse_expr; stream &gt;] -&gt;
-            begin parser
-              | [&lt; 'Token.Kwd ','; e=parse_args (e :: accumulator) &gt;] -&gt; e
-              | [&lt; &gt;] -&gt; e :: accumulator
-            end stream
-        | [&lt; &gt;] -&gt; accumulator
-      in
-      let rec parse_ident id = parser
-        (* Call. *)
-        | [&lt; 'Token.Kwd '(';
-             args=parse_args [];
-             'Token.Kwd ')' ?? "expected ')'"&gt;] -&gt;
-            Ast.Call (id, Array.of_list (List.rev args))
-
-        (* Simple variable ref. *)
-        | [&lt; &gt;] -&gt; Ast.Variable id
-      in
-      parse_ident id stream
-
-  (* ifexpr ::= 'if' expr 'then' expr 'else' expr *)
-  | [&lt; 'Token.If; c=parse_expr;
-       'Token.Then ?? "expected 'then'"; t=parse_expr;
-       'Token.Else ?? "expected 'else'"; e=parse_expr &gt;] -&gt;
-      Ast.If (c, t, e)
-
-  (* forexpr
-        ::= 'for' identifier '=' expr ',' expr (',' expr)? 'in' expression *)
-  | [&lt; 'Token.For;
-       'Token.Ident id ?? "expected identifier after for";
-       'Token.Kwd '=' ?? "expected '=' after for";
-       stream &gt;] -&gt;
-      begin parser
-        | [&lt;
-             start=parse_expr;
-             'Token.Kwd ',' ?? "expected ',' after for";
-             end_=parse_expr;
-             stream &gt;] -&gt;
-            let step =
-              begin parser
-              | [&lt; 'Token.Kwd ','; step=parse_expr &gt;] -&gt; Some step
-              | [&lt; &gt;] -&gt; None
-              end stream
-            in
-            begin parser
-            | [&lt; 'Token.In; body=parse_expr &gt;] -&gt;
-                Ast.For (id, start, end_, step, body)
-            | [&lt; &gt;] -&gt;
-                raise (Stream.Error "expected 'in' after for")
-            end stream
-        | [&lt; &gt;] -&gt;
-            raise (Stream.Error "expected '=' after for")
-      end stream
-
-  (* varexpr
-   *   ::= 'var' identifier ('=' expression?
-   *             (',' identifier ('=' expression)?)* 'in' expression *)
-  | [&lt; 'Token.Var;
-       (* At least one variable name is required. *)
-       'Token.Ident id ?? "expected identifier after var";
-       init=parse_var_init;
-       var_names=parse_var_names [(id, init)];
-       (* At this point, we have to have 'in'. *)
-       'Token.In ?? "expected 'in' keyword after 'var'";
-       body=parse_expr &gt;] -&gt;
-      Ast.Var (Array.of_list (List.rev var_names), body)
-
-  | [&lt; &gt;] -&gt; raise (Stream.Error "unknown token when expecting an expression.")
-
-(* unary
- *   ::= primary
- *   ::= '!' unary *)
-and parse_unary = parser
-  (* If this is a unary operator, read it. *)
-  | [&lt; 'Token.Kwd op when op != '(' &amp;&amp; op != ')'; operand=parse_expr &gt;] -&gt;
-      Ast.Unary (op, operand)
-
-  (* If the current token is not an operator, it must be a primary expr. *)
-  | [&lt; stream &gt;] -&gt; parse_primary stream
-
-(* binoprhs
- *   ::= ('+' primary)* *)
-and parse_bin_rhs expr_prec lhs stream =
-  match Stream.peek stream with
-  (* If this is a binop, find its precedence. *)
-  | Some (Token.Kwd c) when Hashtbl.mem binop_precedence c -&gt;
-      let token_prec = precedence c in
-
-      (* If this is a binop that binds at least as tightly as the current binop,
-       * consume it, otherwise we are done. *)
-      if token_prec &lt; expr_prec then lhs else begin
-        (* Eat the binop. *)
-        Stream.junk stream;
-
-        (* Parse the primary expression after the binary operator. *)
-        let rhs = parse_unary stream in
-
-        (* Okay, we know this is a binop. *)
-        let rhs =
-          match Stream.peek stream with
-          | Some (Token.Kwd c2) -&gt;
-              (* If BinOp binds less tightly with rhs than the operator after
-               * rhs, let the pending operator take rhs as its lhs. *)
-              let next_prec = precedence c2 in
-              if token_prec &lt; next_prec
-              then parse_bin_rhs (token_prec + 1) rhs stream
-              else rhs
-          | _ -&gt; rhs
-        in
-
-        (* Merge lhs/rhs. *)
-        let lhs = Ast.Binary (c, lhs, rhs) in
-        parse_bin_rhs expr_prec lhs stream
-      end
-  | _ -&gt; lhs
-
-and parse_var_init = parser
-  (* read in the optional initializer. *)
-  | [&lt; 'Token.Kwd '='; e=parse_expr &gt;] -&gt; Some e
-  | [&lt; &gt;] -&gt; None
-
-and parse_var_names accumulator = parser
-  | [&lt; 'Token.Kwd ',';
-       'Token.Ident id ?? "expected identifier list after var";
-       init=parse_var_init;
-       e=parse_var_names ((id, init) :: accumulator) &gt;] -&gt; e
-  | [&lt; &gt;] -&gt; accumulator
-
-(* expression
- *   ::= primary binoprhs *)
-and parse_expr = parser
-  | [&lt; lhs=parse_unary; stream &gt;] -&gt; parse_bin_rhs 0 lhs stream
-
-(* prototype
- *   ::= id '(' id* ')'
- *   ::= binary LETTER number? (id, id)
- *   ::= unary LETTER number? (id) *)
-let parse_prototype =
-  let rec parse_args accumulator = parser
-    | [&lt; 'Token.Ident id; e=parse_args (id::accumulator) &gt;] -&gt; e
-    | [&lt; &gt;] -&gt; accumulator
-  in
-  let parse_operator = parser
-    | [&lt; 'Token.Unary &gt;] -&gt; "unary", 1
-    | [&lt; 'Token.Binary &gt;] -&gt; "binary", 2
-  in
-  let parse_binary_precedence = parser
-    | [&lt; 'Token.Number n &gt;] -&gt; int_of_float n
-    | [&lt; &gt;] -&gt; 30
-  in
-  parser
-  | [&lt; 'Token.Ident id;
-       'Token.Kwd '(' ?? "expected '(' in prototype";
-       args=parse_args [];
-       'Token.Kwd ')' ?? "expected ')' in prototype" &gt;] -&gt;
-      (* success. *)
-      Ast.Prototype (id, Array.of_list (List.rev args))
-  | [&lt; (prefix, kind)=parse_operator;
-       'Token.Kwd op ?? "expected an operator";
-       (* Read the precedence if present. *)
-       binary_precedence=parse_binary_precedence;
-       'Token.Kwd '(' ?? "expected '(' in prototype";
-        args=parse_args [];
-       'Token.Kwd ')' ?? "expected ')' in prototype" &gt;] -&gt;
-      let name = prefix ^ (String.make 1 op) in
-      let args = Array.of_list (List.rev args) in
-
-      (* Verify right number of arguments for operator. *)
-      if Array.length args != kind
-      then raise (Stream.Error "invalid number of operands for operator")
-      else
-        if kind == 1 then
-          Ast.Prototype (name, args)
-        else
-          Ast.BinOpPrototype (name, args, binary_precedence)
-  | [&lt; &gt;] -&gt;
-      raise (Stream.Error "expected function name in prototype")
-
-(* definition ::= 'def' prototype expression *)
-let parse_definition = parser
-  | [&lt; 'Token.Def; p=parse_prototype; e=parse_expr &gt;] -&gt;
-      Ast.Function (p, e)
-
-(* toplevelexpr ::= expression *)
-let parse_toplevel = parser
-  | [&lt; e=parse_expr &gt;] -&gt;
-      (* Make an anonymous proto. *)
-      Ast.Function (Ast.Prototype ("", [||]), e)
-
-(*  external ::= 'extern' prototype *)
-let parse_extern = parser
-  | [&lt; 'Token.Extern; e=parse_prototype &gt;] -&gt; e
-</pre>
-</dd>
-
-<dt>codegen.ml:</dt>
-<dd class="doc_code">
-<pre>
-(*===----------------------------------------------------------------------===
- * Code Generation
- *===----------------------------------------------------------------------===*)
-
-open Llvm
-
-exception Error of string
-
-let context = global_context ()
-let the_module = create_module context "my cool jit"
-let builder = builder context
-let named_values:(string, llvalue) Hashtbl.t = Hashtbl.create 10
-
-(* Create an alloca instruction in the entry block of the function. This
- * is used for mutable variables etc. *)
-let create_entry_block_alloca the_function var_name =
-  let builder = builder_at context (instr_begin (entry_block the_function)) in
-  build_alloca double_type var_name builder
-
-let rec codegen_expr = function
-  | Ast.Number n -&gt; const_float double_type n
-  | Ast.Variable name -&gt;
-      let v = try Hashtbl.find named_values name with
-        | Not_found -&gt; raise (Error "unknown variable name")
-      in
-      (* Load the value. *)
-      build_load v name builder
-  | Ast.Unary (op, operand) -&gt;
-      let operand = codegen_expr operand in
-      let callee = "unary" ^ (String.make 1 op) in
-      let callee =
-        match lookup_function callee the_module with
-        | Some callee -&gt; callee
-        | None -&gt; raise (Error "unknown unary operator")
-      in
-      build_call callee [|operand|] "unop" builder
-  | Ast.Binary (op, lhs, rhs) -&gt;
-      begin match op with
-      | '=' -&gt;
-          (* Special case '=' because we don't want to emit the LHS as an
-           * expression. *)
-          let name =
-            match lhs with
-            | Ast.Variable name -&gt; name
-            | _ -&gt; raise (Error "destination of '=' must be a variable")
-          in
-
-          (* Codegen the rhs. *)
-          let val_ = codegen_expr rhs in
-
-          (* Lookup the name. *)
-          let variable = try Hashtbl.find named_values name with
-          | Not_found -&gt; raise (Error "unknown variable name")
-          in
-          ignore(build_store val_ variable builder);
-          val_
-      | _ -&gt;
-          let lhs_val = codegen_expr lhs in
-          let rhs_val = codegen_expr rhs in
-          begin
-            match op with
-            | '+' -&gt; build_add lhs_val rhs_val "addtmp" builder
-            | '-' -&gt; build_sub lhs_val rhs_val "subtmp" builder
-            | '*' -&gt; build_mul lhs_val rhs_val "multmp" builder
-            | '&lt;' -&gt;
-                (* Convert bool 0/1 to double 0.0 or 1.0 *)
-                let i = build_fcmp Fcmp.Ult lhs_val rhs_val "cmptmp" builder in
-                build_uitofp i double_type "booltmp" builder
-            | _ -&gt;
-                (* If it wasn't a builtin binary operator, it must be a user defined
-                 * one. Emit a call to it. *)
-                let callee = "binary" ^ (String.make 1 op) in
-                let callee =
-                  match lookup_function callee the_module with
-                  | Some callee -&gt; callee
-                  | None -&gt; raise (Error "binary operator not found!")
-                in
-                build_call callee [|lhs_val; rhs_val|] "binop" builder
-          end
-      end
-  | Ast.Call (callee, args) -&gt;
-      (* Look up the name in the module table. *)
-      let callee =
-        match lookup_function callee the_module with
-        | Some callee -&gt; callee
-        | None -&gt; raise (Error "unknown function referenced")
-      in
-      let params = params callee in
-
-      (* If argument mismatch error. *)
-      if Array.length params == Array.length args then () else
-        raise (Error "incorrect # arguments passed");
-      let args = Array.map codegen_expr args in
-      build_call callee args "calltmp" builder
-  | Ast.If (cond, then_, else_) -&gt;
-      let cond = codegen_expr cond in
-
-      (* Convert condition to a bool by comparing equal to 0.0 *)
-      let zero = const_float double_type 0.0 in
-      let cond_val = build_fcmp Fcmp.One cond zero "ifcond" builder in
-
-      (* Grab the first block so that we might later add the conditional branch
-       * to it at the end of the function. *)
-      let start_bb = insertion_block builder in
-      let the_function = block_parent start_bb in
-
-      let then_bb = append_block "then" the_function in
-
-      (* Emit 'then' value. *)
-      position_at_end then_bb builder;
-      let then_val = codegen_expr then_ in
-
-      (* Codegen of 'then' can change the current block, update then_bb for the
-       * phi. We create a new name because one is used for the phi node, and the
-       * other is used for the conditional branch. *)
-      let new_then_bb = insertion_block builder in
-
-      (* Emit 'else' value. *)
-      let else_bb = append_block "else" the_function in
-      position_at_end else_bb builder;
-      let else_val = codegen_expr else_ in
-
-      (* Codegen of 'else' can change the current block, update else_bb for the
-       * phi. *)
-      let new_else_bb = insertion_block builder in
-
-      (* Emit merge block. *)
-      let merge_bb = append_block "ifcont" the_function in
-      position_at_end merge_bb builder;
-      let incoming = [(then_val, new_then_bb); (else_val, new_else_bb)] in
-      let phi = build_phi incoming "iftmp" builder in
-
-      (* Return to the start block to add the conditional branch. *)
-      position_at_end start_bb builder;
-      ignore (build_cond_br cond_val then_bb else_bb builder);
-
-      (* Set a unconditional branch at the end of the 'then' block and the
-       * 'else' block to the 'merge' block. *)
-      position_at_end new_then_bb builder; ignore (build_br merge_bb builder);
-      position_at_end new_else_bb builder; ignore (build_br merge_bb builder);
-
-      (* Finally, set the builder to the end of the merge block. *)
-      position_at_end merge_bb builder;
-
-      phi
-  | Ast.For (var_name, start, end_, step, body) -&gt;
-      (* Output this as:
-       *   var = alloca double
-       *   ...
-       *   start = startexpr
-       *   store start -&gt; var
-       *   goto loop
-       * loop:
-       *   ...
-       *   bodyexpr
-       *   ...
-       * loopend:
-       *   step = stepexpr
-       *   endcond = endexpr
-       *
-       *   curvar = load var
-       *   nextvar = curvar + step
-       *   store nextvar -&gt; var
-       *   br endcond, loop, endloop
-       * outloop: *)
-
-      let the_function = block_parent (insertion_block builder) in
-
-      (* Create an alloca for the variable in the entry block. *)
-      let alloca = create_entry_block_alloca the_function var_name in
-
-      (* Emit the start code first, without 'variable' in scope. *)
-      let start_val = codegen_expr start in
-
-      (* Store the value into the alloca. *)
-      ignore(build_store start_val alloca builder);
-
-      (* Make the new basic block for the loop header, inserting after current
-       * block. *)
-      let loop_bb = append_block "loop" the_function in
-
-      (* Insert an explicit fall through from the current block to the
-       * loop_bb. *)
-      ignore (build_br loop_bb builder);
-
-      (* Start insertion in loop_bb. *)
-      position_at_end loop_bb builder;
-
-      (* Within the loop, the variable is defined equal to the PHI node. If it
-       * shadows an existing variable, we have to restore it, so save it
-       * now. *)
-      let old_val =
-        try Some (Hashtbl.find named_values var_name) with Not_found -&gt; None
-      in
-      Hashtbl.add named_values var_name alloca;
-
-      (* Emit the body of the loop.  This, like any other expr, can change the
-       * current BB.  Note that we ignore the value computed by the body, but
-       * don't allow an error *)
-      ignore (codegen_expr body);
-
-      (* Emit the step value. *)
-      let step_val =
-        match step with
-        | Some step -&gt; codegen_expr step
-        (* If not specified, use 1.0. *)
-        | None -&gt; const_float double_type 1.0
-      in
-
-      (* Compute the end condition. *)
-      let end_cond = codegen_expr end_ in
-
-      (* Reload, increment, and restore the alloca. This handles the case where
-       * the body of the loop mutates the variable. *)
-      let cur_var = build_load alloca var_name builder in
-      let next_var = build_add cur_var step_val "nextvar" builder in
-      ignore(build_store next_var alloca builder);
-
-      (* Convert condition to a bool by comparing equal to 0.0. *)
-      let zero = const_float double_type 0.0 in
-      let end_cond = build_fcmp Fcmp.One end_cond zero "loopcond" builder in
-
-      (* Create the "after loop" block and insert it. *)
-      let after_bb = append_block "afterloop" the_function in
-
-      (* Insert the conditional branch into the end of loop_end_bb. *)
-      ignore (build_cond_br end_cond loop_bb after_bb builder);
-
-      (* Any new code will be inserted in after_bb. *)
-      position_at_end after_bb builder;
-
-      (* Restore the unshadowed variable. *)
-      begin match old_val with
-      | Some old_val -&gt; Hashtbl.add named_values var_name old_val
-      | None -&gt; ()
-      end;
-
-      (* for expr always returns 0.0. *)
-      const_null double_type
-  | Ast.Var (var_names, body) -&gt;
-      let old_bindings = ref [] in
-
-      let the_function = block_parent (insertion_block builder) in
-
-      (* Register all variables and emit their initializer. *)
-      Array.iter (fun (var_name, init) -&gt;
-        (* Emit the initializer before adding the variable to scope, this
-         * prevents the initializer from referencing the variable itself, and
-         * permits stuff like this:
-         *   var a = 1 in
-         *     var a = a in ...   # refers to outer 'a'. *)
-        let init_val =
-          match init with
-          | Some init -&gt; codegen_expr init
-          (* If not specified, use 0.0. *)
-          | None -&gt; const_float double_type 0.0
-        in
-
-        let alloca = create_entry_block_alloca the_function var_name in
-        ignore(build_store init_val alloca builder);
-
-        (* Remember the old variable binding so that we can restore the binding
-         * when we unrecurse. *)
-        begin
-          try
-            let old_value = Hashtbl.find named_values var_name in
-            old_bindings := (var_name, old_value) :: !old_bindings;
-          with Not_found -&gt; ()
-        end;
-
-        (* Remember this binding. *)
-        Hashtbl.add named_values var_name alloca;
-      ) var_names;
-
-      (* Codegen the body, now that all vars are in scope. *)
-      let body_val = codegen_expr body in
-
-      (* Pop all our variables from scope. *)
-      List.iter (fun (var_name, old_value) -&gt;
-        Hashtbl.add named_values var_name old_value
-      ) !old_bindings;
-
-      (* Return the body computation. *)
-      body_val
-
-let codegen_proto = function
-  | Ast.Prototype (name, args) | Ast.BinOpPrototype (name, args, _) -&gt;
-      (* Make the function type: double(double,double) etc. *)
-      let doubles = Array.make (Array.length args) double_type in
-      let ft = function_type double_type doubles in
-      let f =
-        match lookup_function name the_module with
-        | None -&gt; declare_function name ft the_module
-
-        (* If 'f' conflicted, there was already something named 'name'. If it
-         * has a body, don't allow redefinition or reextern. *)
-        | Some f -&gt;
-            (* If 'f' already has a body, reject this. *)
-            if block_begin f &lt;&gt; At_end f then
-              raise (Error "redefinition of function");
-
-            (* If 'f' took a different number of arguments, reject. *)
-            if element_type (type_of f) &lt;&gt; ft then
-              raise (Error "redefinition of function with different # args");
-            f
-      in
-
-      (* Set names for all arguments. *)
-      Array.iteri (fun i a -&gt;
-        let n = args.(i) in
-        set_value_name n a;
-        Hashtbl.add named_values n a;
-      ) (params f);
-      f
-
-(* Create an alloca for each argument and register the argument in the symbol
- * table so that references to it will succeed. *)
-let create_argument_allocas the_function proto =
-  let args = match proto with
-    | Ast.Prototype (_, args) | Ast.BinOpPrototype (_, args, _) -&gt; args
-  in
-  Array.iteri (fun i ai -&gt;
-    let var_name = args.(i) in
-    (* Create an alloca for this variable. *)
-    let alloca = create_entry_block_alloca the_function var_name in
-
-    (* Store the initial value into the alloca. *)
-    ignore(build_store ai alloca builder);
-
-    (* Add arguments to variable symbol table. *)
-    Hashtbl.add named_values var_name alloca;
-  ) (params the_function)
-
-let codegen_func the_fpm = function
-  | Ast.Function (proto, body) -&gt;
-      Hashtbl.clear named_values;
-      let the_function = codegen_proto proto in
-
-      (* If this is an operator, install it. *)
-      begin match proto with
-      | Ast.BinOpPrototype (name, args, prec) -&gt;
-          let op = name.[String.length name - 1] in
-          Hashtbl.add Parser.binop_precedence op prec;
-      | _ -&gt; ()
-      end;
-
-      (* Create a new basic block to start insertion into. *)
-      let bb = append_block "entry" the_function in
-      position_at_end bb builder;
-
-      try
-        (* Add all arguments to the symbol table and create their allocas. *)
-        create_argument_allocas the_function proto;
-
-        let ret_val = codegen_expr body in
-
-        (* Finish off the function. *)
-        let _ = build_ret ret_val builder in
-
-        (* Validate the generated code, checking for consistency. *)
-        Llvm_analysis.assert_valid_function the_function;
-
-        (* Optimize the function. *)
-        let _ = PassManager.run_function the_function the_fpm in
-
-        the_function
-      with e -&gt;
-        delete_function the_function;
-        raise e
-</pre>
-</dd>
-
-<dt>toplevel.ml:</dt>
-<dd class="doc_code">
-<pre>
-(*===----------------------------------------------------------------------===
- * Top-Level parsing and JIT Driver
- *===----------------------------------------------------------------------===*)
-
-open Llvm
-open Llvm_executionengine
-
-(* top ::= definition | external | expression | ';' *)
-let rec main_loop the_fpm the_execution_engine stream =
-  match Stream.peek stream with
-  | None -&gt; ()
-
-  (* ignore top-level semicolons. *)
-  | Some (Token.Kwd ';') -&gt;
-      Stream.junk stream;
-      main_loop the_fpm the_execution_engine stream
-
-  | Some token -&gt;
-      begin
-        try match token with
-        | Token.Def -&gt;
-            let e = Parser.parse_definition stream in
-            print_endline "parsed a function definition.";
-            dump_value (Codegen.codegen_func the_fpm e);
-        | Token.Extern -&gt;
-            let e = Parser.parse_extern stream in
-            print_endline "parsed an extern.";
-            dump_value (Codegen.codegen_proto e);
-        | _ -&gt;
-            (* Evaluate a top-level expression into an anonymous function. *)
-            let e = Parser.parse_toplevel stream in
-            print_endline "parsed a top-level expr";
-            let the_function = Codegen.codegen_func the_fpm e in
-            dump_value the_function;
-
-            (* JIT the function, returning a function pointer. *)
-            let result = ExecutionEngine.run_function the_function [||]
-              the_execution_engine in
-
-            print_string "Evaluated to ";
-            print_float (GenericValue.as_float double_type result);
-            print_newline ();
-        with Stream.Error s | Codegen.Error s -&gt;
-          (* Skip token for error recovery. *)
-          Stream.junk stream;
-          print_endline s;
-      end;
-      print_string "ready&gt; "; flush stdout;
-      main_loop the_fpm the_execution_engine stream
-</pre>
-</dd>
-
-<dt>toy.ml:</dt>
-<dd class="doc_code">
-<pre>
-(*===----------------------------------------------------------------------===
- * Main driver code.
- *===----------------------------------------------------------------------===*)
-
-open Llvm
-open Llvm_executionengine
-open Llvm_target
-open Llvm_scalar_opts
-
-let main () =
-  ignore (initialize_native_target ());
-
-  (* Install standard binary operators.
-   * 1 is the lowest precedence. *)
-  Hashtbl.add Parser.binop_precedence '=' 2;
-  Hashtbl.add Parser.binop_precedence '&lt;' 10;
-  Hashtbl.add Parser.binop_precedence '+' 20;
-  Hashtbl.add Parser.binop_precedence '-' 20;
-  Hashtbl.add Parser.binop_precedence '*' 40;    (* highest. *)
-
-  (* Prime the first token. *)
-  print_string "ready&gt; "; flush stdout;
-  let stream = Lexer.lex (Stream.of_channel stdin) in
-
-  (* Create the JIT. *)
-  let the_module_provider = ModuleProvider.create Codegen.the_module in
-  let the_execution_engine = ExecutionEngine.create the_module_provider in
-  let the_fpm = PassManager.create_function the_module_provider in
-
-  (* Set up the optimizer pipeline.  Start with registering info about how the
-   * target lays out data structures. *)
-  TargetData.add (ExecutionEngine.target_data the_execution_engine) the_fpm;
-
-  (* Promote allocas to registers. *)
-  add_memory_to_register_promotion the_fpm;
-
-  (* Do simple "peephole" optimizations and bit-twiddling optzn. *)
-  add_instruction_combining the_fpm;
-
-  (* reassociate expressions. *)
-  add_reassociation the_fpm;
-
-  (* Eliminate Common SubExpressions. *)
-  add_gvn the_fpm;
-
-  (* Simplify the control flow graph (deleting unreachable blocks, etc). *)
-  add_cfg_simplification the_fpm;
-
-  ignore (PassManager.initialize the_fpm);
-
-  (* Run the main "interpreter loop" now. *)
-  Toplevel.main_loop the_fpm the_execution_engine stream;
-
-  (* Print out all the generated code. *)
-  dump_module Codegen.the_module
-;;
-
-main ()
-</pre>
-</dd>
-
-<dt>bindings.c</dt>
-<dd class="doc_code">
-<pre>
-#include &lt;stdio.h&gt;
-
-/* putchard - putchar that takes a double and returns 0. */
-extern double putchard(double X) {
-  putchar((char)X);
-  return 0;
-}
-
-/* printd - printf that takes a double prints it as "%f\n", returning 0. */
-extern double printd(double X) {
-  printf("%f\n", X);
-  return 0;
-}
-</pre>
-</dd>
-</dl>
-
-<a href="LangImpl8.html">Next: Conclusion and other useful LLVM tidbits</a>
-</div>
-
-<!-- *********************************************************************** -->
-<hr>
-<address>
-  <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
-  src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"></a>
-  <a href="http://validator.w3.org/check/referer"><img
-  src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"></a>
-
-  <a href="mailto:sabre at nondot.org">Chris Lattner</a><br>
-  <a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
-  <a href="mailto:idadesub at users.sourceforge.net">Erick Tryzelaar</a><br>
-  Last modified: $Date$
-</address>
-</body>
-</html>
diff --git a/libclamav/c++/llvm/docs/tutorial/index.html b/libclamav/c++/llvm/docs/tutorial/index.html
deleted file mode 100644
index 250b533..0000000
--- a/libclamav/c++/llvm/docs/tutorial/index.html
+++ /dev/null
@@ -1,48 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-                      "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-  <title>LLVM Tutorial: Table of Contents</title>
-  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-  <meta name="author" content="Owen Anderson">
-  <meta name="description" 
-  content="LLVM Tutorial: Table of Contents.">
-  <link rel="stylesheet" href="../llvm.css" type="text/css">
-</head>
-
-<body>
-
-<div class="doc_title"> LLVM Tutorial: Table of Contents </div>
-
-<ol>
-  <li>Kaleidoscope: Implementing a Language with LLVM
-  <ol>
-    <li><a href="LangImpl1.html">Tutorial Introduction and the Lexer</a></li>
-    <li><a href="LangImpl2.html">Implementing a Parser and AST</a></li>
-    <li><a href="LangImpl3.html">Implementing Code Generation to LLVM IR</a></li>
-    <li><a href="LangImpl4.html">Adding JIT and Optimizer Support</a></li>
-    <li><a href="LangImpl5.html">Extending the language: control flow</a></li>
-    <li><a href="LangImpl6.html">Extending the language: user-defined operators</a></li>
-    <li><a href="LangImpl7.html">Extending the language: mutable variables / SSA construction</a></li>
-    <li><a href="LangImpl8.html">Conclusion and other useful LLVM tidbits</a></li>
-  </ol></li>
-  <li>Kaleidoscope: Implementing a Language with LLVM in Objective Caml
-  <ol>
-    <li><a href="OCamlLangImpl1.html">Tutorial Introduction and the Lexer</a></li>
-    <li><a href="OCamlLangImpl2.html">Implementing a Parser and AST</a></li>
-    <li><a href="OCamlLangImpl3.html">Implementing Code Generation to LLVM IR</a></li>
-    <li><a href="OCamlLangImpl4.html">Adding JIT and Optimizer Support</a></li>
-    <li><a href="OCamlLangImpl5.html">Extending the language: control flow</a></li>
-    <li><a href="OCamlLangImpl6.html">Extending the language: user-defined operators</a></li>
-    <li><a href="OCamlLangImpl7.html">Extending the language: mutable variables / SSA construction</a></li>
-    <li><a href="LangImpl8.html">Conclusion and other useful LLVM tidbits</a></li>
-  </ol></li>
-  <li>Advanced Topics
-  <ol>
-    <li><a href="http://llvm.org/pubs/2004-09-22-LCPCLLVMTutorial.html">Writing
-        an Optimization for LLVM</a></li>
-  </ol></li>
-</ol>
-
-</body>
-</html>
diff --git a/libclamav/c++/llvm/include/llvm-c/BitReader.h b/libclamav/c++/llvm/include/llvm-c/BitReader.h
index 59269ce..6db6607 100644
--- a/libclamav/c++/llvm/include/llvm-c/BitReader.h
+++ b/libclamav/c++/llvm/include/llvm-c/BitReader.h
@@ -36,18 +36,28 @@ LLVMBool LLVMParseBitcodeInContext(LLVMContextRef ContextRef,
                                    LLVMMemoryBufferRef MemBuf,
                                    LLVMModuleRef *OutModule, char **OutMessage);
 
-/* Reads a module from the specified path, returning via the OutMP parameter
-   a module provider which performs lazy deserialization. Returns 0 on success.
-   Optionally returns a human-readable error message via OutMessage. */ 
-LLVMBool LLVMGetBitcodeModuleProvider(LLVMMemoryBufferRef MemBuf,
-                                      LLVMModuleProviderRef *OutMP,
-                                      char **OutMessage);
+/** Reads a module from the specified path, returning via the OutMP parameter
+    a module provider which performs lazy deserialization. Returns 0 on success.
+    Optionally returns a human-readable error message via OutMessage. */ 
+LLVMBool LLVMGetBitcodeModuleInContext(LLVMContextRef ContextRef,
+                                       LLVMMemoryBufferRef MemBuf,
+                                       LLVMModuleRef *OutM,
+                                       char **OutMessage);
+
+LLVMBool LLVMGetBitcodeModule(LLVMMemoryBufferRef MemBuf, LLVMModuleRef *OutM,
+                              char **OutMessage);
 
+
+/** Deprecated: Use LLVMGetBitcodeModuleInContext instead. */
 LLVMBool LLVMGetBitcodeModuleProviderInContext(LLVMContextRef ContextRef,
                                                LLVMMemoryBufferRef MemBuf,
                                                LLVMModuleProviderRef *OutMP,
                                                char **OutMessage);
 
+/** Deprecated: Use LLVMGetBitcodeModule instead. */
+LLVMBool LLVMGetBitcodeModuleProvider(LLVMMemoryBufferRef MemBuf,
+                                      LLVMModuleProviderRef *OutMP,
+                                      char **OutMessage);
 
 #ifdef __cplusplus
 }
diff --git a/libclamav/c++/llvm/include/llvm-c/BitWriter.h b/libclamav/c++/llvm/include/llvm-c/BitWriter.h
index 008ff9f..bcbfb11 100644
--- a/libclamav/c++/llvm/include/llvm-c/BitWriter.h
+++ b/libclamav/c++/llvm/include/llvm-c/BitWriter.h
@@ -28,13 +28,16 @@ extern "C" {
 
 /*===-- Operations on modules ---------------------------------------------===*/
 
-/* Writes a module to an open file descriptor. Returns 0 on success.
-   Closes the Handle. Use dup first if this is not what you want. */ 
-int LLVMWriteBitcodeToFileHandle(LLVMModuleRef M, int Handle);
-
-/* Writes a module to the specified path. Returns 0 on success. */ 
+/** Writes a module to the specified path. Returns 0 on success. */ 
 int LLVMWriteBitcodeToFile(LLVMModuleRef M, const char *Path);
 
+/** Writes a module to an open file descriptor. Returns 0 on success. */
+int LLVMWriteBitcodeToFD(LLVMModuleRef M, int FD, int ShouldClose,
+                         int Unbuffered);
+
+/** Deprecated for LLVMWriteBitcodeToFD. Writes a module to an open file
+    descriptor. Returns 0 on success. Closes the Handle. */ 
+int LLVMWriteBitcodeToFileHandle(LLVMModuleRef M, int Handle);
 
 #ifdef __cplusplus
 }
diff --git a/libclamav/c++/llvm/include/llvm-c/Core.h b/libclamav/c++/llvm/include/llvm-c/Core.h
index 4500fcc..733b92c 100644
--- a/libclamav/c++/llvm/include/llvm-c/Core.h
+++ b/libclamav/c++/llvm/include/llvm-c/Core.h
@@ -92,11 +92,8 @@ typedef struct LLVMOpaqueMemoryBuffer *LLVMMemoryBufferRef;
 /** See the llvm::PassManagerBase class. */
 typedef struct LLVMOpaquePassManager *LLVMPassManagerRef;
 
-/**
- * Used to iterate through the uses of a Value, allowing access to all Values
- * that use this Value.  See the llvm::Use and llvm::value_use_iterator classes.
- */
-typedef struct LLVMOpaqueUseIterator *LLVMUseIteratorRef;
+/** Used to get the users and usees of a Value. See the llvm::Use class. */
+typedef struct LLVMOpaqueUse *LLVMUseRef;
 
 typedef enum {
     LLVMZExtAttribute       = 1<<0,
@@ -115,67 +112,81 @@ typedef enum {
     LLVMOptimizeForSizeAttribute = 1<<13,
     LLVMStackProtectAttribute    = 1<<14,
     LLVMStackProtectReqAttribute = 1<<15,
+    LLVMAlignment = 31<<16,
     LLVMNoCaptureAttribute  = 1<<21,
     LLVMNoRedZoneAttribute  = 1<<22,
     LLVMNoImplicitFloatAttribute = 1<<23,
     LLVMNakedAttribute      = 1<<24,
-    LLVMInlineHintAttribute = 1<<25
+    LLVMInlineHintAttribute = 1<<25,
+    LLVMStackAlignment = 7<<26
 } LLVMAttribute;
 
 typedef enum {
+  /* Terminator Instructions */
   LLVMRet            = 1,
   LLVMBr             = 2,
   LLVMSwitch         = 3,
-  LLVMInvoke         = 4,
-  LLVMUnwind         = 5,
-  LLVMUnreachable    = 6,
-  LLVMAdd            = 7,
-  LLVMFAdd           = 8,
-  LLVMSub            = 9,
-  LLVMFSub           = 10,
-  LLVMMul            = 11,
-  LLVMFMul           = 12,
-  LLVMUDiv           = 13,
-  LLVMSDiv           = 14,
-  LLVMFDiv           = 15,
-  LLVMURem           = 16,
-  LLVMSRem           = 17,
-  LLVMFRem           = 18,
-  LLVMShl            = 19,
-  LLVMLShr           = 20,
-  LLVMAShr           = 21,
-  LLVMAnd            = 22,
-  LLVMOr             = 23,
-  LLVMXor            = 24,
-  LLVMMalloc         = 25,
-  LLVMFree           = 26,
-  LLVMAlloca         = 27,
-  LLVMLoad           = 28,
-  LLVMStore          = 29,
-  LLVMGetElementPtr  = 30,
-  LLVMTrunk          = 31,
-  LLVMZExt           = 32,
-  LLVMSExt           = 33,
-  LLVMFPToUI         = 34,
-  LLVMFPToSI         = 35,
-  LLVMUIToFP         = 36,
-  LLVMSIToFP         = 37,
-  LLVMFPTrunc        = 38,
-  LLVMFPExt          = 39,
-  LLVMPtrToInt       = 40,
-  LLVMIntToPtr       = 41,
-  LLVMBitCast        = 42,
-  LLVMICmp           = 43,
-  LLVMFCmp           = 44,
-  LLVMPHI            = 45,
-  LLVMCall           = 46,
-  LLVMSelect         = 47,
-  LLVMVAArg          = 50,
-  LLVMExtractElement = 51,
-  LLVMInsertElement  = 52,
-  LLVMShuffleVector  = 53,
-  LLVMExtractValue   = 54,
-  LLVMInsertValue    = 55
+  LLVMIndirectBr     = 4,
+  LLVMInvoke         = 5,
+  LLVMUnwind         = 6,
+  LLVMUnreachable    = 7,
+
+  /* Standard Binary Operators */
+  LLVMAdd            = 8,
+  LLVMFAdd           = 9,
+  LLVMSub            = 10,
+  LLVMFSub           = 11,
+  LLVMMul            = 12,
+  LLVMFMul           = 13,
+  LLVMUDiv           = 14,
+  LLVMSDiv           = 15,
+  LLVMFDiv           = 16,
+  LLVMURem           = 17,
+  LLVMSRem           = 18,
+  LLVMFRem           = 19,
+
+  /* Logical Operators */
+  LLVMShl            = 20,
+  LLVMLShr           = 21,
+  LLVMAShr           = 22,
+  LLVMAnd            = 23,
+  LLVMOr             = 24,
+  LLVMXor            = 25,
+
+  /* Memory Operators */
+  LLVMAlloca         = 26,
+  LLVMLoad           = 27,
+  LLVMStore          = 28,
+  LLVMGetElementPtr  = 29,
+
+  /* Cast Operators */
+  LLVMTrunc          = 30,
+  LLVMZExt           = 31,
+  LLVMSExt           = 32,
+  LLVMFPToUI         = 33,
+  LLVMFPToSI         = 34,
+  LLVMUIToFP         = 35,
+  LLVMSIToFP         = 36,
+  LLVMFPTrunc        = 37,
+  LLVMFPExt          = 38,
+  LLVMPtrToInt       = 39,
+  LLVMIntToPtr       = 40,
+  LLVMBitCast        = 41,
+
+  /* Other Operators */
+  LLVMICmp           = 42,
+  LLVMFCmp           = 43,
+  LLVMPHI            = 44,
+  LLVMCall           = 45,
+  LLVMSelect         = 46,
+  /* UserOp1 */
+  /* UserOp2 */
+  LLVMVAArg          = 49,
+  LLVMExtractElement = 50,
+  LLVMInsertElement  = 51,
+  LLVMShuffleVector  = 52,
+  LLVMExtractValue   = 53,
+  LLVMInsertValue    = 54
 } LLVMOpcode;
 
 typedef enum {
@@ -270,13 +281,19 @@ typedef enum {
 void LLVMDisposeMessage(char *Message);
 
 
-/*===-- Modules -----------------------------------------------------------===*/
+/*===-- Contexts ----------------------------------------------------------===*/
 
 /* Create and destroy contexts. */
 LLVMContextRef LLVMContextCreate(void);
 LLVMContextRef LLVMGetGlobalContext(void);
 void LLVMContextDispose(LLVMContextRef C);
 
+unsigned LLVMGetMDKindIDInContext(LLVMContextRef C, const char* Name,
+                                  unsigned SLen);
+unsigned LLVMGetMDKindID(const char* Name, unsigned SLen);
+
+/*===-- Modules -----------------------------------------------------------===*/
+
 /* Create and destroy modules. */ 
 /** See llvm::Module::Module. */
 LLVMModuleRef LLVMModuleCreateWithName(const char *ModuleID);
@@ -485,6 +502,9 @@ const char *LLVMGetValueName(LLVMValueRef Val);
 void LLVMSetValueName(LLVMValueRef Val, const char *Name);
 void LLVMDumpValue(LLVMValueRef Val);
 void LLVMReplaceAllUsesWith(LLVMValueRef OldVal, LLVMValueRef NewVal);
+int LLVMHasMetadata(LLVMValueRef Val);
+LLVMValueRef LLVMGetMetadata(LLVMValueRef Val, unsigned KindID);
+void LLVMSetMetadata(LLVMValueRef Val, unsigned KindID, LLVMValueRef Node);
 
 /* Conversion functions. Return the input value if it is an instance of the
    specified class, otherwise NULL. See llvm::dyn_cast_or_null<>. */
@@ -493,10 +513,10 @@ void LLVMReplaceAllUsesWith(LLVMValueRef OldVal, LLVMValueRef NewVal);
 LLVM_FOR_EACH_VALUE_SUBCLASS(LLVM_DECLARE_VALUE_CAST)
 
 /* Operations on Uses */
-LLVMUseIteratorRef LLVMGetFirstUse(LLVMValueRef Val);
-LLVMUseIteratorRef LLVMGetNextUse(LLVMUseIteratorRef U);
-LLVMValueRef LLVMGetUser(LLVMUseIteratorRef U);
-LLVMValueRef LLVMGetUsedValue(LLVMUseIteratorRef U);
+LLVMUseRef LLVMGetFirstUse(LLVMValueRef Val);
+LLVMUseRef LLVMGetNextUse(LLVMUseRef U);
+LLVMValueRef LLVMGetUser(LLVMUseRef U);
+LLVMValueRef LLVMGetUsedValue(LLVMUseRef U);
 
 /* Operations on Users */
 LLVMValueRef LLVMGetOperand(LLVMValueRef Val, unsigned Index);
@@ -510,6 +530,14 @@ LLVMBool LLVMIsNull(LLVMValueRef Val);
 LLVMBool LLVMIsUndef(LLVMValueRef Val);
 LLVMValueRef LLVMConstPointerNull(LLVMTypeRef Ty);
 
+/* Operations on metadata */
+LLVMValueRef LLVMMDStringInContext(LLVMContextRef C, const char *Str,
+                                   unsigned SLen);
+LLVMValueRef LLVMMDString(const char *Str, unsigned SLen);
+LLVMValueRef LLVMMDNodeInContext(LLVMContextRef C, LLVMValueRef *Vals,
+                                 unsigned Count);
+LLVMValueRef LLVMMDNode(LLVMValueRef *Vals, unsigned Count);
+
 /* Operations on scalar constants */
 LLVMValueRef LLVMConstInt(LLVMTypeRef IntTy, unsigned long long N,
                           LLVMBool SignExtend);
@@ -539,20 +567,28 @@ LLVMValueRef LLVMConstArray(LLVMTypeRef ElementTy,
 LLVMValueRef LLVMConstStruct(LLVMValueRef *ConstantVals, unsigned Count,
                              LLVMBool Packed);
 LLVMValueRef LLVMConstVector(LLVMValueRef *ScalarConstantVals, unsigned Size);
+LLVMValueRef LLVMConstUnion(LLVMTypeRef Ty, LLVMValueRef Val);
 
 /* Constant expressions */
 LLVMOpcode LLVMGetConstOpcode(LLVMValueRef ConstantVal);
 LLVMValueRef LLVMAlignOf(LLVMTypeRef Ty);
 LLVMValueRef LLVMSizeOf(LLVMTypeRef Ty);
 LLVMValueRef LLVMConstNeg(LLVMValueRef ConstantVal);
+LLVMValueRef LLVMConstNSWNeg(LLVMValueRef ConstantVal);
+LLVMValueRef LLVMConstNUWNeg(LLVMValueRef ConstantVal);
 LLVMValueRef LLVMConstFNeg(LLVMValueRef ConstantVal);
 LLVMValueRef LLVMConstNot(LLVMValueRef ConstantVal);
 LLVMValueRef LLVMConstAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
 LLVMValueRef LLVMConstNSWAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
+LLVMValueRef LLVMConstNUWAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
 LLVMValueRef LLVMConstFAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
 LLVMValueRef LLVMConstSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
+LLVMValueRef LLVMConstNSWSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
+LLVMValueRef LLVMConstNUWSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
 LLVMValueRef LLVMConstFSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
 LLVMValueRef LLVMConstMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
+LLVMValueRef LLVMConstNSWMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
+LLVMValueRef LLVMConstNUWMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
 LLVMValueRef LLVMConstFMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
 LLVMValueRef LLVMConstUDiv(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
 LLVMValueRef LLVMConstSDiv(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
@@ -618,6 +654,7 @@ LLVMValueRef LLVMConstInsertValue(LLVMValueRef AggConstant,
 LLVMValueRef LLVMConstInlineAsm(LLVMTypeRef Ty,
                                 const char *AsmString, const char *Constraints,
                                 LLVMBool HasSideEffects, LLVMBool IsAlignStack);
+LLVMValueRef LLVMBlockAddress(LLVMValueRef F, LLVMBasicBlockRef BB);
 
 /* Operations on global variables, functions, and aliases (globals) */
 LLVMModuleRef LLVMGetGlobalParent(LLVMValueRef Global);
@@ -633,6 +670,9 @@ void LLVMSetAlignment(LLVMValueRef Global, unsigned Bytes);
 
 /* Operations on global variables */
 LLVMValueRef LLVMAddGlobal(LLVMModuleRef M, LLVMTypeRef Ty, const char *Name);
+LLVMValueRef LLVMAddGlobalInAddressSpace(LLVMModuleRef M, LLVMTypeRef Ty,
+                                         const char *Name,
+                                         unsigned AddressSpace);
 LLVMValueRef LLVMGetNamedGlobal(LLVMModuleRef M, const char *Name);
 LLVMValueRef LLVMGetFirstGlobal(LLVMModuleRef M);
 LLVMValueRef LLVMGetLastGlobal(LLVMModuleRef M);
@@ -753,6 +793,11 @@ void LLVMInsertIntoBuilderWithName(LLVMBuilderRef Builder, LLVMValueRef Instr,
                                    const char *Name);
 void LLVMDisposeBuilder(LLVMBuilderRef Builder);
 
+/* Metadata */
+void LLVMSetCurrentDebugLocation(LLVMBuilderRef Builder, LLVMValueRef L);
+LLVMValueRef LLVMGetCurrentDebugLocation(LLVMBuilderRef Builder);
+void LLVMSetInstDebugLocation(LLVMBuilderRef Builder, LLVMValueRef Inst);
+
 /* Terminators */
 LLVMValueRef LLVMBuildRetVoid(LLVMBuilderRef);
 LLVMValueRef LLVMBuildRet(LLVMBuilderRef, LLVMValueRef V);
@@ -763,6 +808,8 @@ LLVMValueRef LLVMBuildCondBr(LLVMBuilderRef, LLVMValueRef If,
                              LLVMBasicBlockRef Then, LLVMBasicBlockRef Else);
 LLVMValueRef LLVMBuildSwitch(LLVMBuilderRef, LLVMValueRef V,
                              LLVMBasicBlockRef Else, unsigned NumCases);
+LLVMValueRef LLVMBuildIndirectBr(LLVMBuilderRef B, LLVMValueRef Addr,
+                                 unsigned NumDests);
 LLVMValueRef LLVMBuildInvoke(LLVMBuilderRef, LLVMValueRef Fn,
                              LLVMValueRef *Args, unsigned NumArgs,
                              LLVMBasicBlockRef Then, LLVMBasicBlockRef Catch,
@@ -774,19 +821,32 @@ LLVMValueRef LLVMBuildUnreachable(LLVMBuilderRef);
 void LLVMAddCase(LLVMValueRef Switch, LLVMValueRef OnVal,
                  LLVMBasicBlockRef Dest);
 
+/* Add a destination to the indirectbr instruction */
+void LLVMAddDestination(LLVMValueRef IndirectBr, LLVMBasicBlockRef Dest);
+
 /* Arithmetic */
 LLVMValueRef LLVMBuildAdd(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
                           const char *Name);
 LLVMValueRef LLVMBuildNSWAdd(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
                              const char *Name);
+LLVMValueRef LLVMBuildNUWAdd(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
+                             const char *Name);
 LLVMValueRef LLVMBuildFAdd(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
                            const char *Name);
 LLVMValueRef LLVMBuildSub(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
                           const char *Name);
+LLVMValueRef LLVMBuildNSWSub(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
+                             const char *Name);
+LLVMValueRef LLVMBuildNUWSub(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
+                             const char *Name);
 LLVMValueRef LLVMBuildFSub(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
                            const char *Name);
 LLVMValueRef LLVMBuildMul(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
                           const char *Name);
+LLVMValueRef LLVMBuildNSWMul(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
+                             const char *Name);
+LLVMValueRef LLVMBuildNUWMul(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
+                             const char *Name);
 LLVMValueRef LLVMBuildFMul(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
                            const char *Name);
 LLVMValueRef LLVMBuildUDiv(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
@@ -815,7 +875,14 @@ LLVMValueRef LLVMBuildOr(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
                           const char *Name);
 LLVMValueRef LLVMBuildXor(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
                           const char *Name);
+LLVMValueRef LLVMBuildBinOp(LLVMBuilderRef B, LLVMOpcode Op,
+                            LLVMValueRef LHS, LLVMValueRef RHS,
+                            const char *Name);
 LLVMValueRef LLVMBuildNeg(LLVMBuilderRef, LLVMValueRef V, const char *Name);
+LLVMValueRef LLVMBuildNSWNeg(LLVMBuilderRef B, LLVMValueRef V,
+                             const char *Name);
+LLVMValueRef LLVMBuildNUWNeg(LLVMBuilderRef B, LLVMValueRef V,
+                             const char *Name);
 LLVMValueRef LLVMBuildFNeg(LLVMBuilderRef, LLVMValueRef V, const char *Name);
 LLVMValueRef LLVMBuildNot(LLVMBuilderRef, LLVMValueRef V, const char *Name);
 
@@ -874,6 +941,8 @@ LLVMValueRef LLVMBuildSExtOrBitCast(LLVMBuilderRef, LLVMValueRef Val,
                                     LLVMTypeRef DestTy, const char *Name);
 LLVMValueRef LLVMBuildTruncOrBitCast(LLVMBuilderRef, LLVMValueRef Val,
                                      LLVMTypeRef DestTy, const char *Name);
+LLVMValueRef LLVMBuildCast(LLVMBuilderRef B, LLVMOpcode Op, LLVMValueRef Val,
+                           LLVMTypeRef DestTy, const char *Name);
 LLVMValueRef LLVMBuildPointerCast(LLVMBuilderRef, LLVMValueRef Val,
                                   LLVMTypeRef DestTy, const char *Name);
 LLVMValueRef LLVMBuildIntCast(LLVMBuilderRef, LLVMValueRef Val, /*Signed cast!*/
@@ -955,6 +1024,9 @@ LLVMPassManagerRef LLVMCreatePassManager(void);
     provider. It does not take ownership of the module provider. This type of
     pipeline is suitable for code generation and JIT compilation tasks.
     See llvm::FunctionPassManager::FunctionPassManager. */
+LLVMPassManagerRef LLVMCreateFunctionPassManagerForModule(LLVMModuleRef M);
+
+/** Deprecated: Use LLVMCreateFunctionPassManagerForModule instead. */
 LLVMPassManagerRef LLVMCreateFunctionPassManager(LLVMModuleProviderRef MP);
 
 /** Initializes, executes on the provided module, and finalizes all of the
@@ -1026,7 +1098,7 @@ namespace llvm {
   DEFINE_SIMPLE_CONVERSION_FUNCTIONS(PATypeHolder,       LLVMTypeHandleRef    )
   DEFINE_SIMPLE_CONVERSION_FUNCTIONS(MemoryBuffer,       LLVMMemoryBufferRef  )
   DEFINE_SIMPLE_CONVERSION_FUNCTIONS(LLVMContext,        LLVMContextRef       )
-  DEFINE_SIMPLE_CONVERSION_FUNCTIONS(Use,                LLVMUseIteratorRef           )
+  DEFINE_SIMPLE_CONVERSION_FUNCTIONS(Use,                LLVMUseRef           )
   DEFINE_STDCXX_CONVERSION_FUNCTIONS(PassManagerBase,    LLVMPassManagerRef   )
   /* LLVMModuleProviderRef exists for historical reasons, but now just holds a
    * Module.
diff --git a/libclamav/c++/llvm/include/llvm-c/ExecutionEngine.h b/libclamav/c++/llvm/include/llvm-c/ExecutionEngine.h
index 151c935..5a98a77 100644
--- a/libclamav/c++/llvm/include/llvm-c/ExecutionEngine.h
+++ b/libclamav/c++/llvm/include/llvm-c/ExecutionEngine.h
@@ -55,14 +55,30 @@ void LLVMDisposeGenericValue(LLVMGenericValueRef GenVal);
 
 /*===-- Operations on execution engines -----------------------------------===*/
 
+LLVMBool LLVMCreateExecutionEngineForModule(LLVMExecutionEngineRef *OutEE,
+                                            LLVMModuleRef M,
+                                            char **OutError);
+
+LLVMBool LLVMCreateInterpreterForModule(LLVMExecutionEngineRef *OutInterp,
+                                        LLVMModuleRef M,
+                                        char **OutError);
+
+LLVMBool LLVMCreateJITCompilerForModule(LLVMExecutionEngineRef *OutJIT,
+                                        LLVMModuleRef M,
+                                        unsigned OptLevel,
+                                        char **OutError);
+
+/** Deprecated: Use LLVMCreateExecutionEngineForModule instead. */
 LLVMBool LLVMCreateExecutionEngine(LLVMExecutionEngineRef *OutEE,
                                    LLVMModuleProviderRef MP,
                                    char **OutError);
 
+/** Deprecated: Use LLVMCreateInterpreterForModule instead. */
 LLVMBool LLVMCreateInterpreter(LLVMExecutionEngineRef *OutInterp,
                                LLVMModuleProviderRef MP,
                                char **OutError);
 
+/** Deprecated: Use LLVMCreateJITCompilerForModule instead. */
 LLVMBool LLVMCreateJITCompiler(LLVMExecutionEngineRef *OutJIT,
                                LLVMModuleProviderRef MP,
                                unsigned OptLevel,
@@ -84,8 +100,15 @@ LLVMGenericValueRef LLVMRunFunction(LLVMExecutionEngineRef EE, LLVMValueRef F,
 
 void LLVMFreeMachineCodeForFunction(LLVMExecutionEngineRef EE, LLVMValueRef F);
 
+void LLVMAddModule(LLVMExecutionEngineRef EE, LLVMModuleRef M);
+
+/** Deprecated: Use LLVMAddModule instead. */
 void LLVMAddModuleProvider(LLVMExecutionEngineRef EE, LLVMModuleProviderRef MP);
 
+LLVMBool LLVMRemoveModule(LLVMExecutionEngineRef EE, LLVMModuleRef M,
+                          LLVMModuleRef *OutMod, char **OutError);
+
+/** Deprecated: Use LLVMRemoveModule instead. */
 LLVMBool LLVMRemoveModuleProvider(LLVMExecutionEngineRef EE,
                                   LLVMModuleProviderRef MP,
                                   LLVMModuleRef *OutMod, char **OutError);
diff --git a/libclamav/c++/llvm/include/llvm/ADT/APFloat.h b/libclamav/c++/llvm/include/llvm/ADT/APFloat.h
index f81109a..861b7b9 100644
--- a/libclamav/c++/llvm/include/llvm/ADT/APFloat.h
+++ b/libclamav/c++/llvm/include/llvm/ADT/APFloat.h
@@ -173,11 +173,16 @@ namespace llvm {
       fcZero
     };
 
+    enum uninitializedTag {
+      uninitialized
+    };
+
     // Constructors.
     APFloat(const fltSemantics &); // Default construct to 0.0
     APFloat(const fltSemantics &, const StringRef &);
     APFloat(const fltSemantics &, integerPart);
-    APFloat(const fltSemantics &, fltCategory, bool negative, unsigned type=0);
+    APFloat(const fltSemantics &, fltCategory, bool negative);
+    APFloat(const fltSemantics &, uninitializedTag);
     explicit APFloat(double d);
     explicit APFloat(float f);
     explicit APFloat(const APInt &, bool isIEEE = false);
@@ -199,7 +204,26 @@ namespace llvm {
     /// default.  The value is truncated as necessary.
     static APFloat getNaN(const fltSemantics &Sem, bool Negative = false,
                           unsigned type = 0) {
-      return APFloat(Sem, fcNaN, Negative, type);
+      if (type) {
+        APInt fill(64, type);
+        return getQNaN(Sem, Negative, &fill);
+      } else {
+        return getQNaN(Sem, Negative, 0);
+      }
+    }
+
+    /// getQNan - Factory for QNaN values.
+    static APFloat getQNaN(const fltSemantics &Sem,
+                           bool Negative = false,
+                           const APInt *payload = 0) {
+      return makeNaN(Sem, false, Negative, payload);
+    }
+
+    /// getSNan - Factory for SNaN values.
+    static APFloat getSNaN(const fltSemantics &Sem,
+                           bool Negative = false,
+                           const APInt *payload = 0) {
+      return makeNaN(Sem, true, Negative, payload);
     }
 
     /// getLargest - Returns the largest finite number in the given
@@ -350,7 +374,9 @@ namespace llvm {
     opStatus modSpecials(const APFloat &);
 
     /* Miscellany.  */
-    void makeNaN(unsigned = 0);
+    static APFloat makeNaN(const fltSemantics &Sem, bool SNaN, bool Negative,
+                           const APInt *fill);
+    void makeNaN(bool SNaN = false, bool Neg = false, const APInt *fill = 0);
     opStatus normalize(roundingMode, lostFraction);
     opStatus addOrSubtract(const APFloat &, roundingMode, bool subtract);
     cmpResult compareAbsoluteValue(const APFloat &) const;
diff --git a/libclamav/c++/llvm/include/llvm/ADT/APInt.h b/libclamav/c++/llvm/include/llvm/ADT/APInt.h
index 88aa995..3f67ffb 100644
--- a/libclamav/c++/llvm/include/llvm/ADT/APInt.h
+++ b/libclamav/c++/llvm/include/llvm/ADT/APInt.h
@@ -150,7 +150,17 @@ class APInt {
     return isSingleWord() ? VAL : pVal[whichWord(bitPosition)];
   }
 
+  /// Converts a string into a number.  The string must be non-empty
+  /// and well-formed as a number of the given base. The bit-width
+  /// must be sufficient to hold the result.
+  ///
   /// This is used by the constructors that take string arguments.
+  ///
+  /// StringRef::getAsInteger is superficially similar but (1) does
+  /// not assume that the string is well-formed and (2) grows the
+  /// result to hold the input.
+  ///
+  /// @param radix 2, 8, 10, or 16
   /// @brief Convert a char array into an APInt
   void fromString(unsigned numBits, const StringRef &str, uint8_t radix);
 
@@ -571,6 +581,21 @@ public:
   /// @brief Bitwise OR assignment operator.
   APInt& operator|=(const APInt& RHS);
 
+  /// Performs a bitwise OR operation on this APInt and RHS. RHS is
+  /// logically zero-extended or truncated to match the bit-width of
+  /// the LHS.
+  /// 
+  /// @brief Bitwise OR assignment operator.
+  APInt& operator|=(uint64_t RHS) {
+    if (isSingleWord()) {
+      VAL |= RHS;
+      clearUnusedBits();
+    } else {
+      pVal[0] |= RHS;
+    }
+    return *this;
+  }
+
   /// Performs a bitwise XOR operation on this APInt and RHS. The result is
   /// assigned to *this.
   /// @returns *this after XORing with RHS.
@@ -1308,6 +1333,9 @@ public:
   /// Set the given bit of a bignum.  Zero-based.
   static void tcSetBit(integerPart *, unsigned int bit);
 
+  /// Clear the given bit of a bignum.  Zero-based.
+  static void tcClearBit(integerPart *, unsigned int bit);
+
   /// Returns the bit number of the least or most significant set bit
   /// of a number.  If the input number has no bits set -1U is
   /// returned.
diff --git a/libclamav/c++/llvm/include/llvm/ADT/DeltaAlgorithm.h b/libclamav/c++/llvm/include/llvm/ADT/DeltaAlgorithm.h
index 1facfa0..45ba198 100644
--- a/libclamav/c++/llvm/include/llvm/ADT/DeltaAlgorithm.h
+++ b/libclamav/c++/llvm/include/llvm/ADT/DeltaAlgorithm.h
@@ -52,7 +52,7 @@ private:
   /// \return - The test result.
   bool GetTestResult(const changeset_ty &Changes);
 
-  /// Split - Partition a set of changes \arg Sinto one or two subsets.
+  /// Split - Partition a set of changes \arg S into one or two subsets.
   void Split(const changeset_ty &S, changesetlist_ty &Res);
 
   /// Delta - Minimize a set of \arg Changes which has been partioned into
diff --git a/libclamav/c++/llvm/include/llvm/ADT/ScopedHashTable.h b/libclamav/c++/llvm/include/llvm/ADT/ScopedHashTable.h
index d538295..b5ca374 100644
--- a/libclamav/c++/llvm/include/llvm/ADT/ScopedHashTable.h
+++ b/libclamav/c++/llvm/include/llvm/ADT/ScopedHashTable.h
@@ -36,10 +36,10 @@
 
 namespace llvm {
 
-template <typename K, typename V>
+template <typename K, typename V, typename KInfo = DenseMapInfo<K> >
 class ScopedHashTable;
 
-template <typename K, typename V>
+template <typename K, typename V, typename KInfo = DenseMapInfo<K> >
 class ScopedHashTableVal {
   ScopedHashTableVal *NextInScope;
   ScopedHashTableVal *NextForKey;
@@ -61,35 +61,39 @@ public:
   ScopedHashTableVal *getNextInScope() { return NextInScope; }
 };
 
-template <typename K, typename V>
+template <typename K, typename V, typename KInfo = DenseMapInfo<K> >
 class ScopedHashTableScope {
   /// HT - The hashtable that we are active for.
-  ScopedHashTable<K, V> &HT;
+  ScopedHashTable<K, V, KInfo> &HT;
 
   /// PrevScope - This is the scope that we are shadowing in HT.
   ScopedHashTableScope *PrevScope;
 
   /// LastValInScope - This is the last value that was inserted for this scope
   /// or null if none have been inserted yet.
-  ScopedHashTableVal<K,V> *LastValInScope;
+  ScopedHashTableVal<K, V, KInfo> *LastValInScope;
   void operator=(ScopedHashTableScope&);       // DO NOT IMPLEMENT
   ScopedHashTableScope(ScopedHashTableScope&); // DO NOT IMPLEMENT
 public:
-  ScopedHashTableScope(ScopedHashTable<K, V> &HT);
+  ScopedHashTableScope(ScopedHashTable<K, V, KInfo> &HT);
   ~ScopedHashTableScope();
 
 private:
-  friend class ScopedHashTable<K, V>;
-  ScopedHashTableVal<K, V> *getLastValInScope() { return LastValInScope; }
-  void setLastValInScope(ScopedHashTableVal<K,V> *Val) { LastValInScope = Val; }
+  friend class ScopedHashTable<K, V, KInfo>;
+  ScopedHashTableVal<K, V, KInfo> *getLastValInScope() {
+    return LastValInScope;
+  }
+  void setLastValInScope(ScopedHashTableVal<K, V, KInfo> *Val) {
+    LastValInScope = Val;
+  }
 };
 
 
-template <typename K, typename V>
+template <typename K, typename V, typename KInfo = DenseMapInfo<K> >
 class ScopedHashTableIterator {
-  ScopedHashTableVal<K,V> *Node;
+  ScopedHashTableVal<K, V, KInfo> *Node;
 public:
-  ScopedHashTableIterator(ScopedHashTableVal<K,V> *node) : Node(node){}
+  ScopedHashTableIterator(ScopedHashTableVal<K, V, KInfo> *node) : Node(node) {}
 
   V &operator*() const {
     assert(Node && "Dereference end()");
@@ -117,35 +121,43 @@ public:
 };
 
 
-template <typename K, typename V>
+template <typename K, typename V, typename KInfo>
 class ScopedHashTable {
-  DenseMap<K, ScopedHashTableVal<K,V>*> TopLevelMap;
-  ScopedHashTableScope<K, V> *CurScope;
+  DenseMap<K, ScopedHashTableVal<K, V, KInfo>*, KInfo> TopLevelMap;
+  ScopedHashTableScope<K, V, KInfo> *CurScope;
   ScopedHashTable(const ScopedHashTable&); // NOT YET IMPLEMENTED
   void operator=(const ScopedHashTable&);  // NOT YET IMPLEMENTED
-  friend class ScopedHashTableScope<K, V>;
+  friend class ScopedHashTableScope<K, V, KInfo>;
 public:
   ScopedHashTable() : CurScope(0) {}
   ~ScopedHashTable() {
     assert(CurScope == 0 && TopLevelMap.empty() && "Scope imbalance!");
   }
 
+  bool count(const K &Key) const {
+    return TopLevelMap.count(Key);
+  }
+
+  V lookup(const K &Key) {
+    return TopLevelMap[Key]->getValue();
+  }
+
   void insert(const K &Key, const V &Val) {
     assert(CurScope && "No scope active!");
 
-    ScopedHashTableVal<K,V> *&KeyEntry = TopLevelMap[Key];
+    ScopedHashTableVal<K, V, KInfo> *&KeyEntry = TopLevelMap[Key];
 
-    KeyEntry = new ScopedHashTableVal<K,V>(CurScope->getLastValInScope(),
-                                           KeyEntry, Key, Val);
+    KeyEntry= new ScopedHashTableVal<K, V, KInfo>(CurScope->getLastValInScope(),
+                                                  KeyEntry, Key, Val);
     CurScope->setLastValInScope(KeyEntry);
   }
 
-  typedef ScopedHashTableIterator<K, V> iterator;
+  typedef ScopedHashTableIterator<K, V, KInfo> iterator;
 
   iterator end() { return iterator(0); }
 
   iterator begin(const K &Key) {
-    typename DenseMap<K, ScopedHashTableVal<K,V>*>::iterator I =
+    typename DenseMap<K, ScopedHashTableVal<K, V, KInfo>*, KInfo>::iterator I =
       TopLevelMap.find(Key);
     if (I == TopLevelMap.end()) return end();
     return iterator(I->second);
@@ -154,28 +166,29 @@ public:
 
 /// ScopedHashTableScope ctor - Install this as the current scope for the hash
 /// table.
-template <typename K, typename V>
-ScopedHashTableScope<K, V>::ScopedHashTableScope(ScopedHashTable<K, V> &ht)
-  : HT(ht) {
+template <typename K, typename V, typename KInfo>
+ScopedHashTableScope<K, V, KInfo>::
+  ScopedHashTableScope(ScopedHashTable<K, V, KInfo> &ht) : HT(ht) {
   PrevScope = HT.CurScope;
   HT.CurScope = this;
   LastValInScope = 0;
 }
 
-template <typename K, typename V>
-ScopedHashTableScope<K, V>::~ScopedHashTableScope() {
+template <typename K, typename V, typename KInfo>
+ScopedHashTableScope<K, V, KInfo>::~ScopedHashTableScope() {
   assert(HT.CurScope == this && "Scope imbalance!");
   HT.CurScope = PrevScope;
 
   // Pop and delete all values corresponding to this scope.
-  while (ScopedHashTableVal<K, V> *ThisEntry = LastValInScope) {
+  while (ScopedHashTableVal<K, V, KInfo> *ThisEntry = LastValInScope) {
     // Pop this value out of the TopLevelMap.
     if (ThisEntry->getNextForKey() == 0) {
       assert(HT.TopLevelMap[ThisEntry->getKey()] == ThisEntry &&
              "Scope imbalance!");
       HT.TopLevelMap.erase(ThisEntry->getKey());
     } else {
-      ScopedHashTableVal<K,V> *&KeyEntry = HT.TopLevelMap[ThisEntry->getKey()];
+      ScopedHashTableVal<K, V, KInfo> *&KeyEntry =
+        HT.TopLevelMap[ThisEntry->getKey()];
       assert(KeyEntry == ThisEntry && "Scope imbalance!");
       KeyEntry = ThisEntry->getNextForKey();
     }
diff --git a/libclamav/c++/llvm/include/llvm/ADT/StringRef.h b/libclamav/c++/llvm/include/llvm/ADT/StringRef.h
index 3064af3..9257770 100644
--- a/libclamav/c++/llvm/include/llvm/ADT/StringRef.h
+++ b/libclamav/c++/llvm/include/llvm/ADT/StringRef.h
@@ -18,6 +18,7 @@
 namespace llvm {
   template<typename T>
   class SmallVectorImpl;
+  class APInt;
 
   /// StringRef - Represent a constant reference to a string, i.e. a character
   /// array and a length, which need not be null terminated.
@@ -273,6 +274,19 @@ namespace llvm {
 
     // TODO: Provide overloads for int/unsigned that check for overflow.
 
+    /// getAsInteger - Parse the current string as an integer of the
+    /// specified radix, or of an autosensed radix if the radix given
+    /// is 0.  The current value in Result is discarded, and the
+    /// storage is changed to be wide enough to store the parsed
+    /// integer.
+    ///
+    /// Returns true if the string does not solely consist of a valid
+    /// non-empty number in the appropriate base.
+    ///
+    /// APInt::fromString is superficially similar but assumes the
+    /// string is well-formed in the given radix.
+    bool getAsInteger(unsigned Radix, APInt &Result) const;
+
     /// @}
     /// @name Substring Operations
     /// @{
@@ -355,7 +369,7 @@ namespace llvm {
     /// \param A - Where to put the substrings.
     /// \param Separator - The string to split on.
     /// \param MaxSplit - The maximum number of times the string is split.
-    /// \parm KeepEmpty - True if empty substring should be added.
+    /// \param KeepEmpty - True if empty substring should be added.
     void split(SmallVectorImpl<StringRef> &A,
                StringRef Separator, int MaxSplit = -1,
                bool KeepEmpty = true) const;
diff --git a/libclamav/c++/llvm/include/llvm/ADT/Triple.h b/libclamav/c++/llvm/include/llvm/ADT/Triple.h
index 8798b0e..be31ea0 100644
--- a/libclamav/c++/llvm/include/llvm/ADT/Triple.h
+++ b/libclamav/c++/llvm/include/llvm/ADT/Triple.h
@@ -73,6 +73,7 @@ public:
     x86,     // X86: i[3-9]86
     x86_64,  // X86-64: amd64, x86_64
     xcore,   // XCore: xcore
+    mblaze,  // MBlaze: mblaze
 
     InvalidArch
   };
diff --git a/libclamav/c++/llvm/include/llvm/Analysis/DebugInfo.h b/libclamav/c++/llvm/include/llvm/Analysis/DebugInfo.h
index ccf0105..f105c20 100644
--- a/libclamav/c++/llvm/include/llvm/Analysis/DebugInfo.h
+++ b/libclamav/c++/llvm/include/llvm/Analysis/DebugInfo.h
@@ -459,9 +459,11 @@ namespace llvm {
       if (DbgNode && !isLexicalBlock())
         DbgNode = 0;
     }
-    DIScope getContext() const       { return getFieldAs<DIScope>(1); }
-    StringRef getDirectory() const { return getContext().getDirectory(); }
-    StringRef getFilename() const  { return getContext().getFilename(); }
+    DIScope getContext() const       { return getFieldAs<DIScope>(1);      }
+    StringRef getDirectory() const   { return getContext().getDirectory(); }
+    StringRef getFilename() const    { return getContext().getFilename();  }
+    unsigned getLineNumber() const   { return getUnsignedField(2);         }
+    unsigned getColumnNumber() const { return getUnsignedField(3);         }
   };
 
   /// DINameSpace - A wrapper for a C++ style name space.
@@ -636,7 +638,8 @@ namespace llvm {
 
     /// CreateLexicalBlock - This creates a descriptor for a lexical block
     /// with the specified parent context.
-    DILexicalBlock CreateLexicalBlock(DIDescriptor Context);
+    DILexicalBlock CreateLexicalBlock(DIDescriptor Context, unsigned Line = 0,
+                                      unsigned Col = 0);
 
     /// CreateNameSpace - This creates new descriptor for a namespace
     /// with the specified parent context.
diff --git a/libclamav/c++/llvm/include/llvm/Analysis/Dominators.h b/libclamav/c++/llvm/include/llvm/Analysis/Dominators.h
index 31c19c4..1e94f30 100644
--- a/libclamav/c++/llvm/include/llvm/Analysis/Dominators.h
+++ b/libclamav/c++/llvm/include/llvm/Analysis/Dominators.h
@@ -52,7 +52,7 @@ protected:
     Roots(), IsPostDominators(isPostDom) {}
 public:
 
-  /// getRoots -  Return the root blocks of the current CFG.  This may include
+  /// getRoots - Return the root blocks of the current CFG.  This may include
   /// multiple blocks if we are computing post dominators.  For forward
   /// dominators, this will always be a single block (the entry node).
   ///
@@ -225,7 +225,7 @@ protected:
   DenseMap<NodeT*, InfoRec> Info;
 
   void reset() {
-    for (typename DomTreeNodeMapType::iterator I = this->DomTreeNodes.begin(), 
+    for (typename DomTreeNodeMapType::iterator I = this->DomTreeNodes.begin(),
            E = DomTreeNodes.end(); I != E; ++I)
       delete I->second;
     DomTreeNodes.clear();
@@ -248,7 +248,7 @@ protected:
     for (typename GraphTraits<Inverse<N> >::ChildIteratorType PI =
          GraphTraits<Inverse<N> >::child_begin(NewBB),
          PE = GraphTraits<Inverse<N> >::child_end(NewBB); PI != PE; ++PI)
-      PredBlocks.push_back(*PI);  
+      PredBlocks.push_back(*PI);
 
     assert(!PredBlocks.empty() && "No predblocks??");
 
@@ -310,7 +310,7 @@ public:
     if (DomTreeNodes.size() != OtherDomTreeNodes.size())
       return true;
 
-    for (typename DomTreeNodeMapType::const_iterator 
+    for (typename DomTreeNodeMapType::const_iterator
            I = this->DomTreeNodes.begin(),
            E = this->DomTreeNodes.end(); I != E; ++I) {
       NodeT *BB = I->first;
@@ -361,7 +361,7 @@ public:
     return properlyDominates(getNode(A), getNode(B));
   }
 
-  bool dominatedBySlowTreeWalk(const DomTreeNodeBase<NodeT> *A, 
+  bool dominatedBySlowTreeWalk(const DomTreeNodeBase<NodeT> *A,
                                const DomTreeNodeBase<NodeT> *B) const {
     const DomTreeNodeBase<NodeT> *IDom;
     if (A == 0 || B == 0) return false;
@@ -374,7 +374,7 @@ public:
   /// isReachableFromEntry - Return true if A is dominated by the entry
   /// block of the function containing it.
   bool isReachableFromEntry(NodeT* A) {
-    assert (!this->isPostDominator() 
+    assert (!this->isPostDominator()
             && "This is not implemented for post dominators");
     return dominates(&A->getParent()->front(), A);
   }
@@ -384,7 +384,7 @@ public:
   ///
   inline bool dominates(const DomTreeNodeBase<NodeT> *A,
                         const DomTreeNodeBase<NodeT> *B) {
-    if (B == A) 
+    if (B == A)
       return true;  // A node trivially dominates itself.
 
     if (A == 0 || B == 0)
@@ -412,7 +412,7 @@ public:
   }
 
   inline bool dominates(const NodeT *A, const NodeT *B) {
-    if (A == B) 
+    if (A == B)
       return true;
 
     // Cast away the const qualifiers here. This is ok since
@@ -431,9 +431,9 @@ public:
   /// for basic block A and B. If there is no such block then return NULL.
   NodeT *findNearestCommonDominator(NodeT *A, NodeT *B) {
 
-    assert (!this->isPostDominator() 
+    assert (!this->isPostDominator()
             && "This is not implemented for post dominators");
-    assert (A->getParent() == B->getParent() 
+    assert (A->getParent() == B->getParent()
             && "Two blocks are not in same function");
 
     // If either A or B is a entry block then it is nearest common dominator.
@@ -478,14 +478,14 @@ public:
   // the CFG...
 
   /// addNewBlock - Add a new node to the dominator tree information.  This
-  /// creates a new node as a child of DomBB dominator node,linking it into 
+  /// creates a new node as a child of DomBB dominator node,linking it into
   /// the children list of the immediate dominator.
   DomTreeNodeBase<NodeT> *addNewBlock(NodeT *BB, NodeT *DomBB) {
     assert(getNode(BB) == 0 && "Block already in dominator tree!");
     DomTreeNodeBase<NodeT> *IDomNode = getNode(DomBB);
     assert(IDomNode && "Not immediate dominator specified for block!");
     DFSInfoValid = false;
-    return DomTreeNodes[BB] = 
+    return DomTreeNodes[BB] =
       IDomNode->addChild(new DomTreeNodeBase<NodeT>(BB, IDomNode));
   }
 
@@ -503,7 +503,7 @@ public:
     changeImmediateDominator(getNode(BB), getNode(NewBB));
   }
 
-  /// eraseNode - Removes a node from  the dominator tree. Block must not
+  /// eraseNode - Removes a node from the dominator tree. Block must not
   /// domiante any other blocks. Removes node from its immediate dominator's
   /// children list. Deletes dominator node associated with basic block BB.
   void eraseNode(NodeT *BB) {
@@ -708,7 +708,7 @@ public:
 
   DominatorTreeBase<BasicBlock>& getBase() { return *DT; }
 
-  /// getRoots -  Return the root blocks of the current CFG.  This may include
+  /// getRoots - Return the root blocks of the current CFG.  This may include
   /// multiple blocks if we are computing post dominators.  For forward
   /// dominators, this will always be a single block (the entry node).
   ///
@@ -785,7 +785,7 @@ public:
   }
 
   /// addNewBlock - Add a new node to the dominator tree information.  This
-  /// creates a new node as a child of DomBB dominator node,linking it into 
+  /// creates a new node as a child of DomBB dominator node,linking it into
   /// the children list of the immediate dominator.
   inline DomTreeNode *addNewBlock(BasicBlock *BB, BasicBlock *DomBB) {
     return DT->addNewBlock(BB, DomBB);
@@ -802,7 +802,7 @@ public:
     DT->changeImmediateDominator(N, NewIDom);
   }
 
-  /// eraseNode - Removes a node from  the dominator tree. Block must not
+  /// eraseNode - Removes a node from the dominator tree. Block must not
   /// domiante any other blocks. Removes node from its immediate dominator's
   /// children list. Deletes dominator node associated with basic block BB.
   inline void eraseNode(BasicBlock *BB) {
@@ -820,7 +820,7 @@ public:
   }
 
 
-  virtual void releaseMemory() { 
+  virtual void releaseMemory() {
     DT->releaseMemory();
   }
 
@@ -886,10 +886,10 @@ protected:
   const bool IsPostDominators;
 
 public:
-  DominanceFrontierBase(void *ID, bool isPostDom) 
+  DominanceFrontierBase(void *ID, bool isPostDom)
     : FunctionPass(ID), IsPostDominators(isPostDom) {}
 
-  /// getRoots -  Return the root blocks of the current CFG.  This may include
+  /// getRoots - Return the root blocks of the current CFG.  This may include
   /// multiple blocks if we are computing post dominators.  For forward
   /// dominators, this will always be a single block (the entry node).
   ///
@@ -940,7 +940,7 @@ public:
   bool compareDomSet(DomSetType &DS1, const DomSetType &DS2) const {
     std::set<BasicBlock *> tmpSet;
     for (DomSetType::const_iterator I = DS2.begin(),
-           E = DS2.end(); I != E; ++I) 
+           E = DS2.end(); I != E; ++I)
       tmpSet.insert(*I);
 
     for (DomSetType::const_iterator I = DS1.begin(),
@@ -965,14 +965,14 @@ public:
   bool compare(DominanceFrontierBase &Other) const {
     DomSetMapType tmpFrontiers;
     for (DomSetMapType::const_iterator I = Other.begin(),
-           E = Other.end(); I != E; ++I) 
+           E = Other.end(); I != E; ++I)
       tmpFrontiers.insert(std::make_pair(I->first, I->second));
 
     for (DomSetMapType::iterator I = tmpFrontiers.begin(),
            E = tmpFrontiers.end(); I != E; ) {
       BasicBlock *Node = I->first;
       const_iterator DFI = find(Node);
-      if (DFI == end()) 
+      if (DFI == end())
         return true;
 
       if (compareDomSet(I->second, DFI->second))
@@ -1001,7 +1001,7 @@ public:
 class DominanceFrontier : public DominanceFrontierBase {
 public:
   static char ID; // Pass ID, replacement for typeid
-  DominanceFrontier() : 
+  DominanceFrontier() :
     DominanceFrontierBase(&ID, false) {}
 
   BasicBlock *getRoot() const {
@@ -1033,7 +1033,7 @@ public:
   /// to reflect this change.
   void changeImmediateDominator(BasicBlock *BB, BasicBlock *NewBB,
                                 DominatorTree *DT) {
-    // NewBB is now  dominating BB. Which means BB's dominance
+    // NewBB is now dominating BB. Which means BB's dominance
     // frontier is now part of NewBB's dominance frontier. However, BB
     // itself is not member of NewBB's dominance frontier.
     DominanceFrontier::iterator NewDFI = find(NewBB);
diff --git a/libclamav/c++/llvm/include/llvm/Analysis/IVUsers.h b/libclamav/c++/llvm/include/llvm/Analysis/IVUsers.h
index e6e9c71..dc616ca 100644
--- a/libclamav/c++/llvm/include/llvm/Analysis/IVUsers.h
+++ b/libclamav/c++/llvm/include/llvm/Analysis/IVUsers.h
@@ -61,7 +61,7 @@ public:
     Stride = Val;
   }
 
-  /// getOffset - Return the offset to add to a theoeretical induction
+  /// getOffset - Return the offset to add to a theoretical induction
   /// variable that starts at zero and counts up by the stride to compute
   /// the value for the use. This always has the same type as the stride.
   const SCEV *getOffset() const { return Offset; }
@@ -116,7 +116,7 @@ private:
   bool IsUseOfPostIncrementedValue;
 
   /// Deleted - Implementation of CallbackVH virtual function to
-  /// recieve notification when the User is deleted.
+  /// receive notification when the User is deleted.
   virtual void deleted();
 };
 
diff --git a/libclamav/c++/llvm/include/llvm/Analysis/LoopInfo.h b/libclamav/c++/llvm/include/llvm/Analysis/LoopInfo.h
index d5e4d51..f792a7f 100644
--- a/libclamav/c++/llvm/include/llvm/Analysis/LoopInfo.h
+++ b/libclamav/c++/llvm/include/llvm/Analysis/LoopInfo.h
@@ -835,7 +835,7 @@ public:
             } else if (BlockLoop != Child) {
               LoopT *SubLoop = BlockLoop;
               // Reparent all of the blocks which used to belong to BlockLoops
-              for (unsigned j = 0, e = SubLoop->Blocks.size(); j != e; ++j)
+              for (unsigned j = 0, f = SubLoop->Blocks.size(); j != f; ++j)
                 ContainingLoops[SubLoop->Blocks[j]] = Child;
 
               // There is already a loop which contains this block, that means
diff --git a/libclamav/c++/llvm/include/llvm/Analysis/MemoryDependenceAnalysis.h b/libclamav/c++/llvm/include/llvm/Analysis/MemoryDependenceAnalysis.h
index f83cc4f..f6aab03 100644
--- a/libclamav/c++/llvm/include/llvm/Analysis/MemoryDependenceAnalysis.h
+++ b/libclamav/c++/llvm/include/llvm/Analysis/MemoryDependenceAnalysis.h
@@ -249,7 +249,7 @@ namespace llvm {
                      SmallPtrSet<Instruction*, 4> > ReverseDepMapType;
     ReverseDepMapType ReverseLocalDeps;
     
-    // A reverse mapping form dependencies to the non-local dependees.
+    // A reverse mapping from dependencies to the non-local dependees.
     ReverseDepMapType ReverseNonLocalDeps;
     
     /// Current AA implementation, just a cache.
@@ -312,6 +312,11 @@ namespace llvm {
     /// value and replaces the other value with ptr. This can make Ptr available
     /// in more places that cached info does not necessarily keep.
     void invalidateCachedPointerInfo(Value *Ptr);
+
+    /// invalidateCachedPredecessors - Clear the PredIteratorCache info.
+    /// This needs to be done when the CFG changes, e.g., due to splitting
+    /// critical edges.
+    void invalidateCachedPredecessors();
     
   private:
     MemDepResult getPointerDependencyFrom(Value *Pointer, uint64_t MemSize,
diff --git a/libclamav/c++/llvm/include/llvm/Analysis/PHITransAddr.h b/libclamav/c++/llvm/include/llvm/Analysis/PHITransAddr.h
index b612316..033efba 100644
--- a/libclamav/c++/llvm/include/llvm/Analysis/PHITransAddr.h
+++ b/libclamav/c++/llvm/include/llvm/Analysis/PHITransAddr.h
@@ -66,9 +66,11 @@ public:
   bool IsPotentiallyPHITranslatable() const;
   
   /// PHITranslateValue - PHI translate the current address up the CFG from
-  /// CurBB to Pred, updating our state the reflect any needed changes.  This
-  /// returns true on failure and sets Addr to null.
-  bool PHITranslateValue(BasicBlock *CurBB, BasicBlock *PredBB);
+  /// CurBB to Pred, updating our state to reflect any needed changes.  If the
+  /// dominator tree DT is non-null, the translated value must dominate
+  /// PredBB.  This returns true on failure and sets Addr to null.
+  bool PHITranslateValue(BasicBlock *CurBB, BasicBlock *PredBB,
+                         const DominatorTree *DT);
   
   /// PHITranslateWithInsertion - PHI translate this value into the specified
   /// predecessor block, inserting a computation of the value if it is
@@ -88,14 +90,8 @@ public:
   /// returns false.
   bool Verify() const;
 private:
-  Value *PHITranslateSubExpr(Value *V, BasicBlock *CurBB, BasicBlock *PredBB);
-  
-  
-  /// GetAvailablePHITranslatedSubExpr - Return the value computed by
-  /// PHITranslateSubExpr if it dominates PredBB, otherwise return null.
-  Value *GetAvailablePHITranslatedSubExpr(Value *V,
-                                          BasicBlock *CurBB, BasicBlock *PredBB,
-                                          const DominatorTree &DT) const;
+  Value *PHITranslateSubExpr(Value *V, BasicBlock *CurBB, BasicBlock *PredBB,
+                             const DominatorTree *DT);
   
   /// InsertPHITranslatedSubExpr - Insert a computation of the PHI translated
   /// version of 'V' for the edge PredBB->CurBB into the end of the PredBB
diff --git a/libclamav/c++/llvm/include/llvm/Analysis/Passes.h b/libclamav/c++/llvm/include/llvm/Analysis/Passes.h
index 2f39c6a..1a5cbb2 100644
--- a/libclamav/c++/llvm/include/llvm/Analysis/Passes.h
+++ b/libclamav/c++/llvm/include/llvm/Analysis/Passes.h
@@ -81,13 +81,6 @@ namespace llvm {
 
   //===--------------------------------------------------------------------===//
   //
-  // createAndersensPass - This pass implements Andersen's interprocedural alias
-  // analysis.
-  //
-  ModulePass *createAndersensPass();
-
-  //===--------------------------------------------------------------------===//
-  //
   // createProfileLoaderPass - This pass loads information from a profile dump
   // file.
   //
diff --git a/libclamav/c++/llvm/include/llvm/Analysis/ScalarEvolution.h b/libclamav/c++/llvm/include/llvm/Analysis/ScalarEvolution.h
index 383ee88..96d29ba 100644
--- a/libclamav/c++/llvm/include/llvm/Analysis/ScalarEvolution.h
+++ b/libclamav/c++/llvm/include/llvm/Analysis/ScalarEvolution.h
@@ -8,7 +8,7 @@
 //===----------------------------------------------------------------------===//
 //
 // The ScalarEvolution class is an LLVM pass which can be used to analyze and
-// catagorize scalar expressions in loops.  It specializes in recognizing
+// categorize scalar expressions in loops.  It specializes in recognizing
 // general induction variables, representing them with the abstract and opaque
 // SCEV class.  Given this analysis, trip counts of loops and other important
 // properties can be obtained.
@@ -55,7 +55,7 @@ namespace llvm {
 
   protected:
     /// SubclassData - This field is initialized to zero and may be used in
-    /// subclasses to store miscelaneous information.
+    /// subclasses to store miscellaneous information.
     unsigned short SubclassData;
 
   private:
@@ -177,7 +177,7 @@ namespace llvm {
     ///
     LoopInfo *LI;
 
-    /// TD - The target data information for the target we are targetting.
+    /// TD - The target data information for the target we are targeting.
     ///
     TargetData *TD;
 
@@ -194,7 +194,7 @@ namespace llvm {
     std::map<SCEVCallbackVH, const SCEV *> Scalars;
 
     /// BackedgeTakenInfo - Information about the backedge-taken count
-    /// of a loop. This currently inclues an exact count and a maximum count.
+    /// of a loop. This currently includes an exact count and a maximum count.
     ///
     struct BackedgeTakenInfo {
       /// Exact - An expression indicating the exact backedge-taken count of
@@ -305,7 +305,7 @@ namespace llvm {
     /// ComputeLoadConstantCompareBackedgeTakenCount - Given an exit condition
     /// of 'icmp op load X, cst', try to see if we can compute the
     /// backedge-taken count.
-    const SCEV *
+    BackedgeTakenInfo
       ComputeLoadConstantCompareBackedgeTakenCount(LoadInst *LI,
                                                    Constant *RHS,
                                                    const Loop *L,
@@ -323,12 +323,12 @@ namespace llvm {
     /// HowFarToZero - Return the number of times a backedge comparing the
     /// specified value to zero will execute.  If not computable, return
     /// CouldNotCompute.
-    const SCEV *HowFarToZero(const SCEV *V, const Loop *L);
+    BackedgeTakenInfo HowFarToZero(const SCEV *V, const Loop *L);
 
     /// HowFarToNonZero - Return the number of times a backedge checking the
     /// specified value for nonzero will execute.  If not computable, return
     /// CouldNotCompute.
-    const SCEV *HowFarToNonZero(const SCEV *V, const Loop *L);
+    BackedgeTakenInfo HowFarToNonZero(const SCEV *V, const Loop *L);
 
     /// HowManyLessThans - Return the number of times a backedge containing the
     /// specified less-than comparison will execute.  If not computable, return
@@ -353,14 +353,14 @@ namespace llvm {
                        bool Inverse);
 
     /// isImpliedCondOperands - Test whether the condition described by Pred,
-    /// LHS, and RHS is true whenever the condition desribed by Pred, FoundLHS,
+    /// LHS, and RHS is true whenever the condition described by Pred, FoundLHS,
     /// and FoundRHS is true.
     bool isImpliedCondOperands(ICmpInst::Predicate Pred,
                                const SCEV *LHS, const SCEV *RHS,
                                const SCEV *FoundLHS, const SCEV *FoundRHS);
 
     /// isImpliedCondOperandsHelper - Test whether the condition described by
-    /// Pred, LHS, and RHS is true whenever the condition desribed by Pred,
+    /// Pred, LHS, and RHS is true whenever the condition described by Pred,
     /// FoundLHS, and FoundRHS is true.
     bool isImpliedCondOperandsHelper(ICmpInst::Predicate Pred,
                                      const SCEV *LHS, const SCEV *RHS,
@@ -586,6 +586,11 @@ namespace llvm {
     /// compute a trip count, or if the loop is deleted.
     void forgetLoop(const Loop *L);
 
+    /// forgetValue - This method should be called by the client when it has
+    /// changed a value in a way that may effect its value, or which may
+    /// disconnect it from a def-use chain linking it to a loop.
+    void forgetValue(Value *V);
+
     /// GetMinTrailingZeros - Determine the minimum number of zero bits that S
     /// is guaranteed to end in (at every loop iteration).  It is, at the same
     /// time, the minimum number of times S is divisible by 2.  For example,
diff --git a/libclamav/c++/llvm/include/llvm/Analysis/ValueTracking.h b/libclamav/c++/llvm/include/llvm/Analysis/ValueTracking.h
index 7c673c3..0791b7b 100644
--- a/libclamav/c++/llvm/include/llvm/Analysis/ValueTracking.h
+++ b/libclamav/c++/llvm/include/llvm/Analysis/ValueTracking.h
@@ -124,6 +124,10 @@ namespace llvm {
   /// character is included in the result string.
   bool GetConstantStringInfo(Value *V, std::string &Str, uint64_t Offset = 0,
                              bool StopAtNul = true);
+                        
+  /// GetStringLength - If we can compute the length of the string pointed to by
+  /// the specified pointer, return 'len+1'.  If we can't, return 0.
+  uint64_t GetStringLength(Value *V);
 } // end namespace llvm
 
 #endif
diff --git a/libclamav/c++/llvm/include/llvm/Attributes.h b/libclamav/c++/llvm/include/llvm/Attributes.h
index 126c290..1296d67 100644
--- a/libclamav/c++/llvm/include/llvm/Attributes.h
+++ b/libclamav/c++/llvm/include/llvm/Attributes.h
@@ -60,11 +60,11 @@ const Attributes NoImplicitFloat = 1<<23; /// disable implicit floating point
 const Attributes Naked           = 1<<24; ///< Naked function
 const Attributes InlineHint      = 1<<25; ///< source said inlining was
                                           ///desirable
-const Attributes StackAlignment  = 31<<26; ///< Alignment of stack for
-                                           ///function (5 bits) stored as log2
-                                           ///of alignment with +1 bias
-                                           ///0 means unaligned (different from
-                                           ///alignstack(1))
+const Attributes StackAlignment  = 7<<26; ///< Alignment of stack for
+                                          ///function (3 bits) stored as log2
+                                          ///of alignment with +1 bias
+                                          ///0 means unaligned (different from
+                                          ///alignstack(1))
 
 /// @brief Attributes that only apply to function parameters.
 const Attributes ParameterOnly = ByVal | Nest | StructRet | NoCapture;
@@ -118,7 +118,7 @@ inline Attributes constructStackAlignmentFromInt(unsigned i) {
     return 0;
 
   assert(isPowerOf2_32(i) && "Alignment must be a power of two.");
-  assert(i <= 0x40000000 && "Alignment too large.");
+  assert(i <= 0x100 && "Alignment too large.");
   return (Log2_32(i)+1) << 26;
 }
 
diff --git a/libclamav/c++/llvm/include/llvm/CodeGen/AsmPrinter.h b/libclamav/c++/llvm/include/llvm/CodeGen/AsmPrinter.h
index 28a1a3e..8ade1bd 100644
--- a/libclamav/c++/llvm/include/llvm/CodeGen/AsmPrinter.h
+++ b/libclamav/c++/llvm/include/llvm/CodeGen/AsmPrinter.h
@@ -223,7 +223,7 @@ namespace llvm {
     void EmitFunctionBody();
 
     /// EmitInstruction - Targets should implement this to emit instructions.
-    virtual void EmitInstruction(const MachineInstr *MI) {
+    virtual void EmitInstruction(const MachineInstr *) {
       assert(0 && "EmitInstruction not implemented");
     }
     
@@ -356,6 +356,11 @@ namespace llvm {
     /// printOffset - This is just convenient handler for printing offsets.
     void printOffset(int64_t Offset) const;
 
+    /// isBlockOnlyReachableByFallthough - Return true if the basic block has
+    /// exactly one predecessor and the control transfer mechanism between
+    /// the predecessor and this block is a fall-through.
+    virtual bool isBlockOnlyReachableByFallthrough(const MachineBasicBlock *MBB) const;
+
   private:
 
     /// processDebugLoc - Processes the debug information of each machine
diff --git a/libclamav/c++/llvm/include/llvm/CodeGen/DAGISelHeader.h b/libclamav/c++/llvm/include/llvm/CodeGen/DAGISelHeader.h
deleted file mode 100644
index f9490a7..0000000
--- a/libclamav/c++/llvm/include/llvm/CodeGen/DAGISelHeader.h
+++ /dev/null
@@ -1,399 +0,0 @@
-//==-llvm/CodeGen/DAGISelHeader.h - Common DAG ISel definitions  -*- C++ -*-==//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file provides definitions of the common, target-independent methods and 
-// data, which is used by SelectionDAG-based instruction selectors.
-//
-// *** NOTE: This file is #included into the middle of the target
-// instruction selector class.  These functions are really methods.
-// This is a little awkward, but it allows this code to be shared
-// by all the targets while still being able to call into
-// target-specific code without using a virtual function call.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_CODEGEN_DAGISEL_HEADER_H
-#define LLVM_CODEGEN_DAGISEL_HEADER_H
-
-/// ISelPosition - Node iterator marking the current position of
-/// instruction selection as it procedes through the topologically-sorted
-/// node list.
-SelectionDAG::allnodes_iterator ISelPosition;
-
-/// IsChainCompatible - Returns true if Chain is Op or Chain does
-/// not reach Op.
-static bool IsChainCompatible(SDNode *Chain, SDNode *Op) {
-  if (Chain->getOpcode() == ISD::EntryToken)
-    return true;
-  if (Chain->getOpcode() == ISD::TokenFactor)
-    return false;
-  if (Chain->getNumOperands() > 0) {
-    SDValue C0 = Chain->getOperand(0);
-    if (C0.getValueType() == MVT::Other)
-      return C0.getNode() != Op && IsChainCompatible(C0.getNode(), Op);
-  }
-  return true;
-}
-
-/// ISelUpdater - helper class to handle updates of the 
-/// instruciton selection graph.
-class VISIBILITY_HIDDEN ISelUpdater : public SelectionDAG::DAGUpdateListener {
-  SelectionDAG::allnodes_iterator &ISelPosition;
-public:
-  explicit ISelUpdater(SelectionDAG::allnodes_iterator &isp)
-    : ISelPosition(isp) {}
-  
-  /// NodeDeleted - Handle nodes deleted from the graph. If the
-  /// node being deleted is the current ISelPosition node, update
-  /// ISelPosition.
-  ///
-  virtual void NodeDeleted(SDNode *N, SDNode *E) {
-    if (ISelPosition == SelectionDAG::allnodes_iterator(N))
-      ++ISelPosition;
-  }
-
-  /// NodeUpdated - Ignore updates for now.
-  virtual void NodeUpdated(SDNode *N) {}
-};
-
-/// ReplaceUses - replace all uses of the old node F with the use
-/// of the new node T.
-DISABLE_INLINE void ReplaceUses(SDValue F, SDValue T) {
-  ISelUpdater ISU(ISelPosition);
-  CurDAG->ReplaceAllUsesOfValueWith(F, T, &ISU);
-}
-
-/// ReplaceUses - replace all uses of the old nodes F with the use
-/// of the new nodes T.
-DISABLE_INLINE void ReplaceUses(const SDValue *F, const SDValue *T,
-                                unsigned Num) {
-  ISelUpdater ISU(ISelPosition);
-  CurDAG->ReplaceAllUsesOfValuesWith(F, T, Num, &ISU);
-}
-
-/// ReplaceUses - replace all uses of the old node F with the use
-/// of the new node T.
-DISABLE_INLINE void ReplaceUses(SDNode *F, SDNode *T) {
-  ISelUpdater ISU(ISelPosition);
-  CurDAG->ReplaceAllUsesWith(F, T, &ISU);
-}
-
-/// SelectRoot - Top level entry to DAG instruction selector.
-/// Selects instructions starting at the root of the current DAG.
-void SelectRoot(SelectionDAG &DAG) {
-  SelectRootInit();
-
-  // Create a dummy node (which is not added to allnodes), that adds
-  // a reference to the root node, preventing it from being deleted,
-  // and tracking any changes of the root.
-  HandleSDNode Dummy(CurDAG->getRoot());
-  ISelPosition = llvm::next(SelectionDAG::allnodes_iterator(CurDAG->getRoot().getNode()));
-
-  // The AllNodes list is now topological-sorted. Visit the
-  // nodes by starting at the end of the list (the root of the
-  // graph) and preceding back toward the beginning (the entry
-  // node).
-  while (ISelPosition != CurDAG->allnodes_begin()) {
-    SDNode *Node = --ISelPosition;
-    // Skip dead nodes. DAGCombiner is expected to eliminate all dead nodes,
-    // but there are currently some corner cases that it misses. Also, this
-    // makes it theoretically possible to disable the DAGCombiner.
-    if (Node->use_empty())
-      continue;
-#if 0
-    DAG.setSubgraphColor(Node, "red");
-#endif
-    SDNode *ResNode = Select(Node);
-    // If node should not be replaced, continue with the next one.
-    if (ResNode == Node)
-      continue;
-    // Replace node.
-    if (ResNode) {
-#if 0
-      DAG.setSubgraphColor(ResNode, "yellow");
-      DAG.setSubgraphColor(ResNode, "black");
-#endif
-      ReplaceUses(Node, ResNode);
-    }
-    // If after the replacement this node is not used any more,
-    // remove this dead node.
-    if (Node->use_empty()) { // Don't delete EntryToken, etc.
-      ISelUpdater ISU(ISelPosition);
-      CurDAG->RemoveDeadNode(Node, &ISU);
-    }
-  }
-
-  CurDAG->setRoot(Dummy.getValue());
-}
-
-
-/// CheckInteger - Return true if the specified node is not a ConstantSDNode or
-/// if it doesn't have the specified value.
-static bool CheckInteger(SDValue V, int64_t Val) {
-  ConstantSDNode *C = dyn_cast<ConstantSDNode>(V);
-  return C == 0 || C->getSExtValue() != Val;
-}
-
-/// CheckAndImmediate - Check to see if the specified node is an and with an
-/// immediate returning true on failure.
-///
-/// FIXME: Inline this gunk into CheckAndMask.
-bool CheckAndImmediate(SDValue V, int64_t Val) {
-  if (V->getOpcode() == ISD::AND)
-    if (ConstantSDNode *C = dyn_cast<ConstantSDNode>(V->getOperand(1)))
-      if (CheckAndMask(V.getOperand(0), C, Val))
-        return false;
-  return true;
-}
-
-/// CheckOrImmediate - Check to see if the specified node is an or with an
-/// immediate returning true on failure.
-///
-/// FIXME: Inline this gunk into CheckOrMask.
-bool CheckOrImmediate(SDValue V, int64_t Val) {
-  if (V->getOpcode() == ISD::OR)
-    if (ConstantSDNode *C = dyn_cast<ConstantSDNode>(V->getOperand(1)))
-      if (CheckOrMask(V.getOperand(0), C, Val))
-        return false;
-  return true;
-}
-
-static int8_t GetInt1(const unsigned char *MatcherTable, unsigned &Idx) {
-  return MatcherTable[Idx++];
-}
-
-static int16_t GetInt2(const unsigned char *MatcherTable, unsigned &Idx) {
-  int16_t Val = GetInt1(MatcherTable, Idx);
-  Val |= int16_t(GetInt1(MatcherTable, Idx)) << 8;
-  return Val;
-}
-
-static int32_t GetInt4(const unsigned char *MatcherTable, unsigned &Idx) {
-  int32_t Val = GetInt2(MatcherTable, Idx);
-  Val |= int32_t(GetInt2(MatcherTable, Idx)) << 16;
-  return Val;
-}
-
-static int64_t GetInt8(const unsigned char *MatcherTable, unsigned &Idx) {
-  int64_t Val = GetInt4(MatcherTable, Idx);
-  Val |= int64_t(GetInt4(MatcherTable, Idx)) << 32;
-  return Val;
-}
-
-enum BuiltinOpcodes {
-  OPC_Emit,
-  OPC_Push,
-  OPC_Record,
-  OPC_MoveChild,
-  OPC_MoveParent,
-  OPC_CheckSame,
-  OPC_CheckPatternPredicate,
-  OPC_CheckPredicate,
-  OPC_CheckOpcode,
-  OPC_CheckType,
-  OPC_CheckInteger1, OPC_CheckInteger2, OPC_CheckInteger4, OPC_CheckInteger8,
-  OPC_CheckCondCode,
-  OPC_CheckValueType,
-  OPC_CheckComplexPat,
-  OPC_CheckAndImm1, OPC_CheckAndImm2, OPC_CheckAndImm4, OPC_CheckAndImm8,
-  OPC_CheckOrImm1, OPC_CheckOrImm2, OPC_CheckOrImm4, OPC_CheckOrImm8
-};
-
-struct MatchScope {
-  /// FailIndex - If this match fails, this is the index to continue with.
-  unsigned FailIndex;
-  
-  /// NodeStackSize - The size of the node stack when the scope was formed.
-  unsigned NodeStackSize;
-  
-  /// NumRecordedNodes - The number of recorded nodes when the scope was formed.
-  unsigned NumRecordedNodes;
-};
-
-SDNode *SelectCodeCommon(SDNode *NodeToMatch, const unsigned char *MatcherTable,
-                         unsigned TableSize) {
-  switch (NodeToMatch->getOpcode()) {
-  default:
-    break;
-  case ISD::EntryToken:       // These nodes remain the same.
-  case ISD::BasicBlock:
-  case ISD::Register:
-  case ISD::HANDLENODE:
-  case ISD::TargetConstant:
-  case ISD::TargetConstantFP:
-  case ISD::TargetConstantPool:
-  case ISD::TargetFrameIndex:
-  case ISD::TargetExternalSymbol:
-  case ISD::TargetBlockAddress:
-  case ISD::TargetJumpTable:
-  case ISD::TargetGlobalTLSAddress:
-  case ISD::TargetGlobalAddress:
-  case ISD::TokenFactor:
-  case ISD::CopyFromReg:
-  case ISD::CopyToReg:
-    return 0;
-  case ISD::AssertSext:
-  case ISD::AssertZext:
-    ReplaceUses(SDValue(NodeToMatch, 0), NodeToMatch->getOperand(0));
-    return 0;
-  case ISD::INLINEASM: return Select_INLINEASM(NodeToMatch);
-  case ISD::EH_LABEL:  return Select_EH_LABEL(NodeToMatch);
-  case ISD::UNDEF:     return Select_UNDEF(NodeToMatch);
-  }
-  
-  assert(!NodeToMatch->isMachineOpcode() && "Node already selected!");
-  
-  SmallVector<MatchScope, 8> MatchScopes;
-  
-  // RecordedNodes - This is the set of nodes that have been recorded by the
-  // state machine.
-  SmallVector<SDValue, 8> RecordedNodes;
-  
-  // Set up the node stack with NodeToMatch as the only node on the stack.
-  SmallVector<SDValue, 8> NodeStack;
-  SDValue N = SDValue(NodeToMatch, 0);
-  NodeStack.push_back(N);
-  
-  // Interpreter starts at opcode #0.
-  unsigned MatcherIndex = 0;
-  while (1) {
-    assert(MatcherIndex < TableSize && "Invalid index");
-    switch ((BuiltinOpcodes)MatcherTable[MatcherIndex++]) {
-    case OPC_Emit: {
-      errs() << "EMIT NODE\n";
-      return 0;
-    }
-    case OPC_Push: {
-      unsigned NumToSkip = MatcherTable[MatcherIndex++];
-      MatchScope NewEntry;
-      NewEntry.FailIndex = MatcherIndex+NumToSkip;
-      NewEntry.NodeStackSize = NodeStack.size();
-      NewEntry.NumRecordedNodes = RecordedNodes.size();
-      MatchScopes.push_back(NewEntry);
-      continue;
-    }
-    case OPC_Record:
-      // Remember this node, it may end up being an operand in the pattern.
-      RecordedNodes.push_back(N);
-      continue;
-        
-    case OPC_MoveChild: {
-      unsigned Child = MatcherTable[MatcherIndex++];
-      if (Child >= N.getNumOperands())
-        break;  // Match fails if out of range child #.
-      N = N.getOperand(Child);
-      NodeStack.push_back(N);
-      continue;
-    }
-        
-    case OPC_MoveParent:
-      // Pop the current node off the NodeStack.
-      NodeStack.pop_back();
-      assert(!NodeStack.empty() && "Node stack imbalance!");
-      N = NodeStack.back();  
-      continue;
-     
-    case OPC_CheckSame: {
-      // Accept if it is exactly the same as a previously recorded node.
-      unsigned RecNo = MatcherTable[MatcherIndex++];
-      assert(RecNo < RecordedNodes.size() && "Invalid CheckSame");
-      if (N != RecordedNodes[RecNo]) break;
-      continue;
-    }
-    case OPC_CheckPatternPredicate: {
-      unsigned PredNo = MatcherTable[MatcherIndex++];
-      (void)PredNo;
-      // FIXME: CHECK IT.
-      continue;
-    }
-    case OPC_CheckPredicate: {
-      unsigned PredNo = MatcherTable[MatcherIndex++];
-      (void)PredNo;
-      // FIXME: CHECK IT.
-      continue;
-    }
-    case OPC_CheckComplexPat: {
-      unsigned PatNo = MatcherTable[MatcherIndex++];
-      (void)PatNo;
-      // FIXME: CHECK IT.
-      continue;
-    }
-        
-    case OPC_CheckOpcode:
-      if (N->getOpcode() != MatcherTable[MatcherIndex++]) break;
-      continue;
-    case OPC_CheckType:
-      if (N.getValueType() !=
-          (MVT::SimpleValueType)MatcherTable[MatcherIndex++]) break;
-      continue;
-    case OPC_CheckCondCode:
-      if (cast<CondCodeSDNode>(N)->get() !=
-          (ISD::CondCode)MatcherTable[MatcherIndex++]) break;
-      continue;
-    case OPC_CheckValueType:
-      if (cast<VTSDNode>(N)->getVT() !=
-          (MVT::SimpleValueType)MatcherTable[MatcherIndex++]) break;
-      continue;
-
-    case OPC_CheckInteger1:
-      if (CheckInteger(N, GetInt1(MatcherTable, MatcherIndex))) break;
-      continue;
-    case OPC_CheckInteger2:
-      if (CheckInteger(N, GetInt2(MatcherTable, MatcherIndex))) break;
-      continue;
-    case OPC_CheckInteger4:
-      if (CheckInteger(N, GetInt4(MatcherTable, MatcherIndex))) break;
-      continue;
-    case OPC_CheckInteger8:
-      if (CheckInteger(N, GetInt8(MatcherTable, MatcherIndex))) break;
-      continue;
-        
-    case OPC_CheckAndImm1:
-      if (CheckAndImmediate(N, GetInt1(MatcherTable, MatcherIndex))) break;
-      continue;
-    case OPC_CheckAndImm2:
-      if (CheckAndImmediate(N, GetInt2(MatcherTable, MatcherIndex))) break;
-      continue;
-    case OPC_CheckAndImm4:
-      if (CheckAndImmediate(N, GetInt4(MatcherTable, MatcherIndex))) break;
-      continue;
-    case OPC_CheckAndImm8:
-      if (CheckAndImmediate(N, GetInt8(MatcherTable, MatcherIndex))) break;
-      continue;
-
-    case OPC_CheckOrImm1:
-      if (CheckOrImmediate(N, GetInt1(MatcherTable, MatcherIndex))) break;
-      continue;
-    case OPC_CheckOrImm2:
-      if (CheckOrImmediate(N, GetInt2(MatcherTable, MatcherIndex))) break;
-      continue;
-    case OPC_CheckOrImm4:
-      if (CheckOrImmediate(N, GetInt4(MatcherTable, MatcherIndex))) break;
-      continue;
-    case OPC_CheckOrImm8:
-      if (CheckOrImmediate(N, GetInt8(MatcherTable, MatcherIndex))) break;
-      continue;
-    }
-    
-    // If the code reached this point, then the match failed pop out to the next
-    // match scope.
-    if (MatchScopes.empty()) {
-      CannotYetSelect(NodeToMatch);
-      return 0;
-    }
-    
-    RecordedNodes.resize(MatchScopes.back().NumRecordedNodes);
-    NodeStack.resize(MatchScopes.back().NodeStackSize);
-    MatcherIndex = MatchScopes.back().FailIndex;
-    MatchScopes.pop_back();
-  }
-}
-    
-
-#endif /* LLVM_CODEGEN_DAGISEL_HEADER_H */
diff --git a/libclamav/c++/llvm/include/llvm/CodeGen/LiveInterval.h b/libclamav/c++/llvm/include/llvm/CodeGen/LiveInterval.h
index 512c94d..eb5901c 100644
--- a/libclamav/c++/llvm/include/llvm/CodeGen/LiveInterval.h
+++ b/libclamav/c++/llvm/include/llvm/CodeGen/LiveInterval.h
@@ -569,6 +569,16 @@ namespace llvm {
     ///
     unsigned getSize() const;
 
+    /// isSpillable - Can this interval be spilled?
+    bool isSpillable() const {
+      return weight != HUGE_VALF;
+    }
+
+    /// markNotSpillable - Mark interval as not spillable
+    void markNotSpillable() {
+      weight = HUGE_VALF;
+    }
+
     /// ComputeJoinedWeight - Set the weight of a live interval after
     /// Other has been merged into it.
     void ComputeJoinedWeight(const LiveInterval &Other);
diff --git a/libclamav/c++/llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h b/libclamav/c++/llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h
index d7ff8da..e8856ac 100644
--- a/libclamav/c++/llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h
+++ b/libclamav/c++/llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h
@@ -70,8 +70,15 @@ namespace llvm {
     static char ID; // Pass identification, replacement for typeid
     LiveIntervals() : MachineFunctionPass(&ID) {}
 
-    static float getSpillWeight(bool isDef, bool isUse, unsigned loopDepth) {
-      return (isDef + isUse) * powf(10.0F, (float)loopDepth);
+    // Calculate the spill weight to assign to a single instruction.
+    static float getSpillWeight(bool isDef, bool isUse, unsigned loopDepth);
+
+    // After summing the spill weights of all defs and uses, the final weight
+    // should be normalized, dividing the weight of the interval by its size.
+    // This encourages spilling of intervals that are large and have few uses,
+    // and discourages spilling of small intervals with many uses.
+    void normalizeSpillWeight(LiveInterval &li) {
+      li.weight /= getApproximateInstructionCount(li) + 25;
     }
 
     typedef Reg2IntervalMap::iterator iterator;
@@ -409,6 +416,9 @@ namespace llvm {
         DenseMap<unsigned,unsigned> &MBBVRegsMap,
         std::vector<LiveInterval*> &NewLIs);
 
+    // Normalize the spill weight of all the intervals in NewLIs.
+    void normalizeSpillWeights(std::vector<LiveInterval*> &NewLIs);
+
     static LiveInterval* createInterval(unsigned Reg);
 
     void printInstrs(raw_ostream &O) const;
diff --git a/libclamav/c++/llvm/include/llvm/CodeGen/LiveVariables.h b/libclamav/c++/llvm/include/llvm/CodeGen/LiveVariables.h
index a7bf600..fc5ea6f 100644
--- a/libclamav/c++/llvm/include/llvm/CodeGen/LiveVariables.h
+++ b/libclamav/c++/llvm/include/llvm/CodeGen/LiveVariables.h
@@ -124,6 +124,11 @@ private:
   ///
   std::vector<VarInfo> VirtRegInfo;
 
+  /// PHIJoins - list of virtual registers that are PHI joins. These registers
+  /// may have multiple definitions, and they require special handling when
+  /// building live intervals.
+  SparseBitVector<> PHIJoins;
+
   /// ReservedRegisters - This vector keeps track of which registers
   /// are reserved register which are not allocatable by the target machine.
   /// We can not track liveness for values that are in this set.
@@ -295,6 +300,12 @@ public:
   void addNewBlock(MachineBasicBlock *BB,
                    MachineBasicBlock *DomBB,
                    MachineBasicBlock *SuccBB);
+
+  /// isPHIJoin - Return true if Reg is a phi join register.
+  bool isPHIJoin(unsigned Reg) { return PHIJoins.test(Reg); }
+
+  /// setPHIJoin - Mark Reg as a phi join register.
+  void setPHIJoin(unsigned Reg) { PHIJoins.set(Reg); }
 };
 
 } // End llvm namespace
diff --git a/libclamav/c++/llvm/include/llvm/CodeGen/MachineBasicBlock.h b/libclamav/c++/llvm/include/llvm/CodeGen/MachineBasicBlock.h
index db82ba5..d92650b 100644
--- a/libclamav/c++/llvm/include/llvm/CodeGen/MachineBasicBlock.h
+++ b/libclamav/c++/llvm/include/llvm/CodeGen/MachineBasicBlock.h
@@ -285,11 +285,6 @@ public:
   /// it returns end()
   iterator getFirstTerminator();
 
-  /// isOnlyReachableViaFallthough - Return true if this basic block has
-  /// exactly one predecessor and the control transfer mechanism between
-  /// the predecessor and this block is a fall-through.
-  bool isOnlyReachableByFallthrough() const;
-
   void pop_front() { Insts.pop_front(); }
   void pop_back() { Insts.pop_back(); }
   void push_back(MachineInstr *MI) { Insts.push_back(MI); }
diff --git a/libclamav/c++/llvm/include/llvm/CodeGen/MachineInstr.h b/libclamav/c++/llvm/include/llvm/CodeGen/MachineInstr.h
index 6e33fb3..d84f882 100644
--- a/libclamav/c++/llvm/include/llvm/CodeGen/MachineInstr.h
+++ b/libclamav/c++/llvm/include/llvm/CodeGen/MachineInstr.h
@@ -179,17 +179,16 @@ public:
     return MemRefsEnd - MemRefs == 1;
   }
 
+  enum MICheckType {
+    CheckDefs,      // Check all operands for equality
+    IgnoreDefs,     // Ignore all definitions
+    IgnoreVRegDefs  // Ignore virtual register definitions
+  };
+
   /// isIdenticalTo - Return true if this instruction is identical to (same
   /// opcode and same operands as) the specified instruction.
-  bool isIdenticalTo(const MachineInstr *Other) const {
-    if (Other->getOpcode() != getOpcode() ||
-        Other->getNumOperands() != getNumOperands())
-      return false;
-    for (unsigned i = 0, e = getNumOperands(); i != e; ++i)
-      if (!getOperand(i).isIdenticalTo(Other->getOperand(i)))
-        return false;
-    return true;
-  }
+  bool isIdenticalTo(const MachineInstr *Other,
+                     MICheckType Check = CheckDefs) const;
 
   /// removeFromParent - This method unlinks 'this' from the containing basic
   /// block, and returns it, but does not delete it.
@@ -331,13 +330,13 @@ public:
   /// isSafeToMove - Return true if it is safe to move this instruction. If
   /// SawStore is set to true, it means that there is a store (or call) between
   /// the instruction's location and its intended destination.
-  bool isSafeToMove(const TargetInstrInfo *TII, bool &SawStore,
-                    AliasAnalysis *AA) const;
+  bool isSafeToMove(const TargetInstrInfo *TII, AliasAnalysis *AA,
+                    bool &SawStore) const;
 
   /// isSafeToReMat - Return true if it's safe to rematerialize the specified
   /// instruction which defined the specified register instead of copying it.
-  bool isSafeToReMat(const TargetInstrInfo *TII, unsigned DstReg,
-                     AliasAnalysis *AA) const;
+  bool isSafeToReMat(const TargetInstrInfo *TII, AliasAnalysis *AA,
+                     unsigned DstReg) const;
 
   /// hasVolatileMemoryRef - Return true if this instruction may have a
   /// volatile memory reference, or if the information describing the
@@ -420,6 +419,30 @@ private:
   void AddRegOperandsToUseLists(MachineRegisterInfo &RegInfo);
 };
 
+/// MachineInstrExpressionTrait - Special DenseMapInfo traits to compare
+/// MachineInstr* by *value* of the instruction rather than by pointer value.
+/// The hashing and equality testing functions ignore definitions so this is
+/// useful for CSE, etc.
+struct MachineInstrExpressionTrait : DenseMapInfo<MachineInstr*> {
+  static inline MachineInstr *getEmptyKey() {
+    return 0;
+  }
+
+  static inline MachineInstr *getTombstoneKey() {
+    return reinterpret_cast<MachineInstr*>(-1);
+  }
+
+  static unsigned getHashValue(const MachineInstr* const &MI);
+
+  static bool isEqual(const MachineInstr* const &LHS,
+                      const MachineInstr* const &RHS) {
+    if (RHS == getEmptyKey() || RHS == getTombstoneKey() ||
+        LHS == getEmptyKey() || LHS == getTombstoneKey())
+      return LHS == RHS;
+    return LHS->isIdenticalTo(RHS, MachineInstr::IgnoreVRegDefs);
+  }
+};
+
 //===----------------------------------------------------------------------===//
 // Debugging Support
 
diff --git a/libclamav/c++/llvm/include/llvm/CodeGen/MachineInstrBuilder.h b/libclamav/c++/llvm/include/llvm/CodeGen/MachineInstrBuilder.h
index a263a97..47f7cf7 100644
--- a/libclamav/c++/llvm/include/llvm/CodeGen/MachineInstrBuilder.h
+++ b/libclamav/c++/llvm/include/llvm/CodeGen/MachineInstrBuilder.h
@@ -127,7 +127,7 @@ public:
     return *this;
   }
 
-  const MachineInstrBuilder &addMetadata(MDNode *MD) const {
+  const MachineInstrBuilder &addMetadata(const MDNode *MD) const {
     MI->addOperand(MachineOperand::CreateMetadata(MD));
     return *this;
   }
diff --git a/libclamav/c++/llvm/include/llvm/CodeGen/MachineMemOperand.h b/libclamav/c++/llvm/include/llvm/CodeGen/MachineMemOperand.h
index 5dee199..7272aa5 100644
--- a/libclamav/c++/llvm/include/llvm/CodeGen/MachineMemOperand.h
+++ b/libclamav/c++/llvm/include/llvm/CodeGen/MachineMemOperand.h
@@ -46,7 +46,11 @@ public:
     /// The memory access writes data.
     MOStore = 2,
     /// The memory access is volatile.
-    MOVolatile = 4
+    MOVolatile = 4,
+    /// The memory access is non-temporal.
+    MONonTemporal = 8,
+    // This is the number of bits we need to represent flags.
+    MOMaxBits = 4
   };
 
   /// MachineMemOperand - Construct an MachineMemOperand object with the
@@ -64,7 +68,7 @@ public:
   const Value *getValue() const { return V; }
 
   /// getFlags - Return the raw flags of the source value, \see MemOperandFlags.
-  unsigned int getFlags() const { return Flags & 7; }
+  unsigned int getFlags() const { return Flags & ((1 << MOMaxBits) - 1); }
 
   /// getOffset - For normal values, this is a byte offset added to the base
   /// address. For PseudoSourceValue::FPRel values, this is the FrameIndex
@@ -80,11 +84,12 @@ public:
 
   /// getBaseAlignment - Return the minimum known alignment in bytes of the
   /// base address, without the offset.
-  uint64_t getBaseAlignment() const { return (1u << (Flags >> 3)) >> 1; }
+  uint64_t getBaseAlignment() const { return (1u << (Flags >> MOMaxBits)) >> 1; }
 
   bool isLoad() const { return Flags & MOLoad; }
   bool isStore() const { return Flags & MOStore; }
   bool isVolatile() const { return Flags & MOVolatile; }
+  bool isNonTemporal() const { return Flags & MONonTemporal; }
 
   /// refineAlignment - Update this MachineMemOperand to reflect the alignment
   /// of MMO, if it has a greater alignment. This must only be used when the
diff --git a/libclamav/c++/llvm/include/llvm/CodeGen/MachineModuleInfo.h b/libclamav/c++/llvm/include/llvm/CodeGen/MachineModuleInfo.h
index 556ba7f..8eeac9f 100644
--- a/libclamav/c++/llvm/include/llvm/CodeGen/MachineModuleInfo.h
+++ b/libclamav/c++/llvm/include/llvm/CodeGen/MachineModuleInfo.h
@@ -50,6 +50,7 @@ namespace llvm {
 //===----------------------------------------------------------------------===//
 // Forward declarations.
 class Constant;
+class MCSymbol;
 class MDNode;
 class GlobalVariable;
 class MachineBasicBlock;
@@ -66,6 +67,12 @@ class StructType;
 class MachineModuleInfoImpl {
 public:
   virtual ~MachineModuleInfoImpl();
+
+  typedef std::vector<std::pair<MCSymbol*, MCSymbol*> >
+      SymbolListTy;
+protected:
+    static SymbolListTy
+    GetSortedStubs(const DenseMap<MCSymbol*, MCSymbol*> &Map);
 };
   
   
diff --git a/libclamav/c++/llvm/include/llvm/CodeGen/MachineModuleInfoImpls.h b/libclamav/c++/llvm/include/llvm/CodeGen/MachineModuleInfoImpls.h
index 6679990..89b8207 100644
--- a/libclamav/c++/llvm/include/llvm/CodeGen/MachineModuleInfoImpls.h
+++ b/libclamav/c++/llvm/include/llvm/CodeGen/MachineModuleInfoImpls.h
@@ -19,7 +19,7 @@
 
 namespace llvm {
   class MCSymbol;
-  
+
   /// MachineModuleInfoMachO - This is a MachineModuleInfoImpl implementation
   /// for MachO targets.
   class MachineModuleInfoMachO : public MachineModuleInfoImpl {
@@ -54,10 +54,8 @@ namespace llvm {
       assert(Sym && "Key cannot be null");
       return HiddenGVStubs[Sym];
     }
-    
+
     /// Accessor methods to return the set of stubs in sorted order.
-    typedef std::vector<std::pair<MCSymbol*, MCSymbol*> > SymbolListTy;
-    
     SymbolListTy GetFnStubList() const {
       return GetSortedStubs(FnStubs);
     }
@@ -67,12 +65,31 @@ namespace llvm {
     SymbolListTy GetHiddenGVStubList() const {
       return GetSortedStubs(HiddenGVStubs);
     }
-    
-  private:
-    static SymbolListTy
-    GetSortedStubs(const DenseMap<MCSymbol*, MCSymbol*> &Map);
   };
-  
+
+  /// MachineModuleInfoELF - This is a MachineModuleInfoImpl implementation
+  /// for ELF targets.
+  class MachineModuleInfoELF : public MachineModuleInfoImpl {
+    /// GVStubs - These stubs are used to materialize global addresses in PIC
+    /// mode.
+    DenseMap<MCSymbol*, MCSymbol*> GVStubs;
+
+    virtual void Anchor();  // Out of line virtual method.
+  public:
+    MachineModuleInfoELF(const MachineModuleInfo &) {}
+
+    MCSymbol *&getGVStubEntry(MCSymbol *Sym) {
+      assert(Sym && "Key cannot be null");
+      return GVStubs[Sym];
+    }
+
+    /// Accessor methods to return the set of stubs in sorted order.
+
+    SymbolListTy GetGVStubList() const {
+      return GetSortedStubs(GVStubs);
+    }
+  };
+
 } // end namespace llvm
 
 #endif
diff --git a/libclamav/c++/llvm/include/llvm/CodeGen/MachineOperand.h b/libclamav/c++/llvm/include/llvm/CodeGen/MachineOperand.h
index dac0092..0978057 100644
--- a/libclamav/c++/llvm/include/llvm/CodeGen/MachineOperand.h
+++ b/libclamav/c++/llvm/include/llvm/CodeGen/MachineOperand.h
@@ -19,14 +19,14 @@
 
 namespace llvm {
   
-class ConstantFP;
 class BlockAddress;
-class MachineBasicBlock;
+class ConstantFP;
 class GlobalValue;
+class MachineBasicBlock;
 class MachineInstr;
-class TargetMachine;
 class MachineRegisterInfo;
 class MDNode;
+class TargetMachine;
 class raw_ostream;
   
 /// MachineOperand class - Representation of each machine instruction operand.
@@ -100,7 +100,7 @@ private:
     MachineBasicBlock *MBB;   // For MO_MachineBasicBlock.
     const ConstantFP *CFP;    // For MO_FPImmediate.
     int64_t ImmVal;           // For MO_Immediate.
-    MDNode *MD;               // For MO_Metadata.
+    const MDNode *MD;         // For MO_Metadata.
 
     struct {                  // For MO_Register.
       unsigned RegNo;
@@ -467,7 +467,7 @@ public:
     Op.setTargetFlags(TargetFlags);
     return Op;
   }
-  static MachineOperand CreateMetadata(MDNode *Meta) {
+  static MachineOperand CreateMetadata(const MDNode *Meta) {
     MachineOperand Op(MachineOperand::MO_Metadata);
     Op.Contents.MD = Meta;
     return Op;
diff --git a/libclamav/c++/llvm/include/llvm/CodeGen/MachineRegisterInfo.h b/libclamav/c++/llvm/include/llvm/CodeGen/MachineRegisterInfo.h
index 01dc018..f2e5e10 100644
--- a/libclamav/c++/llvm/include/llvm/CodeGen/MachineRegisterInfo.h
+++ b/libclamav/c++/llvm/include/llvm/CodeGen/MachineRegisterInfo.h
@@ -115,6 +115,10 @@ public:
   /// register.
   bool use_empty(unsigned RegNo) const { return use_begin(RegNo) == use_end(); }
 
+  /// hasOneUse - Return true if there is exactly one instruction using the
+  /// specified register.
+  bool hasOneUse(unsigned RegNo) const;
+
   /// use_nodbg_iterator/use_nodbg_begin/use_nodbg_end - Walk all uses of the
   /// specified register, skipping those marked as Debug.
   typedef defusechain_iterator<true,false,true> use_nodbg_iterator;
@@ -129,6 +133,10 @@ public:
     return use_nodbg_begin(RegNo) == use_nodbg_end();
   }
 
+  /// hasOneNonDBGUse - Return true if there is exactly one non-Debug
+  /// instruction using the specified register.
+  bool hasOneNonDBGUse(unsigned RegNo) const;
+
   /// replaceRegWith - Replace all instances of FromReg with ToReg in the
   /// machine function.  This is like llvm-level X->replaceAllUsesWith(Y),
   /// except that it also changes any definitions of the register as well.
diff --git a/libclamav/c++/llvm/include/llvm/CodeGen/Passes.h b/libclamav/c++/llvm/include/llvm/CodeGen/Passes.h
index dbc73cb..911be22 100644
--- a/libclamav/c++/llvm/include/llvm/CodeGen/Passes.h
+++ b/libclamav/c++/llvm/include/llvm/CodeGen/Passes.h
@@ -162,6 +162,10 @@ namespace llvm {
   /// 
   FunctionPass *createGCInfoPrinter(raw_ostream &OS);
   
+  /// createMachineCSEPass - This pass performs global CSE on machine
+  /// instructions.
+  FunctionPass *createMachineCSEPass();
+
   /// createMachineLICMPass - This pass performs LICM on machine instructions.
   /// 
   FunctionPass *createMachineLICMPass();
@@ -187,7 +191,7 @@ namespace llvm {
   /// createMachineVerifierPass - This pass verifies cenerated machine code
   /// instructions for correctness.
   ///
-  /// @param allowPhysDoubleDefs ignore double definitions of
+  /// @param allowDoubleDefs ignore double definitions of
   ///        registers. Useful before LiveVariables has run.
   FunctionPass *createMachineVerifierPass(bool allowDoubleDefs);
 
diff --git a/libclamav/c++/llvm/include/llvm/CodeGen/SelectionDAG.h b/libclamav/c++/llvm/include/llvm/CodeGen/SelectionDAG.h
index 60014f8..ad01e89 100644
--- a/libclamav/c++/llvm/include/llvm/CodeGen/SelectionDAG.h
+++ b/libclamav/c++/llvm/include/llvm/CodeGen/SelectionDAG.h
@@ -581,18 +581,18 @@ public:
   /// determined by their operands, and they produce a value AND a token chain.
   ///
   SDValue getLoad(EVT VT, DebugLoc dl, SDValue Chain, SDValue Ptr,
-                    const Value *SV, int SVOffset, bool isVolatile=false,
-                    unsigned Alignment=0);
+                  const Value *SV, int SVOffset, bool isVolatile,
+                  bool isNonTemporal, unsigned Alignment);
   SDValue getExtLoad(ISD::LoadExtType ExtType, DebugLoc dl, EVT VT,
-                       SDValue Chain, SDValue Ptr, const Value *SV,
-                       int SVOffset, EVT MemVT, bool isVolatile=false,
-                       unsigned Alignment=0);
+                     SDValue Chain, SDValue Ptr, const Value *SV,
+                     int SVOffset, EVT MemVT, bool isVolatile,
+                     bool isNonTemporal, unsigned Alignment);
   SDValue getIndexedLoad(SDValue OrigLoad, DebugLoc dl, SDValue Base,
                            SDValue Offset, ISD::MemIndexedMode AM);
   SDValue getLoad(ISD::MemIndexedMode AM, DebugLoc dl, ISD::LoadExtType ExtType,
                   EVT VT, SDValue Chain, SDValue Ptr, SDValue Offset,
                   const Value *SV, int SVOffset, EVT MemVT,
-                  bool isVolatile=false, unsigned Alignment=0);
+                  bool isVolatile, bool isNonTemporal, unsigned Alignment);
   SDValue getLoad(ISD::MemIndexedMode AM, DebugLoc dl, ISD::LoadExtType ExtType,
                   EVT VT, SDValue Chain, SDValue Ptr, SDValue Offset,
                   EVT MemVT, MachineMemOperand *MMO);
@@ -600,13 +600,14 @@ public:
   /// getStore - Helper function to build ISD::STORE nodes.
   ///
   SDValue getStore(SDValue Chain, DebugLoc dl, SDValue Val, SDValue Ptr,
-                     const Value *SV, int SVOffset, bool isVolatile=false,
-                     unsigned Alignment=0);
+                   const Value *SV, int SVOffset, bool isVolatile,
+                   bool isNonTemporal, unsigned Alignment);
   SDValue getStore(SDValue Chain, DebugLoc dl, SDValue Val, SDValue Ptr,
                    MachineMemOperand *MMO);
   SDValue getTruncStore(SDValue Chain, DebugLoc dl, SDValue Val, SDValue Ptr,
-                          const Value *SV, int SVOffset, EVT TVT,
-                          bool isVolatile=false, unsigned Alignment=0);
+                        const Value *SV, int SVOffset, EVT TVT,
+                        bool isNonTemporal, bool isVolatile,
+                        unsigned Alignment);
   SDValue getTruncStore(SDValue Chain, DebugLoc dl, SDValue Val, SDValue Ptr,
                         EVT TVT, MachineMemOperand *MMO);
   SDValue getIndexedStore(SDValue OrigStoe, DebugLoc dl, SDValue Base,
@@ -667,27 +668,8 @@ public:
   SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, SDVTList VTs,
                        const SDValue *Ops, unsigned NumOps);
 
-  /// MorphNodeTo - These *mutate* the specified node to have the specified
+  /// MorphNodeTo - This *mutates* the specified node to have the specified
   /// return type, opcode, and operands.
-  SDNode *MorphNodeTo(SDNode *N, unsigned Opc, EVT VT);
-  SDNode *MorphNodeTo(SDNode *N, unsigned Opc, EVT VT, SDValue Op1);
-  SDNode *MorphNodeTo(SDNode *N, unsigned Opc, EVT VT,
-                      SDValue Op1, SDValue Op2);
-  SDNode *MorphNodeTo(SDNode *N, unsigned Opc, EVT VT,
-                      SDValue Op1, SDValue Op2, SDValue Op3);
-  SDNode *MorphNodeTo(SDNode *N, unsigned Opc, EVT VT,
-                      const SDValue *Ops, unsigned NumOps);
-  SDNode *MorphNodeTo(SDNode *N, unsigned Opc, EVT VT1, EVT VT2);
-  SDNode *MorphNodeTo(SDNode *N, unsigned Opc, EVT VT1,
-                      EVT VT2, const SDValue *Ops, unsigned NumOps);
-  SDNode *MorphNodeTo(SDNode *N, unsigned Opc, EVT VT1,
-                      EVT VT2, EVT VT3, const SDValue *Ops, unsigned NumOps);
-  SDNode *MorphNodeTo(SDNode *N, unsigned Opc, EVT VT1,
-                      EVT VT2, SDValue Op1);
-  SDNode *MorphNodeTo(SDNode *N, unsigned Opc, EVT VT1,
-                      EVT VT2, SDValue Op1, SDValue Op2);
-  SDNode *MorphNodeTo(SDNode *N, unsigned Opc, EVT VT1,
-                      EVT VT2, SDValue Op1, SDValue Op2, SDValue Op3);
   SDNode *MorphNodeTo(SDNode *N, unsigned Opc, SDVTList VTs,
                       const SDValue *Ops, unsigned NumOps);
 
@@ -897,6 +879,15 @@ public:
   /// isKnownNeverNan - Test whether the given SDValue is known to never be NaN.
   bool isKnownNeverNaN(SDValue Op) const;
 
+  /// isKnownNeverZero - Test whether the given SDValue is known to never be
+  /// positive or negative Zero.
+  bool isKnownNeverZero(SDValue Op) const;
+
+  /// isEqualTo - Test whether two SDValues are known to compare equal. This
+  /// is true if they are the same value, or if one is negative zero and the
+  /// other positive zero.
+  bool isEqualTo(SDValue A, SDValue B) const;
+
   /// isVerifiedDebugInfoDesc - Returns true if the specified SDValue has
   /// been verified as a debug information descriptor.
   bool isVerifiedDebugInfoDesc(SDValue Op) const;
diff --git a/libclamav/c++/llvm/include/llvm/CodeGen/SelectionDAGISel.h b/libclamav/c++/llvm/include/llvm/CodeGen/SelectionDAGISel.h
index b33b21d..d9c1374 100644
--- a/libclamav/c++/llvm/include/llvm/CodeGen/SelectionDAGISel.h
+++ b/libclamav/c++/llvm/include/llvm/CodeGen/SelectionDAGISel.h
@@ -68,12 +68,18 @@ public:
   unsigned MakeReg(EVT VT);
 
   virtual void EmitFunctionEntryCode(Function &Fn, MachineFunction &MF) {}
-  virtual void InstructionSelect() = 0;
   
-  void SelectRootInit() {
-    DAGSize = CurDAG->AssignTopologicalOrder();
-  }
-
+  /// PreprocessISelDAG - This hook allows targets to hack on the graph before
+  /// instruction selection starts.
+  virtual void PreprocessISelDAG() {}
+  
+  /// PostprocessISelDAG() - This hook allows the target to hack on the graph
+  /// right after selection.
+  virtual void PostprocessISelDAG() {}
+  
+  /// Select - Main hook targets implement to select a node.
+  virtual SDNode *Select(SDNode *N) = 0;
+  
   /// SelectInlineAsmMemoryOperand - Select the specified address as a target
   /// addressing mode, according to the specified constraint code.  If this does
   /// not match or is not implemented, return true.  The resultant operands
@@ -85,39 +91,197 @@ public:
     return true;
   }
 
-  /// IsLegalAndProfitableToFold - Returns true if the specific operand node N of
-  /// U can be folded during instruction selection that starts at Root and
-  /// folding N is profitable.
-  virtual
-  bool IsLegalAndProfitableToFold(SDNode *N, SDNode *U, SDNode *Root) const;
+  /// IsProfitableToFold - Returns true if it's profitable to fold the specific
+  /// operand node N of U during instruction selection that starts at Root.
+  virtual bool IsProfitableToFold(SDValue N, SDNode *U, SDNode *Root) const;
+
+  /// IsLegalToFold - Returns true if the specific operand node N of
+  /// U can be folded during instruction selection that starts at Root.
+  bool IsLegalToFold(SDValue N, SDNode *U, SDNode *Root,
+                     bool IgnoreChains = false) const;
 
   /// CreateTargetHazardRecognizer - Return a newly allocated hazard recognizer
   /// to use for this target when scheduling the DAG.
   virtual ScheduleHazardRecognizer *CreateTargetHazardRecognizer();
   
+  
+  // Opcodes used by the DAG state machine:
+  enum BuiltinOpcodes {
+    OPC_Scope,
+    OPC_RecordNode,
+    OPC_RecordChild0, OPC_RecordChild1, OPC_RecordChild2, OPC_RecordChild3, 
+    OPC_RecordChild4, OPC_RecordChild5, OPC_RecordChild6, OPC_RecordChild7,
+    OPC_RecordMemRef,
+    OPC_CaptureFlagInput,
+    OPC_MoveChild,
+    OPC_MoveParent,
+    OPC_CheckSame,
+    OPC_CheckPatternPredicate,
+    OPC_CheckPredicate,
+    OPC_CheckOpcode,
+    OPC_SwitchOpcode,
+    OPC_CheckType,
+    OPC_SwitchType,
+    OPC_CheckChild0Type, OPC_CheckChild1Type, OPC_CheckChild2Type,
+    OPC_CheckChild3Type, OPC_CheckChild4Type, OPC_CheckChild5Type,
+    OPC_CheckChild6Type, OPC_CheckChild7Type,
+    OPC_CheckInteger,
+    OPC_CheckCondCode,
+    OPC_CheckValueType,
+    OPC_CheckComplexPat,
+    OPC_CheckAndImm, OPC_CheckOrImm,
+    OPC_CheckFoldableChainNode,
+    
+    OPC_EmitInteger,
+    OPC_EmitRegister,
+    OPC_EmitConvertToTarget,
+    OPC_EmitMergeInputChains,
+    OPC_EmitCopyToReg,
+    OPC_EmitNodeXForm,
+    OPC_EmitNode,
+    OPC_MorphNodeTo,
+    OPC_MarkFlagResults,
+    OPC_CompleteMatch
+  };
+  
+  enum {
+    OPFL_None       = 0,     // Node has no chain or flag input and isn't variadic.
+    OPFL_Chain      = 1,     // Node has a chain input.
+    OPFL_FlagInput  = 2,     // Node has a flag input.
+    OPFL_FlagOutput = 4,     // Node has a flag output.
+    OPFL_MemRefs    = 8,     // Node gets accumulated MemRefs.
+    OPFL_Variadic0  = 1<<4,  // Node is variadic, root has 0 fixed inputs.
+    OPFL_Variadic1  = 2<<4,  // Node is variadic, root has 1 fixed inputs.
+    OPFL_Variadic2  = 3<<4,  // Node is variadic, root has 2 fixed inputs.
+    OPFL_Variadic3  = 4<<4,  // Node is variadic, root has 3 fixed inputs.
+    OPFL_Variadic4  = 5<<4,  // Node is variadic, root has 4 fixed inputs.
+    OPFL_Variadic5  = 6<<4,  // Node is variadic, root has 5 fixed inputs.
+    OPFL_Variadic6  = 7<<4,  // Node is variadic, root has 6 fixed inputs.
+    
+    OPFL_VariadicInfo = OPFL_Variadic6
+  };
+  
+  /// getNumFixedFromVariadicInfo - Transform an EmitNode flags word into the
+  /// number of fixed arity values that should be skipped when copying from the
+  /// root.
+  static inline int getNumFixedFromVariadicInfo(unsigned Flags) {
+    return ((Flags&OPFL_VariadicInfo) >> 4)-1;
+  }
+  
+  
 protected:
   /// DAGSize - Size of DAG being instruction selected.
   ///
   unsigned DAGSize;
+  
+  /// ISelPosition - Node iterator marking the current position of
+  /// instruction selection as it procedes through the topologically-sorted
+  /// node list.
+  SelectionDAG::allnodes_iterator ISelPosition;
+
+  
+  /// ISelUpdater - helper class to handle updates of the 
+  /// instruction selection graph.
+  class ISelUpdater : public SelectionDAG::DAGUpdateListener {
+    SelectionDAG::allnodes_iterator &ISelPosition;
+  public:
+    explicit ISelUpdater(SelectionDAG::allnodes_iterator &isp)
+      : ISelPosition(isp) {}
+    
+    /// NodeDeleted - Handle nodes deleted from the graph. If the
+    /// node being deleted is the current ISelPosition node, update
+    /// ISelPosition.
+    ///
+    virtual void NodeDeleted(SDNode *N, SDNode *E) {
+      if (ISelPosition == SelectionDAG::allnodes_iterator(N))
+        ++ISelPosition;
+    }
+    
+    /// NodeUpdated - Ignore updates for now.
+    virtual void NodeUpdated(SDNode *N) {}
+  };
+  
+  /// ReplaceUses - replace all uses of the old node F with the use
+  /// of the new node T.
+  void ReplaceUses(SDValue F, SDValue T) {
+    ISelUpdater ISU(ISelPosition);
+    CurDAG->ReplaceAllUsesOfValueWith(F, T, &ISU);
+  }
+  
+  /// ReplaceUses - replace all uses of the old nodes F with the use
+  /// of the new nodes T.
+  void ReplaceUses(const SDValue *F, const SDValue *T, unsigned Num) {
+    ISelUpdater ISU(ISelPosition);
+    CurDAG->ReplaceAllUsesOfValuesWith(F, T, Num, &ISU);
+  }
+  
+  /// ReplaceUses - replace all uses of the old node F with the use
+  /// of the new node T.
+  void ReplaceUses(SDNode *F, SDNode *T) {
+    ISelUpdater ISU(ISelPosition);
+    CurDAG->ReplaceAllUsesWith(F, T, &ISU);
+  }
+  
 
   /// SelectInlineAsmMemoryOperands - Calls to this are automatically generated
   /// by tblgen.  Others should not call it.
   void SelectInlineAsmMemoryOperands(std::vector<SDValue> &Ops);
 
+  
+public:
   // Calls to these predicates are generated by tblgen.
   bool CheckAndMask(SDValue LHS, ConstantSDNode *RHS,
                     int64_t DesiredMaskS) const;
   bool CheckOrMask(SDValue LHS, ConstantSDNode *RHS,
                     int64_t DesiredMaskS) const;
   
+  
+  /// CheckPatternPredicate - This function is generated by tblgen in the
+  /// target.  It runs the specified pattern predicate and returns true if it
+  /// succeeds or false if it fails.  The number is a private implementation
+  /// detail to the code tblgen produces.
+  virtual bool CheckPatternPredicate(unsigned PredNo) const {
+    assert(0 && "Tblgen should generate the implementation of this!");
+    return 0;
+  }
+
+  /// CheckNodePredicate - This function is generated by tblgen in the target.
+  /// It runs node predicate number PredNo and returns true if it succeeds or
+  /// false if it fails.  The number is a private implementation
+  /// detail to the code tblgen produces.
+  virtual bool CheckNodePredicate(SDNode *N, unsigned PredNo) const {
+    assert(0 && "Tblgen should generate the implementation of this!");
+    return 0;
+  }
+  
+  virtual bool CheckComplexPattern(SDNode *Root, SDValue N, unsigned PatternNo,
+                                   SmallVectorImpl<SDValue> &Result) {
+    assert(0 && "Tblgen should generate the implementation of this!");
+    return false;
+  }
+  
+  virtual SDValue RunSDNodeXForm(SDValue V, unsigned XFormNo) {
+    assert(0 && "Tblgen shoudl generate this!");
+    return SDValue();
+  }
+
+  SDNode *SelectCodeCommon(SDNode *NodeToMatch,
+                           const unsigned char *MatcherTable,
+                           unsigned TableSize);
+  
+private:
+  
   // Calls to these functions are generated by tblgen.
   SDNode *Select_INLINEASM(SDNode *N);
   SDNode *Select_UNDEF(SDNode *N);
   SDNode *Select_EH_LABEL(SDNode *N);
   void CannotYetSelect(SDNode *N);
-  void CannotYetSelectIntrinsic(SDNode *N);
 
 private:
+  void DoInstructionSelection();
+  SDNode *MorphNode(SDNode *Node, unsigned TargetOpc, SDVTList VTs,
+                    const SDValue *Ops, unsigned NumOps, unsigned EmitNodeInfo);
+  
   void SelectAllBasicBlocks(Function &Fn, MachineFunction &MF,
                             MachineModuleInfo *MMI,
                             DwarfWriter *DW,
@@ -143,6 +307,16 @@ private:
   /// one preferred by the target.
   ///
   ScheduleDAGSDNodes *CreateScheduler();
+  
+  /// OpcodeOffset - This is a cache used to dispatch efficiently into isel
+  /// state machines that start with a OPC_SwitchOpcode node.
+  std::vector<unsigned> OpcodeOffset;
+  
+  void UpdateChainsAndFlags(SDNode *NodeToMatch, SDValue InputChain,
+                            const SmallVectorImpl<SDNode*> &ChainNodesMatched,
+                            SDValue InputFlag,const SmallVectorImpl<SDNode*> &F,
+                            bool isMorphNodeTo);
+    
 };
 
 }
diff --git a/libclamav/c++/llvm/include/llvm/CodeGen/SelectionDAGNodes.h b/libclamav/c++/llvm/include/llvm/CodeGen/SelectionDAGNodes.h
index 6ba2d3b..21a0b98 100644
--- a/libclamav/c++/llvm/include/llvm/CodeGen/SelectionDAGNodes.h
+++ b/libclamav/c++/llvm/include/llvm/CodeGen/SelectionDAGNodes.h
@@ -1027,11 +1027,15 @@ private:
   /// then they will be delete[]'d when the node is destroyed.
   uint16_t OperandsNeedDelete : 1;
 
+  /// HasDebugValue - This tracks whether this node has one or more dbg_value
+  /// nodes corresponding to it.
+  uint16_t HasDebugValue : 1;
+
 protected:
   /// SubclassData - This member is defined by this class, but is not used for
   /// anything.  Subclasses can use it to hold whatever state they find useful.
   /// This field is initialized to zero by the ctor.
-  uint16_t SubclassData : 15;
+  uint16_t SubclassData : 14;
 
 private:
   /// NodeId - Unique id per SDNode in the DAG.
@@ -1094,6 +1098,12 @@ public:
     return ~NodeType;
   }
 
+  /// getHasDebugValue - get this bit.
+  bool getHasDebugValue() const { return HasDebugValue; }
+
+  /// setHasDebugValue - set this bit.
+  void setHasDebugValue(bool b) { HasDebugValue = b; }
+
   /// use_empty - Return true if there are no uses of this node.
   ///
   bool use_empty() const { return UseList == NULL; }
@@ -1357,8 +1367,8 @@ protected:
 
   SDNode(unsigned Opc, const DebugLoc dl, SDVTList VTs, const SDValue *Ops,
          unsigned NumOps)
-    : NodeType(Opc), OperandsNeedDelete(true), SubclassData(0),
-      NodeId(-1),
+    : NodeType(Opc), OperandsNeedDelete(true), HasDebugValue(false),
+      SubclassData(0), NodeId(-1),
       OperandList(NumOps ? new SDUse[NumOps] : 0),
       ValueList(VTs.VTs), UseList(NULL),
       NumOperands(NumOps), NumValues(VTs.NumVTs),
@@ -1595,7 +1605,10 @@ public:
     return SubclassData;
   }
 
+  // We access subclass data here so that we can check consistency
+  // with MachineMemOperand information.
   bool isVolatile() const { return (SubclassData >> 5) & 1; }
+  bool isNonTemporal() const { return (SubclassData >> 6) & 1; }
 
   /// Returns the SrcValue and offset that describes the location of the access
   const Value *getSrcValue() const { return MMO->getValue(); }
@@ -1761,7 +1774,12 @@ public:
   bool isSplat() const { return isSplatMask(Mask, getValueType(0)); }
   int  getSplatIndex() const { 
     assert(isSplat() && "Cannot get splat index for non-splat!");
-    return Mask[0];
+    EVT VT = getValueType(0);
+    for (unsigned i = 0, e = VT.getVectorNumElements(); i != e; ++i) {
+      if (Mask[i] != -1)
+        return Mask[i];
+    }
+    return -1;
   }
   static bool isSplatMask(const int *Mask, EVT VT);
 
@@ -1807,6 +1825,12 @@ public:
   const APFloat& getValueAPF() const { return Value->getValueAPF(); }
   const ConstantFP *getConstantFPValue() const { return Value; }
 
+  /// isZero - Return true if the value is positive or negative zero.
+  bool isZero() const { return Value->isZero(); }
+
+  /// isNaN - Return true if the value is a NaN.
+  bool isNaN() const { return Value->isNaN(); }
+
   /// isExactlyValue - We don't rely on operator== working on double values, as
   /// it returns true for things that are clearly not equal, like -0.0 and 0.0.
   /// As such, this method can be used to do an exact bit-for-bit comparison of
diff --git a/libclamav/c++/llvm/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h b/libclamav/c++/llvm/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h
new file mode 100644
index 0000000..3d99fa7
--- /dev/null
+++ b/libclamav/c++/llvm/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h
@@ -0,0 +1,207 @@
+//==-- llvm/CodeGen/TargetLoweringObjectFileImpl.h - Object Info -*- C++ -*-==//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file implements classes used to handle lowerings specific to common
+// object file formats.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_CODEGEN_TARGETLOWERINGOBJECTFILEIMPL_H
+#define LLVM_CODEGEN_TARGETLOWERINGOBJECTFILEIMPL_H
+
+#include "llvm/ADT/StringRef.h"
+#include "llvm/MC/SectionKind.h"
+#include "llvm/Target/TargetLoweringObjectFile.h"
+
+namespace llvm {
+  class MachineModuleInfo;
+  class Mangler;
+  class MCAsmInfo;
+  class MCExpr;
+  class MCSection;
+  class MCSectionMachO;
+  class MCSymbol;
+  class MCContext;
+  class GlobalValue;
+  class TargetMachine;
+
+
+class TargetLoweringObjectFileELF : public TargetLoweringObjectFile {
+  mutable void *UniquingMap;
+protected:
+  /// TLSDataSection - Section directive for Thread Local data.
+  ///
+  const MCSection *TLSDataSection;        // Defaults to ".tdata".
+
+  /// TLSBSSSection - Section directive for Thread Local uninitialized data.
+  /// Null if this target doesn't support a BSS section.
+  ///
+  const MCSection *TLSBSSSection;         // Defaults to ".tbss".
+
+  const MCSection *DataRelSection;
+  const MCSection *DataRelLocalSection;
+  const MCSection *DataRelROSection;
+  const MCSection *DataRelROLocalSection;
+
+  const MCSection *MergeableConst4Section;
+  const MCSection *MergeableConst8Section;
+  const MCSection *MergeableConst16Section;
+
+protected:
+  const MCSection *getELFSection(StringRef Section, unsigned Type,
+                                 unsigned Flags, SectionKind Kind,
+                                 bool IsExplicit = false) const;
+public:
+  TargetLoweringObjectFileELF() : UniquingMap(0) {}
+  ~TargetLoweringObjectFileELF();
+
+  virtual void Initialize(MCContext &Ctx, const TargetMachine &TM);
+
+  const MCSection *getDataRelSection() const { return DataRelSection; }
+
+  /// getSectionForConstant - Given a constant with the SectionKind, return a
+  /// section that it should be placed in.
+  virtual const MCSection *getSectionForConstant(SectionKind Kind) const;
+
+
+  virtual const MCSection *
+  getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind,
+                           Mangler *Mang, const TargetMachine &TM) const;
+
+  virtual const MCSection *
+  SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
+                         Mangler *Mang, const TargetMachine &TM) const;
+
+  /// getSymbolForDwarfGlobalReference - Return an MCExpr to use for a reference
+  /// to the specified global variable from exception handling information.
+  ///
+  virtual const MCExpr *
+  getSymbolForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang,
+                              MachineModuleInfo *MMI, unsigned Encoding) const;
+};
+
+
+
+class TargetLoweringObjectFileMachO : public TargetLoweringObjectFile {
+  mutable void *UniquingMap;
+
+  const MCSection *CStringSection;
+  const MCSection *UStringSection;
+  const MCSection *TextCoalSection;
+  const MCSection *ConstTextCoalSection;
+  const MCSection *ConstDataCoalSection;
+  const MCSection *ConstDataSection;
+  const MCSection *DataCoalSection;
+  const MCSection *DataCommonSection;
+  const MCSection *DataBSSSection;
+  const MCSection *FourByteConstantSection;
+  const MCSection *EightByteConstantSection;
+  const MCSection *SixteenByteConstantSection;
+
+  const MCSection *LazySymbolPointerSection;
+  const MCSection *NonLazySymbolPointerSection;
+public:
+  TargetLoweringObjectFileMachO() : UniquingMap(0) {}
+  ~TargetLoweringObjectFileMachO();
+
+  virtual void Initialize(MCContext &Ctx, const TargetMachine &TM);
+
+  virtual const MCSection *
+  SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
+                         Mangler *Mang, const TargetMachine &TM) const;
+
+  virtual const MCSection *
+  getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind,
+                           Mangler *Mang, const TargetMachine &TM) const;
+
+  virtual const MCSection *getSectionForConstant(SectionKind Kind) const;
+
+  /// shouldEmitUsedDirectiveFor - This hook allows targets to selectively
+  /// decide not to emit the UsedDirective for some symbols in llvm.used.
+  /// FIXME: REMOVE this (rdar://7071300)
+  virtual bool shouldEmitUsedDirectiveFor(const GlobalValue *GV,
+                                          Mangler *) const;
+
+  /// getMachOSection - Return the MCSection for the specified mach-o section.
+  /// This requires the operands to be valid.
+  const MCSectionMachO *getMachOSection(StringRef Segment,
+                                        StringRef Section,
+                                        unsigned TypeAndAttributes,
+                                        SectionKind K) const {
+    return getMachOSection(Segment, Section, TypeAndAttributes, 0, K);
+  }
+  const MCSectionMachO *getMachOSection(StringRef Segment,
+                                        StringRef Section,
+                                        unsigned TypeAndAttributes,
+                                        unsigned Reserved2,
+                                        SectionKind K) const;
+
+  /// getTextCoalSection - Return the "__TEXT,__textcoal_nt" section we put weak
+  /// text symbols into.
+  const MCSection *getTextCoalSection() const {
+    return TextCoalSection;
+  }
+
+  /// getConstTextCoalSection - Return the "__TEXT,__const_coal" section
+  /// we put weak read-only symbols into.
+  const MCSection *getConstTextCoalSection() const {
+    return ConstTextCoalSection;
+  }
+
+  /// getLazySymbolPointerSection - Return the section corresponding to
+  /// the .lazy_symbol_pointer directive.
+  const MCSection *getLazySymbolPointerSection() const {
+    return LazySymbolPointerSection;
+  }
+
+  /// getNonLazySymbolPointerSection - Return the section corresponding to
+  /// the .non_lazy_symbol_pointer directive.
+  const MCSection *getNonLazySymbolPointerSection() const {
+    return NonLazySymbolPointerSection;
+  }
+
+  /// getSymbolForDwarfGlobalReference - The mach-o version of this method
+  /// defaults to returning a stub reference.
+  virtual const MCExpr *
+  getSymbolForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang,
+                              MachineModuleInfo *MMI, unsigned Encoding) const;
+
+  virtual unsigned getPersonalityEncoding() const;
+  virtual unsigned getLSDAEncoding() const;
+  virtual unsigned getFDEEncoding() const;
+  virtual unsigned getTTypeEncoding() const;
+};
+
+
+
+class TargetLoweringObjectFileCOFF : public TargetLoweringObjectFile {
+  mutable void *UniquingMap;
+public:
+  TargetLoweringObjectFileCOFF() : UniquingMap(0) {}
+  ~TargetLoweringObjectFileCOFF();
+
+  virtual void Initialize(MCContext &Ctx, const TargetMachine &TM);
+
+  virtual const MCSection *
+  getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind,
+                           Mangler *Mang, const TargetMachine &TM) const;
+
+  virtual const MCSection *
+  SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
+                         Mangler *Mang, const TargetMachine &TM) const;
+
+  /// getCOFFSection - Return the MCSection for the specified COFF section.
+  /// FIXME: Switch this to a semantic view eventually.
+  const MCSection *getCOFFSection(StringRef Name, bool isDirective,
+                                  SectionKind K) const;
+};
+
+} // end namespace llvm
+
+#endif
diff --git a/libclamav/c++/llvm/include/llvm/CompilerDriver/Common.td b/libclamav/c++/llvm/include/llvm/CompilerDriver/Common.td
index 9c3e861..31a627d 100644
--- a/libclamav/c++/llvm/include/llvm/CompilerDriver/Common.td
+++ b/libclamav/c++/llvm/include/llvm/CompilerDriver/Common.td
@@ -20,9 +20,12 @@ class Tool<list<dag> l> {
 def in_language;
 def out_language;
 def output_suffix;
-def cmd_line;
+def command;
+def out_file_option;
+def in_file_option;
 def join;
 def sink;
+def works_on_empty;
 def actions;
 
 // Possible option types.
@@ -42,10 +45,12 @@ def hidden;
 def init;
 def multi_val;
 def one_or_more;
+def zero_or_more;
 def optional;
 def really_hidden;
 def required;
 def comma_separated;
+def forward_not_split;
 
 // The 'case' construct.
 def case;
@@ -81,6 +86,7 @@ def forward_as;
 def forward_value;
 def forward_transformed_value;
 def stop_compilation;
+def no_out_file;
 def unpack_values;
 def warning;
 def error;
diff --git a/libclamav/c++/llvm/include/llvm/CompilerDriver/Main.inc b/libclamav/c++/llvm/include/llvm/CompilerDriver/Main.inc
index fc8b503..71bb8cb 100644
--- a/libclamav/c++/llvm/include/llvm/CompilerDriver/Main.inc
+++ b/libclamav/c++/llvm/include/llvm/CompilerDriver/Main.inc
@@ -10,7 +10,7 @@
 //  This tool provides a single point of access to the LLVM
 //  compilation tools.  It has many options. To discover the options
 //  supported please refer to the tools' manual page or run the tool
-//  with the --help option.
+//  with the -help option.
 //
 //  This file provides the default entry point for the driver executable.
 //
diff --git a/libclamav/c++/llvm/include/llvm/CompilerDriver/Tool.h b/libclamav/c++/llvm/include/llvm/CompilerDriver/Tool.h
index a982e2d..85d1690 100644
--- a/libclamav/c++/llvm/include/llvm/CompilerDriver/Tool.h
+++ b/libclamav/c++/llvm/include/llvm/CompilerDriver/Tool.h
@@ -20,15 +20,19 @@
 #include "llvm/ADT/StringSet.h"
 #include "llvm/System/Path.h"
 
+#include <string>
 #include <vector>
+#include <utility>
 
 namespace llvmc {
 
   class LanguageMap;
+  typedef std::vector<std::pair<unsigned, std::string> > ArgsVector;
   typedef std::vector<llvm::sys::Path> PathVector;
+  typedef std::vector<std::string> StrVector;
   typedef llvm::StringSet<> InputLanguagesSet;
 
-  /// Tool - A class
+  /// Tool - Represents a single tool.
   class Tool : public llvm::RefCountedBaseVPTR<Tool> {
   public:
 
@@ -51,6 +55,7 @@ namespace llvmc {
     virtual const char*  OutputLanguage() const = 0;
 
     virtual bool IsJoin() const = 0;
+    virtual bool WorksOnEmpty() const = 0;
 
   protected:
     /// OutFileName - Generate the output file name.
@@ -58,6 +63,8 @@ namespace llvmc {
                                 const llvm::sys::Path& TempDir,
                                 bool StopCompilation,
                                 const char* OutputSuffix) const;
+
+    StrVector SortArgs(ArgsVector& Args) const;
   };
 
   /// JoinTool - A Tool that has an associated input file list.
diff --git a/libclamav/c++/llvm/include/llvm/Constants.h b/libclamav/c++/llvm/include/llvm/Constants.h
index bd14303..1cebb20 100644
--- a/libclamav/c++/llvm/include/llvm/Constants.h
+++ b/libclamav/c++/llvm/include/llvm/Constants.h
@@ -276,6 +276,12 @@ public:
     return Val.isZero() && Val.isNegative();
   }
 
+  /// isZero - Return true if the value is positive or negative zero.
+  bool isZero() const { return Val.isZero(); }
+
+  /// isNaN - Return true if the value is a NaN.
+  bool isNaN() const { return Val.isNaN(); }
+
   /// isExactlyValue - We don't rely on operator== working on double values, as
   /// it returns true for things that are clearly not equal, like -0.0 and 0.0.
   /// As such, this method can be used to do an exact bit-for-bit comparison of
@@ -692,8 +698,9 @@ public:
   /// independent way (Note: the return type is an i64).
   static Constant *getAlignOf(const Type* Ty);
   
-  /// getSizeOf constant expr - computes the size of a type in a target
-  /// independent way (Note: the return type is an i64).
+  /// getSizeOf constant expr - computes the (alloc) size of a type (in
+  /// address-units, not bits) in a target independent way (Note: the return
+  /// type is an i64).
   ///
   static Constant *getSizeOf(const Type* Ty);
 
diff --git a/libclamav/c++/llvm/include/llvm/GlobalValue.h b/libclamav/c++/llvm/include/llvm/GlobalValue.h
index c15b555..658967d 100644
--- a/libclamav/c++/llvm/include/llvm/GlobalValue.h
+++ b/libclamav/c++/llvm/include/llvm/GlobalValue.h
@@ -110,36 +110,51 @@ public:
     return ODR ? WeakODRLinkage : WeakAnyLinkage;
   }
 
-  bool hasExternalLinkage() const { return Linkage == ExternalLinkage; }
-  bool hasAvailableExternallyLinkage() const {
+  static bool isExternalLinkage(LinkageTypes Linkage) {
+    return Linkage == ExternalLinkage;
+  }
+  static bool isAvailableExternallyLinkage(LinkageTypes Linkage) {
     return Linkage == AvailableExternallyLinkage;
   }
-  bool hasLinkOnceLinkage() const {
+  static bool isLinkOnceLinkage(LinkageTypes Linkage) {
     return Linkage == LinkOnceAnyLinkage || Linkage == LinkOnceODRLinkage;
   }
-  bool hasWeakLinkage() const {
+  static bool isWeakLinkage(LinkageTypes Linkage) {
     return Linkage == WeakAnyLinkage || Linkage == WeakODRLinkage;
   }
-  bool hasAppendingLinkage() const { return Linkage == AppendingLinkage; }
-  bool hasInternalLinkage() const { return Linkage == InternalLinkage; }
-  bool hasPrivateLinkage() const { return Linkage == PrivateLinkage; }
-  bool hasLinkerPrivateLinkage() const { return Linkage==LinkerPrivateLinkage; }
-  bool hasLocalLinkage() const {
-    return hasInternalLinkage() || hasPrivateLinkage() ||
-      hasLinkerPrivateLinkage();
+  static bool isAppendingLinkage(LinkageTypes Linkage) {
+    return Linkage == AppendingLinkage;
+  }
+  static bool isInternalLinkage(LinkageTypes Linkage) {
+    return Linkage == InternalLinkage;
+  }
+  static bool isPrivateLinkage(LinkageTypes Linkage) {
+    return Linkage == PrivateLinkage;
+  }
+  static bool isLinkerPrivateLinkage(LinkageTypes Linkage) {
+    return Linkage==LinkerPrivateLinkage;
+  }
+  static bool isLocalLinkage(LinkageTypes Linkage) {
+    return isInternalLinkage(Linkage) || isPrivateLinkage(Linkage) ||
+      isLinkerPrivateLinkage(Linkage);
+  }
+  static bool isDLLImportLinkage(LinkageTypes Linkage) {
+    return Linkage == DLLImportLinkage;
+  }
+  static bool isDLLExportLinkage(LinkageTypes Linkage) {
+    return Linkage == DLLExportLinkage;
+  }
+  static bool isExternalWeakLinkage(LinkageTypes Linkage) {
+    return Linkage == ExternalWeakLinkage;
+  }
+  static bool isCommonLinkage(LinkageTypes Linkage) {
+    return Linkage == CommonLinkage;
   }
-  bool hasDLLImportLinkage() const { return Linkage == DLLImportLinkage; }
-  bool hasDLLExportLinkage() const { return Linkage == DLLExportLinkage; }
-  bool hasExternalWeakLinkage() const { return Linkage == ExternalWeakLinkage; }
-  bool hasCommonLinkage() const { return Linkage == CommonLinkage; }
-
-  void setLinkage(LinkageTypes LT) { Linkage = LT; }
-  LinkageTypes getLinkage() const { return Linkage; }
 
   /// mayBeOverridden - Whether the definition of this global may be replaced
   /// by something non-equivalent at link time.  For example, if a function has
   /// weak linkage then the code defining it may be replaced by different code.
-  bool mayBeOverridden() const {
+  static bool mayBeOverridden(LinkageTypes Linkage) {
     return (Linkage == WeakAnyLinkage ||
             Linkage == LinkOnceAnyLinkage ||
             Linkage == CommonLinkage ||
@@ -148,7 +163,7 @@ public:
 
   /// isWeakForLinker - Whether the definition of this global may be replaced at
   /// link time.
-  bool isWeakForLinker() const {
+  static bool isWeakForLinker(LinkageTypes Linkage)  {
     return (Linkage == AvailableExternallyLinkage ||
             Linkage == WeakAnyLinkage ||
             Linkage == WeakODRLinkage ||
@@ -158,6 +173,33 @@ public:
             Linkage == ExternalWeakLinkage);
   }
 
+  bool hasExternalLinkage() const { return isExternalLinkage(Linkage); }
+  bool hasAvailableExternallyLinkage() const {
+    return isAvailableExternallyLinkage(Linkage);
+  }
+  bool hasLinkOnceLinkage() const {
+    return isLinkOnceLinkage(Linkage);
+  }
+  bool hasWeakLinkage() const {
+    return isWeakLinkage(Linkage);
+  }
+  bool hasAppendingLinkage() const { return isAppendingLinkage(Linkage); }
+  bool hasInternalLinkage() const { return isInternalLinkage(Linkage); }
+  bool hasPrivateLinkage() const { return isPrivateLinkage(Linkage); }
+  bool hasLinkerPrivateLinkage() const { return isLinkerPrivateLinkage(Linkage); }
+  bool hasLocalLinkage() const { return isLocalLinkage(Linkage); }
+  bool hasDLLImportLinkage() const { return isDLLImportLinkage(Linkage); }
+  bool hasDLLExportLinkage() const { return isDLLExportLinkage(Linkage); }
+  bool hasExternalWeakLinkage() const { return isExternalWeakLinkage(Linkage); }
+  bool hasCommonLinkage() const { return isCommonLinkage(Linkage); }
+
+  void setLinkage(LinkageTypes LT) { Linkage = LT; }
+  LinkageTypes getLinkage() const { return Linkage; }
+
+  bool mayBeOverridden() const { return mayBeOverridden(Linkage); }
+
+  bool isWeakForLinker() const { return isWeakForLinker(Linkage); }
+
   /// copyAttributesFrom - copy all additional attributes (those not needed to
   /// create a GlobalValue) from the GlobalValue Src to this one.
   virtual void copyAttributesFrom(const GlobalValue *Src);
diff --git a/libclamav/c++/llvm/include/llvm/Instructions.h b/libclamav/c++/llvm/include/llvm/Instructions.h
index c6cdbd5..f07291c 100644
--- a/libclamav/c++/llvm/include/llvm/Instructions.h
+++ b/libclamav/c++/llvm/include/llvm/Instructions.h
@@ -590,8 +590,8 @@ public:
     assert(getOperand(0)->getType() == getOperand(1)->getType() &&
           "Both operands to ICmp instruction are not of the same type!");
     // Check that the operands are the right type
-    assert((getOperand(0)->getType()->isIntOrIntVector() ||
-            isa<PointerType>(getOperand(0)->getType())) &&
+    assert((getOperand(0)->getType()->isIntOrIntVectorTy() ||
+            getOperand(0)->getType()->isPointerTy()) &&
            "Invalid operand types for ICmp instruction");
   }
 
@@ -611,8 +611,8 @@ public:
     assert(getOperand(0)->getType() == getOperand(1)->getType() &&
           "Both operands to ICmp instruction are not of the same type!");
     // Check that the operands are the right type
-    assert((getOperand(0)->getType()->isIntOrIntVector() ||
-            isa<PointerType>(getOperand(0)->getType())) &&
+    assert((getOperand(0)->getType()->isIntOrIntVectorTy() ||
+            getOperand(0)->getType()->isPointerTy()) &&
            "Invalid operand types for ICmp instruction");
   }
 
@@ -630,8 +630,8 @@ public:
     assert(getOperand(0)->getType() == getOperand(1)->getType() &&
           "Both operands to ICmp instruction are not of the same type!");
     // Check that the operands are the right type
-    assert((getOperand(0)->getType()->isIntOrIntVector() ||
-            isa<PointerType>(getOperand(0)->getType())) &&
+    assert((getOperand(0)->getType()->isIntOrIntVectorTy() ||
+            getOperand(0)->getType()->isPointerTy()) &&
            "Invalid operand types for ICmp instruction");
   }
 
@@ -740,7 +740,7 @@ public:
     assert(getOperand(0)->getType() == getOperand(1)->getType() &&
            "Both operands to FCmp instruction are not of the same type!");
     // Check that the operands are the right type
-    assert(getOperand(0)->getType()->isFPOrFPVector() &&
+    assert(getOperand(0)->getType()->isFPOrFPVectorTy() &&
            "Invalid operand types for FCmp instruction");
   }
   
@@ -759,7 +759,7 @@ public:
     assert(getOperand(0)->getType() == getOperand(1)->getType() &&
            "Both operands to FCmp instruction are not of the same type!");
     // Check that the operands are the right type
-    assert(getOperand(0)->getType()->isFPOrFPVector() &&
+    assert(getOperand(0)->getType()->isFPOrFPVectorTy() &&
            "Invalid operand types for FCmp instruction");
   }
 
@@ -776,7 +776,7 @@ public:
     assert(getOperand(0)->getType() == getOperand(1)->getType() &&
            "Both operands to FCmp instruction are not of the same type!");
     // Check that the operands are the right type
-    assert(getOperand(0)->getType()->isFPOrFPVector() &&
+    assert(getOperand(0)->getType()->isFPOrFPVectorTy() &&
            "Invalid operand types for FCmp instruction");
   }
 
@@ -1805,7 +1805,7 @@ public:
     return i/2;
   }
 
-  /// getIncomingBlock - Return incoming basic block #i.
+  /// getIncomingBlock - Return incoming basic block number @p i.
   ///
   BasicBlock *getIncomingBlock(unsigned i) const {
     return cast<BasicBlock>(getOperand(i*2+1));
diff --git a/libclamav/c++/llvm/include/llvm/LinkAllPasses.h b/libclamav/c++/llvm/include/llvm/LinkAllPasses.h
index a7e2e05..ae53851 100644
--- a/libclamav/c++/llvm/include/llvm/LinkAllPasses.h
+++ b/libclamav/c++/llvm/include/llvm/LinkAllPasses.h
@@ -46,7 +46,6 @@ namespace {
       (void) llvm::createAggressiveDCEPass();
       (void) llvm::createAliasAnalysisCounterPass();
       (void) llvm::createAliasDebugger();
-      (void) llvm::createAndersensPass();
       (void) llvm::createArgumentPromotionPass();
       (void) llvm::createStructRetPromotionPass();
       (void) llvm::createBasicAliasAnalysisPass();
diff --git a/libclamav/c++/llvm/include/llvm/MC/MCAssembler.h b/libclamav/c++/llvm/include/llvm/MC/MCAssembler.h
index 4527f3c..882929f 100644
--- a/libclamav/c++/llvm/include/llvm/MC/MCAssembler.h
+++ b/libclamav/c++/llvm/include/llvm/MC/MCAssembler.h
@@ -195,12 +195,16 @@ class MCAlignFragment : public MCFragment {
   /// cannot be satisfied in this width then this fragment is ignored.
   unsigned MaxBytesToEmit;
 
+  /// EmitNops - true when aligning code and optimal nops to be used for filling
+  bool EmitNops;
+
 public:
   MCAlignFragment(unsigned _Alignment, int64_t _Value, unsigned _ValueSize,
-                  unsigned _MaxBytesToEmit, MCSectionData *SD = 0)
+                  unsigned _MaxBytesToEmit, bool _EmitNops,
+		  MCSectionData *SD = 0)
     : MCFragment(FT_Align, SD), Alignment(_Alignment),
       Value(_Value),ValueSize(_ValueSize),
-      MaxBytesToEmit(_MaxBytesToEmit) {}
+      MaxBytesToEmit(_MaxBytesToEmit), EmitNops(_EmitNops) {}
 
   /// @name Accessors
   /// @{
@@ -217,6 +221,8 @@ public:
 
   unsigned getMaxBytesToEmit() const { return MaxBytesToEmit; }
 
+  unsigned getEmitNops() const { return EmitNops; }
+
   /// @}
 
   static bool classof(const MCFragment *F) {
diff --git a/libclamav/c++/llvm/include/llvm/MC/MCContext.h b/libclamav/c++/llvm/include/llvm/MC/MCContext.h
index 95c6bd4..74415e2 100644
--- a/libclamav/c++/llvm/include/llvm/MC/MCContext.h
+++ b/libclamav/c++/llvm/include/llvm/MC/MCContext.h
@@ -46,30 +46,28 @@ namespace llvm {
     /// @name Symbol Managment
     /// @{
 
-    /// CreateSymbol - Create a new symbol with the specified @param Name.
+    /// CreateSymbol - Create a new symbol with the specified @p Name.
     ///
     /// @param Name - The symbol name, which must be unique across all symbols.
     MCSymbol *CreateSymbol(StringRef Name);
 
     /// GetOrCreateSymbol - Lookup the symbol inside with the specified
-    /// @param Name.  If it exists, return it.  If not, create a forward
+    /// @p Name.  If it exists, return it.  If not, create a forward
     /// reference and return it.
     ///
     /// @param Name - The symbol name, which must be unique across all symbols.
-    /// @param IsTemporary - Whether this symbol is an assembler temporary,
-    /// which should not survive into the symbol table for the translation unit.
     MCSymbol *GetOrCreateSymbol(StringRef Name);
     MCSymbol *GetOrCreateSymbol(const Twine &Name);
 
     /// CreateTemporarySymbol - Create a new temporary symbol with the specified
-    /// @param Name.
+    /// @p Name.
     ///
     /// @param Name - The symbol name, for debugging purposes only, temporary
     /// symbols do not surive assembly. If non-empty the name must be unique
     /// across all symbols.
     MCSymbol *CreateTemporarySymbol(StringRef Name = "");
 
-    /// LookupSymbol - Get the symbol for @param Name, or null.
+    /// LookupSymbol - Get the symbol for \p Name, or null.
     MCSymbol *LookupSymbol(StringRef Name) const;
 
     /// @}
diff --git a/libclamav/c++/llvm/include/llvm/MC/MCStreamer.h b/libclamav/c++/llvm/include/llvm/MC/MCStreamer.h
index 624d9a6..696d024 100644
--- a/libclamav/c++/llvm/include/llvm/MC/MCStreamer.h
+++ b/libclamav/c++/llvm/include/llvm/MC/MCStreamer.h
@@ -92,12 +92,12 @@ namespace llvm {
     const MCSection *getCurrentSection() const { return CurSection; }
 
     /// SwitchSection - Set the current section where code is being emitted to
-    /// @param Section.  This is required to update CurSection.
+    /// @p Section.  This is required to update CurSection.
     ///
     /// This corresponds to assembler directives like .section, .text, etc.
     virtual void SwitchSection(const MCSection *Section) = 0;
     
-    /// EmitLabel - Emit a label for @param Symbol into the current section.
+    /// EmitLabel - Emit a label for @p Symbol into the current section.
     ///
     /// This corresponds to an assembler statement such as:
     ///   foo:
@@ -107,10 +107,10 @@ namespace llvm {
     /// used in an assignment.
     virtual void EmitLabel(MCSymbol *Symbol) = 0;
 
-    /// EmitAssemblerFlag - Note in the output the specified @param Flag
+    /// EmitAssemblerFlag - Note in the output the specified @p Flag
     virtual void EmitAssemblerFlag(MCAssemblerFlag Flag) = 0;
 
-    /// EmitAssignment - Emit an assignment of @param Value to @param Symbol.
+    /// EmitAssignment - Emit an assignment of @p Value to @p Symbol.
     ///
     /// This corresponds to an assembler statement such as:
     ///  symbol = value
@@ -123,11 +123,11 @@ namespace llvm {
     /// @param Value - The value for the symbol.
     virtual void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) = 0;
 
-    /// EmitSymbolAttribute - Add the given @param Attribute to @param Symbol.
+    /// EmitSymbolAttribute - Add the given @p Attribute to @p Symbol.
     virtual void EmitSymbolAttribute(MCSymbol *Symbol,
                                      MCSymbolAttr Attribute) = 0;
 
-    /// EmitSymbolDesc - Set the @param DescValue for the @param Symbol.
+    /// EmitSymbolDesc - Set the @p DescValue for the @p Symbol.
     ///
     /// @param Symbol - The symbol to have its n_desc field set.
     /// @param DescValue - The value to set into the n_desc field.
@@ -176,8 +176,8 @@ namespace llvm {
     /// etc.
     virtual void EmitBytes(StringRef Data, unsigned AddrSpace) = 0;
 
-    /// EmitValue - Emit the expression @param Value into the output as a native
-    /// integer of the given @param Size bytes.
+    /// EmitValue - Emit the expression @p Value into the output as a native
+    /// integer of the given @p Size bytes.
     ///
     /// This is used to implement assembler directives such as .word, .quad,
     /// etc.
@@ -192,7 +192,7 @@ namespace llvm {
     /// to pass in a MCExpr for constant integers.
     virtual void EmitIntValue(uint64_t Value, unsigned Size,unsigned AddrSpace);
     
-    /// EmitGPRel32Value - Emit the expression @param Value into the output as a
+    /// EmitGPRel32Value - Emit the expression @p Value into the output as a
     /// gprel32 (32-bit GP relative) value.
     ///
     /// This is used to implement assembler directives such as .gprel32 on
@@ -211,11 +211,11 @@ namespace llvm {
     }
 
     
-    /// EmitValueToAlignment - Emit some number of copies of @param Value until
-    /// the byte alignment @param ByteAlignment is reached.
+    /// EmitValueToAlignment - Emit some number of copies of @p Value until
+    /// the byte alignment @p ByteAlignment is reached.
     ///
     /// If the number of bytes need to emit for the alignment is not a multiple
-    /// of @param ValueSize, then the contents of the emitted fill bytes is
+    /// of @p ValueSize, then the contents of the emitted fill bytes is
     /// undefined.
     ///
     /// This used to implement the .align assembler directive.
@@ -223,8 +223,8 @@ namespace llvm {
     /// @param ByteAlignment - The alignment to reach. This must be a power of
     /// two on some targets.
     /// @param Value - The value to use when filling bytes.
-    /// @param Size - The size of the integer (in bytes) to emit for @param
-    /// Value. This must match a native machine width.
+    /// @param ValueSize - The size of the integer (in bytes) to emit for
+    /// @p Value. This must match a native machine width.
     /// @param MaxBytesToEmit - The maximum numbers of bytes to emit, or 0. If
     /// the alignment cannot be reached in this many bytes, no bytes are
     /// emitted.
@@ -232,8 +232,22 @@ namespace llvm {
                                       unsigned ValueSize = 1,
                                       unsigned MaxBytesToEmit = 0) = 0;
 
-    /// EmitValueToOffset - Emit some number of copies of @param Value until the
-    /// byte offset @param Offset is reached.
+    /// EmitCodeAlignment - Emit nops until the byte alignment @p ByteAlignment
+    /// is reached.
+    ///
+    /// This used to align code where the alignment bytes may be executed.  This
+    /// can emit different bytes for different sizes to optimize execution.
+    ///
+    /// @param ByteAlignment - The alignment to reach. This must be a power of
+    /// two on some targets.
+    /// @param MaxBytesToEmit - The maximum numbers of bytes to emit, or 0. If
+    /// the alignment cannot be reached in this many bytes, no bytes are
+    /// emitted.
+    virtual void EmitCodeAlignment(unsigned ByteAlignment,
+                                   unsigned MaxBytesToEmit = 0) = 0;
+
+    /// EmitValueToOffset - Emit some number of copies of @p Value until the
+    /// byte offset @p Offset is reached.
     ///
     /// This is used to implement assembler directives such as .org.
     ///
@@ -254,7 +268,7 @@ namespace llvm {
     /// directive.
     virtual void EmitDwarfFileDirective(unsigned FileNo,StringRef Filename) = 0;
 
-    /// EmitInstruction - Emit the given @param Instruction into the current
+    /// EmitInstruction - Emit the given @p Instruction into the current
     /// section.
     virtual void EmitInstruction(const MCInst &Inst) = 0;
 
diff --git a/libclamav/c++/llvm/include/llvm/Metadata.h b/libclamav/c++/llvm/include/llvm/Metadata.h
index 4e459bf..e536322 100644
--- a/libclamav/c++/llvm/include/llvm/Metadata.h
+++ b/libclamav/c++/llvm/include/llvm/Metadata.h
@@ -75,6 +75,7 @@ class MDNode : public Value, public FoldingSetNode {
   MDNode(const MDNode &);                // DO NOT IMPLEMENT
   void operator=(const MDNode &);        // DO NOT IMPLEMENT
   friend class MDNodeOperand;
+  friend class LLVMContextImpl;
 
   /// NumOperands - This many 'MDNodeOperand' items are co-allocated onto the
   /// end of this MDNode.
@@ -103,9 +104,13 @@ class MDNode : public Value, public FoldingSetNode {
     FL_Yes = 1
   };
   
-  // Replace each instance of F from the operand list of this node with T.
+  /// replaceOperand - Replace each instance of F from the operand list of this 
+  /// node with T.
   void replaceOperand(MDNodeOperand *Op, Value *NewVal);
   ~MDNode();
+  /// replaceAllOperandsWithNull - This is used while destroying llvm context to 
+  /// gracefully delete all nodes. This method replaces all operands with null.
+  void replaceAllOperandsWithNull();
 
 protected:
   explicit MDNode(LLVMContext &C, Value *const *Vals, unsigned NumVals,
diff --git a/libclamav/c++/llvm/include/llvm/Pass.h b/libclamav/c++/llvm/include/llvm/Pass.h
index e822a0f..8fc3a53 100644
--- a/libclamav/c++/llvm/include/llvm/Pass.h
+++ b/libclamav/c++/llvm/include/llvm/Pass.h
@@ -163,7 +163,7 @@ public:
   /// an analysis interface through multiple inheritance.  If needed, it should
   /// override this to adjust the this pointer as needed for the specified pass
   /// info.
-  virtual void *getAdjustedAnalysisPointer(const PassInfo *PI) {
+  virtual void *getAdjustedAnalysisPointer(const PassInfo *) {
     return this;
   }
   virtual ImmutablePass *getAsImmutablePass() { return 0; }
diff --git a/libclamav/c++/llvm/include/llvm/Support/CommandLine.h b/libclamav/c++/llvm/include/llvm/Support/CommandLine.h
index 3ee2313..61c3256 100644
--- a/libclamav/c++/llvm/include/llvm/Support/CommandLine.h
+++ b/libclamav/c++/llvm/include/llvm/Support/CommandLine.h
@@ -93,9 +93,9 @@ enum ValueExpected {           // Is a value required for the option?
 };
 
 enum OptionHidden {            // Control whether -help shows this option
-  NotHidden       = 0x20,      // Option included in --help & --help-hidden
-  Hidden          = 0x40,      // -help doesn't, but --help-hidden does
-  ReallyHidden    = 0x60,      // Neither --help nor --help-hidden show this arg
+  NotHidden       = 0x20,      // Option included in -help & -help-hidden
+  Hidden          = 0x40,      // -help doesn't, but -help-hidden does
+  ReallyHidden    = 0x60,      // Neither -help nor -help-hidden show this arg
   HiddenMask      = 0x60
 };
 
@@ -159,7 +159,7 @@ class Option {
   Option *NextRegistered; // Singly linked list of registered options.
 public:
   const char *ArgStr;     // The argument string itself (ex: "help", "o")
-  const char *HelpStr;    // The descriptive text message for --help
+  const char *HelpStr;    // The descriptive text message for -help
   const char *ValueStr;   // String describing what the value of this option is
 
   inline enum NumOccurrencesFlag getNumOccurrencesFlag() const {
@@ -251,14 +251,14 @@ public:
 // command line option parsers...
 //
 
-// desc - Modifier to set the description shown in the --help output...
+// desc - Modifier to set the description shown in the -help output...
 struct desc {
   const char *Desc;
   desc(const char *Str) : Desc(Str) {}
   void apply(Option &O) const { O.setDescription(Desc); }
 };
 
-// value_desc - Modifier to set the value description shown in the --help
+// value_desc - Modifier to set the value description shown in the -help
 // output...
 struct value_desc {
   const char *Desc;
@@ -437,7 +437,7 @@ protected:
 // Default parser implementation - This implementation depends on having a
 // mapping of recognized options to values of some sort.  In addition to this,
 // each entry in the mapping also tracks a help message that is printed with the
-// command line option for --help.  Because this is a simple mapping parser, the
+// command line option for -help.  Because this is a simple mapping parser, the
 // data type can be any unsupported type.
 //
 template <class DataType>
@@ -1373,7 +1373,7 @@ struct extrahelp {
 
 void PrintVersionMessage();
 // This function just prints the help message, exactly the same way as if the
-// --help option had been given on the command line.
+// -help option had been given on the command line.
 // NOTE: THIS FUNCTION TERMINATES THE PROGRAM!
 void PrintHelpMessage();
 
diff --git a/libclamav/c++/llvm/include/llvm/Support/Compiler.h b/libclamav/c++/llvm/include/llvm/Support/Compiler.h
index 1376e46..881a0fe 100644
--- a/libclamav/c++/llvm/include/llvm/Support/Compiler.h
+++ b/libclamav/c++/llvm/include/llvm/Support/Compiler.h
@@ -78,7 +78,9 @@
 
 // ALWAYS_INLINE - On compilers where we have a directive to do so, mark a
 // method "always inline" because it is performance sensitive.
-#if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
+// GCC 3.4 supported this but is buggy in various cases and produces
+// unimplemented errors, just use it in GCC 4.0 and later.
+#if __GNUC__ > 3
 #define ALWAYS_INLINE __attribute__((always_inline))
 #else
 // TODO: No idea how to do this with MSVC.
diff --git a/libclamav/c++/llvm/include/llvm/Support/Dwarf.h b/libclamav/c++/llvm/include/llvm/Support/Dwarf.h
index bfccc52..5f591d4 100644
--- a/libclamav/c++/llvm/include/llvm/Support/Dwarf.h
+++ b/libclamav/c++/llvm/include/llvm/Support/Dwarf.h
@@ -580,7 +580,6 @@ const char *MacinfoString(unsigned Encoding);
 /// CallFrameString - Return the string for the specified call frame instruction
 /// encodings.
 const char *CallFrameString(unsigned Encoding);
-
 } // End of namespace dwarf
 
 } // End of namespace llvm
diff --git a/libclamav/c++/llvm/include/llvm/Support/FormattedStream.h b/libclamav/c++/llvm/include/llvm/Support/FormattedStream.h
index 58a24bd..58a1885 100644
--- a/libclamav/c++/llvm/include/llvm/Support/FormattedStream.h
+++ b/libclamav/c++/llvm/include/llvm/Support/FormattedStream.h
@@ -1,4 +1,4 @@
-//===-- llvm/CodeGen/FormattedStream.h - Formatted streams ------*- C++ -*-===//
+//===-- llvm/Support/FormattedStream.h - Formatted streams ------*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
diff --git a/libclamav/c++/llvm/include/llvm/Support/IRBuilder.h b/libclamav/c++/llvm/include/llvm/Support/IRBuilder.h
index c8aef9c..1f4e598 100644
--- a/libclamav/c++/llvm/include/llvm/Support/IRBuilder.h
+++ b/libclamav/c++/llvm/include/llvm/Support/IRBuilder.h
@@ -143,6 +143,10 @@ public:
     return Type::getVoidTy(Context);
   }
   
+  const Type *getInt8PtrTy() {
+    return Type::getInt8PtrTy(Context);
+  }
+  
   /// getCurrentFunctionReturnType - Get the return type of the current function
   /// that we're emitting into.
   const Type *getCurrentFunctionReturnType() const;
diff --git a/libclamav/c++/llvm/include/llvm/Support/Regex.h b/libclamav/c++/llvm/include/llvm/Support/Regex.h
index c954c0d..591af00 100644
--- a/libclamav/c++/llvm/include/llvm/Support/Regex.h
+++ b/libclamav/c++/llvm/include/llvm/Support/Regex.h
@@ -56,6 +56,19 @@ namespace llvm {
     ///
     /// This returns true on a successful match.
     bool match(const StringRef &String, SmallVectorImpl<StringRef> *Matches=0);
+
+    /// sub - Return the result of replacing the first match of the regex in
+    /// \arg String with the \arg Repl string. Backreferences like "\0" in the
+    /// replacement string are replaced with the appropriate match substring.
+    ///
+    /// Note that the replacement string has backslash escaping performed on
+    /// it. Invalid backreferences are ignored (replaced by empty strings).
+    ///
+    /// \param Error If non-null, any errors in the substitution (invalid
+    /// backreferences, trailing backslashes) will be recorded as a non-empty
+    /// string.
+    std::string sub(StringRef Repl, StringRef String, std::string *Error = 0);
+
   private:
     struct llvm_regex *preg;
     int error;
diff --git a/libclamav/c++/llvm/include/llvm/Support/TargetFolder.h b/libclamav/c++/llvm/include/llvm/Support/TargetFolder.h
index 384c493..d34f35f 100644
--- a/libclamav/c++/llvm/include/llvm/Support/TargetFolder.h
+++ b/libclamav/c++/llvm/include/llvm/Support/TargetFolder.h
@@ -185,7 +185,9 @@ public:
       return C; // avoid calling Fold
     return Fold(ConstantExpr::getIntegerCast(C, DestTy, isSigned));
   }
-
+  Constant *CreatePointerCast(Constant *C, const Type *DestTy) const {
+    return ConstantExpr::getPointerCast(C, DestTy);
+  }
   Constant *CreateBitCast(Constant *C, const Type *DestTy) const {
     return CreateCast(Instruction::BitCast, C, DestTy);
   }
diff --git a/libclamav/c++/llvm/include/llvm/System/Path.h b/libclamav/c++/llvm/include/llvm/System/Path.h
index 1be27b2..d4af478 100644
--- a/libclamav/c++/llvm/include/llvm/System/Path.h
+++ b/libclamav/c++/llvm/include/llvm/System/Path.h
@@ -203,7 +203,7 @@ namespace sys {
       }
 
       /// Makes a copy of \p that to \p this.
-      /// @param \p that A StringRef denoting the path
+      /// @param that A StringRef denoting the path
       /// @returns \p this
       /// @brief Assignment Operator
       Path &operator=(StringRef that);
diff --git a/libclamav/c++/llvm/include/llvm/Target/Target.td b/libclamav/c++/llvm/include/llvm/Target/Target.td
index 9a117df..0cffffb 100644
--- a/libclamav/c++/llvm/include/llvm/Target/Target.td
+++ b/libclamav/c++/llvm/include/llvm/Target/Target.td
@@ -211,16 +211,9 @@ class Instruction {
   //  hasSideEffects - The instruction has side effects that are not
   //    captured by any operands of the instruction or other flags.
   //
-  //  mayHaveSideEffects  - Some instances of the instruction can have side
-  //    effects. The virtual method "isReallySideEffectFree" is called to
-  //    determine this. Load instructions are an example of where this is
-  //    useful. In general, loads always have side effects. However, loads from
-  //    constant pools don't. Individual back ends make this determination.
-  //
   //  neverHasSideEffects - Set on an instruction with no pattern if it has no
   //    side effects.
   bit hasSideEffects = 0;
-  bit mayHaveSideEffects = 0;
   bit neverHasSideEffects = 0;
 
   // Is this instruction a "real" instruction (with a distinct machine
diff --git a/libclamav/c++/llvm/include/llvm/Target/TargetAsmBackend.h b/libclamav/c++/llvm/include/llvm/Target/TargetAsmBackend.h
new file mode 100644
index 0000000..dfdabdb
--- /dev/null
+++ b/libclamav/c++/llvm/include/llvm/Target/TargetAsmBackend.h
@@ -0,0 +1,35 @@
+//===-- llvm/Target/TargetAsmBackend.h - Target Asm Backend -----*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_TARGET_TARGETASMBACKEND_H
+#define LLVM_TARGET_TARGETASMBACKEND_H
+
+namespace llvm {
+class Target;
+
+/// TargetAsmBackend - Generic interface to target specific assembler backends.
+class TargetAsmBackend {
+  TargetAsmBackend(const TargetAsmBackend &);   // DO NOT IMPLEMENT
+  void operator=(const TargetAsmBackend &);  // DO NOT IMPLEMENT
+protected: // Can only create subclasses.
+  TargetAsmBackend(const Target &);
+
+  /// TheTarget - The Target that this machine was created for.
+  const Target &TheTarget;
+
+public:
+  virtual ~TargetAsmBackend();
+
+  const Target &getTarget() const { return TheTarget; }
+
+};
+
+} // End llvm namespace
+
+#endif
diff --git a/libclamav/c++/llvm/include/llvm/Target/TargetAsmParser.h b/libclamav/c++/llvm/include/llvm/Target/TargetAsmParser.h
index da9ba2b..85315c1 100644
--- a/libclamav/c++/llvm/include/llvm/Target/TargetAsmParser.h
+++ b/libclamav/c++/llvm/include/llvm/Target/TargetAsmParser.h
@@ -42,8 +42,8 @@ public:
   /// line should be parsed up to and including the end-of-statement token. On
   /// failure, the parser is not required to read to the end of the line.
   //
-  /// \param AP - The current parser object.
   /// \param Name - The instruction name.
+  /// \param NameLoc - The source location of the name.
   /// \param Operands [out] - The list of parsed operands, this returns
   ///        ownership of them to the caller.
   /// \return True on failure.
@@ -59,7 +59,7 @@ public:
   /// the target, the entire line is parsed up to and including the
   /// end-of-statement token and false is returned.
   ///
-  /// \param ID - the identifier token of the directive.
+  /// \param DirectiveID - the identifier token of the directive.
   virtual bool ParseDirective(AsmToken DirectiveID) = 0;
   
   /// MatchInstruction - Recognize a series of operands of a parsed instruction
diff --git a/libclamav/c++/llvm/include/llvm/Target/TargetInstrInfo.h b/libclamav/c++/llvm/include/llvm/Target/TargetInstrInfo.h
index d95e4e8..4b26beb 100644
--- a/libclamav/c++/llvm/include/llvm/Target/TargetInstrInfo.h
+++ b/libclamav/c++/llvm/include/llvm/Target/TargetInstrInfo.h
@@ -19,14 +19,14 @@
 
 namespace llvm {
 
-class MCAsmInfo;
-class TargetRegisterClass;
-class TargetRegisterInfo;
-class LiveVariables;
 class CalleeSavedInfo;
+class LiveVariables;
+class MCAsmInfo;
+class MachineMemOperand;
 class SDNode;
 class SelectionDAG;
-class MachineMemOperand;
+class TargetRegisterClass;
+class TargetRegisterInfo;
 
 template<class T> class SmallVectorImpl;
 
@@ -243,13 +243,11 @@ public:
   virtual bool findCommutedOpIndices(MachineInstr *MI, unsigned &SrcOpIdx1,
                                      unsigned &SrcOpIdx2) const = 0;
 
-  /// isIdentical - Return true if two instructions are identical. This differs
-  /// from MachineInstr::isIdenticalTo() in that it does not require the
-  /// virtual destination registers to be the same. This is used by MachineLICM
-  /// and other MI passes to perform CSE.
-  virtual bool isIdentical(const MachineInstr *MI,
-                           const MachineInstr *Other,
-                           const MachineRegisterInfo *MRI) const = 0;
+  /// produceSameValue - Return true if two machine instructions would produce
+  /// identical values. By default, this is only true when the two instructions
+  /// are deemed identical except for defs.
+  virtual bool produceSameValue(const MachineInstr *MI0,
+                                const MachineInstr *MI1) const = 0;
 
   /// AnalyzeBranch - Analyze the branching code at the end of MBB, returning
   /// true if it cannot be understood (e.g. it's a switch dispatch or isn't
@@ -560,10 +558,8 @@ public:
                              const TargetRegisterInfo *TRI) const;
   virtual MachineInstr *duplicate(MachineInstr *Orig,
                                   MachineFunction &MF) const;
-  virtual bool isIdentical(const MachineInstr *MI,
-                           const MachineInstr *Other,
-                           const MachineRegisterInfo *MRI) const;
-
+  virtual bool produceSameValue(const MachineInstr *MI0,
+                                const MachineInstr *MI1) const;
   virtual unsigned GetFunctionSizeInBytes(const MachineFunction &MF) const;
 };
 
diff --git a/libclamav/c++/llvm/include/llvm/Target/TargetLowering.h b/libclamav/c++/llvm/include/llvm/Target/TargetLowering.h
index c6ac89a..60b7ebd 100644
--- a/libclamav/c++/llvm/include/llvm/Target/TargetLowering.h
+++ b/libclamav/c++/llvm/include/llvm/Target/TargetLowering.h
@@ -1164,7 +1164,7 @@ public:
               bool isVarArg, bool isInreg, unsigned NumFixedArgs,
               CallingConv::ID CallConv, bool isTailCall,
               bool isReturnValueUsed, SDValue Callee, ArgListTy &Args,
-              SelectionDAG &DAG, DebugLoc dl, unsigned Order);
+              SelectionDAG &DAG, DebugLoc dl);
 
   /// LowerCall - This hook must be implemented to lower calls into the
   /// the specified DAG. The outgoing arguments to the call are described
diff --git a/libclamav/c++/llvm/include/llvm/Target/TargetLoweringObjectFile.h b/libclamav/c++/llvm/include/llvm/Target/TargetLoweringObjectFile.h
index d3e5cf2..42d88a0 100644
--- a/libclamav/c++/llvm/include/llvm/Target/TargetLoweringObjectFile.h
+++ b/libclamav/c++/llvm/include/llvm/Target/TargetLoweringObjectFile.h
@@ -25,6 +25,7 @@ namespace llvm {
   class MCExpr;
   class MCSection;
   class MCSectionMachO;
+  class MCSymbol;
   class MCContext;
   class GlobalValue;
   class TargetMachine;
@@ -175,187 +176,26 @@ public:
     return 0;
   }
   
-  /// getSymbolForDwarfGlobalReference - Return an MCExpr to use for a
-  /// pc-relative reference to the specified global variable from exception
-  /// handling information.  In addition to the symbol, this returns
-  /// by-reference:
-  ///
-  /// IsIndirect - True if the returned symbol is actually a stub that contains
-  ///    the address of the symbol, false if the symbol is the global itself.
-  ///
-  /// IsPCRel - True if the symbol reference is already pc-relative, false if
-  ///    the caller needs to subtract off the address of the reference from the
-  ///    symbol.
+  /// getSymbolForDwarfGlobalReference - Return an MCExpr to use for a reference
+  /// to the specified global variable from exception handling information.
   ///
   virtual const MCExpr *
   getSymbolForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang,
-                                   MachineModuleInfo *MMI,
-                                   bool &IsIndirect, bool &IsPCRel) const;
-  
-protected:
-  virtual const MCSection *
-  SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
-                         Mangler *Mang, const TargetMachine &TM) const;
-};
-  
-  
-  
+                              MachineModuleInfo *MMI, unsigned Encoding) const;
 
-class TargetLoweringObjectFileELF : public TargetLoweringObjectFile {
-  mutable void *UniquingMap;
-protected:
-  /// TLSDataSection - Section directive for Thread Local data.
-  ///
-  const MCSection *TLSDataSection;        // Defaults to ".tdata".
-  
-  /// TLSBSSSection - Section directive for Thread Local uninitialized data.
-  /// Null if this target doesn't support a BSS section.
-  ///
-  const MCSection *TLSBSSSection;         // Defaults to ".tbss".
-  
-  const MCSection *DataRelSection;
-  const MCSection *DataRelLocalSection;
-  const MCSection *DataRelROSection;
-  const MCSection *DataRelROLocalSection;
-  
-  const MCSection *MergeableConst4Section;
-  const MCSection *MergeableConst8Section;
-  const MCSection *MergeableConst16Section;
-  
-protected:
-  const MCSection *getELFSection(StringRef Section, unsigned Type, 
-                                 unsigned Flags, SectionKind Kind,
-                                 bool IsExplicit = false) const;
-public:
-  TargetLoweringObjectFileELF() : UniquingMap(0) {}
-  ~TargetLoweringObjectFileELF();
-  
-  virtual void Initialize(MCContext &Ctx, const TargetMachine &TM);
-  
-  /// getSectionForConstant - Given a constant with the SectionKind, return a
-  /// section that it should be placed in.
-  virtual const MCSection *getSectionForConstant(SectionKind Kind) const;
-  
-  
-  virtual const MCSection *
-  getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind, 
-                           Mangler *Mang, const TargetMachine &TM) const;
-  
-  virtual const MCSection *
-  SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
-                         Mangler *Mang, const TargetMachine &TM) const;
-};
-
-  
-  
-class TargetLoweringObjectFileMachO : public TargetLoweringObjectFile {
-  mutable void *UniquingMap;
-  
-  const MCSection *CStringSection;
-  const MCSection *UStringSection;
-  const MCSection *TextCoalSection;
-  const MCSection *ConstTextCoalSection;
-  const MCSection *ConstDataCoalSection;
-  const MCSection *ConstDataSection;
-  const MCSection *DataCoalSection;
-  const MCSection *DataCommonSection;
-  const MCSection *DataBSSSection;
-  const MCSection *FourByteConstantSection;
-  const MCSection *EightByteConstantSection;
-  const MCSection *SixteenByteConstantSection;
-  
-  const MCSection *LazySymbolPointerSection;
-  const MCSection *NonLazySymbolPointerSection;
-public:
-  TargetLoweringObjectFileMachO() : UniquingMap(0) {}
-  ~TargetLoweringObjectFileMachO();
-  
-  virtual void Initialize(MCContext &Ctx, const TargetMachine &TM);
-
-  virtual const MCSection *
-  SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
-                         Mangler *Mang, const TargetMachine &TM) const;
-  
-  virtual const MCSection *
-  getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind, 
-                           Mangler *Mang, const TargetMachine &TM) const;
-  
-  virtual const MCSection *getSectionForConstant(SectionKind Kind) const;
-  
-  /// shouldEmitUsedDirectiveFor - This hook allows targets to selectively
-  /// decide not to emit the UsedDirective for some symbols in llvm.used.
-  /// FIXME: REMOVE this (rdar://7071300)
-  virtual bool shouldEmitUsedDirectiveFor(const GlobalValue *GV,
-                                          Mangler *) const;
-
-  /// getMachOSection - Return the MCSection for the specified mach-o section.
-  /// This requires the operands to be valid.
-  const MCSectionMachO *getMachOSection(StringRef Segment,
-                                        StringRef Section,
-                                        unsigned TypeAndAttributes,
-                                        SectionKind K) const {
-    return getMachOSection(Segment, Section, TypeAndAttributes, 0, K);
-  }
-  const MCSectionMachO *getMachOSection(StringRef Segment,
-                                        StringRef Section,
-                                        unsigned TypeAndAttributes,
-                                        unsigned Reserved2,
-                                        SectionKind K) const;
-
-  /// getTextCoalSection - Return the "__TEXT,__textcoal_nt" section we put weak
-  /// text symbols into.
-  const MCSection *getTextCoalSection() const {
-    return TextCoalSection;
-  }
-  
-  /// getConstTextCoalSection - Return the "__TEXT,__const_coal" section
-  /// we put weak read-only symbols into.
-  const MCSection *getConstTextCoalSection() const {
-    return ConstTextCoalSection;
-  }
-  
-  /// getLazySymbolPointerSection - Return the section corresponding to
-  /// the .lazy_symbol_pointer directive.
-  const MCSection *getLazySymbolPointerSection() const {
-    return LazySymbolPointerSection;
-  }
-  
-  /// getNonLazySymbolPointerSection - Return the section corresponding to
-  /// the .non_lazy_symbol_pointer directive.
-  const MCSection *getNonLazySymbolPointerSection() const {
-    return NonLazySymbolPointerSection;
-  }
-  
-  /// getSymbolForDwarfGlobalReference - The mach-o version of this method
-  /// defaults to returning a stub reference.
   virtual const MCExpr *
-  getSymbolForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang,
-                                   MachineModuleInfo *MMI,
-                                   bool &IsIndirect, bool &IsPCRel) const;
-};
+  getSymbolForDwarfReference(const MCSymbol *Sym, MachineModuleInfo *MMI,
+                             unsigned Encoding) const;
 
+  virtual unsigned getPersonalityEncoding() const;
+  virtual unsigned getLSDAEncoding() const;
+  virtual unsigned getFDEEncoding() const;
+  virtual unsigned getTTypeEncoding() const;
 
-
-class TargetLoweringObjectFileCOFF : public TargetLoweringObjectFile {
-  mutable void *UniquingMap;
-public:
-  TargetLoweringObjectFileCOFF() : UniquingMap(0) {}
-  ~TargetLoweringObjectFileCOFF();
-  
-  virtual void Initialize(MCContext &Ctx, const TargetMachine &TM);
-  
-  virtual const MCSection *
-  getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind, 
-                           Mangler *Mang, const TargetMachine &TM) const;
-  
+protected:
   virtual const MCSection *
   SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
                          Mangler *Mang, const TargetMachine &TM) const;
-
-  /// getCOFFSection - Return the MCSection for the specified COFF section.
-  /// FIXME: Switch this to a semantic view eventually.
-  const MCSection *getCOFFSection(StringRef Name, bool isDirective,
-                                  SectionKind K) const;
 };
 
 } // end namespace llvm
diff --git a/libclamav/c++/llvm/include/llvm/Target/TargetMachine.h b/libclamav/c++/llvm/include/llvm/Target/TargetMachine.h
index 63e28ac..a7062ac 100644
--- a/libclamav/c++/llvm/include/llvm/Target/TargetMachine.h
+++ b/libclamav/c++/llvm/include/llvm/Target/TargetMachine.h
@@ -68,15 +68,6 @@ namespace CodeGenOpt {
   };
 }
 
-// Specify if we should encode the LSDA pointer in the FDE as 4- or 8-bytes.
-namespace DwarfLSDAEncoding {
-  enum Encoding {
-    Default,
-    FourByte,
-    EightByte
-  };
-}
-
 //===----------------------------------------------------------------------===//
 ///
 /// TargetMachine - Primary interface to the complete machine description for
@@ -179,20 +170,6 @@ public:
   /// is false.
   static void setAsmVerbosityDefault(bool);
 
-  /// getLSDAEncoding - Returns the LSDA pointer encoding. The choices are
-  /// 4-byte, 8-byte, and target default. The CIE is hard-coded to indicate that
-  /// the LSDA pointer in the FDE section is an "sdata4", and should be encoded
-  /// as a 4-byte pointer by default. However, some systems may require a
-  /// different size due to bugs or other conditions. We will default to a
-  /// 4-byte encoding unless the system tells us otherwise.
-  ///
-  /// FIXME: This call-back isn't good! We should be using the correct encoding
-  /// regardless of the system. However, there are some systems which have bugs
-  /// that prevent this from occuring.
-  virtual DwarfLSDAEncoding::Encoding getLSDAEncoding() const {
-    return DwarfLSDAEncoding::Default;
-  }
-
   /// CodeGenFileType - These enums are meant to be passed into
   /// addPassesToEmitFile to indicate what type of file to emit, and returned by
   /// it to indicate what type of file could actually be made.
@@ -212,8 +189,9 @@ public:
   /// is not supported, or false on success.
   virtual bool addPassesToEmitFile(PassManagerBase &,
                                    formatted_raw_ostream &,
-                                   CodeGenFileType Filetype,
-                                   CodeGenOpt::Level) {
+                                   CodeGenFileType,
+                                   CodeGenOpt::Level,
+                                   bool DisableVerify = true) {
     return true;
   }
 
@@ -225,7 +203,8 @@ public:
   ///
   virtual bool addPassesToEmitMachineCode(PassManagerBase &,
                                           JITCodeEmitter &,
-                                          CodeGenOpt::Level) {
+                                          CodeGenOpt::Level,
+                                          bool DisableVerify = true) {
     return true;
   }
 
@@ -235,7 +214,8 @@ public:
   virtual bool WantsWholeFile() const { return false; }
   virtual bool addPassesToEmitWholeFile(PassManager &, formatted_raw_ostream &,
                                         CodeGenFileType,
-                                        CodeGenOpt::Level) {
+                                        CodeGenOpt::Level,
+                                        bool DisableVerify = true) {
     return true;
   }
 };
@@ -250,7 +230,8 @@ protected: // Can only create subclasses.
   /// addCommonCodeGenPasses - Add standard LLVM codegen passes used for
   /// both emitting to assembly files or machine code output.
   ///
-  bool addCommonCodeGenPasses(PassManagerBase &, CodeGenOpt::Level);
+  bool addCommonCodeGenPasses(PassManagerBase &, CodeGenOpt::Level,
+                              bool DisableVerify);
 
 private:
   virtual void setCodeModelForJIT();
@@ -265,7 +246,8 @@ public:
   virtual bool addPassesToEmitFile(PassManagerBase &PM,
                                    formatted_raw_ostream &Out,
                                    CodeGenFileType FileType,
-                                   CodeGenOpt::Level);
+                                   CodeGenOpt::Level,
+                                   bool DisableVerify = true);
   
   /// addPassesToEmitMachineCode - Add passes to the specified pass manager to
   /// get machine code emitted.  This uses a JITCodeEmitter object to handle
@@ -275,7 +257,8 @@ public:
   ///
   virtual bool addPassesToEmitMachineCode(PassManagerBase &PM,
                                           JITCodeEmitter &MCE,
-                                          CodeGenOpt::Level);
+                                          CodeGenOpt::Level,
+                                          bool DisableVerify = true);
   
   /// Target-Independent Code Generator Pass Configuration Options.
   
diff --git a/libclamav/c++/llvm/include/llvm/Target/TargetOpcodes.h b/libclamav/c++/llvm/include/llvm/Target/TargetOpcodes.h
index 10cb45f..48665b7 100644
--- a/libclamav/c++/llvm/include/llvm/Target/TargetOpcodes.h
+++ b/libclamav/c++/llvm/include/llvm/Target/TargetOpcodes.h
@@ -16,7 +16,7 @@
 
 namespace llvm {
   
-// Invariant opcodes: All instruction sets have these as their low opcodes.
+/// Invariant opcodes: All instruction sets have these as their low opcodes.
 namespace TargetOpcode {
   enum { 
     PHI = 0,
@@ -63,7 +63,7 @@ namespace TargetOpcode {
     /// the copy are emitted with the TargetInstrInfo::copyRegToReg hook.
     COPY_TO_REGCLASS = 10,
     
-    // DBG_VALUE - a mapping of the llvm.dbg.value intrinsic
+    /// DBG_VALUE - a mapping of the llvm.dbg.value intrinsic
     DBG_VALUE = 11
   };
 } // end namespace TargetOpcode
diff --git a/libclamav/c++/llvm/include/llvm/Target/TargetRegisterInfo.h b/libclamav/c++/llvm/include/llvm/Target/TargetRegisterInfo.h
index 65b60f7..212cc93 100644
--- a/libclamav/c++/llvm/include/llvm/Target/TargetRegisterInfo.h
+++ b/libclamav/c++/llvm/include/llvm/Target/TargetRegisterInfo.h
@@ -587,6 +587,17 @@ public:
     return !hasFP(MF);
   }
 
+  /// canSimplifyCallFramePseudos - When possible, it's best to simplify the
+  /// call frame pseudo ops before doing frame index elimination. This is
+  /// possible only when frame index references between the pseudos won't
+  /// need adjusted for the call frame adjustments. Normally, that's true
+  /// if the function has a reserved call frame or a frame pointer. Some
+  /// targets (Thumb2, for example) may have more complicated criteria,
+  /// however, and can override this behavior.
+  virtual bool canSimplifyCallFramePseudos(MachineFunction &MF) const {
+    return hasReservedCallFrame(MF) || hasFP(MF);
+  }
+
   /// hasReservedSpillSlot - Return true if target has reserved a spill slot in
   /// the stack frame of the given function for the specified register. e.g. On
   /// x86, if the frame register is required, the first fixed stack object is
diff --git a/libclamav/c++/llvm/include/llvm/Target/TargetRegistry.h b/libclamav/c++/llvm/include/llvm/Target/TargetRegistry.h
index 37380ab..a409b62 100644
--- a/libclamav/c++/llvm/include/llvm/Target/TargetRegistry.h
+++ b/libclamav/c++/llvm/include/llvm/Target/TargetRegistry.h
@@ -26,6 +26,7 @@
 namespace llvm {
   class AsmPrinter;
   class Module;
+  class MCAssembler;
   class MCAsmInfo;
   class MCAsmParser;
   class MCCodeEmitter;
@@ -33,6 +34,7 @@ namespace llvm {
   class MCDisassembler;
   class MCInstPrinter;
   class MCStreamer;
+  class TargetAsmBackend;
   class TargetAsmLexer;
   class TargetAsmParser;
   class TargetMachine;
@@ -63,6 +65,8 @@ namespace llvm {
                                             MCContext &Ctx,
                                             MCStreamer &Streamer,
                                             const MCAsmInfo *MAI);
+    typedef TargetAsmBackend *(*AsmBackendCtorTy)(const Target &T,
+                                                  MCAssembler &A);
     typedef TargetAsmLexer *(*AsmLexerCtorTy)(const Target &T,
                                               const MCAsmInfo &MAI);
     typedef TargetAsmParser *(*AsmParserCtorTy)(const Target &T,MCAsmParser &P);
@@ -94,32 +98,35 @@ namespace llvm {
     bool HasJIT;
 
     AsmInfoCtorFnTy AsmInfoCtorFn;
-    
+
     /// TargetMachineCtorFn - Construction function for this target's
     /// TargetMachine, if registered.
     TargetMachineCtorTy TargetMachineCtorFn;
 
-    /// AsmPrinterCtorFn - Construction function for this target's AsmPrinter,
-    /// if registered.
-    AsmPrinterCtorTy AsmPrinterCtorFn;
+    /// AsmBackendCtorFn - Construction function for this target's
+    /// TargetAsmBackend, if registered.
+    AsmBackendCtorTy AsmBackendCtorFn;
 
     /// AsmLexerCtorFn - Construction function for this target's TargetAsmLexer,
     /// if registered.
     AsmLexerCtorTy AsmLexerCtorFn;
-    
+
     /// AsmParserCtorFn - Construction function for this target's
     /// TargetAsmParser, if registered.
     AsmParserCtorTy AsmParserCtorFn;
-    
+
+    /// AsmPrinterCtorFn - Construction function for this target's AsmPrinter,
+    /// if registered.
+    AsmPrinterCtorTy AsmPrinterCtorFn;
+
     /// MCDisassemblerCtorFn - Construction function for this target's
     /// MCDisassembler, if registered.
     MCDisassemblerCtorTy MCDisassemblerCtorFn;
 
-    
-    /// MCInstPrinterCtorFn - Construction function for this target's 
+    /// MCInstPrinterCtorFn - Construction function for this target's
     /// MCInstPrinter, if registered.
     MCInstPrinterCtorTy MCInstPrinterCtorFn;
-    
+
     /// CodeEmitterCtorFn - Construction function for this target's CodeEmitter,
     /// if registered.
     CodeEmitterCtorTy CodeEmitterCtorFn;
@@ -147,12 +154,18 @@ namespace llvm {
     /// hasTargetMachine - Check if this target supports code generation.
     bool hasTargetMachine() const { return TargetMachineCtorFn != 0; }
 
-    /// hasAsmPrinter - Check if this target supports .s printing.
-    bool hasAsmPrinter() const { return AsmPrinterCtorFn != 0; }
+    /// hasAsmBackend - Check if this target supports .o generation.
+    bool hasAsmBackend() const { return AsmBackendCtorFn != 0; }
+
+    /// hasAsmLexer - Check if this target supports .s lexing.
+    bool hasAsmLexer() const { return AsmLexerCtorFn != 0; }
 
     /// hasAsmParser - Check if this target supports .s parsing.
     bool hasAsmParser() const { return AsmParserCtorFn != 0; }
-    
+
+    /// hasAsmPrinter - Check if this target supports .s printing.
+    bool hasAsmPrinter() const { return AsmPrinterCtorFn != 0; }
+
     /// hasMCDisassembler - Check if this target has a disassembler.
     bool hasMCDisassembler() const { return MCDisassemblerCtorFn != 0; }
 
@@ -165,7 +178,7 @@ namespace llvm {
     /// @}
     /// @name Feature Constructors
     /// @{
-    
+
     /// createAsmInfo - Create a MCAsmInfo implementation for the specified
     /// target triple.
     ///
@@ -178,7 +191,7 @@ namespace llvm {
         return 0;
       return AsmInfoCtorFn(*this, Triple);
     }
-    
+
     /// createTargetMachine - Create a target specific machine implementation
     /// for the specified \arg Triple.
     ///
@@ -193,14 +206,13 @@ namespace llvm {
       return TargetMachineCtorFn(*this, Triple, Features);
     }
 
-    /// createAsmPrinter - Create a target specific assembly printer pass.  This
-    /// takes ownership of the MCContext and MCStreamer objects but not the MAI.
-    AsmPrinter *createAsmPrinter(formatted_raw_ostream &OS, TargetMachine &TM,
-                                 MCContext &Ctx, MCStreamer &Streamer,
-                                 const MCAsmInfo *MAI) const {
-      if (!AsmPrinterCtorFn)
+    /// createAsmBackend - Create a target specific assembly parser.
+    ///
+    /// \arg Backend - The target independent assembler object.
+    TargetAsmBackend *createAsmBackend(MCAssembler &Backend) const {
+      if (!AsmBackendCtorFn)
         return 0;
-      return AsmPrinterCtorFn(OS, TM, Ctx, Streamer, MAI);
+      return AsmBackendCtorFn(*this, Backend);
     }
 
     /// createAsmLexer - Create a target specific assembly lexer.
@@ -210,7 +222,7 @@ namespace llvm {
         return 0;
       return AsmLexerCtorFn(*this, MAI);
     }
-    
+
     /// createAsmParser - Create a target specific assembly parser.
     ///
     /// \arg Parser - The target independent parser implementation to use for
@@ -220,7 +232,17 @@ namespace llvm {
         return 0;
       return AsmParserCtorFn(*this, Parser);
     }
-    
+
+    /// createAsmPrinter - Create a target specific assembly printer pass.  This
+    /// takes ownership of the MCContext and MCStreamer objects but not the MAI.
+    AsmPrinter *createAsmPrinter(formatted_raw_ostream &OS, TargetMachine &TM,
+                                 MCContext &Ctx, MCStreamer &Streamer,
+                                 const MCAsmInfo *MAI) const {
+      if (!AsmPrinterCtorFn)
+        return 0;
+      return AsmPrinterCtorFn(OS, TM, Ctx, Streamer, MAI);
+    }
+
     const MCDisassembler *createMCDisassembler() const {
       if (!MCDisassemblerCtorFn)
         return 0;
@@ -234,8 +256,8 @@ namespace llvm {
         return 0;
       return MCInstPrinterCtorFn(*this, SyntaxVariant, MAI, O);
     }
-    
-    
+
+
     /// createCodeEmitter - Create a target specific code emitter.
     MCCodeEmitter *createCodeEmitter(TargetMachine &TM, MCContext &Ctx) const {
       if (!CodeEmitterCtorFn)
@@ -270,8 +292,8 @@ namespace llvm {
         return *this;
       }
       iterator operator++(int) {        // Postincrement
-        iterator tmp = *this; 
-        ++*this; 
+        iterator tmp = *this;
+        ++*this;
         return tmp;
       }
 
@@ -313,7 +335,7 @@ namespace llvm {
 
     /// RegisterTarget - Register the given target. Attempts to register a
     /// target which has already been registered will be ignored.
-    /// 
+    ///
     /// Clients are responsible for ensuring that registration doesn't occur
     /// while another thread is attempting to access the registry. Typically
     /// this is done by initializing all targets at program startup.
@@ -321,7 +343,7 @@ namespace llvm {
     /// @param T - The target being registered.
     /// @param Name - The target name. This should be a static string.
     /// @param ShortDesc - A short target description. This should be a static
-    /// string. 
+    /// string.
     /// @param TQualityFn - The triple match quality computation function for
     /// this target.
     /// @param HasJIT - Whether the target supports JIT code
@@ -334,11 +356,11 @@ namespace llvm {
 
     /// RegisterAsmInfo - Register a MCAsmInfo implementation for the
     /// given target.
-    /// 
+    ///
     /// Clients are responsible for ensuring that registration doesn't occur
     /// while another thread is attempting to access the registry. Typically
     /// this is done by initializing all targets at program startup.
-    /// 
+    ///
     /// @param T - The target being registered.
     /// @param Fn - A function to construct a MCAsmInfo for the target.
     static void RegisterAsmInfo(Target &T, Target::AsmInfoCtorFnTy Fn) {
@@ -346,76 +368,90 @@ namespace llvm {
       if (!T.AsmInfoCtorFn)
         T.AsmInfoCtorFn = Fn;
     }
-    
+
     /// RegisterTargetMachine - Register a TargetMachine implementation for the
     /// given target.
-    /// 
+    ///
     /// Clients are responsible for ensuring that registration doesn't occur
     /// while another thread is attempting to access the registry. Typically
     /// this is done by initializing all targets at program startup.
-    /// 
+    ///
     /// @param T - The target being registered.
     /// @param Fn - A function to construct a TargetMachine for the target.
-    static void RegisterTargetMachine(Target &T, 
+    static void RegisterTargetMachine(Target &T,
                                       Target::TargetMachineCtorTy Fn) {
       // Ignore duplicate registration.
       if (!T.TargetMachineCtorFn)
         T.TargetMachineCtorFn = Fn;
     }
 
-    /// RegisterAsmPrinter - Register an AsmPrinter implementation for the given
-    /// target.
-    /// 
+    /// RegisterAsmBackend - Register a TargetAsmBackend implementation for the
+    /// given target.
+    ///
     /// Clients are responsible for ensuring that registration doesn't occur
     /// while another thread is attempting to access the registry. Typically
     /// this is done by initializing all targets at program startup.
     ///
     /// @param T - The target being registered.
-    /// @param Fn - A function to construct an AsmPrinter for the target.
-    static void RegisterAsmPrinter(Target &T, Target::AsmPrinterCtorTy Fn) {
-      // Ignore duplicate registration.
-      if (!T.AsmPrinterCtorFn)
-        T.AsmPrinterCtorFn = Fn;
+    /// @param Fn - A function to construct an AsmBackend for the target.
+    static void RegisterAsmBackend(Target &T, Target::AsmBackendCtorTy Fn) {
+      if (!T.AsmBackendCtorFn)
+        T.AsmBackendCtorFn = Fn;
     }
 
     /// RegisterAsmLexer - Register a TargetAsmLexer implementation for the
     /// given target.
-    /// 
+    ///
     /// Clients are responsible for ensuring that registration doesn't occur
     /// while another thread is attempting to access the registry. Typically
     /// this is done by initializing all targets at program startup.
     ///
     /// @param T - The target being registered.
-    /// @param Fn - A function to construct an AsmPrinter for the target.
+    /// @param Fn - A function to construct an AsmLexer for the target.
     static void RegisterAsmLexer(Target &T, Target::AsmLexerCtorTy Fn) {
       if (!T.AsmLexerCtorFn)
         T.AsmLexerCtorFn = Fn;
     }
-    
+
     /// RegisterAsmParser - Register a TargetAsmParser implementation for the
     /// given target.
-    /// 
+    ///
     /// Clients are responsible for ensuring that registration doesn't occur
     /// while another thread is attempting to access the registry. Typically
     /// this is done by initializing all targets at program startup.
     ///
     /// @param T - The target being registered.
-    /// @param Fn - A function to construct an AsmPrinter for the target.
+    /// @param Fn - A function to construct an AsmParser for the target.
     static void RegisterAsmParser(Target &T, Target::AsmParserCtorTy Fn) {
       if (!T.AsmParserCtorFn)
         T.AsmParserCtorFn = Fn;
     }
-    
+
+    /// RegisterAsmPrinter - Register an AsmPrinter implementation for the given
+    /// target.
+    ///
+    /// Clients are responsible for ensuring that registration doesn't occur
+    /// while another thread is attempting to access the registry. Typically
+    /// this is done by initializing all targets at program startup.
+    ///
+    /// @param T - The target being registered.
+    /// @param Fn - A function to construct an AsmPrinter for the target.
+    static void RegisterAsmPrinter(Target &T, Target::AsmPrinterCtorTy Fn) {
+      // Ignore duplicate registration.
+      if (!T.AsmPrinterCtorFn)
+        T.AsmPrinterCtorFn = Fn;
+    }
+
     /// RegisterMCDisassembler - Register a MCDisassembler implementation for
     /// the given target.
-    /// 
+    ///
     /// Clients are responsible for ensuring that registration doesn't occur
     /// while another thread is attempting to access the registry. Typically
     /// this is done by initializing all targets at program startup.
     ///
     /// @param T - The target being registered.
     /// @param Fn - A function to construct an MCDisassembler for the target.
-    static void RegisterMCDisassembler(Target &T, 
+    static void RegisterMCDisassembler(Target &T,
                                        Target::MCDisassemblerCtorTy Fn) {
       if (!T.MCDisassemblerCtorFn)
         T.MCDisassemblerCtorFn = Fn;
@@ -423,7 +459,7 @@ namespace llvm {
 
     /// RegisterMCInstPrinter - Register a MCInstPrinter implementation for the
     /// given target.
-    /// 
+    ///
     /// Clients are responsible for ensuring that registration doesn't occur
     /// while another thread is attempting to access the registry. Typically
     /// this is done by initializing all targets at program startup.
@@ -435,7 +471,7 @@ namespace llvm {
       if (!T.MCInstPrinterCtorFn)
         T.MCInstPrinterCtorFn = Fn;
     }
-    
+
     /// RegisterCodeEmitter - Register a MCCodeEmitter implementation for the
     /// given target.
     ///
@@ -444,7 +480,7 @@ namespace llvm {
     /// this is done by initializing all targets at program startup.
     ///
     /// @param T - The target being registered.
-    /// @param Fn - A function to construct an AsmPrinter for the target.
+    /// @param Fn - A function to construct an MCCodeEmitter for the target.
     static void RegisterCodeEmitter(Target &T, Target::CodeEmitterCtorTy Fn) {
       if (!T.CodeEmitterCtorFn)
         T.CodeEmitterCtorFn = Fn;
@@ -498,7 +534,7 @@ namespace llvm {
     static const MCAsmInfo *Allocator(const Target &T, StringRef TT) {
       return new MCAsmInfoImpl(T, TT);
     }
-    
+
   };
 
   /// RegisterAsmInfoFn - Helper template for registering a target assembly info
@@ -537,25 +573,22 @@ namespace llvm {
     }
   };
 
-  /// RegisterAsmPrinter - Helper template for registering a target specific
-  /// assembly printer, for use in the target machine initialization
-  /// function. Usage:
+  /// RegisterAsmBackend - Helper template for registering a target specific
+  /// assembler backend. Usage:
   ///
-  /// extern "C" void LLVMInitializeFooAsmPrinter() {
+  /// extern "C" void LLVMInitializeFooAsmBackend() {
   ///   extern Target TheFooTarget;
-  ///   RegisterAsmPrinter<FooAsmPrinter> X(TheFooTarget);
+  ///   RegisterAsmBackend<FooAsmLexer> X(TheFooTarget);
   /// }
-  template<class AsmPrinterImpl>
-  struct RegisterAsmPrinter {
-    RegisterAsmPrinter(Target &T) {
-      TargetRegistry::RegisterAsmPrinter(T, &Allocator);
+  template<class AsmBackendImpl>
+  struct RegisterAsmBackend {
+    RegisterAsmBackend(Target &T) {
+      TargetRegistry::RegisterAsmBackend(T, &Allocator);
     }
 
   private:
-    static AsmPrinter *Allocator(formatted_raw_ostream &OS, TargetMachine &TM,
-                                 MCContext &Ctx, MCStreamer &Streamer,
-                                 const MCAsmInfo *MAI) {
-      return new AsmPrinterImpl(OS, TM, Ctx, Streamer, MAI);
+    static TargetAsmBackend *Allocator(const Target &T, MCAssembler &Backend) {
+      return new AsmBackendImpl(T, Backend);
     }
   };
 
@@ -572,7 +605,7 @@ namespace llvm {
     RegisterAsmLexer(Target &T) {
       TargetRegistry::RegisterAsmLexer(T, &Allocator);
     }
-    
+
   private:
     static TargetAsmLexer *Allocator(const Target &T, const MCAsmInfo &MAI) {
       return new AsmLexerImpl(T, MAI);
@@ -599,6 +632,28 @@ namespace llvm {
     }
   };
 
+  /// RegisterAsmPrinter - Helper template for registering a target specific
+  /// assembly printer, for use in the target machine initialization
+  /// function. Usage:
+  ///
+  /// extern "C" void LLVMInitializeFooAsmPrinter() {
+  ///   extern Target TheFooTarget;
+  ///   RegisterAsmPrinter<FooAsmPrinter> X(TheFooTarget);
+  /// }
+  template<class AsmPrinterImpl>
+  struct RegisterAsmPrinter {
+    RegisterAsmPrinter(Target &T) {
+      TargetRegistry::RegisterAsmPrinter(T, &Allocator);
+    }
+
+  private:
+    static AsmPrinter *Allocator(formatted_raw_ostream &OS, TargetMachine &TM,
+                                 MCContext &Ctx, MCStreamer &Streamer,
+                                 const MCAsmInfo *MAI) {
+      return new AsmPrinterImpl(OS, TM, Ctx, Streamer, MAI);
+    }
+  };
+
   /// RegisterCodeEmitter - Helper template for registering a target specific
   /// machine code emitter, for use in the target initialization
   /// function. Usage:
diff --git a/libclamav/c++/llvm/include/llvm/Target/TargetSelectionDAG.td b/libclamav/c++/llvm/include/llvm/Target/TargetSelectionDAG.td
index 4b72f81..4365d33 100644
--- a/libclamav/c++/llvm/include/llvm/Target/TargetSelectionDAG.td
+++ b/libclamav/c++/llvm/include/llvm/Target/TargetSelectionDAG.td
@@ -479,7 +479,6 @@ class PatLeaf<dag frag, code pred = [{}], SDNodeXForm xform = NOOP_SDNodeXForm>
 def vtInt      : PatLeaf<(vt),  [{ return N->getVT().isInteger(); }]>;
 def vtFP       : PatLeaf<(vt),  [{ return N->getVT().isFloatingPoint(); }]>;
 
-def immAllOnes : PatLeaf<(imm), [{ return N->isAllOnesValue(); }]>;
 def immAllOnesV: PatLeaf<(build_vector), [{
   return ISD::isBuildVectorAllOnes(N);
 }]>;
@@ -496,7 +495,7 @@ def immAllZerosV_bc: PatLeaf<(bitconvert), [{
 
 
 // Other helper fragments.
-def not  : PatFrag<(ops node:$in), (xor node:$in, immAllOnes)>;
+def not  : PatFrag<(ops node:$in), (xor node:$in, -1)>;
 def vnot : PatFrag<(ops node:$in), (xor node:$in, immAllOnesV)>;
 def vnot_conv : PatFrag<(ops node:$in), (xor node:$in, immAllOnesV_bc)>;
 def ineg : PatFrag<(ops node:$in), (sub 0, node:$in)>;
diff --git a/libclamav/c++/llvm/include/llvm/Transforms/Scalar.h b/libclamav/c++/llvm/include/llvm/Transforms/Scalar.h
index 7159f86..6893bad 100644
--- a/libclamav/c++/llvm/include/llvm/Transforms/Scalar.h
+++ b/libclamav/c++/llvm/include/llvm/Transforms/Scalar.h
@@ -263,7 +263,7 @@ extern const PassInfo *const LCSSAID;
 // GVN - This pass performs global value numbering and redundant load 
 // elimination cotemporaneously.
 //
-FunctionPass *createGVNPass(bool NoPRE = false, bool NoLoads = false);
+FunctionPass *createGVNPass(bool NoLoads = false);
 
 //===----------------------------------------------------------------------===//
 //
diff --git a/libclamav/c++/llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h b/libclamav/c++/llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h
index 3f4571e..5279e96 100644
--- a/libclamav/c++/llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h
+++ b/libclamav/c++/llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h
@@ -102,6 +102,12 @@ void FindFunctionBackedges(const Function &F,
 //
 void RemoveSuccessor(TerminatorInst *TI, unsigned SuccNum);
 
+/// GetSuccessorNumber - Search for the specified successor of basic block BB
+/// and return its position in the terminator instruction's list of
+/// successors.  It is an error to call this with a block that is not a
+/// successor.
+unsigned GetSuccessorNumber(BasicBlock *BB, BasicBlock *Succ);
+
 /// isCriticalEdge - Return true if the specified edge is a critical edge.
 /// Critical edges are edges from a block with multiple successors to a block
 /// with multiple predecessors.
diff --git a/libclamav/c++/llvm/include/llvm/Transforms/Utils/BuildLibCalls.h b/libclamav/c++/llvm/include/llvm/Transforms/Utils/BuildLibCalls.h
new file mode 100644
index 0000000..03716a8
--- /dev/null
+++ b/libclamav/c++/llvm/include/llvm/Transforms/Utils/BuildLibCalls.h
@@ -0,0 +1,96 @@
+//===- BuildLibCalls.h - Utility builder for libcalls -----------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file exposes an interface to build some C language libcalls for
+// optimization passes that need to call the various functions.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef TRANSFORMS_UTILS_BUILDLIBCALLS_H
+#define TRANSFORMS_UTILS_BUILDLIBCALLS_H
+
+#include "llvm/Support/IRBuilder.h"
+
+namespace llvm {
+  class Value;
+  class TargetData;
+  
+  /// CastToCStr - Return V if it is an i8*, otherwise cast it to i8*.
+  Value *CastToCStr(Value *V, IRBuilder<> &B);
+
+  /// EmitStrLen - Emit a call to the strlen function to the builder, for the
+  /// specified pointer.  Ptr is required to be some pointer type, and the
+  /// return value has 'intptr_t' type.
+  Value *EmitStrLen(Value *Ptr, IRBuilder<> &B, const TargetData *TD);
+
+  /// EmitStrChr - Emit a call to the strchr function to the builder, for the
+  /// specified pointer and character.  Ptr is required to be some pointer type,
+  /// and the return value has 'i8*' type.
+  Value *EmitStrChr(Value *Ptr, char C, IRBuilder<> &B, const TargetData *TD);
+
+  /// EmitStrCpy - Emit a call to the strcpy function to the builder, for the
+  /// specified pointer arguments.
+  Value *EmitStrCpy(Value *Dst, Value *Src, IRBuilder<> &B,
+                    const TargetData *TD);
+  
+  /// EmitMemCpy - Emit a call to the memcpy function to the builder.  This
+  /// always expects that the size has type 'intptr_t' and Dst/Src are pointers.
+  Value *EmitMemCpy(Value *Dst, Value *Src, Value *Len,
+                    unsigned Align, IRBuilder<> &B, const TargetData *TD);
+
+  /// EmitMemMove - Emit a call to the memmove function to the builder.  This
+  /// always expects that the size has type 'intptr_t' and Dst/Src are pointers.
+  Value *EmitMemMove(Value *Dst, Value *Src, Value *Len,
+		                 unsigned Align, IRBuilder<> &B, const TargetData *TD);
+
+  /// EmitMemChr - Emit a call to the memchr function.  This assumes that Ptr is
+  /// a pointer, Val is an i32 value, and Len is an 'intptr_t' value.
+  Value *EmitMemChr(Value *Ptr, Value *Val, Value *Len, IRBuilder<> &B,
+                    const TargetData *TD);
+
+  /// EmitMemCmp - Emit a call to the memcmp function.
+  Value *EmitMemCmp(Value *Ptr1, Value *Ptr2, Value *Len, IRBuilder<> &B,
+                    const TargetData *TD);
+
+  /// EmitMemSet - Emit a call to the memset function
+  Value *EmitMemSet(Value *Dst, Value *Val, Value *Len, IRBuilder<> &B,
+                    const TargetData *TD);
+
+  /// EmitUnaryFloatFnCall - Emit a call to the unary function named 'Name'
+  /// (e.g.  'floor').  This function is known to take a single of type matching
+  /// 'Op' and returns one value with the same type.  If 'Op' is a long double,
+  /// 'l' is added as the suffix of name, if 'Op' is a float, we add a 'f'
+  /// suffix.
+  Value *EmitUnaryFloatFnCall(Value *Op, const char *Name, IRBuilder<> &B,
+                              const AttrListPtr &Attrs);
+
+  /// EmitPutChar - Emit a call to the putchar function.  This assumes that Char
+  /// is an integer.
+  Value *EmitPutChar(Value *Char, IRBuilder<> &B, const TargetData *TD);
+
+  /// EmitPutS - Emit a call to the puts function.  This assumes that Str is
+  /// some pointer.
+  void EmitPutS(Value *Str, IRBuilder<> &B, const TargetData *TD);
+
+  /// EmitFPutC - Emit a call to the fputc function.  This assumes that Char is
+  /// an i32, and File is a pointer to FILE.
+  void EmitFPutC(Value *Char, Value *File, IRBuilder<> &B,
+                 const TargetData *TD);
+
+  /// EmitFPutS - Emit a call to the puts function.  Str is required to be a
+  /// pointer and File is a pointer to FILE.
+  void EmitFPutS(Value *Str, Value *File, IRBuilder<> &B, const TargetData *TD);
+
+  /// EmitFWrite - Emit a call to the fwrite function.  This assumes that Ptr is
+  /// a pointer, Size is an 'intptr_t', and File is a pointer to FILE.
+  void EmitFWrite(Value *Ptr, Value *Size, Value *File, IRBuilder<> &B,
+                  const TargetData *TD);
+}
+
+#endif
diff --git a/libclamav/c++/llvm/include/llvm/Type.h b/libclamav/c++/llvm/include/llvm/Type.h
index 52b2c84..d09913a 100644
--- a/libclamav/c++/llvm/include/llvm/Type.h
+++ b/libclamav/c++/llvm/include/llvm/Type.h
@@ -89,7 +89,7 @@ public:
     VectorTyID,      ///< 15: SIMD 'packed' format, or other vector type
 
     NumTypeIDs,                         // Must remain as last defined ID
-    LastPrimitiveTyID = LabelTyID,
+    LastPrimitiveTyID = MetadataTyID,
     FirstDerivedTyID = IntegerTyID
   };
 
@@ -182,6 +182,9 @@ public:
   // are defined in private classes defined in Type.cpp for primitive types.
   //
 
+  /// getDescription - Return the string representation of the type.
+  std::string getDescription() const;
+
   /// getTypeID - Return the type id for the type.  This will return one
   /// of the TypeID enum elements defined above.
   ///
@@ -205,55 +208,60 @@ public:
   /// isPPC_FP128Ty - Return true if this is powerpc long double.
   bool isPPC_FP128Ty() const { return ID == PPC_FP128TyID; }
 
+  /// isFloatingPointTy - Return true if this is one of the five floating point
+  /// types
+  bool isFloatingPointTy() const { return ID == FloatTyID || ID == DoubleTyID ||
+      ID == X86_FP80TyID || ID == FP128TyID || ID == PPC_FP128TyID; }
+
+  /// isFPOrFPVectorTy - Return true if this is a FP type or a vector of FP.
+  ///
+  bool isFPOrFPVectorTy() const;
+ 
   /// isLabelTy - Return true if this is 'label'.
   bool isLabelTy() const { return ID == LabelTyID; }
 
   /// isMetadataTy - Return true if this is 'metadata'.
   bool isMetadataTy() const { return ID == MetadataTyID; }
 
-  /// getDescription - Return the string representation of the type.
-  std::string getDescription() const;
-
-  /// isInteger - True if this is an instance of IntegerType.
+  /// isIntegerTy - True if this is an instance of IntegerType.
   ///
-  bool isInteger() const { return ID == IntegerTyID; } 
+  bool isIntegerTy() const { return ID == IntegerTyID; } 
 
-  /// isInteger - Return true if this is an IntegerType of the specified width.
-  bool isInteger(unsigned Bitwidth) const;
+  /// isIntegerTy - Return true if this is an IntegerType of the given width.
+  bool isIntegerTy(unsigned Bitwidth) const;
 
-  /// isIntOrIntVector - Return true if this is an integer type or a vector of
+  /// isIntOrIntVectorTy - Return true if this is an integer type or a vector of
   /// integer types.
   ///
-  bool isIntOrIntVector() const;
+  bool isIntOrIntVectorTy() const;
   
-  /// isFloatingPoint - Return true if this is one of the five floating point
-  /// types
-  bool isFloatingPoint() const { return ID == FloatTyID || ID == DoubleTyID ||
-      ID == X86_FP80TyID || ID == FP128TyID || ID == PPC_FP128TyID; }
+  /// isFunctionTy - True if this is an instance of FunctionType.
+  ///
+  bool isFunctionTy() const { return ID == FunctionTyID; }
 
-  /// isFPOrFPVector - Return true if this is a FP type or a vector of FP types.
+  /// isStructTy - True if this is an instance of StructType.
   ///
-  bool isFPOrFPVector() const;
- 
-  /// isFunction - True if this is an instance of FunctionType.
+  bool isStructTy() const { return ID == StructTyID; }
+
+  /// isUnionTy - True if this is an instance of UnionType.
   ///
-  bool isFunction() const { return ID == FunctionTyID; }
+  bool isUnionTy() const { return ID == UnionTyID; }
 
-  /// isStruct - True if this is an instance of StructType.
+  /// isArrayTy - True if this is an instance of ArrayType.
   ///
-  bool isStruct() const { return ID == StructTyID; }
+  bool isArrayTy() const { return ID == ArrayTyID; }
 
-  /// isArray - True if this is an instance of ArrayType.
+  /// isPointerTy - True if this is an instance of PointerType.
   ///
-  bool isArray() const { return ID == ArrayTyID; }
+  bool isPointerTy() const { return ID == PointerTyID; }
 
-  /// isPointer - True if this is an instance of PointerType.
+  /// isOpaqueTy - True if this is an instance of OpaqueType.
   ///
-  bool isPointer() const { return ID == PointerTyID; }
+  bool isOpaqueTy() const { return ID == OpaqueTyID; }
 
-  /// isVector - True if this is an instance of VectorType.
+  /// isVectorTy - True if this is an instance of VectorType.
   ///
-  bool isVector() const { return ID == VectorTyID; }
+  bool isVectorTy() const { return ID == VectorTyID; }
 
   /// isAbstract - True if the type is either an Opaque type, or is a derived
   /// type that includes an opaque type somewhere in it.
@@ -307,7 +315,7 @@ public:
   ///
   bool isSized() const {
     // If it's a primitive, it is always sized.
-    if (ID == IntegerTyID || isFloatingPoint() || ID == PointerTyID)
+    if (ID == IntegerTyID || isFloatingPointTy() || ID == PointerTyID)
       return true;
     // If it is not something that can have a size (e.g. a function or label),
     // it doesn't have a size.
diff --git a/libclamav/c++/llvm/lib/Analysis/AliasAnalysisCounter.cpp b/libclamav/c++/llvm/lib/Analysis/AliasAnalysisCounter.cpp
index 761cd46..1053955 100644
--- a/libclamav/c++/llvm/lib/Analysis/AliasAnalysisCounter.cpp
+++ b/libclamav/c++/llvm/lib/Analysis/AliasAnalysisCounter.cpp
@@ -162,7 +162,7 @@ AliasAnalysisCounter::getModRefInfo(CallSite CS, Value *P, unsigned Size) {
     errs() << MRString << ":  Ptr: ";
     errs() << "[" << Size << "B] ";
     WriteAsOperand(errs(), P, true, M);
-    errs() << "\t<->" << *CS.getInstruction();
+    errs() << "\t<->" << *CS.getInstruction() << '\n';
   }
   return R;
 }
diff --git a/libclamav/c++/llvm/lib/Analysis/AliasAnalysisEvaluator.cpp b/libclamav/c++/llvm/lib/Analysis/AliasAnalysisEvaluator.cpp
index 6b0a956..308b9e3 100644
--- a/libclamav/c++/llvm/lib/Analysis/AliasAnalysisEvaluator.cpp
+++ b/libclamav/c++/llvm/lib/Analysis/AliasAnalysisEvaluator.cpp
@@ -115,11 +115,11 @@ bool AAEval::runOnFunction(Function &F) {
   SetVector<CallSite> CallSites;
 
   for (Function::arg_iterator I = F.arg_begin(), E = F.arg_end(); I != E; ++I)
-    if (isa<PointerType>(I->getType()))    // Add all pointer arguments
+    if (I->getType()->isPointerTy())    // Add all pointer arguments
       Pointers.insert(I);
 
   for (inst_iterator I = inst_begin(F), E = inst_end(F); I != E; ++I) {
-    if (isa<PointerType>(I->getType())) // Add all pointer instructions
+    if (I->getType()->isPointerTy()) // Add all pointer instructions
       Pointers.insert(&*I);
     Instruction &Inst = *I;
     User::op_iterator OI = Inst.op_begin();
@@ -128,7 +128,7 @@ bool AAEval::runOnFunction(Function &F) {
         isa<Function>(CS.getCalledValue()))
       ++OI;  // Skip actual functions for direct function calls.
     for (; OI != Inst.op_end(); ++OI)
-      if (isa<PointerType>((*OI)->getType()) && !isa<ConstantPointerNull>(*OI))
+      if ((*OI)->getType()->isPointerTy() && !isa<ConstantPointerNull>(*OI))
         Pointers.insert(*OI);
 
     if (CS.getInstruction()) CallSites.insert(CS);
diff --git a/libclamav/c++/llvm/lib/Analysis/BasicAliasAnalysis.cpp b/libclamav/c++/llvm/lib/Analysis/BasicAliasAnalysis.cpp
index 36b831c..31a649d 100644
--- a/libclamav/c++/llvm/lib/Analysis/BasicAliasAnalysis.cpp
+++ b/libclamav/c++/llvm/lib/Analysis/BasicAliasAnalysis.cpp
@@ -290,7 +290,7 @@ BasicAliasAnalysis::getModRefInfo(CallSite CS, Value *P, unsigned Size) {
     for (CallSite::arg_iterator CI = CS.arg_begin(), CE = CS.arg_end();
          CI != CE; ++CI, ++ArgNo) {
       // Only look at the no-capture pointer arguments.
-      if (!isa<PointerType>((*CI)->getType()) ||
+      if (!(*CI)->getType()->isPointerTy() ||
           !CS.paramHasAttr(ArgNo+1, Attribute::NoCapture))
         continue;
       
@@ -662,7 +662,7 @@ BasicAliasAnalysis::aliasCheck(const Value *V1, unsigned V1Size,
   // Are we checking for alias of the same value?
   if (V1 == V2) return MustAlias;
 
-  if (!isa<PointerType>(V1->getType()) || !isa<PointerType>(V2->getType()))
+  if (!V1->getType()->isPointerTy() || !V2->getType()->isPointerTy())
     return NoAlias;  // Scalars cannot alias each other
 
   // Figure out what objects these things are pointing to if we can.
diff --git a/libclamav/c++/llvm/lib/Analysis/CaptureTracking.cpp b/libclamav/c++/llvm/lib/Analysis/CaptureTracking.cpp
index 10a8b11..8767c18 100644
--- a/libclamav/c++/llvm/lib/Analysis/CaptureTracking.cpp
+++ b/libclamav/c++/llvm/lib/Analysis/CaptureTracking.cpp
@@ -44,7 +44,7 @@ static int const Threshold = 20;
 /// counts as capturing it or not.
 bool llvm::PointerMayBeCaptured(const Value *V,
                                 bool ReturnCaptures, bool StoreCaptures) {
-  assert(isa<PointerType>(V->getType()) && "Capture is for pointers only!");
+  assert(V->getType()->isPointerTy() && "Capture is for pointers only!");
   SmallVector<Use*, Threshold> Worklist;
   SmallSet<Use*, Threshold> Visited;
   int Count = 0;
diff --git a/libclamav/c++/llvm/lib/Analysis/ConstantFolding.cpp b/libclamav/c++/llvm/lib/Analysis/ConstantFolding.cpp
index ba87040..114db2d 100644
--- a/libclamav/c++/llvm/lib/Analysis/ConstantFolding.cpp
+++ b/libclamav/c++/llvm/lib/Analysis/ConstantFolding.cpp
@@ -80,7 +80,7 @@ static Constant *FoldBitCast(Constant *C, const Type *DestTy,
   
   // First thing is first.  We only want to think about integer here, so if
   // we have something in FP form, recast it as integer.
-  if (DstEltTy->isFloatingPoint()) {
+  if (DstEltTy->isFloatingPointTy()) {
     // Fold to an vector of integers with same size as our FP type.
     unsigned FPWidth = DstEltTy->getPrimitiveSizeInBits();
     const Type *DestIVTy =
@@ -95,7 +95,7 @@ static Constant *FoldBitCast(Constant *C, const Type *DestTy,
   
   // Okay, we know the destination is integer, if the input is FP, convert
   // it to integer first.
-  if (SrcEltTy->isFloatingPoint()) {
+  if (SrcEltTy->isFloatingPointTy()) {
     unsigned FPWidth = SrcEltTy->getPrimitiveSizeInBits();
     const Type *SrcIVTy =
       VectorType::get(IntegerType::get(C->getContext(), FPWidth), NumSrcElt);
@@ -359,7 +359,7 @@ static Constant *FoldReinterpretLoadFromConstPtr(Constant *C,
       MapTy = Type::getInt32PtrTy(C->getContext());
     else if (LoadTy->isDoubleTy())
       MapTy = Type::getInt64PtrTy(C->getContext());
-    else if (isa<VectorType>(LoadTy)) {
+    else if (LoadTy->isVectorTy()) {
       MapTy = IntegerType::get(C->getContext(),
                                TD.getTypeAllocSizeInBits(LoadTy));
       MapTy = PointerType::getUnqual(MapTy);
@@ -605,7 +605,7 @@ static Constant *SymbolicallyEvaluateGEP(Constant *const *Ops, unsigned NumOps,
   SmallVector<Constant*, 32> NewIdxs;
   do {
     if (const SequentialType *ATy = dyn_cast<SequentialType>(Ty)) {
-      if (isa<PointerType>(ATy)) {
+      if (ATy->isPointerTy()) {
         // The only pointer indexing we'll do is on the first index of the GEP.
         if (!NewIdxs.empty())
           break;
@@ -783,45 +783,12 @@ Constant *llvm::ConstantFoldInstOperands(unsigned Opcode, const Type *DestTy,
     // If the input is a ptrtoint, turn the pair into a ptr to ptr bitcast if
     // the int size is >= the ptr size.  This requires knowing the width of a
     // pointer, so it can't be done in ConstantExpr::getCast.
-    if (ConstantExpr *CE = dyn_cast<ConstantExpr>(Ops[0])) {
+    if (ConstantExpr *CE = dyn_cast<ConstantExpr>(Ops[0]))
       if (TD &&
-          TD->getPointerSizeInBits() <=
-          CE->getType()->getScalarSizeInBits()) {
-        if (CE->getOpcode() == Instruction::PtrToInt)
-          return FoldBitCast(CE->getOperand(0), DestTy, *TD);
-        
-        // If there's a constant offset added to the integer value before
-        // it is casted back to a pointer, see if the expression can be
-        // converted into a GEP.
-        if (CE->getOpcode() == Instruction::Add)
-          if (ConstantInt *L = dyn_cast<ConstantInt>(CE->getOperand(0)))
-            if (ConstantExpr *R = dyn_cast<ConstantExpr>(CE->getOperand(1)))
-              if (R->getOpcode() == Instruction::PtrToInt)
-                if (GlobalVariable *GV =
-                      dyn_cast<GlobalVariable>(R->getOperand(0))) {
-                  const PointerType *GVTy = cast<PointerType>(GV->getType());
-                  if (const ArrayType *AT =
-                        dyn_cast<ArrayType>(GVTy->getElementType())) {
-                    const Type *ElTy = AT->getElementType();
-                    uint64_t AllocSize = TD->getTypeAllocSize(ElTy);
-                    APInt PSA(L->getValue().getBitWidth(), AllocSize);
-                    if (ElTy == cast<PointerType>(DestTy)->getElementType() &&
-                        L->getValue().urem(PSA) == 0) {
-                      APInt ElemIdx = L->getValue().udiv(PSA);
-                      if (ElemIdx.ult(APInt(ElemIdx.getBitWidth(),
-                                            AT->getNumElements()))) {
-                        Constant *Index[] = {
-                          Constant::getNullValue(CE->getType()),
-                          ConstantInt::get(ElTy->getContext(), ElemIdx)
-                        };
-                        return
-                        ConstantExpr::getGetElementPtr(GV, &Index[0], 2);
-                      }
-                    }
-                  }
-                }
-      }
-    }
+          TD->getPointerSizeInBits() <= CE->getType()->getScalarSizeInBits() &&
+          CE->getOpcode() == Instruction::PtrToInt)
+        return FoldBitCast(CE->getOperand(0), DestTy, *TD);
+
     return ConstantExpr::getCast(Opcode, Ops[0], DestTy);
   case Instruction::Trunc:
   case Instruction::ZExt:
@@ -1179,6 +1146,12 @@ llvm::ConstantFoldCall(Function *F,
       return 0;
     }
     
+    if (isa<UndefValue>(Operands[0])) {
+      if (Name.startswith("llvm.bswap"))
+        return Operands[0];
+      return 0;
+    }
+
     return 0;
   }
   
diff --git a/libclamav/c++/llvm/lib/Analysis/DebugInfo.cpp b/libclamav/c++/llvm/lib/Analysis/DebugInfo.cpp
index 258f1db..5cfe666 100644
--- a/libclamav/c++/llvm/lib/Analysis/DebugInfo.cpp
+++ b/libclamav/c++/llvm/lib/Analysis/DebugInfo.cpp
@@ -1007,12 +1007,15 @@ DIVariable DIFactory::CreateComplexVariable(unsigned Tag, DIDescriptor Context,
 
 /// CreateBlock - This creates a descriptor for a lexical block with the
 /// specified parent VMContext.
-DILexicalBlock DIFactory::CreateLexicalBlock(DIDescriptor Context) {
+DILexicalBlock DIFactory::CreateLexicalBlock(DIDescriptor Context,
+                                             unsigned LineNo, unsigned Col) {
   Value *Elts[] = {
     GetTagConstant(dwarf::DW_TAG_lexical_block),
-    Context.getNode()
+    Context.getNode(),
+    ConstantInt::get(Type::getInt32Ty(VMContext), LineNo),
+    ConstantInt::get(Type::getInt32Ty(VMContext), Col)
   };
-  return DILexicalBlock(MDNode::get(VMContext, &Elts[0], 2));
+  return DILexicalBlock(MDNode::get(VMContext, &Elts[0], 4));
 }
 
 /// CreateNameSpace - This creates new descriptor for a namespace
diff --git a/libclamav/c++/llvm/lib/Analysis/IPA/Andersens.cpp b/libclamav/c++/llvm/lib/Analysis/IPA/Andersens.cpp
deleted file mode 100644
index 4180206..0000000
--- a/libclamav/c++/llvm/lib/Analysis/IPA/Andersens.cpp
+++ /dev/null
@@ -1,2868 +0,0 @@
-//===- Andersens.cpp - Andersen's Interprocedural Alias Analysis ----------===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file defines an implementation of Andersen's interprocedural alias
-// analysis
-//
-// In pointer analysis terms, this is a subset-based, flow-insensitive,
-// field-sensitive, and context-insensitive algorithm pointer algorithm.
-//
-// This algorithm is implemented as three stages:
-//   1. Object identification.
-//   2. Inclusion constraint identification.
-//   3. Offline constraint graph optimization
-//   4. Inclusion constraint solving.
-//
-// The object identification stage identifies all of the memory objects in the
-// program, which includes globals, heap allocated objects, and stack allocated
-// objects.
-//
-// The inclusion constraint identification stage finds all inclusion constraints
-// in the program by scanning the program, looking for pointer assignments and
-// other statements that effect the points-to graph.  For a statement like "A =
-// B", this statement is processed to indicate that A can point to anything that
-// B can point to.  Constraints can handle copies, loads, and stores, and
-// address taking.
-//
-// The offline constraint graph optimization portion includes offline variable
-// substitution algorithms intended to compute pointer and location
-// equivalences.  Pointer equivalences are those pointers that will have the
-// same points-to sets, and location equivalences are those variables that
-// always appear together in points-to sets.  It also includes an offline
-// cycle detection algorithm that allows cycles to be collapsed sooner 
-// during solving.
-//
-// The inclusion constraint solving phase iteratively propagates the inclusion
-// constraints until a fixed point is reached.  This is an O(N^3) algorithm.
-//
-// Function constraints are handled as if they were structs with X fields.
-// Thus, an access to argument X of function Y is an access to node index
-// getNode(Y) + X.  This representation allows handling of indirect calls
-// without any issues.  To wit, an indirect call Y(a,b) is equivalent to
-// *(Y + 1) = a, *(Y + 2) = b.
-// The return node for a function is always located at getNode(F) +
-// CallReturnPos. The arguments start at getNode(F) + CallArgPos.
-//
-// Future Improvements:
-//   Use of BDD's.
-//===----------------------------------------------------------------------===//
-
-#define DEBUG_TYPE "anders-aa"
-#include "llvm/Constants.h"
-#include "llvm/DerivedTypes.h"
-#include "llvm/Instructions.h"
-#include "llvm/Module.h"
-#include "llvm/Pass.h"
-#include "llvm/Support/ErrorHandling.h"
-#include "llvm/Support/InstIterator.h"
-#include "llvm/Support/InstVisitor.h"
-#include "llvm/Analysis/AliasAnalysis.h"
-#include "llvm/Analysis/MemoryBuiltins.h"
-#include "llvm/Analysis/Passes.h"
-#include "llvm/Support/Debug.h"
-#include "llvm/System/Atomic.h"
-#include "llvm/ADT/Statistic.h"
-#include "llvm/ADT/SparseBitVector.h"
-#include "llvm/ADT/DenseSet.h"
-#include <algorithm>
-#include <set>
-#include <list>
-#include <map>
-#include <stack>
-#include <vector>
-#include <queue>
-
-// Determining the actual set of nodes the universal set can consist of is very
-// expensive because it means propagating around very large sets.  We rely on
-// other analysis being able to determine which nodes can never be pointed to in
-// order to disambiguate further than "points-to anything".
-#define FULL_UNIVERSAL 0
-
-using namespace llvm;
-#ifndef NDEBUG
-STATISTIC(NumIters      , "Number of iterations to reach convergence");
-#endif
-STATISTIC(NumConstraints, "Number of constraints");
-STATISTIC(NumNodes      , "Number of nodes");
-STATISTIC(NumUnified    , "Number of variables unified");
-STATISTIC(NumErased     , "Number of redundant constraints erased");
-
-static const unsigned SelfRep = (unsigned)-1;
-static const unsigned Unvisited = (unsigned)-1;
-// Position of the function return node relative to the function node.
-static const unsigned CallReturnPos = 1;
-// Position of the function call node relative to the function node.
-static const unsigned CallFirstArgPos = 2;
-
-namespace {
-  struct BitmapKeyInfo {
-    static inline SparseBitVector<> *getEmptyKey() {
-      return reinterpret_cast<SparseBitVector<> *>(-1);
-    }
-    static inline SparseBitVector<> *getTombstoneKey() {
-      return reinterpret_cast<SparseBitVector<> *>(-2);
-    }
-    static unsigned getHashValue(const SparseBitVector<> *bitmap) {
-      return bitmap->getHashValue();
-    }
-    static bool isEqual(const SparseBitVector<> *LHS,
-                        const SparseBitVector<> *RHS) {
-      if (LHS == RHS)
-        return true;
-      else if (LHS == getEmptyKey() || RHS == getEmptyKey()
-               || LHS == getTombstoneKey() || RHS == getTombstoneKey())
-        return false;
-
-      return *LHS == *RHS;
-    }
-  };
-
-  class Andersens : public ModulePass, public AliasAnalysis,
-                    private InstVisitor<Andersens> {
-    struct Node;
-
-    /// Constraint - Objects of this structure are used to represent the various
-    /// constraints identified by the algorithm.  The constraints are 'copy',
-    /// for statements like "A = B", 'load' for statements like "A = *B",
-    /// 'store' for statements like "*A = B", and AddressOf for statements like
-    /// A = alloca;  The Offset is applied as *(A + K) = B for stores,
-    /// A = *(B + K) for loads, and A = B + K for copies.  It is
-    /// illegal on addressof constraints (because it is statically
-    /// resolvable to A = &C where C = B + K)
-
-    struct Constraint {
-      enum ConstraintType { Copy, Load, Store, AddressOf } Type;
-      unsigned Dest;
-      unsigned Src;
-      unsigned Offset;
-
-      Constraint(ConstraintType Ty, unsigned D, unsigned S, unsigned O = 0)
-        : Type(Ty), Dest(D), Src(S), Offset(O) {
-        assert((Offset == 0 || Ty != AddressOf) &&
-               "Offset is illegal on addressof constraints");
-      }
-
-      bool operator==(const Constraint &RHS) const {
-        return RHS.Type == Type
-          && RHS.Dest == Dest
-          && RHS.Src == Src
-          && RHS.Offset == Offset;
-      }
-
-      bool operator!=(const Constraint &RHS) const {
-        return !(*this == RHS);
-      }
-
-      bool operator<(const Constraint &RHS) const {
-        if (RHS.Type != Type)
-          return RHS.Type < Type;
-        else if (RHS.Dest != Dest)
-          return RHS.Dest < Dest;
-        else if (RHS.Src != Src)
-          return RHS.Src < Src;
-        return RHS.Offset < Offset;
-      }
-    };
-
-    // Information DenseSet requires implemented in order to be able to do
-    // it's thing
-    struct PairKeyInfo {
-      static inline std::pair<unsigned, unsigned> getEmptyKey() {
-        return std::make_pair(~0U, ~0U);
-      }
-      static inline std::pair<unsigned, unsigned> getTombstoneKey() {
-        return std::make_pair(~0U - 1, ~0U - 1);
-      }
-      static unsigned getHashValue(const std::pair<unsigned, unsigned> &P) {
-        return P.first ^ P.second;
-      }
-      static unsigned isEqual(const std::pair<unsigned, unsigned> &LHS,
-                              const std::pair<unsigned, unsigned> &RHS) {
-        return LHS == RHS;
-      }
-    };
-    
-    struct ConstraintKeyInfo {
-      static inline Constraint getEmptyKey() {
-        return Constraint(Constraint::Copy, ~0U, ~0U, ~0U);
-      }
-      static inline Constraint getTombstoneKey() {
-        return Constraint(Constraint::Copy, ~0U - 1, ~0U - 1, ~0U - 1);
-      }
-      static unsigned getHashValue(const Constraint &C) {
-        return C.Src ^ C.Dest ^ C.Type ^ C.Offset;
-      }
-      static bool isEqual(const Constraint &LHS,
-                          const Constraint &RHS) {
-        return LHS.Type == RHS.Type && LHS.Dest == RHS.Dest
-          && LHS.Src == RHS.Src && LHS.Offset == RHS.Offset;
-      }
-    };
-
-    // Node class - This class is used to represent a node in the constraint
-    // graph.  Due to various optimizations, it is not always the case that
-    // there is a mapping from a Node to a Value.  In particular, we add
-    // artificial Node's that represent the set of pointed-to variables shared
-    // for each location equivalent Node.
-    struct Node {
-    private:
-      static volatile sys::cas_flag Counter;
-
-    public:
-      Value *Val;
-      SparseBitVector<> *Edges;
-      SparseBitVector<> *PointsTo;
-      SparseBitVector<> *OldPointsTo;
-      std::list<Constraint> Constraints;
-
-      // Pointer and location equivalence labels
-      unsigned PointerEquivLabel;
-      unsigned LocationEquivLabel;
-      // Predecessor edges, both real and implicit
-      SparseBitVector<> *PredEdges;
-      SparseBitVector<> *ImplicitPredEdges;
-      // Set of nodes that point to us, only use for location equivalence.
-      SparseBitVector<> *PointedToBy;
-      // Number of incoming edges, used during variable substitution to early
-      // free the points-to sets
-      unsigned NumInEdges;
-      // True if our points-to set is in the Set2PEClass map
-      bool StoredInHash;
-      // True if our node has no indirect constraints (complex or otherwise)
-      bool Direct;
-      // True if the node is address taken, *or* it is part of a group of nodes
-      // that must be kept together.  This is set to true for functions and
-      // their arg nodes, which must be kept at the same position relative to
-      // their base function node.
-      bool AddressTaken;
-
-      // Nodes in cycles (or in equivalence classes) are united together using a
-      // standard union-find representation with path compression.  NodeRep
-      // gives the index into GraphNodes for the representative Node.
-      unsigned NodeRep;
-
-      // Modification timestamp.  Assigned from Counter.
-      // Used for work list prioritization.
-      unsigned Timestamp;
-
-      explicit Node(bool direct = true) :
-        Val(0), Edges(0), PointsTo(0), OldPointsTo(0), 
-        PointerEquivLabel(0), LocationEquivLabel(0), PredEdges(0),
-        ImplicitPredEdges(0), PointedToBy(0), NumInEdges(0),
-        StoredInHash(false), Direct(direct), AddressTaken(false),
-        NodeRep(SelfRep), Timestamp(0) { }
-
-      Node *setValue(Value *V) {
-        assert(Val == 0 && "Value already set for this node!");
-        Val = V;
-        return this;
-      }
-
-      /// getValue - Return the LLVM value corresponding to this node.
-      ///
-      Value *getValue() const { return Val; }
-
-      /// addPointerTo - Add a pointer to the list of pointees of this node,
-      /// returning true if this caused a new pointer to be added, or false if
-      /// we already knew about the points-to relation.
-      bool addPointerTo(unsigned Node) {
-        return PointsTo->test_and_set(Node);
-      }
-
-      /// intersects - Return true if the points-to set of this node intersects
-      /// with the points-to set of the specified node.
-      bool intersects(Node *N) const;
-
-      /// intersectsIgnoring - Return true if the points-to set of this node
-      /// intersects with the points-to set of the specified node on any nodes
-      /// except for the specified node to ignore.
-      bool intersectsIgnoring(Node *N, unsigned) const;
-
-      // Timestamp a node (used for work list prioritization)
-      void Stamp() {
-        Timestamp = sys::AtomicIncrement(&Counter);
-        --Timestamp;
-      }
-
-      bool isRep() const {
-        return( (int) NodeRep < 0 );
-      }
-    };
-
-    struct WorkListElement {
-      Node* node;
-      unsigned Timestamp;
-      WorkListElement(Node* n, unsigned t) : node(n), Timestamp(t) {}
-
-      // Note that we reverse the sense of the comparison because we
-      // actually want to give low timestamps the priority over high,
-      // whereas priority is typically interpreted as a greater value is
-      // given high priority.
-      bool operator<(const WorkListElement& that) const {
-        return( this->Timestamp > that.Timestamp );
-      }
-    };
-
-    // Priority-queue based work list specialized for Nodes.
-    class WorkList {
-      std::priority_queue<WorkListElement> Q;
-
-    public:
-      void insert(Node* n) {
-        Q.push( WorkListElement(n, n->Timestamp) );
-      }
-
-      // We automatically discard non-representative nodes and nodes
-      // that were in the work list twice (we keep a copy of the
-      // timestamp in the work list so we can detect this situation by
-      // comparing against the node's current timestamp).
-      Node* pop() {
-        while( !Q.empty() ) {
-          WorkListElement x = Q.top(); Q.pop();
-          Node* INode = x.node;
-
-          if( INode->isRep() &&
-              INode->Timestamp == x.Timestamp ) {
-            return(x.node);
-          }
-        }
-        return(0);
-      }
-
-      bool empty() {
-        return Q.empty();
-      }
-    };
-
-    /// GraphNodes - This vector is populated as part of the object
-    /// identification stage of the analysis, which populates this vector with a
-    /// node for each memory object and fills in the ValueNodes map.
-    std::vector<Node> GraphNodes;
-
-    /// ValueNodes - This map indicates the Node that a particular Value* is
-    /// represented by.  This contains entries for all pointers.
-    DenseMap<Value*, unsigned> ValueNodes;
-
-    /// ObjectNodes - This map contains entries for each memory object in the
-    /// program: globals, alloca's and mallocs.
-    DenseMap<Value*, unsigned> ObjectNodes;
-
-    /// ReturnNodes - This map contains an entry for each function in the
-    /// program that returns a value.
-    DenseMap<Function*, unsigned> ReturnNodes;
-
-    /// VarargNodes - This map contains the entry used to represent all pointers
-    /// passed through the varargs portion of a function call for a particular
-    /// function.  An entry is not present in this map for functions that do not
-    /// take variable arguments.
-    DenseMap<Function*, unsigned> VarargNodes;
-
-
-    /// Constraints - This vector contains a list of all of the constraints
-    /// identified by the program.
-    std::vector<Constraint> Constraints;
-
-    // Map from graph node to maximum K value that is allowed (for functions,
-    // this is equivalent to the number of arguments + CallFirstArgPos)
-    std::map<unsigned, unsigned> MaxK;
-
-    /// This enum defines the GraphNodes indices that correspond to important
-    /// fixed sets.
-    enum {
-      UniversalSet = 0,
-      NullPtr      = 1,
-      NullObject   = 2,
-      NumberSpecialNodes
-    };
-    // Stack for Tarjan's
-    std::stack<unsigned> SCCStack;
-    // Map from Graph Node to DFS number
-    std::vector<unsigned> Node2DFS;
-    // Map from Graph Node to Deleted from graph.
-    std::vector<bool> Node2Deleted;
-    // Same as Node Maps, but implemented as std::map because it is faster to
-    // clear 
-    std::map<unsigned, unsigned> Tarjan2DFS;
-    std::map<unsigned, bool> Tarjan2Deleted;
-    // Current DFS number
-    unsigned DFSNumber;
-
-    // Work lists.
-    WorkList w1, w2;
-    WorkList *CurrWL, *NextWL; // "current" and "next" work lists
-
-    // Offline variable substitution related things
-
-    // Temporary rep storage, used because we can't collapse SCC's in the
-    // predecessor graph by uniting the variables permanently, we can only do so
-    // for the successor graph.
-    std::vector<unsigned> VSSCCRep;
-    // Mapping from node to whether we have visited it during SCC finding yet.
-    std::vector<bool> Node2Visited;
-    // During variable substitution, we create unknowns to represent the unknown
-    // value that is a dereference of a variable.  These nodes are known as
-    // "ref" nodes (since they represent the value of dereferences).
-    unsigned FirstRefNode;
-    // During HVN, we create represent address taken nodes as if they were
-    // unknown (since HVN, unlike HU, does not evaluate unions).
-    unsigned FirstAdrNode;
-    // Current pointer equivalence class number
-    unsigned PEClass;
-    // Mapping from points-to sets to equivalence classes
-    typedef DenseMap<SparseBitVector<> *, unsigned, BitmapKeyInfo> BitVectorMap;
-    BitVectorMap Set2PEClass;
-    // Mapping from pointer equivalences to the representative node.  -1 if we
-    // have no representative node for this pointer equivalence class yet.
-    std::vector<int> PEClass2Node;
-    // Mapping from pointer equivalences to representative node.  This includes
-    // pointer equivalent but not location equivalent variables. -1 if we have
-    // no representative node for this pointer equivalence class yet.
-    std::vector<int> PENLEClass2Node;
-    // Union/Find for HCD
-    std::vector<unsigned> HCDSCCRep;
-    // HCD's offline-detected cycles; "Statically DeTected"
-    // -1 if not part of such a cycle, otherwise a representative node.
-    std::vector<int> SDT;
-    // Whether to use SDT (UniteNodes can use it during solving, but not before)
-    bool SDTActive;
-
-  public:
-    static char ID;
-    Andersens() : ModulePass(&ID) {}
-
-    bool runOnModule(Module &M) {
-      InitializeAliasAnalysis(this);
-      IdentifyObjects(M);
-      CollectConstraints(M);
-#undef DEBUG_TYPE
-#define DEBUG_TYPE "anders-aa-constraints"
-      DEBUG(PrintConstraints());
-#undef DEBUG_TYPE
-#define DEBUG_TYPE "anders-aa"
-      SolveConstraints();
-      DEBUG(PrintPointsToGraph());
-
-      // Free the constraints list, as we don't need it to respond to alias
-      // requests.
-      std::vector<Constraint>().swap(Constraints);
-      //These are needed for Print() (-analyze in opt)
-      //ObjectNodes.clear();
-      //ReturnNodes.clear();
-      //VarargNodes.clear();
-      return false;
-    }
-
-    void releaseMemory() {
-      // FIXME: Until we have transitively required passes working correctly,
-      // this cannot be enabled!  Otherwise, using -count-aa with the pass
-      // causes memory to be freed too early. :(
-#if 0
-      // The memory objects and ValueNodes data structures at the only ones that
-      // are still live after construction.
-      std::vector<Node>().swap(GraphNodes);
-      ValueNodes.clear();
-#endif
-    }
-
-    virtual void getAnalysisUsage(AnalysisUsage &AU) const {
-      AliasAnalysis::getAnalysisUsage(AU);
-      AU.setPreservesAll();                         // Does not transform code
-    }
-
-    /// getAdjustedAnalysisPointer - This method is used when a pass implements
-    /// an analysis interface through multiple inheritance.  If needed, it
-    /// should override this to adjust the this pointer as needed for the
-    /// specified pass info.
-    virtual void *getAdjustedAnalysisPointer(const PassInfo *PI) {
-      if (PI->isPassID(&AliasAnalysis::ID))
-        return (AliasAnalysis*)this;
-      return this;
-    }
-                      
-    //------------------------------------------------
-    // Implement the AliasAnalysis API
-    //
-    AliasResult alias(const Value *V1, unsigned V1Size,
-                      const Value *V2, unsigned V2Size);
-    virtual ModRefResult getModRefInfo(CallSite CS, Value *P, unsigned Size);
-    virtual ModRefResult getModRefInfo(CallSite CS1, CallSite CS2);
-    bool pointsToConstantMemory(const Value *P);
-
-    virtual void deleteValue(Value *V) {
-      ValueNodes.erase(V);
-      getAnalysis<AliasAnalysis>().deleteValue(V);
-    }
-
-    virtual void copyValue(Value *From, Value *To) {
-      ValueNodes[To] = ValueNodes[From];
-      getAnalysis<AliasAnalysis>().copyValue(From, To);
-    }
-
-  private:
-    /// getNode - Return the node corresponding to the specified pointer scalar.
-    ///
-    unsigned getNode(Value *V) {
-      if (Constant *C = dyn_cast<Constant>(V))
-        if (!isa<GlobalValue>(C))
-          return getNodeForConstantPointer(C);
-
-      DenseMap<Value*, unsigned>::iterator I = ValueNodes.find(V);
-      if (I == ValueNodes.end()) {
-#ifndef NDEBUG
-        V->dump();
-#endif
-        llvm_unreachable("Value does not have a node in the points-to graph!");
-      }
-      return I->second;
-    }
-
-    /// getObject - Return the node corresponding to the memory object for the
-    /// specified global or allocation instruction.
-    unsigned getObject(Value *V) const {
-      DenseMap<Value*, unsigned>::const_iterator I = ObjectNodes.find(V);
-      assert(I != ObjectNodes.end() &&
-             "Value does not have an object in the points-to graph!");
-      return I->second;
-    }
-
-    /// getReturnNode - Return the node representing the return value for the
-    /// specified function.
-    unsigned getReturnNode(Function *F) const {
-      DenseMap<Function*, unsigned>::const_iterator I = ReturnNodes.find(F);
-      assert(I != ReturnNodes.end() && "Function does not return a value!");
-      return I->second;
-    }
-
-    /// getVarargNode - Return the node representing the variable arguments
-    /// formal for the specified function.
-    unsigned getVarargNode(Function *F) const {
-      DenseMap<Function*, unsigned>::const_iterator I = VarargNodes.find(F);
-      assert(I != VarargNodes.end() && "Function does not take var args!");
-      return I->second;
-    }
-
-    /// getNodeValue - Get the node for the specified LLVM value and set the
-    /// value for it to be the specified value.
-    unsigned getNodeValue(Value &V) {
-      unsigned Index = getNode(&V);
-      GraphNodes[Index].setValue(&V);
-      return Index;
-    }
-
-    unsigned UniteNodes(unsigned First, unsigned Second,
-                        bool UnionByRank = true);
-    unsigned FindNode(unsigned Node);
-    unsigned FindNode(unsigned Node) const;
-
-    void IdentifyObjects(Module &M);
-    void CollectConstraints(Module &M);
-    bool AnalyzeUsesOfFunction(Value *);
-    void CreateConstraintGraph();
-    void OptimizeConstraints();
-    unsigned FindEquivalentNode(unsigned, unsigned);
-    void ClumpAddressTaken();
-    void RewriteConstraints();
-    void HU();
-    void HVN();
-    void HCD();
-    void Search(unsigned Node);
-    void UnitePointerEquivalences();
-    void SolveConstraints();
-    bool QueryNode(unsigned Node);
-    void Condense(unsigned Node);
-    void HUValNum(unsigned Node);
-    void HVNValNum(unsigned Node);
-    unsigned getNodeForConstantPointer(Constant *C);
-    unsigned getNodeForConstantPointerTarget(Constant *C);
-    void AddGlobalInitializerConstraints(unsigned, Constant *C);
-
-    void AddConstraintsForNonInternalLinkage(Function *F);
-    void AddConstraintsForCall(CallSite CS, Function *F);
-    bool AddConstraintsForExternalCall(CallSite CS, Function *F);
-
-
-    void PrintNode(const Node *N) const;
-    void PrintConstraints() const ;
-    void PrintConstraint(const Constraint &) const;
-    void PrintLabels() const;
-    void PrintPointsToGraph() const;
-
-    //===------------------------------------------------------------------===//
-    // Instruction visitation methods for adding constraints
-    //
-    friend class InstVisitor<Andersens>;
-    void visitReturnInst(ReturnInst &RI);
-    void visitInvokeInst(InvokeInst &II) { visitCallSite(CallSite(&II)); }
-    void visitCallInst(CallInst &CI) { 
-      if (isMalloc(&CI)) visitAlloc(CI);
-      else visitCallSite(CallSite(&CI)); 
-    }
-    void visitCallSite(CallSite CS);
-    void visitAllocaInst(AllocaInst &I);
-    void visitAlloc(Instruction &I);
-    void visitLoadInst(LoadInst &LI);
-    void visitStoreInst(StoreInst &SI);
-    void visitGetElementPtrInst(GetElementPtrInst &GEP);
-    void visitPHINode(PHINode &PN);
-    void visitCastInst(CastInst &CI);
-    void visitICmpInst(ICmpInst &ICI) {} // NOOP!
-    void visitFCmpInst(FCmpInst &ICI) {} // NOOP!
-    void visitSelectInst(SelectInst &SI);
-    void visitVAArg(VAArgInst &I);
-    void visitInstruction(Instruction &I);
-
-    //===------------------------------------------------------------------===//
-    // Implement Analyize interface
-    //
-    void print(raw_ostream &O, const Module*) const {
-      PrintPointsToGraph();
-    }
-  };
-}
-
-char Andersens::ID = 0;
-static RegisterPass<Andersens>
-X("anders-aa", "Andersen's Interprocedural Alias Analysis (experimental)",
-  false, true);
-static RegisterAnalysisGroup<AliasAnalysis> Y(X);
-
-// Initialize Timestamp Counter (static).
-volatile llvm::sys::cas_flag Andersens::Node::Counter = 0;
-
-ModulePass *llvm::createAndersensPass() { return new Andersens(); }
-
-//===----------------------------------------------------------------------===//
-//                  AliasAnalysis Interface Implementation
-//===----------------------------------------------------------------------===//
-
-AliasAnalysis::AliasResult Andersens::alias(const Value *V1, unsigned V1Size,
-                                            const Value *V2, unsigned V2Size) {
-  Node *N1 = &GraphNodes[FindNode(getNode(const_cast<Value*>(V1)))];
-  Node *N2 = &GraphNodes[FindNode(getNode(const_cast<Value*>(V2)))];
-
-  // Check to see if the two pointers are known to not alias.  They don't alias
-  // if their points-to sets do not intersect.
-  if (!N1->intersectsIgnoring(N2, NullObject))
-    return NoAlias;
-
-  return AliasAnalysis::alias(V1, V1Size, V2, V2Size);
-}
-
-AliasAnalysis::ModRefResult
-Andersens::getModRefInfo(CallSite CS, Value *P, unsigned Size) {
-  // The only thing useful that we can contribute for mod/ref information is
-  // when calling external function calls: if we know that memory never escapes
-  // from the program, it cannot be modified by an external call.
-  //
-  // NOTE: This is not really safe, at least not when the entire program is not
-  // available.  The deal is that the external function could call back into the
-  // program and modify stuff.  We ignore this technical niggle for now.  This
-  // is, after all, a "research quality" implementation of Andersen's analysis.
-  if (Function *F = CS.getCalledFunction())
-    if (F->isDeclaration()) {
-      Node *N1 = &GraphNodes[FindNode(getNode(P))];
-
-      if (N1->PointsTo->empty())
-        return NoModRef;
-#if FULL_UNIVERSAL
-      if (!UniversalSet->PointsTo->test(FindNode(getNode(P))))
-        return NoModRef;  // Universal set does not contain P
-#else
-      if (!N1->PointsTo->test(UniversalSet))
-        return NoModRef;  // P doesn't point to the universal set.
-#endif
-    }
-
-  return AliasAnalysis::getModRefInfo(CS, P, Size);
-}
-
-AliasAnalysis::ModRefResult
-Andersens::getModRefInfo(CallSite CS1, CallSite CS2) {
-  return AliasAnalysis::getModRefInfo(CS1,CS2);
-}
-
-/// pointsToConstantMemory - If we can determine that this pointer only points
-/// to constant memory, return true.  In practice, this means that if the
-/// pointer can only point to constant globals, functions, or the null pointer,
-/// return true.
-///
-bool Andersens::pointsToConstantMemory(const Value *P) {
-  Node *N = &GraphNodes[FindNode(getNode(const_cast<Value*>(P)))];
-  unsigned i;
-
-  for (SparseBitVector<>::iterator bi = N->PointsTo->begin();
-       bi != N->PointsTo->end();
-       ++bi) {
-    i = *bi;
-    Node *Pointee = &GraphNodes[i];
-    if (Value *V = Pointee->getValue()) {
-      if (!isa<GlobalValue>(V) || (isa<GlobalVariable>(V) &&
-                                   !cast<GlobalVariable>(V)->isConstant()))
-        return AliasAnalysis::pointsToConstantMemory(P);
-    } else {
-      if (i != NullObject)
-        return AliasAnalysis::pointsToConstantMemory(P);
-    }
-  }
-
-  return true;
-}
-
-//===----------------------------------------------------------------------===//
-//                       Object Identification Phase
-//===----------------------------------------------------------------------===//
-
-/// IdentifyObjects - This stage scans the program, adding an entry to the
-/// GraphNodes list for each memory object in the program (global stack or
-/// heap), and populates the ValueNodes and ObjectNodes maps for these objects.
-///
-void Andersens::IdentifyObjects(Module &M) {
-  unsigned NumObjects = 0;
-
-  // Object #0 is always the universal set: the object that we don't know
-  // anything about.
-  assert(NumObjects == UniversalSet && "Something changed!");
-  ++NumObjects;
-
-  // Object #1 always represents the null pointer.
-  assert(NumObjects == NullPtr && "Something changed!");
-  ++NumObjects;
-
-  // Object #2 always represents the null object (the object pointed to by null)
-  assert(NumObjects == NullObject && "Something changed!");
-  ++NumObjects;
-
-  // Add all the globals first.
-  for (Module::global_iterator I = M.global_begin(), E = M.global_end();
-       I != E; ++I) {
-    ObjectNodes[I] = NumObjects++;
-    ValueNodes[I] = NumObjects++;
-  }
-
-  // Add nodes for all of the functions and the instructions inside of them.
-  for (Module::iterator F = M.begin(), E = M.end(); F != E; ++F) {
-    // The function itself is a memory object.
-    unsigned First = NumObjects;
-    ValueNodes[F] = NumObjects++;
-    if (isa<PointerType>(F->getFunctionType()->getReturnType()))
-      ReturnNodes[F] = NumObjects++;
-    if (F->getFunctionType()->isVarArg())
-      VarargNodes[F] = NumObjects++;
-
-
-    // Add nodes for all of the incoming pointer arguments.
-    for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end();
-         I != E; ++I)
-      {
-        if (isa<PointerType>(I->getType()))
-          ValueNodes[I] = NumObjects++;
-      }
-    MaxK[First] = NumObjects - First;
-
-    // Scan the function body, creating a memory object for each heap/stack
-    // allocation in the body of the function and a node to represent all
-    // pointer values defined by instructions and used as operands.
-    for (inst_iterator II = inst_begin(F), E = inst_end(F); II != E; ++II) {
-      // If this is an heap or stack allocation, create a node for the memory
-      // object.
-      if (isa<PointerType>(II->getType())) {
-        ValueNodes[&*II] = NumObjects++;
-        if (AllocaInst *AI = dyn_cast<AllocaInst>(&*II))
-          ObjectNodes[AI] = NumObjects++;
-        else if (isMalloc(&*II))
-          ObjectNodes[&*II] = NumObjects++;
-      }
-
-      // Calls to inline asm need to be added as well because the callee isn't
-      // referenced anywhere else.
-      if (CallInst *CI = dyn_cast<CallInst>(&*II)) {
-        Value *Callee = CI->getCalledValue();
-        if (isa<InlineAsm>(Callee))
-          ValueNodes[Callee] = NumObjects++;
-      }
-    }
-  }
-
-  // Now that we know how many objects to create, make them all now!
-  GraphNodes.resize(NumObjects);
-  NumNodes += NumObjects;
-}
-
-//===----------------------------------------------------------------------===//
-//                     Constraint Identification Phase
-//===----------------------------------------------------------------------===//
-
-/// getNodeForConstantPointer - Return the node corresponding to the constant
-/// pointer itself.
-unsigned Andersens::getNodeForConstantPointer(Constant *C) {
-  assert(isa<PointerType>(C->getType()) && "Not a constant pointer!");
-
-  if (isa<ConstantPointerNull>(C) || isa<UndefValue>(C))
-    return NullPtr;
-  else if (GlobalValue *GV = dyn_cast<GlobalValue>(C))
-    return getNode(GV);
-  else if (ConstantExpr *CE = dyn_cast<ConstantExpr>(C)) {
-    switch (CE->getOpcode()) {
-    case Instruction::GetElementPtr:
-      return getNodeForConstantPointer(CE->getOperand(0));
-    case Instruction::IntToPtr:
-      return UniversalSet;
-    case Instruction::BitCast:
-      return getNodeForConstantPointer(CE->getOperand(0));
-    default:
-      errs() << "Constant Expr not yet handled: " << *CE << "\n";
-      llvm_unreachable(0);
-    }
-  } else {
-    llvm_unreachable("Unknown constant pointer!");
-  }
-  return 0;
-}
-
-/// getNodeForConstantPointerTarget - Return the node POINTED TO by the
-/// specified constant pointer.
-unsigned Andersens::getNodeForConstantPointerTarget(Constant *C) {
-  assert(isa<PointerType>(C->getType()) && "Not a constant pointer!");
-
-  if (isa<ConstantPointerNull>(C))
-    return NullObject;
-  else if (GlobalValue *GV = dyn_cast<GlobalValue>(C))
-    return getObject(GV);
-  else if (ConstantExpr *CE = dyn_cast<ConstantExpr>(C)) {
-    switch (CE->getOpcode()) {
-    case Instruction::GetElementPtr:
-      return getNodeForConstantPointerTarget(CE->getOperand(0));
-    case Instruction::IntToPtr:
-      return UniversalSet;
-    case Instruction::BitCast:
-      return getNodeForConstantPointerTarget(CE->getOperand(0));
-    default:
-      errs() << "Constant Expr not yet handled: " << *CE << "\n";
-      llvm_unreachable(0);
-    }
-  } else {
-    llvm_unreachable("Unknown constant pointer!");
-  }
-  return 0;
-}
-
-/// AddGlobalInitializerConstraints - Add inclusion constraints for the memory
-/// object N, which contains values indicated by C.
-void Andersens::AddGlobalInitializerConstraints(unsigned NodeIndex,
-                                                Constant *C) {
-  if (C->getType()->isSingleValueType()) {
-    if (isa<PointerType>(C->getType()))
-      Constraints.push_back(Constraint(Constraint::Copy, NodeIndex,
-                                       getNodeForConstantPointer(C)));
-  } else if (C->isNullValue()) {
-    Constraints.push_back(Constraint(Constraint::Copy, NodeIndex,
-                                     NullObject));
-    return;
-  } else if (!isa<UndefValue>(C)) {
-    // If this is an array or struct, include constraints for each element.
-    assert(isa<ConstantArray>(C) || isa<ConstantStruct>(C));
-    for (unsigned i = 0, e = C->getNumOperands(); i != e; ++i)
-      AddGlobalInitializerConstraints(NodeIndex,
-                                      cast<Constant>(C->getOperand(i)));
-  }
-}
-
-/// AddConstraintsForNonInternalLinkage - If this function does not have
-/// internal linkage, realize that we can't trust anything passed into or
-/// returned by this function.
-void Andersens::AddConstraintsForNonInternalLinkage(Function *F) {
-  for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(); I != E; ++I)
-    if (isa<PointerType>(I->getType()))
-      // If this is an argument of an externally accessible function, the
-      // incoming pointer might point to anything.
-      Constraints.push_back(Constraint(Constraint::Copy, getNode(I),
-                                       UniversalSet));
-}
-
-/// AddConstraintsForCall - If this is a call to a "known" function, add the
-/// constraints and return true.  If this is a call to an unknown function,
-/// return false.
-bool Andersens::AddConstraintsForExternalCall(CallSite CS, Function *F) {
-  assert(F->isDeclaration() && "Not an external function!");
-
-  // These functions don't induce any points-to constraints.
-  if (F->getName() == "atoi" || F->getName() == "atof" ||
-      F->getName() == "atol" || F->getName() == "atoll" ||
-      F->getName() == "remove" || F->getName() == "unlink" ||
-      F->getName() == "rename" || F->getName() == "memcmp" ||
-      F->getName() == "llvm.memset" ||
-      F->getName() == "strcmp" || F->getName() == "strncmp" ||
-      F->getName() == "execl" || F->getName() == "execlp" ||
-      F->getName() == "execle" || F->getName() == "execv" ||
-      F->getName() == "execvp" || F->getName() == "chmod" ||
-      F->getName() == "puts" || F->getName() == "write" ||
-      F->getName() == "open" || F->getName() == "create" ||
-      F->getName() == "truncate" || F->getName() == "chdir" ||
-      F->getName() == "mkdir" || F->getName() == "rmdir" ||
-      F->getName() == "read" || F->getName() == "pipe" ||
-      F->getName() == "wait" || F->getName() == "time" ||
-      F->getName() == "stat" || F->getName() == "fstat" ||
-      F->getName() == "lstat" || F->getName() == "strtod" ||
-      F->getName() == "strtof" || F->getName() == "strtold" ||
-      F->getName() == "fopen" || F->getName() == "fdopen" ||
-      F->getName() == "freopen" ||
-      F->getName() == "fflush" || F->getName() == "feof" ||
-      F->getName() == "fileno" || F->getName() == "clearerr" ||
-      F->getName() == "rewind" || F->getName() == "ftell" ||
-      F->getName() == "ferror" || F->getName() == "fgetc" ||
-      F->getName() == "fgetc" || F->getName() == "_IO_getc" ||
-      F->getName() == "fwrite" || F->getName() == "fread" ||
-      F->getName() == "fgets" || F->getName() == "ungetc" ||
-      F->getName() == "fputc" ||
-      F->getName() == "fputs" || F->getName() == "putc" ||
-      F->getName() == "ftell" || F->getName() == "rewind" ||
-      F->getName() == "_IO_putc" || F->getName() == "fseek" ||
-      F->getName() == "fgetpos" || F->getName() == "fsetpos" ||
-      F->getName() == "printf" || F->getName() == "fprintf" ||
-      F->getName() == "sprintf" || F->getName() == "vprintf" ||
-      F->getName() == "vfprintf" || F->getName() == "vsprintf" ||
-      F->getName() == "scanf" || F->getName() == "fscanf" ||
-      F->getName() == "sscanf" || F->getName() == "__assert_fail" ||
-      F->getName() == "modf")
-    return true;
-
-
-  // These functions do induce points-to edges.
-  if (F->getName() == "llvm.memcpy" ||
-      F->getName() == "llvm.memmove" ||
-      F->getName() == "memmove") {
-
-    const FunctionType *FTy = F->getFunctionType();
-    if (FTy->getNumParams() > 1 && 
-        isa<PointerType>(FTy->getParamType(0)) &&
-        isa<PointerType>(FTy->getParamType(1))) {
-
-      // *Dest = *Src, which requires an artificial graph node to represent the
-      // constraint.  It is broken up into *Dest = temp, temp = *Src
-      unsigned FirstArg = getNode(CS.getArgument(0));
-      unsigned SecondArg = getNode(CS.getArgument(1));
-      unsigned TempArg = GraphNodes.size();
-      GraphNodes.push_back(Node());
-      Constraints.push_back(Constraint(Constraint::Store,
-                                       FirstArg, TempArg));
-      Constraints.push_back(Constraint(Constraint::Load,
-                                       TempArg, SecondArg));
-      // In addition, Dest = Src
-      Constraints.push_back(Constraint(Constraint::Copy,
-                                       FirstArg, SecondArg));
-      return true;
-    }
-  }
-
-  // Result = Arg0
-  if (F->getName() == "realloc" || F->getName() == "strchr" ||
-      F->getName() == "strrchr" || F->getName() == "strstr" ||
-      F->getName() == "strtok") {
-    const FunctionType *FTy = F->getFunctionType();
-    if (FTy->getNumParams() > 0 && 
-        isa<PointerType>(FTy->getParamType(0))) {
-      Constraints.push_back(Constraint(Constraint::Copy,
-                                       getNode(CS.getInstruction()),
-                                       getNode(CS.getArgument(0))));
-      return true;
-    }
-  }
-
-  return false;
-}
-
-
-
-/// AnalyzeUsesOfFunction - Look at all of the users of the specified function.
-/// If this is used by anything complex (i.e., the address escapes), return
-/// true.
-bool Andersens::AnalyzeUsesOfFunction(Value *V) {
-
-  if (!isa<PointerType>(V->getType())) return true;
-
-  for (Value::use_iterator UI = V->use_begin(), E = V->use_end(); UI != E; ++UI)
-    if (isa<LoadInst>(*UI)) {
-      return false;
-    } else if (StoreInst *SI = dyn_cast<StoreInst>(*UI)) {
-      if (V == SI->getOperand(1)) {
-        return false;
-      } else if (SI->getOperand(1)) {
-        return true;  // Storing the pointer
-      }
-    } else if (GetElementPtrInst *GEP = dyn_cast<GetElementPtrInst>(*UI)) {
-      if (AnalyzeUsesOfFunction(GEP)) return true;
-    } else if (isFreeCall(*UI)) {
-      return false;
-    } else if (CallInst *CI = dyn_cast<CallInst>(*UI)) {
-      // Make sure that this is just the function being called, not that it is
-      // passing into the function.
-      for (unsigned i = 1, e = CI->getNumOperands(); i != e; ++i)
-        if (CI->getOperand(i) == V) return true;
-    } else if (InvokeInst *II = dyn_cast<InvokeInst>(*UI)) {
-      // Make sure that this is just the function being called, not that it is
-      // passing into the function.
-      for (unsigned i = 3, e = II->getNumOperands(); i != e; ++i)
-        if (II->getOperand(i) == V) return true;
-    } else if (ConstantExpr *CE = dyn_cast<ConstantExpr>(*UI)) {
-      if (CE->getOpcode() == Instruction::GetElementPtr ||
-          CE->getOpcode() == Instruction::BitCast) {
-        if (AnalyzeUsesOfFunction(CE))
-          return true;
-      } else {
-        return true;
-      }
-    } else if (ICmpInst *ICI = dyn_cast<ICmpInst>(*UI)) {
-      if (!isa<ConstantPointerNull>(ICI->getOperand(1)))
-        return true;  // Allow comparison against null.
-    } else {
-      return true;
-    }
-  return false;
-}
-
-/// CollectConstraints - This stage scans the program, adding a constraint to
-/// the Constraints list for each instruction in the program that induces a
-/// constraint, and setting up the initial points-to graph.
-///
-void Andersens::CollectConstraints(Module &M) {
-  // First, the universal set points to itself.
-  Constraints.push_back(Constraint(Constraint::AddressOf, UniversalSet,
-                                   UniversalSet));
-  Constraints.push_back(Constraint(Constraint::Store, UniversalSet,
-                                   UniversalSet));
-
-  // Next, the null pointer points to the null object.
-  Constraints.push_back(Constraint(Constraint::AddressOf, NullPtr, NullObject));
-
-  // Next, add any constraints on global variables and their initializers.
-  for (Module::global_iterator I = M.global_begin(), E = M.global_end();
-       I != E; ++I) {
-    // Associate the address of the global object as pointing to the memory for
-    // the global: &G = <G memory>
-    unsigned ObjectIndex = getObject(I);
-    Node *Object = &GraphNodes[ObjectIndex];
-    Object->setValue(I);
-    Constraints.push_back(Constraint(Constraint::AddressOf, getNodeValue(*I),
-                                     ObjectIndex));
-
-    if (I->hasDefinitiveInitializer()) {
-      AddGlobalInitializerConstraints(ObjectIndex, I->getInitializer());
-    } else {
-      // If it doesn't have an initializer (i.e. it's defined in another
-      // translation unit), it points to the universal set.
-      Constraints.push_back(Constraint(Constraint::Copy, ObjectIndex,
-                                       UniversalSet));
-    }
-  }
-
-  for (Module::iterator F = M.begin(), E = M.end(); F != E; ++F) {
-    // Set up the return value node.
-    if (isa<PointerType>(F->getFunctionType()->getReturnType()))
-      GraphNodes[getReturnNode(F)].setValue(F);
-    if (F->getFunctionType()->isVarArg())
-      GraphNodes[getVarargNode(F)].setValue(F);
-
-    // Set up incoming argument nodes.
-    for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end();
-         I != E; ++I)
-      if (isa<PointerType>(I->getType()))
-        getNodeValue(*I);
-
-    // At some point we should just add constraints for the escaping functions
-    // at solve time, but this slows down solving. For now, we simply mark
-    // address taken functions as escaping and treat them as external.
-    if (!F->hasLocalLinkage() || AnalyzeUsesOfFunction(F))
-      AddConstraintsForNonInternalLinkage(F);
-
-    if (!F->isDeclaration()) {
-      // Scan the function body, creating a memory object for each heap/stack
-      // allocation in the body of the function and a node to represent all
-      // pointer values defined by instructions and used as operands.
-      visit(F);
-    } else {
-      // External functions that return pointers return the universal set.
-      if (isa<PointerType>(F->getFunctionType()->getReturnType()))
-        Constraints.push_back(Constraint(Constraint::Copy,
-                                         getReturnNode(F),
-                                         UniversalSet));
-
-      // Any pointers that are passed into the function have the universal set
-      // stored into them.
-      for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end();
-           I != E; ++I)
-        if (isa<PointerType>(I->getType())) {
-          // Pointers passed into external functions could have anything stored
-          // through them.
-          Constraints.push_back(Constraint(Constraint::Store, getNode(I),
-                                           UniversalSet));
-          // Memory objects passed into external function calls can have the
-          // universal set point to them.
-#if FULL_UNIVERSAL
-          Constraints.push_back(Constraint(Constraint::Copy,
-                                           UniversalSet,
-                                           getNode(I)));
-#else
-          Constraints.push_back(Constraint(Constraint::Copy,
-                                           getNode(I),
-                                           UniversalSet));
-#endif
-        }
-
-      // If this is an external varargs function, it can also store pointers
-      // into any pointers passed through the varargs section.
-      if (F->getFunctionType()->isVarArg())
-        Constraints.push_back(Constraint(Constraint::Store, getVarargNode(F),
-                                         UniversalSet));
-    }
-  }
-  NumConstraints += Constraints.size();
-}
-
-
-void Andersens::visitInstruction(Instruction &I) {
-#ifdef NDEBUG
-  return;          // This function is just a big assert.
-#endif
-  if (isa<BinaryOperator>(I))
-    return;
-  // Most instructions don't have any effect on pointer values.
-  switch (I.getOpcode()) {
-  case Instruction::Br:
-  case Instruction::Switch:
-  case Instruction::Unwind:
-  case Instruction::Unreachable:
-  case Instruction::ICmp:
-  case Instruction::FCmp:
-    return;
-  default:
-    // Is this something we aren't handling yet?
-    errs() << "Unknown instruction: " << I;
-    llvm_unreachable(0);
-  }
-}
-
-void Andersens::visitAllocaInst(AllocaInst &I) {
-  visitAlloc(I);
-}
-
-void Andersens::visitAlloc(Instruction &I) {
-  unsigned ObjectIndex = getObject(&I);
-  GraphNodes[ObjectIndex].setValue(&I);
-  Constraints.push_back(Constraint(Constraint::AddressOf, getNodeValue(I),
-                                   ObjectIndex));
-}
-
-void Andersens::visitReturnInst(ReturnInst &RI) {
-  if (RI.getNumOperands() && isa<PointerType>(RI.getOperand(0)->getType()))
-    // return V   -->   <Copy/retval{F}/v>
-    Constraints.push_back(Constraint(Constraint::Copy,
-                                     getReturnNode(RI.getParent()->getParent()),
-                                     getNode(RI.getOperand(0))));
-}
-
-void Andersens::visitLoadInst(LoadInst &LI) {
-  if (isa<PointerType>(LI.getType()))
-    // P1 = load P2  -->  <Load/P1/P2>
-    Constraints.push_back(Constraint(Constraint::Load, getNodeValue(LI),
-                                     getNode(LI.getOperand(0))));
-}
-
-void Andersens::visitStoreInst(StoreInst &SI) {
-  if (isa<PointerType>(SI.getOperand(0)->getType()))
-    // store P1, P2  -->  <Store/P2/P1>
-    Constraints.push_back(Constraint(Constraint::Store,
-                                     getNode(SI.getOperand(1)),
-                                     getNode(SI.getOperand(0))));
-}
-
-void Andersens::visitGetElementPtrInst(GetElementPtrInst &GEP) {
-  // P1 = getelementptr P2, ... --> <Copy/P1/P2>
-  Constraints.push_back(Constraint(Constraint::Copy, getNodeValue(GEP),
-                                   getNode(GEP.getOperand(0))));
-}
-
-void Andersens::visitPHINode(PHINode &PN) {
-  if (isa<PointerType>(PN.getType())) {
-    unsigned PNN = getNodeValue(PN);
-    for (unsigned i = 0, e = PN.getNumIncomingValues(); i != e; ++i)
-      // P1 = phi P2, P3  -->  <Copy/P1/P2>, <Copy/P1/P3>, ...
-      Constraints.push_back(Constraint(Constraint::Copy, PNN,
-                                       getNode(PN.getIncomingValue(i))));
-  }
-}
-
-void Andersens::visitCastInst(CastInst &CI) {
-  Value *Op = CI.getOperand(0);
-  if (isa<PointerType>(CI.getType())) {
-    if (isa<PointerType>(Op->getType())) {
-      // P1 = cast P2  --> <Copy/P1/P2>
-      Constraints.push_back(Constraint(Constraint::Copy, getNodeValue(CI),
-                                       getNode(CI.getOperand(0))));
-    } else {
-      // P1 = cast int --> <Copy/P1/Univ>
-#if 0
-      Constraints.push_back(Constraint(Constraint::Copy, getNodeValue(CI),
-                                       UniversalSet));
-#else
-      getNodeValue(CI);
-#endif
-    }
-  } else if (isa<PointerType>(Op->getType())) {
-    // int = cast P1 --> <Copy/Univ/P1>
-#if 0
-    Constraints.push_back(Constraint(Constraint::Copy,
-                                     UniversalSet,
-                                     getNode(CI.getOperand(0))));
-#else
-    getNode(CI.getOperand(0));
-#endif
-  }
-}
-
-void Andersens::visitSelectInst(SelectInst &SI) {
-  if (isa<PointerType>(SI.getType())) {
-    unsigned SIN = getNodeValue(SI);
-    // P1 = select C, P2, P3   ---> <Copy/P1/P2>, <Copy/P1/P3>
-    Constraints.push_back(Constraint(Constraint::Copy, SIN,
-                                     getNode(SI.getOperand(1))));
-    Constraints.push_back(Constraint(Constraint::Copy, SIN,
-                                     getNode(SI.getOperand(2))));
-  }
-}
-
-void Andersens::visitVAArg(VAArgInst &I) {
-  llvm_unreachable("vaarg not handled yet!");
-}
-
-/// AddConstraintsForCall - Add constraints for a call with actual arguments
-/// specified by CS to the function specified by F.  Note that the types of
-/// arguments might not match up in the case where this is an indirect call and
-/// the function pointer has been casted.  If this is the case, do something
-/// reasonable.
-void Andersens::AddConstraintsForCall(CallSite CS, Function *F) {
-  Value *CallValue = CS.getCalledValue();
-  bool IsDeref = F == NULL;
-
-  // If this is a call to an external function, try to handle it directly to get
-  // some taste of context sensitivity.
-  if (F && F->isDeclaration() && AddConstraintsForExternalCall(CS, F))
-    return;
-
-  if (isa<PointerType>(CS.getType())) {
-    unsigned CSN = getNode(CS.getInstruction());
-    if (!F || isa<PointerType>(F->getFunctionType()->getReturnType())) {
-      if (IsDeref)
-        Constraints.push_back(Constraint(Constraint::Load, CSN,
-                                         getNode(CallValue), CallReturnPos));
-      else
-        Constraints.push_back(Constraint(Constraint::Copy, CSN,
-                                         getNode(CallValue) + CallReturnPos));
-    } else {
-      // If the function returns a non-pointer value, handle this just like we
-      // treat a nonpointer cast to pointer.
-      Constraints.push_back(Constraint(Constraint::Copy, CSN,
-                                       UniversalSet));
-    }
-  } else if (F && isa<PointerType>(F->getFunctionType()->getReturnType())) {
-#if FULL_UNIVERSAL
-    Constraints.push_back(Constraint(Constraint::Copy,
-                                     UniversalSet,
-                                     getNode(CallValue) + CallReturnPos));
-#else
-    Constraints.push_back(Constraint(Constraint::Copy,
-                                      getNode(CallValue) + CallReturnPos,
-                                      UniversalSet));
-#endif
-                          
-    
-  }
-
-  CallSite::arg_iterator ArgI = CS.arg_begin(), ArgE = CS.arg_end();
-  bool external = !F ||  F->isDeclaration();
-  if (F) {
-    // Direct Call
-    Function::arg_iterator AI = F->arg_begin(), AE = F->arg_end();
-    for (; AI != AE && ArgI != ArgE; ++AI, ++ArgI) 
-      {
-#if !FULL_UNIVERSAL
-        if (external && isa<PointerType>((*ArgI)->getType())) 
-          {
-            // Add constraint that ArgI can now point to anything due to
-            // escaping, as can everything it points to. The second portion of
-            // this should be taken care of by universal = *universal
-            Constraints.push_back(Constraint(Constraint::Copy,
-                                             getNode(*ArgI),
-                                             UniversalSet));
-          }
-#endif
-        if (isa<PointerType>(AI->getType())) {
-          if (isa<PointerType>((*ArgI)->getType())) {
-            // Copy the actual argument into the formal argument.
-            Constraints.push_back(Constraint(Constraint::Copy, getNode(AI),
-                                             getNode(*ArgI)));
-          } else {
-            Constraints.push_back(Constraint(Constraint::Copy, getNode(AI),
-                                             UniversalSet));
-          }
-        } else if (isa<PointerType>((*ArgI)->getType())) {
-#if FULL_UNIVERSAL
-          Constraints.push_back(Constraint(Constraint::Copy,
-                                           UniversalSet,
-                                           getNode(*ArgI)));
-#else
-          Constraints.push_back(Constraint(Constraint::Copy,
-                                           getNode(*ArgI),
-                                           UniversalSet));
-#endif
-        }
-      }
-  } else {
-    //Indirect Call
-    unsigned ArgPos = CallFirstArgPos;
-    for (; ArgI != ArgE; ++ArgI) {
-      if (isa<PointerType>((*ArgI)->getType())) {
-        // Copy the actual argument into the formal argument.
-        Constraints.push_back(Constraint(Constraint::Store,
-                                         getNode(CallValue),
-                                         getNode(*ArgI), ArgPos++));
-      } else {
-        Constraints.push_back(Constraint(Constraint::Store,
-                                         getNode (CallValue),
-                                         UniversalSet, ArgPos++));
-      }
-    }
-  }
-  // Copy all pointers passed through the varargs section to the varargs node.
-  if (F && F->getFunctionType()->isVarArg())
-    for (; ArgI != ArgE; ++ArgI)
-      if (isa<PointerType>((*ArgI)->getType()))
-        Constraints.push_back(Constraint(Constraint::Copy, getVarargNode(F),
-                                         getNode(*ArgI)));
-  // If more arguments are passed in than we track, just drop them on the floor.
-}
-
-void Andersens::visitCallSite(CallSite CS) {
-  if (isa<PointerType>(CS.getType()))
-    getNodeValue(*CS.getInstruction());
-
-  if (Function *F = CS.getCalledFunction()) {
-    AddConstraintsForCall(CS, F);
-  } else {
-    AddConstraintsForCall(CS, NULL);
-  }
-}
-
-//===----------------------------------------------------------------------===//
-//                         Constraint Solving Phase
-//===----------------------------------------------------------------------===//
-
-/// intersects - Return true if the points-to set of this node intersects
-/// with the points-to set of the specified node.
-bool Andersens::Node::intersects(Node *N) const {
-  return PointsTo->intersects(N->PointsTo);
-}
-
-/// intersectsIgnoring - Return true if the points-to set of this node
-/// intersects with the points-to set of the specified node on any nodes
-/// except for the specified node to ignore.
-bool Andersens::Node::intersectsIgnoring(Node *N, unsigned Ignoring) const {
-  // TODO: If we are only going to call this with the same value for Ignoring,
-  // we should move the special values out of the points-to bitmap.
-  bool WeHadIt = PointsTo->test(Ignoring);
-  bool NHadIt = N->PointsTo->test(Ignoring);
-  bool Result = false;
-  if (WeHadIt)
-    PointsTo->reset(Ignoring);
-  if (NHadIt)
-    N->PointsTo->reset(Ignoring);
-  Result = PointsTo->intersects(N->PointsTo);
-  if (WeHadIt)
-    PointsTo->set(Ignoring);
-  if (NHadIt)
-    N->PointsTo->set(Ignoring);
-  return Result;
-}
-
-
-/// Clump together address taken variables so that the points-to sets use up
-/// less space and can be operated on faster.
-
-void Andersens::ClumpAddressTaken() {
-#undef DEBUG_TYPE
-#define DEBUG_TYPE "anders-aa-renumber"
-  std::vector<unsigned> Translate;
-  std::vector<Node> NewGraphNodes;
-
-  Translate.resize(GraphNodes.size());
-  unsigned NewPos = 0;
-
-  for (unsigned i = 0; i < Constraints.size(); ++i) {
-    Constraint &C = Constraints[i];
-    if (C.Type == Constraint::AddressOf) {
-      GraphNodes[C.Src].AddressTaken = true;
-    }
-  }
-  for (unsigned i = 0; i < NumberSpecialNodes; ++i) {
-    unsigned Pos = NewPos++;
-    Translate[i] = Pos;
-    NewGraphNodes.push_back(GraphNodes[i]);
-    DEBUG(dbgs() << "Renumbering node " << i << " to node " << Pos << "\n");
-  }
-
-  // I believe this ends up being faster than making two vectors and splicing
-  // them.
-  for (unsigned i = NumberSpecialNodes; i < GraphNodes.size(); ++i) {
-    if (GraphNodes[i].AddressTaken) {
-      unsigned Pos = NewPos++;
-      Translate[i] = Pos;
-      NewGraphNodes.push_back(GraphNodes[i]);
-      DEBUG(dbgs() << "Renumbering node " << i << " to node " << Pos << "\n");
-    }
-  }
-
-  for (unsigned i = NumberSpecialNodes; i < GraphNodes.size(); ++i) {
-    if (!GraphNodes[i].AddressTaken) {
-      unsigned Pos = NewPos++;
-      Translate[i] = Pos;
-      NewGraphNodes.push_back(GraphNodes[i]);
-      DEBUG(dbgs() << "Renumbering node " << i << " to node " << Pos << "\n");
-    }
-  }
-
-  for (DenseMap<Value*, unsigned>::iterator Iter = ValueNodes.begin();
-       Iter != ValueNodes.end();
-       ++Iter)
-    Iter->second = Translate[Iter->second];
-
-  for (DenseMap<Value*, unsigned>::iterator Iter = ObjectNodes.begin();
-       Iter != ObjectNodes.end();
-       ++Iter)
-    Iter->second = Translate[Iter->second];
-
-  for (DenseMap<Function*, unsigned>::iterator Iter = ReturnNodes.begin();
-       Iter != ReturnNodes.end();
-       ++Iter)
-    Iter->second = Translate[Iter->second];
-
-  for (DenseMap<Function*, unsigned>::iterator Iter = VarargNodes.begin();
-       Iter != VarargNodes.end();
-       ++Iter)
-    Iter->second = Translate[Iter->second];
-
-  for (unsigned i = 0; i < Constraints.size(); ++i) {
-    Constraint &C = Constraints[i];
-    C.Src = Translate[C.Src];
-    C.Dest = Translate[C.Dest];
-  }
-
-  GraphNodes.swap(NewGraphNodes);
-#undef DEBUG_TYPE
-#define DEBUG_TYPE "anders-aa"
-}
-
-/// The technique used here is described in "Exploiting Pointer and Location
-/// Equivalence to Optimize Pointer Analysis. In the 14th International Static
-/// Analysis Symposium (SAS), August 2007."  It is known as the "HVN" algorithm,
-/// and is equivalent to value numbering the collapsed constraint graph without
-/// evaluating unions.  This is used as a pre-pass to HU in order to resolve
-/// first order pointer dereferences and speed up/reduce memory usage of HU.
-/// Running both is equivalent to HRU without the iteration
-/// HVN in more detail:
-/// Imagine the set of constraints was simply straight line code with no loops
-/// (we eliminate cycles, so there are no loops), such as:
-/// E = &D
-/// E = &C
-/// E = F
-/// F = G
-/// G = F
-/// Applying value numbering to this code tells us:
-/// G == F == E
-///
-/// For HVN, this is as far as it goes.  We assign new value numbers to every
-/// "address node", and every "reference node".
-/// To get the optimal result for this, we use a DFS + SCC (since all nodes in a
-/// cycle must have the same value number since the = operation is really
-/// inclusion, not overwrite), and value number nodes we receive points-to sets
-/// before we value our own node.
-/// The advantage of HU over HVN is that HU considers the inclusion property, so
-/// that if you have
-/// E = &D
-/// E = &C
-/// E = F
-/// F = G
-/// F = &D
-/// G = F
-/// HU will determine that G == F == E.  HVN will not, because it cannot prove
-/// that the points to information ends up being the same because they all
-/// receive &D from E anyway.
-
-void Andersens::HVN() {
-  DEBUG(dbgs() << "Beginning HVN\n");
-  // Build a predecessor graph.  This is like our constraint graph with the
-  // edges going in the opposite direction, and there are edges for all the
-  // constraints, instead of just copy constraints.  We also build implicit
-  // edges for constraints are implied but not explicit.  I.E for the constraint
-  // a = &b, we add implicit edges *a = b.  This helps us capture more cycles
-  for (unsigned i = 0, e = Constraints.size(); i != e; ++i) {
-    Constraint &C = Constraints[i];
-    if (C.Type == Constraint::AddressOf) {
-      GraphNodes[C.Src].AddressTaken = true;
-      GraphNodes[C.Src].Direct = false;
-
-      // Dest = &src edge
-      unsigned AdrNode = C.Src + FirstAdrNode;
-      if (!GraphNodes[C.Dest].PredEdges)
-        GraphNodes[C.Dest].PredEdges = new SparseBitVector<>;
-      GraphNodes[C.Dest].PredEdges->set(AdrNode);
-
-      // *Dest = src edge
-      unsigned RefNode = C.Dest + FirstRefNode;
-      if (!GraphNodes[RefNode].ImplicitPredEdges)
-        GraphNodes[RefNode].ImplicitPredEdges = new SparseBitVector<>;
-      GraphNodes[RefNode].ImplicitPredEdges->set(C.Src);
-    } else if (C.Type == Constraint::Load) {
-      if (C.Offset == 0) {
-        // dest = *src edge
-        if (!GraphNodes[C.Dest].PredEdges)
-          GraphNodes[C.Dest].PredEdges = new SparseBitVector<>;
-        GraphNodes[C.Dest].PredEdges->set(C.Src + FirstRefNode);
-      } else {
-        GraphNodes[C.Dest].Direct = false;
-      }
-    } else if (C.Type == Constraint::Store) {
-      if (C.Offset == 0) {
-        // *dest = src edge
-        unsigned RefNode = C.Dest + FirstRefNode;
-        if (!GraphNodes[RefNode].PredEdges)
-          GraphNodes[RefNode].PredEdges = new SparseBitVector<>;
-        GraphNodes[RefNode].PredEdges->set(C.Src);
-      }
-    } else {
-      // Dest = Src edge and *Dest = *Src edge
-      if (!GraphNodes[C.Dest].PredEdges)
-        GraphNodes[C.Dest].PredEdges = new SparseBitVector<>;
-      GraphNodes[C.Dest].PredEdges->set(C.Src);
-      unsigned RefNode = C.Dest + FirstRefNode;
-      if (!GraphNodes[RefNode].ImplicitPredEdges)
-        GraphNodes[RefNode].ImplicitPredEdges = new SparseBitVector<>;
-      GraphNodes[RefNode].ImplicitPredEdges->set(C.Src + FirstRefNode);
-    }
-  }
-  PEClass = 1;
-  // Do SCC finding first to condense our predecessor graph
-  DFSNumber = 0;
-  Node2DFS.insert(Node2DFS.begin(), GraphNodes.size(), 0);
-  Node2Deleted.insert(Node2Deleted.begin(), GraphNodes.size(), false);
-  Node2Visited.insert(Node2Visited.begin(), GraphNodes.size(), false);
-
-  for (unsigned i = 0; i < FirstRefNode; ++i) {
-    unsigned Node = VSSCCRep[i];
-    if (!Node2Visited[Node])
-      HVNValNum(Node);
-  }
-  for (BitVectorMap::iterator Iter = Set2PEClass.begin();
-       Iter != Set2PEClass.end();
-       ++Iter)
-    delete Iter->first;
-  Set2PEClass.clear();
-  Node2DFS.clear();
-  Node2Deleted.clear();
-  Node2Visited.clear();
-  DEBUG(dbgs() << "Finished HVN\n");
-
-}
-
-/// This is the workhorse of HVN value numbering. We combine SCC finding at the
-/// same time because it's easy.
-void Andersens::HVNValNum(unsigned NodeIndex) {
-  unsigned MyDFS = DFSNumber++;
-  Node *N = &GraphNodes[NodeIndex];
-  Node2Visited[NodeIndex] = true;
-  Node2DFS[NodeIndex] = MyDFS;
-
-  // First process all our explicit edges
-  if (N->PredEdges)
-    for (SparseBitVector<>::iterator Iter = N->PredEdges->begin();
-         Iter != N->PredEdges->end();
-         ++Iter) {
-      unsigned j = VSSCCRep[*Iter];
-      if (!Node2Deleted[j]) {
-        if (!Node2Visited[j])
-          HVNValNum(j);
-        if (Node2DFS[NodeIndex] > Node2DFS[j])
-          Node2DFS[NodeIndex] = Node2DFS[j];
-      }
-    }
-
-  // Now process all the implicit edges
-  if (N->ImplicitPredEdges)
-    for (SparseBitVector<>::iterator Iter = N->ImplicitPredEdges->begin();
-         Iter != N->ImplicitPredEdges->end();
-         ++Iter) {
-      unsigned j = VSSCCRep[*Iter];
-      if (!Node2Deleted[j]) {
-        if (!Node2Visited[j])
-          HVNValNum(j);
-        if (Node2DFS[NodeIndex] > Node2DFS[j])
-          Node2DFS[NodeIndex] = Node2DFS[j];
-      }
-    }
-
-  // See if we found any cycles
-  if (MyDFS == Node2DFS[NodeIndex]) {
-    while (!SCCStack.empty() && Node2DFS[SCCStack.top()] >= MyDFS) {
-      unsigned CycleNodeIndex = SCCStack.top();
-      Node *CycleNode = &GraphNodes[CycleNodeIndex];
-      VSSCCRep[CycleNodeIndex] = NodeIndex;
-      // Unify the nodes
-      N->Direct &= CycleNode->Direct;
-
-      if (CycleNode->PredEdges) {
-        if (!N->PredEdges)
-          N->PredEdges = new SparseBitVector<>;
-        *(N->PredEdges) |= CycleNode->PredEdges;
-        delete CycleNode->PredEdges;
-        CycleNode->PredEdges = NULL;
-      }
-      if (CycleNode->ImplicitPredEdges) {
-        if (!N->ImplicitPredEdges)
-          N->ImplicitPredEdges = new SparseBitVector<>;
-        *(N->ImplicitPredEdges) |= CycleNode->ImplicitPredEdges;
-        delete CycleNode->ImplicitPredEdges;
-        CycleNode->ImplicitPredEdges = NULL;
-      }
-
-      SCCStack.pop();
-    }
-
-    Node2Deleted[NodeIndex] = true;
-
-    if (!N->Direct) {
-      GraphNodes[NodeIndex].PointerEquivLabel = PEClass++;
-      return;
-    }
-
-    // Collect labels of successor nodes
-    bool AllSame = true;
-    unsigned First = ~0;
-    SparseBitVector<> *Labels = new SparseBitVector<>;
-    bool Used = false;
-
-    if (N->PredEdges)
-      for (SparseBitVector<>::iterator Iter = N->PredEdges->begin();
-           Iter != N->PredEdges->end();
-         ++Iter) {
-        unsigned j = VSSCCRep[*Iter];
-        unsigned Label = GraphNodes[j].PointerEquivLabel;
-        // Ignore labels that are equal to us or non-pointers
-        if (j == NodeIndex || Label == 0)
-          continue;
-        if (First == (unsigned)~0)
-          First = Label;
-        else if (First != Label)
-          AllSame = false;
-        Labels->set(Label);
-    }
-
-    // We either have a non-pointer, a copy of an existing node, or a new node.
-    // Assign the appropriate pointer equivalence label.
-    if (Labels->empty()) {
-      GraphNodes[NodeIndex].PointerEquivLabel = 0;
-    } else if (AllSame) {
-      GraphNodes[NodeIndex].PointerEquivLabel = First;
-    } else {
-      GraphNodes[NodeIndex].PointerEquivLabel = Set2PEClass[Labels];
-      if (GraphNodes[NodeIndex].PointerEquivLabel == 0) {
-        unsigned EquivClass = PEClass++;
-        Set2PEClass[Labels] = EquivClass;
-        GraphNodes[NodeIndex].PointerEquivLabel = EquivClass;
-        Used = true;
-      }
-    }
-    if (!Used)
-      delete Labels;
-  } else {
-    SCCStack.push(NodeIndex);
-  }
-}
-
-/// The technique used here is described in "Exploiting Pointer and Location
-/// Equivalence to Optimize Pointer Analysis. In the 14th International Static
-/// Analysis Symposium (SAS), August 2007."  It is known as the "HU" algorithm,
-/// and is equivalent to value numbering the collapsed constraint graph
-/// including evaluating unions.
-void Andersens::HU() {
-  DEBUG(dbgs() << "Beginning HU\n");
-  // Build a predecessor graph.  This is like our constraint graph with the
-  // edges going in the opposite direction, and there are edges for all the
-  // constraints, instead of just copy constraints.  We also build implicit
-  // edges for constraints are implied but not explicit.  I.E for the constraint
-  // a = &b, we add implicit edges *a = b.  This helps us capture more cycles
-  for (unsigned i = 0, e = Constraints.size(); i != e; ++i) {
-    Constraint &C = Constraints[i];
-    if (C.Type == Constraint::AddressOf) {
-      GraphNodes[C.Src].AddressTaken = true;
-      GraphNodes[C.Src].Direct = false;
-
-      GraphNodes[C.Dest].PointsTo->set(C.Src);
-      // *Dest = src edge
-      unsigned RefNode = C.Dest + FirstRefNode;
-      if (!GraphNodes[RefNode].ImplicitPredEdges)
-        GraphNodes[RefNode].ImplicitPredEdges = new SparseBitVector<>;
-      GraphNodes[RefNode].ImplicitPredEdges->set(C.Src);
-      GraphNodes[C.Src].PointedToBy->set(C.Dest);
-    } else if (C.Type == Constraint::Load) {
-      if (C.Offset == 0) {
-        // dest = *src edge
-        if (!GraphNodes[C.Dest].PredEdges)
-          GraphNodes[C.Dest].PredEdges = new SparseBitVector<>;
-        GraphNodes[C.Dest].PredEdges->set(C.Src + FirstRefNode);
-      } else {
-        GraphNodes[C.Dest].Direct = false;
-      }
-    } else if (C.Type == Constraint::Store) {
-      if (C.Offset == 0) {
-        // *dest = src edge
-        unsigned RefNode = C.Dest + FirstRefNode;
-        if (!GraphNodes[RefNode].PredEdges)
-          GraphNodes[RefNode].PredEdges = new SparseBitVector<>;
-        GraphNodes[RefNode].PredEdges->set(C.Src);
-      }
-    } else {
-      // Dest = Src edge and *Dest = *Src edg
-      if (!GraphNodes[C.Dest].PredEdges)
-        GraphNodes[C.Dest].PredEdges = new SparseBitVector<>;
-      GraphNodes[C.Dest].PredEdges->set(C.Src);
-      unsigned RefNode = C.Dest + FirstRefNode;
-      if (!GraphNodes[RefNode].ImplicitPredEdges)
-        GraphNodes[RefNode].ImplicitPredEdges = new SparseBitVector<>;
-      GraphNodes[RefNode].ImplicitPredEdges->set(C.Src + FirstRefNode);
-    }
-  }
-  PEClass = 1;
-  // Do SCC finding first to condense our predecessor graph
-  DFSNumber = 0;
-  Node2DFS.insert(Node2DFS.begin(), GraphNodes.size(), 0);
-  Node2Deleted.insert(Node2Deleted.begin(), GraphNodes.size(), false);
-  Node2Visited.insert(Node2Visited.begin(), GraphNodes.size(), false);
-
-  for (unsigned i = 0; i < FirstRefNode; ++i) {
-    if (FindNode(i) == i) {
-      unsigned Node = VSSCCRep[i];
-      if (!Node2Visited[Node])
-        Condense(Node);
-    }
-  }
-
-  // Reset tables for actual labeling
-  Node2DFS.clear();
-  Node2Visited.clear();
-  Node2Deleted.clear();
-  // Pre-grow our densemap so that we don't get really bad behavior
-  Set2PEClass.resize(GraphNodes.size());
-
-  // Visit the condensed graph and generate pointer equivalence labels.
-  Node2Visited.insert(Node2Visited.begin(), GraphNodes.size(), false);
-  for (unsigned i = 0; i < FirstRefNode; ++i) {
-    if (FindNode(i) == i) {
-      unsigned Node = VSSCCRep[i];
-      if (!Node2Visited[Node])
-        HUValNum(Node);
-    }
-  }
-  // PEClass nodes will be deleted by the deleting of N->PointsTo in our caller.
-  Set2PEClass.clear();
-  DEBUG(dbgs() << "Finished HU\n");
-}
-
-
-/// Implementation of standard Tarjan SCC algorithm as modified by Nuutilla.
-void Andersens::Condense(unsigned NodeIndex) {
-  unsigned MyDFS = DFSNumber++;
-  Node *N = &GraphNodes[NodeIndex];
-  Node2Visited[NodeIndex] = true;
-  Node2DFS[NodeIndex] = MyDFS;
-
-  // First process all our explicit edges
-  if (N->PredEdges)
-    for (SparseBitVector<>::iterator Iter = N->PredEdges->begin();
-         Iter != N->PredEdges->end();
-         ++Iter) {
-      unsigned j = VSSCCRep[*Iter];
-      if (!Node2Deleted[j]) {
-        if (!Node2Visited[j])
-          Condense(j);
-        if (Node2DFS[NodeIndex] > Node2DFS[j])
-          Node2DFS[NodeIndex] = Node2DFS[j];
-      }
-    }
-
-  // Now process all the implicit edges
-  if (N->ImplicitPredEdges)
-    for (SparseBitVector<>::iterator Iter = N->ImplicitPredEdges->begin();
-         Iter != N->ImplicitPredEdges->end();
-         ++Iter) {
-      unsigned j = VSSCCRep[*Iter];
-      if (!Node2Deleted[j]) {
-        if (!Node2Visited[j])
-          Condense(j);
-        if (Node2DFS[NodeIndex] > Node2DFS[j])
-          Node2DFS[NodeIndex] = Node2DFS[j];
-      }
-    }
-
-  // See if we found any cycles
-  if (MyDFS == Node2DFS[NodeIndex]) {
-    while (!SCCStack.empty() && Node2DFS[SCCStack.top()] >= MyDFS) {
-      unsigned CycleNodeIndex = SCCStack.top();
-      Node *CycleNode = &GraphNodes[CycleNodeIndex];
-      VSSCCRep[CycleNodeIndex] = NodeIndex;
-      // Unify the nodes
-      N->Direct &= CycleNode->Direct;
-
-      *(N->PointsTo) |= CycleNode->PointsTo;
-      delete CycleNode->PointsTo;
-      CycleNode->PointsTo = NULL;
-      if (CycleNode->PredEdges) {
-        if (!N->PredEdges)
-          N->PredEdges = new SparseBitVector<>;
-        *(N->PredEdges) |= CycleNode->PredEdges;
-        delete CycleNode->PredEdges;
-        CycleNode->PredEdges = NULL;
-      }
-      if (CycleNode->ImplicitPredEdges) {
-        if (!N->ImplicitPredEdges)
-          N->ImplicitPredEdges = new SparseBitVector<>;
-        *(N->ImplicitPredEdges) |= CycleNode->ImplicitPredEdges;
-        delete CycleNode->ImplicitPredEdges;
-        CycleNode->ImplicitPredEdges = NULL;
-      }
-      SCCStack.pop();
-    }
-
-    Node2Deleted[NodeIndex] = true;
-
-    // Set up number of incoming edges for other nodes
-    if (N->PredEdges)
-      for (SparseBitVector<>::iterator Iter = N->PredEdges->begin();
-           Iter != N->PredEdges->end();
-           ++Iter)
-        ++GraphNodes[VSSCCRep[*Iter]].NumInEdges;
-  } else {
-    SCCStack.push(NodeIndex);
-  }
-}
-
-void Andersens::HUValNum(unsigned NodeIndex) {
-  Node *N = &GraphNodes[NodeIndex];
-  Node2Visited[NodeIndex] = true;
-
-  // Eliminate dereferences of non-pointers for those non-pointers we have
-  // already identified.  These are ref nodes whose non-ref node:
-  // 1. Has already been visited determined to point to nothing (and thus, a
-  // dereference of it must point to nothing)
-  // 2. Any direct node with no predecessor edges in our graph and with no
-  // points-to set (since it can't point to anything either, being that it
-  // receives no points-to sets and has none).
-  if (NodeIndex >= FirstRefNode) {
-    unsigned j = VSSCCRep[FindNode(NodeIndex - FirstRefNode)];
-    if ((Node2Visited[j] && !GraphNodes[j].PointerEquivLabel)
-        || (GraphNodes[j].Direct && !GraphNodes[j].PredEdges
-            && GraphNodes[j].PointsTo->empty())){
-      return;
-    }
-  }
-    // Process all our explicit edges
-  if (N->PredEdges)
-    for (SparseBitVector<>::iterator Iter = N->PredEdges->begin();
-         Iter != N->PredEdges->end();
-         ++Iter) {
-      unsigned j = VSSCCRep[*Iter];
-      if (!Node2Visited[j])
-        HUValNum(j);
-
-      // If this edge turned out to be the same as us, or got no pointer
-      // equivalence label (and thus points to nothing) , just decrement our
-      // incoming edges and continue.
-      if (j == NodeIndex || GraphNodes[j].PointerEquivLabel == 0) {
-        --GraphNodes[j].NumInEdges;
-        continue;
-      }
-
-      *(N->PointsTo) |= GraphNodes[j].PointsTo;
-
-      // If we didn't end up storing this in the hash, and we're done with all
-      // the edges, we don't need the points-to set anymore.
-      --GraphNodes[j].NumInEdges;
-      if (!GraphNodes[j].NumInEdges && !GraphNodes[j].StoredInHash) {
-        delete GraphNodes[j].PointsTo;
-        GraphNodes[j].PointsTo = NULL;
-      }
-    }
-  // If this isn't a direct node, generate a fresh variable.
-  if (!N->Direct) {
-    N->PointsTo->set(FirstRefNode + NodeIndex);
-  }
-
-  // See If we have something equivalent to us, if not, generate a new
-  // equivalence class.
-  if (N->PointsTo->empty()) {
-    delete N->PointsTo;
-    N->PointsTo = NULL;
-  } else {
-    if (N->Direct) {
-      N->PointerEquivLabel = Set2PEClass[N->PointsTo];
-      if (N->PointerEquivLabel == 0) {
-        unsigned EquivClass = PEClass++;
-        N->StoredInHash = true;
-        Set2PEClass[N->PointsTo] = EquivClass;
-        N->PointerEquivLabel = EquivClass;
-      }
-    } else {
-      N->PointerEquivLabel = PEClass++;
-    }
-  }
-}
-
-/// Rewrite our list of constraints so that pointer equivalent nodes are
-/// replaced by their the pointer equivalence class representative.
-void Andersens::RewriteConstraints() {
-  std::vector<Constraint> NewConstraints;
-  DenseSet<Constraint, ConstraintKeyInfo> Seen;
-
-  PEClass2Node.clear();
-  PENLEClass2Node.clear();
-
-  // We may have from 1 to Graphnodes + 1 equivalence classes.
-  PEClass2Node.insert(PEClass2Node.begin(), GraphNodes.size() + 1, -1);
-  PENLEClass2Node.insert(PENLEClass2Node.begin(), GraphNodes.size() + 1, -1);
-
-  // Rewrite constraints, ignoring non-pointer constraints, uniting equivalent
-  // nodes, and rewriting constraints to use the representative nodes.
-  for (unsigned i = 0, e = Constraints.size(); i != e; ++i) {
-    Constraint &C = Constraints[i];
-    unsigned RHSNode = FindNode(C.Src);
-    unsigned LHSNode = FindNode(C.Dest);
-    unsigned RHSLabel = GraphNodes[VSSCCRep[RHSNode]].PointerEquivLabel;
-    unsigned LHSLabel = GraphNodes[VSSCCRep[LHSNode]].PointerEquivLabel;
-
-    // First we try to eliminate constraints for things we can prove don't point
-    // to anything.
-    if (LHSLabel == 0) {
-      DEBUG(PrintNode(&GraphNodes[LHSNode]));
-      DEBUG(dbgs() << " is a non-pointer, ignoring constraint.\n");
-      continue;
-    }
-    if (RHSLabel == 0) {
-      DEBUG(PrintNode(&GraphNodes[RHSNode]));
-      DEBUG(dbgs() << " is a non-pointer, ignoring constraint.\n");
-      continue;
-    }
-    // This constraint may be useless, and it may become useless as we translate
-    // it.
-    if (C.Src == C.Dest && C.Type == Constraint::Copy)
-      continue;
-
-    C.Src = FindEquivalentNode(RHSNode, RHSLabel);
-    C.Dest = FindEquivalentNode(FindNode(LHSNode), LHSLabel);
-    if ((C.Src == C.Dest && C.Type == Constraint::Copy)
-        || Seen.count(C))
-      continue;
-
-    Seen.insert(C);
-    NewConstraints.push_back(C);
-  }
-  Constraints.swap(NewConstraints);
-  PEClass2Node.clear();
-}
-
-/// See if we have a node that is pointer equivalent to the one being asked
-/// about, and if so, unite them and return the equivalent node.  Otherwise,
-/// return the original node.
-unsigned Andersens::FindEquivalentNode(unsigned NodeIndex,
-                                       unsigned NodeLabel) {
-  if (!GraphNodes[NodeIndex].AddressTaken) {
-    if (PEClass2Node[NodeLabel] != -1) {
-      // We found an existing node with the same pointer label, so unify them.
-      // We specifically request that Union-By-Rank not be used so that
-      // PEClass2Node[NodeLabel] U= NodeIndex and not the other way around.
-      return UniteNodes(PEClass2Node[NodeLabel], NodeIndex, false);
-    } else {
-      PEClass2Node[NodeLabel] = NodeIndex;
-      PENLEClass2Node[NodeLabel] = NodeIndex;
-    }
-  } else if (PENLEClass2Node[NodeLabel] == -1) {
-    PENLEClass2Node[NodeLabel] = NodeIndex;
-  }
-
-  return NodeIndex;
-}
-
-void Andersens::PrintLabels() const {
-  for (unsigned i = 0; i < GraphNodes.size(); ++i) {
-    if (i < FirstRefNode) {
-      PrintNode(&GraphNodes[i]);
-    } else if (i < FirstAdrNode) {
-      DEBUG(dbgs() << "REF(");
-      PrintNode(&GraphNodes[i-FirstRefNode]);
-      DEBUG(dbgs() <<")");
-    } else {
-      DEBUG(dbgs() << "ADR(");
-      PrintNode(&GraphNodes[i-FirstAdrNode]);
-      DEBUG(dbgs() <<")");
-    }
-
-    DEBUG(dbgs() << " has pointer label " << GraphNodes[i].PointerEquivLabel
-         << " and SCC rep " << VSSCCRep[i]
-         << " and is " << (GraphNodes[i].Direct ? "Direct" : "Not direct")
-         << "\n");
-  }
-}
-
-/// The technique used here is described in "The Ant and the
-/// Grasshopper: Fast and Accurate Pointer Analysis for Millions of
-/// Lines of Code. In Programming Language Design and Implementation
-/// (PLDI), June 2007." It is known as the "HCD" (Hybrid Cycle
-/// Detection) algorithm. It is called a hybrid because it performs an
-/// offline analysis and uses its results during the solving (online)
-/// phase. This is just the offline portion; the results of this
-/// operation are stored in SDT and are later used in SolveContraints()
-/// and UniteNodes().
-void Andersens::HCD() {
-  DEBUG(dbgs() << "Starting HCD.\n");
-  HCDSCCRep.resize(GraphNodes.size());
-
-  for (unsigned i = 0; i < GraphNodes.size(); ++i) {
-    GraphNodes[i].Edges = new SparseBitVector<>;
-    HCDSCCRep[i] = i;
-  }
-
-  for (unsigned i = 0, e = Constraints.size(); i != e; ++i) {
-    Constraint &C = Constraints[i];
-    assert (C.Src < GraphNodes.size() && C.Dest < GraphNodes.size());
-    if (C.Type == Constraint::AddressOf) {
-      continue;
-    } else if (C.Type == Constraint::Load) {
-      if( C.Offset == 0 )
-        GraphNodes[C.Dest].Edges->set(C.Src + FirstRefNode);
-    } else if (C.Type == Constraint::Store) {
-      if( C.Offset == 0 )
-        GraphNodes[C.Dest + FirstRefNode].Edges->set(C.Src);
-    } else {
-      GraphNodes[C.Dest].Edges->set(C.Src);
-    }
-  }
-
-  Node2DFS.insert(Node2DFS.begin(), GraphNodes.size(), 0);
-  Node2Deleted.insert(Node2Deleted.begin(), GraphNodes.size(), false);
-  Node2Visited.insert(Node2Visited.begin(), GraphNodes.size(), false);
-  SDT.insert(SDT.begin(), GraphNodes.size() / 2, -1);
-
-  DFSNumber = 0;
-  for (unsigned i = 0; i < GraphNodes.size(); ++i) {
-    unsigned Node = HCDSCCRep[i];
-    if (!Node2Deleted[Node])
-      Search(Node);
-  }
-
-  for (unsigned i = 0; i < GraphNodes.size(); ++i)
-    if (GraphNodes[i].Edges != NULL) {
-      delete GraphNodes[i].Edges;
-      GraphNodes[i].Edges = NULL;
-    }
-
-  while( !SCCStack.empty() )
-    SCCStack.pop();
-
-  Node2DFS.clear();
-  Node2Visited.clear();
-  Node2Deleted.clear();
-  HCDSCCRep.clear();
-  DEBUG(dbgs() << "HCD complete.\n");
-}
-
-// Component of HCD: 
-// Use Nuutila's variant of Tarjan's algorithm to detect
-// Strongly-Connected Components (SCCs). For non-trivial SCCs
-// containing ref nodes, insert the appropriate information in SDT.
-void Andersens::Search(unsigned Node) {
-  unsigned MyDFS = DFSNumber++;
-
-  Node2Visited[Node] = true;
-  Node2DFS[Node] = MyDFS;
-
-  for (SparseBitVector<>::iterator Iter = GraphNodes[Node].Edges->begin(),
-                                   End  = GraphNodes[Node].Edges->end();
-       Iter != End;
-       ++Iter) {
-    unsigned J = HCDSCCRep[*Iter];
-    assert(GraphNodes[J].isRep() && "Debug check; must be representative");
-    if (!Node2Deleted[J]) {
-      if (!Node2Visited[J])
-        Search(J);
-      if (Node2DFS[Node] > Node2DFS[J])
-        Node2DFS[Node] = Node2DFS[J];
-    }
-  }
-
-  if( MyDFS != Node2DFS[Node] ) {
-    SCCStack.push(Node);
-    return;
-  }
-
-  // This node is the root of a SCC, so process it.
-  //
-  // If the SCC is "non-trivial" (not a singleton) and contains a reference 
-  // node, we place this SCC into SDT.  We unite the nodes in any case.
-  if (!SCCStack.empty() && Node2DFS[SCCStack.top()] >= MyDFS) {
-    SparseBitVector<> SCC;
-
-    SCC.set(Node);
-
-    bool Ref = (Node >= FirstRefNode);
-
-    Node2Deleted[Node] = true;
-
-    do {
-      unsigned P = SCCStack.top(); SCCStack.pop();
-      Ref |= (P >= FirstRefNode);
-      SCC.set(P);
-      HCDSCCRep[P] = Node;
-    } while (!SCCStack.empty() && Node2DFS[SCCStack.top()] >= MyDFS);
-
-    if (Ref) {
-      unsigned Rep = SCC.find_first();
-      assert(Rep < FirstRefNode && "The SCC didn't have a non-Ref node!");
-
-      SparseBitVector<>::iterator i = SCC.begin();
-
-      // Skip over the non-ref nodes
-      while( *i < FirstRefNode )
-        ++i;
-
-      while( i != SCC.end() )
-        SDT[ (*i++) - FirstRefNode ] = Rep;
-    }
-  }
-}
-
-
-/// Optimize the constraints by performing offline variable substitution and
-/// other optimizations.
-void Andersens::OptimizeConstraints() {
-  DEBUG(dbgs() << "Beginning constraint optimization\n");
-
-  SDTActive = false;
-
-  // Function related nodes need to stay in the same relative position and can't
-  // be location equivalent.
-  for (std::map<unsigned, unsigned>::iterator Iter = MaxK.begin();
-       Iter != MaxK.end();
-       ++Iter) {
-    for (unsigned i = Iter->first;
-         i != Iter->first + Iter->second;
-         ++i) {
-      GraphNodes[i].AddressTaken = true;
-      GraphNodes[i].Direct = false;
-    }
-  }
-
-  ClumpAddressTaken();
-  FirstRefNode = GraphNodes.size();
-  FirstAdrNode = FirstRefNode + GraphNodes.size();
-  GraphNodes.insert(GraphNodes.end(), 2 * GraphNodes.size(),
-                    Node(false));
-  VSSCCRep.resize(GraphNodes.size());
-  for (unsigned i = 0; i < GraphNodes.size(); ++i) {
-    VSSCCRep[i] = i;
-  }
-  HVN();
-  for (unsigned i = 0; i < GraphNodes.size(); ++i) {
-    Node *N = &GraphNodes[i];
-    delete N->PredEdges;
-    N->PredEdges = NULL;
-    delete N->ImplicitPredEdges;
-    N->ImplicitPredEdges = NULL;
-  }
-#undef DEBUG_TYPE
-#define DEBUG_TYPE "anders-aa-labels"
-  DEBUG(PrintLabels());
-#undef DEBUG_TYPE
-#define DEBUG_TYPE "anders-aa"
-  RewriteConstraints();
-  // Delete the adr nodes.
-  GraphNodes.resize(FirstRefNode * 2);
-
-  // Now perform HU
-  for (unsigned i = 0; i < GraphNodes.size(); ++i) {
-    Node *N = &GraphNodes[i];
-    if (FindNode(i) == i) {
-      N->PointsTo = new SparseBitVector<>;
-      N->PointedToBy = new SparseBitVector<>;
-      // Reset our labels
-    }
-    VSSCCRep[i] = i;
-    N->PointerEquivLabel = 0;
-  }
-  HU();
-#undef DEBUG_TYPE
-#define DEBUG_TYPE "anders-aa-labels"
-  DEBUG(PrintLabels());
-#undef DEBUG_TYPE
-#define DEBUG_TYPE "anders-aa"
-  RewriteConstraints();
-  for (unsigned i = 0; i < GraphNodes.size(); ++i) {
-    if (FindNode(i) == i) {
-      Node *N = &GraphNodes[i];
-      delete N->PointsTo;
-      N->PointsTo = NULL;
-      delete N->PredEdges;
-      N->PredEdges = NULL;
-      delete N->ImplicitPredEdges;
-      N->ImplicitPredEdges = NULL;
-      delete N->PointedToBy;
-      N->PointedToBy = NULL;
-    }
-  }
-
-  // perform Hybrid Cycle Detection (HCD)
-  HCD();
-  SDTActive = true;
-
-  // No longer any need for the upper half of GraphNodes (for ref nodes).
-  GraphNodes.erase(GraphNodes.begin() + FirstRefNode, GraphNodes.end());
-
-  // HCD complete.
-
-  DEBUG(dbgs() << "Finished constraint optimization\n");
-  FirstRefNode = 0;
-  FirstAdrNode = 0;
-}
-
-/// Unite pointer but not location equivalent variables, now that the constraint
-/// graph is built.
-void Andersens::UnitePointerEquivalences() {
-  DEBUG(dbgs() << "Uniting remaining pointer equivalences\n");
-  for (unsigned i = 0; i < GraphNodes.size(); ++i) {
-    if (GraphNodes[i].AddressTaken && GraphNodes[i].isRep()) {
-      unsigned Label = GraphNodes[i].PointerEquivLabel;
-
-      if (Label && PENLEClass2Node[Label] != -1)
-        UniteNodes(i, PENLEClass2Node[Label]);
-    }
-  }
-  DEBUG(dbgs() << "Finished remaining pointer equivalences\n");
-  PENLEClass2Node.clear();
-}
-
-/// Create the constraint graph used for solving points-to analysis.
-///
-void Andersens::CreateConstraintGraph() {
-  for (unsigned i = 0, e = Constraints.size(); i != e; ++i) {
-    Constraint &C = Constraints[i];
-    assert (C.Src < GraphNodes.size() && C.Dest < GraphNodes.size());
-    if (C.Type == Constraint::AddressOf)
-      GraphNodes[C.Dest].PointsTo->set(C.Src);
-    else if (C.Type == Constraint::Load)
-      GraphNodes[C.Src].Constraints.push_back(C);
-    else if (C.Type == Constraint::Store)
-      GraphNodes[C.Dest].Constraints.push_back(C);
-    else if (C.Offset != 0)
-      GraphNodes[C.Src].Constraints.push_back(C);
-    else
-      GraphNodes[C.Src].Edges->set(C.Dest);
-  }
-}
-
-// Perform DFS and cycle detection.
-bool Andersens::QueryNode(unsigned Node) {
-  assert(GraphNodes[Node].isRep() && "Querying a non-rep node");
-  unsigned OurDFS = ++DFSNumber;
-  SparseBitVector<> ToErase;
-  SparseBitVector<> NewEdges;
-  Tarjan2DFS[Node] = OurDFS;
-
-  // Changed denotes a change from a recursive call that we will bubble up.
-  // Merged is set if we actually merge a node ourselves.
-  bool Changed = false, Merged = false;
-
-  for (SparseBitVector<>::iterator bi = GraphNodes[Node].Edges->begin();
-       bi != GraphNodes[Node].Edges->end();
-       ++bi) {
-    unsigned RepNode = FindNode(*bi);
-    // If this edge points to a non-representative node but we are
-    // already planning to add an edge to its representative, we have no
-    // need for this edge anymore.
-    if (RepNode != *bi && NewEdges.test(RepNode)){
-      ToErase.set(*bi);
-      continue;
-    }
-
-    // Continue about our DFS.
-    if (!Tarjan2Deleted[RepNode]){
-      if (Tarjan2DFS[RepNode] == 0) {
-        Changed |= QueryNode(RepNode);
-        // May have been changed by QueryNode
-        RepNode = FindNode(RepNode);
-      }
-      if (Tarjan2DFS[RepNode] < Tarjan2DFS[Node])
-        Tarjan2DFS[Node] = Tarjan2DFS[RepNode];
-    }
-
-    // We may have just discovered that this node is part of a cycle, in
-    // which case we can also erase it.
-    if (RepNode != *bi) {
-      ToErase.set(*bi);
-      NewEdges.set(RepNode);
-    }
-  }
-
-  GraphNodes[Node].Edges->intersectWithComplement(ToErase);
-  GraphNodes[Node].Edges |= NewEdges;
-
-  // If this node is a root of a non-trivial SCC, place it on our 
-  // worklist to be processed.
-  if (OurDFS == Tarjan2DFS[Node]) {
-    while (!SCCStack.empty() && Tarjan2DFS[SCCStack.top()] >= OurDFS) {
-      Node = UniteNodes(Node, SCCStack.top());
-
-      SCCStack.pop();
-      Merged = true;
-    }
-    Tarjan2Deleted[Node] = true;
-
-    if (Merged)
-      NextWL->insert(&GraphNodes[Node]);
-  } else {
-    SCCStack.push(Node);
-  }
-
-  return(Changed | Merged);
-}
-
-/// SolveConstraints - This stage iteratively processes the constraints list
-/// propagating constraints (adding edges to the Nodes in the points-to graph)
-/// until a fixed point is reached.
-///
-/// We use a variant of the technique called "Lazy Cycle Detection", which is
-/// described in "The Ant and the Grasshopper: Fast and Accurate Pointer
-/// Analysis for Millions of Lines of Code. In Programming Language Design and
-/// Implementation (PLDI), June 2007."
-/// The paper describes performing cycle detection one node at a time, which can
-/// be expensive if there are no cycles, but there are long chains of nodes that
-/// it heuristically believes are cycles (because it will DFS from each node
-/// without state from previous nodes).
-/// Instead, we use the heuristic to build a worklist of nodes to check, then
-/// cycle detect them all at the same time to do this more cheaply.  This
-/// catches cycles slightly later than the original technique did, but does it
-/// make significantly cheaper.
-
-void Andersens::SolveConstraints() {
-  CurrWL = &w1;
-  NextWL = &w2;
-
-  OptimizeConstraints();
-#undef DEBUG_TYPE
-#define DEBUG_TYPE "anders-aa-constraints"
-      DEBUG(PrintConstraints());
-#undef DEBUG_TYPE
-#define DEBUG_TYPE "anders-aa"
-
-  for (unsigned i = 0; i < GraphNodes.size(); ++i) {
-    Node *N = &GraphNodes[i];
-    N->PointsTo = new SparseBitVector<>;
-    N->OldPointsTo = new SparseBitVector<>;
-    N->Edges = new SparseBitVector<>;
-  }
-  CreateConstraintGraph();
-  UnitePointerEquivalences();
-  assert(SCCStack.empty() && "SCC Stack should be empty by now!");
-  Node2DFS.clear();
-  Node2Deleted.clear();
-  Node2DFS.insert(Node2DFS.begin(), GraphNodes.size(), 0);
-  Node2Deleted.insert(Node2Deleted.begin(), GraphNodes.size(), false);
-  DFSNumber = 0;
-  DenseSet<Constraint, ConstraintKeyInfo> Seen;
-  DenseSet<std::pair<unsigned,unsigned>, PairKeyInfo> EdgesChecked;
-
-  // Order graph and add initial nodes to work list.
-  for (unsigned i = 0; i < GraphNodes.size(); ++i) {
-    Node *INode = &GraphNodes[i];
-
-    // Add to work list if it's a representative and can contribute to the
-    // calculation right now.
-    if (INode->isRep() && !INode->PointsTo->empty()
-        && (!INode->Edges->empty() || !INode->Constraints.empty())) {
-      INode->Stamp();
-      CurrWL->insert(INode);
-    }
-  }
-  std::queue<unsigned int> TarjanWL;
-#if !FULL_UNIVERSAL
-  // "Rep and special variables" - in order for HCD to maintain conservative
-  // results when !FULL_UNIVERSAL, we need to treat the special variables in
-  // the same way that the !FULL_UNIVERSAL tweak does throughout the rest of
-  // the analysis - it's ok to add edges from the special nodes, but never
-  // *to* the special nodes.
-  std::vector<unsigned int> RSV;
-#endif
-  while( !CurrWL->empty() ) {
-    DEBUG(dbgs() << "Starting iteration #" << ++NumIters << "\n");
-
-    Node* CurrNode;
-    unsigned CurrNodeIndex;
-
-    // Actual cycle checking code.  We cycle check all of the lazy cycle
-    // candidates from the last iteration in one go.
-    if (!TarjanWL.empty()) {
-      DFSNumber = 0;
-      
-      Tarjan2DFS.clear();
-      Tarjan2Deleted.clear();
-      while (!TarjanWL.empty()) {
-        unsigned int ToTarjan = TarjanWL.front();
-        TarjanWL.pop();
-        if (!Tarjan2Deleted[ToTarjan]
-            && GraphNodes[ToTarjan].isRep()
-            && Tarjan2DFS[ToTarjan] == 0)
-          QueryNode(ToTarjan);
-      }
-    }
-    
-    // Add to work list if it's a representative and can contribute to the
-    // calculation right now.
-    while( (CurrNode = CurrWL->pop()) != NULL ) {
-      CurrNodeIndex = CurrNode - &GraphNodes[0];
-      CurrNode->Stamp();
-      
-          
-      // Figure out the changed points to bits
-      SparseBitVector<> CurrPointsTo;
-      CurrPointsTo.intersectWithComplement(CurrNode->PointsTo,
-                                           CurrNode->OldPointsTo);
-      if (CurrPointsTo.empty())
-        continue;
-
-      *(CurrNode->OldPointsTo) |= CurrPointsTo;
-
-      // Check the offline-computed equivalencies from HCD.
-      bool SCC = false;
-      unsigned Rep;
-
-      if (SDT[CurrNodeIndex] >= 0) {
-        SCC = true;
-        Rep = FindNode(SDT[CurrNodeIndex]);
-
-#if !FULL_UNIVERSAL
-        RSV.clear();
-#endif
-        for (SparseBitVector<>::iterator bi = CurrPointsTo.begin();
-             bi != CurrPointsTo.end(); ++bi) {
-          unsigned Node = FindNode(*bi);
-#if !FULL_UNIVERSAL
-          if (Node < NumberSpecialNodes) {
-            RSV.push_back(Node);
-            continue;
-          }
-#endif
-          Rep = UniteNodes(Rep,Node);
-        }
-#if !FULL_UNIVERSAL
-        RSV.push_back(Rep);
-#endif
-
-        NextWL->insert(&GraphNodes[Rep]);
-
-        if ( ! CurrNode->isRep() )
-          continue;
-      }
-
-      Seen.clear();
-
-      /* Now process the constraints for this node.  */
-      for (std::list<Constraint>::iterator li = CurrNode->Constraints.begin();
-           li != CurrNode->Constraints.end(); ) {
-        li->Src = FindNode(li->Src);
-        li->Dest = FindNode(li->Dest);
-
-        // Delete redundant constraints
-        if( Seen.count(*li) ) {
-          std::list<Constraint>::iterator lk = li; li++;
-
-          CurrNode->Constraints.erase(lk);
-          ++NumErased;
-          continue;
-        }
-        Seen.insert(*li);
-
-        // Src and Dest will be the vars we are going to process.
-        // This may look a bit ugly, but what it does is allow us to process
-        // both store and load constraints with the same code.
-        // Load constraints say that every member of our RHS solution has K
-        // added to it, and that variable gets an edge to LHS. We also union
-        // RHS+K's solution into the LHS solution.
-        // Store constraints say that every member of our LHS solution has K
-        // added to it, and that variable gets an edge from RHS. We also union
-        // RHS's solution into the LHS+K solution.
-        unsigned *Src;
-        unsigned *Dest;
-        unsigned K = li->Offset;
-        unsigned CurrMember;
-        if (li->Type == Constraint::Load) {
-          Src = &CurrMember;
-          Dest = &li->Dest;
-        } else if (li->Type == Constraint::Store) {
-          Src = &li->Src;
-          Dest = &CurrMember;
-        } else {
-          // TODO Handle offseted copy constraint
-          li++;
-          continue;
-        }
-
-        // See if we can use Hybrid Cycle Detection (that is, check
-        // if it was a statically detected offline equivalence that
-        // involves pointers; if so, remove the redundant constraints).
-        if( SCC && K == 0 ) {
-#if FULL_UNIVERSAL
-          CurrMember = Rep;
-
-          if (GraphNodes[*Src].Edges->test_and_set(*Dest))
-            if (GraphNodes[*Dest].PointsTo |= *(GraphNodes[*Src].PointsTo))
-              NextWL->insert(&GraphNodes[*Dest]);
-#else
-          for (unsigned i=0; i < RSV.size(); ++i) {
-            CurrMember = RSV[i];
-
-            if (*Dest < NumberSpecialNodes)
-              continue;
-            if (GraphNodes[*Src].Edges->test_and_set(*Dest))
-              if (GraphNodes[*Dest].PointsTo |= *(GraphNodes[*Src].PointsTo))
-                NextWL->insert(&GraphNodes[*Dest]);
-          }
-#endif
-          // since all future elements of the points-to set will be
-          // equivalent to the current ones, the complex constraints
-          // become redundant.
-          //
-          std::list<Constraint>::iterator lk = li; li++;
-#if !FULL_UNIVERSAL
-          // In this case, we can still erase the constraints when the
-          // elements of the points-to sets are referenced by *Dest,
-          // but not when they are referenced by *Src (i.e. for a Load
-          // constraint). This is because if another special variable is
-          // put into the points-to set later, we still need to add the
-          // new edge from that special variable.
-          if( lk->Type != Constraint::Load)
-#endif
-          GraphNodes[CurrNodeIndex].Constraints.erase(lk);
-        } else {
-          const SparseBitVector<> &Solution = CurrPointsTo;
-
-          for (SparseBitVector<>::iterator bi = Solution.begin();
-               bi != Solution.end();
-               ++bi) {
-            CurrMember = *bi;
-
-            // Need to increment the member by K since that is where we are
-            // supposed to copy to/from.  Note that in positive weight cycles,
-            // which occur in address taking of fields, K can go past
-            // MaxK[CurrMember] elements, even though that is all it could point
-            // to.
-            if (K > 0 && K > MaxK[CurrMember])
-              continue;
-            else
-              CurrMember = FindNode(CurrMember + K);
-
-            // Add an edge to the graph, so we can just do regular
-            // bitmap ior next time.  It may also let us notice a cycle.
-#if !FULL_UNIVERSAL
-            if (*Dest < NumberSpecialNodes)
-              continue;
-#endif
-            if (GraphNodes[*Src].Edges->test_and_set(*Dest))
-              if (GraphNodes[*Dest].PointsTo |= *(GraphNodes[*Src].PointsTo))
-                NextWL->insert(&GraphNodes[*Dest]);
-
-          }
-          li++;
-        }
-      }
-      SparseBitVector<> NewEdges;
-      SparseBitVector<> ToErase;
-
-      // Now all we have left to do is propagate points-to info along the
-      // edges, erasing the redundant edges.
-      for (SparseBitVector<>::iterator bi = CurrNode->Edges->begin();
-           bi != CurrNode->Edges->end();
-           ++bi) {
-
-        unsigned DestVar = *bi;
-        unsigned Rep = FindNode(DestVar);
-
-        // If we ended up with this node as our destination, or we've already
-        // got an edge for the representative, delete the current edge.
-        if (Rep == CurrNodeIndex ||
-            (Rep != DestVar && NewEdges.test(Rep))) {
-            ToErase.set(DestVar);
-            continue;
-        }
-        
-        std::pair<unsigned,unsigned> edge(CurrNodeIndex,Rep);
-        
-        // This is where we do lazy cycle detection.
-        // If this is a cycle candidate (equal points-to sets and this
-        // particular edge has not been cycle-checked previously), add to the
-        // list to check for cycles on the next iteration.
-        if (!EdgesChecked.count(edge) &&
-            *(GraphNodes[Rep].PointsTo) == *(CurrNode->PointsTo)) {
-          EdgesChecked.insert(edge);
-          TarjanWL.push(Rep);
-        }
-        // Union the points-to sets into the dest
-#if !FULL_UNIVERSAL
-        if (Rep >= NumberSpecialNodes)
-#endif
-        if (GraphNodes[Rep].PointsTo |= CurrPointsTo) {
-          NextWL->insert(&GraphNodes[Rep]);
-        }
-        // If this edge's destination was collapsed, rewrite the edge.
-        if (Rep != DestVar) {
-          ToErase.set(DestVar);
-          NewEdges.set(Rep);
-        }
-      }
-      CurrNode->Edges->intersectWithComplement(ToErase);
-      CurrNode->Edges |= NewEdges;
-    }
-
-    // Switch to other work list.
-    WorkList* t = CurrWL; CurrWL = NextWL; NextWL = t;
-  }
-
-
-  Node2DFS.clear();
-  Node2Deleted.clear();
-  for (unsigned i = 0; i < GraphNodes.size(); ++i) {
-    Node *N = &GraphNodes[i];
-    delete N->OldPointsTo;
-    delete N->Edges;
-  }
-  SDTActive = false;
-  SDT.clear();
-}
-
-//===----------------------------------------------------------------------===//
-//                               Union-Find
-//===----------------------------------------------------------------------===//
-
-// Unite nodes First and Second, returning the one which is now the
-// representative node.  First and Second are indexes into GraphNodes
-unsigned Andersens::UniteNodes(unsigned First, unsigned Second,
-                               bool UnionByRank) {
-  assert (First < GraphNodes.size() && Second < GraphNodes.size() &&
-          "Attempting to merge nodes that don't exist");
-
-  Node *FirstNode = &GraphNodes[First];
-  Node *SecondNode = &GraphNodes[Second];
-
-  assert (SecondNode->isRep() && FirstNode->isRep() &&
-          "Trying to unite two non-representative nodes!");
-  if (First == Second)
-    return First;
-
-  if (UnionByRank) {
-    int RankFirst  = (int) FirstNode ->NodeRep;
-    int RankSecond = (int) SecondNode->NodeRep;
-
-    // Rank starts at -1 and gets decremented as it increases.
-    // Translation: higher rank, lower NodeRep value, which is always negative.
-    if (RankFirst > RankSecond) {
-      unsigned t = First; First = Second; Second = t;
-      Node* tp = FirstNode; FirstNode = SecondNode; SecondNode = tp;
-    } else if (RankFirst == RankSecond) {
-      FirstNode->NodeRep = (unsigned) (RankFirst - 1);
-    }
-  }
-
-  SecondNode->NodeRep = First;
-#if !FULL_UNIVERSAL
-  if (First >= NumberSpecialNodes)
-#endif
-  if (FirstNode->PointsTo && SecondNode->PointsTo)
-    FirstNode->PointsTo |= *(SecondNode->PointsTo);
-  if (FirstNode->Edges && SecondNode->Edges)
-    FirstNode->Edges |= *(SecondNode->Edges);
-  if (!SecondNode->Constraints.empty())
-    FirstNode->Constraints.splice(FirstNode->Constraints.begin(),
-                                  SecondNode->Constraints);
-  if (FirstNode->OldPointsTo) {
-    delete FirstNode->OldPointsTo;
-    FirstNode->OldPointsTo = new SparseBitVector<>;
-  }
-
-  // Destroy interesting parts of the merged-from node.
-  delete SecondNode->OldPointsTo;
-  delete SecondNode->Edges;
-  delete SecondNode->PointsTo;
-  SecondNode->Edges = NULL;
-  SecondNode->PointsTo = NULL;
-  SecondNode->OldPointsTo = NULL;
-
-  NumUnified++;
-  DEBUG(dbgs() << "Unified Node ");
-  DEBUG(PrintNode(FirstNode));
-  DEBUG(dbgs() << " and Node ");
-  DEBUG(PrintNode(SecondNode));
-  DEBUG(dbgs() << "\n");
-
-  if (SDTActive)
-    if (SDT[Second] >= 0) {
-      if (SDT[First] < 0)
-        SDT[First] = SDT[Second];
-      else {
-        UniteNodes( FindNode(SDT[First]), FindNode(SDT[Second]) );
-        First = FindNode(First);
-      }
-    }
-
-  return First;
-}
-
-// Find the index into GraphNodes of the node representing Node, performing
-// path compression along the way
-unsigned Andersens::FindNode(unsigned NodeIndex) {
-  assert (NodeIndex < GraphNodes.size()
-          && "Attempting to find a node that can't exist");
-  Node *N = &GraphNodes[NodeIndex];
-  if (N->isRep())
-    return NodeIndex;
-  else
-    return (N->NodeRep = FindNode(N->NodeRep));
-}
-
-// Find the index into GraphNodes of the node representing Node, 
-// don't perform path compression along the way (for Print)
-unsigned Andersens::FindNode(unsigned NodeIndex) const {
-  assert (NodeIndex < GraphNodes.size()
-          && "Attempting to find a node that can't exist");
-  const Node *N = &GraphNodes[NodeIndex];
-  if (N->isRep())
-    return NodeIndex;
-  else
-    return FindNode(N->NodeRep);
-}
-
-//===----------------------------------------------------------------------===//
-//                               Debugging Output
-//===----------------------------------------------------------------------===//
-
-void Andersens::PrintNode(const Node *N) const {
-  if (N == &GraphNodes[UniversalSet]) {
-    dbgs() << "<universal>";
-    return;
-  } else if (N == &GraphNodes[NullPtr]) {
-    dbgs() << "<nullptr>";
-    return;
-  } else if (N == &GraphNodes[NullObject]) {
-    dbgs() << "<null>";
-    return;
-  }
-  if (!N->getValue()) {
-    dbgs() << "artificial" << (intptr_t) N;
-    return;
-  }
-
-  assert(N->getValue() != 0 && "Never set node label!");
-  Value *V = N->getValue();
-  if (Function *F = dyn_cast<Function>(V)) {
-    if (isa<PointerType>(F->getFunctionType()->getReturnType()) &&
-        N == &GraphNodes[getReturnNode(F)]) {
-      dbgs() << F->getName() << ":retval";
-      return;
-    } else if (F->getFunctionType()->isVarArg() &&
-               N == &GraphNodes[getVarargNode(F)]) {
-      dbgs() << F->getName() << ":vararg";
-      return;
-    }
-  }
-
-  if (Instruction *I = dyn_cast<Instruction>(V))
-    dbgs() << I->getParent()->getParent()->getName() << ":";
-  else if (Argument *Arg = dyn_cast<Argument>(V))
-    dbgs() << Arg->getParent()->getName() << ":";
-
-  if (V->hasName())
-    dbgs() << V->getName();
-  else
-    dbgs() << "(unnamed)";
-
-  if (isa<GlobalValue>(V) || isa<AllocaInst>(V) || isMalloc(V))
-    if (N == &GraphNodes[getObject(V)])
-      dbgs() << "<mem>";
-}
-void Andersens::PrintConstraint(const Constraint &C) const {
-  if (C.Type == Constraint::Store) {
-    dbgs() << "*";
-    if (C.Offset != 0)
-      dbgs() << "(";
-  }
-  PrintNode(&GraphNodes[C.Dest]);
-  if (C.Type == Constraint::Store && C.Offset != 0)
-    dbgs() << " + " << C.Offset << ")";
-  dbgs() << " = ";
-  if (C.Type == Constraint::Load) {
-    dbgs() << "*";
-    if (C.Offset != 0)
-      dbgs() << "(";
-  }
-  else if (C.Type == Constraint::AddressOf)
-    dbgs() << "&";
-  PrintNode(&GraphNodes[C.Src]);
-  if (C.Offset != 0 && C.Type != Constraint::Store)
-    dbgs() << " + " << C.Offset;
-  if (C.Type == Constraint::Load && C.Offset != 0)
-    dbgs() << ")";
-  dbgs() << "\n";
-}
-
-void Andersens::PrintConstraints() const {
-  dbgs() << "Constraints:\n";
-
-  for (unsigned i = 0, e = Constraints.size(); i != e; ++i)
-    PrintConstraint(Constraints[i]);
-}
-
-void Andersens::PrintPointsToGraph() const {
-  dbgs() << "Points-to graph:\n";
-  for (unsigned i = 0, e = GraphNodes.size(); i != e; ++i) {
-    const Node *N = &GraphNodes[i];
-    if (FindNode(i) != i) {
-      PrintNode(N);
-      dbgs() << "\t--> same as ";
-      PrintNode(&GraphNodes[FindNode(i)]);
-      dbgs() << "\n";
-    } else {
-      dbgs() << "[" << (N->PointsTo->count()) << "] ";
-      PrintNode(N);
-      dbgs() << "\t--> ";
-
-      bool first = true;
-      for (SparseBitVector<>::iterator bi = N->PointsTo->begin();
-           bi != N->PointsTo->end();
-           ++bi) {
-        if (!first)
-          dbgs() << ", ";
-        PrintNode(&GraphNodes[*bi]);
-        first = false;
-      }
-      dbgs() << "\n";
-    }
-  }
-}
diff --git a/libclamav/c++/llvm/lib/Analysis/IPA/CMakeLists.txt b/libclamav/c++/llvm/lib/Analysis/IPA/CMakeLists.txt
index 1ebb0be..007ad22 100644
--- a/libclamav/c++/llvm/lib/Analysis/IPA/CMakeLists.txt
+++ b/libclamav/c++/llvm/lib/Analysis/IPA/CMakeLists.txt
@@ -1,5 +1,4 @@
 add_llvm_library(LLVMipa
-  Andersens.cpp
   CallGraph.cpp
   CallGraphSCCPass.cpp
   FindUsedTypes.cpp
diff --git a/libclamav/c++/llvm/lib/Analysis/IPA/GlobalsModRef.cpp b/libclamav/c++/llvm/lib/Analysis/IPA/GlobalsModRef.cpp
index ec94bc8..7b43089 100644
--- a/libclamav/c++/llvm/lib/Analysis/IPA/GlobalsModRef.cpp
+++ b/libclamav/c++/llvm/lib/Analysis/IPA/GlobalsModRef.cpp
@@ -213,7 +213,7 @@ void GlobalsModRef::AnalyzeGlobals(Module &M) {
         ++NumNonAddrTakenGlobalVars;
 
         // If this global holds a pointer type, see if it is an indirect global.
-        if (isa<PointerType>(I->getType()->getElementType()) &&
+        if (I->getType()->getElementType()->isPointerTy() &&
             AnalyzeIndirectGlobalMemory(I))
           ++NumIndirectGlobalVars;
       }
@@ -231,7 +231,7 @@ bool GlobalsModRef::AnalyzeUsesOfPointer(Value *V,
                                          std::vector<Function*> &Readers,
                                          std::vector<Function*> &Writers,
                                          GlobalValue *OkayStoreDest) {
-  if (!isa<PointerType>(V->getType())) return true;
+  if (!V->getType()->isPointerTy()) return true;
 
   for (Value::use_iterator UI = V->use_begin(), E = V->use_end(); UI != E; ++UI)
     if (LoadInst *LI = dyn_cast<LoadInst>(*UI)) {
diff --git a/libclamav/c++/llvm/lib/Analysis/IVUsers.cpp b/libclamav/c++/llvm/lib/Analysis/IVUsers.cpp
index 4ce6868..98a436f 100644
--- a/libclamav/c++/llvm/lib/Analysis/IVUsers.cpp
+++ b/libclamav/c++/llvm/lib/Analysis/IVUsers.cpp
@@ -142,8 +142,7 @@ static bool getSCEVStartAndStride(const SCEV *&SH, Loop *L, Loop *UseLoop,
 /// the loop, resulting in reg-reg copies (if we use the pre-inc value when we
 /// should use the post-inc value).
 static bool IVUseShouldUsePostIncValue(Instruction *User, Instruction *IV,
-                                       Loop *L, LoopInfo *LI, DominatorTree *DT,
-                                       Pass *P) {
+                                       Loop *L, DominatorTree *DT) {
   // If the user is in the loop, use the preinc value.
   if (L->contains(User)) return false;
 
@@ -223,7 +222,7 @@ bool IVUsers::AddUsersIfInteresting(Instruction *I) {
     // Descend recursively, but not into PHI nodes outside the current loop.
     // It's important to see the entire expression outside the loop to get
     // choices that depend on addressing mode use right, although we won't
-    // consider references ouside the loop in all cases.
+    // consider references outside the loop in all cases.
     // If User is already in Processed, we don't want to recurse into it again,
     // but do want to record a second reference in the same instruction.
     bool AddUserToIVUsers = false;
@@ -245,7 +244,7 @@ bool IVUsers::AddUsersIfInteresting(Instruction *I) {
       // Okay, we found a user that we cannot reduce.  Analyze the instruction
       // and decide what to do with it.  If we are a use inside of the loop, use
       // the value before incrementation, otherwise use it after incrementation.
-      if (IVUseShouldUsePostIncValue(User, I, L, LI, DT, this)) {
+      if (IVUseShouldUsePostIncValue(User, I, L, DT)) {
         // The value used will be incremented by the stride more than we are
         // expecting, so subtract this off.
         const SCEV *NewStart = SE->getMinusSCEV(Start, Stride);
@@ -331,7 +330,7 @@ void IVUsers::print(raw_ostream &OS, const Module *M) const {
   }
   OS << ":\n";
 
-  // Use a defualt AssemblyAnnotationWriter to suppress the default info
+  // Use a default AssemblyAnnotationWriter to suppress the default info
   // comments, which aren't relevant here.
   AssemblyAnnotationWriter Annotator;
   for (ilist<IVStrideUse>::const_iterator UI = IVUses.begin(),
diff --git a/libclamav/c++/llvm/lib/Analysis/InlineCost.cpp b/libclamav/c++/llvm/lib/Analysis/InlineCost.cpp
index 972d034..ca50a17 100644
--- a/libclamav/c++/llvm/lib/Analysis/InlineCost.cpp
+++ b/libclamav/c++/llvm/lib/Analysis/InlineCost.cpp
@@ -84,7 +84,7 @@ unsigned InlineCostAnalyzer::FunctionInfo::
 //
 unsigned InlineCostAnalyzer::FunctionInfo::
          CountCodeReductionForAlloca(Value *V) {
-  if (!isa<PointerType>(V->getType())) return 0;  // Not a pointer
+  if (!V->getType()->isPointerTy()) return 0;  // Not a pointer
   unsigned Reduction = 0;
   for (Value::use_iterator UI = V->use_begin(), E = V->use_end(); UI != E;++UI){
     Instruction *I = cast<Instruction>(*UI);
@@ -175,7 +175,7 @@ void CodeMetrics::analyzeBasicBlock(const BasicBlock *BB) {
         this->usesDynamicAlloca = true;
     }
 
-    if (isa<ExtractElementInst>(II) || isa<VectorType>(II->getType()))
+    if (isa<ExtractElementInst>(II) || II->getType()->isVectorTy())
       ++NumVectorInsts; 
     
     if (const CastInst *CI = dyn_cast<CastInst>(II)) {
diff --git a/libclamav/c++/llvm/lib/Analysis/InstructionSimplify.cpp b/libclamav/c++/llvm/lib/Analysis/InstructionSimplify.cpp
index b53ac13..8288e96 100644
--- a/libclamav/c++/llvm/lib/Analysis/InstructionSimplify.cpp
+++ b/libclamav/c++/llvm/lib/Analysis/InstructionSimplify.cpp
@@ -194,11 +194,10 @@ Value *llvm::SimplifyICmpInst(unsigned Predicate, Value *LHS, Value *RHS,
   const Type *ITy = GetCompareTy(LHS);
   
   // icmp X, X -> true/false
-  if (LHS == RHS)
+  // X icmp undef -> true/false.  For example, icmp ugt %X, undef -> false
+  // because X could be 0.
+  if (LHS == RHS || isa<UndefValue>(RHS))
     return ConstantInt::get(ITy, CmpInst::isTrueWhenEqual(Pred));
-
-  if (isa<UndefValue>(RHS))                  // X icmp undef -> undef
-    return UndefValue::get(ITy);
   
   // icmp <global/alloca*/null>, <global/alloca*/null> - Global/Stack value
   // addresses never equal each other!  We already know that Op0 != Op1.
@@ -283,6 +282,32 @@ Value *llvm::SimplifyFCmpInst(unsigned Predicate, Value *LHS, Value *RHS,
         // True if unordered.
         return ConstantInt::getTrue(CFP->getContext());
       }
+      // Check whether the constant is an infinity.
+      if (CFP->getValueAPF().isInfinity()) {
+        if (CFP->getValueAPF().isNegative()) {
+          switch (Pred) {
+          case FCmpInst::FCMP_OLT:
+            // No value is ordered and less than negative infinity.
+            return ConstantInt::getFalse(CFP->getContext());
+          case FCmpInst::FCMP_UGE:
+            // All values are unordered with or at least negative infinity.
+            return ConstantInt::getTrue(CFP->getContext());
+          default:
+            break;
+          }
+        } else {
+          switch (Pred) {
+          case FCmpInst::FCMP_OGT:
+            // No value is ordered and greater than infinity.
+            return ConstantInt::getFalse(CFP->getContext());
+          case FCmpInst::FCMP_ULE:
+            // All values are unordered with and at most infinity.
+            return ConstantInt::getTrue(CFP->getContext());
+          default:
+            break;
+          }
+        }
+      }
     }
   }
   
diff --git a/libclamav/c++/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp b/libclamav/c++/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp
index 2d74709..2aa2f17 100644
--- a/libclamav/c++/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp
+++ b/libclamav/c++/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp
@@ -580,7 +580,7 @@ MemoryDependenceAnalysis::getNonLocalCallDependency(CallSite QueryCS) {
 void MemoryDependenceAnalysis::
 getNonLocalPointerDependency(Value *Pointer, bool isLoad, BasicBlock *FromBB,
                              SmallVectorImpl<NonLocalDepResult> &Result) {
-  assert(isa<PointerType>(Pointer->getType()) &&
+  assert(Pointer->getType()->isPointerTy() &&
          "Can't get pointer deps of a non-pointer!");
   Result.clear();
   
@@ -861,7 +861,7 @@ getNonLocalPointerDepFromBB(const PHITransAddr &Pointer, uint64_t PointeeSize,
       // Get the PHI translated pointer in this predecessor.  This can fail if
       // not translatable, in which case the getAddr() returns null.
       PHITransAddr PredPointer(Pointer);
-      PredPointer.PHITranslateValue(BB, Pred);
+      PredPointer.PHITranslateValue(BB, Pred, 0);
 
       Value *PredPtrVal = PredPointer.getAddr();
       
@@ -1009,13 +1009,20 @@ RemoveCachedNonLocalPointerDependencies(ValueIsLoadPair P) {
 /// in more places that cached info does not necessarily keep.
 void MemoryDependenceAnalysis::invalidateCachedPointerInfo(Value *Ptr) {
   // If Ptr isn't really a pointer, just ignore it.
-  if (!isa<PointerType>(Ptr->getType())) return;
+  if (!Ptr->getType()->isPointerTy()) return;
   // Flush store info for the pointer.
   RemoveCachedNonLocalPointerDependencies(ValueIsLoadPair(Ptr, false));
   // Flush load info for the pointer.
   RemoveCachedNonLocalPointerDependencies(ValueIsLoadPair(Ptr, true));
 }
 
+/// invalidateCachedPredecessors - Clear the PredIteratorCache info.
+/// This needs to be done when the CFG changes, e.g., due to splitting
+/// critical edges.
+void MemoryDependenceAnalysis::invalidateCachedPredecessors() {
+  PredCache->clear();
+}
+
 /// removeInstruction - Remove an instruction from the dependence analysis,
 /// updating the dependence of instructions that previously depended on it.
 /// This method attempts to keep the cache coherent using the reverse map.
@@ -1050,7 +1057,7 @@ void MemoryDependenceAnalysis::removeInstruction(Instruction *RemInst) {
   
   // Remove it from both the load info and the store info.  The instruction
   // can't be in either of these maps if it is non-pointer.
-  if (isa<PointerType>(RemInst->getType())) {
+  if (RemInst->getType()->isPointerTy()) {
     RemoveCachedNonLocalPointerDependencies(ValueIsLoadPair(RemInst, false));
     RemoveCachedNonLocalPointerDependencies(ValueIsLoadPair(RemInst, true));
   }
diff --git a/libclamav/c++/llvm/lib/Analysis/PHITransAddr.cpp b/libclamav/c++/llvm/lib/Analysis/PHITransAddr.cpp
index 334a188..8e4fa03 100644
--- a/libclamav/c++/llvm/lib/Analysis/PHITransAddr.cpp
+++ b/libclamav/c++/llvm/lib/Analysis/PHITransAddr.cpp
@@ -134,7 +134,8 @@ static void RemoveInstInputs(Value *V,
 }
 
 Value *PHITransAddr::PHITranslateSubExpr(Value *V, BasicBlock *CurBB,
-                                         BasicBlock *PredBB) {
+                                         BasicBlock *PredBB,
+                                         const DominatorTree *DT) {
   // If this is a non-instruction value, it can't require PHI translation.
   Instruction *Inst = dyn_cast<Instruction>(V);
   if (Inst == 0) return V;
@@ -177,7 +178,7 @@ Value *PHITransAddr::PHITranslateSubExpr(Value *V, BasicBlock *CurBB,
   // operands need to be phi translated, and if so, reconstruct it.
   
   if (BitCastInst *BC = dyn_cast<BitCastInst>(Inst)) {
-    Value *PHIIn = PHITranslateSubExpr(BC->getOperand(0), CurBB, PredBB);
+    Value *PHIIn = PHITranslateSubExpr(BC->getOperand(0), CurBB, PredBB, DT);
     if (PHIIn == 0) return 0;
     if (PHIIn == BC->getOperand(0))
       return BC;
@@ -193,7 +194,8 @@ Value *PHITransAddr::PHITranslateSubExpr(Value *V, BasicBlock *CurBB,
     for (Value::use_iterator UI = PHIIn->use_begin(), E = PHIIn->use_end();
          UI != E; ++UI) {
       if (BitCastInst *BCI = dyn_cast<BitCastInst>(*UI))
-        if (BCI->getType() == BC->getType())
+        if (BCI->getType() == BC->getType() &&
+            (!DT || DT->dominates(BCI->getParent(), PredBB)))
           return BCI;
     }
     return 0;
@@ -204,7 +206,7 @@ Value *PHITransAddr::PHITranslateSubExpr(Value *V, BasicBlock *CurBB,
     SmallVector<Value*, 8> GEPOps;
     bool AnyChanged = false;
     for (unsigned i = 0, e = GEP->getNumOperands(); i != e; ++i) {
-      Value *GEPOp = PHITranslateSubExpr(GEP->getOperand(i), CurBB, PredBB);
+      Value *GEPOp = PHITranslateSubExpr(GEP->getOperand(i), CurBB, PredBB, DT);
       if (GEPOp == 0) return 0;
       
       AnyChanged |= GEPOp != GEP->getOperand(i);
@@ -229,7 +231,8 @@ Value *PHITransAddr::PHITranslateSubExpr(Value *V, BasicBlock *CurBB,
       if (GetElementPtrInst *GEPI = dyn_cast<GetElementPtrInst>(*UI))
         if (GEPI->getType() == GEP->getType() &&
             GEPI->getNumOperands() == GEPOps.size() &&
-            GEPI->getParent()->getParent() == CurBB->getParent()) {
+            GEPI->getParent()->getParent() == CurBB->getParent() &&
+            (!DT || DT->dominates(GEPI->getParent(), PredBB))) {
           bool Mismatch = false;
           for (unsigned i = 0, e = GEPOps.size(); i != e; ++i)
             if (GEPI->getOperand(i) != GEPOps[i]) {
@@ -251,7 +254,7 @@ Value *PHITransAddr::PHITranslateSubExpr(Value *V, BasicBlock *CurBB,
     bool isNSW = cast<BinaryOperator>(Inst)->hasNoSignedWrap();
     bool isNUW = cast<BinaryOperator>(Inst)->hasNoUnsignedWrap();
     
-    Value *LHS = PHITranslateSubExpr(Inst->getOperand(0), CurBB, PredBB);
+    Value *LHS = PHITranslateSubExpr(Inst->getOperand(0), CurBB, PredBB, DT);
     if (LHS == 0) return 0;
     
     // If the PHI translated LHS is an add of a constant, fold the immediates.
@@ -287,7 +290,8 @@ Value *PHITransAddr::PHITranslateSubExpr(Value *V, BasicBlock *CurBB,
       if (BinaryOperator *BO = dyn_cast<BinaryOperator>(*UI))
         if (BO->getOpcode() == Instruction::Add &&
             BO->getOperand(0) == LHS && BO->getOperand(1) == RHS &&
-            BO->getParent()->getParent() == CurBB->getParent())
+            BO->getParent()->getParent() == CurBB->getParent() &&
+            (!DT || DT->dominates(BO->getParent(), PredBB)))
           return BO;
     }
     
@@ -300,33 +304,24 @@ Value *PHITransAddr::PHITranslateSubExpr(Value *V, BasicBlock *CurBB,
 
 
 /// PHITranslateValue - PHI translate the current address up the CFG from
-/// CurBB to Pred, updating our state the reflect any needed changes.  This
-/// returns true on failure and sets Addr to null.
-bool PHITransAddr::PHITranslateValue(BasicBlock *CurBB, BasicBlock *PredBB) {
+/// CurBB to Pred, updating our state to reflect any needed changes.  If the
+/// dominator tree DT is non-null, the translated value must dominate
+/// PredBB.  This returns true on failure and sets Addr to null.
+bool PHITransAddr::PHITranslateValue(BasicBlock *CurBB, BasicBlock *PredBB,
+                                     const DominatorTree *DT) {
   assert(Verify() && "Invalid PHITransAddr!");
-  Addr = PHITranslateSubExpr(Addr, CurBB, PredBB);
+  Addr = PHITranslateSubExpr(Addr, CurBB, PredBB, DT);
   assert(Verify() && "Invalid PHITransAddr!");
-  return Addr == 0;
-}
 
-/// GetAvailablePHITranslatedSubExpr - Return the value computed by
-/// PHITranslateSubExpr if it dominates PredBB, otherwise return null.
-Value *PHITransAddr::
-GetAvailablePHITranslatedSubExpr(Value *V, BasicBlock *CurBB,BasicBlock *PredBB,
-                                 const DominatorTree &DT) const {
-  PHITransAddr Tmp(V, TD);
-  Tmp.PHITranslateValue(CurBB, PredBB);
-  
-  // See if PHI translation succeeds.
-  V = Tmp.getAddr();
-  
-  // Make sure the value is live in the predecessor.
-  if (Instruction *Inst = dyn_cast_or_null<Instruction>(V))
-    if (!DT.dominates(Inst->getParent(), PredBB))
-      return 0;
-  return V;
-}
+  if (DT) {
+    // Make sure the value is live in the predecessor.
+    if (Instruction *Inst = dyn_cast_or_null<Instruction>(Addr))
+      if (!DT->dominates(Inst->getParent(), PredBB))
+        Addr = 0;
+  }
 
+  return Addr == 0;
+}
 
 /// PHITranslateWithInsertion - PHI translate this value into the specified
 /// predecessor block, inserting a computation of the value if it is
@@ -365,8 +360,9 @@ InsertPHITranslatedSubExpr(Value *InVal, BasicBlock *CurBB,
                            SmallVectorImpl<Instruction*> &NewInsts) {
   // See if we have a version of this value already available and dominating
   // PredBB.  If so, there is no need to insert a new instance of it.
-  if (Value *Res = GetAvailablePHITranslatedSubExpr(InVal, CurBB, PredBB, DT))
-    return Res;
+  PHITransAddr Tmp(InVal, TD);
+  if (!Tmp.PHITranslateValue(CurBB, PredBB, &DT))
+    return Tmp.getAddr();
 
   // If we don't have an available version of this value, it must be an
   // instruction.
diff --git a/libclamav/c++/llvm/lib/Analysis/PointerTracking.cpp b/libclamav/c++/llvm/lib/Analysis/PointerTracking.cpp
index 58e90b3..b692246 100644
--- a/libclamav/c++/llvm/lib/Analysis/PointerTracking.cpp
+++ b/libclamav/c++/llvm/lib/Analysis/PointerTracking.cpp
@@ -231,7 +231,7 @@ void PointerTracking::print(raw_ostream &OS, const Module* M) const {
   // this should be safe for the same reason its safe for SCEV.
   PointerTracking &PT = *const_cast<PointerTracking*>(this);
   for (inst_iterator I=inst_begin(*FF), E=inst_end(*FF); I != E; ++I) {
-    if (!isa<PointerType>(I->getType()))
+    if (!I->getType()->isPointerTy())
       continue;
     Value *Base;
     const SCEV *Limit, *Offset;
diff --git a/libclamav/c++/llvm/lib/Analysis/ScalarEvolution.cpp b/libclamav/c++/llvm/lib/Analysis/ScalarEvolution.cpp
index 1ed9d07..b979f33 100644
--- a/libclamav/c++/llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/libclamav/c++/llvm/lib/Analysis/ScalarEvolution.cpp
@@ -214,8 +214,8 @@ bool SCEVCastExpr::properlyDominates(BasicBlock *BB, DominatorTree *DT) const {
 SCEVTruncateExpr::SCEVTruncateExpr(const FoldingSetNodeID &ID,
                                    const SCEV *op, const Type *ty)
   : SCEVCastExpr(ID, scTruncate, op, ty) {
-  assert((Op->getType()->isInteger() || isa<PointerType>(Op->getType())) &&
-         (Ty->isInteger() || isa<PointerType>(Ty)) &&
+  assert((Op->getType()->isIntegerTy() || Op->getType()->isPointerTy()) &&
+         (Ty->isIntegerTy() || Ty->isPointerTy()) &&
          "Cannot truncate non-integer value!");
 }
 
@@ -226,8 +226,8 @@ void SCEVTruncateExpr::print(raw_ostream &OS) const {
 SCEVZeroExtendExpr::SCEVZeroExtendExpr(const FoldingSetNodeID &ID,
                                        const SCEV *op, const Type *ty)
   : SCEVCastExpr(ID, scZeroExtend, op, ty) {
-  assert((Op->getType()->isInteger() || isa<PointerType>(Op->getType())) &&
-         (Ty->isInteger() || isa<PointerType>(Ty)) &&
+  assert((Op->getType()->isIntegerTy() || Op->getType()->isPointerTy()) &&
+         (Ty->isIntegerTy() || Ty->isPointerTy()) &&
          "Cannot zero extend non-integer value!");
 }
 
@@ -238,8 +238,8 @@ void SCEVZeroExtendExpr::print(raw_ostream &OS) const {
 SCEVSignExtendExpr::SCEVSignExtendExpr(const FoldingSetNodeID &ID,
                                        const SCEV *op, const Type *ty)
   : SCEVCastExpr(ID, scSignExtend, op, ty) {
-  assert((Op->getType()->isInteger() || isa<PointerType>(Op->getType())) &&
-         (Ty->isInteger() || isa<PointerType>(Ty)) &&
+  assert((Op->getType()->isIntegerTy() || Op->getType()->isPointerTy()) &&
+         (Ty->isIntegerTy() || Ty->isPointerTy()) &&
          "Cannot sign extend non-integer value!");
 }
 
@@ -394,7 +394,7 @@ bool SCEVUnknown::isAlignOf(const Type *&AllocTy) const {
               if (ConstantInt *CI = dyn_cast<ConstantInt>(CE->getOperand(2)))
                 if (CI->isOne() &&
                     STy->getNumElements() == 2 &&
-                    STy->getElementType(0)->isInteger(1)) {
+                    STy->getElementType(0)->isIntegerTy(1)) {
                   AllocTy = STy->getElementType(1);
                   return true;
                 }
@@ -416,7 +416,7 @@ bool SCEVUnknown::isOffsetOf(const Type *&CTy, Constant *&FieldNo) const {
             cast<PointerType>(CE->getOperand(0)->getType())->getElementType();
           // Ignore vector types here so that ScalarEvolutionExpander doesn't
           // emit getelementptrs that index into vectors.
-          if (isa<StructType>(Ty) || isa<ArrayType>(Ty)) {
+          if (Ty->isStructTy() || Ty->isArrayTy()) {
             CTy = Ty;
             FieldNo = CE->getOperand(2);
             return true;
@@ -518,9 +518,9 @@ namespace {
 
         // Order pointer values after integer values. This helps SCEVExpander
         // form GEPs.
-        if (isa<PointerType>(LU->getType()) && !isa<PointerType>(RU->getType()))
+        if (LU->getType()->isPointerTy() && !RU->getType()->isPointerTy())
           return false;
-        if (isa<PointerType>(RU->getType()) && !isa<PointerType>(LU->getType()))
+        if (RU->getType()->isPointerTy() && !LU->getType()->isPointerTy())
           return true;
 
         // Compare getValueID values.
@@ -616,7 +616,7 @@ namespace {
 /// When this routine is finished, we know that any duplicates in the vector are
 /// consecutive and that complexity is monotonically increasing.
 ///
-/// Note that we go take special precautions to ensure that we get determinstic
+/// Note that we go take special precautions to ensure that we get deterministic
 /// results from this routine.  In other words, we don't want the results of
 /// this to depend on where the addresses of various SCEV objects happened to
 /// land in memory.
@@ -744,7 +744,7 @@ static const SCEV *BinomialCoefficient(const SCEV *It, unsigned K,
   // We need at least W + T bits for the multiplication step
   unsigned CalculationBits = W + T;
 
-  // Calcuate 2^T, at width T+W.
+  // Calculate 2^T, at width T+W.
   APInt DivFactor = APInt(CalculationBits, 1).shl(T);
 
   // Calculate the multiplicative inverse of K! / 2^T;
@@ -921,9 +921,7 @@ const SCEV *ScalarEvolution::getZeroExtendExpr(const SCEV *Op,
         if (MaxBECount == RecastedMaxBECount) {
           const Type *WideTy = IntegerType::get(getContext(), BitWidth * 2);
           // Check whether Start+Step*MaxBECount has no unsigned overflow.
-          const SCEV *ZMul =
-            getMulExpr(CastedMaxBECount,
-                       getTruncateOrZeroExtend(Step, Start->getType()));
+          const SCEV *ZMul = getMulExpr(CastedMaxBECount, Step);
           const SCEV *Add = getAddExpr(Start, ZMul);
           const SCEV *OperandExtendedAdd =
             getAddExpr(getZeroExtendExpr(Start, WideTy),
@@ -937,9 +935,7 @@ const SCEV *ScalarEvolution::getZeroExtendExpr(const SCEV *Op,
 
           // Similar to above, only this time treat the step value as signed.
           // This covers loops that count down.
-          const SCEV *SMul =
-            getMulExpr(CastedMaxBECount,
-                       getTruncateOrSignExtend(Step, Start->getType()));
+          const SCEV *SMul = getMulExpr(CastedMaxBECount, Step);
           Add = getAddExpr(Start, SMul);
           OperandExtendedAdd =
             getAddExpr(getZeroExtendExpr(Start, WideTy),
@@ -1060,9 +1056,7 @@ const SCEV *ScalarEvolution::getSignExtendExpr(const SCEV *Op,
         if (MaxBECount == RecastedMaxBECount) {
           const Type *WideTy = IntegerType::get(getContext(), BitWidth * 2);
           // Check whether Start+Step*MaxBECount has no signed overflow.
-          const SCEV *SMul =
-            getMulExpr(CastedMaxBECount,
-                       getTruncateOrSignExtend(Step, Start->getType()));
+          const SCEV *SMul = getMulExpr(CastedMaxBECount, Step);
           const SCEV *Add = getAddExpr(Start, SMul);
           const SCEV *OperandExtendedAdd =
             getAddExpr(getSignExtendExpr(Start, WideTy),
@@ -1076,9 +1070,7 @@ const SCEV *ScalarEvolution::getSignExtendExpr(const SCEV *Op,
 
           // Similar to above, only this time treat the step value as unsigned.
           // This covers loops that count up with an unsigned step.
-          const SCEV *UMul =
-            getMulExpr(CastedMaxBECount,
-                       getTruncateOrZeroExtend(Step, Start->getType()));
+          const SCEV *UMul = getMulExpr(CastedMaxBECount, Step);
           Add = getAddExpr(Start, UMul);
           OperandExtendedAdd =
             getAddExpr(getSignExtendExpr(Start, WideTy),
@@ -1418,7 +1410,7 @@ const SCEV *ScalarEvolution::getAddExpr(SmallVectorImpl<const SCEV *> &Ops,
 
     // If we deleted at least one add, we added operands to the end of the list,
     // and they are not necessarily sorted.  Recurse to resort and resimplify
-    // any operands we just aquired.
+    // any operands we just acquired.
     if (DeletedAdd)
       return getAddExpr(Ops);
   }
@@ -1725,7 +1717,7 @@ const SCEV *ScalarEvolution::getMulExpr(SmallVectorImpl<const SCEV *> &Ops,
 
     // If we deleted at least one mul, we added operands to the end of the list,
     // and they are not necessarily sorted.  Recurse to resort and resimplify
-    // any operands we just aquired.
+    // any operands we just acquired.
     if (DeletedMul)
       return getMulExpr(Ops);
   }
@@ -1973,6 +1965,12 @@ ScalarEvolution::getAddRecExpr(SmallVectorImpl<const SCEV *> &Operands,
     return getAddRecExpr(Operands, L, HasNUW, HasNSW); // {X,+,0}  -->  X
   }
 
+  // It's tempting to want to call getMaxBackedgeTakenCount count here and
+  // use that information to infer NUW and NSW flags. However, computing a
+  // BE count requires calling getAddRecExpr, so we may not yet have a
+  // meaningful BE count at this point (and if we don't, we'd be stuck
+  // with a SCEVCouldNotCompute as the cached BE count).
+
   // If HasNSW is true and all the operands are non-negative, infer HasNUW.
   if (!HasNUW && HasNSW) {
     bool All = true;
@@ -2308,7 +2306,7 @@ const SCEV *ScalarEvolution::getUnknown(Value *V) {
 /// has access to target-specific information.
 bool ScalarEvolution::isSCEVable(const Type *Ty) const {
   // Integers and pointers are always SCEVable.
-  return Ty->isInteger() || isa<PointerType>(Ty);
+  return Ty->isIntegerTy() || Ty->isPointerTy();
 }
 
 /// getTypeSizeInBits - Return the size in bits of the specified type,
@@ -2321,12 +2319,12 @@ uint64_t ScalarEvolution::getTypeSizeInBits(const Type *Ty) const {
     return TD->getTypeSizeInBits(Ty);
 
   // Integer types have fixed sizes.
-  if (Ty->isInteger())
+  if (Ty->isIntegerTy())
     return Ty->getPrimitiveSizeInBits();
 
   // The only other support type is pointer. Without TargetData, conservatively
   // assume pointers are 64-bit.
-  assert(isa<PointerType>(Ty) && "isSCEVable permitted a non-SCEVable type!");
+  assert(Ty->isPointerTy() && "isSCEVable permitted a non-SCEVable type!");
   return 64;
 }
 
@@ -2337,11 +2335,11 @@ uint64_t ScalarEvolution::getTypeSizeInBits(const Type *Ty) const {
 const Type *ScalarEvolution::getEffectiveSCEVType(const Type *Ty) const {
   assert(isSCEVable(Ty) && "Type is not SCEVable!");
 
-  if (Ty->isInteger())
+  if (Ty->isIntegerTy())
     return Ty;
 
   // The only other support type is pointer.
-  assert(isa<PointerType>(Ty) && "Unexpected non-pointer non-integer type!");
+  assert(Ty->isPointerTy() && "Unexpected non-pointer non-integer type!");
   if (TD) return TD->getIntPtrType(getContext());
 
   // Without TargetData, conservatively assume pointers are 64-bit.
@@ -2412,8 +2410,8 @@ const SCEV *
 ScalarEvolution::getTruncateOrZeroExtend(const SCEV *V,
                                          const Type *Ty) {
   const Type *SrcTy = V->getType();
-  assert((SrcTy->isInteger() || isa<PointerType>(SrcTy)) &&
-         (Ty->isInteger() || isa<PointerType>(Ty)) &&
+  assert((SrcTy->isIntegerTy() || SrcTy->isPointerTy()) &&
+         (Ty->isIntegerTy() || Ty->isPointerTy()) &&
          "Cannot truncate or zero extend with non-integer arguments!");
   if (getTypeSizeInBits(SrcTy) == getTypeSizeInBits(Ty))
     return V;  // No conversion
@@ -2429,8 +2427,8 @@ const SCEV *
 ScalarEvolution::getTruncateOrSignExtend(const SCEV *V,
                                          const Type *Ty) {
   const Type *SrcTy = V->getType();
-  assert((SrcTy->isInteger() || isa<PointerType>(SrcTy)) &&
-         (Ty->isInteger() || isa<PointerType>(Ty)) &&
+  assert((SrcTy->isIntegerTy() || SrcTy->isPointerTy()) &&
+         (Ty->isIntegerTy() || Ty->isPointerTy()) &&
          "Cannot truncate or zero extend with non-integer arguments!");
   if (getTypeSizeInBits(SrcTy) == getTypeSizeInBits(Ty))
     return V;  // No conversion
@@ -2445,8 +2443,8 @@ ScalarEvolution::getTruncateOrSignExtend(const SCEV *V,
 const SCEV *
 ScalarEvolution::getNoopOrZeroExtend(const SCEV *V, const Type *Ty) {
   const Type *SrcTy = V->getType();
-  assert((SrcTy->isInteger() || isa<PointerType>(SrcTy)) &&
-         (Ty->isInteger() || isa<PointerType>(Ty)) &&
+  assert((SrcTy->isIntegerTy() || SrcTy->isPointerTy()) &&
+         (Ty->isIntegerTy() || Ty->isPointerTy()) &&
          "Cannot noop or zero extend with non-integer arguments!");
   assert(getTypeSizeInBits(SrcTy) <= getTypeSizeInBits(Ty) &&
          "getNoopOrZeroExtend cannot truncate!");
@@ -2461,8 +2459,8 @@ ScalarEvolution::getNoopOrZeroExtend(const SCEV *V, const Type *Ty) {
 const SCEV *
 ScalarEvolution::getNoopOrSignExtend(const SCEV *V, const Type *Ty) {
   const Type *SrcTy = V->getType();
-  assert((SrcTy->isInteger() || isa<PointerType>(SrcTy)) &&
-         (Ty->isInteger() || isa<PointerType>(Ty)) &&
+  assert((SrcTy->isIntegerTy() || SrcTy->isPointerTy()) &&
+         (Ty->isIntegerTy() || Ty->isPointerTy()) &&
          "Cannot noop or sign extend with non-integer arguments!");
   assert(getTypeSizeInBits(SrcTy) <= getTypeSizeInBits(Ty) &&
          "getNoopOrSignExtend cannot truncate!");
@@ -2478,8 +2476,8 @@ ScalarEvolution::getNoopOrSignExtend(const SCEV *V, const Type *Ty) {
 const SCEV *
 ScalarEvolution::getNoopOrAnyExtend(const SCEV *V, const Type *Ty) {
   const Type *SrcTy = V->getType();
-  assert((SrcTy->isInteger() || isa<PointerType>(SrcTy)) &&
-         (Ty->isInteger() || isa<PointerType>(Ty)) &&
+  assert((SrcTy->isIntegerTy() || SrcTy->isPointerTy()) &&
+         (Ty->isIntegerTy() || Ty->isPointerTy()) &&
          "Cannot noop or any extend with non-integer arguments!");
   assert(getTypeSizeInBits(SrcTy) <= getTypeSizeInBits(Ty) &&
          "getNoopOrAnyExtend cannot truncate!");
@@ -2493,8 +2491,8 @@ ScalarEvolution::getNoopOrAnyExtend(const SCEV *V, const Type *Ty) {
 const SCEV *
 ScalarEvolution::getTruncateOrNoop(const SCEV *V, const Type *Ty) {
   const Type *SrcTy = V->getType();
-  assert((SrcTy->isInteger() || isa<PointerType>(SrcTy)) &&
-         (Ty->isInteger() || isa<PointerType>(Ty)) &&
+  assert((SrcTy->isIntegerTy() || SrcTy->isPointerTy()) &&
+         (Ty->isIntegerTy() || Ty->isPointerTy()) &&
          "Cannot truncate or noop with non-integer arguments!");
   assert(getTypeSizeInBits(SrcTy) >= getTypeSizeInBits(Ty) &&
          "getTruncateOrNoop cannot extend!");
@@ -2551,12 +2549,12 @@ PushDefUseChildren(Instruction *I,
 /// the Scalars map if they reference SymName. This is used during PHI
 /// resolution.
 void
-ScalarEvolution::ForgetSymbolicName(Instruction *I, const SCEV *SymName) {
+ScalarEvolution::ForgetSymbolicName(Instruction *PN, const SCEV *SymName) {
   SmallVector<Instruction *, 16> Worklist;
-  PushDefUseChildren(I, Worklist);
+  PushDefUseChildren(PN, Worklist);
 
   SmallPtrSet<Instruction *, 8> Visited;
-  Visited.insert(I);
+  Visited.insert(PN);
   while (!Worklist.empty()) {
     Instruction *I = Worklist.pop_back_val();
     if (!Visited.insert(I)) continue;
@@ -2570,12 +2568,15 @@ ScalarEvolution::ForgetSymbolicName(Instruction *I, const SCEV *SymName) {
         continue;
 
       // SCEVUnknown for a PHI either means that it has an unrecognized
-      // structure, or it's a PHI that's in the progress of being computed
-      // by createNodeForPHI.  In the former case, additional loop trip
-      // count information isn't going to change anything. In the later
-      // case, createNodeForPHI will perform the necessary updates on its
-      // own when it gets to that point.
-      if (!isa<PHINode>(I) || !isa<SCEVUnknown>(It->second)) {
+      // structure, it's a PHI that's in the progress of being computed
+      // by createNodeForPHI, or it's a single-value PHI. In the first case,
+      // additional loop trip count information isn't going to change anything.
+      // In the second case, createNodeForPHI will perform the necessary
+      // updates on its own when it gets to that point. In the third, we do
+      // want to forget the SCEVUnknown.
+      if (!isa<PHINode>(I) ||
+          !isa<SCEVUnknown>(It->second) ||
+          (I != PN && It->second == SymName)) {
         ValuesAtScopes.erase(It->second);
         Scalars.erase(It);
       }
@@ -2698,9 +2699,21 @@ const SCEV *ScalarEvolution::createNodeForPHI(PHINode *PN) {
         return SymbolicName;
       }
 
-  // It's tempting to recognize PHIs with a unique incoming value, however
-  // this leads passes like indvars to break LCSSA form. Fortunately, such
-  // PHIs are rare, as instcombine zaps them.
+  // If the PHI has a single incoming value, follow that value, unless the
+  // PHI's incoming blocks are in a different loop, in which case doing so
+  // risks breaking LCSSA form. Instcombine would normally zap these, but
+  // it doesn't have DominatorTree information, so it may miss cases.
+  if (Value *V = PN->hasConstantValue(DT)) {
+    bool AllSameLoop = true;
+    Loop *PNLoop = LI->getLoopFor(PN->getParent());
+    for (size_t i = 0, e = PN->getNumIncomingValues(); i != e; ++i)
+      if (LI->getLoopFor(PN->getIncomingBlock(i)) != PNLoop) {
+        AllSameLoop = false;
+        break;
+      }
+    if (AllSameLoop)
+      return getSCEV(V);
+  }
 
   // If it's not a loop phi, we can't handle it yet.
   return getUnknown(PN);
@@ -2733,7 +2746,7 @@ const SCEV *ScalarEvolution::createNodeForGEP(GEPOperator *GEP) {
     } else {
       // For an array, add the element offset, explicitly scaled.
       const SCEV *LocalOffset = getSCEV(Index);
-      // Getelementptr indicies are signed.
+      // Getelementptr indices are signed.
       LocalOffset = getTruncateOrSignExtend(LocalOffset, IntPtrTy);
       // Lower "inbounds" GEPs to NSW arithmetic.
       LocalOffset = getMulExpr(LocalOffset, getSizeOfExpr(*GTI),
@@ -2936,7 +2949,6 @@ ScalarEvolution::getUnsignedRange(const SCEV *S) {
 
   if (const SCEVUnknown *U = dyn_cast<SCEVUnknown>(S)) {
     // For a SCEVUnknown, ask ValueTracking.
-    unsigned BitWidth = getTypeSizeInBits(U->getType());
     APInt Mask = APInt::getAllOnesValue(BitWidth);
     APInt Zeros(BitWidth, 0), Ones(BitWidth, 0);
     ComputeMaskedBits(U->getValue(), Mask, Zeros, Ones, TD);
@@ -3068,7 +3080,7 @@ ScalarEvolution::getSignedRange(const SCEV *S) {
 
   if (const SCEVUnknown *U = dyn_cast<SCEVUnknown>(S)) {
     // For a SCEVUnknown, ask ValueTracking.
-    if (!U->getValue()->getType()->isInteger() && !TD)
+    if (!U->getValue()->getType()->isIntegerTy() && !TD)
       return ConservativeResult;
     unsigned NS = ComputeNumSignBits(U->getValue(), TD);
     if (NS == 1)
@@ -3208,7 +3220,7 @@ const SCEV *ScalarEvolution::createSCEV(Value *V) {
               const Type *Z0Ty = Z0->getType();
               unsigned Z0TySize = getTypeSizeInBits(Z0Ty);
 
-              // If C is a low-bits mask, the zero extend is zerving to
+              // If C is a low-bits mask, the zero extend is serving to
               // mask off the high bits. Complement the operand and
               // re-apply the zext.
               if (APIntOps::isMask(Z0TySize, CI->getValue()))
@@ -3393,7 +3405,7 @@ PushLoopPHIs(const Loop *L, SmallVectorImpl<Instruction *> &Worklist) {
 const ScalarEvolution::BackedgeTakenInfo &
 ScalarEvolution::getBackedgeTakenInfo(const Loop *L) {
   // Initially insert a CouldNotCompute for this loop. If the insertion
-  // succeeds, procede to actually compute a backedge-taken count and
+  // succeeds, proceed to actually compute a backedge-taken count and
   // update the value. The temporary CouldNotCompute value tells SCEV
   // code elsewhere that it shouldn't attempt to request a new
   // backedge-taken count, which could result in infinite recursion.
@@ -3485,6 +3497,35 @@ void ScalarEvolution::forgetLoop(const Loop *L) {
   }
 }
 
+/// forgetValue - This method should be called by the client when it has
+/// changed a value in a way that may effect its value, or which may
+/// disconnect it from a def-use chain linking it to a loop.
+void ScalarEvolution::forgetValue(Value *V) {
+  Instruction *I = dyn_cast<Instruction>(V);
+  if (!I) return;
+
+  // Drop information about expressions based on loop-header PHIs.
+  SmallVector<Instruction *, 16> Worklist;
+  Worklist.push_back(I);
+
+  SmallPtrSet<Instruction *, 8> Visited;
+  while (!Worklist.empty()) {
+    I = Worklist.pop_back_val();
+    if (!Visited.insert(I)) continue;
+
+    std::map<SCEVCallbackVH, const SCEV *>::iterator It =
+      Scalars.find(static_cast<Value *>(I));
+    if (It != Scalars.end()) {
+      ValuesAtScopes.erase(It->second);
+      Scalars.erase(It);
+      if (PHINode *PN = dyn_cast<PHINode>(I))
+        ConstantEvolutionLoopExitValue.erase(PN);
+    }
+
+    PushDefUseChildren(I, Worklist);
+  }
+}
+
 /// ComputeBackedgeTakenCount - Compute the number of times the backedge
 /// of the specified loop will execute.
 ScalarEvolution::BackedgeTakenInfo
@@ -3581,7 +3622,7 @@ ScalarEvolution::ComputeBackedgeTakenCountFromExit(const Loop *L,
       return getCouldNotCompute();
   }
 
-  // Procede to the next level to examine the exit condition expression.
+  // Proceed to the next level to examine the exit condition expression.
   return ComputeBackedgeTakenCountFromExitCond(L, ExitBr->getCondition(),
                                                ExitBr->getSuccessor(0),
                                                ExitBr->getSuccessor(1));
@@ -3670,10 +3711,23 @@ ScalarEvolution::ComputeBackedgeTakenCountFromExitCond(const Loop *L,
   }
 
   // With an icmp, it may be feasible to compute an exact backedge-taken count.
-  // Procede to the next level to examine the icmp.
+  // Proceed to the next level to examine the icmp.
   if (ICmpInst *ExitCondICmp = dyn_cast<ICmpInst>(ExitCond))
     return ComputeBackedgeTakenCountFromExitCondICmp(L, ExitCondICmp, TBB, FBB);
 
+  // Check for a constant condition. These are normally stripped out by
+  // SimplifyCFG, but ScalarEvolution may be used by a pass which wishes to
+  // preserve the CFG and is temporarily leaving constant conditions
+  // in place.
+  if (ConstantInt *CI = dyn_cast<ConstantInt>(ExitCond)) {
+    if (L->contains(FBB) == !CI->getZExtValue())
+      // The backedge is always taken.
+      return getCouldNotCompute();
+    else
+      // The backedge is never taken.
+      return getIntegerSCEV(0, CI->getType());
+  }
+
   // If it's not an integer or pointer comparison then compute it the hard way.
   return ComputeBackedgeTakenCountExhaustively(L, ExitCond, !L->contains(TBB));
 }
@@ -3697,14 +3751,10 @@ ScalarEvolution::ComputeBackedgeTakenCountFromExitCondICmp(const Loop *L,
   // Handle common loops like: for (X = "string"; *X; ++X)
   if (LoadInst *LI = dyn_cast<LoadInst>(ExitCond->getOperand(0)))
     if (Constant *RHS = dyn_cast<Constant>(ExitCond->getOperand(1))) {
-      const SCEV *ItCnt =
+      BackedgeTakenInfo ItCnt =
         ComputeLoadConstantCompareBackedgeTakenCount(LI, RHS, L, Cond);
-      if (!isa<SCEVCouldNotCompute>(ItCnt)) {
-        unsigned BitWidth = getTypeSizeInBits(ItCnt->getType());
-        return BackedgeTakenInfo(ItCnt,
-                                 isa<SCEVConstant>(ItCnt) ? ItCnt :
-                                   getConstant(APInt::getMaxValue(BitWidth)-1));
-      }
+      if (ItCnt.hasAnyInfo())
+        return ItCnt;
     }
 
   const SCEV *LHS = getSCEV(ExitCond->getOperand(0));
@@ -3738,14 +3788,14 @@ ScalarEvolution::ComputeBackedgeTakenCountFromExitCondICmp(const Loop *L,
   switch (Cond) {
   case ICmpInst::ICMP_NE: {                     // while (X != Y)
     // Convert to: while (X-Y != 0)
-    const SCEV *TC = HowFarToZero(getMinusSCEV(LHS, RHS), L);
-    if (!isa<SCEVCouldNotCompute>(TC)) return TC;
+    BackedgeTakenInfo BTI = HowFarToZero(getMinusSCEV(LHS, RHS), L);
+    if (BTI.hasAnyInfo()) return BTI;
     break;
   }
   case ICmpInst::ICMP_EQ: {                     // while (X == Y)
     // Convert to: while (X-Y == 0)
-    const SCEV *TC = HowFarToNonZero(getMinusSCEV(LHS, RHS), L);
-    if (!isa<SCEVCouldNotCompute>(TC)) return TC;
+    BackedgeTakenInfo BTI = HowFarToNonZero(getMinusSCEV(LHS, RHS), L);
+    if (BTI.hasAnyInfo()) return BTI;
     break;
   }
   case ICmpInst::ICMP_SLT: {
@@ -3832,7 +3882,7 @@ GetAddressedElementFromGlobal(GlobalVariable *GV,
 /// ComputeLoadConstantCompareBackedgeTakenCount - Given an exit condition of
 /// 'icmp op load X, cst', try to see if we can compute the backedge
 /// execution count.
-const SCEV *
+ScalarEvolution::BackedgeTakenInfo
 ScalarEvolution::ComputeLoadConstantCompareBackedgeTakenCount(
                                                 LoadInst *LI,
                                                 Constant *RHS,
@@ -3841,6 +3891,7 @@ ScalarEvolution::ComputeLoadConstantCompareBackedgeTakenCount(
   if (LI->isVolatile()) return getCouldNotCompute();
 
   // Check to see if the loaded pointer is a getelementptr of a global.
+  // TODO: Use SCEV instead of manually grubbing with GEPs.
   GetElementPtrInst *GEP = dyn_cast<GetElementPtrInst>(LI->getOperand(0));
   if (!GEP) return getCouldNotCompute();
 
@@ -4190,14 +4241,15 @@ const SCEV *ScalarEvolution::computeSCEVAtScope(const SCEV *V, const Loop *L) {
           }
         }
 
-        Constant *C;
+        Constant *C = 0;
         if (const CmpInst *CI = dyn_cast<CmpInst>(I))
           C = ConstantFoldCompareInstOperands(CI->getPredicate(),
                                               Operands[0], Operands[1], TD);
         else
           C = ConstantFoldInstOperands(I->getOpcode(), I->getType(),
                                        &Operands[0], Operands.size(), TD);
-        return getSCEV(C);
+        if (C)
+          return getSCEV(C);
       }
     }
 
@@ -4405,7 +4457,8 @@ SolveQuadraticEquation(const SCEVAddRecExpr *AddRec, ScalarEvolution &SE) {
 
 /// HowFarToZero - Return the number of times a backedge comparing the specified
 /// value to zero will execute.  If not computable, return CouldNotCompute.
-const SCEV *ScalarEvolution::HowFarToZero(const SCEV *V, const Loop *L) {
+ScalarEvolution::BackedgeTakenInfo
+ScalarEvolution::HowFarToZero(const SCEV *V, const Loop *L) {
   // If the value is a constant
   if (const SCEVConstant *C = dyn_cast<SCEVConstant>(V)) {
     // If the value is already zero, the branch will execute zero times.
@@ -4450,7 +4503,7 @@ const SCEV *ScalarEvolution::HowFarToZero(const SCEV *V, const Loop *L) {
                                             -StartC->getValue()->getValue(),
                                             *this);
     }
-  } else if (AddRec->isQuadratic() && AddRec->getType()->isInteger()) {
+  } else if (AddRec->isQuadratic() && AddRec->getType()->isIntegerTy()) {
     // If this is a quadratic (3-term) AddRec {L,+,M,+,N}, find the roots of
     // the quadratic equation to solve it.
     std::pair<const SCEV *,const SCEV *> Roots = SolveQuadraticEquation(AddRec,
@@ -4485,7 +4538,8 @@ const SCEV *ScalarEvolution::HowFarToZero(const SCEV *V, const Loop *L) {
 /// HowFarToNonZero - Return the number of times a backedge checking the
 /// specified value for nonzero will execute.  If not computable, return
 /// CouldNotCompute
-const SCEV *ScalarEvolution::HowFarToNonZero(const SCEV *V, const Loop *L) {
+ScalarEvolution::BackedgeTakenInfo
+ScalarEvolution::HowFarToNonZero(const SCEV *V, const Loop *L) {
   // Loops that look like: while (X == 0) are very strange indeed.  We don't
   // handle them yet except for the trivial case.  This could be expanded in the
   // future as needed.
@@ -4726,7 +4780,7 @@ bool ScalarEvolution::isImpliedCond(Value *CondValue,
                                     ICmpInst::Predicate Pred,
                                     const SCEV *LHS, const SCEV *RHS,
                                     bool Inverse) {
-  // Recursivly handle And and Or conditions.
+  // Recursively handle And and Or conditions.
   if (BinaryOperator *BO = dyn_cast<BinaryOperator>(CondValue)) {
     if (BO->getOpcode() == Instruction::And) {
       if (!Inverse)
@@ -4929,7 +4983,7 @@ bool ScalarEvolution::isImpliedCond(Value *CondValue,
 }
 
 /// isImpliedCondOperands - Test whether the condition described by Pred,
-/// LHS, and RHS is true whenever the condition desribed by Pred, FoundLHS,
+/// LHS, and RHS is true whenever the condition described by Pred, FoundLHS,
 /// and FoundRHS is true.
 bool ScalarEvolution::isImpliedCondOperands(ICmpInst::Predicate Pred,
                                             const SCEV *LHS, const SCEV *RHS,
@@ -4944,7 +4998,7 @@ bool ScalarEvolution::isImpliedCondOperands(ICmpInst::Predicate Pred,
 }
 
 /// isImpliedCondOperandsHelper - Test whether the condition described by
-/// Pred, LHS, and RHS is true whenever the condition desribed by Pred,
+/// Pred, LHS, and RHS is true whenever the condition described by Pred,
 /// FoundLHS, and FoundRHS is true.
 bool
 ScalarEvolution::isImpliedCondOperandsHelper(ICmpInst::Predicate Pred,
@@ -5102,7 +5156,7 @@ ScalarEvolution::HowManyLessThans(const SCEV *LHS, const SCEV *RHS,
 
     // If MaxEnd is within a step of the maximum integer value in its type,
     // adjust it down to the minimum value which would produce the same effect.
-    // This allows the subsequent ceiling divison of (N+(step-1))/step to
+    // This allows the subsequent ceiling division of (N+(step-1))/step to
     // compute the correct value.
     const SCEV *StepMinusOne = getMinusSCEV(Step,
                                             getIntegerSCEV(1, Step->getType()));
@@ -5319,8 +5373,8 @@ ScalarEvolution::ScalarEvolution()
 bool ScalarEvolution::runOnFunction(Function &F) {
   this->F = &F;
   LI = &getAnalysis<LoopInfo>();
-  DT = &getAnalysis<DominatorTree>();
   TD = getAnalysisIfAvailable<TargetData>();
+  DT = &getAnalysis<DominatorTree>();
   return false;
 }
 
@@ -5379,7 +5433,7 @@ static void PrintLoopInfo(raw_ostream &OS, ScalarEvolution *SE,
 }
 
 void ScalarEvolution::print(raw_ostream &OS, const Module *) const {
-  // ScalarEvolution's implementaiton of the print method is to print
+  // ScalarEvolution's implementation of the print method is to print
   // out SCEV values of all instructions that are interesting. Doing
   // this potentially causes it to create new SCEV objects though,
   // which technically conflicts with the const qualifier. This isn't
diff --git a/libclamav/c++/llvm/lib/Analysis/ScalarEvolutionAliasAnalysis.cpp b/libclamav/c++/llvm/lib/Analysis/ScalarEvolutionAliasAnalysis.cpp
index 498c4a8..17b254f 100644
--- a/libclamav/c++/llvm/lib/Analysis/ScalarEvolutionAliasAnalysis.cpp
+++ b/libclamav/c++/llvm/lib/Analysis/ScalarEvolutionAliasAnalysis.cpp
@@ -10,6 +10,10 @@
 // This file defines the ScalarEvolutionAliasAnalysis pass, which implements a
 // simple alias analysis implemented in terms of ScalarEvolution queries.
 //
+// This differs from traditional loop dependence analysis in that it tests
+// for dependencies within a single iteration of a loop, rather than
+// dependences between different iterations.
+//
 // ScalarEvolution has a more complete understanding of pointer arithmetic
 // than BasicAliasAnalysis' collection of ad-hoc analyses.
 //
@@ -41,7 +45,7 @@ namespace {
         return (AliasAnalysis*)this;
       return this;
     }
-                                         
+
   private:
     virtual void getAnalysisUsage(AnalysisUsage &AU) const;
     virtual bool runOnFunction(Function &F);
@@ -89,7 +93,7 @@ ScalarEvolutionAliasAnalysis::GetBaseValue(const SCEV *S) {
   } else if (const SCEVAddExpr *A = dyn_cast<SCEVAddExpr>(S)) {
     // If there's a pointer operand, it'll be sorted at the end of the list.
     const SCEV *Last = A->getOperand(A->getNumOperands()-1);
-    if (isa<PointerType>(Last->getType()))
+    if (Last->getType()->isPointerTy())
       return GetBaseValue(Last);
   } else if (const SCEVUnknown *U = dyn_cast<SCEVUnknown>(S)) {
     // This is a leaf node.
diff --git a/libclamav/c++/llvm/lib/Analysis/ScalarEvolutionExpander.cpp b/libclamav/c++/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
index 15384c1..e27da96 100644
--- a/libclamav/c++/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
+++ b/libclamav/c++/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
@@ -15,6 +15,7 @@
 
 #include "llvm/Analysis/ScalarEvolutionExpander.h"
 #include "llvm/Analysis/LoopInfo.h"
+#include "llvm/IntrinsicInst.h"
 #include "llvm/LLVMContext.h"
 #include "llvm/Target/TargetData.h"
 #include "llvm/ADT/STLExtras.h"
@@ -137,6 +138,10 @@ Value *SCEVExpander::InsertBinop(Instruction::BinaryOps Opcode,
   if (IP != BlockBegin) {
     --IP;
     for (; ScanLimit; --IP, --ScanLimit) {
+      // Don't count dbg.value against the ScanLimit, to avoid perturbing the
+      // generated code.
+      if (isa<DbgInfoIntrinsic>(IP))
+        ScanLimit++;
       if (IP->getOpcode() == (unsigned)Opcode && IP->getOperand(0) == LHS &&
           IP->getOperand(1) == RHS)
         return IP;
@@ -144,15 +149,34 @@ Value *SCEVExpander::InsertBinop(Instruction::BinaryOps Opcode,
     }
   }
 
+  // Save the original insertion point so we can restore it when we're done.
+  BasicBlock *SaveInsertBB = Builder.GetInsertBlock();
+  BasicBlock::iterator SaveInsertPt = Builder.GetInsertPoint();
+
+  // Move the insertion point out of as many loops as we can.
+  while (const Loop *L = SE.LI->getLoopFor(Builder.GetInsertBlock())) {
+    if (!L->isLoopInvariant(LHS) || !L->isLoopInvariant(RHS)) break;
+    BasicBlock *Preheader = L->getLoopPreheader();
+    if (!Preheader) break;
+
+    // Ok, move up a level.
+    Builder.SetInsertPoint(Preheader, Preheader->getTerminator());
+  }
+
   // If we haven't found this binop, insert it.
   Value *BO = Builder.CreateBinOp(Opcode, LHS, RHS, "tmp");
   rememberInstruction(BO);
+
+  // Restore the original insert point.
+  if (SaveInsertBB)
+    restoreInsertPoint(SaveInsertBB, SaveInsertPt);
+
   return BO;
 }
 
 /// FactorOutConstant - Test if S is divisible by Factor, using signed
 /// division. If so, update S with Factor divided out and return true.
-/// S need not be evenly divisble if a reasonable remainder can be
+/// S need not be evenly divisible if a reasonable remainder can be
 /// computed.
 /// TODO: When ScalarEvolution gets a SCEVSDivExpr, this can be made
 /// unnecessary; in its place, just signed-divide Ops[i] by the scale and
@@ -462,7 +486,7 @@ Value *SCEVExpander::expandAddToGEP(const SCEV *const *op_begin,
       break;
   }
 
-  // If none of the operands were convertable to proper GEP indices, cast
+  // If none of the operands were convertible to proper GEP indices, cast
   // the base to i8* and do an ugly getelementptr with that. It's still
   // better than ptrtoint+arithmetic+inttoptr at least.
   if (!AnyNonZeroIndices) {
@@ -486,6 +510,10 @@ Value *SCEVExpander::expandAddToGEP(const SCEV *const *op_begin,
     if (IP != BlockBegin) {
       --IP;
       for (; ScanLimit; --IP, --ScanLimit) {
+        // Don't count dbg.value against the ScanLimit, to avoid perturbing the
+        // generated code.
+        if (isa<DbgInfoIntrinsic>(IP))
+          ScanLimit++;
         if (IP->getOpcode() == Instruction::GetElementPtr &&
             IP->getOperand(0) == V && IP->getOperand(1) == Idx)
           return IP;
@@ -493,12 +521,56 @@ Value *SCEVExpander::expandAddToGEP(const SCEV *const *op_begin,
       }
     }
 
+    // Save the original insertion point so we can restore it when we're done.
+    BasicBlock *SaveInsertBB = Builder.GetInsertBlock();
+    BasicBlock::iterator SaveInsertPt = Builder.GetInsertPoint();
+
+    // Move the insertion point out of as many loops as we can.
+    while (const Loop *L = SE.LI->getLoopFor(Builder.GetInsertBlock())) {
+      if (!L->isLoopInvariant(V) || !L->isLoopInvariant(Idx)) break;
+      BasicBlock *Preheader = L->getLoopPreheader();
+      if (!Preheader) break;
+
+      // Ok, move up a level.
+      Builder.SetInsertPoint(Preheader, Preheader->getTerminator());
+    }
+
     // Emit a GEP.
     Value *GEP = Builder.CreateGEP(V, Idx, "uglygep");
     rememberInstruction(GEP);
+
+    // Restore the original insert point.
+    if (SaveInsertBB)
+      restoreInsertPoint(SaveInsertBB, SaveInsertPt);
+
     return GEP;
   }
 
+  // Save the original insertion point so we can restore it when we're done.
+  BasicBlock *SaveInsertBB = Builder.GetInsertBlock();
+  BasicBlock::iterator SaveInsertPt = Builder.GetInsertPoint();
+
+  // Move the insertion point out of as many loops as we can.
+  while (const Loop *L = SE.LI->getLoopFor(Builder.GetInsertBlock())) {
+    if (!L->isLoopInvariant(V)) break;
+
+    bool AnyIndexNotLoopInvariant = false;
+    for (SmallVectorImpl<Value *>::const_iterator I = GepIndices.begin(),
+         E = GepIndices.end(); I != E; ++I)
+      if (!L->isLoopInvariant(*I)) {
+        AnyIndexNotLoopInvariant = true;
+        break;
+      }
+    if (AnyIndexNotLoopInvariant)
+      break;
+
+    BasicBlock *Preheader = L->getLoopPreheader();
+    if (!Preheader) break;
+
+    // Ok, move up a level.
+    Builder.SetInsertPoint(Preheader, Preheader->getTerminator());
+  }
+
   // Insert a pretty getelementptr. Note that this GEP is not marked inbounds,
   // because ScalarEvolution may have changed the address arithmetic to
   // compute a value which is beyond the end of the allocated object.
@@ -511,6 +583,11 @@ Value *SCEVExpander::expandAddToGEP(const SCEV *const *op_begin,
                                  "scevgep");
   Ops.push_back(SE.getUnknown(GEP));
   rememberInstruction(GEP);
+
+  // Restore the original insert point.
+  if (SaveInsertBB)
+    restoreInsertPoint(SaveInsertBB, SaveInsertPt);
+
   return expand(SE.getAddExpr(Ops));
 }
 
@@ -528,70 +605,179 @@ static bool isNonConstantNegative(const SCEV *F) {
   return SC->getValue()->getValue().isNegative();
 }
 
-Value *SCEVExpander::visitAddExpr(const SCEVAddExpr *S) {
-  int NumOperands = S->getNumOperands();
-  const Type *Ty = SE.getEffectiveSCEVType(S->getType());
+/// PickMostRelevantLoop - Given two loops pick the one that's most relevant for
+/// SCEV expansion. If they are nested, this is the most nested. If they are
+/// neighboring, pick the later.
+static const Loop *PickMostRelevantLoop(const Loop *A, const Loop *B,
+                                        DominatorTree &DT) {
+  if (!A) return B;
+  if (!B) return A;
+  if (A->contains(B)) return B;
+  if (B->contains(A)) return A;
+  if (DT.dominates(A->getHeader(), B->getHeader())) return B;
+  if (DT.dominates(B->getHeader(), A->getHeader())) return A;
+  return A; // Arbitrarily break the tie.
+}
 
-  // Find the index of an operand to start with. Choose the operand with
-  // pointer type, if there is one, or the last operand otherwise.
-  int PIdx = 0;
-  for (; PIdx != NumOperands - 1; ++PIdx)
-    if (isa<PointerType>(S->getOperand(PIdx)->getType())) break;
+/// GetRelevantLoop - Get the most relevant loop associated with the given
+/// expression, according to PickMostRelevantLoop.
+static const Loop *GetRelevantLoop(const SCEV *S, LoopInfo &LI,
+                                   DominatorTree &DT) {
+  if (isa<SCEVConstant>(S))
+    return 0;
+  if (const SCEVUnknown *U = dyn_cast<SCEVUnknown>(S)) {
+    if (const Instruction *I = dyn_cast<Instruction>(U->getValue()))
+      return LI.getLoopFor(I->getParent());
+    return 0;
+  }
+  if (const SCEVNAryExpr *N = dyn_cast<SCEVNAryExpr>(S)) {
+    const Loop *L = 0;
+    if (const SCEVAddRecExpr *AR = dyn_cast<SCEVAddRecExpr>(S))
+      L = AR->getLoop();
+    for (SCEVNAryExpr::op_iterator I = N->op_begin(), E = N->op_end();
+         I != E; ++I)
+      L = PickMostRelevantLoop(L, GetRelevantLoop(*I, LI, DT), DT);
+    return L;
+  }
+  if (const SCEVCastExpr *C = dyn_cast<SCEVCastExpr>(S))
+    return GetRelevantLoop(C->getOperand(), LI, DT);
+  if (const SCEVUDivExpr *D = dyn_cast<SCEVUDivExpr>(S))
+    return PickMostRelevantLoop(GetRelevantLoop(D->getLHS(), LI, DT),
+                                GetRelevantLoop(D->getRHS(), LI, DT),
+                                DT);
+  llvm_unreachable("Unexpected SCEV type!");
+}
 
-  // Expand code for the operand that we chose.
-  Value *V = expand(S->getOperand(PIdx));
+/// LoopCompare - Compare loops by PickMostRelevantLoop.
+class LoopCompare {
+  DominatorTree &DT;
+public:
+  explicit LoopCompare(DominatorTree &dt) : DT(dt) {}
+
+  bool operator()(std::pair<const Loop *, const SCEV *> LHS,
+                  std::pair<const Loop *, const SCEV *> RHS) const {
+    // Compare loops with PickMostRelevantLoop.
+    if (LHS.first != RHS.first)
+      return PickMostRelevantLoop(LHS.first, RHS.first, DT) != LHS.first;
+
+    // If one operand is a non-constant negative and the other is not,
+    // put the non-constant negative on the right so that a sub can
+    // be used instead of a negate and add.
+    if (isNonConstantNegative(LHS.second)) {
+      if (!isNonConstantNegative(RHS.second))
+        return false;
+    } else if (isNonConstantNegative(RHS.second))
+      return true;
 
-  // Turn things like ptrtoint+arithmetic+inttoptr into GEP. See the
-  // comments on expandAddToGEP for details.
-  if (const PointerType *PTy = dyn_cast<PointerType>(V->getType())) {
-    // Take the operand at PIdx out of the list.
-    const SmallVectorImpl<const SCEV *> &Ops = S->getOperands();
-    SmallVector<const SCEV *, 8> NewOps;
-    NewOps.insert(NewOps.end(), Ops.begin(), Ops.begin() + PIdx);
-    NewOps.insert(NewOps.end(), Ops.begin() + PIdx + 1, Ops.end());
-    // Make a GEP.
-    return expandAddToGEP(NewOps.begin(), NewOps.end(), PTy, Ty, V);
+    // Otherwise they are equivalent according to this comparison.
+    return false;
   }
+};
 
-  // Otherwise, we'll expand the rest of the SCEVAddExpr as plain integer
-  // arithmetic.
-  V = InsertNoopCastOfTo(V, Ty);
+Value *SCEVExpander::visitAddExpr(const SCEVAddExpr *S) {
+  const Type *Ty = SE.getEffectiveSCEVType(S->getType());
 
-  // Emit a bunch of add instructions
-  for (int i = NumOperands-1; i >= 0; --i) {
-    if (i == PIdx) continue;
-    const SCEV *Op = S->getOperand(i);
-    if (isNonConstantNegative(Op)) {
+  // Collect all the add operands in a loop, along with their associated loops.
+  // Iterate in reverse so that constants are emitted last, all else equal, and
+  // so that pointer operands are inserted first, which the code below relies on
+  // to form more involved GEPs.
+  SmallVector<std::pair<const Loop *, const SCEV *>, 8> OpsAndLoops;
+  for (std::reverse_iterator<SCEVAddExpr::op_iterator> I(S->op_end()),
+       E(S->op_begin()); I != E; ++I)
+    OpsAndLoops.push_back(std::make_pair(GetRelevantLoop(*I, *SE.LI, *SE.DT),
+                                         *I));
+
+  // Sort by loop. Use a stable sort so that constants follow non-constants and
+  // pointer operands precede non-pointer operands.
+  std::stable_sort(OpsAndLoops.begin(), OpsAndLoops.end(), LoopCompare(*SE.DT));
+
+  // Emit instructions to add all the operands. Hoist as much as possible
+  // out of loops, and form meaningful getelementptrs where possible.
+  Value *Sum = 0;
+  for (SmallVectorImpl<std::pair<const Loop *, const SCEV *> >::iterator
+       I = OpsAndLoops.begin(), E = OpsAndLoops.end(); I != E; ) {
+    const Loop *CurLoop = I->first;
+    const SCEV *Op = I->second;
+    if (!Sum) {
+      // This is the first operand. Just expand it.
+      Sum = expand(Op);
+      ++I;
+    } else if (const PointerType *PTy = dyn_cast<PointerType>(Sum->getType())) {
+      // The running sum expression is a pointer. Try to form a getelementptr
+      // at this level with that as the base.
+      SmallVector<const SCEV *, 4> NewOps;
+      for (; I != E && I->first == CurLoop; ++I)
+        NewOps.push_back(I->second);
+      Sum = expandAddToGEP(NewOps.begin(), NewOps.end(), PTy, Ty, Sum);
+    } else if (const PointerType *PTy = dyn_cast<PointerType>(Op->getType())) {
+      // The running sum is an integer, and there's a pointer at this level.
+      // Try to form a getelementptr.
+      SmallVector<const SCEV *, 4> NewOps;
+      NewOps.push_back(SE.getUnknown(Sum));
+      for (++I; I != E && I->first == CurLoop; ++I)
+        NewOps.push_back(I->second);
+      Sum = expandAddToGEP(NewOps.begin(), NewOps.end(), PTy, Ty, expand(Op));
+    } else if (isNonConstantNegative(Op)) {
+      // Instead of doing a negate and add, just do a subtract.
       Value *W = expandCodeFor(SE.getNegativeSCEV(Op), Ty);
-      V = InsertBinop(Instruction::Sub, V, W);
+      Sum = InsertNoopCastOfTo(Sum, Ty);
+      Sum = InsertBinop(Instruction::Sub, Sum, W);
+      ++I;
     } else {
+      // A simple add.
       Value *W = expandCodeFor(Op, Ty);
-      V = InsertBinop(Instruction::Add, V, W);
+      Sum = InsertNoopCastOfTo(Sum, Ty);
+      // Canonicalize a constant to the RHS.
+      if (isa<Constant>(Sum)) std::swap(Sum, W);
+      Sum = InsertBinop(Instruction::Add, Sum, W);
+      ++I;
     }
   }
-  return V;
+
+  return Sum;
 }
 
 Value *SCEVExpander::visitMulExpr(const SCEVMulExpr *S) {
   const Type *Ty = SE.getEffectiveSCEVType(S->getType());
-  int FirstOp = 0;  // Set if we should emit a subtract.
-  if (const SCEVConstant *SC = dyn_cast<SCEVConstant>(S->getOperand(0)))
-    if (SC->getValue()->isAllOnesValue())
-      FirstOp = 1;
-
-  int i = S->getNumOperands()-2;
-  Value *V = expandCodeFor(S->getOperand(i+1), Ty);
-
-  // Emit a bunch of multiply instructions
-  for (; i >= FirstOp; --i) {
-    Value *W = expandCodeFor(S->getOperand(i), Ty);
-    V = InsertBinop(Instruction::Mul, V, W);
+
+  // Collect all the mul operands in a loop, along with their associated loops.
+  // Iterate in reverse so that constants are emitted last, all else equal.
+  SmallVector<std::pair<const Loop *, const SCEV *>, 8> OpsAndLoops;
+  for (std::reverse_iterator<SCEVMulExpr::op_iterator> I(S->op_end()),
+       E(S->op_begin()); I != E; ++I)
+    OpsAndLoops.push_back(std::make_pair(GetRelevantLoop(*I, *SE.LI, *SE.DT),
+                                         *I));
+
+  // Sort by loop. Use a stable sort so that constants follow non-constants.
+  std::stable_sort(OpsAndLoops.begin(), OpsAndLoops.end(), LoopCompare(*SE.DT));
+
+  // Emit instructions to mul all the operands. Hoist as much as possible
+  // out of loops.
+  Value *Prod = 0;
+  for (SmallVectorImpl<std::pair<const Loop *, const SCEV *> >::iterator
+       I = OpsAndLoops.begin(), E = OpsAndLoops.end(); I != E; ) {
+    const SCEV *Op = I->second;
+    if (!Prod) {
+      // This is the first operand. Just expand it.
+      Prod = expand(Op);
+      ++I;
+    } else if (Op->isAllOnesValue()) {
+      // Instead of doing a multiply by negative one, just do a negate.
+      Prod = InsertNoopCastOfTo(Prod, Ty);
+      Prod = InsertBinop(Instruction::Sub, Constant::getNullValue(Ty), Prod);
+      ++I;
+    } else {
+      // A simple mul.
+      Value *W = expandCodeFor(Op, Ty);
+      Prod = InsertNoopCastOfTo(Prod, Ty);
+      // Canonicalize a constant to the RHS.
+      if (isa<Constant>(Prod)) std::swap(Prod, W);
+      Prod = InsertBinop(Instruction::Mul, Prod, W);
+      ++I;
+    }
   }
 
-  // -1 * ...  --->  0 - ...
-  if (FirstOp == 1)
-    V = InsertBinop(Instruction::Sub, Constant::getNullValue(Ty), V);
-  return V;
+  return Prod;
 }
 
 Value *SCEVExpander::visitUDivExpr(const SCEVUDivExpr *S) {
@@ -646,18 +832,59 @@ SCEVExpander::getAddRecExprPHILiterally(const SCEVAddRecExpr *Normalized,
          SE.getEffectiveSCEVType(Normalized->getType())) &&
         SE.getSCEV(PN) == Normalized)
       if (BasicBlock *LatchBlock = L->getLoopLatch()) {
-        // Remember this PHI, even in post-inc mode.
-        InsertedValues.insert(PN);
-        // Remember the increment.
         Instruction *IncV =
-          cast<Instruction>(PN->getIncomingValueForBlock(LatchBlock)
-                                  ->stripPointerCasts());
-        rememberInstruction(IncV);
-        // Make sure the increment is where we want it. But don't move it
-        // down past a potential existing post-inc user.
-        if (L == IVIncInsertLoop && !SE.DT->dominates(IncV, IVIncInsertPos))
-          IncV->moveBefore(IVIncInsertPos);
-        return PN;
+          cast<Instruction>(PN->getIncomingValueForBlock(LatchBlock));
+
+        // Determine if this is a well-behaved chain of instructions leading
+        // back to the PHI. It probably will be, if we're scanning an inner
+        // loop already visited by LSR for example, but it wouldn't have
+        // to be.
+        do {
+          if (IncV->getNumOperands() == 0 || isa<PHINode>(IncV)) {
+            IncV = 0;
+            break;
+          }
+          // If any of the operands don't dominate the insert position, bail.
+          // Addrec operands are always loop-invariant, so this can only happen
+          // if there are instructions which haven't been hoisted.
+          for (User::op_iterator OI = IncV->op_begin()+1,
+               OE = IncV->op_end(); OI != OE; ++OI)
+            if (Instruction *OInst = dyn_cast<Instruction>(OI))
+              if (!SE.DT->dominates(OInst, IVIncInsertPos)) {
+                IncV = 0;
+                break;
+              }
+          if (!IncV)
+            break;
+          // Advance to the next instruction.
+          IncV = dyn_cast<Instruction>(IncV->getOperand(0));
+          if (!IncV)
+            break;
+          if (IncV->mayHaveSideEffects()) {
+            IncV = 0;
+            break;
+          }
+        } while (IncV != PN);
+
+        if (IncV) {
+          // Ok, the add recurrence looks usable.
+          // Remember this PHI, even in post-inc mode.
+          InsertedValues.insert(PN);
+          // Remember the increment.
+          IncV = cast<Instruction>(PN->getIncomingValueForBlock(LatchBlock));
+          rememberInstruction(IncV);
+          if (L == IVIncInsertLoop)
+            do {
+              if (SE.DT->dominates(IncV, IVIncInsertPos))
+                break;
+              // Make sure the increment is where we want it. But don't move it
+              // down past a potential existing post-inc user.
+              IncV->moveBefore(IVIncInsertPos);
+              IVIncInsertPos = IncV;
+              IncV = cast<Instruction>(IncV->getOperand(0));
+            } while (IncV != PN);
+          return PN;
+        }
       }
 
   // Save the original insertion point so we can restore it when we're done.
@@ -674,7 +901,7 @@ SCEVExpander::getAddRecExprPHILiterally(const SCEVAddRecExpr *Normalized,
   // negative, insert a sub instead of an add for the increment (unless it's a
   // constant, because subtracts of constants are canonicalized to adds).
   const SCEV *Step = Normalized->getStepRecurrence(SE);
-  bool isPointer = isa<PointerType>(ExpandTy);
+  bool isPointer = ExpandTy->isPointerTy();
   bool isNegative = !isPointer && isNonConstantNegative(Step);
   if (isNegative)
     Step = SE.getNegativeSCEV(Step);
@@ -779,7 +1006,7 @@ Value *SCEVExpander::expandAddRecExprLiterally(const SCEVAddRecExpr *S) {
   const Type *ExpandTy = PostLoopScale ? IntTy : STy;
   PHINode *PN = getAddRecExprPHILiterally(Normalized, L, ExpandTy, IntTy);
 
-  // Accomodate post-inc mode, if necessary.
+  // Accommodate post-inc mode, if necessary.
   Value *Result;
   if (L != PostIncLoop)
     Result = PN;
@@ -824,7 +1051,7 @@ Value *SCEVExpander::visitAddRecExpr(const SCEVAddRecExpr *S) {
   PHINode *CanonicalIV = 0;
   if (PHINode *PN = L->getCanonicalInductionVariable())
     if (SE.isSCEVable(PN->getType()) &&
-        isa<IntegerType>(SE.getEffectiveSCEVType(PN->getType())) &&
+        SE.getEffectiveSCEVType(PN->getType())->isIntegerTy() &&
         SE.getTypeSizeInBits(PN->getType()) >= SE.getTypeSizeInBits(Ty))
       CanonicalIV = PN;
 
@@ -1040,13 +1267,24 @@ Value *SCEVExpander::expand(const SCEV *S) {
        L = L->getParentLoop())
     if (S->isLoopInvariant(L)) {
       if (!L) break;
-      if (BasicBlock *Preheader = L->getLoopPreheader())
+      if (BasicBlock *Preheader = L->getLoopPreheader()) {
         InsertPt = Preheader->getTerminator();
+        BasicBlock::iterator IP = InsertPt;
+        // Back past any debug info instructions.  Sometimes we inserted
+        // something earlier before debug info but after any real instructions.
+        // This should behave the same as if debug info was not present.
+        while (IP != Preheader->begin()) {
+          --IP;
+          if (!isa<DbgInfoIntrinsic>(IP))
+            break;
+          InsertPt = IP;
+        }
+      }
     } else {
       // If the SCEV is computable at this level, insert it into the header
       // after the PHIs (and after any other instructions that we've inserted
       // there) so that it is guaranteed to dominate any user inside the loop.
-      if (L && S->hasComputableLoopEvolution(L))
+      if (L && S->hasComputableLoopEvolution(L) && L != PostIncLoop)
         InsertPt = L->getHeader()->getFirstNonPHI();
       while (isInsertedInstruction(InsertPt))
         InsertPt = llvm::next(BasicBlock::iterator(InsertPt));
@@ -1090,7 +1328,7 @@ void SCEVExpander::rememberInstruction(Value *I) {
 }
 
 void SCEVExpander::restoreInsertPoint(BasicBlock *BB, BasicBlock::iterator I) {
-  // If we aquired more instructions since the old insert point was saved,
+  // If we acquired more instructions since the old insert point was saved,
   // advance past them.
   while (isInsertedInstruction(I)) ++I;
 
@@ -1104,7 +1342,7 @@ void SCEVExpander::restoreInsertPoint(BasicBlock *BB, BasicBlock::iterator I) {
 Value *
 SCEVExpander::getOrInsertCanonicalInductionVariable(const Loop *L,
                                                     const Type *Ty) {
-  assert(Ty->isInteger() && "Can only insert integer induction variables!");
+  assert(Ty->isIntegerTy() && "Can only insert integer induction variables!");
   const SCEV *H = SE.getAddRecExpr(SE.getIntegerSCEV(0, Ty),
                                    SE.getIntegerSCEV(1, Ty), L);
   BasicBlock *SaveInsertBB = Builder.GetInsertBlock();
diff --git a/libclamav/c++/llvm/lib/Analysis/ValueTracking.cpp b/libclamav/c++/llvm/lib/Analysis/ValueTracking.cpp
index f9331e7..92cbb7c 100644
--- a/libclamav/c++/llvm/lib/Analysis/ValueTracking.cpp
+++ b/libclamav/c++/llvm/lib/Analysis/ValueTracking.cpp
@@ -23,6 +23,7 @@
 #include "llvm/Target/TargetData.h"
 #include "llvm/Support/GetElementPtrTypeIterator.h"
 #include "llvm/Support/MathExtras.h"
+#include "llvm/ADT/SmallPtrSet.h"
 #include <cstring>
 using namespace llvm;
 
@@ -49,11 +50,11 @@ void llvm::ComputeMaskedBits(Value *V, const APInt &Mask,
   assert(V && "No Value?");
   assert(Depth <= MaxDepth && "Limit Search Depth");
   unsigned BitWidth = Mask.getBitWidth();
-  assert((V->getType()->isIntOrIntVector() || isa<PointerType>(V->getType())) &&
-         "Not integer or pointer type!");
+  assert((V->getType()->isIntOrIntVectorTy() || V->getType()->isPointerTy())
+         && "Not integer or pointer type!");
   assert((!TD ||
           TD->getTypeSizeInBits(V->getType()->getScalarType()) == BitWidth) &&
-         (!V->getType()->isIntOrIntVector() ||
+         (!V->getType()->isIntOrIntVectorTy() ||
           V->getType()->getScalarSizeInBits() == BitWidth) &&
          KnownZero.getBitWidth() == BitWidth && 
          KnownOne.getBitWidth() == BitWidth &&
@@ -249,7 +250,7 @@ void llvm::ComputeMaskedBits(Value *V, const APInt &Mask,
     unsigned SrcBitWidth;
     // Note that we handle pointer operands here because of inttoptr/ptrtoint
     // which fall through here.
-    if (isa<PointerType>(SrcTy))
+    if (SrcTy->isPointerTy())
       SrcBitWidth = TD->getTypeSizeInBits(SrcTy);
     else
       SrcBitWidth = SrcTy->getScalarSizeInBits();
@@ -269,10 +270,10 @@ void llvm::ComputeMaskedBits(Value *V, const APInt &Mask,
   }
   case Instruction::BitCast: {
     const Type *SrcTy = I->getOperand(0)->getType();
-    if ((SrcTy->isInteger() || isa<PointerType>(SrcTy)) &&
+    if ((SrcTy->isIntegerTy() || SrcTy->isPointerTy()) &&
         // TODO: For now, not handling conversions like:
         // (bitcast i64 %x to <2 x i32>)
-        !isa<VectorType>(I->getType())) {
+        !I->getType()->isVectorTy()) {
       ComputeMaskedBits(I->getOperand(0), Mask, KnownZero, KnownOne, TD,
                         Depth+1);
       return;
@@ -649,7 +650,7 @@ bool llvm::MaskedValueIsZero(Value *V, const APInt &Mask,
 ///
 unsigned llvm::ComputeNumSignBits(Value *V, const TargetData *TD,
                                   unsigned Depth) {
-  assert((TD || V->getType()->isIntOrIntVector()) &&
+  assert((TD || V->getType()->isIntOrIntVectorTy()) &&
          "ComputeNumSignBits requires a TargetData object to operate "
          "on non-integer values!");
   const Type *Ty = V->getType();
@@ -823,7 +824,7 @@ bool llvm::ComputeMultiple(Value *V, unsigned Base, Value *&Multiple,
 
   assert(V && "No Value?");
   assert(Depth <= MaxDepth && "Limit Search Depth");
-  assert(V->getType()->isInteger() && "Not integer or pointer type!");
+  assert(V->getType()->isIntegerTy() && "Not integer or pointer type!");
 
   const Type *T = V->getType();
 
@@ -980,7 +981,7 @@ bool llvm::CannotBeNegativeZero(const Value *V, unsigned Depth) {
 /// may not be represented in the result.
 static Value *GetLinearExpression(Value *V, APInt &Scale, APInt &Offset,
                                   const TargetData *TD, unsigned Depth) {
-  assert(isa<IntegerType>(V->getType()) && "Not an integer value");
+  assert(V->getType()->isIntegerTy() && "Not an integer value");
 
   // Limit our recursion depth.
   if (Depth == 6) {
@@ -1253,7 +1254,7 @@ Value *llvm::FindInsertedValue(Value *V, const unsigned *idx_begin,
   if (idx_begin == idx_end)
     return V;
   // We have indices, so V should have an indexable type
-  assert((isa<StructType>(V->getType()) || isa<ArrayType>(V->getType()))
+  assert((V->getType()->isStructTy() || V->getType()->isArrayTy())
          && "Not looking at a struct or array?");
   assert(ExtractValueInst::getIndexedType(V->getType(), idx_begin, idx_end)
          && "Invalid indices for type?");
@@ -1372,7 +1373,7 @@ bool llvm::GetConstantStringInfo(Value *V, std::string &Str, uint64_t Offset,
     // Make sure the index-ee is a pointer to array of i8.
     const PointerType *PT = cast<PointerType>(GEP->getOperand(0)->getType());
     const ArrayType *AT = dyn_cast<ArrayType>(PT->getElementType());
-    if (AT == 0 || !AT->getElementType()->isInteger(8))
+    if (AT == 0 || !AT->getElementType()->isIntegerTy(8))
       return false;
     
     // Check to make sure that the first operand of the GEP is an integer and
@@ -1411,7 +1412,7 @@ bool llvm::GetConstantStringInfo(Value *V, std::string &Str, uint64_t Offset,
   
   // Must be a Constant Array
   ConstantArray *Array = dyn_cast<ConstantArray>(GlobalInit);
-  if (Array == 0 || !Array->getType()->getElementType()->isInteger(8))
+  if (Array == 0 || !Array->getType()->getElementType()->isIntegerTy(8))
     return false;
   
   // Get the number of elements in the array
@@ -1436,3 +1437,131 @@ bool llvm::GetConstantStringInfo(Value *V, std::string &Str, uint64_t Offset,
   // The array isn't null terminated, but maybe this is a memcpy, not a strcpy.
   return true;
 }
+
+// These next two are very similar to the above, but also look through PHI
+// nodes.
+// TODO: See if we can integrate these two together.
+
+/// GetStringLengthH - If we can compute the length of the string pointed to by
+/// the specified pointer, return 'len+1'.  If we can't, return 0.
+static uint64_t GetStringLengthH(Value *V, SmallPtrSet<PHINode*, 32> &PHIs) {
+  // Look through noop bitcast instructions.
+  if (BitCastInst *BCI = dyn_cast<BitCastInst>(V))
+    return GetStringLengthH(BCI->getOperand(0), PHIs);
+
+  // If this is a PHI node, there are two cases: either we have already seen it
+  // or we haven't.
+  if (PHINode *PN = dyn_cast<PHINode>(V)) {
+    if (!PHIs.insert(PN))
+      return ~0ULL;  // already in the set.
+
+    // If it was new, see if all the input strings are the same length.
+    uint64_t LenSoFar = ~0ULL;
+    for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i) {
+      uint64_t Len = GetStringLengthH(PN->getIncomingValue(i), PHIs);
+      if (Len == 0) return 0; // Unknown length -> unknown.
+
+      if (Len == ~0ULL) continue;
+
+      if (Len != LenSoFar && LenSoFar != ~0ULL)
+        return 0;    // Disagree -> unknown.
+      LenSoFar = Len;
+    }
+
+    // Success, all agree.
+    return LenSoFar;
+  }
+
+  // strlen(select(c,x,y)) -> strlen(x) ^ strlen(y)
+  if (SelectInst *SI = dyn_cast<SelectInst>(V)) {
+    uint64_t Len1 = GetStringLengthH(SI->getTrueValue(), PHIs);
+    if (Len1 == 0) return 0;
+    uint64_t Len2 = GetStringLengthH(SI->getFalseValue(), PHIs);
+    if (Len2 == 0) return 0;
+    if (Len1 == ~0ULL) return Len2;
+    if (Len2 == ~0ULL) return Len1;
+    if (Len1 != Len2) return 0;
+    return Len1;
+  }
+
+  // If the value is not a GEP instruction nor a constant expression with a
+  // GEP instruction, then return unknown.
+  User *GEP = 0;
+  if (GetElementPtrInst *GEPI = dyn_cast<GetElementPtrInst>(V)) {
+    GEP = GEPI;
+  } else if (ConstantExpr *CE = dyn_cast<ConstantExpr>(V)) {
+    if (CE->getOpcode() != Instruction::GetElementPtr)
+      return 0;
+    GEP = CE;
+  } else {
+    return 0;
+  }
+
+  // Make sure the GEP has exactly three arguments.
+  if (GEP->getNumOperands() != 3)
+    return 0;
+
+  // Check to make sure that the first operand of the GEP is an integer and
+  // has value 0 so that we are sure we're indexing into the initializer.
+  if (ConstantInt *Idx = dyn_cast<ConstantInt>(GEP->getOperand(1))) {
+    if (!Idx->isZero())
+      return 0;
+  } else
+    return 0;
+
+  // If the second index isn't a ConstantInt, then this is a variable index
+  // into the array.  If this occurs, we can't say anything meaningful about
+  // the string.
+  uint64_t StartIdx = 0;
+  if (ConstantInt *CI = dyn_cast<ConstantInt>(GEP->getOperand(2)))
+    StartIdx = CI->getZExtValue();
+  else
+    return 0;
+
+  // The GEP instruction, constant or instruction, must reference a global
+  // variable that is a constant and is initialized. The referenced constant
+  // initializer is the array that we'll use for optimization.
+  GlobalVariable* GV = dyn_cast<GlobalVariable>(GEP->getOperand(0));
+  if (!GV || !GV->isConstant() || !GV->hasInitializer() ||
+      GV->mayBeOverridden())
+    return 0;
+  Constant *GlobalInit = GV->getInitializer();
+
+  // Handle the ConstantAggregateZero case, which is a degenerate case. The
+  // initializer is constant zero so the length of the string must be zero.
+  if (isa<ConstantAggregateZero>(GlobalInit))
+    return 1;  // Len = 0 offset by 1.
+
+  // Must be a Constant Array
+  ConstantArray *Array = dyn_cast<ConstantArray>(GlobalInit);
+  if (!Array || !Array->getType()->getElementType()->isIntegerTy(8))
+    return false;
+
+  // Get the number of elements in the array
+  uint64_t NumElts = Array->getType()->getNumElements();
+
+  // Traverse the constant array from StartIdx (derived above) which is
+  // the place the GEP refers to in the array.
+  for (unsigned i = StartIdx; i != NumElts; ++i) {
+    Constant *Elt = Array->getOperand(i);
+    ConstantInt *CI = dyn_cast<ConstantInt>(Elt);
+    if (!CI) // This array isn't suitable, non-int initializer.
+      return 0;
+    if (CI->isZero())
+      return i-StartIdx+1; // We found end of string, success!
+  }
+
+  return 0; // The array isn't null terminated, conservatively return 'unknown'.
+}
+
+/// GetStringLength - If we can compute the length of the string pointed to by
+/// the specified pointer, return 'len+1'.  If we can't, return 0.
+uint64_t llvm::GetStringLength(Value *V) {
+  if (!V->getType()->isPointerTy()) return 0;
+
+  SmallPtrSet<PHINode*, 32> PHIs;
+  uint64_t Len = GetStringLengthH(V, PHIs);
+  // If Len is ~0ULL, we had an infinite phi cycle: this is dead code, so return
+  // an empty string as a length.
+  return Len == ~0ULL ? 1 : Len;
+}
diff --git a/libclamav/c++/llvm/lib/AsmParser/LLParser.cpp b/libclamav/c++/llvm/lib/AsmParser/LLParser.cpp
index 5cff310..8083a07 100644
--- a/libclamav/c++/llvm/lib/AsmParser/LLParser.cpp
+++ b/libclamav/c++/llvm/lib/AsmParser/LLParser.cpp
@@ -614,7 +614,7 @@ bool LLParser::ParseAlias(const std::string &Name, LocTy NameLoc,
     Aliasee = ID.ConstantVal;
   }
 
-  if (!isa<PointerType>(Aliasee->getType()))
+  if (!Aliasee->getType()->isPointerTy())
     return Error(AliaseeLoc, "alias must have pointer type");
 
   // Okay, create the alias but do not insert it into the module yet.
@@ -685,7 +685,7 @@ bool LLParser::ParseGlobal(const std::string &Name, LocTy NameLoc,
       return true;
   }
 
-  if (isa<FunctionType>(Ty) || Ty->isLabelTy())
+  if (Ty->isFunctionTy() || Ty->isLabelTy())
     return Error(TyLoc, "invalid type for global variable");
 
   GlobalVariable *GV = 0;
@@ -791,7 +791,7 @@ GlobalValue *LLParser::GetGlobalVal(const std::string &Name, const Type *Ty,
   GlobalValue *FwdVal;
   if (const FunctionType *FT = dyn_cast<FunctionType>(PTy->getElementType())) {
     // Function types can return opaque but functions can't.
-    if (isa<OpaqueType>(FT->getReturnType())) {
+    if (FT->getReturnType()->isOpaqueTy()) {
       Error(Loc, "function may not return opaque type");
       return 0;
     }
@@ -836,7 +836,7 @@ GlobalValue *LLParser::GetGlobalVal(unsigned ID, const Type *Ty, LocTy Loc) {
   GlobalValue *FwdVal;
   if (const FunctionType *FT = dyn_cast<FunctionType>(PTy->getElementType())) {
     // Function types can return opaque but functions can't.
-    if (isa<OpaqueType>(FT->getReturnType())) {
+    if (FT->getReturnType()->isOpaqueTy()) {
       Error(Loc, "function may not return opaque type");
       return 0;
     }
@@ -1515,7 +1515,7 @@ bool LLParser::ParseArgumentList(std::vector<ArgInfo> &ArgList,
         Name = "";
       }
 
-      if (!ArgTy->isFirstClassType() && !isa<OpaqueType>(ArgTy))
+      if (!ArgTy->isFirstClassType() && !ArgTy->isOpaqueTy())
         return Error(TypeLoc, "invalid type for function argument");
 
       ArgList.push_back(ArgInfo(TypeLoc, ArgTy, Attrs, Name));
@@ -1785,7 +1785,7 @@ Value *LLParser::PerFunctionState::GetVal(const std::string &Name,
   }
 
   // Don't make placeholders with invalid type.
-  if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty) && !Ty->isLabelTy()) {
+  if (!Ty->isFirstClassType() && !Ty->isOpaqueTy() && !Ty->isLabelTy()) {
     P.Error(Loc, "invalid use of a non-first-class type");
     return 0;
   }
@@ -1826,7 +1826,7 @@ Value *LLParser::PerFunctionState::GetVal(unsigned ID, const Type *Ty,
     return 0;
   }
 
-  if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty) && !Ty->isLabelTy()) {
+  if (!Ty->isFirstClassType() && !Ty->isOpaqueTy() && !Ty->isLabelTy()) {
     P.Error(Loc, "invalid use of a non-first-class type");
     return 0;
   }
@@ -2057,8 +2057,8 @@ bool LLParser::ParseValID(ValID &ID, PerFunctionState *PFS) {
     if (Elts.empty())
       return Error(ID.Loc, "constant vector must not be empty");
 
-    if (!Elts[0]->getType()->isInteger() &&
-        !Elts[0]->getType()->isFloatingPoint())
+    if (!Elts[0]->getType()->isIntegerTy() &&
+        !Elts[0]->getType()->isFloatingPointTy())
       return Error(FirstEltLoc,
                    "vector elements must have integer or floating point type");
 
@@ -2250,13 +2250,13 @@ bool LLParser::ParseValID(ValID &ID, PerFunctionState *PFS) {
     CmpInst::Predicate Pred = (CmpInst::Predicate)PredVal;
 
     if (Opc == Instruction::FCmp) {
-      if (!Val0->getType()->isFPOrFPVector())
+      if (!Val0->getType()->isFPOrFPVectorTy())
         return Error(ID.Loc, "fcmp requires floating point operands");
       ID.ConstantVal = ConstantExpr::getFCmp(Pred, Val0, Val1);
     } else {
       assert(Opc == Instruction::ICmp && "Unexpected opcode for CmpInst!");
-      if (!Val0->getType()->isIntOrIntVector() &&
-          !isa<PointerType>(Val0->getType()))
+      if (!Val0->getType()->isIntOrIntVectorTy() &&
+          !Val0->getType()->isPointerTy())
         return Error(ID.Loc, "icmp requires pointer or integer operands");
       ID.ConstantVal = ConstantExpr::getICmp(Pred, Val0, Val1);
     }
@@ -2306,7 +2306,7 @@ bool LLParser::ParseValID(ValID &ID, PerFunctionState *PFS) {
       return true;
     if (Val0->getType() != Val1->getType())
       return Error(ID.Loc, "operands of constexpr must have same type");
-    if (!Val0->getType()->isIntOrIntVector()) {
+    if (!Val0->getType()->isIntOrIntVectorTy()) {
       if (NUW)
         return Error(ModifierLoc, "nuw only applies to integer operations");
       if (NSW)
@@ -2314,8 +2314,8 @@ bool LLParser::ParseValID(ValID &ID, PerFunctionState *PFS) {
     }
     // API compatibility: Accept either integer or floating-point types with
     // add, sub, and mul.
-    if (!Val0->getType()->isIntOrIntVector() &&
-        !Val0->getType()->isFPOrFPVector())
+    if (!Val0->getType()->isIntOrIntVectorTy() &&
+        !Val0->getType()->isFPOrFPVectorTy())
       return Error(ID.Loc,"constexpr requires integer, fp, or vector operands");
     unsigned Flags = 0;
     if (NUW)   Flags |= OverflowingBinaryOperator::NoUnsignedWrap;
@@ -2345,7 +2345,7 @@ bool LLParser::ParseValID(ValID &ID, PerFunctionState *PFS) {
       return true;
     if (Val0->getType() != Val1->getType())
       return Error(ID.Loc, "operands of constexpr must have same type");
-    if (!Val0->getType()->isIntOrIntVector())
+    if (!Val0->getType()->isIntOrIntVectorTy())
       return Error(ID.Loc,
                    "constexpr requires integer or integer vector operands");
     ID.ConstantVal = ConstantExpr::get(Opc, Val0, Val1);
@@ -2370,7 +2370,7 @@ bool LLParser::ParseValID(ValID &ID, PerFunctionState *PFS) {
       return true;
 
     if (Opc == Instruction::GetElementPtr) {
-      if (Elts.size() == 0 || !isa<PointerType>(Elts[0]->getType()))
+      if (Elts.size() == 0 || !Elts[0]->getType()->isPointerTy())
         return Error(ID.Loc, "getelementptr requires pointer operand");
 
       if (!GetElementPtrInst::getIndexedType(Elts[0]->getType(),
@@ -2470,7 +2470,7 @@ bool LLParser::ParseGlobalValueVector(SmallVectorImpl<Constant*> &Elts) {
 
 bool LLParser::ConvertValIDToValue(const Type *Ty, ValID &ID, Value *&V,
                                    PerFunctionState *PFS) {
-  if (isa<FunctionType>(Ty))
+  if (Ty->isFunctionTy())
     return Error(ID.Loc, "functions are not values, refer to them as pointers");
 
   switch (ID.Kind) {
@@ -2509,13 +2509,13 @@ bool LLParser::ConvertValIDToValue(const Type *Ty, ValID &ID, Value *&V,
     V = GetGlobalVal(ID.UIntVal, Ty, ID.Loc);
     return V == 0;
   case ValID::t_APSInt:
-    if (!isa<IntegerType>(Ty))
+    if (!Ty->isIntegerTy())
       return Error(ID.Loc, "integer constant must have integer type");
     ID.APSIntVal.extOrTrunc(Ty->getPrimitiveSizeInBits());
     V = ConstantInt::get(Context, ID.APSIntVal);
     return false;
   case ValID::t_APFloat:
-    if (!Ty->isFloatingPoint() ||
+    if (!Ty->isFloatingPointTy() ||
         !ConstantFP::isValueValidForType(Ty, ID.APFloatVal))
       return Error(ID.Loc, "floating point constant invalid for type");
 
@@ -2535,19 +2535,19 @@ bool LLParser::ConvertValIDToValue(const Type *Ty, ValID &ID, Value *&V,
 
     return false;
   case ValID::t_Null:
-    if (!isa<PointerType>(Ty))
+    if (!Ty->isPointerTy())
       return Error(ID.Loc, "null must be a pointer type");
     V = ConstantPointerNull::get(cast<PointerType>(Ty));
     return false;
   case ValID::t_Undef:
     // FIXME: LabelTy should not be a first-class type.
     if ((!Ty->isFirstClassType() || Ty->isLabelTy()) &&
-        !isa<OpaqueType>(Ty))
+        !Ty->isOpaqueTy())
       return Error(ID.Loc, "invalid type for undef constant");
     V = UndefValue::get(Ty);
     return false;
   case ValID::t_EmptyArray:
-    if (!isa<ArrayType>(Ty) || cast<ArrayType>(Ty)->getNumElements() != 0)
+    if (!Ty->isArrayTy() || cast<ArrayType>(Ty)->getNumElements() != 0)
       return Error(ID.Loc, "invalid empty array initializer");
     V = UndefValue::get(Ty);
     return false;
@@ -2662,7 +2662,7 @@ bool LLParser::ParseFunctionHeader(Function *&Fn, bool isDefine) {
   }
 
   if (!FunctionType::isValidReturnType(RetType) ||
-      isa<OpaqueType>(RetType))
+      RetType->isOpaqueTy())
     return Error(RetTypeLoc, "invalid function return type");
 
   LocTy NameLoc = Lex.getLoc();
@@ -2963,7 +2963,7 @@ int LLParser::ParseInstruction(Instruction *&Inst, BasicBlock *BB,
     // API compatibility: Accept either integer or floating-point types.
     bool Result = ParseArithmetic(Inst, PFS, KeywordVal, 0);
     if (!Result) {
-      if (!Inst->getType()->isIntOrIntVector()) {
+      if (!Inst->getType()->isIntOrIntVectorTy()) {
         if (NUW)
           return Error(ModifierLoc, "nuw only applies to integer operations");
         if (NSW)
@@ -3186,7 +3186,7 @@ bool LLParser::ParseSwitch(Instruction *&Inst, PerFunctionState &PFS) {
       ParseToken(lltok::lsquare, "expected '[' with switch table"))
     return true;
 
-  if (!isa<IntegerType>(Cond->getType()))
+  if (!Cond->getType()->isIntegerTy())
     return Error(CondLoc, "switch condition must have integer type");
 
   // Parse the jump table pairs.
@@ -3229,7 +3229,7 @@ bool LLParser::ParseIndirectBr(Instruction *&Inst, PerFunctionState &PFS) {
       ParseToken(lltok::lsquare, "expected '[' with indirectbr"))
     return true;
   
-  if (!isa<PointerType>(Address->getType()))
+  if (!Address->getType()->isPointerTy())
     return Error(AddrLoc, "indirectbr address must have pointer type");
   
   // Parse the destination list.
@@ -3382,11 +3382,11 @@ bool LLParser::ParseArithmetic(Instruction *&Inst, PerFunctionState &PFS,
   switch (OperandType) {
   default: llvm_unreachable("Unknown operand type!");
   case 0: // int or FP.
-    Valid = LHS->getType()->isIntOrIntVector() ||
-            LHS->getType()->isFPOrFPVector();
+    Valid = LHS->getType()->isIntOrIntVectorTy() ||
+            LHS->getType()->isFPOrFPVectorTy();
     break;
-  case 1: Valid = LHS->getType()->isIntOrIntVector(); break;
-  case 2: Valid = LHS->getType()->isFPOrFPVector(); break;
+  case 1: Valid = LHS->getType()->isIntOrIntVectorTy(); break;
+  case 2: Valid = LHS->getType()->isFPOrFPVectorTy(); break;
   }
 
   if (!Valid)
@@ -3406,7 +3406,7 @@ bool LLParser::ParseLogical(Instruction *&Inst, PerFunctionState &PFS,
       ParseValue(LHS->getType(), RHS, PFS))
     return true;
 
-  if (!LHS->getType()->isIntOrIntVector())
+  if (!LHS->getType()->isIntOrIntVectorTy())
     return Error(Loc,"instruction requires integer or integer vector operands");
 
   Inst = BinaryOperator::Create((Instruction::BinaryOps)Opc, LHS, RHS);
@@ -3430,13 +3430,13 @@ bool LLParser::ParseCompare(Instruction *&Inst, PerFunctionState &PFS,
     return true;
 
   if (Opc == Instruction::FCmp) {
-    if (!LHS->getType()->isFPOrFPVector())
+    if (!LHS->getType()->isFPOrFPVectorTy())
       return Error(Loc, "fcmp requires floating point operands");
     Inst = new FCmpInst(CmpInst::Predicate(Pred), LHS, RHS);
   } else {
     assert(Opc == Instruction::ICmp && "Unknown opcode for CmpInst!");
-    if (!LHS->getType()->isIntOrIntVector() &&
-        !isa<PointerType>(LHS->getType()))
+    if (!LHS->getType()->isIntOrIntVectorTy() &&
+        !LHS->getType()->isPointerTy())
       return Error(Loc, "icmp requires integer operands");
     Inst = new ICmpInst(CmpInst::Predicate(Pred), LHS, RHS);
   }
@@ -3733,7 +3733,7 @@ int LLParser::ParseAlloc(Instruction *&Inst, PerFunctionState &PFS,
     }
   }
 
-  if (Size && !Size->getType()->isInteger(32))
+  if (Size && !Size->getType()->isIntegerTy(32))
     return Error(SizeLoc, "element count must be i32");
 
   if (isAlloca) {
@@ -3761,7 +3761,7 @@ bool LLParser::ParseFree(Instruction *&Inst, PerFunctionState &PFS,
                          BasicBlock* BB) {
   Value *Val; LocTy Loc;
   if (ParseTypeAndValue(Val, Loc, PFS)) return true;
-  if (!isa<PointerType>(Val->getType()))
+  if (!Val->getType()->isPointerTy())
     return Error(Loc, "operand to free must be a pointer");
   Inst = CallInst::CreateFree(Val, BB);
   return false;
@@ -3778,7 +3778,7 @@ int LLParser::ParseLoad(Instruction *&Inst, PerFunctionState &PFS,
       ParseOptionalCommaAlign(Alignment, AteExtraComma))
     return true;
 
-  if (!isa<PointerType>(Val->getType()) ||
+  if (!Val->getType()->isPointerTy() ||
       !cast<PointerType>(Val->getType())->getElementType()->isFirstClassType())
     return Error(Loc, "load operand must be a pointer to a first class type");
 
@@ -3799,7 +3799,7 @@ int LLParser::ParseStore(Instruction *&Inst, PerFunctionState &PFS,
       ParseOptionalCommaAlign(Alignment, AteExtraComma))
     return true;
 
-  if (!isa<PointerType>(Ptr->getType()))
+  if (!Ptr->getType()->isPointerTy())
     return Error(PtrLoc, "store operand must be a pointer");
   if (!Val->getType()->isFirstClassType())
     return Error(Loc, "store operand must be a first class value");
@@ -3821,7 +3821,7 @@ bool LLParser::ParseGetResult(Instruction *&Inst, PerFunctionState &PFS) {
       ParseUInt32(Element, EltLoc))
     return true;
 
-  if (!isa<StructType>(Val->getType()) && !isa<ArrayType>(Val->getType()))
+  if (!Val->getType()->isStructTy() && !Val->getType()->isArrayTy())
     return Error(ValLoc, "getresult inst requires an aggregate operand");
   if (!ExtractValueInst::getIndexedType(Val->getType(), Element))
     return Error(EltLoc, "invalid getresult index for value");
@@ -3838,7 +3838,7 @@ int LLParser::ParseGetElementPtr(Instruction *&Inst, PerFunctionState &PFS) {
 
   if (ParseTypeAndValue(Ptr, Loc, PFS)) return true;
 
-  if (!isa<PointerType>(Ptr->getType()))
+  if (!Ptr->getType()->isPointerTy())
     return Error(Loc, "base of getelementptr must be a pointer");
 
   SmallVector<Value*, 16> Indices;
@@ -3849,7 +3849,7 @@ int LLParser::ParseGetElementPtr(Instruction *&Inst, PerFunctionState &PFS) {
       break;
     }
     if (ParseTypeAndValue(Val, EltLoc, PFS)) return true;
-    if (!isa<IntegerType>(Val->getType()))
+    if (!Val->getType()->isIntegerTy())
       return Error(EltLoc, "getelementptr index must be an integer");
     Indices.push_back(Val);
   }
diff --git a/libclamav/c++/llvm/lib/Bitcode/Reader/BitReader.cpp b/libclamav/c++/llvm/lib/Bitcode/Reader/BitReader.cpp
index 1facbc3..15844c0 100644
--- a/libclamav/c++/llvm/lib/Bitcode/Reader/BitReader.cpp
+++ b/libclamav/c++/llvm/lib/Bitcode/Reader/BitReader.cpp
@@ -21,17 +21,8 @@ using namespace llvm;
    Optionally returns a human-readable error message via OutMessage. */
 LLVMBool LLVMParseBitcode(LLVMMemoryBufferRef MemBuf,
                           LLVMModuleRef *OutModule, char **OutMessage) {
-  std::string Message;
-  
-  *OutModule = wrap(ParseBitcodeFile(unwrap(MemBuf), getGlobalContext(),  
-                                     &Message));
-  if (!*OutModule) {
-    if (OutMessage)
-      *OutMessage = strdup(Message.c_str());
-    return 1;
-  }
-  
-  return 0;
+  return LLVMParseBitcodeInContext(wrap(&getGlobalContext()), MemBuf, OutModule,
+                                   OutMessage);
 }
 
 LLVMBool LLVMParseBitcodeInContext(LLVMContextRef ContextRef,
@@ -54,36 +45,44 @@ LLVMBool LLVMParseBitcodeInContext(LLVMContextRef ContextRef,
 /* Reads a module from the specified path, returning via the OutModule parameter
    a module provider which performs lazy deserialization. Returns 0 on success.
    Optionally returns a human-readable error message via OutMessage. */ 
-LLVMBool LLVMGetBitcodeModuleProvider(LLVMMemoryBufferRef MemBuf,
-                                      LLVMModuleProviderRef *OutMP,
-                                      char **OutMessage) {
+LLVMBool LLVMGetBitcodeModuleInContext(LLVMContextRef ContextRef,
+                                       LLVMMemoryBufferRef MemBuf,
+                                       LLVMModuleRef *OutM,
+                                       char **OutMessage) {
   std::string Message;
-
-  *OutMP = reinterpret_cast<LLVMModuleProviderRef>(
-    getLazyBitcodeModule(unwrap(MemBuf), getGlobalContext(), &Message));
-                                         
-  if (!*OutMP) {
+  
+  *OutM = wrap(getLazyBitcodeModule(unwrap(MemBuf), *unwrap(ContextRef),
+                                    &Message));
+  if (!*OutM) {
     if (OutMessage)
       *OutMessage = strdup(Message.c_str());
-      return 1;
+    return 1;
   }
-
+  
   return 0;
+
 }
 
+LLVMBool LLVMGetBitcodeModule(LLVMMemoryBufferRef MemBuf, LLVMModuleRef *OutM,
+                              char **OutMessage) {
+  return LLVMGetBitcodeModuleInContext(LLVMGetGlobalContext(), MemBuf, OutM,
+                                       OutMessage);
+}
+
+/* Deprecated: Use LLVMGetBitcodeModuleInContext instead. */
 LLVMBool LLVMGetBitcodeModuleProviderInContext(LLVMContextRef ContextRef,
                                                LLVMMemoryBufferRef MemBuf,
                                                LLVMModuleProviderRef *OutMP,
                                                char **OutMessage) {
-  std::string Message;
-  
-  *OutMP = reinterpret_cast<LLVMModuleProviderRef>(
-    getLazyBitcodeModule(unwrap(MemBuf), *unwrap(ContextRef), &Message));
-  if (!*OutMP) {
-    if (OutMessage)
-      *OutMessage = strdup(Message.c_str());
-    return 1;
-  }
-  
-  return 0;
+  return LLVMGetBitcodeModuleInContext(ContextRef, MemBuf,
+                                       reinterpret_cast<LLVMModuleRef*>(OutMP),
+                                       OutMessage);
+}
+
+/* Deprecated: Use LLVMGetBitcodeModule instead. */
+LLVMBool LLVMGetBitcodeModuleProvider(LLVMMemoryBufferRef MemBuf,
+                                      LLVMModuleProviderRef *OutMP,
+                                      char **OutMessage) {
+  return LLVMGetBitcodeModuleProviderInContext(LLVMGetGlobalContext(), MemBuf,
+                                               OutMP, OutMessage);
 }
diff --git a/libclamav/c++/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/libclamav/c++/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index a0402ca..a328837 100644
--- a/libclamav/c++/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/libclamav/c++/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -108,17 +108,17 @@ static int GetDecodedBinaryOpcode(unsigned Val, const Type *Ty) {
   switch (Val) {
   default: return -1;
   case bitc::BINOP_ADD:
-    return Ty->isFPOrFPVector() ? Instruction::FAdd : Instruction::Add;
+    return Ty->isFPOrFPVectorTy() ? Instruction::FAdd : Instruction::Add;
   case bitc::BINOP_SUB:
-    return Ty->isFPOrFPVector() ? Instruction::FSub : Instruction::Sub;
+    return Ty->isFPOrFPVectorTy() ? Instruction::FSub : Instruction::Sub;
   case bitc::BINOP_MUL:
-    return Ty->isFPOrFPVector() ? Instruction::FMul : Instruction::Mul;
+    return Ty->isFPOrFPVectorTy() ? Instruction::FMul : Instruction::Mul;
   case bitc::BINOP_UDIV: return Instruction::UDiv;
   case bitc::BINOP_SDIV:
-    return Ty->isFPOrFPVector() ? Instruction::FDiv : Instruction::SDiv;
+    return Ty->isFPOrFPVectorTy() ? Instruction::FDiv : Instruction::SDiv;
   case bitc::BINOP_UREM: return Instruction::URem;
   case bitc::BINOP_SREM:
-    return Ty->isFPOrFPVector() ? Instruction::FRem : Instruction::SRem;
+    return Ty->isFPOrFPVectorTy() ? Instruction::FRem : Instruction::SRem;
   case bitc::BINOP_SHL:  return Instruction::Shl;
   case bitc::BINOP_LSHR: return Instruction::LShr;
   case bitc::BINOP_ASHR: return Instruction::AShr;
@@ -963,12 +963,12 @@ bool BitcodeReader::ParseConstants() {
       V = Constant::getNullValue(CurTy);
       break;
     case bitc::CST_CODE_INTEGER:   // INTEGER: [intval]
-      if (!isa<IntegerType>(CurTy) || Record.empty())
+      if (!CurTy->isIntegerTy() || Record.empty())
         return Error("Invalid CST_INTEGER record");
       V = ConstantInt::get(CurTy, DecodeSignRotatedValue(Record[0]));
       break;
     case bitc::CST_CODE_WIDE_INTEGER: {// WIDE_INTEGER: [n x intval]
-      if (!isa<IntegerType>(CurTy) || Record.empty())
+      if (!CurTy->isIntegerTy() || Record.empty())
         return Error("Invalid WIDE_INTEGER record");
 
       unsigned NumWords = Record.size();
@@ -1175,7 +1175,7 @@ bool BitcodeReader::ParseConstants() {
       Constant *Op0 = ValueList.getConstantFwdRef(Record[1], OpTy);
       Constant *Op1 = ValueList.getConstantFwdRef(Record[2], OpTy);
 
-      if (OpTy->isFPOrFPVector())
+      if (OpTy->isFPOrFPVectorTy())
         V = ConstantExpr::getFCmp(Record[3], Op0, Op1);
       else
         V = ConstantExpr::getICmp(Record[3], Op0, Op1);
@@ -1407,7 +1407,7 @@ bool BitcodeReader::ParseModule() {
       if (Record.size() < 6)
         return Error("Invalid MODULE_CODE_GLOBALVAR record");
       const Type *Ty = getTypeByID(Record[0]);
-      if (!isa<PointerType>(Ty))
+      if (!Ty->isPointerTy())
         return Error("Global not a pointer type!");
       unsigned AddressSpace = cast<PointerType>(Ty)->getAddressSpace();
       Ty = cast<PointerType>(Ty)->getElementType();
@@ -1450,7 +1450,7 @@ bool BitcodeReader::ParseModule() {
       if (Record.size() < 8)
         return Error("Invalid MODULE_CODE_FUNCTION record");
       const Type *Ty = getTypeByID(Record[0]);
-      if (!isa<PointerType>(Ty))
+      if (!Ty->isPointerTy())
         return Error("Function not a pointer type!");
       const FunctionType *FTy =
         dyn_cast<FunctionType>(cast<PointerType>(Ty)->getElementType());
@@ -1491,7 +1491,7 @@ bool BitcodeReader::ParseModule() {
       if (Record.size() < 3)
         return Error("Invalid MODULE_ALIAS record");
       const Type *Ty = getTypeByID(Record[0]);
-      if (!isa<PointerType>(Ty))
+      if (!Ty->isPointerTy())
         return Error("Function not a pointer type!");
 
       GlobalAlias *NewGA = new GlobalAlias(Ty, GetDecodedLinkage(Record[2]),
@@ -1622,6 +1622,7 @@ bool BitcodeReader::ParseFunctionBody(Function *F) {
   if (Stream.EnterSubBlock(bitc::FUNCTION_BLOCK_ID))
     return Error("Malformed block record");
 
+  InstructionList.clear();
   unsigned ModuleValueListSize = ValueList.size();
 
   // Add all the function arguments to the value table.
@@ -1892,7 +1893,7 @@ bool BitcodeReader::ParseFunctionBody(Function *F) {
           OpNum+1 != Record.size())
         return Error("Invalid CMP record");
 
-      if (LHS->getType()->isFPOrFPVector())
+      if (LHS->getType()->isFPOrFPVectorTy())
         I = new FCmpInst((FCmpInst::Predicate)Record[OpNum], LHS, RHS);
       else
         I = new ICmpInst((ICmpInst::Predicate)Record[OpNum], LHS, RHS);
@@ -1932,7 +1933,7 @@ bool BitcodeReader::ParseFunctionBody(Function *F) {
 
         const Type *ReturnType = F->getReturnType();
         if (Vs.size() > 1 ||
-            (isa<StructType>(ReturnType) &&
+            (ReturnType->isStructTy() &&
              (Vs.empty() || Vs[0]->getType() != ReturnType))) {
           Value *RV = UndefValue::get(ReturnType);
           for (unsigned i = 0, e = Vs.size(); i != e; ++i) {
diff --git a/libclamav/c++/llvm/lib/Bitcode/Writer/BitWriter.cpp b/libclamav/c++/llvm/lib/Bitcode/Writer/BitWriter.cpp
index 7ed651b..4288422 100644
--- a/libclamav/c++/llvm/lib/Bitcode/Writer/BitWriter.cpp
+++ b/libclamav/c++/llvm/lib/Bitcode/Writer/BitWriter.cpp
@@ -27,20 +27,14 @@ int LLVMWriteBitcodeToFile(LLVMModuleRef M, const char *Path) {
   return 0;
 }
 
-#if defined(__GNUC__) && (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR >= 4)
-#include <ext/stdio_filebuf.h>
-
-int LLVMWriteBitcodeToFileHandle(LLVMModuleRef M, int FileHandle) {
-  raw_fd_ostream OS(FileHandle, false);
+int LLVMWriteBitcodeToFD(LLVMModuleRef M, int FD, int ShouldClose,
+                         int Unbuffered) {
+  raw_fd_ostream OS(FD, ShouldClose, Unbuffered);
   
   WriteBitcodeToFile(unwrap(M), OS);
   return 0;
 }
 
-#else
-
 int LLVMWriteBitcodeToFileHandle(LLVMModuleRef M, int FileHandle) {
-  return -1; // Not supported.
+  return LLVMWriteBitcodeToFD(M, FileHandle, true, false);
 }
-
-#endif
diff --git a/libclamav/c++/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp b/libclamav/c++/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
index 595497f..aa4c3af 100644
--- a/libclamav/c++/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
+++ b/libclamav/c++/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
@@ -27,7 +27,7 @@ static bool isSingleValueType(const std::pair<const llvm::Type*,
 }
 
 static bool isIntegerValue(const std::pair<const Value*, unsigned> &V) {
-  return isa<IntegerType>(V.first->getType());
+  return V.first->getType()->isIntegerTy();
 }
 
 static bool CompareByFrequency(const std::pair<const llvm::Type*,
@@ -39,8 +39,6 @@ static bool CompareByFrequency(const std::pair<const llvm::Type*,
 
 /// ValueEnumerator - Enumerate module-level information.
 ValueEnumerator::ValueEnumerator(const Module *M) {
-  InstructionCount = 0;
-
   // Enumerate the global variables.
   for (Module::const_global_iterator I = M->global_begin(),
          E = M->global_end(); I != E; ++I)
@@ -377,6 +375,7 @@ void ValueEnumerator::EnumerateAttributes(const AttrListPtr &PAL) {
 
 
 void ValueEnumerator::incorporateFunction(const Function &F) {
+  InstructionCount = 0;
   NumModuleValues = Values.size();
 
   // Adding function arguments to the value table.
diff --git a/libclamav/c++/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/libclamav/c++/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index fc08384..bd2b1b6 100644
--- a/libclamav/c++/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/libclamav/c++/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -917,11 +917,10 @@ void AsmPrinter::EmitAlignment(unsigned NumBits, const GlobalValue *GV,
   
   if (NumBits == 0) return;   // No need to emit alignment.
   
-  unsigned FillValue = 0;
   if (getCurrentSection()->getKind().isText())
-    FillValue = MAI->getTextAlignFillValue();
-  
-  OutStreamer.EmitValueToAlignment(1 << NumBits, FillValue, 1, 0);
+    OutStreamer.EmitCodeAlignment(1 << NumBits);
+  else
+    OutStreamer.EmitValueToAlignment(1 << NumBits, 0, 1, 0);
 }
 
 /// LowerConstant - Lower the specified LLVM Constant to an MCExpr.
@@ -1717,7 +1716,7 @@ void AsmPrinter::EmitBasicBlockStart(const MachineBasicBlock *MBB) const {
   }
 
   // Print the main label for the block.
-  if (MBB->pred_empty() || MBB->isOnlyReachableByFallthrough()) {
+  if (MBB->pred_empty() || isBlockOnlyReachableByFallthrough(MBB)) {
     if (VerboseAsm) {
       // NOTE: Want this comment at start of line.
       O << MAI->getCommentString() << " BB#" << MBB->getNumber() << ':';
@@ -1764,6 +1763,39 @@ void AsmPrinter::printOffset(int64_t Offset) const {
     O << Offset;
 }
 
+/// isBlockOnlyReachableByFallthough - Return true if the basic block has
+/// exactly one predecessor and the control transfer mechanism between
+/// the predecessor and this block is a fall-through.
+bool AsmPrinter::isBlockOnlyReachableByFallthrough(const MachineBasicBlock *MBB) 
+    const {
+  // If this is a landing pad, it isn't a fall through.  If it has no preds,
+  // then nothing falls through to it.
+  if (MBB->isLandingPad() || MBB->pred_empty())
+    return false;
+  
+  // If there isn't exactly one predecessor, it can't be a fall through.
+  MachineBasicBlock::const_pred_iterator PI = MBB->pred_begin(), PI2 = PI;
+  ++PI2;
+  if (PI2 != MBB->pred_end())
+    return false;
+  
+  // The predecessor has to be immediately before this block.
+  const MachineBasicBlock *Pred = *PI;
+  
+  if (!Pred->isLayoutSuccessor(MBB))
+    return false;
+  
+  // If the block is completely empty, then it definitely does fall through.
+  if (Pred->empty())
+    return true;
+  
+  // Otherwise, check the last instruction.
+  const MachineInstr &LastInst = Pred->back();
+  return !LastInst.getDesc().isBarrier();
+}
+
+
+
 GCMetadataPrinter *AsmPrinter::GetOrCreateGCPrinter(GCStrategy *S) {
   if (!S->usesMetadata())
     return 0;
diff --git a/libclamav/c++/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/libclamav/c++/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index 5093dd9..5ad1e5e 100644
--- a/libclamav/c++/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/libclamav/c++/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -238,7 +238,18 @@ public:
         LIndex = DSI;
       }
     }
-    setLastInsn(LastInsn);
+
+    unsigned CurrentLastInsnIndex = 0;
+    if (const MachineInstr *CL = getLastInsn()) 
+      CurrentLastInsnIndex = MIIndexMap[CL];
+    unsigned FIndex = MIIndexMap[getFirstInsn()];
+
+    // Set LastInsn as the last instruction for this scope only if
+    // it follows 
+    //  1) this scope's first instruction and
+    //  2) current last instruction for this scope, if any.
+    if (LIndex >= CurrentLastInsnIndex && LIndex >= FIndex)
+      setLastInsn(LastInsn);
   }
 
 #ifndef NDEBUG
@@ -1166,7 +1177,9 @@ DIE *DwarfDebug::createSubprogramDIE(const DISubprogram &SP, bool MakeDecl) {
     return SPDie;
 
   SPDie = new DIE(dwarf::DW_TAG_subprogram);
-  addString(SPDie, dwarf::DW_AT_name, dwarf::DW_FORM_string, SP.getName());
+  // Constructors and operators for anonymous aggregates do not have names.
+  if (!SP.getName().empty())
+    addString(SPDie, dwarf::DW_AT_name, dwarf::DW_FORM_string, SP.getName());
 
   StringRef LinkageName = SP.getLinkageName();
   if (!LinkageName.empty())
diff --git a/libclamav/c++/llvm/lib/CodeGen/AsmPrinter/DwarfException.cpp b/libclamav/c++/llvm/lib/CodeGen/AsmPrinter/DwarfException.cpp
index 22b1b1c..2b08ba4 100644
--- a/libclamav/c++/llvm/lib/CodeGen/AsmPrinter/DwarfException.cpp
+++ b/libclamav/c++/llvm/lib/CodeGen/AsmPrinter/DwarfException.cpp
@@ -50,26 +50,6 @@ DwarfException::~DwarfException() {
   delete ExceptionTimer;
 }
 
-/// SizeOfEncodedValue - Return the size of the encoding in bytes.
-unsigned DwarfException::SizeOfEncodedValue(unsigned Encoding) {
-  if (Encoding == dwarf::DW_EH_PE_omit)
-    return 0;
-
-  switch (Encoding & 0x07) {
-  case dwarf::DW_EH_PE_absptr:
-    return TD->getPointerSize();
-  case dwarf::DW_EH_PE_udata2:
-    return 2;
-  case dwarf::DW_EH_PE_udata4:
-    return 4;
-  case dwarf::DW_EH_PE_udata8:
-    return 8;
-  }
-
-  assert(0 && "Invalid encoded value.");
-  return 0;
-}
-
 /// CreateLabelDiff - Emit a label and subtract it from the expression we
 /// already have.  This is equivalent to emitting "foo - .", but we have to emit
 /// the label for "." directly.
@@ -100,7 +80,7 @@ void DwarfException::EmitCIE(const Function *PersonalityFn, unsigned Index) {
     TD->getPointerSize() : -TD->getPointerSize();
 
   const TargetLoweringObjectFile &TLOF = Asm->getObjFileLowering();
-  
+
   // Begin eh frame section.
   Asm->OutStreamer.SwitchSection(TLOF.getEHFrameSection());
 
@@ -128,30 +108,16 @@ void DwarfException::EmitCIE(const Function *PersonalityFn, unsigned Index) {
   // The personality presence indicates that language specific information will
   // show up in the eh frame.  Find out how we are supposed to lower the
   // personality function reference:
-  const MCExpr *PersonalityRef = 0;
-  bool IsPersonalityIndirect = false, IsPersonalityPCRel = false;
-  if (PersonalityFn) {
-    // FIXME: HANDLE STATIC CODEGEN MODEL HERE.
-    
-    // In non-static mode, ask the object file how to represent this reference.
-    PersonalityRef =
-      TLOF.getSymbolForDwarfGlobalReference(PersonalityFn, Asm->Mang,
-                                            Asm->MMI,
-                                            IsPersonalityIndirect,
-                                            IsPersonalityPCRel);
-  }
-  
-  unsigned PerEncoding = dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4;
-  if (IsPersonalityIndirect)
-    PerEncoding |= dwarf::DW_EH_PE_indirect;
-  unsigned LSDAEncoding = dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4;
-  unsigned FDEEncoding = dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4;
+
+  unsigned LSDAEncoding = TLOF.getLSDAEncoding();
+  unsigned FDEEncoding = TLOF.getFDEEncoding();
+  unsigned PerEncoding = TLOF.getPersonalityEncoding();
 
   char Augmentation[6] = { 0 };
   unsigned AugmentationSize = 0;
   char *APtr = Augmentation + 1;
 
-  if (PersonalityRef) {
+  if (PersonalityFn) {
     // There is a personality function.
     *APtr++ = 'P';
     AugmentationSize += 1 + SizeOfEncodedValue(PerEncoding);
@@ -181,20 +147,19 @@ void DwarfException::EmitCIE(const Function *PersonalityFn, unsigned Index) {
   Asm->EmitInt8(RI->getDwarfRegNum(RI->getRARegister(), true));
   EOL("CIE Return Address Column");
 
-  EmitULEB128(AugmentationSize, "Augmentation Size");
-  EmitEncodingByte(PerEncoding, "Personality");
-
-  // If there is a personality, we need to indicate the function's location.
-  if (PersonalityRef) {
-    if (!IsPersonalityPCRel)
-      PersonalityRef = CreateLabelDiff(PersonalityRef, "personalityref_addr",
-                                       Index);
+  if (Augmentation[0]) {
+    EmitULEB128(AugmentationSize, "Augmentation Size");
 
-    O << MAI->getData32bitsDirective() << *PersonalityRef;
-    EOL("Personality");
-
-    EmitEncodingByte(LSDAEncoding, "LSDA");
-    EmitEncodingByte(FDEEncoding, "FDE");
+    // If there is a personality, we need to indicate the function's location.
+    if (PersonalityFn) {
+      EmitEncodingByte(PerEncoding, "Personality");
+      EmitReference(PersonalityFn, PerEncoding);
+      EOL("Personality");
+    }
+    if (UsesLSDA[Index])
+      EmitEncodingByte(LSDAEncoding, "LSDA");
+    if (FDEEncoding != dwarf::DW_EH_PE_absptr)
+      EmitEncodingByte(FDEEncoding, "FDE");
   }
 
   // Indicate locations of general callee saved registers in frame.
@@ -216,8 +181,12 @@ void DwarfException::EmitFDE(const FunctionEHFrameInfo &EHFrameInfo) {
          "Should not emit 'available externally' functions at all");
 
   const Function *TheFunc = EHFrameInfo.function;
+  const TargetLoweringObjectFile &TLOF = Asm->getObjFileLowering();
 
-  Asm->OutStreamer.SwitchSection(Asm->getObjFileLowering().getEHFrameSection());
+  unsigned LSDAEncoding = TLOF.getLSDAEncoding();
+  unsigned FDEEncoding = TLOF.getFDEEncoding();
+
+  Asm->OutStreamer.SwitchSection(TLOF.getEHFrameSection());
 
   // Externally visible entry into the functions eh frame info. If the
   // corresponding function is static, this should not be externally visible.
@@ -255,7 +224,8 @@ void DwarfException::EmitFDE(const FunctionEHFrameInfo &EHFrameInfo) {
 
     // EH frame header.
     EmitDifference("eh_frame_end", EHFrameInfo.Number,
-                   "eh_frame_begin", EHFrameInfo.Number, true);
+                   "eh_frame_begin", EHFrameInfo.Number,
+                   true);
     EOL("Length of Frame Information Entry");
 
     EmitLabel("eh_frame_begin", EHFrameInfo.Number);
@@ -266,33 +236,23 @@ void DwarfException::EmitFDE(const FunctionEHFrameInfo &EHFrameInfo) {
 
     EOL("FDE CIE offset");
 
-    EmitReference("eh_func_begin", EHFrameInfo.Number, true, true);
+    EmitReference("eh_func_begin", EHFrameInfo.Number, FDEEncoding);
     EOL("FDE initial location");
     EmitDifference("eh_func_end", EHFrameInfo.Number,
-                   "eh_func_begin", EHFrameInfo.Number, true);
+                   "eh_func_begin", EHFrameInfo.Number,
+                   SizeOfEncodedValue(FDEEncoding) == 4);
     EOL("FDE address range");
 
     // If there is a personality and landing pads then point to the language
     // specific data area in the exception table.
     if (MMI->getPersonalities()[0] != NULL) {
+      unsigned Size = SizeOfEncodedValue(LSDAEncoding);
 
-      if (Asm->TM.getLSDAEncoding() != DwarfLSDAEncoding::EightByte) {
-        EmitULEB128(4, "Augmentation size");
-
-        if (EHFrameInfo.hasLandingPads)
-          EmitReference("exception", EHFrameInfo.Number, true, true);
-        else
-          Asm->OutStreamer.EmitIntValue(0, 4/*size*/, 0/*addrspace*/);
-      } else {
-        EmitULEB128(TD->getPointerSize(), "Augmentation size");
-
-        if (EHFrameInfo.hasLandingPads) {
-          EmitReference("exception", EHFrameInfo.Number, true, false);
-        } else {
-          Asm->OutStreamer.EmitIntValue(0, TD->getPointerSize(),
-                                        0/*addrspace*/);
-        }
-      }
+      EmitULEB128(Size, "Augmentation size");
+      if (EHFrameInfo.hasLandingPads)
+        EmitReference("exception", EHFrameInfo.Number, LSDAEncoding);
+      else
+        Asm->OutStreamer.EmitIntValue(0, Size/*size*/, 0/*addrspace*/);
 
       EOL("Language Specific Data Area");
     } else {
@@ -678,29 +638,29 @@ void DwarfException::EmitExceptionTable() {
   const unsigned LandingPadSize = SizeOfEncodedValue(dwarf::DW_EH_PE_udata4);
   bool IsSJLJ = MAI->getExceptionHandlingType() == ExceptionHandling::SjLj;
   bool HaveTTData = IsSJLJ ? (!TypeInfos.empty() || !FilterIds.empty()) : true;
-  unsigned SizeSites;
+  unsigned CallSiteTableLength;
 
   if (IsSJLJ)
-    SizeSites = 0;
+    CallSiteTableLength = 0;
   else
-    SizeSites = CallSites.size() *
+    CallSiteTableLength = CallSites.size() *
       (SiteStartSize + SiteLengthSize + LandingPadSize);
 
   for (unsigned i = 0, e = CallSites.size(); i < e; ++i) {
-    SizeSites += MCAsmInfo::getULEB128Size(CallSites[i].Action);
+    CallSiteTableLength += MCAsmInfo::getULEB128Size(CallSites[i].Action);
     if (IsSJLJ)
-      SizeSites += MCAsmInfo::getULEB128Size(i);
+      CallSiteTableLength += MCAsmInfo::getULEB128Size(i);
   }
 
   // Type infos.
   const MCSection *LSDASection = Asm->getObjFileLowering().getLSDASection();
-  unsigned TTypeFormat;
+  unsigned TTypeEncoding;
   unsigned TypeFormatSize;
 
   if (!HaveTTData) {
     // For SjLj exceptions, if there is no TypeInfo, then we just explicitly say
     // that we're omitting that bit.
-    TTypeFormat = dwarf::DW_EH_PE_omit;
+    TTypeEncoding = dwarf::DW_EH_PE_omit;
     TypeFormatSize = SizeOfEncodedValue(dwarf::DW_EH_PE_absptr);
   } else {
     // Okay, we have actual filters or typeinfos to emit.  As such, we need to
@@ -730,21 +690,28 @@ void DwarfException::EmitExceptionTable() {
     // somewhere.  This predicate should be moved to a shared location that is
     // in target-independent code.
     //
-    if (LSDASection->getKind().isWriteable() ||
-        Asm->TM.getRelocationModel() == Reloc::Static)
-      TTypeFormat = dwarf::DW_EH_PE_absptr;
-    else
-      TTypeFormat = dwarf::DW_EH_PE_indirect | dwarf::DW_EH_PE_pcrel |
-        dwarf::DW_EH_PE_sdata4;
-
-    TypeFormatSize = SizeOfEncodedValue(TTypeFormat);
+    TTypeEncoding = Asm->getObjFileLowering().getTTypeEncoding();
+    TypeFormatSize = SizeOfEncodedValue(TTypeEncoding);
   }
 
   // Begin the exception table.
   Asm->OutStreamer.SwitchSection(LSDASection);
   Asm->EmitAlignment(2, 0, 0, false);
 
+  // Emit the LSDA.
   O << "GCC_except_table" << SubprogramCount << ":\n";
+  EmitLabel("exception", SubprogramCount);
+
+  if (IsSJLJ) {
+    SmallString<16> LSDAName;
+    raw_svector_ostream(LSDAName) << MAI->getPrivateGlobalPrefix() <<
+      "_LSDA_" << Asm->getFunctionNumber();
+    O << LSDAName.str() << ":\n";
+  }
+
+  // Emit the LSDA header.
+  EmitEncodingByte(dwarf::DW_EH_PE_omit, "@LPStart");
+  EmitEncodingByte(TTypeEncoding, "@TType");
 
   // The type infos need to be aligned. GCC does this by inserting padding just
   // before the type infos. However, this changes the size of the exception
@@ -753,7 +720,7 @@ void DwarfException::EmitExceptionTable() {
   // So by increasing the size by inserting padding, you may increase the number
   // of bytes used for writing the size. If it increases, say by one byte, then
   // you now need to output one less byte of padding to get the type infos
-  // aligned.  However this decreases the size of the exception table. This
+  // aligned. However this decreases the size of the exception table. This
   // changes the value you have to output for the exception table size. Due to
   // the variable length encoding, the number of bytes used for writing the
   // length may decrease. If so, you then have to increase the amount of
@@ -762,41 +729,35 @@ void DwarfException::EmitExceptionTable() {
   // We chose another solution: don't output padding inside the table like GCC
   // does, instead output it before the table.
   unsigned SizeTypes = TypeInfos.size() * TypeFormatSize;
-  unsigned TyOffset = sizeof(int8_t) +          // Call site format
-    MCAsmInfo::getULEB128Size(SizeSites) +      // Call site table length
-    SizeSites + SizeActions + SizeTypes;
-  unsigned TotalSize = sizeof(int8_t) +         // LPStart format
-                       sizeof(int8_t) +         // TType format
-    (HaveTTData ?
-     MCAsmInfo::getULEB128Size(TyOffset) : 0) + // TType base offset
-    TyOffset;
+  unsigned CallSiteTableLengthSize =
+    MCAsmInfo::getULEB128Size(CallSiteTableLength);
+  unsigned TTypeBaseOffset =
+    sizeof(int8_t) +                            // Call site format
+    CallSiteTableLengthSize +                   // Call site table length size
+    CallSiteTableLength +                       // Call site table length
+    SizeActions +                               // Actions size
+    SizeTypes;
+  unsigned TTypeBaseOffsetSize = MCAsmInfo::getULEB128Size(TTypeBaseOffset);
+  unsigned TotalSize =
+    sizeof(int8_t) +                            // LPStart format
+    sizeof(int8_t) +                            // TType format
+    (HaveTTData ? TTypeBaseOffsetSize : 0) +    // TType base offset size
+    TTypeBaseOffset;                            // TType base offset
   unsigned SizeAlign = (4 - TotalSize) & 3;
 
-  for (unsigned i = 0; i != SizeAlign; ++i) {
-    Asm->EmitInt8(0);
-    EOL("Padding");
-  }
-
-  EmitLabel("exception", SubprogramCount);
-
-  if (IsSJLJ) {
-    SmallString<16> LSDAName;
-    raw_svector_ostream(LSDAName) << MAI->getPrivateGlobalPrefix() <<
-      "_LSDA_" << Asm->getFunctionNumber();
-    O << LSDAName.str() << ":\n";
+  if (HaveTTData) {
+    // Account for any extra padding that will be added to the call site table
+    // length.
+    EmitULEB128(TTypeBaseOffset, "@TType base offset", SizeAlign);
+    SizeAlign = 0;
   }
 
-  // Emit the header.
-  EmitEncodingByte(dwarf::DW_EH_PE_omit, "@LPStart");
-  EmitEncodingByte(TTypeFormat, "@TType");
-
-  if (HaveTTData)
-    EmitULEB128(TyOffset, "@TType base offset");
-
   // SjLj Exception handling
   if (IsSJLJ) {
     EmitEncodingByte(dwarf::DW_EH_PE_udata4, "Call site");
-    EmitULEB128(SizeSites, "Call site table length");
+
+    // Add extra padding if it wasn't added to the TType base offset.
+    EmitULEB128(CallSiteTableLength, "Call site table length", SizeAlign);
 
     // Emit the landing pad site information.
     unsigned idx = 0;
@@ -837,7 +798,9 @@ void DwarfException::EmitExceptionTable() {
 
     // Emit the landing pad call site table.
     EmitEncodingByte(dwarf::DW_EH_PE_udata4, "Call site");
-    EmitULEB128(SizeSites, "Call site table length");
+
+    // Add extra padding if it wasn't added to the TType base offset.
+    EmitULEB128(CallSiteTableLength, "Call site table length", SizeAlign);
 
     for (SmallVectorImpl<CallSiteEntry>::const_iterator
          I = CallSites.begin(), E = CallSites.end(); I != E; ++I) {
@@ -911,12 +874,12 @@ void DwarfException::EmitExceptionTable() {
   for (std::vector<GlobalVariable *>::const_reverse_iterator
          I = TypeInfos.rbegin(), E = TypeInfos.rend(); I != E; ++I) {
     const GlobalVariable *GV = *I;
-    PrintRelDirective();
 
     if (GV) {
-      O << *Asm->GetGlobalValueSymbol(GV);
+      EmitReference(GV, TTypeEncoding);
       EOL("TypeInfo");
     } else {
+      PrintRelDirective(TTypeEncoding);
       O << "0x0";
       EOL("");
     }
diff --git a/libclamav/c++/llvm/lib/CodeGen/AsmPrinter/DwarfException.h b/libclamav/c++/llvm/lib/CodeGen/AsmPrinter/DwarfException.h
index 6177d26..3db1a00 100644
--- a/libclamav/c++/llvm/lib/CodeGen/AsmPrinter/DwarfException.h
+++ b/libclamav/c++/llvm/lib/CodeGen/AsmPrinter/DwarfException.h
@@ -76,9 +76,6 @@ class DwarfException : public DwarfPrinter {
   /// ExceptionTimer - Timer for the Dwarf exception writer.
   Timer *ExceptionTimer;
 
-  /// SizeOfEncodedValue - Return the size of the encoding in bytes.
-  unsigned SizeOfEncodedValue(unsigned Encoding);
-
   /// EmitCIE - Emit a Common Information Entry (CIE). This holds information
   /// that is shared among many Frame Description Entries.  There is at least
   /// one CIE in every non-empty .debug_frame section.
diff --git a/libclamav/c++/llvm/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp b/libclamav/c++/llvm/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp
index 4de0b74..28ff0eb 100644
--- a/libclamav/c++/llvm/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp
+++ b/libclamav/c++/llvm/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp
@@ -8,7 +8,7 @@
 //===----------------------------------------------------------------------===//
 //
 // Emit general DWARF directives.
-// 
+//
 //===----------------------------------------------------------------------===//
 
 #include "DwarfPrinter.h"
@@ -18,13 +18,17 @@
 #include "llvm/CodeGen/MachineFunction.h"
 #include "llvm/CodeGen/MachineModuleInfo.h"
 #include "llvm/MC/MCAsmInfo.h"
+#include "llvm/MC/MCContext.h"
+#include "llvm/MC/MCExpr.h"
 #include "llvm/MC/MCStreamer.h"
 #include "llvm/MC/MCSymbol.h"
 #include "llvm/Target/TargetData.h"
 #include "llvm/Target/TargetFrameInfo.h"
+#include "llvm/Target/TargetLoweringObjectFile.h"
 #include "llvm/Target/TargetRegisterInfo.h"
 #include "llvm/Support/Dwarf.h"
 #include "llvm/Support/ErrorHandling.h"
+#include "llvm/ADT/SmallString.h"
 using namespace llvm;
 
 DwarfPrinter::DwarfPrinter(raw_ostream &OS, AsmPrinter *A, const MCAsmInfo *T,
@@ -33,6 +37,26 @@ DwarfPrinter::DwarfPrinter(raw_ostream &OS, AsmPrinter *A, const MCAsmInfo *T,
   RI(Asm->TM.getRegisterInfo()), M(NULL), MF(NULL), MMI(NULL),
   SubprogramCount(0), Flavor(flavor), SetCounter(1) {}
 
+/// SizeOfEncodedValue - Return the size of the encoding in bytes.
+unsigned DwarfPrinter::SizeOfEncodedValue(unsigned Encoding) const {
+  if (Encoding == dwarf::DW_EH_PE_omit)
+    return 0;
+
+  switch (Encoding & 0x07) {
+  case dwarf::DW_EH_PE_absptr:
+    return TD->getPointerSize();
+  case dwarf::DW_EH_PE_udata2:
+    return 2;
+  case dwarf::DW_EH_PE_udata4:
+    return 4;
+  case dwarf::DW_EH_PE_udata8:
+    return 8;
+  }
+
+  assert(0 && "Invalid encoded value.");
+  return 0;
+}
+
 void DwarfPrinter::PrintRelDirective(bool Force32Bit, bool isInSection) const {
   if (isInSection && MAI->getDwarfSectionOffsetDirective())
     O << MAI->getDwarfSectionOffsetDirective();
@@ -42,6 +66,14 @@ void DwarfPrinter::PrintRelDirective(bool Force32Bit, bool isInSection) const {
     O << MAI->getData64bitsDirective();
 }
 
+void DwarfPrinter::PrintRelDirective(unsigned Encoding) const {
+  unsigned Size = SizeOfEncodedValue(Encoding);
+  assert((Size == 4 || Size == 8) && "Do not support other types or rels!");
+
+  O << (Size == 4 ?
+        MAI->getData32bitsDirective() : MAI->getData64bitsDirective());
+}
+
 /// EOL - Print a newline character to asm stream.  If a comment is present
 /// then it will be printed first.  Comments should not contain '\n'.
 void DwarfPrinter::EOL(const Twine &Comment) const {
@@ -127,29 +159,35 @@ void DwarfPrinter::EmitSLEB128(int Value, const char *Desc) const {
     Value >>= 7;
     IsMore = Value != Sign || ((Byte ^ Sign) & 0x40) != 0;
     if (IsMore) Byte |= 0x80;
-    
     Asm->OutStreamer.EmitIntValue(Byte, 1, /*addrspace*/0);
   } while (IsMore);
 }
 
 /// EmitULEB128 - emit the specified signed leb128 value.
-void DwarfPrinter::EmitULEB128(unsigned Value, const char *Desc) const {
+void DwarfPrinter::EmitULEB128(unsigned Value, const char *Desc,
+                               unsigned PadTo) const {
   if (Asm->VerboseAsm && Desc)
     Asm->OutStreamer.AddComment(Desc);
  
-  if (MAI->hasLEB128()) {
+  if (MAI->hasLEB128() && PadTo == 0) {
     O << "\t.uleb128\t" << Value;
     Asm->OutStreamer.AddBlankLine();
     return;
   }
   
-  // If we don't have .uleb128, emit as .bytes.
+  // If we don't have .uleb128 or we want to emit padding, emit as .bytes.
   do {
     unsigned char Byte = static_cast<unsigned char>(Value & 0x7f);
     Value >>= 7;
-    if (Value) Byte |= 0x80;
+    if (Value || PadTo != 0) Byte |= 0x80;
     Asm->OutStreamer.EmitIntValue(Byte, 1, /*addrspace*/0);
   } while (Value);
+
+  if (PadTo) {
+    if (PadTo > 1)
+      Asm->OutStreamer.EmitFill(PadTo - 1, 0x80/*fillval*/, 0/*addrspace*/);
+    Asm->OutStreamer.EmitFill(1, 0/*fillval*/, 0/*addrspace*/);
+  }
 }
 
 
@@ -195,6 +233,31 @@ void DwarfPrinter::EmitReference(const MCSymbol *Sym, bool IsPCRelative,
   if (IsPCRelative) O << "-" << MAI->getPCSymbol();
 }
 
+void DwarfPrinter::EmitReference(const char *Tag, unsigned Number,
+                                 unsigned Encoding) const {
+  SmallString<64> Name;
+  raw_svector_ostream(Name) << MAI->getPrivateGlobalPrefix()
+                            << Tag << Number;
+
+  MCSymbol *Sym = Asm->OutContext.GetOrCreateSymbol(Name.str());
+  EmitReference(Sym, Encoding);
+}
+
+void DwarfPrinter::EmitReference(const MCSymbol *Sym, unsigned Encoding) const {
+  const TargetLoweringObjectFile &TLOF = Asm->getObjFileLowering();
+
+  PrintRelDirective(Encoding);
+  O << *TLOF.getSymbolForDwarfReference(Sym, Asm->MMI, Encoding);;
+}
+
+void DwarfPrinter::EmitReference(const GlobalValue *GV, unsigned Encoding)const {
+  const TargetLoweringObjectFile &TLOF = Asm->getObjFileLowering();
+
+  PrintRelDirective(Encoding);
+  O << *TLOF.getSymbolForDwarfGlobalReference(GV, Asm->Mang,
+                                              Asm->MMI, Encoding);;
+}
+
 /// EmitDifference - Emit the difference between two labels.  If this assembler
 /// supports .set, we emit a .set of a temporary and then use it in the .word.
 void DwarfPrinter::EmitDifference(const char *TagHi, unsigned NumberHi,
diff --git a/libclamav/c++/llvm/lib/CodeGen/AsmPrinter/DwarfPrinter.h b/libclamav/c++/llvm/lib/CodeGen/AsmPrinter/DwarfPrinter.h
index 69d9c27..bd715f2 100644
--- a/libclamav/c++/llvm/lib/CodeGen/AsmPrinter/DwarfPrinter.h
+++ b/libclamav/c++/llvm/lib/CodeGen/AsmPrinter/DwarfPrinter.h
@@ -28,6 +28,7 @@ class Module;
 class MCAsmInfo;
 class TargetData;
 class TargetRegisterInfo;
+class GlobalValue;
 class MCSymbol;
 class Twine;
 
@@ -85,6 +86,10 @@ public:
   const MCAsmInfo *getMCAsmInfo() const { return MAI; }
   const TargetData *getTargetData() const { return TD; }
 
+  /// SizeOfEncodedValue - Return the size of the encoding in bytes.
+  unsigned SizeOfEncodedValue(unsigned Encoding) const;
+
+  void PrintRelDirective(unsigned Encoding) const;
   void PrintRelDirective(bool Force32Bit = false,
                          bool isInSection = false) const;
 
@@ -106,7 +111,8 @@ public:
   void EmitSLEB128(int Value, const char *Desc) const;
 
   /// EmitULEB128 - emit the specified unsigned leb128 value.
-  void EmitULEB128(unsigned Value, const char *Desc = 0) const;
+  void EmitULEB128(unsigned Value, const char *Desc = 0,
+                   unsigned PadTo = 0) const;
 
   
   /// PrintLabelName - Print label name in form used by Dwarf writer.
@@ -140,6 +146,10 @@ public:
   void EmitReference(const MCSymbol *Sym, bool IsPCRelative = false,
                      bool Force32Bit = false) const;
 
+  void EmitReference(const char *Tag, unsigned Number, unsigned Encoding) const;
+  void EmitReference(const MCSymbol *Sym, unsigned Encoding) const;
+  void EmitReference(const GlobalValue *GV, unsigned Encoding) const;
+
   /// EmitDifference - Emit the difference between two labels.
   void EmitDifference(const DWLabel &LabelHi, const DWLabel &LabelLo,
                       bool IsSmall = false) {
diff --git a/libclamav/c++/llvm/lib/CodeGen/BranchFolding.cpp b/libclamav/c++/llvm/lib/CodeGen/BranchFolding.cpp
index faf4d95..d94729a 100644
--- a/libclamav/c++/llvm/lib/CodeGen/BranchFolding.cpp
+++ b/libclamav/c++/llvm/lib/CodeGen/BranchFolding.cpp
@@ -334,7 +334,9 @@ static unsigned ComputeCommonTailLength(MachineBasicBlock *MBB1,
   unsigned TailLen = 0;
   while (I1 != MBB1->begin() && I2 != MBB2->begin()) {
     --I1; --I2;
-    if (!I1->isIdenticalTo(I2) ||
+    // Don't merge debugging pseudos.
+    if (I1->isDebugValue() || I2->isDebugValue() ||
+        !I1->isIdenticalTo(I2) ||
         // FIXME: This check is dubious. It's used to get around a problem where
         // people incorrectly expect inline asm directives to remain in the same
         // relative order. This is untenable because normal compiler
@@ -412,6 +414,8 @@ static unsigned EstimateRuntime(MachineBasicBlock::iterator I,
                                 MachineBasicBlock::iterator E) {
   unsigned Time = 0;
   for (; I != E; ++I) {
+    if (I->isDebugValue())
+      continue;
     const TargetInstrDesc &TID = I->getDesc();
     if (TID.isCall())
       Time += 10;
diff --git a/libclamav/c++/llvm/lib/CodeGen/CMakeLists.txt b/libclamav/c++/llvm/lib/CodeGen/CMakeLists.txt
index 46d3268..d385b86 100644
--- a/libclamav/c++/llvm/lib/CodeGen/CMakeLists.txt
+++ b/libclamav/c++/llvm/lib/CodeGen/CMakeLists.txt
@@ -22,6 +22,7 @@ add_llvm_library(LLVMCodeGen
   LiveVariables.cpp
   LowerSubregs.cpp
   MachineBasicBlock.cpp
+  MachineCSE.cpp
   MachineDominators.cpp
   MachineFunction.cpp
   MachineFunctionAnalysis.cpp
@@ -67,6 +68,7 @@ add_llvm_library(LLVMCodeGen
   StrongPHIElimination.cpp
   TailDuplication.cpp
   TargetInstrInfoImpl.cpp
+  TargetLoweringObjectFileImpl.cpp
   TwoAddressInstructionPass.cpp
   UnreachableBlockElim.cpp
   VirtRegMap.cpp
diff --git a/libclamav/c++/llvm/lib/CodeGen/CalcSpillWeights.cpp b/libclamav/c++/llvm/lib/CodeGen/CalcSpillWeights.cpp
index 2bedd04..a328d0e 100644
--- a/libclamav/c++/llvm/lib/CodeGen/CalcSpillWeights.cpp
+++ b/libclamav/c++/llvm/lib/CodeGen/CalcSpillWeights.cpp
@@ -131,10 +131,7 @@ bool CalculateSpillWeights::runOnMachineFunction(MachineFunction &fn) {
       if (Hint.first || Hint.second)
         li.weight *= 1.01F;
 
-      // Divide the weight of the interval by its size.  This encourages
-      // spilling of intervals that are large and have few uses, and
-      // discourages spilling of small intervals with many uses.
-      li.weight /= lis->getApproximateInstructionCount(li) * SlotIndex::NUM;
+      lis->normalizeSpillWeight(li);
     }
   }
   
diff --git a/libclamav/c++/llvm/lib/CodeGen/CodePlacementOpt.cpp b/libclamav/c++/llvm/lib/CodeGen/CodePlacementOpt.cpp
index a13a310..3ff2a04 100644
--- a/libclamav/c++/llvm/lib/CodeGen/CodePlacementOpt.cpp
+++ b/libclamav/c++/llvm/lib/CodeGen/CodePlacementOpt.cpp
@@ -102,13 +102,6 @@ bool CodePlacementOpt::HasAnalyzableTerminator(MachineBasicBlock *MBB) {
   // Conservatively ignore EH landing pads.
   if (MBB->isLandingPad()) return false;
 
-  // Ignore blocks which look like they might have EH-related control flow.
-  // At the time of this writing, there are blocks which AnalyzeBranch
-  // thinks end in single uncoditional branches, yet which have two CFG
-  // successors. Code in this file is not prepared to reason about such things.
-  if (!MBB->empty() && MBB->back().isEHLabel())
-    return false;
-
   // Aggressively handle return blocks and similar constructs.
   if (MBB->succ_empty()) return true;
 
@@ -118,6 +111,14 @@ bool CodePlacementOpt::HasAnalyzableTerminator(MachineBasicBlock *MBB) {
   // Make sure the terminator is understood.
   if (TII->AnalyzeBranch(*MBB, TBB, FBB, Cond))
     return false;
+   // Ignore blocks which look like they might have EH-related control flow.
+   // AnalyzeBranch thinks it knows how to analyze such things, but it doesn't
+   // recognize the possibility of a control transfer through an unwind.
+   // Such blocks contain EH_LABEL instructions, however they may be in the
+   // middle of the block. Instead of searching for them, just check to see
+   // if the CFG disagrees with AnalyzeBranch.
+  if (1u + !Cond.empty() != MBB->succ_size())
+    return false;
   // Make sure we have the option of reversing the condition.
   if (!Cond.empty() && TII->ReverseBranchCondition(Cond))
     return false;
diff --git a/libclamav/c++/llvm/lib/CodeGen/CriticalAntiDepBreaker.cpp b/libclamav/c++/llvm/lib/CodeGen/CriticalAntiDepBreaker.cpp
index 056e2d5..7d3de89 100644
--- a/libclamav/c++/llvm/lib/CodeGen/CriticalAntiDepBreaker.cpp
+++ b/libclamav/c++/llvm/lib/CodeGen/CriticalAntiDepBreaker.cpp
@@ -119,6 +119,8 @@ void CriticalAntiDepBreaker::FinishBlock() {
 
 void CriticalAntiDepBreaker::Observe(MachineInstr *MI, unsigned Count,
                                      unsigned InsertPosIndex) {
+  if (MI->isDebugValue())
+    return;
   assert(Count < InsertPosIndex && "Instruction index out of expected range!");
 
   // Any register which was defined within the previous scheduling region
@@ -409,6 +411,8 @@ BreakAntiDependencies(std::vector<SUnit>& SUnits,
   for (MachineBasicBlock::iterator I = End, E = Begin;
        I != E; --Count) {
     MachineInstr *MI = --I;
+    if (MI->isDebugValue())
+      continue;
 
     // Check if this instruction has a dependence on the critical path that
     // is an anti-dependence that we may be able to break. If it is, set
diff --git a/libclamav/c++/llvm/lib/CodeGen/DeadMachineInstructionElim.cpp b/libclamav/c++/llvm/lib/CodeGen/DeadMachineInstructionElim.cpp
index a215a19..d69c995 100644
--- a/libclamav/c++/llvm/lib/CodeGen/DeadMachineInstructionElim.cpp
+++ b/libclamav/c++/llvm/lib/CodeGen/DeadMachineInstructionElim.cpp
@@ -55,7 +55,7 @@ FunctionPass *llvm::createDeadMachineInstructionElimPass() {
 bool DeadMachineInstructionElim::isDead(const MachineInstr *MI) const {
   // Don't delete instructions with side effects.
   bool SawStore = false;
-  if (!MI->isSafeToMove(TII, SawStore, 0) && !MI->isPHI())
+  if (!MI->isSafeToMove(TII, 0, SawStore) && !MI->isPHI())
     return false;
 
   // Examine each operand.
diff --git a/libclamav/c++/llvm/lib/CodeGen/IntrinsicLowering.cpp b/libclamav/c++/llvm/lib/CodeGen/IntrinsicLowering.cpp
index 9997a48..87ab7ef 100644
--- a/libclamav/c++/llvm/lib/CodeGen/IntrinsicLowering.cpp
+++ b/libclamav/c++/llvm/lib/CodeGen/IntrinsicLowering.cpp
@@ -155,7 +155,7 @@ void IntrinsicLowering::AddPrototypes(Module &M) {
 /// LowerBSWAP - Emit the code to lower bswap of V before the specified
 /// instruction IP.
 static Value *LowerBSWAP(LLVMContext &Context, Value *V, Instruction *IP) {
-  assert(V->getType()->isInteger() && "Can't bswap a non-integer type!");
+  assert(V->getType()->isIntegerTy() && "Can't bswap a non-integer type!");
 
   unsigned BitSize = V->getType()->getPrimitiveSizeInBits();
   
@@ -251,7 +251,7 @@ static Value *LowerBSWAP(LLVMContext &Context, Value *V, Instruction *IP) {
 /// LowerCTPOP - Emit the code to lower ctpop of V before the specified
 /// instruction IP.
 static Value *LowerCTPOP(LLVMContext &Context, Value *V, Instruction *IP) {
-  assert(V->getType()->isInteger() && "Can't ctpop a non-integer type!");
+  assert(V->getType()->isIntegerTy() && "Can't ctpop a non-integer type!");
 
   static const uint64_t MaskValues[6] = {
     0x5555555555555555ULL, 0x3333333333333333ULL,
diff --git a/libclamav/c++/llvm/lib/CodeGen/LLVMTargetMachine.cpp b/libclamav/c++/llvm/lib/CodeGen/LLVMTargetMachine.cpp
index 278de02..5e88865 100644
--- a/libclamav/c++/llvm/lib/CodeGen/LLVMTargetMachine.cpp
+++ b/libclamav/c++/llvm/lib/CodeGen/LLVMTargetMachine.cpp
@@ -67,6 +67,9 @@ static cl::opt<bool> VerifyMachineCode("verify-machineinstrs", cl::Hidden,
     cl::desc("Verify generated machine code"),
     cl::init(getenv("LLVM_VERIFY_MACHINEINSTRS")!=NULL));
 
+static cl::opt<bool> EnableMachineCSE("enable-machine-cse", cl::Hidden,
+    cl::desc("Enable Machine CSE"));
+
 static cl::opt<cl::boolOrDefault>
 AsmVerbose("asm-verbose", cl::desc("Add comments to directives."),
            cl::init(cl::BOU_UNSET));
@@ -115,9 +118,10 @@ LLVMTargetMachine::setCodeModelForStatic() {
 bool LLVMTargetMachine::addPassesToEmitFile(PassManagerBase &PM,
                                             formatted_raw_ostream &Out,
                                             CodeGenFileType FileType,
-                                            CodeGenOpt::Level OptLevel) {
+                                            CodeGenOpt::Level OptLevel,
+                                            bool DisableVerify) {
   // Add common CodeGen passes.
-  if (addCommonCodeGenPasses(PM, OptLevel))
+  if (addCommonCodeGenPasses(PM, OptLevel, DisableVerify))
     return true;
 
   OwningPtr<MCContext> Context(new MCContext());
@@ -193,12 +197,13 @@ bool LLVMTargetMachine::addPassesToEmitFile(PassManagerBase &PM,
 ///
 bool LLVMTargetMachine::addPassesToEmitMachineCode(PassManagerBase &PM,
                                                    JITCodeEmitter &JCE,
-                                                   CodeGenOpt::Level OptLevel) {
+                                                   CodeGenOpt::Level OptLevel,
+                                                   bool DisableVerify) {
   // Make sure the code model is set.
   setCodeModelForJIT();
   
   // Add common CodeGen passes.
-  if (addCommonCodeGenPasses(PM, OptLevel))
+  if (addCommonCodeGenPasses(PM, OptLevel, DisableVerify))
     return true;
 
   addCodeEmitter(PM, OptLevel, JCE);
@@ -207,6 +212,12 @@ bool LLVMTargetMachine::addPassesToEmitMachineCode(PassManagerBase &PM,
   return false; // success!
 }
 
+static void printNoVerify(PassManagerBase &PM,
+                           const char *Banner) {
+  if (PrintMachineCode)
+    PM.add(createMachineFunctionPrinterPass(dbgs(), Banner));
+}
+
 static void printAndVerify(PassManagerBase &PM,
                            const char *Banner,
                            bool allowDoubleDefs = false) {
@@ -221,13 +232,19 @@ static void printAndVerify(PassManagerBase &PM,
 /// emitting to assembly files or machine code output.
 ///
 bool LLVMTargetMachine::addCommonCodeGenPasses(PassManagerBase &PM,
-                                               CodeGenOpt::Level OptLevel) {
+                                               CodeGenOpt::Level OptLevel,
+                                               bool DisableVerify) {
   // Standard LLVM-Level Passes.
 
+  // Before running any passes, run the verifier to determine if the input
+  // coming from the front-end and/or optimizer is valid.
+  if (!DisableVerify)
+    PM.add(createVerifierPass());
+
   // Optionally, tun split-GEPs and no-load GVN.
   if (EnableSplitGEPGVN) {
     PM.add(createGEPSplitterPass());
-    PM.add(createGVNPass(/*NoPRE=*/false, /*NoLoads=*/true));
+    PM.add(createGVNPass(/*NoLoads=*/true));
   }
 
   // Run loop strength reduction before anything else.
@@ -235,9 +252,6 @@ bool LLVMTargetMachine::addCommonCodeGenPasses(PassManagerBase &PM,
     PM.add(createLoopStrengthReducePass(getTargetLowering()));
     if (PrintLSR)
       PM.add(createPrintFunctionPass("\n\n*** Code after LSR ***\n", &dbgs()));
-#ifndef NDEBUG
-    PM.add(createVerifierPass());
-#endif
   }
 
   // Turn exception handling constructs into something the code generators can
@@ -277,6 +291,11 @@ bool LLVMTargetMachine::addCommonCodeGenPasses(PassManagerBase &PM,
                                    "*** Final LLVM Code input to ISel ***\n",
                                    &dbgs()));
 
+  // All passes which modify the LLVM IR are now complete; run the verifier
+  // to ensure that the IR is valid.
+  if (!DisableVerify)
+    PM.add(createVerifierPass());
+
   // Standard Lower-Level Passes.
 
   // Set up a MachineFunction for the rest of CodeGen to work on.
@@ -309,6 +328,8 @@ bool LLVMTargetMachine::addCommonCodeGenPasses(PassManagerBase &PM,
     PM.add(createOptimizeExtsPass());
     if (!DisableMachineLICM)
       PM.add(createMachineLICMPass());
+    if (EnableMachineCSE)
+      PM.add(createMachineCSEPass());
     if (!DisableMachineSink)
       PM.add(createMachineSinkingPass());
     printAndVerify(PM, "After MachineLICM and MachineSinking",
@@ -363,13 +384,13 @@ bool LLVMTargetMachine::addCommonCodeGenPasses(PassManagerBase &PM,
   // Branch folding must be run after regalloc and prolog/epilog insertion.
   if (OptLevel != CodeGenOpt::None && !DisableBranchFold) {
     PM.add(createBranchFoldingPass(getEnableTailMergeDefault()));
-    printAndVerify(PM, "After BranchFolding");
+    printNoVerify(PM, "After BranchFolding");
   }
 
   // Tail duplication.
   if (OptLevel != CodeGenOpt::None && !DisableTailDuplicate) {
     PM.add(createTailDuplicatePass(false));
-    printAndVerify(PM, "After TailDuplicate");
+    printNoVerify(PM, "After TailDuplicate");
   }
 
   PM.add(createGCMachineCodeAnalysisPass());
@@ -379,11 +400,11 @@ bool LLVMTargetMachine::addCommonCodeGenPasses(PassManagerBase &PM,
 
   if (OptLevel != CodeGenOpt::None && !DisableCodePlace) {
     PM.add(createCodePlacementOptPass());
-    printAndVerify(PM, "After CodePlacementOpt");
+    printNoVerify(PM, "After CodePlacementOpt");
   }
 
   if (addPreEmitPass(PM, OptLevel))
-    printAndVerify(PM, "After PreEmit passes");
+    printNoVerify(PM, "After PreEmit passes");
 
   return false;
 }
diff --git a/libclamav/c++/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp b/libclamav/c++/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
index f6bf433..ccda66f 100644
--- a/libclamav/c++/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
+++ b/libclamav/c++/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
@@ -329,24 +329,43 @@ void LiveIntervals::handleVirtualRegisterDef(MachineBasicBlock *mbb,
     DEBUG(dbgs() << " +" << NewLR);
     interval.addRange(NewLR);
 
-    // Iterate over all of the blocks that the variable is completely
-    // live in, adding [insrtIndex(begin), instrIndex(end)+4) to the
-    // live interval.
-    for (SparseBitVector<>::iterator I = vi.AliveBlocks.begin(), 
-             E = vi.AliveBlocks.end(); I != E; ++I) {
-      MachineBasicBlock *aliveBlock = mf_->getBlockNumbered(*I);
-      LiveRange LR(getMBBStartIdx(aliveBlock), getMBBEndIdx(aliveBlock), ValNo);
-      interval.addRange(LR);
-      DEBUG(dbgs() << " +" << LR);
+    bool PHIJoin = lv_->isPHIJoin(interval.reg);
+
+    if (PHIJoin) {
+      // A phi join register is killed at the end of the MBB and revived as a new
+      // valno in the killing blocks.
+      assert(vi.AliveBlocks.empty() && "Phi join can't pass through blocks");
+      DEBUG(dbgs() << " phi-join");
+      ValNo->addKill(indexes_->getTerminatorGap(mbb));
+      ValNo->setHasPHIKill(true);
+    } else {
+      // Iterate over all of the blocks that the variable is completely
+      // live in, adding [insrtIndex(begin), instrIndex(end)+4) to the
+      // live interval.
+      for (SparseBitVector<>::iterator I = vi.AliveBlocks.begin(),
+               E = vi.AliveBlocks.end(); I != E; ++I) {
+        MachineBasicBlock *aliveBlock = mf_->getBlockNumbered(*I);
+        LiveRange LR(getMBBStartIdx(aliveBlock), getMBBEndIdx(aliveBlock), ValNo);
+        interval.addRange(LR);
+        DEBUG(dbgs() << " +" << LR);
+      }
     }
 
     // Finally, this virtual register is live from the start of any killing
     // block to the 'use' slot of the killing instruction.
     for (unsigned i = 0, e = vi.Kills.size(); i != e; ++i) {
       MachineInstr *Kill = vi.Kills[i];
-      SlotIndex killIdx =
-        getInstructionIndex(Kill).getDefIndex();
-      LiveRange LR(getMBBStartIdx(Kill->getParent()), killIdx, ValNo);
+      SlotIndex Start = getMBBStartIdx(Kill->getParent());
+      SlotIndex killIdx = getInstructionIndex(Kill).getDefIndex();
+
+      // Create interval with one of a NEW value number.  Note that this value
+      // number isn't actually defined by an instruction, weird huh? :)
+      if (PHIJoin) {
+        ValNo = interval.getNextValue(SlotIndex(Start, true), 0, false,
+                                      VNInfoAllocator);
+        ValNo->setIsPHIDef(true);
+      }
+      LiveRange LR(Start, killIdx, ValNo);
       interval.addRange(LR);
       ValNo->addKill(killIdx);
       DEBUG(dbgs() << " +" << LR);
@@ -409,48 +428,11 @@ void LiveIntervals::handleVirtualRegisterDef(MachineBasicBlock *mbb,
           interval.print(dbgs(), tri_);
         });
     } else {
-      // Otherwise, this must be because of phi elimination.  If this is the
-      // first redefinition of the vreg that we have seen, go back and change
-      // the live range in the PHI block to be a different value number.
-      if (interval.containsOneValue()) {
-
-        VNInfo *VNI = interval.getValNumInfo(0);
-        // Phi elimination may have reused the register for multiple identical
-        // phi nodes. There will be a kill per phi. Remove the old ranges that
-        // we now know have an incorrect number.
-        for (unsigned ki=0, ke=vi.Kills.size(); ki != ke; ++ki) {
-          MachineInstr *Killer = vi.Kills[ki];
-          SlotIndex Start = getMBBStartIdx(Killer->getParent());
-          SlotIndex End = getInstructionIndex(Killer).getDefIndex();
-          DEBUG({
-              dbgs() << "\n\t\trenaming [" << Start << "," << End << "] in: ";
-              interval.print(dbgs(), tri_);
-            });
-          interval.removeRange(Start, End);
-
-          // Replace the interval with one of a NEW value number.  Note that
-          // this value number isn't actually defined by an instruction, weird
-          // huh? :)
-          LiveRange LR(Start, End,
-                       interval.getNextValue(SlotIndex(Start, true),
-                                             0, false, VNInfoAllocator));
-          LR.valno->setIsPHIDef(true);
-          interval.addRange(LR);
-          LR.valno->addKill(End);
-        }
-
-        MachineBasicBlock *killMBB = getMBBFromIndex(VNI->def);
-        VNI->addKill(indexes_->getTerminatorGap(killMBB));
-        VNI->setHasPHIKill(true);
-        DEBUG({
-            dbgs() << " RESULT: ";
-            interval.print(dbgs(), tri_);
-          });
-      }
-
+      assert(lv_->isPHIJoin(interval.reg) && "Multiply defined register");
       // In the case of PHI elimination, each variable definition is only
       // live until the end of the block.  We've already taken care of the
       // rest of the live range.
+
       SlotIndex defIndex = MIIdx.getDefIndex();
       if (MO.isEarlyClobber())
         defIndex = MIIdx.getUseIndex();
@@ -468,7 +450,7 @@ void LiveIntervals::handleVirtualRegisterDef(MachineBasicBlock *mbb,
       interval.addRange(LR);
       ValNo->addKill(indexes_->getTerminatorGap(mbb));
       ValNo->setHasPHIKill(true);
-      DEBUG(dbgs() << " +" << LR);
+      DEBUG(dbgs() << " phi-join +" << LR);
     }
   }
 
@@ -1358,11 +1340,9 @@ rewriteInstructionsForSpills(const LiveInterval &li, bool TrySplit,
     MachineBasicBlock *MBB = MI->getParent();
 
     if (ImpUse && MI != ReMatDefMI) {
-      // Re-matting an instruction with virtual register use. Update the
-      // register interval's spill weight to HUGE_VALF to prevent it from
-      // being spilled.
-      LiveInterval &ImpLi = getInterval(ImpUse);
-      ImpLi.weight = HUGE_VALF;
+      // Re-matting an instruction with virtual register use. Prevent interval
+      // from being spilled.
+      getInterval(ImpUse).markNotSpillable();
     }
 
     unsigned MBBId = MBB->getNumber();
@@ -1414,7 +1394,7 @@ rewriteInstructionsForSpills(const LiveInterval &li, bool TrySplit,
     LiveInterval &nI = getOrCreateInterval(NewVReg);
     if (!TrySplit) {
       // The spill weight is now infinity as it cannot be spilled again.
-      nI.weight = HUGE_VALF;
+      nI.markNotSpillable();
       continue;
     }
 
@@ -1562,6 +1542,28 @@ LiveIntervals::handleSpilledImpDefs(const LiveInterval &li, VirtRegMap &vrm,
   }
 }
 
+float
+LiveIntervals::getSpillWeight(bool isDef, bool isUse, unsigned loopDepth) {
+  // Limit the loop depth ridiculousness.
+  if (loopDepth > 200)
+    loopDepth = 200;
+
+  // The loop depth is used to roughly estimate the number of times the
+  // instruction is executed. Something like 10^d is simple, but will quickly
+  // overflow a float. This expression behaves like 10^d for small d, but is
+  // more tempered for large d. At d=200 we get 6.7e33 which leaves a bit of
+  // headroom before overflow.
+  float lc = powf(1 + (100.0f / (loopDepth+10)), (float)loopDepth);
+
+  return (isDef + isUse) * lc;
+}
+
+void
+LiveIntervals::normalizeSpillWeights(std::vector<LiveInterval*> &NewLIs) {
+  for (unsigned i = 0, e = NewLIs.size(); i != e; ++i)
+    normalizeSpillWeight(*NewLIs[i]);
+}
+
 std::vector<LiveInterval*> LiveIntervals::
 addIntervalsForSpillsFast(const LiveInterval &li,
                           const MachineLoopInfo *loopInfo,
@@ -1570,8 +1572,7 @@ addIntervalsForSpillsFast(const LiveInterval &li,
 
   std::vector<LiveInterval*> added;
 
-  assert(li.weight != HUGE_VALF &&
-         "attempt to spill already spilled interval!");
+  assert(li.isSpillable() && "attempt to spill already spilled interval!");
 
   DEBUG({
       dbgs() << "\t\t\t\tadding intervals for spills for interval: ";
@@ -1607,10 +1608,7 @@ addIntervalsForSpillsFast(const LiveInterval &li,
       
       // create a new register for this spill
       LiveInterval &nI = getOrCreateInterval(NewVReg);
-
-      // the spill weight is now infinity as it
-      // cannot be spilled again
-      nI.weight = HUGE_VALF;
+      nI.markNotSpillable();
       
       // Rewrite register operands to use the new vreg.
       for (SmallVectorImpl<unsigned>::iterator I = Indices.begin(),
@@ -1664,8 +1662,7 @@ addIntervalsForSpills(const LiveInterval &li,
   if (EnableFastSpilling)
     return addIntervalsForSpillsFast(li, loopInfo, vrm);
   
-  assert(li.weight != HUGE_VALF &&
-         "attempt to spill already spilled interval!");
+  assert(li.isSpillable() && "attempt to spill already spilled interval!");
 
   DEBUG({
       dbgs() << "\t\t\t\tadding intervals for spills for interval: ";
@@ -1739,6 +1736,7 @@ addIntervalsForSpills(const LiveInterval &li,
     }
 
     handleSpilledImpDefs(li, vrm, rc, NewLIs);
+    normalizeSpillWeights(NewLIs);
     return NewLIs;
   }
 
@@ -1814,6 +1812,7 @@ addIntervalsForSpills(const LiveInterval &li,
   // Insert spills / restores if we are splitting.
   if (!TrySplit) {
     handleSpilledImpDefs(li, vrm, rc, NewLIs);
+    normalizeSpillWeights(NewLIs);
     return NewLIs;
   }
 
@@ -1930,11 +1929,10 @@ addIntervalsForSpills(const LiveInterval &li,
             unsigned ImpUse = getReMatImplicitUse(li, ReMatDefMI);
             if (ImpUse) {
               // Re-matting an instruction with virtual register use. Add the
-              // register as an implicit use on the use MI and update the register
-              // interval's spill weight to HUGE_VALF to prevent it from being
-              // spilled.
+              // register as an implicit use on the use MI and mark the register
+              // interval as unspillable.
               LiveInterval &ImpLi = getInterval(ImpUse);
-              ImpLi.weight = HUGE_VALF;
+              ImpLi.markNotSpillable();
               MI->addOperand(MachineOperand::CreateReg(ImpUse, false, true));
             }
           }
@@ -1973,6 +1971,7 @@ addIntervalsForSpills(const LiveInterval &li,
   }
 
   handleSpilledImpDefs(li, vrm, rc, RetNewLIs);
+  normalizeSpillWeights(RetNewLIs);
   return RetNewLIs;
 }
 
diff --git a/libclamav/c++/llvm/lib/CodeGen/LiveVariables.cpp b/libclamav/c++/llvm/lib/CodeGen/LiveVariables.cpp
index 8a124dc..519990e 100644
--- a/libclamav/c++/llvm/lib/CodeGen/LiveVariables.cpp
+++ b/libclamav/c++/llvm/lib/CodeGen/LiveVariables.cpp
@@ -365,27 +365,7 @@ bool LiveVariables::HandlePhysRegKill(unsigned Reg, MachineInstr *MI) {
     }
   }
 
-  if (LastRefOrPartRef == PhysRegDef[Reg] && LastRefOrPartRef != MI) {
-    if (LastPartDef)
-      // The last partial def kills the register.
-      LastPartDef->addOperand(MachineOperand::CreateReg(Reg, false/*IsDef*/,
-                                                true/*IsImp*/, true/*IsKill*/));
-    else {
-      MachineOperand *MO =
-        LastRefOrPartRef->findRegisterDefOperand(Reg, false, TRI);
-      bool NeedEC = MO->isEarlyClobber() && MO->getReg() != Reg;
-      // If the last reference is the last def, then it's not used at all.
-      // That is, unless we are currently processing the last reference itself.
-      LastRefOrPartRef->addRegisterDead(Reg, TRI, true);
-      if (NeedEC) {
-        // If we are adding a subreg def and the superreg def is marked early
-        // clobber, add an early clobber marker to the subreg def.
-        MO = LastRefOrPartRef->findRegisterDefOperand(Reg);
-        if (MO)
-          MO->setIsEarlyClobber();
-      }
-    }
-  } else if (!PhysRegUse[Reg]) {
+  if (!PhysRegUse[Reg]) {
     // Partial uses. Mark register def dead and add implicit def of
     // sub-registers which are used.
     // EAX<dead>  = op  AL<imp-def>
@@ -419,6 +399,26 @@ bool LiveVariables::HandlePhysRegKill(unsigned Reg, MachineInstr *MI) {
       for (const unsigned *SS = TRI->getSubRegisters(SubReg); *SS; ++SS)
         PartUses.erase(*SS);
     }
+  } else if (LastRefOrPartRef == PhysRegDef[Reg] && LastRefOrPartRef != MI) {
+    if (LastPartDef)
+      // The last partial def kills the register.
+      LastPartDef->addOperand(MachineOperand::CreateReg(Reg, false/*IsDef*/,
+                                                true/*IsImp*/, true/*IsKill*/));
+    else {
+      MachineOperand *MO =
+        LastRefOrPartRef->findRegisterDefOperand(Reg, false, TRI);
+      bool NeedEC = MO->isEarlyClobber() && MO->getReg() != Reg;
+      // If the last reference is the last def, then it's not used at all.
+      // That is, unless we are currently processing the last reference itself.
+      LastRefOrPartRef->addRegisterDead(Reg, TRI, true);
+      if (NeedEC) {
+        // If we are adding a subreg def and the superreg def is marked early
+        // clobber, add an early clobber marker to the subreg def.
+        MO = LastRefOrPartRef->findRegisterDefOperand(Reg);
+        if (MO)
+          MO->setIsEarlyClobber();
+      }
+    }
   } else
     LastRefOrPartRef->addRegisterKilled(Reg, TRI, true);
   return true;
@@ -510,6 +510,7 @@ bool LiveVariables::runOnMachineFunction(MachineFunction &mf) {
   PHIVarInfo = new SmallVector<unsigned, 4>[MF->getNumBlockIDs()];
   std::fill(PhysRegDef,  PhysRegDef  + NumRegs, (MachineInstr*)0);
   std::fill(PhysRegUse,  PhysRegUse  + NumRegs, (MachineInstr*)0);
+  PHIJoins.clear();
 
   /// Get some space for a respectable number of registers.
   VirtRegInfo.resize(64);
diff --git a/libclamav/c++/llvm/lib/CodeGen/MachineBasicBlock.cpp b/libclamav/c++/llvm/lib/CodeGen/MachineBasicBlock.cpp
index 655a0bf..64134ce 100644
--- a/libclamav/c++/llvm/lib/CodeGen/MachineBasicBlock.cpp
+++ b/libclamav/c++/llvm/lib/CodeGen/MachineBasicBlock.cpp
@@ -143,36 +143,6 @@ MachineBasicBlock::iterator MachineBasicBlock::getFirstTerminator() {
   return I;
 }
 
-/// isOnlyReachableViaFallthough - Return true if this basic block has
-/// exactly one predecessor and the control transfer mechanism between
-/// the predecessor and this block is a fall-through.
-bool MachineBasicBlock::isOnlyReachableByFallthrough() const {
-  // If this is a landing pad, it isn't a fall through.  If it has no preds,
-  // then nothing falls through to it.
-  if (isLandingPad() || pred_empty())
-    return false;
-  
-  // If there isn't exactly one predecessor, it can't be a fall through.
-  const_pred_iterator PI = pred_begin(), PI2 = PI;
-  ++PI2;
-  if (PI2 != pred_end())
-    return false;
-  
-  // The predecessor has to be immediately before this block.
-  const MachineBasicBlock *Pred = *PI;
-  
-  if (!Pred->isLayoutSuccessor(this))
-    return false;
-  
-  // If the block is completely empty, then it definitely does fall through.
-  if (Pred->empty())
-    return true;
-  
-  // Otherwise, check the last instruction.
-  const MachineInstr &LastInst = Pred->back();
-  return !LastInst.getDesc().isBarrier();
-}
-
 void MachineBasicBlock::dump() const {
   print(dbgs());
 }
diff --git a/libclamav/c++/llvm/lib/CodeGen/MachineCSE.cpp b/libclamav/c++/llvm/lib/CodeGen/MachineCSE.cpp
new file mode 100644
index 0000000..b376e3d
--- /dev/null
+++ b/libclamav/c++/llvm/lib/CodeGen/MachineCSE.cpp
@@ -0,0 +1,268 @@
+//===-- MachineCSE.cpp - Machine Common Subexpression Elimination Pass ----===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This pass performs global common subexpression elimination on machine
+// instructions using a scoped hash table based value numbering scheme. It
+// must be run while the machine function is still in SSA form.
+//
+//===----------------------------------------------------------------------===//
+
+#define DEBUG_TYPE "machine-cse"
+#include "llvm/CodeGen/Passes.h"
+#include "llvm/CodeGen/MachineDominators.h"
+#include "llvm/CodeGen/MachineInstr.h"
+#include "llvm/CodeGen/MachineRegisterInfo.h"
+#include "llvm/Analysis/AliasAnalysis.h"
+#include "llvm/Target/TargetInstrInfo.h"
+#include "llvm/ADT/ScopedHashTable.h"
+#include "llvm/ADT/Statistic.h"
+#include "llvm/Support/Debug.h"
+
+using namespace llvm;
+
+STATISTIC(NumCoalesces, "Number of copies coalesced");
+STATISTIC(NumCSEs,      "Number of common subexpression eliminated");
+
+namespace {
+  class MachineCSE : public MachineFunctionPass {
+    const TargetInstrInfo *TII;
+    const TargetRegisterInfo *TRI;
+    MachineRegisterInfo  *MRI;
+    MachineDominatorTree *DT;
+    AliasAnalysis *AA;
+  public:
+    static char ID; // Pass identification
+    MachineCSE() : MachineFunctionPass(&ID), CurrVN(0) {}
+
+    virtual bool runOnMachineFunction(MachineFunction &MF);
+    
+    virtual void getAnalysisUsage(AnalysisUsage &AU) const {
+      AU.setPreservesCFG();
+      MachineFunctionPass::getAnalysisUsage(AU);
+      AU.addRequired<AliasAnalysis>();
+      AU.addRequired<MachineDominatorTree>();
+      AU.addPreserved<MachineDominatorTree>();
+    }
+
+  private:
+    unsigned CurrVN;
+    ScopedHashTable<MachineInstr*, unsigned, MachineInstrExpressionTrait> VNT;
+    SmallVector<MachineInstr*, 64> Exps;
+
+    bool PerformTrivialCoalescing(MachineInstr *MI, MachineBasicBlock *MBB);
+    bool isPhysDefTriviallyDead(unsigned Reg,
+                                MachineBasicBlock::const_iterator I,
+                                MachineBasicBlock::const_iterator E);
+    bool hasLivePhysRegDefUse(MachineInstr *MI, MachineBasicBlock *MBB);
+    bool isCSECandidate(MachineInstr *MI);
+    bool ProcessBlock(MachineDomTreeNode *Node);
+  };
+} // end anonymous namespace
+
+char MachineCSE::ID = 0;
+static RegisterPass<MachineCSE>
+X("machine-cse", "Machine Common Subexpression Elimination");
+
+FunctionPass *llvm::createMachineCSEPass() { return new MachineCSE(); }
+
+bool MachineCSE::PerformTrivialCoalescing(MachineInstr *MI,
+                                          MachineBasicBlock *MBB) {
+  bool Changed = false;
+  for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
+    MachineOperand &MO = MI->getOperand(i);
+    if (!MO.isReg() || !MO.isUse())
+      continue;
+    unsigned Reg = MO.getReg();
+    if (!Reg || TargetRegisterInfo::isPhysicalRegister(Reg))
+      continue;
+    if (!MRI->hasOneUse(Reg))
+      // Only coalesce single use copies. This ensure the copy will be
+      // deleted.
+      continue;
+    MachineInstr *DefMI = MRI->getVRegDef(Reg);
+    if (DefMI->getParent() != MBB)
+      continue;
+    unsigned SrcReg, DstReg, SrcSubIdx, DstSubIdx;
+    if (TII->isMoveInstr(*DefMI, SrcReg, DstReg, SrcSubIdx, DstSubIdx) &&
+        TargetRegisterInfo::isVirtualRegister(SrcReg) &&
+        !SrcSubIdx && !DstSubIdx) {
+      MO.setReg(SrcReg);
+      DefMI->eraseFromParent();
+      ++NumCoalesces;
+      Changed = true;
+    }
+  }
+
+  return Changed;
+}
+
+bool MachineCSE::isPhysDefTriviallyDead(unsigned Reg,
+                                        MachineBasicBlock::const_iterator I,
+                                        MachineBasicBlock::const_iterator E) {
+  unsigned LookAheadLeft = 5;
+  while (LookAheadLeft--) {
+    if (I == E)
+      // Reached end of block, register is obviously dead.
+      return true;
+
+    if (I->isDebugValue())
+      continue;
+    bool SeenDef = false;
+    for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i) {
+      const MachineOperand &MO = I->getOperand(i);
+      if (!MO.isReg() || !MO.getReg())
+        continue;
+      if (!TRI->regsOverlap(MO.getReg(), Reg))
+        continue;
+      if (MO.isUse())
+        return false;
+      SeenDef = true;
+    }
+    if (SeenDef)
+      // See a def of Reg (or an alias) before encountering any use, it's 
+      // trivially dead.
+      return true;
+    ++I;
+  }
+  return false;
+}
+
+bool MachineCSE::hasLivePhysRegDefUse(MachineInstr *MI, MachineBasicBlock *MBB){
+  unsigned PhysDef = 0;
+  for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
+    MachineOperand &MO = MI->getOperand(i);
+    if (!MO.isReg())
+      continue;
+    unsigned Reg = MO.getReg();
+    if (!Reg)
+      continue;
+    if (TargetRegisterInfo::isPhysicalRegister(Reg)) {
+      if (MO.isUse())
+        // Can't touch anything to read a physical register.
+        return true;
+      if (MO.isDead())
+        // If the def is dead, it's ok.
+        continue;
+      // Ok, this is a physical register def that's not marked "dead". That's
+      // common since this pass is run before livevariables. We can scan
+      // forward a few instructions and check if it is obviously dead.
+      if (PhysDef)
+        // Multiple physical register defs. These are rare, forget about it.
+        return true;
+      PhysDef = Reg;
+    }
+  }
+
+  if (PhysDef) {
+    MachineBasicBlock::iterator I = MI; I = llvm::next(I);
+    if (!isPhysDefTriviallyDead(PhysDef, I, MBB->end()))
+      return true;
+  }
+  return false;
+}
+
+bool MachineCSE::isCSECandidate(MachineInstr *MI) {
+  // Ignore copies or instructions that read / write physical registers
+  // (except for dead defs of physical registers).
+  unsigned SrcReg, DstReg, SrcSubIdx, DstSubIdx;
+  if (TII->isMoveInstr(*MI, SrcReg, DstReg, SrcSubIdx, DstSubIdx) ||
+      MI->isExtractSubreg() || MI->isInsertSubreg() || MI->isSubregToReg())
+    return false;
+
+  // Ignore stuff that we obviously can't move.
+  const TargetInstrDesc &TID = MI->getDesc();  
+  if (TID.mayStore() || TID.isCall() || TID.isTerminator() ||
+      TID.hasUnmodeledSideEffects())
+    return false;
+
+  if (TID.mayLoad()) {
+    // Okay, this instruction does a load. As a refinement, we allow the target
+    // to decide whether the loaded value is actually a constant. If so, we can
+    // actually use it as a load.
+    if (!MI->isInvariantLoad(AA))
+      // FIXME: we should be able to hoist loads with no other side effects if
+      // there are no other instructions which can change memory in this loop.
+      // This is a trivial form of alias analysis.
+      return false;
+  }
+  return true;
+}
+
+bool MachineCSE::ProcessBlock(MachineDomTreeNode *Node) {
+  bool Changed = false;
+
+  ScopedHashTableScope<MachineInstr*, unsigned,
+    MachineInstrExpressionTrait> VNTS(VNT);
+  MachineBasicBlock *MBB = Node->getBlock();
+  for (MachineBasicBlock::iterator I = MBB->begin(), E = MBB->end(); I != E; ) {
+    MachineInstr *MI = &*I;
+    ++I;
+
+    if (!isCSECandidate(MI))
+      continue;
+
+    bool FoundCSE = VNT.count(MI);
+    if (!FoundCSE) {
+      // Look for trivial copy coalescing opportunities.
+      if (PerformTrivialCoalescing(MI, MBB))
+        FoundCSE = VNT.count(MI);
+    }
+    // FIXME: commute commutable instructions?
+
+    // If the instruction defines a physical register and the value *may* be
+    // used, then it's not safe to replace it with a common subexpression.
+    if (FoundCSE && hasLivePhysRegDefUse(MI, MBB))
+      FoundCSE = false;
+
+    if (!FoundCSE) {
+      VNT.insert(MI, CurrVN++);
+      Exps.push_back(MI);
+      continue;
+    }
+
+    // Found a common subexpression, eliminate it.
+    unsigned CSVN = VNT.lookup(MI);
+    MachineInstr *CSMI = Exps[CSVN];
+    DEBUG(dbgs() << "Examining: " << *MI);
+    DEBUG(dbgs() << "*** Found a common subexpression: " << *CSMI);
+    unsigned NumDefs = MI->getDesc().getNumDefs();
+    for (unsigned i = 0, e = MI->getNumOperands(); NumDefs && i != e; ++i) {
+      MachineOperand &MO = MI->getOperand(i);
+      if (!MO.isReg() || !MO.isDef())
+        continue;
+      unsigned OldReg = MO.getReg();
+      unsigned NewReg = CSMI->getOperand(i).getReg();
+      if (OldReg == NewReg)
+        continue;
+      assert(TargetRegisterInfo::isVirtualRegister(OldReg) &&
+             TargetRegisterInfo::isVirtualRegister(NewReg) &&
+             "Do not CSE physical register defs!");
+      MRI->replaceRegWith(OldReg, NewReg);
+      --NumDefs;
+    }
+    MI->eraseFromParent();
+    ++NumCSEs;
+  }
+
+  // Recursively call ProcessBlock with childred.
+  const std::vector<MachineDomTreeNode*> &Children = Node->getChildren();
+  for (unsigned i = 0, e = Children.size(); i != e; ++i)
+    Changed |= ProcessBlock(Children[i]);
+
+  return Changed;
+}
+
+bool MachineCSE::runOnMachineFunction(MachineFunction &MF) {
+  TII = MF.getTarget().getInstrInfo();
+  TRI = MF.getTarget().getRegisterInfo();
+  MRI = &MF.getRegInfo();
+  DT = &getAnalysis<MachineDominatorTree>();
+  AA = &getAnalysis<AliasAnalysis>();
+  return ProcessBlock(DT->getRootNode());
+}
diff --git a/libclamav/c++/llvm/lib/CodeGen/MachineFunction.cpp b/libclamav/c++/llvm/lib/CodeGen/MachineFunction.cpp
index f141c56..4377d5b 100644
--- a/libclamav/c++/llvm/lib/CodeGen/MachineFunction.cpp
+++ b/libclamav/c++/llvm/lib/CodeGen/MachineFunction.cpp
@@ -95,6 +95,9 @@ MachineFunction::MachineFunction(Function *F, const TargetMachine &TM,
   MFInfo = 0;
   FrameInfo = new (Allocator.Allocate<MachineFrameInfo>())
                   MachineFrameInfo(*TM.getFrameInfo());
+  if (Fn->hasFnAttr(Attribute::StackAlignment))
+    FrameInfo->setMaxAlignment(Attribute::getStackAlignmentFromAttrs(
+        Fn->getAttributes().getFnAttributes()));
   ConstantPool = new (Allocator.Allocate<MachineConstantPool>())
                      MachineConstantPool(TM.getTargetData());
   Alignment = TM.getTargetLowering()->getFunctionAlignment(F);
diff --git a/libclamav/c++/llvm/lib/CodeGen/MachineInstr.cpp b/libclamav/c++/llvm/lib/CodeGen/MachineInstr.cpp
index df61c74..e23670d 100644
--- a/libclamav/c++/llvm/lib/CodeGen/MachineInstr.cpp
+++ b/libclamav/c++/llvm/lib/CodeGen/MachineInstr.cpp
@@ -18,6 +18,7 @@
 #include "llvm/Type.h"
 #include "llvm/Value.h"
 #include "llvm/Assembly/Writer.h"
+#include "llvm/CodeGen/MachineConstantPool.h"
 #include "llvm/CodeGen/MachineFunction.h"
 #include "llvm/CodeGen/MachineMemOperand.h"
 #include "llvm/CodeGen/MachineRegisterInfo.h"
@@ -305,7 +306,7 @@ void MachineOperand::print(raw_ostream &OS, const TargetMachine *TM) const {
 MachineMemOperand::MachineMemOperand(const Value *v, unsigned int f,
                                      int64_t o, uint64_t s, unsigned int a)
   : Offset(o), Size(s), V(v),
-    Flags((f & 7) | ((Log2_32(a) + 1) << 3)) {
+    Flags((f & ((1 << MOMaxBits) - 1)) | ((Log2_32(a) + 1) << MOMaxBits)) {
   assert(getBaseAlignment() == a && "Alignment is not a power of 2!");
   assert((isLoad() || isStore()) && "Not a load/store!");
 }
@@ -327,7 +328,8 @@ void MachineMemOperand::refineAlignment(const MachineMemOperand *MMO) {
 
   if (MMO->getBaseAlignment() >= getBaseAlignment()) {
     // Update the alignment value.
-    Flags = (Flags & 7) | ((Log2_32(MMO->getBaseAlignment()) + 1) << 3);
+    Flags = (Flags & ((1 << MOMaxBits) - 1)) |
+      ((Log2_32(MMO->getBaseAlignment()) + 1) << MOMaxBits);
     // Also update the base and offset, because the new alignment may
     // not be applicable with the old ones.
     V = MMO->getValue();
@@ -700,6 +702,35 @@ void MachineInstr::addMemOperand(MachineFunction &MF,
   MemRefsEnd = NewMemRefsEnd;
 }
 
+bool MachineInstr::isIdenticalTo(const MachineInstr *Other,
+                                 MICheckType Check) const {
+  // If opcodes or number of operands are not the same then the two
+  // instructions are obviously not identical.
+  if (Other->getOpcode() != getOpcode() ||
+      Other->getNumOperands() != getNumOperands())
+    return false;
+
+  // Check operands to make sure they match.
+  for (unsigned i = 0, e = getNumOperands(); i != e; ++i) {
+    const MachineOperand &MO = getOperand(i);
+    const MachineOperand &OMO = Other->getOperand(i);
+    // Clients may or may not want to ignore defs when testing for equality.
+    // For example, machine CSE pass only cares about finding common
+    // subexpressions, so it's safe to ignore virtual register defs.
+    if (Check != CheckDefs && MO.isReg() && MO.isDef()) {
+      if (Check == IgnoreDefs)
+        continue;
+      // Check == IgnoreVRegDefs
+      if (TargetRegisterInfo::isPhysicalRegister(MO.getReg()) ||
+          TargetRegisterInfo::isPhysicalRegister(OMO.getReg()))
+        if (MO.getReg() != OMO.getReg())
+          return false;
+    } else if (!MO.isIdenticalTo(OMO))
+      return false;
+  }
+  return true;
+}
+
 /// removeFromParent - This method unlinks 'this' from the containing basic
 /// block, and returns it, but does not delete it.
 MachineInstr *MachineInstr::removeFromParent() {
@@ -958,8 +989,8 @@ void MachineInstr::copyPredicates(const MachineInstr *MI) {
 /// SawStore is set to true, it means that there is a store (or call) between
 /// the instruction's location and its intended destination.
 bool MachineInstr::isSafeToMove(const TargetInstrInfo *TII,
-                                bool &SawStore,
-                                AliasAnalysis *AA) const {
+                                AliasAnalysis *AA,
+                                bool &SawStore) const {
   // Ignore stuff that we obviously can't move.
   if (TID->mayStore() || TID->isCall()) {
     SawStore = true;
@@ -984,11 +1015,11 @@ bool MachineInstr::isSafeToMove(const TargetInstrInfo *TII,
 /// isSafeToReMat - Return true if it's safe to rematerialize the specified
 /// instruction which defined the specified register instead of copying it.
 bool MachineInstr::isSafeToReMat(const TargetInstrInfo *TII,
-                                 unsigned DstReg,
-                                 AliasAnalysis *AA) const {
+                                 AliasAnalysis *AA,
+                                 unsigned DstReg) const {
   bool SawStore = false;
   if (!TII->isTriviallyReMaterializable(this, AA) ||
-      !isSafeToMove(TII, SawStore, AA))
+      !isSafeToMove(TII, AA, SawStore))
     return false;
   for (unsigned i = 0, e = getNumOperands(); i != e; ++i) {
     const MachineOperand &MO = getOperand(i);
@@ -1324,3 +1355,48 @@ void MachineInstr::addRegisterDefined(unsigned IncomingReg,
                                          true  /*IsDef*/,
                                          true  /*IsImp*/));
 }
+
+unsigned
+MachineInstrExpressionTrait::getHashValue(const MachineInstr* const &MI) {
+  unsigned Hash = MI->getOpcode() * 37;
+  for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
+    const MachineOperand &MO = MI->getOperand(i);
+    uint64_t Key = (uint64_t)MO.getType() << 32;
+    switch (MO.getType()) {
+      default: break;
+      case MachineOperand::MO_Register:
+        if (MO.isDef() && MO.getReg() &&
+            TargetRegisterInfo::isVirtualRegister(MO.getReg()))
+          continue;  // Skip virtual register defs.
+        Key |= MO.getReg();
+        break;
+      case MachineOperand::MO_Immediate:
+        Key |= MO.getImm();
+        break;
+      case MachineOperand::MO_FrameIndex:
+      case MachineOperand::MO_ConstantPoolIndex:
+      case MachineOperand::MO_JumpTableIndex:
+        Key |= MO.getIndex();
+        break;
+      case MachineOperand::MO_MachineBasicBlock:
+        Key |= DenseMapInfo<void*>::getHashValue(MO.getMBB());
+        break;
+      case MachineOperand::MO_GlobalAddress:
+        Key |= DenseMapInfo<void*>::getHashValue(MO.getGlobal());
+        break;
+      case MachineOperand::MO_BlockAddress:
+        Key |= DenseMapInfo<void*>::getHashValue(MO.getBlockAddress());
+        break;
+    }
+    Key += ~(Key << 32);
+    Key ^= (Key >> 22);
+    Key += ~(Key << 13);
+    Key ^= (Key >> 8);
+    Key += (Key << 3);
+    Key ^= (Key >> 15);
+    Key += ~(Key << 27);
+    Key ^= (Key >> 31);
+    Hash = (unsigned)Key + Hash * 37;
+  }
+  return Hash;
+}
diff --git a/libclamav/c++/llvm/lib/CodeGen/MachineLICM.cpp b/libclamav/c++/llvm/lib/CodeGen/MachineLICM.cpp
index 92c84f3..0361694 100644
--- a/libclamav/c++/llvm/lib/CodeGen/MachineLICM.cpp
+++ b/libclamav/c++/llvm/lib/CodeGen/MachineLICM.cpp
@@ -252,32 +252,6 @@ bool MachineLICM::IsLoopInvariantInst(MachineInstr &I) {
       return false;
   }
 
-  DEBUG({
-      dbgs() << "--- Checking if we can hoist " << I;
-      if (I.getDesc().getImplicitUses()) {
-        dbgs() << "  * Instruction has implicit uses:\n";
-
-        const TargetRegisterInfo *TRI = TM->getRegisterInfo();
-        for (const unsigned *ImpUses = I.getDesc().getImplicitUses();
-             *ImpUses; ++ImpUses)
-          dbgs() << "      -> " << TRI->getName(*ImpUses) << "\n";
-      }
-
-      if (I.getDesc().getImplicitDefs()) {
-        dbgs() << "  * Instruction has implicit defines:\n";
-
-        const TargetRegisterInfo *TRI = TM->getRegisterInfo();
-        for (const unsigned *ImpDefs = I.getDesc().getImplicitDefs();
-             *ImpDefs; ++ImpDefs)
-          dbgs() << "      -> " << TRI->getName(*ImpDefs) << "\n";
-      }
-    });
-
-  if (I.getDesc().getImplicitDefs() || I.getDesc().getImplicitUses()) {
-    DEBUG(dbgs() << "Cannot hoist with implicit defines or uses\n");
-    return false;
-  }
-
   // The instruction is loop invariant if all of its operands are.
   for (unsigned i = 0, e = I.getNumOperands(); i != e; ++i) {
     const MachineOperand &MO = I.getOperand(i);
@@ -311,6 +285,10 @@ bool MachineLICM::IsLoopInvariantInst(MachineInstr &I) {
       } else if (!MO.isDead()) {
         // A def that isn't dead. We can't move it.
         return false;
+      } else if (CurLoop->getHeader()->isLiveIn(Reg)) {
+        // If the reg is live into the loop, we can't hoist an instruction
+        // which would clobber it.
+        return false;
       }
     }
 
@@ -467,7 +445,7 @@ MachineLICM::LookForDuplicate(const MachineInstr *MI,
                               std::vector<const MachineInstr*> &PrevMIs) {
   for (unsigned i = 0, e = PrevMIs.size(); i != e; ++i) {
     const MachineInstr *PrevMI = PrevMIs[i];
-    if (TII->isIdentical(MI, PrevMI, RegInfo))
+    if (TII->produceSameValue(MI, PrevMI))
       return PrevMI;
   }
   return 0;
@@ -480,9 +458,20 @@ bool MachineLICM::EliminateCSE(MachineInstr *MI,
 
   if (const MachineInstr *Dup = LookForDuplicate(MI, CI->second)) {
     DEBUG(dbgs() << "CSEing " << *MI << " with " << *Dup);
+
+    // Replace virtual registers defined by MI by their counterparts defined
+    // by Dup.
     for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
       const MachineOperand &MO = MI->getOperand(i);
-      if (MO.isReg() && MO.isDef())
+
+      // Physical registers may not differ here.
+      assert((!MO.isReg() || MO.getReg() == 0 ||
+              !TargetRegisterInfo::isPhysicalRegister(MO.getReg()) ||
+              MO.getReg() == Dup->getOperand(i).getReg()) &&
+             "Instructions with different phys regs are not identical!");
+
+      if (MO.isReg() && MO.isDef() &&
+          !TargetRegisterInfo::isPhysicalRegister(MO.getReg()))
         RegInfo->replaceRegWith(MO.getReg(), Dup->getOperand(i).getReg());
     }
     MI->eraseFromParent();
diff --git a/libclamav/c++/llvm/lib/CodeGen/MachineModuleInfoImpls.cpp b/libclamav/c++/llvm/lib/CodeGen/MachineModuleInfoImpls.cpp
index 8378906..39d2c75 100644
--- a/libclamav/c++/llvm/lib/CodeGen/MachineModuleInfoImpls.cpp
+++ b/libclamav/c++/llvm/lib/CodeGen/MachineModuleInfoImpls.cpp
@@ -22,7 +22,7 @@ using namespace llvm;
 
 // Out of line virtual method.
 void MachineModuleInfoMachO::Anchor() {}
-
+void MachineModuleInfoELF::Anchor() {}
 
 static int SortSymbolPair(const void *LHS, const void *RHS) {
   const MCSymbol *LHSS =
@@ -34,10 +34,11 @@ static int SortSymbolPair(const void *LHS, const void *RHS) {
 
 /// GetSortedStubs - Return the entries from a DenseMap in a deterministic
 /// sorted orer.
-MachineModuleInfoMachO::SymbolListTy
-MachineModuleInfoMachO::GetSortedStubs(const DenseMap<MCSymbol*, 
-                                                      MCSymbol*> &Map) {
-  MachineModuleInfoMachO::SymbolListTy List(Map.begin(), Map.end());
+MachineModuleInfoImpl::SymbolListTy
+MachineModuleInfoImpl::GetSortedStubs(const DenseMap<MCSymbol*,
+                                                     MCSymbol*> &Map) {
+  MachineModuleInfoImpl::SymbolListTy List(Map.begin(), Map.end());
+
   if (!List.empty())
     qsort(&List[0], List.size(), sizeof(List[0]), SortSymbolPair);
   return List;
diff --git a/libclamav/c++/llvm/lib/CodeGen/MachineRegisterInfo.cpp b/libclamav/c++/llvm/lib/CodeGen/MachineRegisterInfo.cpp
index b31973e..d9ab677 100644
--- a/libclamav/c++/llvm/lib/CodeGen/MachineRegisterInfo.cpp
+++ b/libclamav/c++/llvm/lib/CodeGen/MachineRegisterInfo.cpp
@@ -116,6 +116,19 @@ MachineInstr *MachineRegisterInfo::getVRegDef(unsigned Reg) const {
   return 0;
 }
 
+bool MachineRegisterInfo::hasOneUse(unsigned RegNo) const {
+  use_iterator UI = use_begin(RegNo);
+  if (UI == use_end())
+    return false;
+  return ++UI == use_end();
+}
+
+bool MachineRegisterInfo::hasOneNonDBGUse(unsigned RegNo) const {
+  use_nodbg_iterator UI = use_nodbg_begin(RegNo);
+  if (UI == use_nodbg_end())
+    return false;
+  return ++UI == use_nodbg_end();
+}
 
 #ifndef NDEBUG
 void MachineRegisterInfo::dumpUses(unsigned Reg) const {
diff --git a/libclamav/c++/llvm/lib/CodeGen/MachineSink.cpp b/libclamav/c++/llvm/lib/CodeGen/MachineSink.cpp
index c391576..e47ba7c 100644
--- a/libclamav/c++/llvm/lib/CodeGen/MachineSink.cpp
+++ b/libclamav/c++/llvm/lib/CodeGen/MachineSink.cpp
@@ -72,8 +72,13 @@ bool MachineSinking::AllUsesDominatedByBlock(unsigned Reg,
                                              MachineBasicBlock *MBB) const {
   assert(TargetRegisterInfo::isVirtualRegister(Reg) &&
          "Only makes sense for vregs");
-  for (MachineRegisterInfo::use_iterator I = RegInfo->use_begin(Reg),
-       E = RegInfo->use_end(); I != E; ++I) {
+  // Ignoring debug uses is necessary so debug info doesn't affect the code.
+  // This may leave a referencing dbg_value in the original block, before
+  // the definition of the vreg.  Dwarf generator handles this although the
+  // user might not get the right info at runtime.
+  for (MachineRegisterInfo::use_nodbg_iterator I = 
+       RegInfo->use_nodbg_begin(Reg),
+       E = RegInfo->use_nodbg_end(); I != E; ++I) {
     // Determine the block of the use.
     MachineInstr *UseInst = &*I;
     MachineBasicBlock *UseBlock = UseInst->getParent();
@@ -135,7 +140,10 @@ bool MachineSinking::ProcessBlock(MachineBasicBlock &MBB) {
     ProcessedBegin = I == MBB.begin();
     if (!ProcessedBegin)
       --I;
-    
+
+    if (MI->isDebugValue())
+      continue;
+
     if (SinkInstruction(MI, SawStore))
       ++NumSunk, MadeChange = true;
     
@@ -149,7 +157,7 @@ bool MachineSinking::ProcessBlock(MachineBasicBlock &MBB) {
 /// instruction out of its current block into a successor.
 bool MachineSinking::SinkInstruction(MachineInstr *MI, bool &SawStore) {
   // Check if it's safe to move the instruction.
-  if (!MI->isSafeToMove(TII, SawStore, AA))
+  if (!MI->isSafeToMove(TII, AA, SawStore))
     return false;
   
   // FIXME: This should include support for sinking instructions within the
diff --git a/libclamav/c++/llvm/lib/CodeGen/PBQP/HeuristicSolver.h b/libclamav/c++/llvm/lib/CodeGen/PBQP/HeuristicSolver.h
index c156264..bd18b52 100644
--- a/libclamav/c++/llvm/lib/CodeGen/PBQP/HeuristicSolver.h
+++ b/libclamav/c++/llvm/lib/CodeGen/PBQP/HeuristicSolver.h
@@ -229,7 +229,7 @@ namespace PBQP {
     }
 
     /// \brief Apply rule R1.
-    /// @param nItr Node iterator for node to apply R1 to.
+    /// @param xnItr Node iterator for node to apply R1 to.
     ///
     /// Node will be automatically pushed to the solver stack.
     void applyR1(Graph::NodeItr xnItr) {
@@ -277,7 +277,7 @@ namespace PBQP {
     }
 
     /// \brief Apply rule R2.
-    /// @param nItr Node iterator for node to apply R2 to.
+    /// @param xnItr Node iterator for node to apply R2 to.
     ///
     /// Node will be automatically pushed to the solver stack.
     void applyR2(Graph::NodeItr xnItr) {
diff --git a/libclamav/c++/llvm/lib/CodeGen/PHIElimination.cpp b/libclamav/c++/llvm/lib/CodeGen/PHIElimination.cpp
index b740c68..8bbe0a7 100644
--- a/libclamav/c++/llvm/lib/CodeGen/PHIElimination.cpp
+++ b/libclamav/c++/llvm/lib/CodeGen/PHIElimination.cpp
@@ -55,8 +55,6 @@ void llvm::PHIElimination::getAnalysisUsage(AnalysisUsage &AU) const {
 bool llvm::PHIElimination::runOnMachineFunction(MachineFunction &Fn) {
   MRI = &Fn.getRegInfo();
 
-  PHIDefs.clear();
-  PHIKills.clear();
   bool Changed = false;
 
   // Split critical edges to help the coalescer
@@ -215,10 +213,6 @@ void llvm::PHIElimination::LowerAtomicPHINode(
     TII->copyRegToReg(MBB, AfterPHIsIt, DestReg, IncomingReg, RC, RC);
   }
 
-  // Record PHI def.
-  assert(!hasPHIDef(DestReg) && "Vreg has multiple phi-defs?");
-  PHIDefs[DestReg] = &MBB;
-
   // Update live variable information if there is any.
   LiveVariables *LV = getAnalysisIfAvailable<LiveVariables>();
   if (LV) {
@@ -229,6 +223,7 @@ void llvm::PHIElimination::LowerAtomicPHINode(
 
       // Increment use count of the newly created virtual register.
       VI.NumUses++;
+      LV->setPHIJoin(IncomingReg);
 
       // When we are reusing the incoming register, it may already have been
       // killed in this block. The old kill will also have been inserted at
@@ -276,9 +271,6 @@ void llvm::PHIElimination::LowerAtomicPHINode(
     // path the PHI.
     MachineBasicBlock &opBlock = *MPhi->getOperand(i*2+2).getMBB();
 
-    // Record the kill.
-    PHIKills[SrcReg].insert(&opBlock);
-
     // If source is defined by an implicit def, there is no need to insert a
     // copy.
     MachineInstr *DefMI = MRI->getVRegDef(SrcReg);
@@ -451,34 +443,3 @@ MachineBasicBlock *PHIElimination::SplitCriticalEdge(MachineBasicBlock *A,
 
   return NMBB;
 }
-
-unsigned
-PHIElimination::PHINodeTraits::getHashValue(const MachineInstr *MI) {
-  if (!MI || MI==getEmptyKey() || MI==getTombstoneKey())
-    return DenseMapInfo<MachineInstr*>::getHashValue(MI);
-  unsigned hash = 0;
-  for (unsigned ni = 1, ne = MI->getNumOperands(); ni != ne; ni += 2)
-    hash = hash*37 + DenseMapInfo<BBVRegPair>::
-      getHashValue(BBVRegPair(MI->getOperand(ni+1).getMBB()->getNumber(),
-                              MI->getOperand(ni).getReg()));
-  return hash;
-}
-
-bool PHIElimination::PHINodeTraits::isEqual(const MachineInstr *LHS,
-                                            const MachineInstr *RHS) {
-  const MachineInstr *EmptyKey = getEmptyKey();
-  const MachineInstr *TombstoneKey = getTombstoneKey();
-  if (!LHS || !RHS || LHS==EmptyKey || RHS==EmptyKey ||
-      LHS==TombstoneKey || RHS==TombstoneKey)
-    return LHS==RHS;
-
-  unsigned ne = LHS->getNumOperands();
-  if (ne != RHS->getNumOperands())
-      return false;
-  // Ignore operand 0, the defined register.
-  for (unsigned ni = 1; ni != ne; ni += 2)
-    if (LHS->getOperand(ni).getReg() != RHS->getOperand(ni).getReg() ||
-        LHS->getOperand(ni+1).getMBB() != RHS->getOperand(ni+1).getMBB())
-      return false;
-  return true;
-}
diff --git a/libclamav/c++/llvm/lib/CodeGen/PHIElimination.h b/libclamav/c++/llvm/lib/CodeGen/PHIElimination.h
index 895aaa4..7dedf03 100644
--- a/libclamav/c++/llvm/lib/CodeGen/PHIElimination.h
+++ b/libclamav/c++/llvm/lib/CodeGen/PHIElimination.h
@@ -22,17 +22,8 @@ namespace llvm {
   /// Lower PHI instructions to copies.  
   class PHIElimination : public MachineFunctionPass {
     MachineRegisterInfo  *MRI; // Machine register information
-  private:
-
-    typedef SmallSet<MachineBasicBlock*, 4> PHIKillList;
-    typedef DenseMap<unsigned, PHIKillList> PHIKillMap;
-    typedef DenseMap<unsigned, MachineBasicBlock*> PHIDefMap;
 
   public:
-
-    typedef PHIKillList::iterator phi_kill_iterator;
-    typedef PHIKillList::const_iterator const_phi_kill_iterator;
-
     static char ID; // Pass identification, replacement for typeid
     PHIElimination() : MachineFunctionPass(&ID) {}
 
@@ -40,38 +31,6 @@ namespace llvm {
     
     virtual void getAnalysisUsage(AnalysisUsage &AU) const;
 
-    /// Return true if the given vreg was defined by a PHI intsr prior to
-    /// lowering.
-    bool hasPHIDef(unsigned vreg) const {
-      return PHIDefs.count(vreg);
-    }
-
-    /// Returns the block in which the PHI instruction which defined the
-    /// given vreg used to reside. 
-    MachineBasicBlock* getPHIDefBlock(unsigned vreg) {
-      PHIDefMap::iterator phiDefItr = PHIDefs.find(vreg);
-      assert(phiDefItr != PHIDefs.end() && "vreg has no phi-def.");
-      return phiDefItr->second;
-    }
-
-    /// Returns true if the given vreg was killed by a PHI instr.
-    bool hasPHIKills(unsigned vreg) const {
-      return PHIKills.count(vreg);
-    }
-
-    /// Returns an iterator over the BasicBlocks which contained PHI
-    /// kills of this register prior to lowering.
-    phi_kill_iterator phiKillsBegin(unsigned vreg) {
-      PHIKillMap::iterator phiKillItr = PHIKills.find(vreg);
-      assert(phiKillItr != PHIKills.end() && "vreg has no phi-kills.");
-      return phiKillItr->second.begin();
-    } 
-    phi_kill_iterator phiKillsEnd(unsigned vreg) {
-      PHIKillMap::iterator phiKillItr = PHIKills.find(vreg);
-      assert(phiKillItr != PHIKills.end() && "vreg has no phi-kills.");
-      return phiKillItr->second.end();
-    }
-
   private:
     /// EliminatePHINodes - Eliminate phi nodes by inserting copy instructions
     /// in predecessor basic blocks.
@@ -109,12 +68,29 @@ namespace llvm {
     // SkipPHIsAndLabels - Copies need to be inserted after phi nodes and
     // also after any exception handling labels: in landing pads execution
     // starts at the label, so any copies placed before it won't be executed!
+    // We also deal with DBG_VALUEs, which are a bit tricky:
+    //  PHI
+    //  DBG_VALUE
+    //  LABEL
+    // Here the DBG_VALUE needs to be skipped, and if it refers to a PHI it
+    // needs to be annulled or, better, moved to follow the label, as well.
+    //  PHI
+    //  DBG_VALUE
+    //  no label
+    // Here it is not a good idea to skip the DBG_VALUE.
+    // FIXME: For now we skip and annul all DBG_VALUEs, maximally simple and
+    // maximally stupid.
     MachineBasicBlock::iterator SkipPHIsAndLabels(MachineBasicBlock &MBB,
                                                 MachineBasicBlock::iterator I) {
       // Rather than assuming that EH labels come before other kinds of labels,
       // just skip all labels.
-      while (I != MBB.end() && (I->isPHI() || I->isLabel()))
+      while (I != MBB.end() && 
+             (I->isPHI() || I->isLabel() || I->isDebugValue())) {
+        if (I->isDebugValue() && I->getNumOperands()==3 && 
+            I->getOperand(0).isReg())
+          I->getOperand(0).setReg(0U);
         ++I;
+      }
       return I;
     }
 
@@ -122,21 +98,13 @@ namespace llvm {
     typedef DenseMap<BBVRegPair, unsigned> VRegPHIUse;
 
     VRegPHIUse VRegPHIUseCount;
-    PHIDefMap PHIDefs;
-    PHIKillMap PHIKills;
 
     // Defs of PHI sources which are implicit_def.
     SmallPtrSet<MachineInstr*, 4> ImpDefs;
 
-    // Lowered PHI nodes may be reused. We provide special DenseMap traits to
-    // match PHI nodes with identical arguments.
-    struct PHINodeTraits : public DenseMapInfo<MachineInstr*> {
-      static unsigned getHashValue(const MachineInstr *PtrVal);
-      static bool isEqual(const MachineInstr *LHS, const MachineInstr *RHS);
-    };
-
     // Map reusable lowered PHI node -> incoming join register.
-    typedef DenseMap<MachineInstr*, unsigned, PHINodeTraits> LoweredPHIMap;
+    typedef DenseMap<MachineInstr*, unsigned,
+                     MachineInstrExpressionTrait> LoweredPHIMap;
     LoweredPHIMap LoweredPHIs;
   };
 
diff --git a/libclamav/c++/llvm/lib/CodeGen/Passes.cpp b/libclamav/c++/llvm/lib/CodeGen/Passes.cpp
index f67eb79..5ea2941 100644
--- a/libclamav/c++/llvm/lib/CodeGen/Passes.cpp
+++ b/libclamav/c++/llvm/lib/CodeGen/Passes.cpp
@@ -34,7 +34,7 @@ static cl::opt<RegisterRegAlloc::FunctionPassCtor, false,
                RegisterPassParser<RegisterRegAlloc> >
 RegAlloc("regalloc",
          cl::init(&createLinearScanRegisterAllocator),
-         cl::desc("Register allocator to use: (default = linearscan)")); 
+         cl::desc("Register allocator to use (default=linearscan)")); 
 
 
 //===---------------------------------------------------------------------===//
diff --git a/libclamav/c++/llvm/lib/CodeGen/PostRASchedulerList.cpp b/libclamav/c++/llvm/lib/CodeGen/PostRASchedulerList.cpp
index f43395f..424181c 100644
--- a/libclamav/c++/llvm/lib/CodeGen/PostRASchedulerList.cpp
+++ b/libclamav/c++/llvm/lib/CodeGen/PostRASchedulerList.cpp
@@ -460,6 +460,8 @@ void SchedulePostRATDList::FixupKills(MachineBasicBlock *MBB) {
   for (MachineBasicBlock::iterator I = MBB->end(), E = MBB->begin();
        I != E; --Count) {
     MachineInstr *MI = --I;
+    if (MI->isDebugValue())
+      continue;
 
     // Update liveness.  Registers that are defed but not used in this
     // instruction are now dead. Mark register and all subregs as they
diff --git a/libclamav/c++/llvm/lib/CodeGen/ProcessImplicitDefs.cpp b/libclamav/c++/llvm/lib/CodeGen/ProcessImplicitDefs.cpp
index e3df2e4..d7179b3 100644
--- a/libclamav/c++/llvm/lib/CodeGen/ProcessImplicitDefs.cpp
+++ b/libclamav/c++/llvm/lib/CodeGen/ProcessImplicitDefs.cpp
@@ -205,10 +205,9 @@ bool ProcessImplicitDefs::runOnMachineFunction(MachineFunction &fn) {
       // Process each use instruction once.
       for (MachineRegisterInfo::use_iterator UI = mri_->use_begin(Reg),
              UE = mri_->use_end(); UI != UE; ++UI) {
-        MachineInstr *RMI = &*UI;
-        MachineBasicBlock *RMBB = RMI->getParent();
-        if (RMBB == MBB)
+        if (UI.getOperand().isUndef())
           continue;
+        MachineInstr *RMI = &*UI;
         if (ModInsts.insert(RMI))
           RUses.push_back(RMI);
       }
diff --git a/libclamav/c++/llvm/lib/CodeGen/PrologEpilogInserter.cpp b/libclamav/c++/llvm/lib/CodeGen/PrologEpilogInserter.cpp
index 040259e..138e711 100644
--- a/libclamav/c++/llvm/lib/CodeGen/PrologEpilogInserter.cpp
+++ b/libclamav/c++/llvm/lib/CodeGen/PrologEpilogInserter.cpp
@@ -175,9 +175,10 @@ void PEI::calculateCallsInformation(MachineFunction &Fn) {
     MachineBasicBlock::iterator I = *i;
 
     // If call frames are not being included as part of the stack frame, and
-    // there is no dynamic allocation (therefore referencing frame slots off
-    // sp), leave the pseudo ops alone. We'll eliminate them later.
-    if (RegInfo->hasReservedCallFrame(Fn) || RegInfo->hasFP(Fn))
+    // the target doesn't indicate otherwise, remove the call frame pseudos
+    // here. The sub/add sp instruction pairs are still inserted, but we don't
+    // need to track the SP adjustment for frame index elimination.
+    if (RegInfo->canSimplifyCallFramePseudos(Fn))
       RegInfo->eliminateCallFramePseudoInstr(Fn, *I->getParent(), I);
   }
 }
diff --git a/libclamav/c++/llvm/lib/CodeGen/PseudoSourceValue.cpp b/libclamav/c++/llvm/lib/CodeGen/PseudoSourceValue.cpp
index 7fb3e6e..5e86e5a 100644
--- a/libclamav/c++/llvm/lib/CodeGen/PseudoSourceValue.cpp
+++ b/libclamav/c++/llvm/lib/CodeGen/PseudoSourceValue.cpp
@@ -18,19 +18,38 @@
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/ManagedStatic.h"
 #include "llvm/Support/raw_ostream.h"
+#include "llvm/System/Mutex.h"
 #include <map>
 using namespace llvm;
 
-static ManagedStatic<PseudoSourceValue[4]> PSVs;
+namespace {
+struct PSVGlobalsTy {
+  // PseudoSourceValues are immutable so don't need locking.
+  const PseudoSourceValue PSVs[4];
+  sys::Mutex Lock;  // Guards FSValues, but not the values inside it.
+  std::map<int, const PseudoSourceValue *> FSValues;
+
+  PSVGlobalsTy() : PSVs() {}
+  ~PSVGlobalsTy() {
+    for (std::map<int, const PseudoSourceValue *>::iterator
+           I = FSValues.begin(), E = FSValues.end(); I != E; ++I) {
+      delete I->second;
+    }
+  }
+};
+
+static ManagedStatic<PSVGlobalsTy> PSVGlobals;
+
+}  // anonymous namespace
 
 const PseudoSourceValue *PseudoSourceValue::getStack()
-{ return &(*PSVs)[0]; }
+{ return &PSVGlobals->PSVs[0]; }
 const PseudoSourceValue *PseudoSourceValue::getGOT()
-{ return &(*PSVs)[1]; }
+{ return &PSVGlobals->PSVs[1]; }
 const PseudoSourceValue *PseudoSourceValue::getJumpTable()
-{ return &(*PSVs)[2]; }
+{ return &PSVGlobals->PSVs[2]; }
 const PseudoSourceValue *PseudoSourceValue::getConstantPool()
-{ return &(*PSVs)[3]; }
+{ return &PSVGlobals->PSVs[3]; }
 
 static const char *const PSVNames[] = {
   "Stack",
@@ -48,13 +67,13 @@ PseudoSourceValue::PseudoSourceValue(enum ValueTy Subclass) :
         Subclass) {}
 
 void PseudoSourceValue::printCustom(raw_ostream &O) const {
-  O << PSVNames[this - *PSVs];
+  O << PSVNames[this - PSVGlobals->PSVs];
 }
 
-static ManagedStatic<std::map<int, const PseudoSourceValue *> > FSValues;
-
 const PseudoSourceValue *PseudoSourceValue::getFixedStack(int FI) {
-  const PseudoSourceValue *&V = (*FSValues)[FI];
+  PSVGlobalsTy &PG = *PSVGlobals;
+  sys::ScopedLock locked(PG.Lock);
+  const PseudoSourceValue *&V = PG.FSValues[FI];
   if (!V)
     V = new FixedStackPseudoSourceValue(FI);
   return V;
diff --git a/libclamav/c++/llvm/lib/CodeGen/RegAllocLinearScan.cpp b/libclamav/c++/llvm/lib/CodeGen/RegAllocLinearScan.cpp
index 8e44a57..5c5a394 100644
--- a/libclamav/c++/llvm/lib/CodeGen/RegAllocLinearScan.cpp
+++ b/libclamav/c++/llvm/lib/CodeGen/RegAllocLinearScan.cpp
@@ -334,10 +334,6 @@ namespace {
                             SmallVector<unsigned, 256> &inactiveCounts,
                             bool SkipDGRegs);
 
-    /// assignVirt2StackSlot - assigns this virtual register to a
-    /// stack slot. returns the stack slot
-    int assignVirt2StackSlot(unsigned virtReg);
-
     void ComputeRelatedRegClasses();
 
     template <typename ItTy>
diff --git a/libclamav/c++/llvm/lib/CodeGen/RegAllocLocal.cpp b/libclamav/c++/llvm/lib/CodeGen/RegAllocLocal.cpp
index c25c24a..04303cf 100644
--- a/libclamav/c++/llvm/lib/CodeGen/RegAllocLocal.cpp
+++ b/libclamav/c++/llvm/lib/CodeGen/RegAllocLocal.cpp
@@ -490,10 +490,12 @@ MachineInstr *RALocal::reloadVirtReg(MachineBasicBlock &MBB, MachineInstr *MI,
   // If the virtual register is already available, just update the instruction
   // and return.
   if (unsigned PR = getVirt2PhysRegMapSlot(VirtReg)) {
-    MarkPhysRegRecentlyUsed(PR);       // Already have this value available!
     MI->getOperand(OpNum).setReg(PR);  // Assign the input register
-    if (!MI->isDebugValue())
+    if (!MI->isDebugValue()) {
+      // Do not do these for DBG_VALUE as they can affect codegen.
+      MarkPhysRegRecentlyUsed(PR);       // Already have this value available!
       getVirtRegLastUse(VirtReg) = std::make_pair(MI, OpNum);
+    }
     return MI;
   }
 
@@ -694,7 +696,13 @@ void RALocal::ComputeLocalLiveness(MachineBasicBlock& MBB) {
     bool usedOutsideBlock = isPhysReg ? false :   
           UsedInMultipleBlocks.test(MO.getReg() -  
                                     TargetRegisterInfo::FirstVirtualRegister);
-    if (!isPhysReg && !usedOutsideBlock)
+    if (!isPhysReg && !usedOutsideBlock) {
+      // DBG_VALUE complicates this:  if the only refs of a register outside
+      // this block are DBG_VALUE, we can't keep the reg live just for that,
+      // as it will cause the reg to be spilled at the end of this block when
+      // it wouldn't have been otherwise.  Nullify the DBG_VALUEs when that
+      // happens.
+      bool UsedByDebugValueOnly = false;
       for (MachineRegisterInfo::reg_iterator UI = MRI.reg_begin(MO.getReg()),
            UE = MRI.reg_end(); UI != UE; ++UI)
         // Two cases:
@@ -702,12 +710,26 @@ void RALocal::ComputeLocalLiveness(MachineBasicBlock& MBB) {
         // - used in the same block before it is defined (loop)
         if (UI->getParent() != &MBB ||
             (MO.isDef() && UI.getOperand().isUse() && precedes(&*UI, MI))) {
+          if (UI->isDebugValue()) {
+            UsedByDebugValueOnly = true;
+            continue;
+          }
+          // A non-DBG_VALUE use means we can leave DBG_VALUE uses alone.
           UsedInMultipleBlocks.set(MO.getReg() - 
                                    TargetRegisterInfo::FirstVirtualRegister);
           usedOutsideBlock = true;
+          UsedByDebugValueOnly = false;
           break;
         }
-    
+      if (UsedByDebugValueOnly)
+        for (MachineRegisterInfo::reg_iterator UI = MRI.reg_begin(MO.getReg()),
+             UE = MRI.reg_end(); UI != UE; ++UI)
+          if (UI->isDebugValue() &&
+              (UI->getParent() != &MBB ||
+               (MO.isDef() && precedes(&*UI, MI))))
+            UI.getOperand().setReg(0U);
+    }
+  
     // Physical registers and those that are not live-out of the block
     // are killed/dead at their last use/def within this block.
     if (isPhysReg || !usedOutsideBlock) {
diff --git a/libclamav/c++/llvm/lib/CodeGen/RegAllocPBQP.cpp b/libclamav/c++/llvm/lib/CodeGen/RegAllocPBQP.cpp
index 2701faf..81cfd8f 100644
--- a/libclamav/c++/llvm/lib/CodeGen/RegAllocPBQP.cpp
+++ b/libclamav/c++/llvm/lib/CodeGen/RegAllocPBQP.cpp
@@ -57,7 +57,7 @@
 using namespace llvm;
 
 static RegisterRegAlloc
-registerPBQPRepAlloc("pbqp", "PBQP register allocator.",
+registerPBQPRepAlloc("pbqp", "PBQP register allocator",
                        llvm::createPBQPRegisterAllocator);
 
 static cl::opt<bool>
@@ -867,10 +867,6 @@ bool PBQPRegAlloc::runOnMachineFunction(MachineFunction &MF) {
   // Find the vreg intervals in need of allocation.
   findVRegIntervalsToAlloc();
 
-  // If there aren't any then we're done here.
-  if (vregIntervalsToAlloc.empty() && emptyVRegIntervals.empty())
-    return true;
-
   // If there are non-empty intervals allocate them using pbqp.
   if (!vregIntervalsToAlloc.empty()) {
 
diff --git a/libclamav/c++/llvm/lib/CodeGen/ScheduleDAGInstrs.cpp b/libclamav/c++/llvm/lib/CodeGen/ScheduleDAGInstrs.cpp
index 56dd533..badf34e 100644
--- a/libclamav/c++/llvm/lib/CodeGen/ScheduleDAGInstrs.cpp
+++ b/libclamav/c++/llvm/lib/CodeGen/ScheduleDAGInstrs.cpp
@@ -72,7 +72,7 @@ static const Value *getUnderlyingObjectFromInt(const Value *V) {
     } else {
       return V;
     }
-    assert(isa<IntegerType>(V->getType()) && "Unexpected operand type!");
+    assert(V->getType()->isIntegerTy() && "Unexpected operand type!");
   } while (1);
 }
 
@@ -87,7 +87,7 @@ static const Value *getUnderlyingObject(const Value *V) {
       break;
     const Value *O = getUnderlyingObjectFromInt(cast<User>(V)->getOperand(0));
     // If that succeeded in finding a pointer, continue the search.
-    if (!isa<PointerType>(O->getType()))
+    if (!O->getType()->isPointerTy())
       break;
     V = O;
   } while (1);
diff --git a/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 9189e71..3be6b43 100644
--- a/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -1064,7 +1064,7 @@ SDValue DAGCombiner::visitADD(SDNode *N) {
   if (VT.isInteger() && !VT.isVector()) {
     APInt LHSZero, LHSOne;
     APInt RHSZero, RHSOne;
-    APInt Mask = APInt::getAllOnesValue(VT.getSizeInBits());
+    APInt Mask = APInt::getAllOnesValue(VT.getScalarType().getSizeInBits());
     DAG.ComputeMaskedBits(N0, Mask, LHSZero, LHSOne);
 
     if (LHSZero.getBoolValue()) {
@@ -1136,7 +1136,7 @@ SDValue DAGCombiner::visitADDC(SDNode *N) {
   // fold (addc a, b) -> (or a, b), CARRY_FALSE iff a and b share no bits.
   APInt LHSZero, LHSOne;
   APInt RHSZero, RHSOne;
-  APInt Mask = APInt::getAllOnesValue(VT.getSizeInBits());
+  APInt Mask = APInt::getAllOnesValue(VT.getScalarType().getSizeInBits());
   DAG.ComputeMaskedBits(N0, Mask, LHSZero, LHSOne);
 
   if (LHSZero.getBoolValue()) {
@@ -1758,7 +1758,7 @@ SDValue DAGCombiner::visitAND(SDNode *N) {
   ConstantSDNode *N0C = dyn_cast<ConstantSDNode>(N0);
   ConstantSDNode *N1C = dyn_cast<ConstantSDNode>(N1);
   EVT VT = N1.getValueType();
-  unsigned BitWidth = VT.getSizeInBits();
+  unsigned BitWidth = VT.getScalarType().getSizeInBits();
 
   // fold vector ops
   if (VT.isVector()) {
@@ -1786,7 +1786,7 @@ SDValue DAGCombiner::visitAND(SDNode *N) {
   SDValue RAND = ReassociateOps(ISD::AND, N->getDebugLoc(), N0, N1);
   if (RAND.getNode() != 0)
     return RAND;
-  // fold (and (or x, 0xFFFF), 0xFF) -> 0xFF
+  // fold (and (or x, C), D) -> D if (C & D) == D
   if (N1C && N0.getOpcode() == ISD::OR)
     if (ConstantSDNode *ORI = dyn_cast<ConstantSDNode>(N0.getOperand(1)))
       if ((ORI->getAPIntValue() & N1C->getAPIntValue()) == N1C->getAPIntValue())
@@ -1872,16 +1872,17 @@ SDValue DAGCombiner::visitAND(SDNode *N) {
     EVT MemVT = LN0->getMemoryVT();
     // If we zero all the possible extended bits, then we can turn this into
     // a zextload if we are running before legalize or the operation is legal.
-    unsigned BitWidth = N1.getValueSizeInBits();
+    unsigned BitWidth = N1.getValueType().getScalarType().getSizeInBits();
     if (DAG.MaskedValueIsZero(N1, APInt::getHighBitsSet(BitWidth,
-                                     BitWidth - MemVT.getSizeInBits())) &&
+                           BitWidth - MemVT.getScalarType().getSizeInBits())) &&
         ((!LegalOperations && !LN0->isVolatile()) ||
          TLI.isLoadExtLegal(ISD::ZEXTLOAD, MemVT))) {
       SDValue ExtLoad = DAG.getExtLoad(ISD::ZEXTLOAD, N0.getDebugLoc(), VT,
                                        LN0->getChain(), LN0->getBasePtr(),
                                        LN0->getSrcValue(),
                                        LN0->getSrcValueOffset(), MemVT,
-                                       LN0->isVolatile(), LN0->getAlignment());
+                                       LN0->isVolatile(), LN0->isNonTemporal(),
+                                       LN0->getAlignment());
       AddToWorkList(N);
       CombineTo(N0.getNode(), ExtLoad, ExtLoad.getValue(1));
       return SDValue(N, 0);   // Return N so it doesn't get rechecked!
@@ -1894,16 +1895,17 @@ SDValue DAGCombiner::visitAND(SDNode *N) {
     EVT MemVT = LN0->getMemoryVT();
     // If we zero all the possible extended bits, then we can turn this into
     // a zextload if we are running before legalize or the operation is legal.
-    unsigned BitWidth = N1.getValueSizeInBits();
+    unsigned BitWidth = N1.getValueType().getScalarType().getSizeInBits();
     if (DAG.MaskedValueIsZero(N1, APInt::getHighBitsSet(BitWidth,
-                                     BitWidth - MemVT.getSizeInBits())) &&
+                           BitWidth - MemVT.getScalarType().getSizeInBits())) &&
         ((!LegalOperations && !LN0->isVolatile()) ||
          TLI.isLoadExtLegal(ISD::ZEXTLOAD, MemVT))) {
       SDValue ExtLoad = DAG.getExtLoad(ISD::ZEXTLOAD, N0.getDebugLoc(), VT,
                                        LN0->getChain(),
                                        LN0->getBasePtr(), LN0->getSrcValue(),
                                        LN0->getSrcValueOffset(), MemVT,
-                                       LN0->isVolatile(), LN0->getAlignment());
+                                       LN0->isVolatile(), LN0->isNonTemporal(),
+                                       LN0->getAlignment());
       AddToWorkList(N);
       CombineTo(N0.getNode(), ExtLoad, ExtLoad.getValue(1));
       return SDValue(N, 0);   // Return N so it doesn't get rechecked!
@@ -1935,7 +1937,8 @@ SDValue DAGCombiner::visitAND(SDNode *N) {
             DAG.getExtLoad(ISD::ZEXTLOAD, LN0->getDebugLoc(), LoadResultTy,
                            LN0->getChain(), LN0->getBasePtr(),
                            LN0->getSrcValue(), LN0->getSrcValueOffset(),
-                           ExtVT, LN0->isVolatile(), LN0->getAlignment());
+                           ExtVT, LN0->isVolatile(), LN0->isNonTemporal(),
+                           LN0->getAlignment());
           AddToWorkList(N);
           CombineTo(LN0, NewLoad, NewLoad.getValue(1));
           return SDValue(N, 0);   // Return N so it doesn't get rechecked!
@@ -1970,7 +1973,8 @@ SDValue DAGCombiner::visitAND(SDNode *N) {
             DAG.getExtLoad(ISD::ZEXTLOAD, LN0->getDebugLoc(), LoadResultTy,
                            LN0->getChain(), NewPtr,
                            LN0->getSrcValue(), LN0->getSrcValueOffset(),
-                           ExtVT, LN0->isVolatile(), Alignment);
+                           ExtVT, LN0->isVolatile(), LN0->isNonTemporal(),
+                           Alignment);
           AddToWorkList(N);
           CombineTo(LN0, Load, Load.getValue(1));
           return SDValue(N, 0);   // Return N so it doesn't get rechecked!
@@ -2021,13 +2025,15 @@ SDValue DAGCombiner::visitOR(SDNode *N) {
   if (ROR.getNode() != 0)
     return ROR;
   // Canonicalize (or (and X, c1), c2) -> (and (or X, c2), c1|c2)
+  // iff (c1 & c2) == 0.
   if (N1C && N0.getOpcode() == ISD::AND && N0.getNode()->hasOneUse() &&
              isa<ConstantSDNode>(N0.getOperand(1))) {
     ConstantSDNode *C1 = cast<ConstantSDNode>(N0.getOperand(1));
-    return DAG.getNode(ISD::AND, N->getDebugLoc(), VT,
-                       DAG.getNode(ISD::OR, N0.getDebugLoc(), VT,
-                                   N0.getOperand(0), N1),
-                       DAG.FoldConstantArithmetic(ISD::OR, VT, N1C, C1));
+    if ((C1->getAPIntValue() & N1C->getAPIntValue()) != 0)
+      return DAG.getNode(ISD::AND, N->getDebugLoc(), VT,
+                         DAG.getNode(ISD::OR, N0.getDebugLoc(), VT,
+                                     N0.getOperand(0), N1),
+                         DAG.FoldConstantArithmetic(ISD::OR, VT, N1C, C1));
   }
   // fold (or (setcc x), (setcc y)) -> (setcc (or x, y))
   if (isSetCCEquivalent(N0, LL, LR, CC0) && isSetCCEquivalent(N1, RL, RR, CC1)){
@@ -2750,7 +2756,7 @@ SDValue DAGCombiner::visitSRL(SDNode *N) {
   if (N1C && N0.getOpcode() == ISD::CTLZ &&
       N1C->getAPIntValue() == Log2_32(VT.getSizeInBits())) {
     APInt KnownZero, KnownOne;
-    APInt Mask = APInt::getAllOnesValue(VT.getSizeInBits());
+    APInt Mask = APInt::getAllOnesValue(VT.getScalarType().getSizeInBits());
     DAG.ComputeMaskedBits(N0.getOperand(0), Mask, KnownZero, KnownOne);
 
     // If any of the input bits are KnownOne, then the input couldn't be all
@@ -3143,7 +3149,8 @@ SDValue DAGCombiner::visitSIGN_EXTEND(SDNode *N) {
                                        LN0->getBasePtr(), LN0->getSrcValue(),
                                        LN0->getSrcValueOffset(),
                                        N0.getValueType(),
-                                       LN0->isVolatile(), LN0->getAlignment());
+                                       LN0->isVolatile(), LN0->isNonTemporal(),
+                                       LN0->getAlignment());
       CombineTo(N, ExtLoad);
       SDValue Trunc = DAG.getNode(ISD::TRUNCATE, N0.getDebugLoc(),
                                   N0.getValueType(), ExtLoad);
@@ -3185,7 +3192,8 @@ SDValue DAGCombiner::visitSIGN_EXTEND(SDNode *N) {
                                        LN0->getChain(),
                                        LN0->getBasePtr(), LN0->getSrcValue(),
                                        LN0->getSrcValueOffset(), MemVT,
-                                       LN0->isVolatile(), LN0->getAlignment());
+                                       LN0->isVolatile(), LN0->isNonTemporal(),
+                                       LN0->getAlignment());
       CombineTo(N, ExtLoad);
       CombineTo(N0.getNode(),
                 DAG.getNode(ISD::TRUNCATE, N0.getDebugLoc(),
@@ -3315,7 +3323,8 @@ SDValue DAGCombiner::visitZERO_EXTEND(SDNode *N) {
                                        LN0->getBasePtr(), LN0->getSrcValue(),
                                        LN0->getSrcValueOffset(),
                                        N0.getValueType(),
-                                       LN0->isVolatile(), LN0->getAlignment());
+                                       LN0->isVolatile(), LN0->isNonTemporal(),
+                                       LN0->getAlignment());
       CombineTo(N, ExtLoad);
       SDValue Trunc = DAG.getNode(ISD::TRUNCATE, N0.getDebugLoc(),
                                   N0.getValueType(), ExtLoad);
@@ -3357,7 +3366,8 @@ SDValue DAGCombiner::visitZERO_EXTEND(SDNode *N) {
                                        LN0->getChain(),
                                        LN0->getBasePtr(), LN0->getSrcValue(),
                                        LN0->getSrcValueOffset(), MemVT,
-                                       LN0->isVolatile(), LN0->getAlignment());
+                                       LN0->isVolatile(), LN0->isNonTemporal(),
+                                       LN0->getAlignment());
       CombineTo(N, ExtLoad);
       CombineTo(N0.getNode(),
                 DAG.getNode(ISD::TRUNCATE, N0.getDebugLoc(), N0.getValueType(),
@@ -3471,7 +3481,8 @@ SDValue DAGCombiner::visitANY_EXTEND(SDNode *N) {
                                        LN0->getBasePtr(), LN0->getSrcValue(),
                                        LN0->getSrcValueOffset(),
                                        N0.getValueType(),
-                                       LN0->isVolatile(), LN0->getAlignment());
+                                       LN0->isVolatile(), LN0->isNonTemporal(),
+                                       LN0->getAlignment());
       CombineTo(N, ExtLoad);
       SDValue Trunc = DAG.getNode(ISD::TRUNCATE, N0.getDebugLoc(),
                                   N0.getValueType(), ExtLoad);
@@ -3513,7 +3524,8 @@ SDValue DAGCombiner::visitANY_EXTEND(SDNode *N) {
                                      VT, LN0->getChain(), LN0->getBasePtr(),
                                      LN0->getSrcValue(),
                                      LN0->getSrcValueOffset(), MemVT,
-                                     LN0->isVolatile(), LN0->getAlignment());
+                                     LN0->isVolatile(), LN0->isNonTemporal(),
+                                     LN0->getAlignment());
     CombineTo(N, ExtLoad);
     CombineTo(N0.getNode(),
               DAG.getNode(ISD::TRUNCATE, N0.getDebugLoc(),
@@ -3636,10 +3648,11 @@ SDValue DAGCombiner::ReduceLoadWidth(SDNode *N) {
     SDValue Load = (ExtType == ISD::NON_EXTLOAD)
       ? DAG.getLoad(VT, N0.getDebugLoc(), LN0->getChain(), NewPtr,
                     LN0->getSrcValue(), LN0->getSrcValueOffset() + PtrOff,
-                    LN0->isVolatile(), NewAlign)
+                    LN0->isVolatile(), LN0->isNonTemporal(), NewAlign)
       : DAG.getExtLoad(ExtType, N0.getDebugLoc(), VT, LN0->getChain(), NewPtr,
                        LN0->getSrcValue(), LN0->getSrcValueOffset() + PtrOff,
-                       ExtVT, LN0->isVolatile(), NewAlign);
+                       ExtVT, LN0->isVolatile(), LN0->isNonTemporal(),
+                       NewAlign);
 
     // Replace the old load's chain with the new load's chain.
     WorkListRemover DeadNodes(*this);
@@ -3726,7 +3739,8 @@ SDValue DAGCombiner::visitSIGN_EXTEND_INREG(SDNode *N) {
                                      LN0->getChain(),
                                      LN0->getBasePtr(), LN0->getSrcValue(),
                                      LN0->getSrcValueOffset(), EVT,
-                                     LN0->isVolatile(), LN0->getAlignment());
+                                     LN0->isVolatile(), LN0->isNonTemporal(),
+                                     LN0->getAlignment());
     CombineTo(N, ExtLoad);
     CombineTo(N0.getNode(), ExtLoad, ExtLoad.getValue(1));
     return SDValue(N, 0);   // Return N so it doesn't get rechecked!
@@ -3742,7 +3756,8 @@ SDValue DAGCombiner::visitSIGN_EXTEND_INREG(SDNode *N) {
                                      LN0->getChain(),
                                      LN0->getBasePtr(), LN0->getSrcValue(),
                                      LN0->getSrcValueOffset(), EVT,
-                                     LN0->isVolatile(), LN0->getAlignment());
+                                     LN0->isVolatile(), LN0->isNonTemporal(),
+                                     LN0->getAlignment());
     CombineTo(N, ExtLoad);
     CombineTo(N0.getNode(), ExtLoad, ExtLoad.getValue(1));
     return SDValue(N, 0);   // Return N so it doesn't get rechecked!
@@ -3826,7 +3841,7 @@ SDValue DAGCombiner::CombineConsecutiveLoads(SDNode *N, EVT VT) {
         (!LegalOperations || TLI.isOperationLegal(ISD::LOAD, VT)))
       return DAG.getLoad(VT, N->getDebugLoc(), LD1->getChain(),
                          LD1->getBasePtr(), LD1->getSrcValue(),
-                         LD1->getSrcValueOffset(), false, Align);
+                         LD1->getSrcValueOffset(), false, false, Align);
   }
 
   return SDValue();
@@ -3896,7 +3911,8 @@ SDValue DAGCombiner::visitBIT_CONVERT(SDNode *N) {
       SDValue Load = DAG.getLoad(VT, N->getDebugLoc(), LN0->getChain(),
                                  LN0->getBasePtr(),
                                  LN0->getSrcValue(), LN0->getSrcValueOffset(),
-                                 LN0->isVolatile(), OrigAlign);
+                                 LN0->isVolatile(), LN0->isNonTemporal(),
+                                 OrigAlign);
       AddToWorkList(N);
       CombineTo(N0.getNode(),
                 DAG.getNode(ISD::BIT_CONVERT, N0.getDebugLoc(),
@@ -4492,7 +4508,8 @@ SDValue DAGCombiner::visitFP_EXTEND(SDNode *N) {
                                      LN0->getBasePtr(), LN0->getSrcValue(),
                                      LN0->getSrcValueOffset(),
                                      N0.getValueType(),
-                                     LN0->isVolatile(), LN0->getAlignment());
+                                     LN0->isVolatile(), LN0->isNonTemporal(),
+                                     LN0->getAlignment());
     CombineTo(N, ExtLoad);
     CombineTo(N0.getNode(),
               DAG.getNode(ISD::FP_ROUND, N0.getDebugLoc(),
@@ -4640,7 +4657,8 @@ SDValue DAGCombiner::visitBRCOND(SDNode *N) {
             DAG.DeleteNode(Trunc);
           }
           // Replace the uses of SRL with SETCC
-          DAG.ReplaceAllUsesOfValueWith(N1, SetCC);
+          WorkListRemover DeadNodes(*this);
+          DAG.ReplaceAllUsesOfValueWith(N1, SetCC, &DeadNodes);
           removeFromWorkList(N1.getNode());
           DAG.DeleteNode(N1.getNode());
           return SDValue(N, 0);   // Return N so it doesn't get rechecked!
@@ -4648,6 +4666,56 @@ SDValue DAGCombiner::visitBRCOND(SDNode *N) {
       }
     }
   }
+  
+  // Transform br(xor(x, y)) -> br(x != y)
+  // Transform br(xor(xor(x,y), 1)) -> br (x == y)
+  if (N1.hasOneUse() && N1.getOpcode() == ISD::XOR) {
+    SDNode *TheXor = N1.getNode();
+    SDValue Op0 = TheXor->getOperand(0);
+    SDValue Op1 = TheXor->getOperand(1);
+    if (Op0.getOpcode() == Op1.getOpcode()) {
+      // Avoid missing important xor optimizations.
+      SDValue Tmp = visitXOR(TheXor);
+      if (Tmp.getNode()) {
+        DEBUG(dbgs() << "\nReplacing.8 ";
+              TheXor->dump(&DAG);
+              dbgs() << "\nWith: ";
+              Tmp.getNode()->dump(&DAG);
+              dbgs() << '\n');
+        WorkListRemover DeadNodes(*this);
+        DAG.ReplaceAllUsesOfValueWith(N1, Tmp, &DeadNodes);
+        removeFromWorkList(TheXor);
+        DAG.DeleteNode(TheXor);
+        return DAG.getNode(ISD::BRCOND, N->getDebugLoc(),
+                           MVT::Other, Chain, Tmp, N2);
+      }
+    }
+
+    if (Op0.getOpcode() != ISD::SETCC && Op1.getOpcode() != ISD::SETCC) {
+      bool Equal = false;
+      if (ConstantSDNode *RHSCI = dyn_cast<ConstantSDNode>(Op0))
+        if (RHSCI->getAPIntValue() == 1 && Op0.hasOneUse() &&
+            Op0.getOpcode() == ISD::XOR) {
+          TheXor = Op0.getNode();
+          Equal = true;
+        }
+
+      EVT SetCCVT = N1.getValueType();
+      if (LegalTypes)
+        SetCCVT = TLI.getSetCCResultType(SetCCVT);
+      SDValue SetCC = DAG.getSetCC(TheXor->getDebugLoc(),
+                                   SetCCVT,
+                                   Op0, Op1,
+                                   Equal ? ISD::SETEQ : ISD::SETNE);
+      // Replace the uses of XOR with SETCC
+      WorkListRemover DeadNodes(*this);
+      DAG.ReplaceAllUsesOfValueWith(N1, SetCC, &DeadNodes);
+      removeFromWorkList(N1.getNode());
+      DAG.DeleteNode(N1.getNode());
+      return DAG.getNode(ISD::BRCOND, N->getDebugLoc(),
+                         MVT::Other, Chain, SetCC, N2);
+    }
+  }
 
   return SDValue();
 }
@@ -4960,7 +5028,7 @@ SDValue DAGCombiner::visitLOAD(SDNode *N) {
                               LD->getValueType(0),
                               Chain, Ptr, LD->getSrcValue(),
                               LD->getSrcValueOffset(), LD->getMemoryVT(),
-                              LD->isVolatile(), Align);
+                              LD->isVolatile(), LD->isNonTemporal(), Align);
     }
   }
 
@@ -4997,7 +5065,7 @@ SDValue DAGCombiner::visitLOAD(SDNode *N) {
       assert(N->getValueType(2) == MVT::Other && "Malformed indexed loads?");
       if (N->hasNUsesOfValue(0, 0) && N->hasNUsesOfValue(0, 1)) {
         SDValue Undef = DAG.getUNDEF(N->getValueType(0));
-        DEBUG(dbgs() << "\nReplacing.6 ";
+        DEBUG(dbgs() << "\nReplacing.7 ";
               N->dump(&DAG);
               dbgs() << "\nWith: ";
               Undef.getNode()->dump(&DAG);
@@ -5042,7 +5110,8 @@ SDValue DAGCombiner::visitLOAD(SDNode *N) {
         ReplLoad = DAG.getLoad(N->getValueType(0), LD->getDebugLoc(),
                                BetterChain, Ptr,
                                LD->getSrcValue(), LD->getSrcValueOffset(),
-                               LD->isVolatile(), LD->getAlignment());
+                               LD->isVolatile(), LD->isNonTemporal(),
+                               LD->getAlignment());
       } else {
         ReplLoad = DAG.getExtLoad(LD->getExtensionType(), LD->getDebugLoc(),
                                   LD->getValueType(0),
@@ -5050,6 +5119,7 @@ SDValue DAGCombiner::visitLOAD(SDNode *N) {
                                   LD->getSrcValueOffset(),
                                   LD->getMemoryVT(),
                                   LD->isVolatile(),
+                                  LD->isNonTemporal(),
                                   LD->getAlignment());
       }
 
@@ -5149,13 +5219,14 @@ SDValue DAGCombiner::ReduceLoadOpStoreWidth(SDNode *N) {
       SDValue NewLD = DAG.getLoad(NewVT, N0.getDebugLoc(),
                                   LD->getChain(), NewPtr,
                                   LD->getSrcValue(), LD->getSrcValueOffset(),
-                                  LD->isVolatile(), NewAlign);
+                                  LD->isVolatile(), LD->isNonTemporal(),
+                                  NewAlign);
       SDValue NewVal = DAG.getNode(Opc, Value.getDebugLoc(), NewVT, NewLD,
                                    DAG.getConstant(NewImm, NewVT));
       SDValue NewST = DAG.getStore(Chain, N->getDebugLoc(),
                                    NewVal, NewPtr,
                                    ST->getSrcValue(), ST->getSrcValueOffset(),
-                                   false, NewAlign);
+                                   false, false, NewAlign);
 
       AddToWorkList(NewPtr.getNode());
       AddToWorkList(NewLD.getNode());
@@ -5184,7 +5255,7 @@ SDValue DAGCombiner::visitSTORE(SDNode *N) {
         return DAG.getTruncStore(Chain, N->getDebugLoc(), Value,
                                  Ptr, ST->getSrcValue(),
                                  ST->getSrcValueOffset(), ST->getMemoryVT(),
-                                 ST->isVolatile(), Align);
+                                 ST->isVolatile(), ST->isNonTemporal(), Align);
     }
   }
 
@@ -5201,7 +5272,8 @@ SDValue DAGCombiner::visitSTORE(SDNode *N) {
          TLI.isOperationLegalOrCustom(ISD::STORE, SVT)))
       return DAG.getStore(Chain, N->getDebugLoc(), Value.getOperand(0),
                           Ptr, ST->getSrcValue(),
-                          ST->getSrcValueOffset(), ST->isVolatile(), OrigAlign);
+                          ST->getSrcValueOffset(), ST->isVolatile(),
+                          ST->isNonTemporal(), OrigAlign);
   }
 
   // Turn 'store float 1.0, Ptr' -> 'store int 0x12345678, Ptr'
@@ -5227,7 +5299,7 @@ SDValue DAGCombiner::visitSTORE(SDNode *N) {
           return DAG.getStore(Chain, N->getDebugLoc(), Tmp,
                               Ptr, ST->getSrcValue(),
                               ST->getSrcValueOffset(), ST->isVolatile(),
-                              ST->getAlignment());
+                              ST->isNonTemporal(), ST->getAlignment());
         }
         break;
       case MVT::f64:
@@ -5239,7 +5311,7 @@ SDValue DAGCombiner::visitSTORE(SDNode *N) {
           return DAG.getStore(Chain, N->getDebugLoc(), Tmp,
                               Ptr, ST->getSrcValue(),
                               ST->getSrcValueOffset(), ST->isVolatile(),
-                              ST->getAlignment());
+                              ST->isNonTemporal(), ST->getAlignment());
         } else if (!ST->isVolatile() &&
                    TLI.isOperationLegalOrCustom(ISD::STORE, MVT::i32)) {
           // Many FP stores are not made apparent until after legalize, e.g. for
@@ -5253,18 +5325,21 @@ SDValue DAGCombiner::visitSTORE(SDNode *N) {
           int SVOffset = ST->getSrcValueOffset();
           unsigned Alignment = ST->getAlignment();
           bool isVolatile = ST->isVolatile();
+          bool isNonTemporal = ST->isNonTemporal();
 
           SDValue St0 = DAG.getStore(Chain, ST->getDebugLoc(), Lo,
                                      Ptr, ST->getSrcValue(),
                                      ST->getSrcValueOffset(),
-                                     isVolatile, ST->getAlignment());
+                                     isVolatile, isNonTemporal,
+                                     ST->getAlignment());
           Ptr = DAG.getNode(ISD::ADD, N->getDebugLoc(), Ptr.getValueType(), Ptr,
                             DAG.getConstant(4, Ptr.getValueType()));
           SVOffset += 4;
           Alignment = MinAlign(Alignment, 4U);
           SDValue St1 = DAG.getStore(Chain, ST->getDebugLoc(), Hi,
                                      Ptr, ST->getSrcValue(),
-                                     SVOffset, isVolatile, Alignment);
+                                     SVOffset, isVolatile, isNonTemporal,
+                                     Alignment);
           return DAG.getNode(ISD::TokenFactor, N->getDebugLoc(), MVT::Other,
                              St0, St1);
         }
@@ -5286,12 +5361,13 @@ SDValue DAGCombiner::visitSTORE(SDNode *N) {
       if (ST->isTruncatingStore()) {
         ReplStore = DAG.getTruncStore(BetterChain, N->getDebugLoc(), Value, Ptr,
                                       ST->getSrcValue(),ST->getSrcValueOffset(),
-                                      ST->getMemoryVT(),
-                                      ST->isVolatile(), ST->getAlignment());
+                                      ST->getMemoryVT(), ST->isVolatile(),
+                                      ST->isNonTemporal(), ST->getAlignment());
       } else {
         ReplStore = DAG.getStore(BetterChain, N->getDebugLoc(), Value, Ptr,
                                  ST->getSrcValue(), ST->getSrcValueOffset(),
-                                 ST->isVolatile(), ST->getAlignment());
+                                 ST->isVolatile(), ST->isNonTemporal(),
+                                 ST->getAlignment());
       }
 
       // Create token to keep both nodes around.
@@ -5325,7 +5401,8 @@ SDValue DAGCombiner::visitSTORE(SDNode *N) {
       return DAG.getTruncStore(Chain, N->getDebugLoc(), Shorter,
                                Ptr, ST->getSrcValue(),
                                ST->getSrcValueOffset(), ST->getMemoryVT(),
-                               ST->isVolatile(), ST->getAlignment());
+                               ST->isVolatile(), ST->isNonTemporal(),
+                               ST->getAlignment());
 
     // Otherwise, see if we can simplify the operation with
     // SimplifyDemandedBits, which only works if the value has a single use.
@@ -5358,7 +5435,8 @@ SDValue DAGCombiner::visitSTORE(SDNode *N) {
     return DAG.getTruncStore(Chain, N->getDebugLoc(), Value.getOperand(0),
                              Ptr, ST->getSrcValue(),
                              ST->getSrcValueOffset(), ST->getMemoryVT(),
-                             ST->isVolatile(), ST->getAlignment());
+                             ST->isVolatile(), ST->isNonTemporal(),
+                             ST->getAlignment());
   }
 
   return ReduceLoadOpStoreWidth(N);
@@ -5503,7 +5581,7 @@ SDValue DAGCombiner::visitEXTRACT_VECTOR_ELT(SDNode *N) {
 
     return DAG.getLoad(LVT, N->getDebugLoc(), LN0->getChain(), NewPtr,
                        LN0->getSrcValue(), LN0->getSrcValueOffset(),
-                       LN0->isVolatile(), Align);
+                       LN0->isVolatile(), LN0->isNonTemporal(), Align);
   }
 
   return SDValue();
@@ -5883,6 +5961,7 @@ bool DAGCombiner::SimplifySelectOps(SDNode *TheSelect, SDValue LHS,
                                LLD->getChain(),
                                Addr, 0, 0,
                                LLD->isVolatile(),
+                               LLD->isNonTemporal(),
                                LLD->getAlignment());
           } else {
             Load = DAG.getExtLoad(LLD->getExtensionType(),
@@ -5891,6 +5970,7 @@ bool DAGCombiner::SimplifySelectOps(SDNode *TheSelect, SDValue LHS,
                                   LLD->getChain(), Addr, 0, 0,
                                   LLD->getMemoryVT(),
                                   LLD->isVolatile(),
+                                  LLD->isNonTemporal(),
                                   LLD->getAlignment());
           }
 
@@ -5998,7 +6078,7 @@ SDValue DAGCombiner::SimplifySelectCC(DebugLoc DL, SDValue N0, SDValue N1,
                             CstOffset);
         return DAG.getLoad(TV->getValueType(0), DL, DAG.getEntryNode(), CPIdx,
                            PseudoSourceValue::getConstantPool(), 0, false,
-                           Alignment);
+                           false, Alignment);
 
       }
     }  
diff --git a/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp b/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
index 35ef5b7..1d76c7c 100644
--- a/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
+++ b/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
@@ -350,6 +350,34 @@ bool FastISel::SelectCall(User *I) {
     (void)TargetSelectInstruction(cast<Instruction>(I));
     return true;
   }
+  case Intrinsic::dbg_value: {
+    // This requires target support, but right now X86 is the only Fast target.
+    DbgValueInst *DI = cast<DbgValueInst>(I);
+    const TargetInstrDesc &II = TII.get(TargetOpcode::DBG_VALUE);
+    Value *V = DI->getValue();
+    if (!V) {
+      // Currently the optimizer can produce this; insert an undef to
+      // help debugging.  Probably the optimizer should not do this.
+      BuildMI(MBB, DL, II).addReg(0U).addImm(DI->getOffset()).
+                                     addMetadata(DI->getVariable());
+    } else if (ConstantInt *CI = dyn_cast<ConstantInt>(V)) {
+      BuildMI(MBB, DL, II).addImm(CI->getZExtValue()).addImm(DI->getOffset()).
+                                     addMetadata(DI->getVariable());
+    } else if (ConstantFP *CF = dyn_cast<ConstantFP>(V)) {
+      BuildMI(MBB, DL, II).addFPImm(CF).addImm(DI->getOffset()).
+                                     addMetadata(DI->getVariable());
+    } else if (unsigned Reg = lookUpRegForValue(V)) {
+      BuildMI(MBB, DL, II).addReg(Reg, RegState::Debug).addImm(DI->getOffset()).
+                                     addMetadata(DI->getVariable());
+    } else {
+      // We can't yet handle anything else here because it would require
+      // generating code, thus altering codegen because of debug info.
+      // Insert an undef so we can see what we dropped.
+      BuildMI(MBB, DL, II).addReg(0U).addImm(DI->getOffset()).
+                                     addMetadata(DI->getVariable());
+    }     
+    return true;
+  }
   case Intrinsic::eh_exception: {
     EVT VT = TLI.getValueType(I->getType());
     switch (TLI.getOperationAction(ISD::EXCEPTIONADDR, VT)) {
diff --git a/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp b/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp
index 02fe85d..625de11 100644
--- a/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp
+++ b/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp
@@ -15,6 +15,7 @@
 
 #define DEBUG_TYPE "instr-emitter"
 #include "InstrEmitter.h"
+#include "SDDbgValue.h"
 #include "llvm/CodeGen/MachineConstantPool.h"
 #include "llvm/CodeGen/MachineFunction.h"
 #include "llvm/CodeGen/MachineInstrBuilder.h"
@@ -497,6 +498,56 @@ InstrEmitter::EmitCopyToRegClassNode(SDNode *Node,
   assert(isNew && "Node emitted out of order - early");
 }
 
+/// EmitDbgValue - Generate any debug info that refers to this Node.  Constant
+/// dbg_value is not handled here.
+void
+InstrEmitter::EmitDbgValue(SDNode *Node,
+                           DenseMap<SDValue, unsigned> &VRBaseMap,
+                           SDDbgValue *sd) {
+  if (!Node->getHasDebugValue())
+    return;
+  if (!sd)
+    return;
+  unsigned VReg = getVR(SDValue(sd->getSDNode(), sd->getResNo()), VRBaseMap);
+  const TargetInstrDesc &II = TII->get(TargetOpcode::DBG_VALUE);
+  DebugLoc DL = sd->getDebugLoc();
+  MachineInstr *MI;
+  if (VReg) {
+    MI = BuildMI(*MF, DL, II).addReg(VReg, RegState::Debug).
+                              addImm(sd->getOffset()).
+                              addMetadata(sd->getMDPtr());
+  } else {
+    // Insert an Undef so we can see what we dropped.
+    MI = BuildMI(*MF, DL, II).addReg(0U).addImm(sd->getOffset()).
+                                    addMetadata(sd->getMDPtr());
+  }
+  MBB->insert(InsertPos, MI);
+}
+
+/// EmitDbgValue - Generate constant debug info.  No SDNode is involved.
+void
+InstrEmitter::EmitDbgValue(SDDbgValue *sd) {
+  if (!sd)
+    return;
+  const TargetInstrDesc &II = TII->get(TargetOpcode::DBG_VALUE);
+  DebugLoc DL = sd->getDebugLoc();
+  MachineInstr *MI;
+  Value *V = sd->getConst();
+  if (ConstantInt *CI = dyn_cast<ConstantInt>(V)) {
+    MI = BuildMI(*MF, DL, II).addImm(CI->getZExtValue()).
+                                   addImm(sd->getOffset()).
+                                   addMetadata(sd->getMDPtr());
+  } else if (ConstantFP *CF = dyn_cast<ConstantFP>(V)) {
+    MI = BuildMI(*MF, DL, II).addFPImm(CF).addImm(sd->getOffset()).
+                                   addMetadata(sd->getMDPtr());
+  } else {
+    // Insert an Undef so we can see what we dropped.
+    MI = BuildMI(*MF, DL, II).addReg(0U).addImm(sd->getOffset()).
+                                    addMetadata(sd->getMDPtr());
+  }
+  MBB->insert(InsertPos, MI);
+}
+
 /// EmitNode - Generate machine code for a node and needed dependencies.
 ///
 void InstrEmitter::EmitNode(SDNode *Node, bool IsClone, bool IsCloned,
diff --git a/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/InstrEmitter.h b/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/InstrEmitter.h
index 91817e4..4fe9f19 100644
--- a/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/InstrEmitter.h
+++ b/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/InstrEmitter.h
@@ -23,6 +23,7 @@
 namespace llvm {
 
 class TargetInstrDesc;
+class SDDbgValue;
 
 class InstrEmitter {
   MachineFunction *MF;
@@ -97,6 +98,16 @@ public:
   /// MachineInstr.
   static unsigned CountOperands(SDNode *Node);
 
+  /// EmitDbgValue - Generate any debug info that refers to this Node.  Constant
+  /// dbg_value is not handled here.
+  void EmitDbgValue(SDNode *Node,
+                    DenseMap<SDValue, unsigned> &VRBaseMap,
+                    SDDbgValue* sd);
+
+
+  /// EmitDbgValue - Generate a constant DBG_VALUE.  No node is involved.
+  void EmitDbgValue(SDDbgValue* sd);
+
   /// EmitNode - Generate machine code for a node and needed dependencies.
   ///
   void EmitNode(SDNode *Node, bool IsClone, bool IsCloned,
diff --git a/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
index 78e6e4e..f498263 100644
--- a/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+++ b/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
@@ -377,9 +377,10 @@ static SDValue ExpandConstantFP(ConstantFPSDNode *CFP, bool UseCP,
     return DAG.getExtLoad(ISD::EXTLOAD, dl,
                           OrigVT, DAG.getEntryNode(),
                           CPIdx, PseudoSourceValue::getConstantPool(),
-                          0, VT, false, Alignment);
+                          0, VT, false, false, Alignment);
   return DAG.getLoad(OrigVT, dl, DAG.getEntryNode(), CPIdx,
-                     PseudoSourceValue::getConstantPool(), 0, false, Alignment);
+                     PseudoSourceValue::getConstantPool(), 0, false, false,
+                     Alignment);
 }
 
 /// ExpandUnalignedStore - Expands an unaligned store to 2 half-size stores.
@@ -402,7 +403,8 @@ SDValue ExpandUnalignedStore(StoreSDNode *ST, SelectionDAG &DAG,
       // FIXME: Does not handle truncating floating point stores!
       SDValue Result = DAG.getNode(ISD::BIT_CONVERT, dl, intVT, Val);
       return DAG.getStore(Chain, dl, Result, Ptr, ST->getSrcValue(),
-                          SVOffset, ST->isVolatile(), Alignment);
+                          SVOffset, ST->isVolatile(), ST->isNonTemporal(),
+                          Alignment);
     } else {
       // Do a (aligned) store to a stack slot, then copy from the stack slot
       // to the final destination using (unaligned) integer loads and stores.
@@ -418,7 +420,8 @@ SDValue ExpandUnalignedStore(StoreSDNode *ST, SelectionDAG &DAG,
 
       // Perform the original store, only redirected to the stack slot.
       SDValue Store = DAG.getTruncStore(Chain, dl,
-                                        Val, StackPtr, NULL, 0, StoredVT);
+                                        Val, StackPtr, NULL, 0, StoredVT,
+                                        false, false, 0);
       SDValue Increment = DAG.getConstant(RegBytes, TLI.getPointerTy());
       SmallVector<SDValue, 8> Stores;
       unsigned Offset = 0;
@@ -426,11 +429,12 @@ SDValue ExpandUnalignedStore(StoreSDNode *ST, SelectionDAG &DAG,
       // Do all but one copies using the full register width.
       for (unsigned i = 1; i < NumRegs; i++) {
         // Load one integer register's worth from the stack slot.
-        SDValue Load = DAG.getLoad(RegVT, dl, Store, StackPtr, NULL, 0);
+        SDValue Load = DAG.getLoad(RegVT, dl, Store, StackPtr, NULL, 0,
+                                   false, false, 0);
         // Store it to the final location.  Remember the store.
         Stores.push_back(DAG.getStore(Load.getValue(1), dl, Load, Ptr,
                                       ST->getSrcValue(), SVOffset + Offset,
-                                      ST->isVolatile(),
+                                      ST->isVolatile(), ST->isNonTemporal(),
                                       MinAlign(ST->getAlignment(), Offset)));
         // Increment the pointers.
         Offset += RegBytes;
@@ -446,11 +450,12 @@ SDValue ExpandUnalignedStore(StoreSDNode *ST, SelectionDAG &DAG,
 
       // Load from the stack slot.
       SDValue Load = DAG.getExtLoad(ISD::EXTLOAD, dl, RegVT, Store, StackPtr,
-                                    NULL, 0, MemVT);
+                                    NULL, 0, MemVT, false, false, 0);
 
       Stores.push_back(DAG.getTruncStore(Load.getValue(1), dl, Load, Ptr,
                                          ST->getSrcValue(), SVOffset + Offset,
                                          MemVT, ST->isVolatile(),
+                                         ST->isNonTemporal(),
                                          MinAlign(ST->getAlignment(), Offset)));
       // The order of the stores doesn't matter - say it with a TokenFactor.
       return DAG.getNode(ISD::TokenFactor, dl, MVT::Other, &Stores[0],
@@ -474,13 +479,14 @@ SDValue ExpandUnalignedStore(StoreSDNode *ST, SelectionDAG &DAG,
   SDValue Store1, Store2;
   Store1 = DAG.getTruncStore(Chain, dl, TLI.isLittleEndian()?Lo:Hi, Ptr,
                              ST->getSrcValue(), SVOffset, NewStoredVT,
-                             ST->isVolatile(), Alignment);
+                             ST->isVolatile(), ST->isNonTemporal(), Alignment);
   Ptr = DAG.getNode(ISD::ADD, dl, Ptr.getValueType(), Ptr,
                     DAG.getConstant(IncrementSize, TLI.getPointerTy()));
   Alignment = MinAlign(Alignment, IncrementSize);
   Store2 = DAG.getTruncStore(Chain, dl, TLI.isLittleEndian()?Hi:Lo, Ptr,
                              ST->getSrcValue(), SVOffset + IncrementSize,
-                             NewStoredVT, ST->isVolatile(), Alignment);
+                             NewStoredVT, ST->isVolatile(), ST->isNonTemporal(),
+                             Alignment);
 
   return DAG.getNode(ISD::TokenFactor, dl, MVT::Other, Store1, Store2);
 }
@@ -502,7 +508,7 @@ SDValue ExpandUnalignedLoad(LoadSDNode *LD, SelectionDAG &DAG,
       // then bitconvert to floating point or vector.
       SDValue newLoad = DAG.getLoad(intVT, dl, Chain, Ptr, LD->getSrcValue(),
                                     SVOffset, LD->isVolatile(),
-                                    LD->getAlignment());
+                                    LD->isNonTemporal(), LD->getAlignment());
       SDValue Result = DAG.getNode(ISD::BIT_CONVERT, dl, LoadedVT, newLoad);
       if (VT.isFloatingPoint() && LoadedVT != VT)
         Result = DAG.getNode(ISD::FP_EXTEND, dl, VT, Result);
@@ -530,10 +536,11 @@ SDValue ExpandUnalignedLoad(LoadSDNode *LD, SelectionDAG &DAG,
         // Load one integer register's worth from the original location.
         SDValue Load = DAG.getLoad(RegVT, dl, Chain, Ptr, LD->getSrcValue(),
                                    SVOffset + Offset, LD->isVolatile(),
+                                   LD->isNonTemporal(),
                                    MinAlign(LD->getAlignment(), Offset));
         // Follow the load with a store to the stack slot.  Remember the store.
         Stores.push_back(DAG.getStore(Load.getValue(1), dl, Load, StackPtr,
-                                      NULL, 0));
+                                      NULL, 0, false, false, 0));
         // Increment the pointers.
         Offset += RegBytes;
         Ptr = DAG.getNode(ISD::ADD, dl, Ptr.getValueType(), Ptr, Increment);
@@ -546,12 +553,13 @@ SDValue ExpandUnalignedLoad(LoadSDNode *LD, SelectionDAG &DAG,
       SDValue Load = DAG.getExtLoad(ISD::EXTLOAD, dl, RegVT, Chain, Ptr,
                                     LD->getSrcValue(), SVOffset + Offset,
                                     MemVT, LD->isVolatile(),
+                                    LD->isNonTemporal(),
                                     MinAlign(LD->getAlignment(), Offset));
       // Follow the load with a store to the stack slot.  Remember the store.
       // On big-endian machines this requires a truncating store to ensure
       // that the bits end up in the right place.
       Stores.push_back(DAG.getTruncStore(Load.getValue(1), dl, Load, StackPtr,
-                                         NULL, 0, MemVT));
+                                         NULL, 0, MemVT, false, false, 0));
 
       // The order of the stores doesn't matter - say it with a TokenFactor.
       SDValue TF = DAG.getNode(ISD::TokenFactor, dl, MVT::Other, &Stores[0],
@@ -559,7 +567,7 @@ SDValue ExpandUnalignedLoad(LoadSDNode *LD, SelectionDAG &DAG,
 
       // Finally, perform the original load only redirected to the stack slot.
       Load = DAG.getExtLoad(LD->getExtensionType(), dl, VT, TF, StackBase,
-                            NULL, 0, LoadedVT);
+                            NULL, 0, LoadedVT, false, false, 0);
 
       // Callers expect a MERGE_VALUES node.
       SDValue Ops[] = { Load, TF };
@@ -588,20 +596,22 @@ SDValue ExpandUnalignedLoad(LoadSDNode *LD, SelectionDAG &DAG,
   SDValue Lo, Hi;
   if (TLI.isLittleEndian()) {
     Lo = DAG.getExtLoad(ISD::ZEXTLOAD, dl, VT, Chain, Ptr, LD->getSrcValue(),
-                        SVOffset, NewLoadedVT, LD->isVolatile(), Alignment);
+                        SVOffset, NewLoadedVT, LD->isVolatile(),
+                        LD->isNonTemporal(), Alignment);
     Ptr = DAG.getNode(ISD::ADD, dl, Ptr.getValueType(), Ptr,
                       DAG.getConstant(IncrementSize, TLI.getPointerTy()));
     Hi = DAG.getExtLoad(HiExtType, dl, VT, Chain, Ptr, LD->getSrcValue(),
                         SVOffset + IncrementSize, NewLoadedVT, LD->isVolatile(),
-                        MinAlign(Alignment, IncrementSize));
+                        LD->isNonTemporal(), MinAlign(Alignment, IncrementSize));
   } else {
     Hi = DAG.getExtLoad(HiExtType, dl, VT, Chain, Ptr, LD->getSrcValue(),
-                        SVOffset, NewLoadedVT, LD->isVolatile(), Alignment);
+                        SVOffset, NewLoadedVT, LD->isVolatile(),
+                        LD->isNonTemporal(), Alignment);
     Ptr = DAG.getNode(ISD::ADD, dl, Ptr.getValueType(), Ptr,
                       DAG.getConstant(IncrementSize, TLI.getPointerTy()));
     Lo = DAG.getExtLoad(ISD::ZEXTLOAD, dl, VT, Chain, Ptr, LD->getSrcValue(),
                         SVOffset + IncrementSize, NewLoadedVT, LD->isVolatile(),
-                        MinAlign(Alignment, IncrementSize));
+                        LD->isNonTemporal(), MinAlign(Alignment, IncrementSize));
   }
 
   // aggregate the two parts
@@ -643,7 +653,8 @@ PerformInsertVectorEltInMemory(SDValue Vec, SDValue Val, SDValue Idx,
 
   // Store the vector.
   SDValue Ch = DAG.getStore(DAG.getEntryNode(), dl, Tmp1, StackPtr,
-                            PseudoSourceValue::getFixedStack(SPFI), 0);
+                            PseudoSourceValue::getFixedStack(SPFI), 0,
+                            false, false, 0);
 
   // Truncate or zero extend offset to target pointer type.
   unsigned CastOpc = IdxVT.bitsGT(PtrVT) ? ISD::TRUNCATE : ISD::ZERO_EXTEND;
@@ -654,10 +665,12 @@ PerformInsertVectorEltInMemory(SDValue Vec, SDValue Val, SDValue Idx,
   SDValue StackPtr2 = DAG.getNode(ISD::ADD, dl, IdxVT, Tmp3, StackPtr);
   // Store the scalar value.
   Ch = DAG.getTruncStore(Ch, dl, Tmp2, StackPtr2,
-                         PseudoSourceValue::getFixedStack(SPFI), 0, EltVT);
+                         PseudoSourceValue::getFixedStack(SPFI), 0, EltVT,
+                         false, false, 0);
   // Load the updated vector.
   return DAG.getLoad(VT, dl, Ch, StackPtr,
-                     PseudoSourceValue::getFixedStack(SPFI), 0);
+                     PseudoSourceValue::getFixedStack(SPFI), 0,
+                     false, false, 0);
 }
 
 
@@ -702,6 +715,7 @@ SDValue SelectionDAGLegalize::OptimizeFloatStore(StoreSDNode* ST) {
   int SVOffset = ST->getSrcValueOffset();
   unsigned Alignment = ST->getAlignment();
   bool isVolatile = ST->isVolatile();
+  bool isNonTemporal = ST->isNonTemporal();
   DebugLoc dl = ST->getDebugLoc();
   if (ConstantFPSDNode *CFP = dyn_cast<ConstantFPSDNode>(ST->getValue())) {
     if (CFP->getValueType(0) == MVT::f32 &&
@@ -710,14 +724,14 @@ SDValue SelectionDAGLegalize::OptimizeFloatStore(StoreSDNode* ST) {
                                       bitcastToAPInt().zextOrTrunc(32),
                               MVT::i32);
       return DAG.getStore(Tmp1, dl, Tmp3, Tmp2, ST->getSrcValue(),
-                          SVOffset, isVolatile, Alignment);
+                          SVOffset, isVolatile, isNonTemporal, Alignment);
     } else if (CFP->getValueType(0) == MVT::f64) {
       // If this target supports 64-bit registers, do a single 64-bit store.
       if (getTypeAction(MVT::i64) == Legal) {
         Tmp3 = DAG.getConstant(CFP->getValueAPF().bitcastToAPInt().
                                   zextOrTrunc(64), MVT::i64);
         return DAG.getStore(Tmp1, dl, Tmp3, Tmp2, ST->getSrcValue(),
-                            SVOffset, isVolatile, Alignment);
+                            SVOffset, isVolatile, isNonTemporal, Alignment);
       } else if (getTypeAction(MVT::i32) == Legal && !ST->isVolatile()) {
         // Otherwise, if the target supports 32-bit registers, use 2 32-bit
         // stores.  If the target supports neither 32- nor 64-bits, this
@@ -728,11 +742,11 @@ SDValue SelectionDAGLegalize::OptimizeFloatStore(StoreSDNode* ST) {
         if (TLI.isBigEndian()) std::swap(Lo, Hi);
 
         Lo = DAG.getStore(Tmp1, dl, Lo, Tmp2, ST->getSrcValue(),
-                          SVOffset, isVolatile, Alignment);
+                          SVOffset, isVolatile, isNonTemporal, Alignment);
         Tmp2 = DAG.getNode(ISD::ADD, dl, Tmp2.getValueType(), Tmp2,
                             DAG.getIntPtrConstant(4));
         Hi = DAG.getStore(Tmp1, dl, Hi, Tmp2, ST->getSrcValue(), SVOffset+4,
-                          isVolatile, MinAlign(Alignment, 4U));
+                          isVolatile, isNonTemporal, MinAlign(Alignment, 4U));
 
         return DAG.getNode(ISD::TokenFactor, dl, MVT::Other, Lo, Hi);
       }
@@ -1108,7 +1122,8 @@ SDValue SelectionDAGLegalize::LegalizeOp(SDValue Op) {
 
         Tmp1 = DAG.getLoad(NVT, dl, Tmp1, Tmp2, LD->getSrcValue(),
                            LD->getSrcValueOffset(),
-                           LD->isVolatile(), LD->getAlignment());
+                           LD->isVolatile(), LD->isNonTemporal(),
+                           LD->getAlignment());
         Tmp3 = LegalizeOp(DAG.getNode(ISD::BIT_CONVERT, dl, VT, Tmp1));
         Tmp4 = LegalizeOp(Tmp1.getValue(1));
         break;
@@ -1125,6 +1140,7 @@ SDValue SelectionDAGLegalize::LegalizeOp(SDValue Op) {
       int SVOffset = LD->getSrcValueOffset();
       unsigned Alignment = LD->getAlignment();
       bool isVolatile = LD->isVolatile();
+      bool isNonTemporal = LD->isNonTemporal();
 
       if (SrcWidth != SrcVT.getStoreSizeInBits() &&
           // Some targets pretend to have an i1 loading operation, and actually
@@ -1150,7 +1166,7 @@ SDValue SelectionDAGLegalize::LegalizeOp(SDValue Op) {
 
         Result = DAG.getExtLoad(NewExtType, dl, Node->getValueType(0),
                                 Tmp1, Tmp2, LD->getSrcValue(), SVOffset,
-                                NVT, isVolatile, Alignment);
+                                NVT, isVolatile, isNonTemporal, Alignment);
 
         Ch = Result.getValue(1); // The chain.
 
@@ -1187,7 +1203,7 @@ SDValue SelectionDAGLegalize::LegalizeOp(SDValue Op) {
           Lo = DAG.getExtLoad(ISD::ZEXTLOAD, dl,
                               Node->getValueType(0), Tmp1, Tmp2,
                               LD->getSrcValue(), SVOffset, RoundVT, isVolatile,
-                              Alignment);
+                              isNonTemporal, Alignment);
 
           // Load the remaining ExtraWidth bits.
           IncrementSize = RoundWidth / 8;
@@ -1195,7 +1211,7 @@ SDValue SelectionDAGLegalize::LegalizeOp(SDValue Op) {
                              DAG.getIntPtrConstant(IncrementSize));
           Hi = DAG.getExtLoad(ExtType, dl, Node->getValueType(0), Tmp1, Tmp2,
                               LD->getSrcValue(), SVOffset + IncrementSize,
-                              ExtraVT, isVolatile,
+                              ExtraVT, isVolatile, isNonTemporal,
                               MinAlign(Alignment, IncrementSize));
 
           // Build a factor node to remember that this load is independent of the
@@ -1215,7 +1231,7 @@ SDValue SelectionDAGLegalize::LegalizeOp(SDValue Op) {
           // Load the top RoundWidth bits.
           Hi = DAG.getExtLoad(ExtType, dl, Node->getValueType(0), Tmp1, Tmp2,
                               LD->getSrcValue(), SVOffset, RoundVT, isVolatile,
-                              Alignment);
+                              isNonTemporal, Alignment);
 
           // Load the remaining ExtraWidth bits.
           IncrementSize = RoundWidth / 8;
@@ -1224,7 +1240,7 @@ SDValue SelectionDAGLegalize::LegalizeOp(SDValue Op) {
           Lo = DAG.getExtLoad(ISD::ZEXTLOAD, dl,
                               Node->getValueType(0), Tmp1, Tmp2,
                               LD->getSrcValue(), SVOffset + IncrementSize,
-                              ExtraVT, isVolatile,
+                              ExtraVT, isVolatile, isNonTemporal,
                               MinAlign(Alignment, IncrementSize));
 
           // Build a factor node to remember that this load is independent of the
@@ -1284,7 +1300,8 @@ SDValue SelectionDAGLegalize::LegalizeOp(SDValue Op) {
               (SrcVT == MVT::f64 && Node->getValueType(0) == MVT::f128)) {
             SDValue Load = DAG.getLoad(SrcVT, dl, Tmp1, Tmp2, LD->getSrcValue(),
                                        LD->getSrcValueOffset(),
-                                       LD->isVolatile(), LD->getAlignment());
+                                       LD->isVolatile(), LD->isNonTemporal(),
+                                       LD->getAlignment());
             Result = DAG.getNode(ISD::FP_EXTEND, dl,
                                  Node->getValueType(0), Load);
             Tmp1 = LegalizeOp(Result);  // Relegalize new nodes.
@@ -1297,7 +1314,8 @@ SDValue SelectionDAGLegalize::LegalizeOp(SDValue Op) {
           Result = DAG.getExtLoad(ISD::EXTLOAD, dl, Node->getValueType(0),
                                   Tmp1, Tmp2, LD->getSrcValue(),
                                   LD->getSrcValueOffset(), SrcVT,
-                                  LD->isVolatile(), LD->getAlignment());
+                                  LD->isVolatile(), LD->isNonTemporal(),
+                                  LD->getAlignment());
           SDValue ValRes;
           if (ExtType == ISD::SEXTLOAD)
             ValRes = DAG.getNode(ISD::SIGN_EXTEND_INREG, dl,
@@ -1325,6 +1343,7 @@ SDValue SelectionDAGLegalize::LegalizeOp(SDValue Op) {
     int SVOffset = ST->getSrcValueOffset();
     unsigned Alignment = ST->getAlignment();
     bool isVolatile = ST->isVolatile();
+    bool isNonTemporal = ST->isNonTemporal();
 
     if (!ST->isTruncatingStore()) {
       if (SDNode *OptStore = OptimizeFloatStore(ST).getNode()) {
@@ -1361,7 +1380,7 @@ SDValue SelectionDAGLegalize::LegalizeOp(SDValue Op) {
                              TLI.getTypeToPromoteTo(ISD::STORE, VT), Tmp3);
           Result = DAG.getStore(Tmp1, dl, Tmp3, Tmp2,
                                 ST->getSrcValue(), SVOffset, isVolatile,
-                                Alignment);
+                                isNonTemporal, Alignment);
           break;
         }
         break;
@@ -1379,7 +1398,8 @@ SDValue SelectionDAGLegalize::LegalizeOp(SDValue Op) {
         EVT NVT = EVT::getIntegerVT(*DAG.getContext(), StVT.getStoreSizeInBits());
         Tmp3 = DAG.getZeroExtendInReg(Tmp3, dl, StVT);
         Result = DAG.getTruncStore(Tmp1, dl, Tmp3, Tmp2, ST->getSrcValue(),
-                                   SVOffset, NVT, isVolatile, Alignment);
+                                   SVOffset, NVT, isVolatile, isNonTemporal,
+                                   Alignment);
       } else if (StWidth & (StWidth - 1)) {
         // If not storing a power-of-2 number of bits, expand as two stores.
         assert(!StVT.isVector() && "Unsupported truncstore!");
@@ -1399,7 +1419,7 @@ SDValue SelectionDAGLegalize::LegalizeOp(SDValue Op) {
           // Store the bottom RoundWidth bits.
           Lo = DAG.getTruncStore(Tmp1, dl, Tmp3, Tmp2, ST->getSrcValue(),
                                  SVOffset, RoundVT,
-                                 isVolatile, Alignment);
+                                 isVolatile, isNonTemporal, Alignment);
 
           // Store the remaining ExtraWidth bits.
           IncrementSize = RoundWidth / 8;
@@ -1409,6 +1429,7 @@ SDValue SelectionDAGLegalize::LegalizeOp(SDValue Op) {
                            DAG.getConstant(RoundWidth, TLI.getShiftAmountTy()));
           Hi = DAG.getTruncStore(Tmp1, dl, Hi, Tmp2, ST->getSrcValue(),
                                  SVOffset + IncrementSize, ExtraVT, isVolatile,
+                                 isNonTemporal,
                                  MinAlign(Alignment, IncrementSize));
         } else {
           // Big endian - avoid unaligned stores.
@@ -1417,7 +1438,8 @@ SDValue SelectionDAGLegalize::LegalizeOp(SDValue Op) {
           Hi = DAG.getNode(ISD::SRL, dl, Tmp3.getValueType(), Tmp3,
                            DAG.getConstant(ExtraWidth, TLI.getShiftAmountTy()));
           Hi = DAG.getTruncStore(Tmp1, dl, Hi, Tmp2, ST->getSrcValue(),
-                                 SVOffset, RoundVT, isVolatile, Alignment);
+                                 SVOffset, RoundVT, isVolatile, isNonTemporal,
+                                 Alignment);
 
           // Store the remaining ExtraWidth bits.
           IncrementSize = RoundWidth / 8;
@@ -1425,6 +1447,7 @@ SDValue SelectionDAGLegalize::LegalizeOp(SDValue Op) {
                              DAG.getIntPtrConstant(IncrementSize));
           Lo = DAG.getTruncStore(Tmp1, dl, Tmp3, Tmp2, ST->getSrcValue(),
                                  SVOffset + IncrementSize, ExtraVT, isVolatile,
+                                 isNonTemporal,
                                  MinAlign(Alignment, IncrementSize));
         }
 
@@ -1457,7 +1480,8 @@ SDValue SelectionDAGLegalize::LegalizeOp(SDValue Op) {
           assert(isTypeLegal(StVT) && "Do not know how to expand this store!");
           Tmp3 = DAG.getNode(ISD::TRUNCATE, dl, StVT, Tmp3);
           Result = DAG.getStore(Tmp1, dl, Tmp3, Tmp2, ST->getSrcValue(),
-                                SVOffset, isVolatile, Alignment);
+                                SVOffset, isVolatile, isNonTemporal,
+                                Alignment);
           break;
         }
       }
@@ -1484,7 +1508,8 @@ SDValue SelectionDAGLegalize::ExpandExtractFromVectorThroughStack(SDValue Op) {
   DebugLoc dl = Op.getDebugLoc();
   // Store the value to a temporary stack slot, then LOAD the returned part.
   SDValue StackPtr = DAG.CreateStackTemporary(Vec.getValueType());
-  SDValue Ch = DAG.getStore(DAG.getEntryNode(), dl, Vec, StackPtr, NULL, 0);
+  SDValue Ch = DAG.getStore(DAG.getEntryNode(), dl, Vec, StackPtr, NULL, 0,
+                            false, false, 0);
 
   // Add the offset to the index.
   unsigned EltSize =
@@ -1500,10 +1525,12 @@ SDValue SelectionDAGLegalize::ExpandExtractFromVectorThroughStack(SDValue Op) {
   StackPtr = DAG.getNode(ISD::ADD, dl, Idx.getValueType(), Idx, StackPtr);
 
   if (Op.getValueType().isVector())
-    return DAG.getLoad(Op.getValueType(), dl, Ch, StackPtr, NULL, 0);
+    return DAG.getLoad(Op.getValueType(), dl, Ch, StackPtr, NULL, 0,
+                       false, false, 0);
   else
     return DAG.getExtLoad(ISD::EXTLOAD, dl, Op.getValueType(), Ch, StackPtr,
-                          NULL, 0, Vec.getValueType().getVectorElementType());
+                          NULL, 0, Vec.getValueType().getVectorElementType(),
+                          false, false, 0);
 }
 
 SDValue SelectionDAGLegalize::ExpandVectorBuildThroughStack(SDNode* Node) {
@@ -1512,7 +1539,6 @@ SDValue SelectionDAGLegalize::ExpandVectorBuildThroughStack(SDNode* Node) {
   // the result as a vector.
   // Create the stack frame object.
   EVT VT = Node->getValueType(0);
-  EVT OpVT = Node->getOperand(0).getValueType();
   EVT EltVT = VT.getVectorElementType();
   DebugLoc dl = Node->getDebugLoc();
   SDValue FIPtr = DAG.CreateStackTemporary(VT);
@@ -1532,13 +1558,16 @@ SDValue SelectionDAGLegalize::ExpandVectorBuildThroughStack(SDNode* Node) {
     SDValue Idx = DAG.getConstant(Offset, FIPtr.getValueType());
     Idx = DAG.getNode(ISD::ADD, dl, FIPtr.getValueType(), FIPtr, Idx);
 
-    // If EltVT smaller than OpVT, only store the bits necessary.
-    if (!OpVT.isVector() && EltVT.bitsLT(OpVT)) {
+    // If the destination vector element type is narrower than the source
+    // element type, only store the bits necessary.
+    if (EltVT.bitsLT(Node->getOperand(i).getValueType().getScalarType())) {
       Stores.push_back(DAG.getTruncStore(DAG.getEntryNode(), dl,
-                          Node->getOperand(i), Idx, SV, Offset, EltVT));
+                                         Node->getOperand(i), Idx, SV, Offset,
+                                         EltVT, false, false, 0));
     } else
       Stores.push_back(DAG.getStore(DAG.getEntryNode(), dl, 
-                                    Node->getOperand(i), Idx, SV, Offset));
+                                    Node->getOperand(i), Idx, SV, Offset,
+                                    false, false, 0));
   }
 
   SDValue StoreChain;
@@ -1549,7 +1578,7 @@ SDValue SelectionDAGLegalize::ExpandVectorBuildThroughStack(SDNode* Node) {
     StoreChain = DAG.getEntryNode();
 
   // Result is a load from the stack slot.
-  return DAG.getLoad(VT, dl, StoreChain, FIPtr, SV, 0);
+  return DAG.getLoad(VT, dl, StoreChain, FIPtr, SV, 0, false, false, 0);
 }
 
 SDValue SelectionDAGLegalize::ExpandFCOPYSIGN(SDNode* Node) {
@@ -1572,12 +1601,14 @@ SDValue SelectionDAGLegalize::ExpandFCOPYSIGN(SDNode* Node) {
     SDValue StackPtr = DAG.CreateStackTemporary(Tmp2.getValueType());
     SDValue StorePtr = StackPtr, LoadPtr = StackPtr;
     SDValue Ch =
-        DAG.getStore(DAG.getEntryNode(), dl, Tmp2, StorePtr, NULL, 0);
+      DAG.getStore(DAG.getEntryNode(), dl, Tmp2, StorePtr, NULL, 0,
+                   false, false, 0);
     if (Tmp2.getValueType() == MVT::f64 && TLI.isLittleEndian())
       LoadPtr = DAG.getNode(ISD::ADD, dl, StackPtr.getValueType(),
                             LoadPtr, DAG.getIntPtrConstant(4));
     SignBit = DAG.getExtLoad(ISD::SEXTLOAD, dl, TLI.getPointerTy(),
-                              Ch, LoadPtr, NULL, 0, MVT::i32);
+                             Ch, LoadPtr, NULL, 0, MVT::i32,
+                             false, false, 0);
   }
   SignBit =
       DAG.getSetCC(dl, TLI.getSetCCResultType(SignBit.getValueType()),
@@ -1701,20 +1732,21 @@ SDValue SelectionDAGLegalize::EmitStackConvert(SDValue SrcOp,
 
   if (SrcSize > SlotSize)
     Store = DAG.getTruncStore(DAG.getEntryNode(), dl, SrcOp, FIPtr,
-                              SV, 0, SlotVT, false, SrcAlign);
+                              SV, 0, SlotVT, false, false, SrcAlign);
   else {
     assert(SrcSize == SlotSize && "Invalid store");
     Store = DAG.getStore(DAG.getEntryNode(), dl, SrcOp, FIPtr,
-                         SV, 0, false, SrcAlign);
+                         SV, 0, false, false, SrcAlign);
   }
 
   // Result is a load from the stack slot.
   if (SlotSize == DestSize)
-    return DAG.getLoad(DestVT, dl, Store, FIPtr, SV, 0, false, DestAlign);
+    return DAG.getLoad(DestVT, dl, Store, FIPtr, SV, 0, false, false,
+                       DestAlign);
 
   assert(SlotSize < DestSize && "Unknown extension!");
   return DAG.getExtLoad(ISD::EXTLOAD, dl, DestVT, Store, FIPtr, SV, 0, SlotVT,
-                        false, DestAlign);
+                        false, false, DestAlign);
 }
 
 SDValue SelectionDAGLegalize::ExpandSCALAR_TO_VECTOR(SDNode *Node) {
@@ -1729,9 +1761,11 @@ SDValue SelectionDAGLegalize::ExpandSCALAR_TO_VECTOR(SDNode *Node) {
   SDValue Ch = DAG.getTruncStore(DAG.getEntryNode(), dl, Node->getOperand(0),
                                  StackPtr,
                                  PseudoSourceValue::getFixedStack(SPFI), 0,
-                                 Node->getValueType(0).getVectorElementType());
+                                 Node->getValueType(0).getVectorElementType(),
+                                 false, false, 0);
   return DAG.getLoad(Node->getValueType(0), dl, Ch, StackPtr,
-                     PseudoSourceValue::getFixedStack(SPFI), 0);
+                     PseudoSourceValue::getFixedStack(SPFI), 0,
+                     false, false, 0);
 }
 
 
@@ -1805,7 +1839,7 @@ SDValue SelectionDAGLegalize::ExpandBUILD_VECTOR(SDNode *Node) {
     unsigned Alignment = cast<ConstantPoolSDNode>(CPIdx)->getAlignment();
     return DAG.getLoad(VT, dl, DAG.getEntryNode(), CPIdx,
                        PseudoSourceValue::getConstantPool(), 0,
-                       false, Alignment);
+                       false, false, Alignment);
   }
 
   if (!MoreThanTwoValues) {
@@ -1865,8 +1899,7 @@ SDValue SelectionDAGLegalize::ExpandLibCall(RTLIB::Libcall LC, SDNode *Node,
     TLI.LowerCallTo(InChain, RetTy, isSigned, !isSigned, false, false,
                     0, TLI.getLibcallCallingConv(LC), false,
                     /*isReturnValueUsed=*/true,
-                    Callee, Args, DAG,
-                    Node->getDebugLoc(), DAG.GetOrdering(Node));
+                    Callee, Args, DAG, Node->getDebugLoc());
 
   // Legalize the call sequence, starting with the chain.  This will advance
   // the LastCALLSEQ_END to the legalized version of the CALLSEQ_END node that
@@ -1943,13 +1976,16 @@ SDValue SelectionDAGLegalize::ExpandLegalINT_TO_FP(bool isSigned,
     }
     // store the lo of the constructed double - based on integer input
     SDValue Store1 = DAG.getStore(DAG.getEntryNode(), dl,
-                                  Op0Mapped, Lo, NULL, 0);
+                                  Op0Mapped, Lo, NULL, 0,
+                                  false, false, 0);
     // initial hi portion of constructed double
     SDValue InitialHi = DAG.getConstant(0x43300000u, MVT::i32);
     // store the hi of the constructed double - biased exponent
-    SDValue Store2=DAG.getStore(Store1, dl, InitialHi, Hi, NULL, 0);
+    SDValue Store2=DAG.getStore(Store1, dl, InitialHi, Hi, NULL, 0,
+                                false, false, 0);
     // load the constructed double
-    SDValue Load = DAG.getLoad(MVT::f64, dl, Store2, StackSlot, NULL, 0);
+    SDValue Load = DAG.getLoad(MVT::f64, dl, Store2, StackSlot, NULL, 0,
+                               false, false, 0);
     // FP constant to bias correct the final result
     SDValue Bias = DAG.getConstantFP(isSigned ?
                                      BitsToDouble(0x4330000080000000ULL) :
@@ -1972,6 +2008,31 @@ SDValue SelectionDAGLegalize::ExpandLegalINT_TO_FP(bool isSigned,
     return Result;
   }
   assert(!isSigned && "Legalize cannot Expand SINT_TO_FP for i64 yet");
+
+  // Implementation of unsigned i64 to f64 following the algorithm in
+  // __floatundidf in compiler_rt. This implementation has the advantage
+  // of performing rounding correctly, both in the default rounding mode
+  // and in all alternate rounding modes.
+  // TODO: Generalize this for use with other types.
+  if (Op0.getValueType() == MVT::i64 && DestVT == MVT::f64) {
+    SDValue TwoP52 =
+      DAG.getConstant(UINT64_C(0x4330000000000000), MVT::i64);
+    SDValue TwoP84PlusTwoP52 =
+      DAG.getConstantFP(BitsToDouble(UINT64_C(0x4530000000100000)), MVT::f64);
+    SDValue TwoP84 =
+      DAG.getConstant(UINT64_C(0x4530000000000000), MVT::i64);
+
+    SDValue Lo = DAG.getZeroExtendInReg(Op0, dl, MVT::i32);
+    SDValue Hi = DAG.getNode(ISD::SRL, dl, MVT::i64, Op0,
+                             DAG.getConstant(32, MVT::i64));
+    SDValue LoOr = DAG.getNode(ISD::OR, dl, MVT::i64, Lo, TwoP52);
+    SDValue HiOr = DAG.getNode(ISD::OR, dl, MVT::i64, Hi, TwoP84);
+    SDValue LoFlt = DAG.getNode(ISD::BIT_CONVERT, dl, MVT::f64, LoOr);
+    SDValue HiFlt = DAG.getNode(ISD::BIT_CONVERT, dl, MVT::f64, HiOr);
+    SDValue HiSub = DAG.getNode(ISD::FSUB, dl, MVT::f64, HiFlt, TwoP84PlusTwoP52);
+    return DAG.getNode(ISD::FADD, dl, MVT::f64, LoFlt, HiSub);
+  }
+
   SDValue Tmp1 = DAG.getNode(ISD::SINT_TO_FP, dl, DestVT, Op0);
 
   SDValue SignSet = DAG.getSetCC(dl, TLI.getSetCCResultType(Op0.getValueType()),
@@ -2004,13 +2065,13 @@ SDValue SelectionDAGLegalize::ExpandLegalINT_TO_FP(bool isSigned,
   if (DestVT == MVT::f32)
     FudgeInReg = DAG.getLoad(MVT::f32, dl, DAG.getEntryNode(), CPIdx,
                              PseudoSourceValue::getConstantPool(), 0,
-                             false, Alignment);
+                             false, false, Alignment);
   else {
     FudgeInReg =
       LegalizeOp(DAG.getExtLoad(ISD::EXTLOAD, dl, DestVT,
                                 DAG.getEntryNode(), CPIdx,
                                 PseudoSourceValue::getConstantPool(), 0,
-                                MVT::f32, false, Alignment));
+                                MVT::f32, false, false, Alignment));
   }
 
   return DAG.getNode(ISD::FADD, dl, DestVT, Tmp1, FudgeInReg);
@@ -2271,7 +2332,7 @@ void SelectionDAGLegalize::ExpandNode(SDNode *Node,
                       false, false, false, false, 0, CallingConv::C, false,
                       /*isReturnValueUsed=*/true,
                       DAG.getExternalSymbol("abort", TLI.getPointerTy()),
-                      Args, DAG, dl, DAG.GetOrdering(Node));
+                      Args, DAG, dl);
     Results.push_back(CallResult.second);
     break;
   }
@@ -2350,16 +2411,19 @@ void SelectionDAGLegalize::ExpandNode(SDNode *Node,
     EVT VT = Node->getValueType(0);
     Tmp1 = Node->getOperand(0);
     Tmp2 = Node->getOperand(1);
-    SDValue VAList = DAG.getLoad(TLI.getPointerTy(), dl, Tmp1, Tmp2, V, 0);
+    SDValue VAList = DAG.getLoad(TLI.getPointerTy(), dl, Tmp1, Tmp2, V, 0,
+                                 false, false, 0);
     // Increment the pointer, VAList, to the next vaarg
     Tmp3 = DAG.getNode(ISD::ADD, dl, TLI.getPointerTy(), VAList,
                        DAG.getConstant(TLI.getTargetData()->
                                        getTypeAllocSize(VT.getTypeForEVT(*DAG.getContext())),
                                        TLI.getPointerTy()));
     // Store the incremented VAList to the legalized pointer
-    Tmp3 = DAG.getStore(VAList.getValue(1), dl, Tmp3, Tmp2, V, 0);
+    Tmp3 = DAG.getStore(VAList.getValue(1), dl, Tmp3, Tmp2, V, 0,
+                        false, false, 0);
     // Load the actual argument out of the pointer VAList
-    Results.push_back(DAG.getLoad(VT, dl, Tmp3, VAList, NULL, 0));
+    Results.push_back(DAG.getLoad(VT, dl, Tmp3, VAList, NULL, 0,
+                                  false, false, 0));
     Results.push_back(Results[0].getValue(1));
     break;
   }
@@ -2369,8 +2433,9 @@ void SelectionDAGLegalize::ExpandNode(SDNode *Node,
     const Value *VD = cast<SrcValueSDNode>(Node->getOperand(3))->getValue();
     const Value *VS = cast<SrcValueSDNode>(Node->getOperand(4))->getValue();
     Tmp1 = DAG.getLoad(TLI.getPointerTy(), dl, Node->getOperand(0),
-                       Node->getOperand(2), VS, 0);
-    Tmp1 = DAG.getStore(Tmp1.getValue(1), dl, Tmp1, Node->getOperand(1), VD, 0);
+                       Node->getOperand(2), VS, 0, false, false, 0);
+    Tmp1 = DAG.getStore(Tmp1.getValue(1), dl, Tmp1, Node->getOperand(1), VD, 0,
+                        false, false, 0);
     Results.push_back(Tmp1);
     break;
   }
@@ -2827,7 +2892,8 @@ void SelectionDAGLegalize::ExpandNode(SDNode *Node,
 
     EVT MemVT = EVT::getIntegerVT(*DAG.getContext(), EntrySize * 8);
     SDValue LD = DAG.getExtLoad(ISD::SEXTLOAD, dl, PTy, Chain, Addr,
-                                PseudoSourceValue::getJumpTable(), 0, MemVT);
+                                PseudoSourceValue::getJumpTable(), 0, MemVT,
+                                false, false, 0);
     Addr = LD;
     if (TLI.getTargetMachine().getRelocationModel() == Reloc::PIC_) {
       // For PIC, the sequence is:
diff --git a/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp b/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp
index 4f0fce7..35a7c7c 100644
--- a/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp
+++ b/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp
@@ -444,7 +444,7 @@ SDValue DAGTypeLegalizer::SoftenFloatRes_LOAD(SDNode *N) {
     NewL = DAG.getLoad(L->getAddressingMode(), dl, L->getExtensionType(),
                        NVT, L->getChain(), L->getBasePtr(), L->getOffset(),
                        L->getSrcValue(), L->getSrcValueOffset(), NVT,
-                       L->isVolatile(), L->getAlignment());
+                       L->isVolatile(), L->isNonTemporal(), L->getAlignment());
     // Legalized the chain result - switch anything that used the old chain to
     // use the new one.
     ReplaceValueWith(SDValue(N, 1), NewL.getValue(1));
@@ -456,8 +456,8 @@ SDValue DAGTypeLegalizer::SoftenFloatRes_LOAD(SDNode *N) {
                      L->getMemoryVT(), L->getChain(),
                      L->getBasePtr(), L->getOffset(),
                      L->getSrcValue(), L->getSrcValueOffset(),
-                     L->getMemoryVT(),
-                     L->isVolatile(), L->getAlignment());
+                     L->getMemoryVT(), L->isVolatile(),
+                     L->isNonTemporal(), L->getAlignment());
   // Legalized the chain result - switch anything that used the old chain to
   // use the new one.
   ReplaceValueWith(SDValue(N, 1), NewL.getValue(1));
@@ -755,7 +755,8 @@ SDValue DAGTypeLegalizer::SoftenFloatOp_STORE(SDNode *N, unsigned OpNo) {
 
   return DAG.getStore(ST->getChain(), dl, Val, ST->getBasePtr(),
                       ST->getSrcValue(), ST->getSrcValueOffset(),
-                      ST->isVolatile(), ST->getAlignment());
+                      ST->isVolatile(), ST->isNonTemporal(),
+                      ST->getAlignment());
 }
 
 
@@ -1073,8 +1074,8 @@ void DAGTypeLegalizer::ExpandFloatRes_LOAD(SDNode *N, SDValue &Lo,
 
   Hi = DAG.getExtLoad(LD->getExtensionType(), dl, NVT, Chain, Ptr,
                       LD->getSrcValue(), LD->getSrcValueOffset(),
-                      LD->getMemoryVT(),
-                      LD->isVolatile(), LD->getAlignment());
+                      LD->getMemoryVT(), LD->isVolatile(),
+                      LD->isNonTemporal(), LD->getAlignment());
 
   // Remember the chain.
   Chain = Hi.getValue(1);
@@ -1382,6 +1383,6 @@ SDValue DAGTypeLegalizer::ExpandFloatOp_STORE(SDNode *N, unsigned OpNo) {
 
   return DAG.getTruncStore(Chain, N->getDebugLoc(), Hi, Ptr,
                            ST->getSrcValue(), ST->getSrcValueOffset(),
-                           ST->getMemoryVT(),
-                           ST->isVolatile(), ST->getAlignment());
+                           ST->getMemoryVT(), ST->isVolatile(),
+                           ST->isNonTemporal(), ST->getAlignment());
 }
diff --git a/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp b/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
index 9932cf4..81f28ad 100644
--- a/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
+++ b/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
@@ -359,7 +359,7 @@ SDValue DAGTypeLegalizer::PromoteIntRes_LOAD(LoadSDNode *N) {
   SDValue Res = DAG.getExtLoad(ExtType, dl, NVT, N->getChain(), N->getBasePtr(),
                                N->getSrcValue(), N->getSrcValueOffset(),
                                N->getMemoryVT(), N->isVolatile(),
-                               N->getAlignment());
+                               N->isNonTemporal(), N->getAlignment());
 
   // Legalized the chain result - switch anything that used the old chain to
   // use the new one.
@@ -873,6 +873,7 @@ SDValue DAGTypeLegalizer::PromoteIntOp_STORE(StoreSDNode *N, unsigned OpNo){
   int SVOffset = N->getSrcValueOffset();
   unsigned Alignment = N->getAlignment();
   bool isVolatile = N->isVolatile();
+  bool isNonTemporal = N->isNonTemporal();
   DebugLoc dl = N->getDebugLoc();
 
   SDValue Val = GetPromotedInteger(N->getValue());  // Get promoted value.
@@ -880,7 +881,7 @@ SDValue DAGTypeLegalizer::PromoteIntOp_STORE(StoreSDNode *N, unsigned OpNo){
   // Truncate the value and store the result.
   return DAG.getTruncStore(Ch, dl, Val, Ptr, N->getSrcValue(),
                            SVOffset, N->getMemoryVT(),
-                           isVolatile, Alignment);
+                           isVolatile, isNonTemporal, Alignment);
 }
 
 SDValue DAGTypeLegalizer::PromoteIntOp_TRUNCATE(SDNode *N) {
@@ -1079,8 +1080,8 @@ ExpandShiftWithKnownAmountBit(SDNode *N, SDValue &Lo, SDValue &Hi) {
   SDValue Amt = N->getOperand(1);
   EVT NVT = TLI.getTypeToTransformTo(*DAG.getContext(), N->getValueType(0));
   EVT ShTy = Amt.getValueType();
-  unsigned ShBits = ShTy.getSizeInBits();
-  unsigned NVTBits = NVT.getSizeInBits();
+  unsigned ShBits = ShTy.getScalarType().getSizeInBits();
+  unsigned NVTBits = NVT.getScalarType().getSizeInBits();
   assert(isPowerOf2_32(NVTBits) &&
          "Expanded integer type size not a power of two!");
   DebugLoc dl = N->getDebugLoc();
@@ -1500,6 +1501,7 @@ void DAGTypeLegalizer::ExpandIntRes_LOAD(LoadSDNode *N,
   int SVOffset = N->getSrcValueOffset();
   unsigned Alignment = N->getAlignment();
   bool isVolatile = N->isVolatile();
+  bool isNonTemporal = N->isNonTemporal();
   DebugLoc dl = N->getDebugLoc();
 
   assert(NVT.isByteSized() && "Expanded type not byte sized!");
@@ -1508,7 +1510,7 @@ void DAGTypeLegalizer::ExpandIntRes_LOAD(LoadSDNode *N,
     EVT MemVT = N->getMemoryVT();
 
     Lo = DAG.getExtLoad(ExtType, dl, NVT, Ch, Ptr, N->getSrcValue(), SVOffset,
-                        MemVT, isVolatile, Alignment);
+                        MemVT, isVolatile, isNonTemporal, Alignment);
 
     // Remember the chain.
     Ch = Lo.getValue(1);
@@ -1530,7 +1532,7 @@ void DAGTypeLegalizer::ExpandIntRes_LOAD(LoadSDNode *N,
   } else if (TLI.isLittleEndian()) {
     // Little-endian - low bits are at low addresses.
     Lo = DAG.getLoad(NVT, dl, Ch, Ptr, N->getSrcValue(), SVOffset,
-                     isVolatile, Alignment);
+                     isVolatile, isNonTemporal, Alignment);
 
     unsigned ExcessBits =
       N->getMemoryVT().getSizeInBits() - NVT.getSizeInBits();
@@ -1542,7 +1544,8 @@ void DAGTypeLegalizer::ExpandIntRes_LOAD(LoadSDNode *N,
                       DAG.getIntPtrConstant(IncrementSize));
     Hi = DAG.getExtLoad(ExtType, dl, NVT, Ch, Ptr, N->getSrcValue(),
                         SVOffset+IncrementSize, NEVT,
-                        isVolatile, MinAlign(Alignment, IncrementSize));
+                        isVolatile, isNonTemporal,
+                        MinAlign(Alignment, IncrementSize));
 
     // Build a factor node to remember that this load is independent of the
     // other one.
@@ -1560,7 +1563,7 @@ void DAGTypeLegalizer::ExpandIntRes_LOAD(LoadSDNode *N,
     Hi = DAG.getExtLoad(ExtType, dl, NVT, Ch, Ptr, N->getSrcValue(), SVOffset,
                         EVT::getIntegerVT(*DAG.getContext(),
                                           MemVT.getSizeInBits() - ExcessBits),
-                        isVolatile, Alignment);
+                        isVolatile, isNonTemporal, Alignment);
 
     // Increment the pointer to the other half.
     Ptr = DAG.getNode(ISD::ADD, dl, Ptr.getValueType(), Ptr,
@@ -1569,7 +1572,8 @@ void DAGTypeLegalizer::ExpandIntRes_LOAD(LoadSDNode *N,
     Lo = DAG.getExtLoad(ISD::ZEXTLOAD, dl, NVT, Ch, Ptr, N->getSrcValue(),
                         SVOffset+IncrementSize,
                         EVT::getIntegerVT(*DAG.getContext(), ExcessBits),
-                        isVolatile, MinAlign(Alignment, IncrementSize));
+                        isVolatile, isNonTemporal,
+                        MinAlign(Alignment, IncrementSize));
 
     // Build a factor node to remember that this load is independent of the
     // other one.
@@ -2212,6 +2216,7 @@ SDValue DAGTypeLegalizer::ExpandIntOp_STORE(StoreSDNode *N, unsigned OpNo) {
   int SVOffset = N->getSrcValueOffset();
   unsigned Alignment = N->getAlignment();
   bool isVolatile = N->isVolatile();
+  bool isNonTemporal = N->isNonTemporal();
   DebugLoc dl = N->getDebugLoc();
   SDValue Lo, Hi;
 
@@ -2220,13 +2225,14 @@ SDValue DAGTypeLegalizer::ExpandIntOp_STORE(StoreSDNode *N, unsigned OpNo) {
   if (N->getMemoryVT().bitsLE(NVT)) {
     GetExpandedInteger(N->getValue(), Lo, Hi);
     return DAG.getTruncStore(Ch, dl, Lo, Ptr, N->getSrcValue(), SVOffset,
-                             N->getMemoryVT(), isVolatile, Alignment);
+                             N->getMemoryVT(), isVolatile, isNonTemporal,
+                             Alignment);
   } else if (TLI.isLittleEndian()) {
     // Little-endian - low bits are at low addresses.
     GetExpandedInteger(N->getValue(), Lo, Hi);
 
     Lo = DAG.getStore(Ch, dl, Lo, Ptr, N->getSrcValue(), SVOffset,
-                      isVolatile, Alignment);
+                      isVolatile, isNonTemporal, Alignment);
 
     unsigned ExcessBits =
       N->getMemoryVT().getSizeInBits() - NVT.getSizeInBits();
@@ -2238,7 +2244,8 @@ SDValue DAGTypeLegalizer::ExpandIntOp_STORE(StoreSDNode *N, unsigned OpNo) {
                       DAG.getIntPtrConstant(IncrementSize));
     Hi = DAG.getTruncStore(Ch, dl, Hi, Ptr, N->getSrcValue(),
                            SVOffset+IncrementSize, NEVT,
-                           isVolatile, MinAlign(Alignment, IncrementSize));
+                           isVolatile, isNonTemporal,
+                           MinAlign(Alignment, IncrementSize));
     return DAG.getNode(ISD::TokenFactor, dl, MVT::Other, Lo, Hi);
   } else {
     // Big-endian - high bits are at low addresses.  Favor aligned stores at
@@ -2264,7 +2271,8 @@ SDValue DAGTypeLegalizer::ExpandIntOp_STORE(StoreSDNode *N, unsigned OpNo) {
 
     // Store both the high bits and maybe some of the low bits.
     Hi = DAG.getTruncStore(Ch, dl, Hi, Ptr, N->getSrcValue(),
-                           SVOffset, HiVT, isVolatile, Alignment);
+                           SVOffset, HiVT, isVolatile, isNonTemporal,
+                           Alignment);
 
     // Increment the pointer to the other half.
     Ptr = DAG.getNode(ISD::ADD, dl, Ptr.getValueType(), Ptr,
@@ -2273,7 +2281,8 @@ SDValue DAGTypeLegalizer::ExpandIntOp_STORE(StoreSDNode *N, unsigned OpNo) {
     Lo = DAG.getTruncStore(Ch, dl, Lo, Ptr, N->getSrcValue(),
                            SVOffset+IncrementSize,
                            EVT::getIntegerVT(*DAG.getContext(), ExcessBits),
-                           isVolatile, MinAlign(Alignment, IncrementSize));
+                           isVolatile, isNonTemporal,
+                           MinAlign(Alignment, IncrementSize));
     return DAG.getNode(ISD::TokenFactor, dl, MVT::Other, Lo, Hi);
   }
 }
@@ -2341,7 +2350,7 @@ SDValue DAGTypeLegalizer::ExpandIntOp_UINT_TO_FP(SDNode *N) {
     // FIXME: Avoid the extend by constructing the right constant pool?
     SDValue Fudge = DAG.getExtLoad(ISD::EXTLOAD, dl, DstVT, DAG.getEntryNode(),
                                    FudgePtr, NULL, 0, MVT::f32,
-                                   false, Alignment);
+                                   false, false, Alignment);
     return DAG.getNode(ISD::FADD, dl, DstVT, SignedConv, Fudge);
   }
 
diff --git a/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp b/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp
index 37f36a3..f3e7ca4 100644
--- a/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp
+++ b/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp
@@ -871,9 +871,10 @@ SDValue DAGTypeLegalizer::CreateStackStoreLoad(SDValue Op,
   // the source and destination types.
   SDValue StackPtr = DAG.CreateStackTemporary(Op.getValueType(), DestVT);
   // Emit a store to the stack slot.
-  SDValue Store = DAG.getStore(DAG.getEntryNode(), dl, Op, StackPtr, NULL, 0);
+  SDValue Store = DAG.getStore(DAG.getEntryNode(), dl, Op, StackPtr, NULL, 0,
+                               false, false, 0);
   // Result is a load from the stack slot.
-  return DAG.getLoad(DestVT, dl, Store, StackPtr, NULL, 0);
+  return DAG.getLoad(DestVT, dl, Store, StackPtr, NULL, 0, false, false, 0);
 }
 
 /// CustomLowerNode - Replace the node's results with custom code provided
@@ -1033,8 +1034,7 @@ SDValue DAGTypeLegalizer::MakeLibCall(RTLIB::Libcall LC, EVT RetVT,
     TLI.LowerCallTo(DAG.getEntryNode(), RetTy, isSigned, !isSigned, false,
                     false, 0, TLI.getLibcallCallingConv(LC), false,
                     /*isReturnValueUsed=*/true,
-                    Callee, Args, DAG, dl,
-                    DAG.GetOrdering(DAG.getEntryNode().getNode()));
+                    Callee, Args, DAG, dl);
   return CallInfo.first;
 }
 
diff --git a/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/LegalizeTypesGeneric.cpp b/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/LegalizeTypesGeneric.cpp
index a1b6ced..5e83b4b 100644
--- a/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/LegalizeTypesGeneric.cpp
+++ b/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/LegalizeTypesGeneric.cpp
@@ -122,10 +122,11 @@ void DAGTypeLegalizer::ExpandRes_BIT_CONVERT(SDNode *N, SDValue &Lo,
   const Value *SV = PseudoSourceValue::getFixedStack(SPFI);
 
   // Emit a store to the stack slot.
-  SDValue Store = DAG.getStore(DAG.getEntryNode(), dl, InOp, StackPtr, SV, 0);
+  SDValue Store = DAG.getStore(DAG.getEntryNode(), dl, InOp, StackPtr, SV, 0,
+                               false, false, 0);
 
   // Load the first half from the stack slot.
-  Lo = DAG.getLoad(NOutVT, dl, Store, StackPtr, SV, 0);
+  Lo = DAG.getLoad(NOutVT, dl, Store, StackPtr, SV, 0, false, false, 0);
 
   // Increment the pointer to the other half.
   unsigned IncrementSize = NOutVT.getSizeInBits() / 8;
@@ -134,7 +135,7 @@ void DAGTypeLegalizer::ExpandRes_BIT_CONVERT(SDNode *N, SDValue &Lo,
 
   // Load the second half from the stack slot.
   Hi = DAG.getLoad(NOutVT, dl, Store, StackPtr, SV, IncrementSize, false,
-                   MinAlign(Alignment, IncrementSize));
+                   false, MinAlign(Alignment, IncrementSize));
 
   // Handle endianness of the load.
   if (TLI.isBigEndian())
@@ -205,11 +206,12 @@ void DAGTypeLegalizer::ExpandRes_NormalLoad(SDNode *N, SDValue &Lo,
   int SVOffset = LD->getSrcValueOffset();
   unsigned Alignment = LD->getAlignment();
   bool isVolatile = LD->isVolatile();
+  bool isNonTemporal = LD->isNonTemporal();
 
   assert(NVT.isByteSized() && "Expanded type not byte sized!");
 
   Lo = DAG.getLoad(NVT, dl, Chain, Ptr, LD->getSrcValue(), SVOffset,
-                   isVolatile, Alignment);
+                   isVolatile, isNonTemporal, Alignment);
 
   // Increment the pointer to the other half.
   unsigned IncrementSize = NVT.getSizeInBits() / 8;
@@ -217,7 +219,8 @@ void DAGTypeLegalizer::ExpandRes_NormalLoad(SDNode *N, SDValue &Lo,
                     DAG.getIntPtrConstant(IncrementSize));
   Hi = DAG.getLoad(NVT, dl, Chain, Ptr, LD->getSrcValue(),
                    SVOffset+IncrementSize,
-                   isVolatile, MinAlign(Alignment, IncrementSize));
+                   isVolatile, isNonTemporal,
+                   MinAlign(Alignment, IncrementSize));
 
   // Build a factor node to remember that this load is independent of the
   // other one.
@@ -383,6 +386,7 @@ SDValue DAGTypeLegalizer::ExpandOp_NormalStore(SDNode *N, unsigned OpNo) {
   int SVOffset = St->getSrcValueOffset();
   unsigned Alignment = St->getAlignment();
   bool isVolatile = St->isVolatile();
+  bool isNonTemporal = St->isNonTemporal();
 
   assert(NVT.isByteSized() && "Expanded type not byte sized!");
   unsigned IncrementSize = NVT.getSizeInBits() / 8;
@@ -394,14 +398,15 @@ SDValue DAGTypeLegalizer::ExpandOp_NormalStore(SDNode *N, unsigned OpNo) {
     std::swap(Lo, Hi);
 
   Lo = DAG.getStore(Chain, dl, Lo, Ptr, St->getSrcValue(), SVOffset,
-                    isVolatile, Alignment);
+                    isVolatile, isNonTemporal, Alignment);
 
   Ptr = DAG.getNode(ISD::ADD, dl, Ptr.getValueType(), Ptr,
                     DAG.getIntPtrConstant(IncrementSize));
   assert(isTypeLegal(Ptr.getValueType()) && "Pointers must be legal!");
   Hi = DAG.getStore(Chain, dl, Hi, Ptr, St->getSrcValue(),
                     SVOffset + IncrementSize,
-                    isVolatile, MinAlign(Alignment, IncrementSize));
+                    isVolatile, isNonTemporal,
+                    MinAlign(Alignment, IncrementSize));
 
   return DAG.getNode(ISD::TokenFactor, dl, MVT::Other, Lo, Hi);
 }
diff --git a/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp b/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
index e955e10..8363c3a 100644
--- a/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
+++ b/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
@@ -172,7 +172,8 @@ SDValue DAGTypeLegalizer::ScalarizeVecRes_LOAD(LoadSDNode *N) {
                                DAG.getUNDEF(N->getBasePtr().getValueType()),
                                N->getSrcValue(), N->getSrcValueOffset(),
                                N->getMemoryVT().getVectorElementType(),
-                               N->isVolatile(), N->getOriginalAlignment());
+                               N->isVolatile(), N->isNonTemporal(),
+                               N->getOriginalAlignment());
 
   // Legalized the chain result - switch anything that used the old chain to
   // use the new one.
@@ -366,11 +367,13 @@ SDValue DAGTypeLegalizer::ScalarizeVecOp_STORE(StoreSDNode *N, unsigned OpNo){
                              N->getBasePtr(),
                              N->getSrcValue(), N->getSrcValueOffset(),
                              N->getMemoryVT().getVectorElementType(),
-                             N->isVolatile(), N->getAlignment());
+                             N->isVolatile(), N->isNonTemporal(),
+                             N->getAlignment());
 
   return DAG.getStore(N->getChain(), dl, GetScalarizedVector(N->getOperand(1)),
                       N->getBasePtr(), N->getSrcValue(), N->getSrcValueOffset(),
-                      N->isVolatile(), N->getOriginalAlignment());
+                      N->isVolatile(), N->isNonTemporal(),
+                      N->getOriginalAlignment());
 }
 
 
@@ -696,17 +699,20 @@ void DAGTypeLegalizer::SplitVecRes_INSERT_VECTOR_ELT(SDNode *N, SDValue &Lo,
   EVT VecVT = Vec.getValueType();
   EVT EltVT = VecVT.getVectorElementType();
   SDValue StackPtr = DAG.CreateStackTemporary(VecVT);
-  SDValue Store = DAG.getStore(DAG.getEntryNode(), dl, Vec, StackPtr, NULL, 0);
+  SDValue Store = DAG.getStore(DAG.getEntryNode(), dl, Vec, StackPtr, NULL, 0,
+                               false, false, 0);
 
   // Store the new element.  This may be larger than the vector element type,
   // so use a truncating store.
   SDValue EltPtr = GetVectorElementPointer(StackPtr, EltVT, Idx);
   unsigned Alignment =
     TLI.getTargetData()->getPrefTypeAlignment(VecVT.getTypeForEVT(*DAG.getContext()));
-  Store = DAG.getTruncStore(Store, dl, Elt, EltPtr, NULL, 0, EltVT);
+  Store = DAG.getTruncStore(Store, dl, Elt, EltPtr, NULL, 0, EltVT,
+                            false, false, 0);
 
   // Load the Lo part from the stack slot.
-  Lo = DAG.getLoad(Lo.getValueType(), dl, Store, StackPtr, NULL, 0);
+  Lo = DAG.getLoad(Lo.getValueType(), dl, Store, StackPtr, NULL, 0,
+                   false, false, 0);
 
   // Increment the pointer to the other part.
   unsigned IncrementSize = Lo.getValueType().getSizeInBits() / 8;
@@ -715,7 +721,7 @@ void DAGTypeLegalizer::SplitVecRes_INSERT_VECTOR_ELT(SDNode *N, SDValue &Lo,
 
   // Load the Hi part from the stack slot.
   Hi = DAG.getLoad(Hi.getValueType(), dl, Store, StackPtr, NULL, 0, false,
-                   MinAlign(Alignment, IncrementSize));
+                   false, MinAlign(Alignment, IncrementSize));
 }
 
 void DAGTypeLegalizer::SplitVecRes_SCALAR_TO_VECTOR(SDNode *N, SDValue &Lo,
@@ -743,19 +749,20 @@ void DAGTypeLegalizer::SplitVecRes_LOAD(LoadSDNode *LD, SDValue &Lo,
   EVT MemoryVT = LD->getMemoryVT();
   unsigned Alignment = LD->getOriginalAlignment();
   bool isVolatile = LD->isVolatile();
+  bool isNonTemporal = LD->isNonTemporal();
 
   EVT LoMemVT, HiMemVT;
   GetSplitDestVTs(MemoryVT, LoMemVT, HiMemVT);
 
   Lo = DAG.getLoad(ISD::UNINDEXED, dl, ExtType, LoVT, Ch, Ptr, Offset,
-                   SV, SVOffset, LoMemVT, isVolatile, Alignment);
+                   SV, SVOffset, LoMemVT, isVolatile, isNonTemporal, Alignment);
 
   unsigned IncrementSize = LoMemVT.getSizeInBits()/8;
   Ptr = DAG.getNode(ISD::ADD, dl, Ptr.getValueType(), Ptr,
                     DAG.getIntPtrConstant(IncrementSize));
   SVOffset += IncrementSize;
   Hi = DAG.getLoad(ISD::UNINDEXED, dl, ExtType, HiVT, Ch, Ptr, Offset,
-                   SV, SVOffset, HiMemVT, isVolatile, Alignment);
+                   SV, SVOffset, HiMemVT, isVolatile, isNonTemporal, Alignment);
 
   // Build a factor node to remember that this load is independent of the
   // other one.
@@ -1086,12 +1093,13 @@ SDValue DAGTypeLegalizer::SplitVecOp_EXTRACT_VECTOR_ELT(SDNode *N) {
   SDValue StackPtr = DAG.CreateStackTemporary(VecVT);
   int SPFI = cast<FrameIndexSDNode>(StackPtr.getNode())->getIndex();
   const Value *SV = PseudoSourceValue::getFixedStack(SPFI);
-  SDValue Store = DAG.getStore(DAG.getEntryNode(), dl, Vec, StackPtr, SV, 0);
+  SDValue Store = DAG.getStore(DAG.getEntryNode(), dl, Vec, StackPtr, SV, 0,
+                               false, false, 0);
 
   // Load back the required element.
   StackPtr = GetVectorElementPointer(StackPtr, EltVT, Idx);
   return DAG.getExtLoad(ISD::EXTLOAD, dl, N->getValueType(0), Store, StackPtr,
-                        SV, 0, EltVT);
+                        SV, 0, EltVT, false, false, 0);
 }
 
 SDValue DAGTypeLegalizer::SplitVecOp_STORE(StoreSDNode *N, unsigned OpNo) {
@@ -1106,6 +1114,7 @@ SDValue DAGTypeLegalizer::SplitVecOp_STORE(StoreSDNode *N, unsigned OpNo) {
   EVT MemoryVT = N->getMemoryVT();
   unsigned Alignment = N->getOriginalAlignment();
   bool isVol = N->isVolatile();
+  bool isNT = N->isNonTemporal();
   SDValue Lo, Hi;
   GetSplitVector(N->getOperand(1), Lo, Hi);
 
@@ -1116,10 +1125,10 @@ SDValue DAGTypeLegalizer::SplitVecOp_STORE(StoreSDNode *N, unsigned OpNo) {
 
   if (isTruncating)
     Lo = DAG.getTruncStore(Ch, dl, Lo, Ptr, N->getSrcValue(), SVOffset,
-                           LoMemVT, isVol, Alignment);
+                           LoMemVT, isVol, isNT, Alignment);
   else
     Lo = DAG.getStore(Ch, dl, Lo, Ptr, N->getSrcValue(), SVOffset,
-                      isVol, Alignment);
+                      isVol, isNT, Alignment);
 
   // Increment the pointer to the other half.
   Ptr = DAG.getNode(ISD::ADD, dl, Ptr.getValueType(), Ptr,
@@ -1128,10 +1137,10 @@ SDValue DAGTypeLegalizer::SplitVecOp_STORE(StoreSDNode *N, unsigned OpNo) {
 
   if (isTruncating)
     Hi = DAG.getTruncStore(Ch, dl, Hi, Ptr, N->getSrcValue(), SVOffset,
-                           HiMemVT, isVol, Alignment);
+                           HiMemVT, isVol, isNT, Alignment);
   else
     Hi = DAG.getStore(Ch, dl, Hi, Ptr, N->getSrcValue(), SVOffset,
-                      isVol, Alignment);
+                      isVol, isNT, Alignment);
 
   return DAG.getNode(ISD::TokenFactor, dl, MVT::Other, Lo, Hi);
 }
@@ -2128,6 +2137,7 @@ SDValue DAGTypeLegalizer::GenWidenVectorLoads(SmallVector<SDValue, 16>& LdChain,
   int       SVOffset = LD->getSrcValueOffset();
   unsigned  Align    = LD->getAlignment();
   bool      isVolatile = LD->isVolatile();
+  bool      isNonTemporal = LD->isNonTemporal();
   const Value *SV = LD->getSrcValue();
 
   int LdWidth = LdVT.getSizeInBits();
@@ -2138,7 +2148,7 @@ SDValue DAGTypeLegalizer::GenWidenVectorLoads(SmallVector<SDValue, 16>& LdChain,
   EVT NewVT = FindMemType(DAG, TLI, LdWidth, WidenVT, LdAlign, WidthDiff);
   int NewVTWidth = NewVT.getSizeInBits();
   SDValue LdOp = DAG.getLoad(NewVT, dl, Chain, BasePtr, SV, SVOffset,
-                             isVolatile, Align);
+                             isVolatile, isNonTemporal, Align);
   LdChain.push_back(LdOp.getValue(1));
 
   // Check if we can load the element with one instruction
@@ -2185,7 +2195,7 @@ SDValue DAGTypeLegalizer::GenWidenVectorLoads(SmallVector<SDValue, 16>& LdChain,
 
     SDValue LdOp = DAG.getLoad(NewVT, dl, Chain, BasePtr, SV,
                                SVOffset+Offset, isVolatile,
-                               MinAlign(Align, Increment));
+                               isNonTemporal, MinAlign(Align, Increment));
     LdChain.push_back(LdOp.getValue(1));
     LdOps.push_back(LdOp);
 
@@ -2259,6 +2269,7 @@ DAGTypeLegalizer::GenWidenVectorExtLoads(SmallVector<SDValue, 16>& LdChain,
   int       SVOffset = LD->getSrcValueOffset();
   unsigned  Align    = LD->getAlignment();
   bool      isVolatile = LD->isVolatile();
+  bool      isNonTemporal = LD->isNonTemporal();
   const Value *SV = LD->getSrcValue();
 
   EVT EltVT = WidenVT.getVectorElementType();
@@ -2270,14 +2281,15 @@ DAGTypeLegalizer::GenWidenVectorExtLoads(SmallVector<SDValue, 16>& LdChain,
   SmallVector<SDValue, 16> Ops(WidenNumElts);
   unsigned Increment = LdEltVT.getSizeInBits() / 8;
   Ops[0] = DAG.getExtLoad(ExtType, dl, EltVT, Chain, BasePtr, SV, SVOffset,
-                          LdEltVT, isVolatile, Align);
+                          LdEltVT, isVolatile, isNonTemporal, Align);
   LdChain.push_back(Ops[0].getValue(1));
   unsigned i = 0, Offset = Increment;
   for (i=1; i < NumElts; ++i, Offset += Increment) {
     SDValue NewBasePtr = DAG.getNode(ISD::ADD, dl, BasePtr.getValueType(),
                                      BasePtr, DAG.getIntPtrConstant(Offset));
     Ops[i] = DAG.getExtLoad(ExtType, dl, EltVT, Chain, NewBasePtr, SV,
-                            SVOffset + Offset, LdEltVT, isVolatile, Align);
+                            SVOffset + Offset, LdEltVT, isVolatile,
+                            isNonTemporal, Align);
     LdChain.push_back(Ops[i].getValue(1));
   }
 
@@ -2301,6 +2313,7 @@ void DAGTypeLegalizer::GenWidenVectorStores(SmallVector<SDValue, 16>& StChain,
   int      SVOffset = ST->getSrcValueOffset();
   unsigned Align = ST->getAlignment();
   bool     isVolatile = ST->isVolatile();
+  bool     isNonTemporal = ST->isNonTemporal();
   SDValue  ValOp = GetWidenedVector(ST->getValue());
   DebugLoc dl = ST->getDebugLoc();
 
@@ -2326,6 +2339,7 @@ void DAGTypeLegalizer::GenWidenVectorStores(SmallVector<SDValue, 16>& StChain,
                                    DAG.getIntPtrConstant(Idx));
         StChain.push_back(DAG.getStore(Chain, dl, EOp, BasePtr, SV,
                                        SVOffset + Offset, isVolatile,
+                                       isNonTemporal,
                                        MinAlign(Align, Offset)));
         StWidth -= NewVTWidth;
         Offset += Increment;
@@ -2344,8 +2358,8 @@ void DAGTypeLegalizer::GenWidenVectorStores(SmallVector<SDValue, 16>& StChain,
         SDValue EOp = DAG.getNode(ISD::EXTRACT_VECTOR_ELT, dl, NewVT, VecOp,
                       DAG.getIntPtrConstant(Idx++));
         StChain.push_back(DAG.getStore(Chain, dl, EOp, BasePtr, SV,
-                                   SVOffset + Offset, isVolatile,
-                                   MinAlign(Align, Offset)));
+                                       SVOffset + Offset, isVolatile,
+                                       isNonTemporal, MinAlign(Align, Offset)));
         StWidth -= NewVTWidth;
         Offset += Increment;
         BasePtr = DAG.getNode(ISD::ADD, dl, BasePtr.getValueType(), BasePtr,
@@ -2368,6 +2382,7 @@ DAGTypeLegalizer::GenWidenVectorTruncStores(SmallVector<SDValue, 16>& StChain,
   int      SVOffset = ST->getSrcValueOffset();
   unsigned Align = ST->getAlignment();
   bool     isVolatile = ST->isVolatile();
+  bool     isNonTemporal = ST->isNonTemporal();
   SDValue  ValOp = GetWidenedVector(ST->getValue());
   DebugLoc dl = ST->getDebugLoc();
   
@@ -2390,7 +2405,7 @@ DAGTypeLegalizer::GenWidenVectorTruncStores(SmallVector<SDValue, 16>& StChain,
                             DAG.getIntPtrConstant(0));
   StChain.push_back(DAG.getTruncStore(Chain, dl, EOp, BasePtr, SV,
                                       SVOffset, StEltVT,
-                                      isVolatile, Align));
+                                      isVolatile, isNonTemporal, Align));
   unsigned Offset = Increment;
   for (unsigned i=1; i < NumElts; ++i, Offset += Increment) {
     SDValue NewBasePtr = DAG.getNode(ISD::ADD, dl, BasePtr.getValueType(),
@@ -2399,7 +2414,8 @@ DAGTypeLegalizer::GenWidenVectorTruncStores(SmallVector<SDValue, 16>& StChain,
                             DAG.getIntPtrConstant(0));
     StChain.push_back(DAG.getTruncStore(Chain, dl, EOp, NewBasePtr, SV,
                                         SVOffset + Offset, StEltVT,
-                                        isVolatile, MinAlign(Align, Offset)));
+                                        isVolatile, isNonTemporal,
+                                        MinAlign(Align, Offset)));
   }
 }
 
diff --git a/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/SDDbgValue.h b/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/SDDbgValue.h
new file mode 100644
index 0000000..9e15fc9
--- /dev/null
+++ b/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/SDDbgValue.h
@@ -0,0 +1,67 @@
+//===-- llvm/CodeGen/SDDbgValue.h - SD dbg_value handling--------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file declares the SDDbgValue class.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_CODEGEN_SDDBGVALUE_H
+#define LLVM_CODEGEN_SDDBGVALUE_H
+
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/Support/DebugLoc.h"
+
+namespace llvm {
+
+class MDNode;
+class SDNode;
+class Value;
+
+/// SDDbgValue - Holds the information from a dbg_value node through SDISel.
+/// Either Const or Node is nonzero, but not both.
+/// We do not use SDValue here to avoid including its header.
+
+class SDDbgValue {
+  SDNode *Node;           // valid for non-constants
+  unsigned ResNo;         // valid for non-constants
+  Value *Const;           // valid for constants
+  MDNode *mdPtr;
+  uint64_t Offset;
+  DebugLoc DL;
+public:
+  // Constructor for non-constants.
+  SDDbgValue(MDNode *mdP, SDNode *N, unsigned R, uint64_t off, DebugLoc dl) :
+    Node(N), ResNo(R), Const(0), mdPtr(mdP), Offset(off), DL(dl) {}
+
+  // Constructor for constants.
+  SDDbgValue(MDNode *mdP, Value *C, uint64_t off, DebugLoc dl) : Node(0),
+    ResNo(0), Const(C), mdPtr(mdP), Offset(off), DL(dl) {}
+
+  // Returns the MDNode pointer.
+  MDNode *getMDPtr() { return mdPtr; }
+
+  // Returns the SDNode* (valid for non-constants only).
+  SDNode *getSDNode() { assert (!Const); return Node; }
+
+  // Returns the ResNo (valid for non-constants only).
+  unsigned getResNo() { assert (!Const); return ResNo; }
+
+  // Returns the Value* for a constant (invalid for non-constants).
+  Value *getConst() { assert (!Node); return Const; }
+
+  // Returns the offset.
+  uint64_t getOffset() { return Offset; }
+
+  // Returns the DebugLoc.
+  DebugLoc getDebugLoc() { return DL; }
+};
+
+} // end llvm namespace
+
+#endif
diff --git a/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp b/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp
index b51c61b..06e7b8c 100644
--- a/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp
+++ b/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp
@@ -218,8 +218,20 @@ void ScheduleDAGSDNodes::BuildSchedUnits() {
   // Check to see if the scheduler cares about latencies.
   bool UnitLatencies = ForceUnitLatencies();
 
-  for (SelectionDAG::allnodes_iterator NI = DAG->allnodes_begin(),
-       E = DAG->allnodes_end(); NI != E; ++NI) {
+  // Add all nodes in depth first order.
+  SmallVector<SDNode*, 64> Worklist;
+  SmallPtrSet<SDNode*, 64> Visited;
+  Worklist.push_back(DAG->getRoot().getNode());
+  Visited.insert(DAG->getRoot().getNode());
+  
+  while (!Worklist.empty()) {
+    SDNode *NI = Worklist.pop_back_val();
+    
+    // Add all operands to the worklist unless they've already been added.
+    for (unsigned i = 0, e = NI->getNumOperands(); i != e; ++i)
+      if (Visited.insert(NI->getOperand(i).getNode()))
+        Worklist.push_back(NI->getOperand(i).getNode());
+  
     if (isPassiveNode(NI))  // Leaf node, e.g. a TargetImmediate.
       continue;
     
diff --git a/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index 6122a2a..023e486 100644
--- a/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -468,18 +468,20 @@ static void AddNodeIDNode(FoldingSetNodeID &ID, const SDNode *N) {
 }
 
 /// encodeMemSDNodeFlags - Generic routine for computing a value for use in
-/// the CSE map that carries volatility, indexing mode, and
+/// the CSE map that carries volatility, temporalness, indexing mode, and
 /// extension/truncation information.
 ///
 static inline unsigned
-encodeMemSDNodeFlags(int ConvType, ISD::MemIndexedMode AM, bool isVolatile) {
+encodeMemSDNodeFlags(int ConvType, ISD::MemIndexedMode AM, bool isVolatile,
+                     bool isNonTemporal) {
   assert((ConvType & 3) == ConvType &&
          "ConvType may not require more than 2 bits!");
   assert((AM & 7) == AM &&
          "AM may not require more than 3 bits!");
   return ConvType |
          (AM << 2) |
-         (isVolatile << 5);
+         (isVolatile << 5) |
+         (isNonTemporal << 6);
 }
 
 //===----------------------------------------------------------------------===//
@@ -829,6 +831,7 @@ void SelectionDAG::clear() {
   EntryNode.UseList = 0;
   AllNodes.push_back(&EntryNode);
   Root = getEntryNode();
+  delete Ordering;
   Ordering = new SDNodeOrdering();
 }
 
@@ -859,14 +862,14 @@ SDValue SelectionDAG::getZeroExtendInReg(SDValue Op, DebugLoc DL, EVT VT) {
 /// getNOT - Create a bitwise NOT operation as (XOR Val, -1).
 ///
 SDValue SelectionDAG::getNOT(DebugLoc DL, SDValue Val, EVT VT) {
-  EVT EltVT = VT.isVector() ? VT.getVectorElementType() : VT;
+  EVT EltVT = VT.getScalarType();
   SDValue NegOne =
     getConstant(APInt::getAllOnesValue(EltVT.getSizeInBits()), VT);
   return getNode(ISD::XOR, DL, VT, Val, NegOne);
 }
 
 SDValue SelectionDAG::getConstant(uint64_t Val, EVT VT, bool isT) {
-  EVT EltVT = VT.isVector() ? VT.getVectorElementType() : VT;
+  EVT EltVT = VT.getScalarType();
   assert((EltVT.getSizeInBits() >= 64 ||
          (uint64_t)((int64_t)Val >> EltVT.getSizeInBits()) + 1 < 2) &&
          "getConstant with a uint64_t value that doesn't fit in the type!");
@@ -880,7 +883,7 @@ SDValue SelectionDAG::getConstant(const APInt &Val, EVT VT, bool isT) {
 SDValue SelectionDAG::getConstant(const ConstantInt &Val, EVT VT, bool isT) {
   assert(VT.isInteger() && "Cannot create FP integer constant!");
 
-  EVT EltVT = VT.isVector() ? VT.getVectorElementType() : VT;
+  EVT EltVT = VT.getScalarType();
   assert(Val.getBitWidth() == EltVT.getSizeInBits() &&
          "APInt size does not match type size!");
 
@@ -923,8 +926,7 @@ SDValue SelectionDAG::getConstantFP(const APFloat& V, EVT VT, bool isTarget) {
 SDValue SelectionDAG::getConstantFP(const ConstantFP& V, EVT VT, bool isTarget){
   assert(VT.isFloatingPoint() && "Cannot create integer FP constant!");
 
-  EVT EltVT =
-    VT.isVector() ? VT.getVectorElementType() : VT;
+  EVT EltVT = VT.getScalarType();
 
   // Do the map lookup using the actual bit pattern for the floating point
   // value, so that we don't have problems with 0.0 comparing equal to -0.0, and
@@ -958,8 +960,7 @@ SDValue SelectionDAG::getConstantFP(const ConstantFP& V, EVT VT, bool isTarget){
 }
 
 SDValue SelectionDAG::getConstantFP(double Val, EVT VT, bool isTarget) {
-  EVT EltVT =
-    VT.isVector() ? VT.getVectorElementType() : VT;
+  EVT EltVT = VT.getScalarType();
   if (EltVT==MVT::f32)
     return getConstantFP(APFloat((float)Val), VT, isTarget);
   else
@@ -1344,7 +1345,7 @@ SDValue SelectionDAG::getBlockAddress(BlockAddress *BA, EVT VT,
 }
 
 SDValue SelectionDAG::getSrcValue(const Value *V) {
-  assert((!V || isa<PointerType>(V->getType())) &&
+  assert((!V || V->getType()->isPointerTy()) &&
          "SrcValue is not a pointer?");
 
   FoldingSetNodeID ID;
@@ -2232,6 +2233,29 @@ bool SelectionDAG::isKnownNeverNaN(SDValue Op) const {
   return false;
 }
 
+bool SelectionDAG::isKnownNeverZero(SDValue Op) const {
+  // If the value is a constant, we can obviously see if it is a zero or not.
+  if (const ConstantFPSDNode *C = dyn_cast<ConstantFPSDNode>(Op))
+    return !C->isZero();
+
+  // TODO: Recognize more cases here.
+
+  return false;
+}
+
+bool SelectionDAG::isEqualTo(SDValue A, SDValue B) const {
+  // Check the obvious case.
+  if (A == B) return true;
+
+  // For for negative and positive zero.
+  if (const ConstantFPSDNode *CA = dyn_cast<ConstantFPSDNode>(A))
+    if (const ConstantFPSDNode *CB = dyn_cast<ConstantFPSDNode>(B))
+      if (CA->isZero() && CB->isZero()) return true;
+
+  // Otherwise they may not be equal.
+  return false;
+}
+
 bool SelectionDAG::isVerifiedDebugInfoDesc(SDValue Op) const {
   GlobalAddressSDNode *GA = dyn_cast<GlobalAddressSDNode>(Op);
   if (!GA) return false;
@@ -3080,8 +3104,7 @@ SDValue SelectionDAG::getStackArgumentTokenFactor(SDValue Chain) {
 /// operand.
 static SDValue getMemsetValue(SDValue Value, EVT VT, SelectionDAG &DAG,
                               DebugLoc dl) {
-  unsigned NumBits = VT.isVector() ?
-    VT.getVectorElementType().getSizeInBits() : VT.getSizeInBits();
+  unsigned NumBits = VT.getScalarType().getSizeInBits();
   if (ConstantSDNode *C = dyn_cast<ConstantSDNode>(Value)) {
     APInt Val = APInt(NumBits, C->getZExtValue() & 255);
     unsigned Shift = 8;
@@ -3299,7 +3322,7 @@ static SDValue getMemcpyLoadsAndStores(SelectionDAG &DAG, DebugLoc dl,
       Value = getMemsetStringVal(VT, dl, DAG, TLI, Str, SrcOff);
       Store = DAG.getStore(Chain, dl, Value,
                            getMemBasePlusOffset(Dst, DstOff, DAG),
-                           DstSV, DstSVOff + DstOff, false, DstAlign);
+                           DstSV, DstSVOff + DstOff, false, false, DstAlign);
     } else {
       // The type might not be legal for the target.  This should only happen
       // if the type is smaller than a legal type, as on PPC, so the right
@@ -3310,10 +3333,11 @@ static SDValue getMemcpyLoadsAndStores(SelectionDAG &DAG, DebugLoc dl,
       assert(NVT.bitsGE(VT));
       Value = DAG.getExtLoad(ISD::EXTLOAD, dl, NVT, Chain,
                              getMemBasePlusOffset(Src, SrcOff, DAG),
-                             SrcSV, SrcSVOff + SrcOff, VT, false, Align);
+                             SrcSV, SrcSVOff + SrcOff, VT, false, false, Align);
       Store = DAG.getTruncStore(Chain, dl, Value,
-                             getMemBasePlusOffset(Dst, DstOff, DAG),
-                             DstSV, DstSVOff + DstOff, VT, false, DstAlign);
+                                getMemBasePlusOffset(Dst, DstOff, DAG),
+                                DstSV, DstSVOff + DstOff, VT, false, false,
+                                DstAlign);
     }
     OutChains.push_back(Store);
     SrcOff += VTSize;
@@ -3358,7 +3382,7 @@ static SDValue getMemmoveLoadsAndStores(SelectionDAG &DAG, DebugLoc dl,
 
     Value = DAG.getLoad(VT, dl, Chain,
                         getMemBasePlusOffset(Src, SrcOff, DAG),
-                        SrcSV, SrcSVOff + SrcOff, false, Align);
+                        SrcSV, SrcSVOff + SrcOff, false, false, Align);
     LoadValues.push_back(Value);
     LoadChains.push_back(Value.getValue(1));
     SrcOff += VTSize;
@@ -3373,7 +3397,7 @@ static SDValue getMemmoveLoadsAndStores(SelectionDAG &DAG, DebugLoc dl,
 
     Store = DAG.getStore(Chain, dl, LoadValues[i],
                          getMemBasePlusOffset(Dst, DstOff, DAG),
-                         DstSV, DstSVOff + DstOff, false, DstAlign);
+                         DstSV, DstSVOff + DstOff, false, false, DstAlign);
     OutChains.push_back(Store);
     DstOff += VTSize;
   }
@@ -3408,7 +3432,7 @@ static SDValue getMemsetStores(SelectionDAG &DAG, DebugLoc dl,
     SDValue Value = getMemsetValue(Src, VT, DAG, dl);
     SDValue Store = DAG.getStore(Chain, dl, Value,
                                  getMemBasePlusOffset(Dst, DstOff, DAG),
-                                 DstSV, DstSVOff + DstOff);
+                                 DstSV, DstSVOff + DstOff, false, false, 0);
     OutChains.push_back(Store);
     DstOff += VTSize;
   }
@@ -3472,7 +3496,7 @@ SDValue SelectionDAG::getMemcpy(SDValue Chain, DebugLoc dl, SDValue Dst,
                     /*isReturnValueUsed=*/false,
                     getExternalSymbol(TLI.getLibcallName(RTLIB::MEMCPY),
                                       TLI.getPointerTy()),
-                    Args, *this, dl, GetOrdering(Chain.getNode()));
+                    Args, *this, dl);
   return CallResult.second;
 }
 
@@ -3521,7 +3545,7 @@ SDValue SelectionDAG::getMemmove(SDValue Chain, DebugLoc dl, SDValue Dst,
                     /*isReturnValueUsed=*/false,
                     getExternalSymbol(TLI.getLibcallName(RTLIB::MEMMOVE),
                                       TLI.getPointerTy()),
-                    Args, *this, dl, GetOrdering(Chain.getNode()));
+                    Args, *this, dl);
   return CallResult.second;
 }
 
@@ -3580,7 +3604,7 @@ SDValue SelectionDAG::getMemset(SDValue Chain, DebugLoc dl, SDValue Dst,
                     /*isReturnValueUsed=*/false,
                     getExternalSymbol(TLI.getLibcallName(RTLIB::MEMSET),
                                       TLI.getPointerTy()),
-                    Args, *this, dl, GetOrdering(Chain.getNode()));
+                    Args, *this, dl);
   return CallResult.second;
 }
 
@@ -3788,7 +3812,8 @@ SelectionDAG::getLoad(ISD::MemIndexedMode AM, DebugLoc dl,
                       ISD::LoadExtType ExtType, EVT VT, SDValue Chain,
                       SDValue Ptr, SDValue Offset,
                       const Value *SV, int SVOffset, EVT MemVT,
-                      bool isVolatile, unsigned Alignment) {
+                      bool isVolatile, bool isNonTemporal,
+                      unsigned Alignment) {
   if (Alignment == 0)  // Ensure that codegen never sees alignment 0
     Alignment = getEVTAlignment(VT);
 
@@ -3802,6 +3827,8 @@ SelectionDAG::getLoad(ISD::MemIndexedMode AM, DebugLoc dl,
   unsigned Flags = MachineMemOperand::MOLoad;
   if (isVolatile)
     Flags |= MachineMemOperand::MOVolatile;
+  if (isNonTemporal)
+    Flags |= MachineMemOperand::MONonTemporal;
   MachineMemOperand *MMO =
     MF.getMachineMemOperand(SV, Flags, SVOffset,
                             MemVT.getStoreSize(), Alignment);
@@ -3840,7 +3867,8 @@ SelectionDAG::getLoad(ISD::MemIndexedMode AM, DebugLoc dl,
   FoldingSetNodeID ID;
   AddNodeIDNode(ID, ISD::LOAD, VTs, Ops, 3);
   ID.AddInteger(MemVT.getRawBits());
-  ID.AddInteger(encodeMemSDNodeFlags(ExtType, AM, MMO->isVolatile()));
+  ID.AddInteger(encodeMemSDNodeFlags(ExtType, AM, MMO->isVolatile(),
+                                     MMO->isNonTemporal()));
   void *IP = 0;
   if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) {
     cast<LoadSDNode>(E)->refineAlignment(MMO);
@@ -3856,20 +3884,22 @@ SelectionDAG::getLoad(ISD::MemIndexedMode AM, DebugLoc dl,
 SDValue SelectionDAG::getLoad(EVT VT, DebugLoc dl,
                               SDValue Chain, SDValue Ptr,
                               const Value *SV, int SVOffset,
-                              bool isVolatile, unsigned Alignment) {
+                              bool isVolatile, bool isNonTemporal,
+                              unsigned Alignment) {
   SDValue Undef = getUNDEF(Ptr.getValueType());
   return getLoad(ISD::UNINDEXED, dl, ISD::NON_EXTLOAD, VT, Chain, Ptr, Undef,
-                 SV, SVOffset, VT, isVolatile, Alignment);
+                 SV, SVOffset, VT, isVolatile, isNonTemporal, Alignment);
 }
 
 SDValue SelectionDAG::getExtLoad(ISD::LoadExtType ExtType, DebugLoc dl, EVT VT,
                                  SDValue Chain, SDValue Ptr,
                                  const Value *SV,
                                  int SVOffset, EVT MemVT,
-                                 bool isVolatile, unsigned Alignment) {
+                                 bool isVolatile, bool isNonTemporal,
+                                 unsigned Alignment) {
   SDValue Undef = getUNDEF(Ptr.getValueType());
   return getLoad(ISD::UNINDEXED, dl, ExtType, VT, Chain, Ptr, Undef,
-                 SV, SVOffset, MemVT, isVolatile, Alignment);
+                 SV, SVOffset, MemVT, isVolatile, isNonTemporal, Alignment);
 }
 
 SDValue
@@ -3881,12 +3911,13 @@ SelectionDAG::getIndexedLoad(SDValue OrigLoad, DebugLoc dl, SDValue Base,
   return getLoad(AM, dl, LD->getExtensionType(), OrigLoad.getValueType(),
                  LD->getChain(), Base, Offset, LD->getSrcValue(),
                  LD->getSrcValueOffset(), LD->getMemoryVT(),
-                 LD->isVolatile(), LD->getAlignment());
+                 LD->isVolatile(), LD->isNonTemporal(), LD->getAlignment());
 }
 
 SDValue SelectionDAG::getStore(SDValue Chain, DebugLoc dl, SDValue Val,
                                SDValue Ptr, const Value *SV, int SVOffset,
-                               bool isVolatile, unsigned Alignment) {
+                               bool isVolatile, bool isNonTemporal,
+                               unsigned Alignment) {
   if (Alignment == 0)  // Ensure that codegen never sees alignment 0
     Alignment = getEVTAlignment(Val.getValueType());
 
@@ -3900,6 +3931,8 @@ SDValue SelectionDAG::getStore(SDValue Chain, DebugLoc dl, SDValue Val,
   unsigned Flags = MachineMemOperand::MOStore;
   if (isVolatile)
     Flags |= MachineMemOperand::MOVolatile;
+  if (isNonTemporal)
+    Flags |= MachineMemOperand::MONonTemporal;
   MachineMemOperand *MMO =
     MF.getMachineMemOperand(SV, Flags, SVOffset,
                             Val.getValueType().getStoreSize(), Alignment);
@@ -3916,7 +3949,8 @@ SDValue SelectionDAG::getStore(SDValue Chain, DebugLoc dl, SDValue Val,
   FoldingSetNodeID ID;
   AddNodeIDNode(ID, ISD::STORE, VTs, Ops, 4);
   ID.AddInteger(VT.getRawBits());
-  ID.AddInteger(encodeMemSDNodeFlags(false, ISD::UNINDEXED, MMO->isVolatile()));
+  ID.AddInteger(encodeMemSDNodeFlags(false, ISD::UNINDEXED, MMO->isVolatile(),
+                                     MMO->isNonTemporal()));
   void *IP = 0;
   if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) {
     cast<StoreSDNode>(E)->refineAlignment(MMO);
@@ -3932,7 +3966,8 @@ SDValue SelectionDAG::getStore(SDValue Chain, DebugLoc dl, SDValue Val,
 SDValue SelectionDAG::getTruncStore(SDValue Chain, DebugLoc dl, SDValue Val,
                                     SDValue Ptr, const Value *SV,
                                     int SVOffset, EVT SVT,
-                                    bool isVolatile, unsigned Alignment) {
+                                    bool isVolatile, bool isNonTemporal,
+                                    unsigned Alignment) {
   if (Alignment == 0)  // Ensure that codegen never sees alignment 0
     Alignment = getEVTAlignment(SVT);
 
@@ -3946,6 +3981,8 @@ SDValue SelectionDAG::getTruncStore(SDValue Chain, DebugLoc dl, SDValue Val,
   unsigned Flags = MachineMemOperand::MOStore;
   if (isVolatile)
     Flags |= MachineMemOperand::MOVolatile;
+  if (isNonTemporal)
+    Flags |= MachineMemOperand::MONonTemporal;
   MachineMemOperand *MMO =
     MF.getMachineMemOperand(SV, Flags, SVOffset, SVT.getStoreSize(), Alignment);
 
@@ -3976,7 +4013,8 @@ SDValue SelectionDAG::getTruncStore(SDValue Chain, DebugLoc dl, SDValue Val,
   FoldingSetNodeID ID;
   AddNodeIDNode(ID, ISD::STORE, VTs, Ops, 4);
   ID.AddInteger(SVT.getRawBits());
-  ID.AddInteger(encodeMemSDNodeFlags(true, ISD::UNINDEXED, MMO->isVolatile()));
+  ID.AddInteger(encodeMemSDNodeFlags(true, ISD::UNINDEXED, MMO->isVolatile(),
+                                     MMO->isNonTemporal()));
   void *IP = 0;
   if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) {
     cast<StoreSDNode>(E)->refineAlignment(MMO);
@@ -4535,91 +4573,13 @@ SDNode *SelectionDAG::SelectNodeTo(SDNode *N, unsigned MachineOpc,
 SDNode *SelectionDAG::SelectNodeTo(SDNode *N, unsigned MachineOpc,
                                    SDVTList VTs, const SDValue *Ops,
                                    unsigned NumOps) {
-  return MorphNodeTo(N, ~MachineOpc, VTs, Ops, NumOps);
-}
-
-SDNode *SelectionDAG::MorphNodeTo(SDNode *N, unsigned Opc,
-                                  EVT VT) {
-  SDVTList VTs = getVTList(VT);
-  return MorphNodeTo(N, Opc, VTs, 0, 0);
-}
-
-SDNode *SelectionDAG::MorphNodeTo(SDNode *N, unsigned Opc,
-                                  EVT VT, SDValue Op1) {
-  SDVTList VTs = getVTList(VT);
-  SDValue Ops[] = { Op1 };
-  return MorphNodeTo(N, Opc, VTs, Ops, 1);
-}
-
-SDNode *SelectionDAG::MorphNodeTo(SDNode *N, unsigned Opc,
-                                  EVT VT, SDValue Op1,
-                                  SDValue Op2) {
-  SDVTList VTs = getVTList(VT);
-  SDValue Ops[] = { Op1, Op2 };
-  return MorphNodeTo(N, Opc, VTs, Ops, 2);
-}
-
-SDNode *SelectionDAG::MorphNodeTo(SDNode *N, unsigned Opc,
-                                  EVT VT, SDValue Op1,
-                                  SDValue Op2, SDValue Op3) {
-  SDVTList VTs = getVTList(VT);
-  SDValue Ops[] = { Op1, Op2, Op3 };
-  return MorphNodeTo(N, Opc, VTs, Ops, 3);
-}
-
-SDNode *SelectionDAG::MorphNodeTo(SDNode *N, unsigned Opc,
-                                  EVT VT, const SDValue *Ops,
-                                  unsigned NumOps) {
-  SDVTList VTs = getVTList(VT);
-  return MorphNodeTo(N, Opc, VTs, Ops, NumOps);
-}
-
-SDNode *SelectionDAG::MorphNodeTo(SDNode *N, unsigned Opc,
-                                  EVT VT1, EVT VT2, const SDValue *Ops,
-                                  unsigned NumOps) {
-  SDVTList VTs = getVTList(VT1, VT2);
-  return MorphNodeTo(N, Opc, VTs, Ops, NumOps);
-}
-
-SDNode *SelectionDAG::MorphNodeTo(SDNode *N, unsigned Opc,
-                                  EVT VT1, EVT VT2) {
-  SDVTList VTs = getVTList(VT1, VT2);
-  return MorphNodeTo(N, Opc, VTs, (SDValue *)0, 0);
-}
-
-SDNode *SelectionDAG::MorphNodeTo(SDNode *N, unsigned Opc,
-                                  EVT VT1, EVT VT2, EVT VT3,
-                                  const SDValue *Ops, unsigned NumOps) {
-  SDVTList VTs = getVTList(VT1, VT2, VT3);
-  return MorphNodeTo(N, Opc, VTs, Ops, NumOps);
-}
-
-SDNode *SelectionDAG::MorphNodeTo(SDNode *N, unsigned Opc,
-                                  EVT VT1, EVT VT2,
-                                  SDValue Op1) {
-  SDVTList VTs = getVTList(VT1, VT2);
-  SDValue Ops[] = { Op1 };
-  return MorphNodeTo(N, Opc, VTs, Ops, 1);
-}
-
-SDNode *SelectionDAG::MorphNodeTo(SDNode *N, unsigned Opc,
-                                  EVT VT1, EVT VT2,
-                                  SDValue Op1, SDValue Op2) {
-  SDVTList VTs = getVTList(VT1, VT2);
-  SDValue Ops[] = { Op1, Op2 };
-  return MorphNodeTo(N, Opc, VTs, Ops, 2);
-}
-
-SDNode *SelectionDAG::MorphNodeTo(SDNode *N, unsigned Opc,
-                                  EVT VT1, EVT VT2,
-                                  SDValue Op1, SDValue Op2,
-                                  SDValue Op3) {
-  SDVTList VTs = getVTList(VT1, VT2);
-  SDValue Ops[] = { Op1, Op2, Op3 };
-  return MorphNodeTo(N, Opc, VTs, Ops, 3);
+  N = MorphNodeTo(N, ~MachineOpc, VTs, Ops, NumOps);
+  // Reset the NodeID to -1.
+  N->setNodeId(-1);
+  return N;
 }
 
-/// MorphNodeTo - These *mutate* the specified node to have the specified
+/// MorphNodeTo - This *mutates* the specified node to have the specified
 /// return type, opcode, and operands.
 ///
 /// Note that MorphNodeTo returns the resultant node.  If there is already a
@@ -4695,12 +4655,14 @@ SDNode *SelectionDAG::MorphNodeTo(SDNode *N, unsigned Opc,
 
   // Delete any nodes that are still dead after adding the uses for the
   // new operands.
-  SmallVector<SDNode *, 16> DeadNodes;
-  for (SmallPtrSet<SDNode *, 16>::iterator I = DeadNodeSet.begin(),
-       E = DeadNodeSet.end(); I != E; ++I)
-    if ((*I)->use_empty())
-      DeadNodes.push_back(*I);
-  RemoveDeadNodes(DeadNodes);
+  if (!DeadNodeSet.empty()) {
+    SmallVector<SDNode *, 16> DeadNodes;
+    for (SmallPtrSet<SDNode *, 16>::iterator I = DeadNodeSet.begin(),
+         E = DeadNodeSet.end(); I != E; ++I)
+      if ((*I)->use_empty())
+        DeadNodes.push_back(*I);
+    RemoveDeadNodes(DeadNodes);
+  }
 
   if (IP)
     CSEMap.InsertNode(N, IP);   // Memoize the new node.
@@ -4907,6 +4869,43 @@ SDNode *SelectionDAG::getNodeIfExists(unsigned Opcode, SDVTList VTList,
   return NULL;
 }
 
+namespace {
+
+/// RAUWUpdateListener - Helper for ReplaceAllUsesWith - When the node
+/// pointed to by a use iterator is deleted, increment the use iterator
+/// so that it doesn't dangle.
+///
+/// This class also manages a "downlink" DAGUpdateListener, to forward
+/// messages to ReplaceAllUsesWith's callers.
+///
+class RAUWUpdateListener : public SelectionDAG::DAGUpdateListener {
+  SelectionDAG::DAGUpdateListener *DownLink;
+  SDNode::use_iterator &UI;
+  SDNode::use_iterator &UE;
+
+  virtual void NodeDeleted(SDNode *N, SDNode *E) {
+    // Increment the iterator as needed.
+    while (UI != UE && N == *UI)
+      ++UI;
+
+    // Then forward the message.
+    if (DownLink) DownLink->NodeDeleted(N, E);
+  }
+
+  virtual void NodeUpdated(SDNode *N) {
+    // Just forward the message.
+    if (DownLink) DownLink->NodeUpdated(N);
+  }
+
+public:
+  RAUWUpdateListener(SelectionDAG::DAGUpdateListener *dl,
+                     SDNode::use_iterator &ui,
+                     SDNode::use_iterator &ue)
+    : DownLink(dl), UI(ui), UE(ue) {}
+};
+
+}
+
 /// ReplaceAllUsesWith - Modify anything using 'From' to use 'To' instead.
 /// This can cause recursive merging of nodes in the DAG.
 ///
@@ -4927,6 +4926,7 @@ void SelectionDAG::ReplaceAllUsesWith(SDValue FromN, SDValue To,
   // is replaced by To, we don't want to replace of all its users with To
   // too. See PR3018 for more info.
   SDNode::use_iterator UI = From->use_begin(), UE = From->use_end();
+  RAUWUpdateListener Listener(UpdateListener, UI, UE);
   while (UI != UE) {
     SDNode *User = *UI;
 
@@ -4945,7 +4945,7 @@ void SelectionDAG::ReplaceAllUsesWith(SDValue FromN, SDValue To,
 
     // Now that we have modified User, add it back to the CSE maps.  If it
     // already exists there, recursively merge the results together.
-    AddModifiedNodeToCSEMaps(User, UpdateListener);
+    AddModifiedNodeToCSEMaps(User, &Listener);
   }
 }
 
@@ -4971,6 +4971,7 @@ void SelectionDAG::ReplaceAllUsesWith(SDNode *From, SDNode *To,
   // Iterate over just the existing users of From. See the comments in
   // the ReplaceAllUsesWith above.
   SDNode::use_iterator UI = From->use_begin(), UE = From->use_end();
+  RAUWUpdateListener Listener(UpdateListener, UI, UE);
   while (UI != UE) {
     SDNode *User = *UI;
 
@@ -4989,7 +4990,7 @@ void SelectionDAG::ReplaceAllUsesWith(SDNode *From, SDNode *To,
 
     // Now that we have modified User, add it back to the CSE maps.  If it
     // already exists there, recursively merge the results together.
-    AddModifiedNodeToCSEMaps(User, UpdateListener);
+    AddModifiedNodeToCSEMaps(User, &Listener);
   }
 }
 
@@ -5007,6 +5008,7 @@ void SelectionDAG::ReplaceAllUsesWith(SDNode *From,
   // Iterate over just the existing users of From. See the comments in
   // the ReplaceAllUsesWith above.
   SDNode::use_iterator UI = From->use_begin(), UE = From->use_end();
+  RAUWUpdateListener Listener(UpdateListener, UI, UE);
   while (UI != UE) {
     SDNode *User = *UI;
 
@@ -5026,7 +5028,7 @@ void SelectionDAG::ReplaceAllUsesWith(SDNode *From,
 
     // Now that we have modified User, add it back to the CSE maps.  If it
     // already exists there, recursively merge the results together.
-    AddModifiedNodeToCSEMaps(User, UpdateListener);
+    AddModifiedNodeToCSEMaps(User, &Listener);
   }
 }
 
@@ -5048,6 +5050,7 @@ void SelectionDAG::ReplaceAllUsesOfValueWith(SDValue From, SDValue To,
   // the ReplaceAllUsesWith above.
   SDNode::use_iterator UI = From.getNode()->use_begin(),
                        UE = From.getNode()->use_end();
+  RAUWUpdateListener Listener(UpdateListener, UI, UE);
   while (UI != UE) {
     SDNode *User = *UI;
     bool UserRemovedFromCSEMaps = false;
@@ -5083,7 +5086,7 @@ void SelectionDAG::ReplaceAllUsesOfValueWith(SDValue From, SDValue To,
 
     // Now that we have modified User, add it back to the CSE maps.  If it
     // already exists there, recursively merge the results together.
-    AddModifiedNodeToCSEMaps(User, UpdateListener);
+    AddModifiedNodeToCSEMaps(User, &Listener);
   }
 }
 
@@ -5280,8 +5283,11 @@ GlobalAddressSDNode::GlobalAddressSDNode(unsigned Opc, const GlobalValue *GA,
 MemSDNode::MemSDNode(unsigned Opc, DebugLoc dl, SDVTList VTs, EVT memvt,
                      MachineMemOperand *mmo)
  : SDNode(Opc, dl, VTs), MemoryVT(memvt), MMO(mmo) {
-  SubclassData = encodeMemSDNodeFlags(0, ISD::UNINDEXED, MMO->isVolatile());
+  SubclassData = encodeMemSDNodeFlags(0, ISD::UNINDEXED, MMO->isVolatile(),
+                                      MMO->isNonTemporal());
   assert(isVolatile() == MMO->isVolatile() && "Volatile encoding error!");
+  assert(isNonTemporal() == MMO->isNonTemporal() &&
+         "Non-temporal encoding error!");
   assert(memvt.getStoreSize() == MMO->getSize() && "Size mismatch!");
 }
 
@@ -5290,7 +5296,8 @@ MemSDNode::MemSDNode(unsigned Opc, DebugLoc dl, SDVTList VTs,
                      MachineMemOperand *mmo)
    : SDNode(Opc, dl, VTs, Ops, NumOps),
      MemoryVT(memvt), MMO(mmo) {
-  SubclassData = encodeMemSDNodeFlags(0, ISD::UNINDEXED, MMO->isVolatile());
+  SubclassData = encodeMemSDNodeFlags(0, ISD::UNINDEXED, MMO->isVolatile(),
+                                      MMO->isNonTemporal());
   assert(isVolatile() == MMO->isVolatile() && "Volatile encoding error!");
   assert(memvt.getStoreSize() == MMO->getSize() && "Size mismatch!");
 }
@@ -5459,15 +5466,15 @@ std::string SDNode::getOperationName(const SelectionDAG *G) const {
         if (const TargetInstrInfo *TII = G->getTarget().getInstrInfo())
           if (getMachineOpcode() < TII->getNumOpcodes())
             return TII->get(getMachineOpcode()).getName();
-      return "<<Unknown Machine Node>>";
+      return "<<Unknown Machine Node #" + utostr(getOpcode()) + ">>";
     }
     if (G) {
       const TargetLowering &TLI = G->getTargetLoweringInfo();
       const char *Name = TLI.getTargetNodeName(getOpcode());
       if (Name) return Name;
-      return "<<Unknown Target Node>>";
+      return "<<Unknown Target Node #" + utostr(getOpcode()) + ">>";
     }
-    return "<<Unknown Node>>";
+    return "<<Unknown Node #" + utostr(getOpcode()) + ">>";
 
 #ifndef NDEBUG
   case ISD::DELETED_NODE:
@@ -5904,6 +5911,9 @@ void SDNode::print_details(raw_ostream &OS, const SelectionDAG *G) const {
   if (G)
     if (unsigned Order = G->GetOrdering(this))
       OS << " [ORD=" << Order << ']';
+  
+  if (getNodeId() != -1)
+    OS << " [ID=" << getNodeId() << ']';
 }
 
 void SDNode::print(raw_ostream &OS, const SelectionDAG *G) const {
@@ -6292,31 +6302,37 @@ bool ShuffleVectorSDNode::isSplatMask(const int *Mask, EVT VT) {
   return true;
 }
 
+#ifdef XDEBUG
 static void checkForCyclesHelper(const SDNode *N,
-                                 std::set<const SDNode *> &visited) {
-  if (visited.find(N) != visited.end()) {
+                                 SmallPtrSet<const SDNode*, 32> &Visited,
+                                 SmallPtrSet<const SDNode*, 32> &Checked) {
+  // If this node has already been checked, don't check it again.
+  if (Checked.count(N))
+    return;
+  
+  // If a node has already been visited on this depth-first walk, reject it as
+  // a cycle.
+  if (!Visited.insert(N)) {
     dbgs() << "Offending node:\n";
     N->dumprFull();
-    assert(0 && "Detected cycle in SelectionDAG");
+    errs() << "Detected cycle in SelectionDAG\n";
+    abort();
   }
-
-  std::set<const SDNode*>::iterator i;
-  bool inserted;
-
-  tie(i, inserted) = visited.insert(N);
-  assert(inserted && "Missed cycle");
-
-  for(unsigned i = 0; i < N->getNumOperands(); ++i) {
-    checkForCyclesHelper(N->getOperand(i).getNode(), visited);
-  }
-  visited.erase(i);
+  
+  for(unsigned i = 0, e = N->getNumOperands(); i != e; ++i)
+    checkForCyclesHelper(N->getOperand(i).getNode(), Visited, Checked);
+  
+  Checked.insert(N);
+  Visited.erase(N);
 }
+#endif
 
 void llvm::checkForCycles(const llvm::SDNode *N) {
 #ifdef XDEBUG
   assert(N && "Checking nonexistant SDNode");
-  std::set<const SDNode *> visited;
-  checkForCyclesHelper(N, visited);
+  SmallPtrSet<const SDNode*, 32> visited;
+  SmallPtrSet<const SDNode*, 32> checked;
+  checkForCyclesHelper(N, visited, checked);
 #endif
 }
 
diff --git a/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index 6f60c7b..308742b 100644
--- a/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -155,7 +155,7 @@ namespace {
     /// this value and returns the result as a ValueVTs value.  This uses
     /// Chain/Flag as the input and updates them for the output Chain/Flag.
     /// If the Flag pointer is NULL, no flag is used.
-    SDValue getCopyFromRegs(SelectionDAG &DAG, DebugLoc dl, unsigned Order,
+    SDValue getCopyFromRegs(SelectionDAG &DAG, DebugLoc dl,
                             SDValue &Chain, SDValue *Flag) const;
 
     /// getCopyToRegs - Emit a series of CopyToReg nodes that copies the
@@ -163,14 +163,14 @@ namespace {
     /// Chain/Flag as the input and updates them for the output Chain/Flag.
     /// If the Flag pointer is NULL, no flag is used.
     void getCopyToRegs(SDValue Val, SelectionDAG &DAG, DebugLoc dl,
-                       unsigned Order, SDValue &Chain, SDValue *Flag) const;
+                       SDValue &Chain, SDValue *Flag) const;
 
     /// AddInlineAsmOperands - Add this value to the specified inlineasm node
     /// operand list.  This adds the code marker, matching input operand index
     /// (if applicable), and includes the number of values added into it.
     void AddInlineAsmOperands(unsigned Code,
                               bool HasMatching, unsigned MatchingIdx,
-                              SelectionDAG &DAG, unsigned Order,
+                              SelectionDAG &DAG,
                               std::vector<SDValue> &Ops) const;
   };
 }
@@ -180,7 +180,7 @@ namespace {
 /// larger then ValueVT then AssertOp can be used to specify whether the extra
 /// bits are known to be zero (ISD::AssertZext) or sign extended from ValueVT
 /// (ISD::AssertSext).
-static SDValue getCopyFromParts(SelectionDAG &DAG, DebugLoc dl, unsigned Order,
+static SDValue getCopyFromParts(SelectionDAG &DAG, DebugLoc dl,
                                 const SDValue *Parts,
                                 unsigned NumParts, EVT PartVT, EVT ValueVT,
                                 ISD::NodeType AssertOp = ISD::DELETED_NODE) {
@@ -205,9 +205,9 @@ static SDValue getCopyFromParts(SelectionDAG &DAG, DebugLoc dl, unsigned Order,
       EVT HalfVT = EVT::getIntegerVT(*DAG.getContext(), RoundBits/2);
 
       if (RoundParts > 2) {
-        Lo = getCopyFromParts(DAG, dl, Order, Parts, RoundParts / 2,
+        Lo = getCopyFromParts(DAG, dl, Parts, RoundParts / 2,
                               PartVT, HalfVT);
-        Hi = getCopyFromParts(DAG, dl, Order, Parts + RoundParts / 2,
+        Hi = getCopyFromParts(DAG, dl, Parts + RoundParts / 2,
                               RoundParts / 2, PartVT, HalfVT);
       } else {
         Lo = DAG.getNode(ISD::BIT_CONVERT, dl, HalfVT, Parts[0]);
@@ -223,7 +223,7 @@ static SDValue getCopyFromParts(SelectionDAG &DAG, DebugLoc dl, unsigned Order,
         // Assemble the trailing non-power-of-2 part.
         unsigned OddParts = NumParts - RoundParts;
         EVT OddVT = EVT::getIntegerVT(*DAG.getContext(), OddParts * PartBits);
-        Hi = getCopyFromParts(DAG, dl, Order,
+        Hi = getCopyFromParts(DAG, dl,
                               Parts + RoundParts, OddParts, PartVT, OddVT);
 
         // Combine the round and odd parts.
@@ -259,7 +259,7 @@ static SDValue getCopyFromParts(SelectionDAG &DAG, DebugLoc dl, unsigned Order,
         // If the register was not expanded, truncate or copy the value,
         // as appropriate.
         for (unsigned i = 0; i != NumParts; ++i)
-          Ops[i] = getCopyFromParts(DAG, dl, Order, &Parts[i], 1,
+          Ops[i] = getCopyFromParts(DAG, dl, &Parts[i], 1,
                                     PartVT, IntermediateVT);
       } else if (NumParts > 0) {
         // If the intermediate type was expanded, build the intermediate
@@ -268,7 +268,7 @@ static SDValue getCopyFromParts(SelectionDAG &DAG, DebugLoc dl, unsigned Order,
                "Must expand into a divisible number of parts!");
         unsigned Factor = NumParts / NumIntermediates;
         for (unsigned i = 0; i != NumIntermediates; ++i)
-          Ops[i] = getCopyFromParts(DAG, dl, Order, &Parts[i * Factor], Factor,
+          Ops[i] = getCopyFromParts(DAG, dl, &Parts[i * Factor], Factor,
                                     PartVT, IntermediateVT);
       }
 
@@ -292,7 +292,7 @@ static SDValue getCopyFromParts(SelectionDAG &DAG, DebugLoc dl, unsigned Order,
       assert(ValueVT.isFloatingPoint() && PartVT.isInteger() &&
              !PartVT.isVector() && "Unexpected split");
       EVT IntVT = EVT::getIntegerVT(*DAG.getContext(), ValueVT.getSizeInBits());
-      Val = getCopyFromParts(DAG, dl, Order, Parts, NumParts, PartVT, IntVT);
+      Val = getCopyFromParts(DAG, dl, Parts, NumParts, PartVT, IntVT);
     }
   }
 
@@ -349,7 +349,7 @@ static SDValue getCopyFromParts(SelectionDAG &DAG, DebugLoc dl, unsigned Order,
 /// getCopyToParts - Create a series of nodes that contain the specified value
 /// split into legal parts.  If the parts contain more bits than Val, then, for
 /// integers, ExtendKind can be used to specify how to generate the extra bits.
-static void getCopyToParts(SelectionDAG &DAG, DebugLoc dl, unsigned Order,
+static void getCopyToParts(SelectionDAG &DAG, DebugLoc dl,
                            SDValue Val, SDValue *Parts, unsigned NumParts,
                            EVT PartVT,
                            ISD::NodeType ExtendKind = ISD::ANY_EXTEND) {
@@ -417,7 +417,7 @@ static void getCopyToParts(SelectionDAG &DAG, DebugLoc dl, unsigned Order,
       SDValue OddVal = DAG.getNode(ISD::SRL, dl, ValueVT, Val,
                                    DAG.getConstant(RoundBits,
                                                    TLI.getPointerTy()));
-      getCopyToParts(DAG, dl, Order, OddVal, Parts + RoundParts,
+      getCopyToParts(DAG, dl, OddVal, Parts + RoundParts,
                      OddParts, PartVT);
 
       if (TLI.isBigEndian())
@@ -514,7 +514,7 @@ static void getCopyToParts(SelectionDAG &DAG, DebugLoc dl, unsigned Order,
     // If the register was not expanded, promote or copy the value,
     // as appropriate.
     for (unsigned i = 0; i != NumParts; ++i)
-      getCopyToParts(DAG, dl, Order, Ops[i], &Parts[i], 1, PartVT);
+      getCopyToParts(DAG, dl, Ops[i], &Parts[i], 1, PartVT);
   } else if (NumParts > 0) {
     // If the intermediate type was expanded, split each the value into
     // legal parts.
@@ -522,7 +522,7 @@ static void getCopyToParts(SelectionDAG &DAG, DebugLoc dl, unsigned Order,
            "Must expand into a divisible number of parts!");
     unsigned Factor = NumParts / NumIntermediates;
     for (unsigned i = 0; i != NumIntermediates; ++i)
-      getCopyToParts(DAG, dl, Order, Ops[i], &Parts[i*Factor], Factor, PartVT);
+      getCopyToParts(DAG, dl, Ops[i], &Parts[i*Factor], Factor, PartVT);
   }
 }
 
@@ -680,7 +680,7 @@ SDValue SelectionDAGBuilder::getValue(const Value *V) {
                                 getCurDebugLoc());
     }
 
-    if (isa<StructType>(C->getType()) || isa<ArrayType>(C->getType())) {
+    if (C->getType()->isStructTy() || C->getType()->isArrayTy()) {
       assert((isa<ConstantAggregateZero>(C) || isa<UndefValue>(C)) &&
              "Unknown struct or array constant!");
 
@@ -747,8 +747,7 @@ SDValue SelectionDAGBuilder::getValue(const Value *V) {
 
   RegsForValue RFV(*DAG.getContext(), TLI, InReg, V->getType());
   SDValue Chain = DAG.getEntryNode();
-  return RFV.getCopyFromRegs(DAG, getCurDebugLoc(),
-                             SDNodeOrder, Chain, NULL);
+  return RFV.getCopyFromRegs(DAG, getCurDebugLoc(), Chain, NULL);
 }
 
 /// Get the EVTs and ArgFlags collections that represent the legalized return 
@@ -844,19 +843,17 @@ void SelectionDAGBuilder::visitRet(ReturnInst &I) {
       Chains[i] =
         DAG.getStore(Chain, getCurDebugLoc(),
                      SDValue(RetOp.getNode(), RetOp.getResNo() + i),
-                     Add, NULL, Offsets[i], false, 0);
+                     Add, NULL, Offsets[i], false, false, 0);
     }
 
     Chain = DAG.getNode(ISD::TokenFactor, getCurDebugLoc(),
                         MVT::Other, &Chains[0], NumValues);
-  } else {
-    for (unsigned i = 0, e = I.getNumOperands(); i != e; ++i) {
-      SmallVector<EVT, 4> ValueVTs;
-      ComputeValueVTs(TLI, I.getOperand(i)->getType(), ValueVTs);
-      unsigned NumValues = ValueVTs.size();
-      if (NumValues == 0) continue;
-
-      SDValue RetOp = getValue(I.getOperand(i));
+  } else if (I.getNumOperands() != 0) {
+    SmallVector<EVT, 4> ValueVTs;
+    ComputeValueVTs(TLI, I.getOperand(0)->getType(), ValueVTs);
+    unsigned NumValues = ValueVTs.size();
+    if (NumValues) {
+      SDValue RetOp = getValue(I.getOperand(0));
       for (unsigned j = 0, f = NumValues; j != f; ++j) {
         EVT VT = ValueVTs[j];
 
@@ -881,7 +878,7 @@ void SelectionDAGBuilder::visitRet(ReturnInst &I) {
         unsigned NumParts = TLI.getNumRegisters(*DAG.getContext(), VT);
         EVT PartVT = TLI.getRegisterType(*DAG.getContext(), VT);
         SmallVector<SDValue, 4> Parts(NumParts);
-        getCopyToParts(DAG, getCurDebugLoc(), SDNodeOrder,
+        getCopyToParts(DAG, getCurDebugLoc(),
                        SDValue(RetOp.getNode(), RetOp.getResNo() + j),
                        &Parts[0], NumParts, PartVT, ExtendKind);
 
@@ -2080,7 +2077,7 @@ void SelectionDAGBuilder::visitIndirectBr(IndirectBrInst &I) {
 void SelectionDAGBuilder::visitFSub(User &I) {
   // -0.0 - X --> fneg
   const Type *Ty = I.getType();
-  if (isa<VectorType>(Ty)) {
+  if (Ty->isVectorTy()) {
     if (ConstantVector *CV = dyn_cast<ConstantVector>(I.getOperand(0))) {
       const VectorType *DestTy = cast<VectorType>(I.getType());
       const Type *ElTy = DestTy->getElementType();
@@ -2117,7 +2114,7 @@ void SelectionDAGBuilder::visitBinary(User &I, unsigned OpCode) {
 void SelectionDAGBuilder::visitShift(User &I, unsigned Opcode) {
   SDValue Op1 = getValue(I.getOperand(0));
   SDValue Op2 = getValue(I.getOperand(1));
-  if (!isa<VectorType>(I.getType()) &&
+  if (!I.getType()->isVectorTy() &&
       Op2.getValueType() != TLI.getShiftAmountTy()) {
     // If the operand is smaller than the shift count type, promote it.
     EVT PTy = TLI.getPointerTy();
@@ -2705,7 +2702,9 @@ void SelectionDAGBuilder::visitLoad(LoadInst &I) {
   SDValue Ptr = getValue(SV);
 
   const Type *Ty = I.getType();
+
   bool isVolatile = I.isVolatile();
+  bool isNonTemporal = I.getMetadata("nontemporal") != 0;
   unsigned Alignment = I.getAlignment();
 
   SmallVector<EVT, 4> ValueVTs;
@@ -2737,7 +2736,8 @@ void SelectionDAGBuilder::visitLoad(LoadInst &I) {
                             PtrVT, Ptr,
                             DAG.getConstant(Offsets[i], PtrVT));
     SDValue L = DAG.getLoad(ValueVTs[i], getCurDebugLoc(), Root,
-                            A, SV, Offsets[i], isVolatile, Alignment);
+                            A, SV, Offsets[i], isVolatile, 
+                            isNonTemporal, Alignment);
 
     Values[i] = L;
     Chains[i] = L.getValue(1);
@@ -2778,6 +2778,7 @@ void SelectionDAGBuilder::visitStore(StoreInst &I) {
   SmallVector<SDValue, 4> Chains(NumValues);
   EVT PtrVT = Ptr.getValueType();
   bool isVolatile = I.isVolatile();
+  bool isNonTemporal = I.getMetadata("nontemporal") != 0;
   unsigned Alignment = I.getAlignment();
 
   for (unsigned i = 0; i != NumValues; ++i) {
@@ -2785,7 +2786,8 @@ void SelectionDAGBuilder::visitStore(StoreInst &I) {
                               DAG.getConstant(Offsets[i], PtrVT));
     Chains[i] = DAG.getStore(Root, getCurDebugLoc(),
                              SDValue(Src.getNode(), Src.getResNo() + i),
-                             Add, PtrV, Offsets[i], isVolatile, Alignment);
+                             Add, PtrV, Offsets[i], isVolatile, 
+                             isNonTemporal, Alignment);
   }
 
   DAG.setRoot(DAG.getNode(ISD::TokenFactor, getCurDebugLoc(),
@@ -2885,7 +2887,7 @@ void SelectionDAGBuilder::visitTargetIntrinsic(CallInst &I,
 ///
 /// where Op is the hexidecimal representation of floating point value.
 static SDValue
-GetSignificand(SelectionDAG &DAG, SDValue Op, DebugLoc dl, unsigned Order) {
+GetSignificand(SelectionDAG &DAG, SDValue Op, DebugLoc dl) {
   SDValue t1 = DAG.getNode(ISD::AND, dl, MVT::i32, Op,
                            DAG.getConstant(0x007fffff, MVT::i32));
   SDValue t2 = DAG.getNode(ISD::OR, dl, MVT::i32, t1,
@@ -2900,7 +2902,7 @@ GetSignificand(SelectionDAG &DAG, SDValue Op, DebugLoc dl, unsigned Order) {
 /// where Op is the hexidecimal representation of floating point value.
 static SDValue
 GetExponent(SelectionDAG &DAG, SDValue Op, const TargetLowering &TLI,
-            DebugLoc dl, unsigned Order) {
+            DebugLoc dl) {
   SDValue t0 = DAG.getNode(ISD::AND, dl, MVT::i32, Op,
                            DAG.getConstant(0x7f800000, MVT::i32));
   SDValue t1 = DAG.getNode(ISD::SRL, dl, MVT::i32, t0,
@@ -3084,13 +3086,13 @@ SelectionDAGBuilder::visitLog(CallInst &I) {
     SDValue Op1 = DAG.getNode(ISD::BIT_CONVERT, dl, MVT::i32, Op);
 
     // Scale the exponent by log(2) [0.69314718f].
-    SDValue Exp = GetExponent(DAG, Op1, TLI, dl, SDNodeOrder);
+    SDValue Exp = GetExponent(DAG, Op1, TLI, dl);
     SDValue LogOfExponent = DAG.getNode(ISD::FMUL, dl, MVT::f32, Exp,
                                         getF32Constant(DAG, 0x3f317218));
 
     // Get the significand and build it into a floating-point number with
     // exponent of 1.
-    SDValue X = GetSignificand(DAG, Op1, dl, SDNodeOrder);
+    SDValue X = GetSignificand(DAG, Op1, dl);
 
     if (LimitFloatPrecision <= 6) {
       // For floating-point precision of 6:
@@ -3194,11 +3196,11 @@ SelectionDAGBuilder::visitLog2(CallInst &I) {
     SDValue Op1 = DAG.getNode(ISD::BIT_CONVERT, dl, MVT::i32, Op);
 
     // Get the exponent.
-    SDValue LogOfExponent = GetExponent(DAG, Op1, TLI, dl, SDNodeOrder);
+    SDValue LogOfExponent = GetExponent(DAG, Op1, TLI, dl);
 
     // Get the significand and build it into a floating-point number with
     // exponent of 1.
-    SDValue X = GetSignificand(DAG, Op1, dl, SDNodeOrder);
+    SDValue X = GetSignificand(DAG, Op1, dl);
 
     // Different possible minimax approximations of significand in
     // floating-point for various degrees of accuracy over [1,2].
@@ -3303,13 +3305,13 @@ SelectionDAGBuilder::visitLog10(CallInst &I) {
     SDValue Op1 = DAG.getNode(ISD::BIT_CONVERT, dl, MVT::i32, Op);
 
     // Scale the exponent by log10(2) [0.30102999f].
-    SDValue Exp = GetExponent(DAG, Op1, TLI, dl, SDNodeOrder);
+    SDValue Exp = GetExponent(DAG, Op1, TLI, dl);
     SDValue LogOfExponent = DAG.getNode(ISD::FMUL, dl, MVT::f32, Exp,
                                         getF32Constant(DAG, 0x3e9a209a));
 
     // Get the significand and build it into a floating-point number with
     // exponent of 1.
-    SDValue X = GetSignificand(DAG, Op1, dl, SDNodeOrder);
+    SDValue X = GetSignificand(DAG, Op1, dl);
 
     if (LimitFloatPrecision <= 6) {
       // For floating-point precision of 6:
@@ -4064,7 +4066,7 @@ SelectionDAGBuilder::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) {
     // Store the stack protector onto the stack.
     Res = DAG.getStore(getRoot(), getCurDebugLoc(), Src, FIN,
                        PseudoSourceValue::getFixedStack(FI),
-                       0, true);
+                       0, true, false, 0);
     setValue(&I, Res);
     DAG.setRoot(Res);
     return 0;
@@ -4282,8 +4284,8 @@ isInTailCallPosition(CallSite CS, Attributes CalleeRetAttr,
     // Check for a truly no-op bitcast.
     if (isa<BitCastInst>(U) &&
         (U->getOperand(0)->getType() == U->getType() ||
-         (isa<PointerType>(U->getOperand(0)->getType()) &&
-          isa<PointerType>(U->getType()))))
+         (U->getOperand(0)->getType()->isPointerTy() &&
+          U->getType()->isPointerTy())))
       continue;
     // Otherwise it's not a true no-op.
     return false;
@@ -4391,7 +4393,7 @@ void SelectionDAGBuilder::LowerCallTo(CallSite CS, SDValue Callee,
                     CS.getCallingConv(),
                     isTailCall,
                     !CS.getInstruction()->use_empty(),
-                    Callee, Args, DAG, getCurDebugLoc(), SDNodeOrder);
+                    Callee, Args, DAG, getCurDebugLoc());
   assert((isTailCall || Result.second.getNode()) &&
          "Non-null chain expected with non-tail call!");
   assert((Result.second.getNode() || !Result.first.getNode()) &&
@@ -4416,7 +4418,7 @@ void SelectionDAGBuilder::LowerCallTo(CallSite CS, SDValue Callee,
                                 DemoteStackSlot,
                                 DAG.getConstant(Offsets[i], PtrVT));
       SDValue L = DAG.getLoad(OutVTs[i], getCurDebugLoc(), Result.second,
-                              Add, NULL, Offsets[i], false, 1);
+                              Add, NULL, Offsets[i], false, false, 1);
       Values[i] = L;
       Chains[i] = L.getValue(1);
     }
@@ -4439,7 +4441,7 @@ void SelectionDAGBuilder::LowerCallTo(CallSite CS, SDValue Callee,
       unsigned NumRegs = TLI.getNumRegisters(RetTy->getContext(), VT);
   
       SDValue ReturnValue =
-        getCopyFromParts(DAG, getCurDebugLoc(), SDNodeOrder, &Values[CurReg], NumRegs,
+        getCopyFromParts(DAG, getCurDebugLoc(), &Values[CurReg], NumRegs,
                          RegisterVT, VT, AssertOp);
       ReturnValues.push_back(ReturnValue);
       CurReg += NumRegs;
@@ -4518,7 +4520,8 @@ static SDValue getMemCmpLoad(Value *PtrVal, MVT LoadVT, const Type *LoadTy,
   SDValue Ptr = Builder.getValue(PtrVal);
   SDValue LoadVal = Builder.DAG.getLoad(LoadVT, Builder.getCurDebugLoc(), Root,
                                         Ptr, PtrVal /*SrcValue*/, 0/*SVOffset*/,
-                                        false /*volatile*/, 1 /* align=1 */);
+                                        false /*volatile*/,
+                                        false /*nontemporal*/, 1 /* align=1 */);
 
   if (!ConstantMemory)
     Builder.PendingLoads.push_back(LoadVal.getValue(1));
@@ -4535,9 +4538,9 @@ bool SelectionDAGBuilder::visitMemCmpCall(CallInst &I) {
     return false;
 
   Value *LHS = I.getOperand(1), *RHS = I.getOperand(2);
-  if (!isa<PointerType>(LHS->getType()) || !isa<PointerType>(RHS->getType()) ||
-      !isa<IntegerType>(I.getOperand(3)->getType()) ||
-      !isa<IntegerType>(I.getType()))
+  if (!LHS->getType()->isPointerTy() || !RHS->getType()->isPointerTy() ||
+      !I.getOperand(3)->getType()->isIntegerTy() ||
+      !I.getType()->isIntegerTy())
     return false;
 
   ConstantInt *Size = dyn_cast<ConstantInt>(I.getOperand(3));
@@ -4631,7 +4634,7 @@ void SelectionDAGBuilder::visitCall(CallInst &I) {
       StringRef Name = F->getName();
       if (Name == "copysign" || Name == "copysignf") {
         if (I.getNumOperands() == 3 &&   // Basic sanity checks.
-            I.getOperand(1)->getType()->isFloatingPoint() &&
+            I.getOperand(1)->getType()->isFloatingPointTy() &&
             I.getType() == I.getOperand(1)->getType() &&
             I.getType() == I.getOperand(2)->getType()) {
           SDValue LHS = getValue(I.getOperand(1));
@@ -4642,7 +4645,7 @@ void SelectionDAGBuilder::visitCall(CallInst &I) {
         }
       } else if (Name == "fabs" || Name == "fabsf" || Name == "fabsl") {
         if (I.getNumOperands() == 2 &&   // Basic sanity checks.
-            I.getOperand(1)->getType()->isFloatingPoint() &&
+            I.getOperand(1)->getType()->isFloatingPointTy() &&
             I.getType() == I.getOperand(1)->getType()) {
           SDValue Tmp = getValue(I.getOperand(1));
           setValue(&I, DAG.getNode(ISD::FABS, getCurDebugLoc(),
@@ -4651,7 +4654,7 @@ void SelectionDAGBuilder::visitCall(CallInst &I) {
         }
       } else if (Name == "sin" || Name == "sinf" || Name == "sinl") {
         if (I.getNumOperands() == 2 &&   // Basic sanity checks.
-            I.getOperand(1)->getType()->isFloatingPoint() &&
+            I.getOperand(1)->getType()->isFloatingPointTy() &&
             I.getType() == I.getOperand(1)->getType() &&
             I.onlyReadsMemory()) {
           SDValue Tmp = getValue(I.getOperand(1));
@@ -4661,7 +4664,7 @@ void SelectionDAGBuilder::visitCall(CallInst &I) {
         }
       } else if (Name == "cos" || Name == "cosf" || Name == "cosl") {
         if (I.getNumOperands() == 2 &&   // Basic sanity checks.
-            I.getOperand(1)->getType()->isFloatingPoint() &&
+            I.getOperand(1)->getType()->isFloatingPointTy() &&
             I.getType() == I.getOperand(1)->getType() &&
             I.onlyReadsMemory()) {
           SDValue Tmp = getValue(I.getOperand(1));
@@ -4671,7 +4674,7 @@ void SelectionDAGBuilder::visitCall(CallInst &I) {
         }
       } else if (Name == "sqrt" || Name == "sqrtf" || Name == "sqrtl") {
         if (I.getNumOperands() == 2 &&   // Basic sanity checks.
-            I.getOperand(1)->getType()->isFloatingPoint() &&
+            I.getOperand(1)->getType()->isFloatingPointTy() &&
             I.getType() == I.getOperand(1)->getType() &&
             I.onlyReadsMemory()) {
           SDValue Tmp = getValue(I.getOperand(1));
@@ -4705,8 +4708,7 @@ void SelectionDAGBuilder::visitCall(CallInst &I) {
 /// Chain/Flag as the input and updates them for the output Chain/Flag.
 /// If the Flag pointer is NULL, no flag is used.
 SDValue RegsForValue::getCopyFromRegs(SelectionDAG &DAG, DebugLoc dl,
-                                      unsigned Order, SDValue &Chain,
-                                      SDValue *Flag) const {
+                                      SDValue &Chain, SDValue *Flag) const {
   // Assemble the legal parts into the final values.
   SmallVector<SDValue, 4> Values(ValueVTs.size());
   SmallVector<SDValue, 8> Parts;
@@ -4771,7 +4773,7 @@ SDValue RegsForValue::getCopyFromRegs(SelectionDAG &DAG, DebugLoc dl,
       Parts[i] = P;
     }
 
-    Values[Value] = getCopyFromParts(DAG, dl, Order, Parts.begin(),
+    Values[Value] = getCopyFromParts(DAG, dl, Parts.begin(),
                                      NumRegs, RegisterVT, ValueVT);
     Part += NumRegs;
     Parts.clear();
@@ -4787,8 +4789,7 @@ SDValue RegsForValue::getCopyFromRegs(SelectionDAG &DAG, DebugLoc dl,
 /// Chain/Flag as the input and updates them for the output Chain/Flag.
 /// If the Flag pointer is NULL, no flag is used.
 void RegsForValue::getCopyToRegs(SDValue Val, SelectionDAG &DAG, DebugLoc dl,
-                                 unsigned Order, SDValue &Chain,
-                                 SDValue *Flag) const {
+                                 SDValue &Chain, SDValue *Flag) const {
   // Get the list of the values's legal parts.
   unsigned NumRegs = Regs.size();
   SmallVector<SDValue, 8> Parts(NumRegs);
@@ -4797,7 +4798,7 @@ void RegsForValue::getCopyToRegs(SDValue Val, SelectionDAG &DAG, DebugLoc dl,
     unsigned NumParts = TLI->getNumRegisters(*DAG.getContext(), ValueVT);
     EVT RegisterVT = RegVTs[Value];
 
-    getCopyToParts(DAG, dl, Order,
+    getCopyToParts(DAG, dl,
                    Val.getValue(Val.getResNo() + Value),
                    &Parts[Part], NumParts, RegisterVT);
     Part += NumParts;
@@ -4838,7 +4839,7 @@ void RegsForValue::getCopyToRegs(SDValue Val, SelectionDAG &DAG, DebugLoc dl,
 /// values added into it.
 void RegsForValue::AddInlineAsmOperands(unsigned Code,
                                         bool HasMatching,unsigned MatchingIdx,
-                                        SelectionDAG &DAG, unsigned Order,
+                                        SelectionDAG &DAG,
                                         std::vector<SDValue> &Ops) const {
   assert(Regs.size() < (1 << 13) && "Too many inline asm outputs!");
   unsigned Flag = Code | (Regs.size() << 3);
@@ -5336,7 +5337,8 @@ void SelectionDAGBuilder::visitInlineAsm(CallSite CS) {
         int SSFI = MF.getFrameInfo()->CreateStackObject(TySize, Align, false);
         SDValue StackSlot = DAG.getFrameIndex(SSFI, TLI.getPointerTy());
         Chain = DAG.getStore(Chain, getCurDebugLoc(),
-                             OpInfo.CallOperand, StackSlot, NULL, 0);
+                             OpInfo.CallOperand, StackSlot, NULL, 0,
+                             false, false, 0);
         OpInfo.CallOperand = StackSlot;
       }
 
@@ -5427,7 +5429,7 @@ void SelectionDAGBuilder::visitInlineAsm(CallSite CS) {
                                                2 /* REGDEF */ ,
                                                false,
                                                0,
-                                               DAG, SDNodeOrder,
+                                               DAG,
                                                AsmNodeOperands);
       break;
     }
@@ -5475,10 +5477,10 @@ void SelectionDAGBuilder::visitInlineAsm(CallSite CS) {
 
           // Use the produced MatchedRegs object to
           MatchedRegs.getCopyToRegs(InOperandVal, DAG, getCurDebugLoc(),
-                                    SDNodeOrder, Chain, &Flag);
+                                    Chain, &Flag);
           MatchedRegs.AddInlineAsmOperands(1 /*REGUSE*/,
                                            true, OpInfo.getMatchedOperand(),
-                                           DAG, SDNodeOrder, AsmNodeOperands);
+                                           DAG, AsmNodeOperands);
           break;
         } else {
           assert(((OpFlag & 7) == 4) && "Unknown matching constraint!");
@@ -5539,11 +5541,10 @@ void SelectionDAGBuilder::visitInlineAsm(CallSite CS) {
       }
 
       OpInfo.AssignedRegs.getCopyToRegs(InOperandVal, DAG, getCurDebugLoc(),
-                                        SDNodeOrder, Chain, &Flag);
+                                        Chain, &Flag);
 
       OpInfo.AssignedRegs.AddInlineAsmOperands(1/*REGUSE*/, false, 0,
-                                               DAG, SDNodeOrder,
-                                               AsmNodeOperands);
+                                               DAG, AsmNodeOperands);
       break;
     }
     case InlineAsm::isClobber: {
@@ -5551,7 +5552,7 @@ void SelectionDAGBuilder::visitInlineAsm(CallSite CS) {
       // allocator is aware that the physreg got clobbered.
       if (!OpInfo.AssignedRegs.Regs.empty())
         OpInfo.AssignedRegs.AddInlineAsmOperands(6 /* EARLYCLOBBER REGDEF */,
-                                                 false, 0, DAG, SDNodeOrder,
+                                                 false, 0, DAG,
                                                  AsmNodeOperands);
       break;
     }
@@ -5571,7 +5572,7 @@ void SelectionDAGBuilder::visitInlineAsm(CallSite CS) {
   // and set it as the value of the call.
   if (!RetValRegs.Regs.empty()) {
     SDValue Val = RetValRegs.getCopyFromRegs(DAG, getCurDebugLoc(),
-                                             SDNodeOrder, Chain, &Flag);
+                                             Chain, &Flag);
 
     // FIXME: Why don't we do this for inline asms with MRVs?
     if (CS.getType()->isSingleValueType() && CS.getType()->isSized()) {
@@ -5611,7 +5612,7 @@ void SelectionDAGBuilder::visitInlineAsm(CallSite CS) {
     RegsForValue &OutRegs = IndirectStoresToEmit[i].first;
     Value *Ptr = IndirectStoresToEmit[i].second;
     SDValue OutVal = OutRegs.getCopyFromRegs(DAG, getCurDebugLoc(),
-                                             SDNodeOrder, Chain, &Flag);
+                                             Chain, &Flag);
     StoresToEmit.push_back(std::make_pair(OutVal, Ptr));
 
   }
@@ -5622,7 +5623,8 @@ void SelectionDAGBuilder::visitInlineAsm(CallSite CS) {
     SDValue Val = DAG.getStore(Chain, getCurDebugLoc(),
                                StoresToEmit[i].first,
                                getValue(StoresToEmit[i].second),
-                               StoresToEmit[i].second, 0);
+                               StoresToEmit[i].second, 0,
+                               false, false, 0);
     OutChains.push_back(Val);
   }
 
@@ -5675,8 +5677,7 @@ TargetLowering::LowerCallTo(SDValue Chain, const Type *RetTy,
                             CallingConv::ID CallConv, bool isTailCall,
                             bool isReturnValueUsed,
                             SDValue Callee,
-                            ArgListTy &Args, SelectionDAG &DAG, DebugLoc dl,
-                            unsigned Order) {
+                            ArgListTy &Args, SelectionDAG &DAG, DebugLoc dl) {
   // Handle all of the outgoing arguments.
   SmallVector<ISD::OutputArg, 32> Outs;
   for (unsigned i = 0, e = Args.size(); i != e; ++i) {
@@ -5727,7 +5728,7 @@ TargetLowering::LowerCallTo(SDValue Chain, const Type *RetTy,
       else if (Args[i].isZExt)
         ExtendKind = ISD::ZERO_EXTEND;
 
-      getCopyToParts(DAG, dl, Order, Op, &Parts[0], NumParts,
+      getCopyToParts(DAG, dl, Op, &Parts[0], NumParts,
                      PartVT, ExtendKind);
 
       for (unsigned j = 0; j != NumParts; ++j) {
@@ -5806,7 +5807,7 @@ TargetLowering::LowerCallTo(SDValue Chain, const Type *RetTy,
     EVT RegisterVT = getRegisterType(RetTy->getContext(), VT);
     unsigned NumRegs = getNumRegisters(RetTy->getContext(), VT);
 
-    ReturnValues.push_back(getCopyFromParts(DAG, dl, Order, &InVals[CurReg],
+    ReturnValues.push_back(getCopyFromParts(DAG, dl, &InVals[CurReg],
                                             NumRegs, RegisterVT, VT,
                                             AssertOp));
     CurReg += NumRegs;
@@ -5846,7 +5847,7 @@ void SelectionDAGBuilder::CopyValueToVirtualRegister(Value *V, unsigned Reg) {
 
   RegsForValue RFV(V->getContext(), TLI, Reg, V->getType());
   SDValue Chain = DAG.getEntryNode();
-  RFV.getCopyToRegs(Op, DAG, getCurDebugLoc(), SDNodeOrder, Chain, 0);
+  RFV.getCopyToRegs(Op, DAG, getCurDebugLoc(), Chain, 0);
   PendingExports.push_back(Chain);
 }
 
@@ -5972,7 +5973,7 @@ void SelectionDAGISel::LowerArguments(BasicBlock *LLVMBB) {
     EVT VT = ValueVTs[0];
     EVT RegVT = TLI.getRegisterType(*CurDAG->getContext(), VT);
     ISD::NodeType AssertOp = ISD::DELETED_NODE;
-    SDValue ArgValue = getCopyFromParts(DAG, dl, 0, &InVals[0], 1,
+    SDValue ArgValue = getCopyFromParts(DAG, dl, &InVals[0], 1,
                                         RegVT, VT, AssertOp);
 
     MachineFunction& MF = SDB->DAG.getMachineFunction();
@@ -6006,7 +6007,7 @@ void SelectionDAGISel::LowerArguments(BasicBlock *LLVMBB) {
         else if (F.paramHasAttr(Idx, Attribute::ZExt))
           AssertOp = ISD::AssertZext;
 
-        ArgValues.push_back(getCopyFromParts(DAG, dl, 0, &InVals[i],
+        ArgValues.push_back(getCopyFromParts(DAG, dl, &InVals[i],
                                              NumParts, PartVT, VT,
                                              AssertOp));
       }
diff --git a/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
index da2e6e4..05f9f1f 100644
--- a/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
+++ b/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
@@ -56,9 +56,12 @@
 #include "llvm/Support/MathExtras.h"
 #include "llvm/Support/Timer.h"
 #include "llvm/Support/raw_ostream.h"
+#include "llvm/ADT/Statistic.h"
 #include <algorithm>
 using namespace llvm;
 
+STATISTIC(NumFastIselFailures, "Number of instructions fast isel failed on");
+
 static cl::opt<bool>
 EnableFastISelVerbose("fast-isel-verbose", cl::Hidden,
           cl::desc("Enable verbose messages in the \"fast\" "
@@ -723,9 +726,9 @@ void SelectionDAGISel::CodeGenAndEmitDAG() {
   // code to the MachineBasicBlock.
   if (TimePassesIsEnabled) {
     NamedRegionTimer T("Instruction Selection", GroupName);
-    InstructionSelect();
+    DoInstructionSelection();
   } else {
-    InstructionSelect();
+    DoInstructionSelection();
   }
 
   DEBUG(dbgs() << "Selected selection DAG:\n");
@@ -765,6 +768,66 @@ void SelectionDAGISel::CodeGenAndEmitDAG() {
   DEBUG(BB->dump());
 }
 
+void SelectionDAGISel::DoInstructionSelection() {
+  DEBUG(errs() << "===== Instruction selection begins:\n");
+
+  PreprocessISelDAG();
+  
+  // Select target instructions for the DAG.
+  {
+    // Number all nodes with a topological order and set DAGSize.
+    DAGSize = CurDAG->AssignTopologicalOrder();
+    
+    // Create a dummy node (which is not added to allnodes), that adds
+    // a reference to the root node, preventing it from being deleted,
+    // and tracking any changes of the root.
+    HandleSDNode Dummy(CurDAG->getRoot());
+    ISelPosition = SelectionDAG::allnodes_iterator(CurDAG->getRoot().getNode());
+    ++ISelPosition;
+    
+    // The AllNodes list is now topological-sorted. Visit the
+    // nodes by starting at the end of the list (the root of the
+    // graph) and preceding back toward the beginning (the entry
+    // node).
+    while (ISelPosition != CurDAG->allnodes_begin()) {
+      SDNode *Node = --ISelPosition;
+      // Skip dead nodes. DAGCombiner is expected to eliminate all dead nodes,
+      // but there are currently some corner cases that it misses. Also, this
+      // makes it theoretically possible to disable the DAGCombiner.
+      if (Node->use_empty())
+        continue;
+      
+      SDNode *ResNode = Select(Node);
+      
+      // FIXME: This is pretty gross.  'Select' should be changed to not return
+      // anything at all and this code should be nuked with a tactical strike.
+      
+      // If node should not be replaced, continue with the next one.
+      if (ResNode == Node || Node->getOpcode() == ISD::DELETED_NODE)
+        continue;
+      // Replace node.
+      if (ResNode)
+        ReplaceUses(Node, ResNode);
+      
+      // If after the replacement this node is not used any more,
+      // remove this dead node.
+      if (Node->use_empty()) { // Don't delete EntryToken, etc.
+        ISelUpdater ISU(ISelPosition);
+        CurDAG->RemoveDeadNode(Node, &ISU);
+      }
+    }
+    
+    CurDAG->setRoot(Dummy.getValue());
+  }    
+  DEBUG(errs() << "===== Instruction selection ends:\n");
+
+  PostprocessISelDAG();
+  
+  // FIXME: This shouldn't be needed, remove it.
+  CurDAG->RemoveDeadNodes();
+}
+
+
 void SelectionDAGISel::SelectAllBasicBlocks(Function &Fn,
                                             MachineFunction &MF,
                                             MachineModuleInfo *MMI,
@@ -870,6 +933,7 @@ void SelectionDAGISel::SelectAllBasicBlocks(Function &Fn,
         // feed PHI nodes in successor blocks.
         if (isa<TerminatorInst>(BI))
           if (!HandlePHINodesInSuccessorBlocksFast(LLVMBB, FastIS)) {
+            ++NumFastIselFailures;
             ResetDebugLoc(SDB, FastIS);
             if (EnableFastISelVerbose || EnableFastISelAbort) {
               dbgs() << "FastISel miss: ";
@@ -894,6 +958,7 @@ void SelectionDAGISel::SelectAllBasicBlocks(Function &Fn,
 
         // Then handle certain instructions as single-LLVM-Instruction blocks.
         if (isa<CallInst>(BI)) {
+          ++NumFastIselFailures;
           if (EnableFastISelVerbose || EnableFastISelAbort) {
             dbgs() << "FastISel missed call: ";
             BI->dump();
@@ -923,6 +988,7 @@ void SelectionDAGISel::SelectAllBasicBlocks(Function &Fn,
         // Otherwise, give up on FastISel for the rest of the block.
         // For now, be a little lenient about non-branch terminators.
         if (!isa<TerminatorInst>(BI) || isa<BranchInst>(BI)) {
+          ++NumFastIselFailures;
           if (EnableFastISelVerbose || EnableFastISelAbort) {
             dbgs() << "FastISel miss: ";
             BI->dump();
@@ -972,6 +1038,8 @@ SelectionDAGISel::FinishBasicBlock() {
       MachineInstr *PHI = SDB->PHINodesToUpdate[i].first;
       assert(PHI->isPHI() &&
              "This is not a machine PHI node that we are updating!");
+      if (!BB->isSuccessor(PHI->getParent()))
+        continue;
       PHI->addOperand(MachineOperand::CreateReg(SDB->PHINodesToUpdate[i].second,
                                                 false));
       PHI->addOperand(MachineOperand::CreateMBB(BB));
@@ -1316,13 +1384,29 @@ static SDNode *findFlagUse(SDNode *N) {
 /// This function recursively traverses up the operand chain, ignoring
 /// certain nodes.
 static bool findNonImmUse(SDNode *Use, SDNode* Def, SDNode *ImmedUse,
-                          SDNode *Root,
-                          SmallPtrSet<SDNode*, 16> &Visited) {
-  if (Use->getNodeId() < Def->getNodeId() ||
-      !Visited.insert(Use))
+                          SDNode *Root, SmallPtrSet<SDNode*, 16> &Visited,
+                          bool IgnoreChains) {
+  // The NodeID's are given uniques ID's where a node ID is guaranteed to be
+  // greater than all of its (recursive) operands.  If we scan to a point where
+  // 'use' is smaller than the node we're scanning for, then we know we will
+  // never find it.
+  //
+  // The Use may be -1 (unassigned) if it is a newly allocated node.  This can
+  // happen because we scan down to newly selected nodes in the case of flag
+  // uses.
+  if ((Use->getNodeId() < Def->getNodeId() && Use->getNodeId() != -1))
+    return false;
+  
+  // Don't revisit nodes if we already scanned it and didn't fail, we know we
+  // won't fail if we scan it again.
+  if (!Visited.insert(Use))
     return false;
 
   for (unsigned i = 0, e = Use->getNumOperands(); i != e; ++i) {
+    // Ignore chain uses, they are validated by HandleMergeInputChains.
+    if (Use->getOperand(i).getValueType() == MVT::Other && IgnoreChains)
+      continue;
+    
     SDNode *N = Use->getOperand(i).getNode();
     if (N == Def) {
       if (Use == ImmedUse || Use == Root)
@@ -1332,32 +1416,24 @@ static bool findNonImmUse(SDNode *Use, SDNode* Def, SDNode *ImmedUse,
     }
 
     // Traverse up the operand chain.
-    if (findNonImmUse(N, Def, ImmedUse, Root, Visited))
+    if (findNonImmUse(N, Def, ImmedUse, Root, Visited, IgnoreChains))
       return true;
   }
   return false;
 }
 
-/// isNonImmUse - Start searching from Root up the DAG to check is Def can
-/// be reached. Return true if that's the case. However, ignore direct uses
-/// by ImmedUse (which would be U in the example illustrated in
-/// IsLegalAndProfitableToFold) and by Root (which can happen in the store
-/// case).
-/// FIXME: to be really generic, we should allow direct use by any node
-/// that is being folded. But realisticly since we only fold loads which
-/// have one non-chain use, we only need to watch out for load/op/store
-/// and load/op/cmp case where the root (store / cmp) may reach the load via
-/// its chain operand.
-static inline bool isNonImmUse(SDNode *Root, SDNode *Def, SDNode *ImmedUse) {
-  SmallPtrSet<SDNode*, 16> Visited;
-  return findNonImmUse(Root, Def, ImmedUse, Root, Visited);
+/// IsProfitableToFold - Returns true if it's profitable to fold the specific
+/// operand node N of U during instruction selection that starts at Root.
+bool SelectionDAGISel::IsProfitableToFold(SDValue N, SDNode *U,
+                                          SDNode *Root) const {
+  if (OptLevel == CodeGenOpt::None) return false;
+  return N.hasOneUse();
 }
 
-/// IsLegalAndProfitableToFold - Returns true if the specific operand node N of
-/// U can be folded during instruction selection that starts at Root and
-/// folding N is profitable.
-bool SelectionDAGISel::IsLegalAndProfitableToFold(SDNode *N, SDNode *U,
-                                                  SDNode *Root) const {
+/// IsLegalToFold - Returns true if the specific operand node N of
+/// U can be folded during instruction selection that starts at Root.
+bool SelectionDAGISel::IsLegalToFold(SDValue N, SDNode *U, SDNode *Root,
+                                     bool IgnoreChains) const {
   if (OptLevel == CodeGenOpt::None) return false;
 
   // If Root use can somehow reach N through a path that that doesn't contain
@@ -1402,6 +1478,8 @@ bool SelectionDAGISel::IsLegalAndProfitableToFold(SDNode *N, SDNode *U,
   // Fold. But since Fold and FU are flagged together, this will create
   // a cycle in the scheduling graph.
 
+  // If the node has flags, walk down the graph to the "lowest" node in the
+  // flagged set.
   EVT VT = Root->getValueType(Root->getNumValues()-1);
   while (VT == MVT::Flag) {
     SDNode *FU = findFlagUse(Root);
@@ -1409,9 +1487,17 @@ bool SelectionDAGISel::IsLegalAndProfitableToFold(SDNode *N, SDNode *U,
       break;
     Root = FU;
     VT = Root->getValueType(Root->getNumValues()-1);
+    
+    // If our query node has a flag result with a use, we've walked up it.  If
+    // the user (which has already been selected) has a chain or indirectly uses
+    // the chain, our WalkChainUsers predicate will not consider it.  Because of
+    // this, we cannot ignore chains in this predicate.
+    IgnoreChains = false;
   }
+  
 
-  return !isNonImmUse(Root, N, U);
+  SmallPtrSet<SDNode*, 16> Visited;
+  return !findNonImmUse(Root, N.getNode(), U, Root, Visited, IgnoreChains);
 }
 
 SDNode *SelectionDAGISel::Select_INLINEASM(SDNode *N) {
@@ -1423,6 +1509,7 @@ SDNode *SelectionDAGISel::Select_INLINEASM(SDNode *N) {
   VTs.push_back(MVT::Flag);
   SDValue New = CurDAG->getNode(ISD::INLINEASM, N->getDebugLoc(),
                                 VTs, &Ops[0], Ops.size());
+  New->setNodeId(-1);
   return New.getNode();
 }
 
@@ -1438,25 +1525,1219 @@ SDNode *SelectionDAGISel::Select_EH_LABEL(SDNode *N) {
                               MVT::Other, Tmp, Chain);
 }
 
+/// GetVBR - decode a vbr encoding whose top bit is set.
+ALWAYS_INLINE static uint64_t
+GetVBR(uint64_t Val, const unsigned char *MatcherTable, unsigned &Idx) {
+  assert(Val >= 128 && "Not a VBR");
+  Val &= 127;  // Remove first vbr bit.
+  
+  unsigned Shift = 7;
+  uint64_t NextBits;
+  do {
+    NextBits = MatcherTable[Idx++];
+    Val |= (NextBits&127) << Shift;
+    Shift += 7;
+  } while (NextBits & 128);
+  
+  return Val;
+}
+
+
+/// UpdateChainsAndFlags - When a match is complete, this method updates uses of
+/// interior flag and chain results to use the new flag and chain results.
+void SelectionDAGISel::
+UpdateChainsAndFlags(SDNode *NodeToMatch, SDValue InputChain,
+                     const SmallVectorImpl<SDNode*> &ChainNodesMatched,
+                     SDValue InputFlag,
+                     const SmallVectorImpl<SDNode*> &FlagResultNodesMatched,
+                     bool isMorphNodeTo) {
+  SmallVector<SDNode*, 4> NowDeadNodes;
+  
+  ISelUpdater ISU(ISelPosition);
+
+  // Now that all the normal results are replaced, we replace the chain and
+  // flag results if present.
+  if (!ChainNodesMatched.empty()) {
+    assert(InputChain.getNode() != 0 &&
+           "Matched input chains but didn't produce a chain");
+    // Loop over all of the nodes we matched that produced a chain result.
+    // Replace all the chain results with the final chain we ended up with.
+    for (unsigned i = 0, e = ChainNodesMatched.size(); i != e; ++i) {
+      SDNode *ChainNode = ChainNodesMatched[i];
+      
+      // If this node was already deleted, don't look at it.
+      if (ChainNode->getOpcode() == ISD::DELETED_NODE)
+        continue;
+      
+      // Don't replace the results of the root node if we're doing a
+      // MorphNodeTo.
+      if (ChainNode == NodeToMatch && isMorphNodeTo)
+        continue;
+      
+      SDValue ChainVal = SDValue(ChainNode, ChainNode->getNumValues()-1);
+      if (ChainVal.getValueType() == MVT::Flag)
+        ChainVal = ChainVal.getValue(ChainVal->getNumValues()-2);
+      assert(ChainVal.getValueType() == MVT::Other && "Not a chain?");
+      CurDAG->ReplaceAllUsesOfValueWith(ChainVal, InputChain, &ISU);
+      
+      // If the node became dead, delete it.
+      if (ChainNode->use_empty())
+        NowDeadNodes.push_back(ChainNode);
+    }
+  }
+  
+  // If the result produces a flag, update any flag results in the matched
+  // pattern with the flag result.
+  if (InputFlag.getNode() != 0) {
+    // Handle any interior nodes explicitly marked.
+    for (unsigned i = 0, e = FlagResultNodesMatched.size(); i != e; ++i) {
+      SDNode *FRN = FlagResultNodesMatched[i];
+      
+      // If this node was already deleted, don't look at it.
+      if (FRN->getOpcode() == ISD::DELETED_NODE)
+        continue;
+      
+      assert(FRN->getValueType(FRN->getNumValues()-1) == MVT::Flag &&
+             "Doesn't have a flag result");
+      CurDAG->ReplaceAllUsesOfValueWith(SDValue(FRN, FRN->getNumValues()-1),
+                                        InputFlag, &ISU);
+      
+      // If the node became dead, delete it.
+      if (FRN->use_empty())
+        NowDeadNodes.push_back(FRN);
+    }
+  }
+  
+  if (!NowDeadNodes.empty())
+    CurDAG->RemoveDeadNodes(NowDeadNodes, &ISU);
+  
+  DEBUG(errs() << "ISEL: Match complete!\n");
+}
+
+enum ChainResult {
+  CR_Simple,
+  CR_InducesCycle,
+  CR_LeadsToInteriorNode
+};
+
+/// WalkChainUsers - Walk down the users of the specified chained node that is
+/// part of the pattern we're matching, looking at all of the users we find.
+/// This determines whether something is an interior node, whether we have a
+/// non-pattern node in between two pattern nodes (which prevent folding because
+/// it would induce a cycle) and whether we have a TokenFactor node sandwiched
+/// between pattern nodes (in which case the TF becomes part of the pattern).
+///
+/// The walk we do here is guaranteed to be small because we quickly get down to
+/// already selected nodes "below" us.
+static ChainResult 
+WalkChainUsers(SDNode *ChainedNode,
+               SmallVectorImpl<SDNode*> &ChainedNodesInPattern,
+               SmallVectorImpl<SDNode*> &InteriorChainedNodes) {
+  ChainResult Result = CR_Simple;
+  
+  for (SDNode::use_iterator UI = ChainedNode->use_begin(),
+         E = ChainedNode->use_end(); UI != E; ++UI) {
+    // Make sure the use is of the chain, not some other value we produce.
+    if (UI.getUse().getValueType() != MVT::Other) continue;
+    
+    SDNode *User = *UI;
+
+    // If we see an already-selected machine node, then we've gone beyond the
+    // pattern that we're selecting down into the already selected chunk of the
+    // DAG.
+    if (User->isMachineOpcode() ||
+        User->getOpcode() == ISD::HANDLENODE)  // Root of the graph.
+      continue;
+    
+    if (User->getOpcode() == ISD::CopyToReg ||
+        User->getOpcode() == ISD::CopyFromReg ||
+        User->getOpcode() == ISD::INLINEASM) {
+      // If their node ID got reset to -1 then they've already been selected.
+      // Treat them like a MachineOpcode.
+      if (User->getNodeId() == -1)
+        continue;
+    }
+
+    // If we have a TokenFactor, we handle it specially.
+    if (User->getOpcode() != ISD::TokenFactor) {
+      // If the node isn't a token factor and isn't part of our pattern, then it
+      // must be a random chained node in between two nodes we're selecting.
+      // This happens when we have something like:
+      //   x = load ptr
+      //   call
+      //   y = x+4
+      //   store y -> ptr
+      // Because we structurally match the load/store as a read/modify/write,
+      // but the call is chained between them.  We cannot fold in this case
+      // because it would induce a cycle in the graph.
+      if (!std::count(ChainedNodesInPattern.begin(),
+                      ChainedNodesInPattern.end(), User))
+        return CR_InducesCycle;
+      
+      // Otherwise we found a node that is part of our pattern.  For example in:
+      //   x = load ptr
+      //   y = x+4
+      //   store y -> ptr
+      // This would happen when we're scanning down from the load and see the
+      // store as a user.  Record that there is a use of ChainedNode that is
+      // part of the pattern and keep scanning uses.
+      Result = CR_LeadsToInteriorNode;
+      InteriorChainedNodes.push_back(User);
+      continue;
+    }
+    
+    // If we found a TokenFactor, there are two cases to consider: first if the
+    // TokenFactor is just hanging "below" the pattern we're matching (i.e. no
+    // uses of the TF are in our pattern) we just want to ignore it.  Second,
+    // the TokenFactor can be sandwiched in between two chained nodes, like so:
+    //     [Load chain]
+    //         ^
+    //         |
+    //       [Load]
+    //       ^    ^
+    //       |    \                    DAG's like cheese
+    //      /       \                       do you?
+    //     /         |
+    // [TokenFactor] [Op]
+    //     ^          ^
+    //     |          |
+    //      \        /
+    //       \      /
+    //       [Store]
+    //
+    // In this case, the TokenFactor becomes part of our match and we rewrite it
+    // as a new TokenFactor.
+    //
+    // To distinguish these two cases, do a recursive walk down the uses.
+    switch (WalkChainUsers(User, ChainedNodesInPattern, InteriorChainedNodes)) {
+    case CR_Simple:
+      // If the uses of the TokenFactor are just already-selected nodes, ignore
+      // it, it is "below" our pattern.
+      continue;
+    case CR_InducesCycle:
+      // If the uses of the TokenFactor lead to nodes that are not part of our
+      // pattern that are not selected, folding would turn this into a cycle,
+      // bail out now.
+      return CR_InducesCycle;
+    case CR_LeadsToInteriorNode:
+      break;  // Otherwise, keep processing.
+    }
+    
+    // Okay, we know we're in the interesting interior case.  The TokenFactor
+    // is now going to be considered part of the pattern so that we rewrite its
+    // uses (it may have uses that are not part of the pattern) with the
+    // ultimate chain result of the generated code.  We will also add its chain
+    // inputs as inputs to the ultimate TokenFactor we create.
+    Result = CR_LeadsToInteriorNode;
+    ChainedNodesInPattern.push_back(User);
+    InteriorChainedNodes.push_back(User);
+    continue;
+  }
+  
+  return Result;
+}
+
+/// HandleMergeInputChains - This implements the OPC_EmitMergeInputChains
+/// operation for when the pattern matched at least one node with a chains.  The
+/// input vector contains a list of all of the chained nodes that we match.  We
+/// must determine if this is a valid thing to cover (i.e. matching it won't
+/// induce cycles in the DAG) and if so, creating a TokenFactor node. that will
+/// be used as the input node chain for the generated nodes.
+static SDValue
+HandleMergeInputChains(SmallVectorImpl<SDNode*> &ChainNodesMatched,
+                       SelectionDAG *CurDAG) {
+  // Walk all of the chained nodes we've matched, recursively scanning down the
+  // users of the chain result. This adds any TokenFactor nodes that are caught
+  // in between chained nodes to the chained and interior nodes list.
+  SmallVector<SDNode*, 3> InteriorChainedNodes;
+  for (unsigned i = 0, e = ChainNodesMatched.size(); i != e; ++i) {
+    if (WalkChainUsers(ChainNodesMatched[i], ChainNodesMatched,
+                       InteriorChainedNodes) == CR_InducesCycle)
+      return SDValue(); // Would induce a cycle.
+  }
+  
+  // Okay, we have walked all the matched nodes and collected TokenFactor nodes
+  // that we are interested in.  Form our input TokenFactor node.
+  SmallVector<SDValue, 3> InputChains;
+  for (unsigned i = 0, e = ChainNodesMatched.size(); i != e; ++i) {
+    // Add the input chain of this node to the InputChains list (which will be
+    // the operands of the generated TokenFactor) if it's not an interior node.
+    SDNode *N = ChainNodesMatched[i];
+    if (N->getOpcode() != ISD::TokenFactor) {
+      if (std::count(InteriorChainedNodes.begin(),InteriorChainedNodes.end(),N))
+        continue;
+      
+      // Otherwise, add the input chain.
+      SDValue InChain = ChainNodesMatched[i]->getOperand(0);
+      assert(InChain.getValueType() == MVT::Other && "Not a chain");
+      InputChains.push_back(InChain);
+      continue;
+    }
+    
+    // If we have a token factor, we want to add all inputs of the token factor
+    // that are not part of the pattern we're matching.
+    for (unsigned op = 0, e = N->getNumOperands(); op != e; ++op) {
+      if (!std::count(ChainNodesMatched.begin(), ChainNodesMatched.end(),
+                      N->getOperand(op).getNode()))
+        InputChains.push_back(N->getOperand(op));
+    }
+  }
+  
+  SDValue Res;
+  if (InputChains.size() == 1)
+    return InputChains[0];
+  return CurDAG->getNode(ISD::TokenFactor, ChainNodesMatched[0]->getDebugLoc(),
+                         MVT::Other, &InputChains[0], InputChains.size());
+}  
+
+/// MorphNode - Handle morphing a node in place for the selector.
+SDNode *SelectionDAGISel::
+MorphNode(SDNode *Node, unsigned TargetOpc, SDVTList VTList,
+          const SDValue *Ops, unsigned NumOps, unsigned EmitNodeInfo) {
+  // It is possible we're using MorphNodeTo to replace a node with no
+  // normal results with one that has a normal result (or we could be
+  // adding a chain) and the input could have flags and chains as well.
+  // In this case we need to shifting the operands down.
+  // FIXME: This is a horrible hack and broken in obscure cases, no worse
+  // than the old isel though.  We should sink this into MorphNodeTo.
+  int OldFlagResultNo = -1, OldChainResultNo = -1;
+
+  unsigned NTMNumResults = Node->getNumValues();
+  if (Node->getValueType(NTMNumResults-1) == MVT::Flag) {
+    OldFlagResultNo = NTMNumResults-1;
+    if (NTMNumResults != 1 &&
+        Node->getValueType(NTMNumResults-2) == MVT::Other)
+      OldChainResultNo = NTMNumResults-2;
+  } else if (Node->getValueType(NTMNumResults-1) == MVT::Other)
+    OldChainResultNo = NTMNumResults-1;
+
+  // Call the underlying SelectionDAG routine to do the transmogrification. Note
+  // that this deletes operands of the old node that become dead.
+  SDNode *Res = CurDAG->MorphNodeTo(Node, ~TargetOpc, VTList, Ops, NumOps);
+
+  // MorphNodeTo can operate in two ways: if an existing node with the
+  // specified operands exists, it can just return it.  Otherwise, it
+  // updates the node in place to have the requested operands.
+  if (Res == Node) {
+    // If we updated the node in place, reset the node ID.  To the isel,
+    // this should be just like a newly allocated machine node.
+    Res->setNodeId(-1);
+  }
+
+  unsigned ResNumResults = Res->getNumValues();
+  // Move the flag if needed.
+  if ((EmitNodeInfo & OPFL_FlagOutput) && OldFlagResultNo != -1 &&
+      (unsigned)OldFlagResultNo != ResNumResults-1)
+    CurDAG->ReplaceAllUsesOfValueWith(SDValue(Node, OldFlagResultNo), 
+                                      SDValue(Res, ResNumResults-1));
+
+  if ((EmitNodeInfo & OPFL_FlagOutput) != 0)
+  --ResNumResults;
+
+  // Move the chain reference if needed.
+  if ((EmitNodeInfo & OPFL_Chain) && OldChainResultNo != -1 &&
+      (unsigned)OldChainResultNo != ResNumResults-1)
+    CurDAG->ReplaceAllUsesOfValueWith(SDValue(Node, OldChainResultNo), 
+                                      SDValue(Res, ResNumResults-1));
+
+  // Otherwise, no replacement happened because the node already exists. Replace
+  // Uses of the old node with the new one.
+  if (Res != Node)
+    CurDAG->ReplaceAllUsesWith(Node, Res);
+  
+  return Res;
+}
+
+/// CheckPatternPredicate - Implements OP_CheckPatternPredicate.
+ALWAYS_INLINE static bool
+CheckSame(const unsigned char *MatcherTable, unsigned &MatcherIndex,
+          SDValue N, const SmallVectorImpl<SDValue> &RecordedNodes) {
+  // Accept if it is exactly the same as a previously recorded node.
+  unsigned RecNo = MatcherTable[MatcherIndex++];
+  assert(RecNo < RecordedNodes.size() && "Invalid CheckSame");
+  return N == RecordedNodes[RecNo];
+}
+  
+/// CheckPatternPredicate - Implements OP_CheckPatternPredicate.
+ALWAYS_INLINE static bool
+CheckPatternPredicate(const unsigned char *MatcherTable, unsigned &MatcherIndex,
+                      SelectionDAGISel &SDISel) {
+  return SDISel.CheckPatternPredicate(MatcherTable[MatcherIndex++]);
+}
+
+/// CheckNodePredicate - Implements OP_CheckNodePredicate.
+ALWAYS_INLINE static bool
+CheckNodePredicate(const unsigned char *MatcherTable, unsigned &MatcherIndex,
+                   SelectionDAGISel &SDISel, SDNode *N) {
+  return SDISel.CheckNodePredicate(N, MatcherTable[MatcherIndex++]);
+}
+
+ALWAYS_INLINE static bool
+CheckOpcode(const unsigned char *MatcherTable, unsigned &MatcherIndex,
+            SDNode *N) {
+  return N->getOpcode() == MatcherTable[MatcherIndex++];
+}
+
+ALWAYS_INLINE static bool
+CheckType(const unsigned char *MatcherTable, unsigned &MatcherIndex,
+          SDValue N, const TargetLowering &TLI) {
+  MVT::SimpleValueType VT = (MVT::SimpleValueType)MatcherTable[MatcherIndex++];
+  if (N.getValueType() == VT) return true;
+  
+  // Handle the case when VT is iPTR.
+  return VT == MVT::iPTR && N.getValueType() == TLI.getPointerTy();
+}
+
+ALWAYS_INLINE static bool
+CheckChildType(const unsigned char *MatcherTable, unsigned &MatcherIndex,
+               SDValue N, const TargetLowering &TLI,
+               unsigned ChildNo) {
+  if (ChildNo >= N.getNumOperands())
+    return false;  // Match fails if out of range child #.
+  return ::CheckType(MatcherTable, MatcherIndex, N.getOperand(ChildNo), TLI);
+}
+
+
+ALWAYS_INLINE static bool
+CheckCondCode(const unsigned char *MatcherTable, unsigned &MatcherIndex,
+              SDValue N) {
+  return cast<CondCodeSDNode>(N)->get() ==
+      (ISD::CondCode)MatcherTable[MatcherIndex++];
+}
+
+ALWAYS_INLINE static bool
+CheckValueType(const unsigned char *MatcherTable, unsigned &MatcherIndex,
+               SDValue N, const TargetLowering &TLI) {
+  MVT::SimpleValueType VT = (MVT::SimpleValueType)MatcherTable[MatcherIndex++];
+  if (cast<VTSDNode>(N)->getVT() == VT)
+    return true;
+  
+  // Handle the case when VT is iPTR.
+  return VT == MVT::iPTR && cast<VTSDNode>(N)->getVT() == TLI.getPointerTy();
+}
+
+ALWAYS_INLINE static bool
+CheckInteger(const unsigned char *MatcherTable, unsigned &MatcherIndex,
+             SDValue N) {
+  int64_t Val = MatcherTable[MatcherIndex++];
+  if (Val & 128)
+    Val = GetVBR(Val, MatcherTable, MatcherIndex);
+  
+  ConstantSDNode *C = dyn_cast<ConstantSDNode>(N);
+  return C != 0 && C->getSExtValue() == Val;
+}
+
+ALWAYS_INLINE static bool
+CheckAndImm(const unsigned char *MatcherTable, unsigned &MatcherIndex,
+            SDValue N, SelectionDAGISel &SDISel) {
+  int64_t Val = MatcherTable[MatcherIndex++];
+  if (Val & 128)
+    Val = GetVBR(Val, MatcherTable, MatcherIndex);
+  
+  if (N->getOpcode() != ISD::AND) return false;
+  
+  ConstantSDNode *C = dyn_cast<ConstantSDNode>(N->getOperand(1));
+  return C != 0 && SDISel.CheckAndMask(N.getOperand(0), C, Val);
+}
+
+ALWAYS_INLINE static bool
+CheckOrImm(const unsigned char *MatcherTable, unsigned &MatcherIndex,
+           SDValue N, SelectionDAGISel &SDISel) {
+  int64_t Val = MatcherTable[MatcherIndex++];
+  if (Val & 128)
+    Val = GetVBR(Val, MatcherTable, MatcherIndex);
+  
+  if (N->getOpcode() != ISD::OR) return false;
+  
+  ConstantSDNode *C = dyn_cast<ConstantSDNode>(N->getOperand(1));
+  return C != 0 && SDISel.CheckOrMask(N.getOperand(0), C, Val);
+}
+
+/// IsPredicateKnownToFail - If we know how and can do so without pushing a
+/// scope, evaluate the current node.  If the current predicate is known to
+/// fail, set Result=true and return anything.  If the current predicate is
+/// known to pass, set Result=false and return the MatcherIndex to continue
+/// with.  If the current predicate is unknown, set Result=false and return the
+/// MatcherIndex to continue with. 
+static unsigned IsPredicateKnownToFail(const unsigned char *Table,
+                                       unsigned Index, SDValue N,
+                                       bool &Result, SelectionDAGISel &SDISel,
+                                       SmallVectorImpl<SDValue> &RecordedNodes){
+  switch (Table[Index++]) {
+  default:
+    Result = false;
+    return Index-1;  // Could not evaluate this predicate.
+  case SelectionDAGISel::OPC_CheckSame:
+    Result = !::CheckSame(Table, Index, N, RecordedNodes);
+    return Index;
+  case SelectionDAGISel::OPC_CheckPatternPredicate:
+    Result = !::CheckPatternPredicate(Table, Index, SDISel);
+    return Index;
+  case SelectionDAGISel::OPC_CheckPredicate:
+    Result = !::CheckNodePredicate(Table, Index, SDISel, N.getNode());
+    return Index;
+  case SelectionDAGISel::OPC_CheckOpcode:
+    Result = !::CheckOpcode(Table, Index, N.getNode());
+    return Index;
+  case SelectionDAGISel::OPC_CheckType:
+    Result = !::CheckType(Table, Index, N, SDISel.TLI);
+    return Index;
+  case SelectionDAGISel::OPC_CheckChild0Type:
+  case SelectionDAGISel::OPC_CheckChild1Type:
+  case SelectionDAGISel::OPC_CheckChild2Type:
+  case SelectionDAGISel::OPC_CheckChild3Type:
+  case SelectionDAGISel::OPC_CheckChild4Type:
+  case SelectionDAGISel::OPC_CheckChild5Type:
+  case SelectionDAGISel::OPC_CheckChild6Type:
+  case SelectionDAGISel::OPC_CheckChild7Type:
+    Result = !::CheckChildType(Table, Index, N, SDISel.TLI,
+                        Table[Index-1] - SelectionDAGISel::OPC_CheckChild0Type);
+    return Index;
+  case SelectionDAGISel::OPC_CheckCondCode:
+    Result = !::CheckCondCode(Table, Index, N);
+    return Index;
+  case SelectionDAGISel::OPC_CheckValueType:
+    Result = !::CheckValueType(Table, Index, N, SDISel.TLI);
+    return Index;
+  case SelectionDAGISel::OPC_CheckInteger:
+    Result = !::CheckInteger(Table, Index, N);
+    return Index;
+  case SelectionDAGISel::OPC_CheckAndImm:
+    Result = !::CheckAndImm(Table, Index, N, SDISel);
+    return Index;
+  case SelectionDAGISel::OPC_CheckOrImm:
+    Result = !::CheckOrImm(Table, Index, N, SDISel);
+    return Index;
+  }
+}
+
+
+struct MatchScope {
+  /// FailIndex - If this match fails, this is the index to continue with.
+  unsigned FailIndex;
+  
+  /// NodeStack - The node stack when the scope was formed.
+  SmallVector<SDValue, 4> NodeStack;
+  
+  /// NumRecordedNodes - The number of recorded nodes when the scope was formed.
+  unsigned NumRecordedNodes;
+  
+  /// NumMatchedMemRefs - The number of matched memref entries.
+  unsigned NumMatchedMemRefs;
+  
+  /// InputChain/InputFlag - The current chain/flag 
+  SDValue InputChain, InputFlag;
+
+  /// HasChainNodesMatched - True if the ChainNodesMatched list is non-empty.
+  bool HasChainNodesMatched, HasFlagResultNodesMatched;
+};
+
+SDNode *SelectionDAGISel::
+SelectCodeCommon(SDNode *NodeToMatch, const unsigned char *MatcherTable,
+                 unsigned TableSize) {
+  // FIXME: Should these even be selected?  Handle these cases in the caller?
+  switch (NodeToMatch->getOpcode()) {
+  default:
+    break;
+  case ISD::EntryToken:       // These nodes remain the same.
+  case ISD::BasicBlock:
+  case ISD::Register:
+  case ISD::HANDLENODE:
+  case ISD::TargetConstant:
+  case ISD::TargetConstantFP:
+  case ISD::TargetConstantPool:
+  case ISD::TargetFrameIndex:
+  case ISD::TargetExternalSymbol:
+  case ISD::TargetBlockAddress:
+  case ISD::TargetJumpTable:
+  case ISD::TargetGlobalTLSAddress:
+  case ISD::TargetGlobalAddress:
+  case ISD::TokenFactor:
+  case ISD::CopyFromReg:
+  case ISD::CopyToReg:
+    NodeToMatch->setNodeId(-1); // Mark selected.
+    return 0;
+  case ISD::AssertSext:
+  case ISD::AssertZext:
+    CurDAG->ReplaceAllUsesOfValueWith(SDValue(NodeToMatch, 0),
+                                      NodeToMatch->getOperand(0));
+    return 0;
+  case ISD::INLINEASM: return Select_INLINEASM(NodeToMatch);
+  case ISD::EH_LABEL:  return Select_EH_LABEL(NodeToMatch);
+  case ISD::UNDEF:     return Select_UNDEF(NodeToMatch);
+  }
+  
+  assert(!NodeToMatch->isMachineOpcode() && "Node already selected!");
+
+  // Set up the node stack with NodeToMatch as the only node on the stack.
+  SmallVector<SDValue, 8> NodeStack;
+  SDValue N = SDValue(NodeToMatch, 0);
+  NodeStack.push_back(N);
+
+  // MatchScopes - Scopes used when matching, if a match failure happens, this
+  // indicates where to continue checking.
+  SmallVector<MatchScope, 8> MatchScopes;
+  
+  // RecordedNodes - This is the set of nodes that have been recorded by the
+  // state machine.
+  SmallVector<SDValue, 8> RecordedNodes;
+  
+  // MatchedMemRefs - This is the set of MemRef's we've seen in the input
+  // pattern.
+  SmallVector<MachineMemOperand*, 2> MatchedMemRefs;
+  
+  // These are the current input chain and flag for use when generating nodes.
+  // Various Emit operations change these.  For example, emitting a copytoreg
+  // uses and updates these.
+  SDValue InputChain, InputFlag;
+  
+  // ChainNodesMatched - If a pattern matches nodes that have input/output
+  // chains, the OPC_EmitMergeInputChains operation is emitted which indicates
+  // which ones they are.  The result is captured into this list so that we can
+  // update the chain results when the pattern is complete.
+  SmallVector<SDNode*, 3> ChainNodesMatched;
+  SmallVector<SDNode*, 3> FlagResultNodesMatched;
+  
+  DEBUG(errs() << "ISEL: Starting pattern match on root node: ";
+        NodeToMatch->dump(CurDAG);
+        errs() << '\n');
+  
+  // Determine where to start the interpreter.  Normally we start at opcode #0,
+  // but if the state machine starts with an OPC_SwitchOpcode, then we
+  // accelerate the first lookup (which is guaranteed to be hot) with the
+  // OpcodeOffset table.
+  unsigned MatcherIndex = 0;
+  
+  if (!OpcodeOffset.empty()) {
+    // Already computed the OpcodeOffset table, just index into it.
+    if (N.getOpcode() < OpcodeOffset.size())
+      MatcherIndex = OpcodeOffset[N.getOpcode()];
+    DEBUG(errs() << "  Initial Opcode index to " << MatcherIndex << "\n");
+
+  } else if (MatcherTable[0] == OPC_SwitchOpcode) {
+    // Otherwise, the table isn't computed, but the state machine does start
+    // with an OPC_SwitchOpcode instruction.  Populate the table now, since this
+    // is the first time we're selecting an instruction.
+    unsigned Idx = 1;
+    while (1) {
+      // Get the size of this case.
+      unsigned CaseSize = MatcherTable[Idx++];
+      if (CaseSize & 128)
+        CaseSize = GetVBR(CaseSize, MatcherTable, Idx);
+      if (CaseSize == 0) break;
+
+      // Get the opcode, add the index to the table.
+      unsigned Opc = MatcherTable[Idx++];
+      if (Opc >= OpcodeOffset.size())
+        OpcodeOffset.resize((Opc+1)*2);
+      OpcodeOffset[Opc] = Idx;
+      Idx += CaseSize;
+    }
+
+    // Okay, do the lookup for the first opcode.
+    if (N.getOpcode() < OpcodeOffset.size())
+      MatcherIndex = OpcodeOffset[N.getOpcode()];
+  }
+  
+  while (1) {
+    assert(MatcherIndex < TableSize && "Invalid index");
+    BuiltinOpcodes Opcode = (BuiltinOpcodes)MatcherTable[MatcherIndex++];
+    switch (Opcode) {
+    case OPC_Scope: {
+      // Okay, the semantics of this operation are that we should push a scope
+      // then evaluate the first child.  However, pushing a scope only to have
+      // the first check fail (which then pops it) is inefficient.  If we can
+      // determine immediately that the first check (or first several) will
+      // immediately fail, don't even bother pushing a scope for them.
+      unsigned FailIndex;
+      
+      while (1) {
+        unsigned NumToSkip = MatcherTable[MatcherIndex++];
+        if (NumToSkip & 128)
+          NumToSkip = GetVBR(NumToSkip, MatcherTable, MatcherIndex);
+        // Found the end of the scope with no match.
+        if (NumToSkip == 0) {
+          FailIndex = 0;
+          break;
+        }
+        
+        FailIndex = MatcherIndex+NumToSkip;
+        
+        // If we can't evaluate this predicate without pushing a scope (e.g. if
+        // it is a 'MoveParent') or if the predicate succeeds on this node, we
+        // push the scope and evaluate the full predicate chain.
+        bool Result;
+        MatcherIndex = IsPredicateKnownToFail(MatcherTable, MatcherIndex, N,
+                                              Result, *this, RecordedNodes);
+        if (!Result)
+          break;
+        
+        DEBUG(errs() << "  Skipped scope entry at index " << MatcherIndex
+              << " continuing at " << FailIndex << "\n");
+
+        
+        // Otherwise, we know that this case of the Scope is guaranteed to fail,
+        // move to the next case.
+        MatcherIndex = FailIndex;
+      }
+      
+      // If the whole scope failed to match, bail.
+      if (FailIndex == 0) break;
+      
+      // Push a MatchScope which indicates where to go if the first child fails
+      // to match.
+      MatchScope NewEntry;
+      NewEntry.FailIndex = FailIndex;
+      NewEntry.NodeStack.append(NodeStack.begin(), NodeStack.end());
+      NewEntry.NumRecordedNodes = RecordedNodes.size();
+      NewEntry.NumMatchedMemRefs = MatchedMemRefs.size();
+      NewEntry.InputChain = InputChain;
+      NewEntry.InputFlag = InputFlag;
+      NewEntry.HasChainNodesMatched = !ChainNodesMatched.empty();
+      NewEntry.HasFlagResultNodesMatched = !FlagResultNodesMatched.empty();
+      MatchScopes.push_back(NewEntry);
+      continue;
+    }
+    case OPC_RecordNode:
+      // Remember this node, it may end up being an operand in the pattern.
+      RecordedNodes.push_back(N);
+      continue;
+        
+    case OPC_RecordChild0: case OPC_RecordChild1:
+    case OPC_RecordChild2: case OPC_RecordChild3:
+    case OPC_RecordChild4: case OPC_RecordChild5:
+    case OPC_RecordChild6: case OPC_RecordChild7: {
+      unsigned ChildNo = Opcode-OPC_RecordChild0;
+      if (ChildNo >= N.getNumOperands())
+        break;  // Match fails if out of range child #.
+
+      RecordedNodes.push_back(N->getOperand(ChildNo));
+      continue;
+    }
+    case OPC_RecordMemRef:
+      MatchedMemRefs.push_back(cast<MemSDNode>(N)->getMemOperand());
+      continue;
+        
+    case OPC_CaptureFlagInput:
+      // If the current node has an input flag, capture it in InputFlag.
+      if (N->getNumOperands() != 0 &&
+          N->getOperand(N->getNumOperands()-1).getValueType() == MVT::Flag)
+        InputFlag = N->getOperand(N->getNumOperands()-1);
+      continue;
+        
+    case OPC_MoveChild: {
+      unsigned ChildNo = MatcherTable[MatcherIndex++];
+      if (ChildNo >= N.getNumOperands())
+        break;  // Match fails if out of range child #.
+      N = N.getOperand(ChildNo);
+      NodeStack.push_back(N);
+      continue;
+    }
+        
+    case OPC_MoveParent:
+      // Pop the current node off the NodeStack.
+      NodeStack.pop_back();
+      assert(!NodeStack.empty() && "Node stack imbalance!");
+      N = NodeStack.back();  
+      continue;
+     
+    case OPC_CheckSame:
+      if (!::CheckSame(MatcherTable, MatcherIndex, N, RecordedNodes)) break;
+      continue;
+    case OPC_CheckPatternPredicate:
+      if (!::CheckPatternPredicate(MatcherTable, MatcherIndex, *this)) break;
+      continue;
+    case OPC_CheckPredicate:
+      if (!::CheckNodePredicate(MatcherTable, MatcherIndex, *this,
+                                N.getNode()))
+        break;
+      continue;
+    case OPC_CheckComplexPat: {
+      unsigned CPNum = MatcherTable[MatcherIndex++];
+      unsigned RecNo = MatcherTable[MatcherIndex++];
+      assert(RecNo < RecordedNodes.size() && "Invalid CheckComplexPat");
+      if (!CheckComplexPattern(NodeToMatch, RecordedNodes[RecNo], CPNum,
+                               RecordedNodes))
+        break;
+      continue;
+    }
+    case OPC_CheckOpcode:
+      if (!::CheckOpcode(MatcherTable, MatcherIndex, N.getNode())) break;
+      continue;
+        
+    case OPC_CheckType:
+      if (!::CheckType(MatcherTable, MatcherIndex, N, TLI)) break;
+      continue;
+        
+    case OPC_SwitchOpcode: {
+      unsigned CurNodeOpcode = N.getOpcode();
+      unsigned SwitchStart = MatcherIndex-1; (void)SwitchStart;
+      unsigned CaseSize;
+      while (1) {
+        // Get the size of this case.
+        CaseSize = MatcherTable[MatcherIndex++];
+        if (CaseSize & 128)
+          CaseSize = GetVBR(CaseSize, MatcherTable, MatcherIndex);
+        if (CaseSize == 0) break;
+
+        // If the opcode matches, then we will execute this case.
+        if (CurNodeOpcode == MatcherTable[MatcherIndex++])
+          break;
+      
+        // Otherwise, skip over this case.
+        MatcherIndex += CaseSize;
+      }
+      
+      // If no cases matched, bail out.
+      if (CaseSize == 0) break;
+      
+      // Otherwise, execute the case we found.
+      DEBUG(errs() << "  OpcodeSwitch from " << SwitchStart
+                   << " to " << MatcherIndex << "\n");
+      continue;
+    }
+        
+    case OPC_SwitchType: {
+      MVT::SimpleValueType CurNodeVT = N.getValueType().getSimpleVT().SimpleTy;
+      unsigned SwitchStart = MatcherIndex-1; (void)SwitchStart;
+      unsigned CaseSize;
+      while (1) {
+        // Get the size of this case.
+        CaseSize = MatcherTable[MatcherIndex++];
+        if (CaseSize & 128)
+          CaseSize = GetVBR(CaseSize, MatcherTable, MatcherIndex);
+        if (CaseSize == 0) break;
+        
+        MVT::SimpleValueType CaseVT =
+          (MVT::SimpleValueType)MatcherTable[MatcherIndex++];
+        if (CaseVT == MVT::iPTR)
+          CaseVT = TLI.getPointerTy().SimpleTy;
+        
+        // If the VT matches, then we will execute this case.
+        if (CurNodeVT == CaseVT)
+          break;
+        
+        // Otherwise, skip over this case.
+        MatcherIndex += CaseSize;
+      }
+      
+      // If no cases matched, bail out.
+      if (CaseSize == 0) break;
+      
+      // Otherwise, execute the case we found.
+      DEBUG(errs() << "  TypeSwitch[" << EVT(CurNodeVT).getEVTString()
+                   << "] from " << SwitchStart << " to " << MatcherIndex<<'\n');
+      continue;
+    }
+    case OPC_CheckChild0Type: case OPC_CheckChild1Type:
+    case OPC_CheckChild2Type: case OPC_CheckChild3Type:
+    case OPC_CheckChild4Type: case OPC_CheckChild5Type:
+    case OPC_CheckChild6Type: case OPC_CheckChild7Type:
+      if (!::CheckChildType(MatcherTable, MatcherIndex, N, TLI,
+                            Opcode-OPC_CheckChild0Type))
+        break;
+      continue;
+    case OPC_CheckCondCode:
+      if (!::CheckCondCode(MatcherTable, MatcherIndex, N)) break;
+      continue;
+    case OPC_CheckValueType:
+      if (!::CheckValueType(MatcherTable, MatcherIndex, N, TLI)) break;
+      continue;
+    case OPC_CheckInteger:
+      if (!::CheckInteger(MatcherTable, MatcherIndex, N)) break;
+      continue;
+    case OPC_CheckAndImm:
+      if (!::CheckAndImm(MatcherTable, MatcherIndex, N, *this)) break;
+      continue;
+    case OPC_CheckOrImm:
+      if (!::CheckOrImm(MatcherTable, MatcherIndex, N, *this)) break;
+      continue;
+        
+    case OPC_CheckFoldableChainNode: {
+      assert(NodeStack.size() != 1 && "No parent node");
+      // Verify that all intermediate nodes between the root and this one have
+      // a single use.
+      bool HasMultipleUses = false;
+      for (unsigned i = 1, e = NodeStack.size()-1; i != e; ++i)
+        if (!NodeStack[i].hasOneUse()) {
+          HasMultipleUses = true;
+          break;
+        }
+      if (HasMultipleUses) break;
+
+      // Check to see that the target thinks this is profitable to fold and that
+      // we can fold it without inducing cycles in the graph.
+      if (!IsProfitableToFold(N, NodeStack[NodeStack.size()-2].getNode(),
+                              NodeToMatch) ||
+          !IsLegalToFold(N, NodeStack[NodeStack.size()-2].getNode(),
+                         NodeToMatch, true/*We validate our own chains*/))
+        break;
+      
+      continue;
+    }
+    case OPC_EmitInteger: {
+      MVT::SimpleValueType VT =
+        (MVT::SimpleValueType)MatcherTable[MatcherIndex++];
+      int64_t Val = MatcherTable[MatcherIndex++];
+      if (Val & 128)
+        Val = GetVBR(Val, MatcherTable, MatcherIndex);
+      RecordedNodes.push_back(CurDAG->getTargetConstant(Val, VT));
+      continue;
+    }
+    case OPC_EmitRegister: {
+      MVT::SimpleValueType VT =
+        (MVT::SimpleValueType)MatcherTable[MatcherIndex++];
+      unsigned RegNo = MatcherTable[MatcherIndex++];
+      RecordedNodes.push_back(CurDAG->getRegister(RegNo, VT));
+      continue;
+    }
+        
+    case OPC_EmitConvertToTarget:  {
+      // Convert from IMM/FPIMM to target version.
+      unsigned RecNo = MatcherTable[MatcherIndex++];
+      assert(RecNo < RecordedNodes.size() && "Invalid CheckSame");
+      SDValue Imm = RecordedNodes[RecNo];
+
+      if (Imm->getOpcode() == ISD::Constant) {
+        int64_t Val = cast<ConstantSDNode>(Imm)->getZExtValue();
+        Imm = CurDAG->getTargetConstant(Val, Imm.getValueType());
+      } else if (Imm->getOpcode() == ISD::ConstantFP) {
+        const ConstantFP *Val=cast<ConstantFPSDNode>(Imm)->getConstantFPValue();
+        Imm = CurDAG->getTargetConstantFP(*Val, Imm.getValueType());
+      }
+      
+      RecordedNodes.push_back(Imm);
+      continue;
+    }
+        
+    case OPC_EmitMergeInputChains: {
+      assert(InputChain.getNode() == 0 &&
+             "EmitMergeInputChains should be the first chain producing node");
+      // This node gets a list of nodes we matched in the input that have
+      // chains.  We want to token factor all of the input chains to these nodes
+      // together.  However, if any of the input chains is actually one of the
+      // nodes matched in this pattern, then we have an intra-match reference.
+      // Ignore these because the newly token factored chain should not refer to
+      // the old nodes.
+      unsigned NumChains = MatcherTable[MatcherIndex++];
+      assert(NumChains != 0 && "Can't TF zero chains");
+
+      assert(ChainNodesMatched.empty() &&
+             "Should only have one EmitMergeInputChains per match");
+
+      // Read all of the chained nodes.
+      for (unsigned i = 0; i != NumChains; ++i) {
+        unsigned RecNo = MatcherTable[MatcherIndex++];
+        assert(RecNo < RecordedNodes.size() && "Invalid CheckSame");
+        ChainNodesMatched.push_back(RecordedNodes[RecNo].getNode());
+        
+        // FIXME: What if other value results of the node have uses not matched
+        // by this pattern?
+        if (ChainNodesMatched.back() != NodeToMatch &&
+            !RecordedNodes[RecNo].hasOneUse()) {
+          ChainNodesMatched.clear();
+          break;
+        }
+      }
+      
+      // If the inner loop broke out, the match fails.
+      if (ChainNodesMatched.empty())
+        break;
+
+      // Merge the input chains if they are not intra-pattern references.
+      InputChain = HandleMergeInputChains(ChainNodesMatched, CurDAG);
+      
+      if (InputChain.getNode() == 0)
+        break;  // Failed to merge.
+
+      continue;
+    }
+        
+    case OPC_EmitCopyToReg: {
+      unsigned RecNo = MatcherTable[MatcherIndex++];
+      assert(RecNo < RecordedNodes.size() && "Invalid CheckSame");
+      unsigned DestPhysReg = MatcherTable[MatcherIndex++];
+      
+      if (InputChain.getNode() == 0)
+        InputChain = CurDAG->getEntryNode();
+      
+      InputChain = CurDAG->getCopyToReg(InputChain, NodeToMatch->getDebugLoc(),
+                                        DestPhysReg, RecordedNodes[RecNo],
+                                        InputFlag);
+      
+      InputFlag = InputChain.getValue(1);
+      continue;
+    }
+        
+    case OPC_EmitNodeXForm: {
+      unsigned XFormNo = MatcherTable[MatcherIndex++];
+      unsigned RecNo = MatcherTable[MatcherIndex++];
+      assert(RecNo < RecordedNodes.size() && "Invalid CheckSame");
+      RecordedNodes.push_back(RunSDNodeXForm(RecordedNodes[RecNo], XFormNo));
+      continue;
+    }
+        
+    case OPC_EmitNode:
+    case OPC_MorphNodeTo: {
+      uint16_t TargetOpc = MatcherTable[MatcherIndex++];
+      TargetOpc |= (unsigned short)MatcherTable[MatcherIndex++] << 8;
+      unsigned EmitNodeInfo = MatcherTable[MatcherIndex++];
+      // Get the result VT list.
+      unsigned NumVTs = MatcherTable[MatcherIndex++];
+      SmallVector<EVT, 4> VTs;
+      for (unsigned i = 0; i != NumVTs; ++i) {
+        MVT::SimpleValueType VT =
+          (MVT::SimpleValueType)MatcherTable[MatcherIndex++];
+        if (VT == MVT::iPTR) VT = TLI.getPointerTy().SimpleTy;
+        VTs.push_back(VT);
+      }
+      
+      if (EmitNodeInfo & OPFL_Chain)
+        VTs.push_back(MVT::Other);
+      if (EmitNodeInfo & OPFL_FlagOutput)
+        VTs.push_back(MVT::Flag);
+      
+      // This is hot code, so optimize the two most common cases of 1 and 2
+      // results.
+      SDVTList VTList;
+      if (VTs.size() == 1)
+        VTList = CurDAG->getVTList(VTs[0]);
+      else if (VTs.size() == 2)
+        VTList = CurDAG->getVTList(VTs[0], VTs[1]);
+      else
+        VTList = CurDAG->getVTList(VTs.data(), VTs.size());
+
+      // Get the operand list.
+      unsigned NumOps = MatcherTable[MatcherIndex++];
+      SmallVector<SDValue, 8> Ops;
+      for (unsigned i = 0; i != NumOps; ++i) {
+        unsigned RecNo = MatcherTable[MatcherIndex++];
+        if (RecNo & 128)
+          RecNo = GetVBR(RecNo, MatcherTable, MatcherIndex);
+        
+        assert(RecNo < RecordedNodes.size() && "Invalid EmitNode");
+        Ops.push_back(RecordedNodes[RecNo]);
+      }
+      
+      // If there are variadic operands to add, handle them now.
+      if (EmitNodeInfo & OPFL_VariadicInfo) {
+        // Determine the start index to copy from.
+        unsigned FirstOpToCopy = getNumFixedFromVariadicInfo(EmitNodeInfo);
+        FirstOpToCopy += (EmitNodeInfo & OPFL_Chain) ? 1 : 0;
+        assert(NodeToMatch->getNumOperands() >= FirstOpToCopy &&
+               "Invalid variadic node");
+        // Copy all of the variadic operands, not including a potential flag
+        // input.
+        for (unsigned i = FirstOpToCopy, e = NodeToMatch->getNumOperands();
+             i != e; ++i) {
+          SDValue V = NodeToMatch->getOperand(i);
+          if (V.getValueType() == MVT::Flag) break;
+          Ops.push_back(V);
+        }
+      }
+      
+      // If this has chain/flag inputs, add them.
+      if (EmitNodeInfo & OPFL_Chain)
+        Ops.push_back(InputChain);
+      if ((EmitNodeInfo & OPFL_FlagInput) && InputFlag.getNode() != 0)
+        Ops.push_back(InputFlag);
+      
+      // Create the node.
+      SDNode *Res = 0;
+      if (Opcode != OPC_MorphNodeTo) {
+        // If this is a normal EmitNode command, just create the new node and
+        // add the results to the RecordedNodes list.
+        Res = CurDAG->getMachineNode(TargetOpc, NodeToMatch->getDebugLoc(),
+                                     VTList, Ops.data(), Ops.size());
+        
+        // Add all the non-flag/non-chain results to the RecordedNodes list.
+        for (unsigned i = 0, e = VTs.size(); i != e; ++i) {
+          if (VTs[i] == MVT::Other || VTs[i] == MVT::Flag) break;
+          RecordedNodes.push_back(SDValue(Res, i));
+        }
+        
+      } else {
+        Res = MorphNode(NodeToMatch, TargetOpc, VTList, Ops.data(), Ops.size(),
+                        EmitNodeInfo);
+      }
+      
+      // If the node had chain/flag results, update our notion of the current
+      // chain and flag.
+      if (EmitNodeInfo & OPFL_FlagOutput) {
+        InputFlag = SDValue(Res, VTs.size()-1);
+        if (EmitNodeInfo & OPFL_Chain)
+          InputChain = SDValue(Res, VTs.size()-2);
+      } else if (EmitNodeInfo & OPFL_Chain)
+        InputChain = SDValue(Res, VTs.size()-1);
+
+      // If the OPFL_MemRefs flag is set on this node, slap all of the
+      // accumulated memrefs onto it.
+      //
+      // FIXME: This is vastly incorrect for patterns with multiple outputs
+      // instructions that access memory and for ComplexPatterns that match
+      // loads.
+      if (EmitNodeInfo & OPFL_MemRefs) {
+        MachineSDNode::mmo_iterator MemRefs =
+          MF->allocateMemRefsArray(MatchedMemRefs.size());
+        std::copy(MatchedMemRefs.begin(), MatchedMemRefs.end(), MemRefs);
+        cast<MachineSDNode>(Res)
+          ->setMemRefs(MemRefs, MemRefs + MatchedMemRefs.size());
+      }
+      
+      DEBUG(errs() << "  "
+                   << (Opcode == OPC_MorphNodeTo ? "Morphed" : "Created")
+                   << " node: "; Res->dump(CurDAG); errs() << "\n");
+      
+      // If this was a MorphNodeTo then we're completely done!
+      if (Opcode == OPC_MorphNodeTo) {
+        // Update chain and flag uses.
+        UpdateChainsAndFlags(NodeToMatch, InputChain, ChainNodesMatched,
+                             InputFlag, FlagResultNodesMatched, true);
+        return Res;
+      }
+      
+      continue;
+    }
+        
+    case OPC_MarkFlagResults: {
+      unsigned NumNodes = MatcherTable[MatcherIndex++];
+      
+      // Read and remember all the flag-result nodes.
+      for (unsigned i = 0; i != NumNodes; ++i) {
+        unsigned RecNo = MatcherTable[MatcherIndex++];
+        if (RecNo & 128)
+          RecNo = GetVBR(RecNo, MatcherTable, MatcherIndex);
+
+        assert(RecNo < RecordedNodes.size() && "Invalid CheckSame");
+        FlagResultNodesMatched.push_back(RecordedNodes[RecNo].getNode());
+      }
+      continue;
+    }
+      
+    case OPC_CompleteMatch: {
+      // The match has been completed, and any new nodes (if any) have been
+      // created.  Patch up references to the matched dag to use the newly
+      // created nodes.
+      unsigned NumResults = MatcherTable[MatcherIndex++];
+
+      for (unsigned i = 0; i != NumResults; ++i) {
+        unsigned ResSlot = MatcherTable[MatcherIndex++];
+        if (ResSlot & 128)
+          ResSlot = GetVBR(ResSlot, MatcherTable, MatcherIndex);
+        
+        assert(ResSlot < RecordedNodes.size() && "Invalid CheckSame");
+        SDValue Res = RecordedNodes[ResSlot];
+        
+        // FIXME2: Eliminate this horrible hack by fixing the 'Gen' program
+        // after (parallel) on input patterns are removed.  This would also
+        // allow us to stop encoding #results in OPC_CompleteMatch's table
+        // entry.
+        if (NodeToMatch->getNumValues() <= i ||
+            NodeToMatch->getValueType(i) == MVT::Other ||
+            NodeToMatch->getValueType(i) == MVT::Flag)
+          break;
+        assert((NodeToMatch->getValueType(i) == Res.getValueType() ||
+                NodeToMatch->getValueType(i) == MVT::iPTR ||
+                Res.getValueType() == MVT::iPTR ||
+                NodeToMatch->getValueType(i).getSizeInBits() ==
+                    Res.getValueType().getSizeInBits()) &&
+               "invalid replacement");
+        CurDAG->ReplaceAllUsesOfValueWith(SDValue(NodeToMatch, i), Res);
+      }
+
+      // If the root node defines a flag, add it to the flag nodes to update
+      // list.
+      if (NodeToMatch->getValueType(NodeToMatch->getNumValues()-1) == MVT::Flag)
+        FlagResultNodesMatched.push_back(NodeToMatch);
+      
+      // Update chain and flag uses.
+      UpdateChainsAndFlags(NodeToMatch, InputChain, ChainNodesMatched,
+                           InputFlag, FlagResultNodesMatched, false);
+      
+      assert(NodeToMatch->use_empty() &&
+             "Didn't replace all uses of the node?");
+      
+      // FIXME: We just return here, which interacts correctly with SelectRoot
+      // above.  We should fix this to not return an SDNode* anymore.
+      return 0;
+    }
+    }
+    
+    // If the code reached this point, then the match failed.  See if there is
+    // another child to try in the current 'Scope', otherwise pop it until we
+    // find a case to check.
+    while (1) {
+      if (MatchScopes.empty()) {
+        CannotYetSelect(NodeToMatch);
+        return 0;
+      }
+
+      // Restore the interpreter state back to the point where the scope was
+      // formed.
+      MatchScope &LastScope = MatchScopes.back();
+      RecordedNodes.resize(LastScope.NumRecordedNodes);
+      NodeStack.clear();
+      NodeStack.append(LastScope.NodeStack.begin(), LastScope.NodeStack.end());
+      N = NodeStack.back();
+
+      DEBUG(errs() << "  Match failed at index " << MatcherIndex
+                   << " continuing at " << LastScope.FailIndex << "\n");
+    
+      if (LastScope.NumMatchedMemRefs != MatchedMemRefs.size())
+        MatchedMemRefs.resize(LastScope.NumMatchedMemRefs);
+      MatcherIndex = LastScope.FailIndex;
+      
+      InputChain = LastScope.InputChain;
+      InputFlag = LastScope.InputFlag;
+      if (!LastScope.HasChainNodesMatched)
+        ChainNodesMatched.clear();
+      if (!LastScope.HasFlagResultNodesMatched)
+        FlagResultNodesMatched.clear();
+
+      // Check to see what the offset is at the new MatcherIndex.  If it is zero
+      // we have reached the end of this scope, otherwise we have another child
+      // in the current scope to try.
+      unsigned NumToSkip = MatcherTable[MatcherIndex++];
+      if (NumToSkip & 128)
+        NumToSkip = GetVBR(NumToSkip, MatcherTable, MatcherIndex);
+
+      // If we have another child in this scope to match, update FailIndex and
+      // try it.
+      if (NumToSkip != 0) {
+        LastScope.FailIndex = MatcherIndex+NumToSkip;
+        break;
+      }
+      
+      // End of this scope, pop it and try the next child in the containing
+      // scope.
+      MatchScopes.pop_back();
+    }
+  }
+}
+    
+
+
 void SelectionDAGISel::CannotYetSelect(SDNode *N) {
   std::string msg;
   raw_string_ostream Msg(msg);
   Msg << "Cannot yet select: ";
-  N->printrFull(Msg, CurDAG);
+  
+  if (N->getOpcode() != ISD::INTRINSIC_W_CHAIN &&
+      N->getOpcode() != ISD::INTRINSIC_WO_CHAIN &&
+      N->getOpcode() != ISD::INTRINSIC_VOID) {
+    N->printrFull(Msg, CurDAG);
+  } else {
+    bool HasInputChain = N->getOperand(0).getValueType() == MVT::Other;
+    unsigned iid =
+      cast<ConstantSDNode>(N->getOperand(HasInputChain))->getZExtValue();
+    if (iid < Intrinsic::num_intrinsics)
+      Msg << "intrinsic %" << Intrinsic::getName((Intrinsic::ID)iid);
+    else if (const TargetIntrinsicInfo *TII = TM.getIntrinsicInfo())
+      Msg << "target intrinsic %" << TII->getName(iid);
+    else
+      Msg << "unknown intrinsic #" << iid;
+  }
   llvm_report_error(Msg.str());
 }
 
-void SelectionDAGISel::CannotYetSelectIntrinsic(SDNode *N) {
-  dbgs() << "Cannot yet select: ";
-  unsigned iid =
-    cast<ConstantSDNode>(N->getOperand(N->getOperand(0).getValueType() ==
-                                       MVT::Other))->getZExtValue();
-  if (iid < Intrinsic::num_intrinsics)
-    llvm_report_error("Cannot yet select: intrinsic %" +
-                      Intrinsic::getName((Intrinsic::ID)iid));
-  else if (const TargetIntrinsicInfo *tii = TM.getIntrinsicInfo())
-    llvm_report_error(Twine("Cannot yet select: target intrinsic %") +
-                      tii->getName(iid));
-}
-
 char SelectionDAGISel::ID = 0;
diff --git a/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
index 1683d01..0e54ca4 100644
--- a/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
+++ b/libclamav/c++/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
@@ -1441,8 +1441,10 @@ bool TargetLowering::SimplifyDemandedBits(SDValue Op,
   case ISD::TRUNCATE: {
     // Simplify the input, using demanded bit information, and compute the known
     // zero/one bits live out.
+    unsigned OperandBitWidth =
+      Op.getOperand(0).getValueType().getScalarType().getSizeInBits();
     APInt TruncMask = NewMask;
-    TruncMask.zext(Op.getOperand(0).getValueSizeInBits());
+    TruncMask.zext(OperandBitWidth);
     if (SimplifyDemandedBits(Op.getOperand(0), TruncMask,
                              KnownZero, KnownOne, TLO, Depth+1))
       return true;
@@ -1453,15 +1455,14 @@ bool TargetLowering::SimplifyDemandedBits(SDValue Op,
     // on the known demanded bits.
     if (Op.getOperand(0).getNode()->hasOneUse()) {
       SDValue In = Op.getOperand(0);
-      unsigned InBitWidth = In.getValueSizeInBits();
       switch (In.getOpcode()) {
       default: break;
       case ISD::SRL:
         // Shrink SRL by a constant if none of the high bits shifted in are
         // demanded.
         if (ConstantSDNode *ShAmt = dyn_cast<ConstantSDNode>(In.getOperand(1))){
-          APInt HighBits = APInt::getHighBitsSet(InBitWidth,
-                                                 InBitWidth - BitWidth);
+          APInt HighBits = APInt::getHighBitsSet(OperandBitWidth,
+                                                 OperandBitWidth - BitWidth);
           HighBits = HighBits.lshr(ShAmt->getZExtValue());
           HighBits.trunc(BitWidth);
           
@@ -1607,7 +1608,7 @@ static bool ValueHasExactlyOneBitSet(SDValue Val, const SelectionDAG &DAG) {
 
   // Fall back to ComputeMaskedBits to catch other known cases.
   EVT OpVT = Val.getValueType();
-  unsigned BitWidth = OpVT.getSizeInBits();
+  unsigned BitWidth = OpVT.getScalarType().getSizeInBits();
   APInt Mask = APInt::getAllOnesValue(BitWidth);
   APInt KnownZero, KnownOne;
   DAG.ComputeMaskedBits(Val, Mask, KnownZero, KnownOne);
@@ -1716,7 +1717,7 @@ TargetLowering::SimplifySetCC(EVT VT, SDValue N0, SDValue N1,
           SDValue NewLoad = DAG.getLoad(newVT, dl, Lod->getChain(), Ptr,
                                         Lod->getSrcValue(), 
                                         Lod->getSrcValueOffset() + bestOffset,
-                                        false, NewAlign);
+                                        false, false, NewAlign);
           return DAG.getSetCC(dl, VT, 
                               DAG.getNode(ISD::AND, dl, newVT, NewLoad,
                                       DAG.getConstant(bestMask.trunc(bestWidth),
@@ -1775,7 +1776,7 @@ TargetLowering::SimplifySetCC(EVT VT, SDValue N0, SDValue N1,
         break;   // todo, be more careful with signed comparisons
       }
     } else if (N0.getOpcode() == ISD::SIGN_EXTEND_INREG &&
-                (Cond == ISD::SETEQ || Cond == ISD::SETNE)) {
+               (Cond == ISD::SETEQ || Cond == ISD::SETNE)) {
       EVT ExtSrcTy = cast<VTSDNode>(N0.getOperand(1))->getVT();
       unsigned ExtSrcTyBits = ExtSrcTy.getSizeInBits();
       EVT ExtDstTy = N0.getValueType();
@@ -1809,22 +1810,21 @@ TargetLowering::SimplifySetCC(EVT VT, SDValue N0, SDValue N1,
                           Cond);
     } else if ((N1C->isNullValue() || N1C->getAPIntValue() == 1) &&
                 (Cond == ISD::SETEQ || Cond == ISD::SETNE)) {
-      
       // SETCC (SETCC), [0|1], [EQ|NE]  -> SETCC
-      if (N0.getOpcode() == ISD::SETCC) {
+      if (N0.getOpcode() == ISD::SETCC &&
+          isTypeLegal(VT) && VT.bitsLE(N0.getValueType())) {
         bool TrueWhenTrue = (Cond == ISD::SETEQ) ^ (N1C->getAPIntValue() != 1);
         if (TrueWhenTrue)
-          return N0;
-        
+          return DAG.getNode(ISD::TRUNCATE, dl, VT, N0);        
         // Invert the condition.
         ISD::CondCode CC = cast<CondCodeSDNode>(N0.getOperand(2))->get();
         CC = ISD::getSetCCInverse(CC, 
                                   N0.getOperand(0).getValueType().isInteger());
         return DAG.getSetCC(dl, VT, N0.getOperand(0), N0.getOperand(1), CC);
       }
-      
+
       if ((N0.getOpcode() == ISD::XOR ||
-            (N0.getOpcode() == ISD::AND && 
+           (N0.getOpcode() == ISD::AND && 
             N0.getOperand(0).getOpcode() == ISD::XOR &&
             N0.getOperand(1) == N0.getOperand(0).getOperand(1))) &&
           isa<ConstantSDNode>(N0.getOperand(1)) &&
@@ -1847,9 +1847,36 @@ TargetLowering::SimplifySetCC(EVT VT, SDValue N0, SDValue N1,
                               N0.getOperand(0).getOperand(0),
                               N0.getOperand(1));
           }
+
           return DAG.getSetCC(dl, VT, Val, N1,
                               Cond == ISD::SETEQ ? ISD::SETNE : ISD::SETEQ);
         }
+      } else if (N1C->getAPIntValue() == 1 &&
+                 (VT == MVT::i1 ||
+                  getBooleanContents() == ZeroOrOneBooleanContent)) {
+        SDValue Op0 = N0;
+        if (Op0.getOpcode() == ISD::TRUNCATE)
+          Op0 = Op0.getOperand(0);
+
+        if ((Op0.getOpcode() == ISD::XOR) &&
+            Op0.getOperand(0).getOpcode() == ISD::SETCC &&
+            Op0.getOperand(1).getOpcode() == ISD::SETCC) {
+          // (xor (setcc), (setcc)) == / != 1 -> (setcc) != / == (setcc)
+          Cond = (Cond == ISD::SETEQ) ? ISD::SETNE : ISD::SETEQ;
+          return DAG.getSetCC(dl, VT, Op0.getOperand(0), Op0.getOperand(1),
+                              Cond);
+        } else if (Op0.getOpcode() == ISD::AND &&
+                isa<ConstantSDNode>(Op0.getOperand(1)) &&
+                cast<ConstantSDNode>(Op0.getOperand(1))->getAPIntValue() == 1) {
+          // If this is (X&1) == / != 1, normalize it to (X&1) != / == 0.
+          if (Op0.getValueType() != VT)
+            Op0 = DAG.getNode(ISD::AND, dl, VT,
+                          DAG.getNode(ISD::TRUNCATE, dl, VT, Op0.getOperand(0)),
+                          DAG.getConstant(1, VT));
+          return DAG.getSetCC(dl, VT, Op0,
+                              DAG.getConstant(0, Op0.getValueType()),
+                              Cond == ISD::SETEQ ? ISD::SETNE : ISD::SETEQ);
+        }
       }
     }
     
diff --git a/libclamav/c++/llvm/lib/CodeGen/SimpleRegisterCoalescing.cpp b/libclamav/c++/llvm/lib/CodeGen/SimpleRegisterCoalescing.cpp
index e7b0cff..ce72b2f 100644
--- a/libclamav/c++/llvm/lib/CodeGen/SimpleRegisterCoalescing.cpp
+++ b/libclamav/c++/llvm/lib/CodeGen/SimpleRegisterCoalescing.cpp
@@ -662,7 +662,7 @@ bool SimpleRegisterCoalescing::ReMaterializeTrivialDef(LiveInterval &SrcInt,
   if (!tii_->isTriviallyReMaterializable(DefMI, AA))
     return false;
   bool SawStore = false;
-  if (!DefMI->isSafeToMove(tii_, SawStore, AA))
+  if (!DefMI->isSafeToMove(tii_, AA, SawStore))
     return false;
   if (TID.getNumDefs() != 1)
     return false;
@@ -702,7 +702,8 @@ bool SimpleRegisterCoalescing::ReMaterializeTrivialDef(LiveInterval &SrcInt,
     for (const unsigned* SR = tri_->getSubRegisters(DstReg); *SR; ++SR) {
       if (!li_->hasInterval(*SR))
         continue;
-      DLR = li_->getInterval(*SR).getLiveRangeContaining(DefIdx);
+      const LiveRange *DLR =
+          li_->getInterval(*SR).getLiveRangeContaining(DefIdx);
       if (DLR && DLR->valno->getCopy() == CopyMI)
         DLR->valno->setCopy(0);
     }
@@ -741,9 +742,21 @@ bool SimpleRegisterCoalescing::ReMaterializeTrivialDef(LiveInterval &SrcInt,
       NewMI->addOperand(MO);
     if (MO.isDef() && li_->hasInterval(MO.getReg())) {
       unsigned Reg = MO.getReg();
-      DLR = li_->getInterval(Reg).getLiveRangeContaining(DefIdx);
+      const LiveRange *DLR =
+          li_->getInterval(Reg).getLiveRangeContaining(DefIdx);
       if (DLR && DLR->valno->getCopy() == CopyMI)
         DLR->valno->setCopy(0);
+      // Handle subregs as well
+      if (TargetRegisterInfo::isPhysicalRegister(Reg)) {
+        for (const unsigned* SR = tri_->getSubRegisters(Reg); *SR; ++SR) {
+          if (!li_->hasInterval(*SR))
+            continue;
+          const LiveRange *DLR =
+              li_->getInterval(*SR).getLiveRangeContaining(DefIdx);
+          if (DLR && DLR->valno->getCopy() == CopyMI)
+            DLR->valno->setCopy(0);
+        }
+      }
     }
   }
 
@@ -752,6 +765,7 @@ bool SimpleRegisterCoalescing::ReMaterializeTrivialDef(LiveInterval &SrcInt,
   CopyMI->eraseFromParent();
   ReMatCopies.insert(CopyMI);
   ReMatDefs.insert(DefMI);
+  DEBUG(dbgs() << "Remat: " << *NewMI);
   ++NumReMats;
   return true;
 }
@@ -1705,6 +1719,7 @@ bool SimpleRegisterCoalescing::JoinCopy(CopyRec &TheCopy, bool &Again) {
         (AdjustCopiesBackFrom(SrcInt, DstInt, CopyMI) ||
          RemoveCopyByCommutingDef(SrcInt, DstInt, CopyMI))) {
       JoinedCopies.insert(CopyMI);
+      DEBUG(dbgs() << "Trivial!\n");
       return true;
     }
 
@@ -1864,7 +1879,7 @@ static unsigned ComputeUltimateVN(VNInfo *VNI,
   // If the VN has already been computed, just return it.
   if (ThisValNoAssignments[VN] >= 0)
     return ThisValNoAssignments[VN];
-//  assert(ThisValNoAssignments[VN] != -2 && "Cyclic case?");
+  assert(ThisValNoAssignments[VN] != -2 && "Cyclic value numbers");
 
   // If this val is not a copy from the other val, then it must be a new value
   // number in the destination.
diff --git a/libclamav/c++/llvm/lib/CodeGen/SjLjEHPrepare.cpp b/libclamav/c++/llvm/lib/CodeGen/SjLjEHPrepare.cpp
index 8d4d1b2..059e8d6 100644
--- a/libclamav/c++/llvm/lib/CodeGen/SjLjEHPrepare.cpp
+++ b/libclamav/c++/llvm/lib/CodeGen/SjLjEHPrepare.cpp
@@ -44,7 +44,6 @@ namespace {
     const Type *FunctionContextTy;
     Constant *RegisterFn;
     Constant *UnregisterFn;
-    Constant *ResumeFn;
     Constant *BuiltinSetjmpFn;
     Constant *FrameAddrFn;
     Constant *LSDAAddrFn;
@@ -67,8 +66,8 @@ namespace {
     }
 
   private:
-    void markInvokeCallSite(InvokeInst *II, unsigned InvokeNo,
-                            Value *CallSite,
+    void insertCallSiteStore(Instruction *I, int Number, Value *CallSite);
+    void markInvokeCallSite(InvokeInst *II, int InvokeNo, Value *CallSite,
                             SwitchInst *CatchSwitch);
     void splitLiveRangesLiveAcrossInvokes(SmallVector<InvokeInst*,16> &Invokes);
     bool insertSjLjEHSupport(Function &F);
@@ -107,11 +106,6 @@ bool SjLjEHPass::doInitialization(Module &M) {
                           Type::getVoidTy(M.getContext()),
                           PointerType::getUnqual(FunctionContextTy),
                           (Type *)0);
-  ResumeFn =
-    M.getOrInsertFunction("_Unwind_SjLj_Resume",
-                          Type::getVoidTy(M.getContext()),
-                          VoidPtrTy,
-                          (Type *)0);
   FrameAddrFn = Intrinsic::getDeclaration(&M, Intrinsic::frameaddress);
   BuiltinSetjmpFn = Intrinsic::getDeclaration(&M, Intrinsic::eh_sjlj_setjmp);
   LSDAAddrFn = Intrinsic::getDeclaration(&M, Intrinsic::eh_sjlj_lsda);
@@ -123,12 +117,22 @@ bool SjLjEHPass::doInitialization(Module &M) {
   return true;
 }
 
+/// insertCallSiteStore - Insert a store of the call-site value to the
+/// function context
+void SjLjEHPass::insertCallSiteStore(Instruction *I, int Number,
+                                     Value *CallSite) {
+  ConstantInt *CallSiteNoC = ConstantInt::get(Type::getInt32Ty(I->getContext()),
+                                              Number);
+  // Insert a store of the call-site number
+  new StoreInst(CallSiteNoC, CallSite, true, I);  // volatile
+}
+
 /// markInvokeCallSite - Insert code to mark the call_site for this invoke
-void SjLjEHPass::markInvokeCallSite(InvokeInst *II, unsigned InvokeNo,
+void SjLjEHPass::markInvokeCallSite(InvokeInst *II, int InvokeNo,
                                     Value *CallSite,
                                     SwitchInst *CatchSwitch) {
   ConstantInt *CallSiteNoC= ConstantInt::get(Type::getInt32Ty(II->getContext()),
-                                            InvokeNo);
+                                              InvokeNo);
   // The runtime comes back to the dispatcher with the call_site - 1 in
   // the context. Odd, but there it is.
   ConstantInt *SwitchValC = ConstantInt::get(Type::getInt32Ty(II->getContext()),
@@ -145,8 +149,11 @@ void SjLjEHPass::markInvokeCallSite(InvokeInst *II, unsigned InvokeNo,
     }
   }
 
-  // Insert a store of the invoke num before the invoke
-  new StoreInst(CallSiteNoC, CallSite, true, II);  // volatile
+  // Insert the store of the call site value
+  insertCallSiteStore(II, InvokeNo, CallSite);
+
+  // Record the call site value for the back end so it stays associated with
+  // the invoke.
   CallInst::Create(CallSiteFn, CallSiteNoC, "", II);
 
   // Add a switch case to our unwind block.
@@ -272,8 +279,8 @@ bool SjLjEHPass::insertSjLjEHSupport(Function &F) {
   SmallVector<InvokeInst*,16> Invokes;
 
   // Look through the terminators of the basic blocks to find invokes, returns
-  // and unwinds
-  for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB)
+  // and unwinds.
+  for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB) {
     if (ReturnInst *RI = dyn_cast<ReturnInst>(BB->getTerminator())) {
       // Remember all return instructions in case we insert an invoke into this
       // function.
@@ -283,6 +290,7 @@ bool SjLjEHPass::insertSjLjEHSupport(Function &F) {
     } else if (UnwindInst *UI = dyn_cast<UnwindInst>(BB->getTerminator())) {
       Unwinds.push_back(UI);
     }
+  }
   // If we don't have any invokes or unwinds, there's nothing to do.
   if (Unwinds.empty() && Invokes.empty()) return false;
 
@@ -478,24 +486,21 @@ bool SjLjEHPass::insertSjLjEHSupport(Function &F) {
     for (unsigned i = 0, e = Invokes.size(); i != e; ++i)
       markInvokeCallSite(Invokes[i], i+1, CallSite, DispatchSwitch);
 
-    // The front end has likely added calls to _Unwind_Resume. We need
-    // to find those calls and mark the call_site as -1 immediately prior.
-    // resume is a noreturn function, so any block that has a call to it
-    // should end in an 'unreachable' instruction with the call immediately
-    // prior. That's how we'll search.
-    // ??? There's got to be a better way. this is fugly.
-    for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB)
-      if ((dyn_cast<UnreachableInst>(BB->getTerminator()))) {
-        BasicBlock::iterator I = BB->getTerminator();
-        // Check the previous instruction and see if it's a resume call
-        if (I == BB->begin()) continue;
-        if (CallInst *CI = dyn_cast<CallInst>(--I)) {
-          if (CI->getCalledFunction() == ResumeFn) {
-            Value *NegativeOne = Constant::getAllOnesValue(Int32Ty);
-            new StoreInst(NegativeOne, CallSite, true, I);  // volatile
-          }
+    // Mark call instructions that aren't nounwind as no-action
+    // (call_site == -1). Skip the entry block, as prior to then, no function
+    // context has been created for this function and any unexpected exceptions
+    // thrown will go directly to the caller's context, which is what we want
+    // anyway, so no need to do anything here.
+    for (Function::iterator BB = F.begin(), E = F.end(); ++BB != E;) {
+      for (BasicBlock::iterator I = BB->begin(), end = BB->end(); I != end; ++I)
+        if (CallInst *CI = dyn_cast<CallInst>(I)) {
+          // Ignore calls to the EH builtins (eh.selector, eh.exception)
+          Constant *Callee = CI->getCalledFunction();
+          if (Callee != SelectorFn && Callee != ExceptionFn
+              && !CI->doesNotThrow())
+            insertCallSiteStore(CI, -1, CallSite);
         }
-      }
+    }
 
     // Replace all unwinds with a branch to the unwind handler.
     // ??? Should this ever happen with sjlj exceptions?
diff --git a/libclamav/c++/llvm/lib/CodeGen/StackProtector.cpp b/libclamav/c++/llvm/lib/CodeGen/StackProtector.cpp
index 48bb5af..8a6a727 100644
--- a/libclamav/c++/llvm/lib/CodeGen/StackProtector.cpp
+++ b/libclamav/c++/llvm/lib/CodeGen/StackProtector.cpp
@@ -113,7 +113,7 @@ bool StackProtector::RequiresStackProtector() const {
 
         if (const ArrayType *AT = dyn_cast<ArrayType>(AI->getAllocatedType())) {
           // We apparently only care about character arrays.
-          if (!AT->getElementType()->isInteger(8))
+          if (!AT->getElementType()->isIntegerTy(8))
             continue;
 
           // If an array has more than SSPBufferSize bytes of allocated space,
diff --git a/libclamav/c++/llvm/lib/CodeGen/TargetInstrInfoImpl.cpp b/libclamav/c++/llvm/lib/CodeGen/TargetInstrInfoImpl.cpp
index a0fccab..e9e998f 100644
--- a/libclamav/c++/llvm/lib/CodeGen/TargetInstrInfoImpl.cpp
+++ b/libclamav/c++/llvm/lib/CodeGen/TargetInstrInfoImpl.cpp
@@ -150,6 +150,11 @@ void TargetInstrInfoImpl::reMaterialize(MachineBasicBlock &MBB,
   MBB.insert(I, MI);
 }
 
+bool TargetInstrInfoImpl::produceSameValue(const MachineInstr *MI0,
+                                           const MachineInstr *MI1) const {
+  return MI0->isIdenticalTo(MI1, MachineInstr::IgnoreVRegDefs);
+}
+
 MachineInstr *TargetInstrInfoImpl::duplicate(MachineInstr *Orig,
                                              MachineFunction &MF) const {
   assert(!Orig->getDesc().isNotDuplicable() &&
@@ -157,37 +162,6 @@ MachineInstr *TargetInstrInfoImpl::duplicate(MachineInstr *Orig,
   return MF.CloneMachineInstr(Orig);
 }
 
-bool
-TargetInstrInfoImpl::isIdentical(const MachineInstr *MI,
-                                 const MachineInstr *Other,
-                                 const MachineRegisterInfo *MRI) const {
-  if (MI->getOpcode() != Other->getOpcode() ||
-      MI->getNumOperands() != Other->getNumOperands())
-    return false;
-
-  for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
-    const MachineOperand &MO = MI->getOperand(i);
-    const MachineOperand &OMO = Other->getOperand(i);
-    if (MO.isReg() && MO.isDef()) {
-      assert(OMO.isReg() && OMO.isDef());
-      unsigned Reg = MO.getReg();
-      if (TargetRegisterInfo::isPhysicalRegister(Reg)) {
-        if (Reg != OMO.getReg())
-          return false;
-      } else if (MRI->getRegClass(MO.getReg()) !=
-                 MRI->getRegClass(OMO.getReg()))
-        return false;
-
-      continue;
-    }
-
-    if (!MO.isIdenticalTo(OMO))
-      return false;
-  }
-
-  return true;
-}
-
 unsigned
 TargetInstrInfoImpl::GetFunctionSizeInBytes(const MachineFunction &MF) const {
   unsigned FnSize = 0;
diff --git a/libclamav/c++/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/libclamav/c++/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
new file mode 100644
index 0000000..3b3be5d
--- /dev/null
+++ b/libclamav/c++/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
@@ -0,0 +1,902 @@
+//===-- llvm/CodeGen/TargetLoweringObjectFileImpl.cpp - Object File Info --===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file implements classes used to handle lowerings specific to common
+// object file formats.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/CodeGen/TargetLoweringObjectFileImpl.h"
+#include "llvm/Constants.h"
+#include "llvm/DerivedTypes.h"
+#include "llvm/Function.h"
+#include "llvm/GlobalVariable.h"
+#include "llvm/CodeGen/MachineModuleInfoImpls.h"
+#include "llvm/MC/MCContext.h"
+#include "llvm/MC/MCExpr.h"
+#include "llvm/MC/MCSectionMachO.h"
+#include "llvm/MC/MCSectionELF.h"
+#include "llvm/MC/MCSymbol.h"
+#include "llvm/Target/Mangler.h"
+#include "llvm/Target/TargetData.h"
+#include "llvm/Target/TargetMachine.h"
+#include "llvm/Target/TargetOptions.h"
+#include "llvm/Support/Dwarf.h"
+#include "llvm/Support/ErrorHandling.h"
+#include "llvm/Support/raw_ostream.h"
+#include "llvm/ADT/SmallString.h"
+#include "llvm/ADT/StringExtras.h"
+using namespace llvm;
+using namespace dwarf;
+
+//===----------------------------------------------------------------------===//
+//                                  ELF
+//===----------------------------------------------------------------------===//
+typedef StringMap<const MCSectionELF*> ELFUniqueMapTy;
+
+TargetLoweringObjectFileELF::~TargetLoweringObjectFileELF() {
+  // If we have the section uniquing map, free it.
+  delete (ELFUniqueMapTy*)UniquingMap;
+}
+
+const MCSection *TargetLoweringObjectFileELF::
+getELFSection(StringRef Section, unsigned Type, unsigned Flags,
+              SectionKind Kind, bool IsExplicit) const {
+  if (UniquingMap == 0)
+    UniquingMap = new ELFUniqueMapTy();
+  ELFUniqueMapTy &Map = *(ELFUniqueMapTy*)UniquingMap;
+
+  // Do the lookup, if we have a hit, return it.
+  const MCSectionELF *&Entry = Map[Section];
+  if (Entry) return Entry;
+
+  return Entry = MCSectionELF::Create(Section, Type, Flags, Kind, IsExplicit,
+                                      getContext());
+}
+
+void TargetLoweringObjectFileELF::Initialize(MCContext &Ctx,
+                                             const TargetMachine &TM) {
+  if (UniquingMap != 0)
+    ((ELFUniqueMapTy*)UniquingMap)->clear();
+  TargetLoweringObjectFile::Initialize(Ctx, TM);
+
+  BSSSection =
+    getELFSection(".bss", MCSectionELF::SHT_NOBITS,
+                  MCSectionELF::SHF_WRITE | MCSectionELF::SHF_ALLOC,
+                  SectionKind::getBSS());
+
+  TextSection =
+    getELFSection(".text", MCSectionELF::SHT_PROGBITS,
+                  MCSectionELF::SHF_EXECINSTR | MCSectionELF::SHF_ALLOC,
+                  SectionKind::getText());
+
+  DataSection =
+    getELFSection(".data", MCSectionELF::SHT_PROGBITS,
+                  MCSectionELF::SHF_WRITE | MCSectionELF::SHF_ALLOC,
+                  SectionKind::getDataRel());
+
+  ReadOnlySection =
+    getELFSection(".rodata", MCSectionELF::SHT_PROGBITS,
+                  MCSectionELF::SHF_ALLOC,
+                  SectionKind::getReadOnly());
+
+  TLSDataSection =
+    getELFSection(".tdata", MCSectionELF::SHT_PROGBITS,
+                  MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_TLS |
+                  MCSectionELF::SHF_WRITE, SectionKind::getThreadData());
+
+  TLSBSSSection =
+    getELFSection(".tbss", MCSectionELF::SHT_NOBITS,
+                  MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_TLS |
+                  MCSectionELF::SHF_WRITE, SectionKind::getThreadBSS());
+
+  DataRelSection =
+    getELFSection(".data.rel", MCSectionELF::SHT_PROGBITS,
+                  MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_WRITE,
+                  SectionKind::getDataRel());
+
+  DataRelLocalSection =
+    getELFSection(".data.rel.local", MCSectionELF::SHT_PROGBITS,
+                  MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_WRITE,
+                  SectionKind::getDataRelLocal());
+
+  DataRelROSection =
+    getELFSection(".data.rel.ro", MCSectionELF::SHT_PROGBITS,
+                  MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_WRITE,
+                  SectionKind::getReadOnlyWithRel());
+
+  DataRelROLocalSection =
+    getELFSection(".data.rel.ro.local", MCSectionELF::SHT_PROGBITS,
+                  MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_WRITE,
+                  SectionKind::getReadOnlyWithRelLocal());
+
+  MergeableConst4Section =
+    getELFSection(".rodata.cst4", MCSectionELF::SHT_PROGBITS,
+                  MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_MERGE,
+                  SectionKind::getMergeableConst4());
+
+  MergeableConst8Section =
+    getELFSection(".rodata.cst8", MCSectionELF::SHT_PROGBITS,
+                  MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_MERGE,
+                  SectionKind::getMergeableConst8());
+
+  MergeableConst16Section =
+    getELFSection(".rodata.cst16", MCSectionELF::SHT_PROGBITS,
+                  MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_MERGE,
+                  SectionKind::getMergeableConst16());
+
+  StaticCtorSection =
+    getELFSection(".ctors", MCSectionELF::SHT_PROGBITS,
+                  MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_WRITE,
+                  SectionKind::getDataRel());
+
+  StaticDtorSection =
+    getELFSection(".dtors", MCSectionELF::SHT_PROGBITS,
+                  MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_WRITE,
+                  SectionKind::getDataRel());
+
+  // Exception Handling Sections.
+
+  // FIXME: We're emitting LSDA info into a readonly section on ELF, even though
+  // it contains relocatable pointers.  In PIC mode, this is probably a big
+  // runtime hit for C++ apps.  Either the contents of the LSDA need to be
+  // adjusted or this should be a data section.
+  LSDASection =
+    getELFSection(".gcc_except_table", MCSectionELF::SHT_PROGBITS,
+                  MCSectionELF::SHF_ALLOC, SectionKind::getReadOnly());
+  EHFrameSection =
+    getELFSection(".eh_frame", MCSectionELF::SHT_PROGBITS,
+                  MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_WRITE,
+                  SectionKind::getDataRel());
+
+  // Debug Info Sections.
+  DwarfAbbrevSection =
+    getELFSection(".debug_abbrev", MCSectionELF::SHT_PROGBITS, 0,
+                  SectionKind::getMetadata());
+  DwarfInfoSection =
+    getELFSection(".debug_info", MCSectionELF::SHT_PROGBITS, 0,
+                  SectionKind::getMetadata());
+  DwarfLineSection =
+    getELFSection(".debug_line", MCSectionELF::SHT_PROGBITS, 0,
+                  SectionKind::getMetadata());
+  DwarfFrameSection =
+    getELFSection(".debug_frame", MCSectionELF::SHT_PROGBITS, 0,
+                  SectionKind::getMetadata());
+  DwarfPubNamesSection =
+    getELFSection(".debug_pubnames", MCSectionELF::SHT_PROGBITS, 0,
+                  SectionKind::getMetadata());
+  DwarfPubTypesSection =
+    getELFSection(".debug_pubtypes", MCSectionELF::SHT_PROGBITS, 0,
+                  SectionKind::getMetadata());
+  DwarfStrSection =
+    getELFSection(".debug_str", MCSectionELF::SHT_PROGBITS, 0,
+                  SectionKind::getMetadata());
+  DwarfLocSection =
+    getELFSection(".debug_loc", MCSectionELF::SHT_PROGBITS, 0,
+                  SectionKind::getMetadata());
+  DwarfARangesSection =
+    getELFSection(".debug_aranges", MCSectionELF::SHT_PROGBITS, 0,
+                  SectionKind::getMetadata());
+  DwarfRangesSection =
+    getELFSection(".debug_ranges", MCSectionELF::SHT_PROGBITS, 0,
+                  SectionKind::getMetadata());
+  DwarfMacroInfoSection =
+    getELFSection(".debug_macinfo", MCSectionELF::SHT_PROGBITS, 0,
+                  SectionKind::getMetadata());
+}
+
+
+static SectionKind
+getELFKindForNamedSection(StringRef Name, SectionKind K) {
+  if (Name.empty() || Name[0] != '.') return K;
+
+  // Some lame default implementation based on some magic section names.
+  if (Name == ".bss" ||
+      Name.startswith(".bss.") ||
+      Name.startswith(".gnu.linkonce.b.") ||
+      Name.startswith(".llvm.linkonce.b.") ||
+      Name == ".sbss" ||
+      Name.startswith(".sbss.") ||
+      Name.startswith(".gnu.linkonce.sb.") ||
+      Name.startswith(".llvm.linkonce.sb."))
+    return SectionKind::getBSS();
+
+  if (Name == ".tdata" ||
+      Name.startswith(".tdata.") ||
+      Name.startswith(".gnu.linkonce.td.") ||
+      Name.startswith(".llvm.linkonce.td."))
+    return SectionKind::getThreadData();
+
+  if (Name == ".tbss" ||
+      Name.startswith(".tbss.") ||
+      Name.startswith(".gnu.linkonce.tb.") ||
+      Name.startswith(".llvm.linkonce.tb."))
+    return SectionKind::getThreadBSS();
+
+  return K;
+}
+
+
+static unsigned getELFSectionType(StringRef Name, SectionKind K) {
+
+  if (Name == ".init_array")
+    return MCSectionELF::SHT_INIT_ARRAY;
+
+  if (Name == ".fini_array")
+    return MCSectionELF::SHT_FINI_ARRAY;
+
+  if (Name == ".preinit_array")
+    return MCSectionELF::SHT_PREINIT_ARRAY;
+
+  if (K.isBSS() || K.isThreadBSS())
+    return MCSectionELF::SHT_NOBITS;
+
+  return MCSectionELF::SHT_PROGBITS;
+}
+
+
+static unsigned
+getELFSectionFlags(SectionKind K) {
+  unsigned Flags = 0;
+
+  if (!K.isMetadata())
+    Flags |= MCSectionELF::SHF_ALLOC;
+
+  if (K.isText())
+    Flags |= MCSectionELF::SHF_EXECINSTR;
+
+  if (K.isWriteable())
+    Flags |= MCSectionELF::SHF_WRITE;
+
+  if (K.isThreadLocal())
+    Flags |= MCSectionELF::SHF_TLS;
+
+  // K.isMergeableConst() is left out to honour PR4650
+  if (K.isMergeableCString() || K.isMergeableConst4() ||
+      K.isMergeableConst8() || K.isMergeableConst16())
+    Flags |= MCSectionELF::SHF_MERGE;
+
+  if (K.isMergeableCString())
+    Flags |= MCSectionELF::SHF_STRINGS;
+
+  return Flags;
+}
+
+
+const MCSection *TargetLoweringObjectFileELF::
+getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind,
+                         Mangler *Mang, const TargetMachine &TM) const {
+  StringRef SectionName = GV->getSection();
+
+  // Infer section flags from the section name if we can.
+  Kind = getELFKindForNamedSection(SectionName, Kind);
+
+  return getELFSection(SectionName,
+                       getELFSectionType(SectionName, Kind),
+                       getELFSectionFlags(Kind), Kind, true);
+}
+
+static const char *getSectionPrefixForUniqueGlobal(SectionKind Kind) {
+  if (Kind.isText())                 return ".gnu.linkonce.t.";
+  if (Kind.isReadOnly())             return ".gnu.linkonce.r.";
+
+  if (Kind.isThreadData())           return ".gnu.linkonce.td.";
+  if (Kind.isThreadBSS())            return ".gnu.linkonce.tb.";
+
+  if (Kind.isDataNoRel())            return ".gnu.linkonce.d.";
+  if (Kind.isDataRelLocal())         return ".gnu.linkonce.d.rel.local.";
+  if (Kind.isDataRel())              return ".gnu.linkonce.d.rel.";
+  if (Kind.isReadOnlyWithRelLocal()) return ".gnu.linkonce.d.rel.ro.local.";
+
+  assert(Kind.isReadOnlyWithRel() && "Unknown section kind");
+  return ".gnu.linkonce.d.rel.ro.";
+}
+
+const MCSection *TargetLoweringObjectFileELF::
+SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
+                       Mangler *Mang, const TargetMachine &TM) const {
+
+  // If this global is linkonce/weak and the target handles this by emitting it
+  // into a 'uniqued' section name, create and return the section now.
+  if (GV->isWeakForLinker() && !Kind.isCommon() && !Kind.isBSS()) {
+    const char *Prefix = getSectionPrefixForUniqueGlobal(Kind);
+    SmallString<128> Name;
+    Name.append(Prefix, Prefix+strlen(Prefix));
+    Mang->getNameWithPrefix(Name, GV, false);
+    return getELFSection(Name.str(), getELFSectionType(Name.str(), Kind),
+                         getELFSectionFlags(Kind), Kind);
+  }
+
+  if (Kind.isText()) return TextSection;
+
+  if (Kind.isMergeable1ByteCString() ||
+      Kind.isMergeable2ByteCString() ||
+      Kind.isMergeable4ByteCString()) {
+
+    // We also need alignment here.
+    // FIXME: this is getting the alignment of the character, not the
+    // alignment of the global!
+    unsigned Align =
+      TM.getTargetData()->getPreferredAlignment(cast<GlobalVariable>(GV));
+
+    const char *SizeSpec = ".rodata.str1.";
+    if (Kind.isMergeable2ByteCString())
+      SizeSpec = ".rodata.str2.";
+    else if (Kind.isMergeable4ByteCString())
+      SizeSpec = ".rodata.str4.";
+    else
+      assert(Kind.isMergeable1ByteCString() && "unknown string width");
+
+
+    std::string Name = SizeSpec + utostr(Align);
+    return getELFSection(Name, MCSectionELF::SHT_PROGBITS,
+                         MCSectionELF::SHF_ALLOC |
+                         MCSectionELF::SHF_MERGE |
+                         MCSectionELF::SHF_STRINGS,
+                         Kind);
+  }
+
+  if (Kind.isMergeableConst()) {
+    if (Kind.isMergeableConst4() && MergeableConst4Section)
+      return MergeableConst4Section;
+    if (Kind.isMergeableConst8() && MergeableConst8Section)
+      return MergeableConst8Section;
+    if (Kind.isMergeableConst16() && MergeableConst16Section)
+      return MergeableConst16Section;
+    return ReadOnlySection;  // .const
+  }
+
+  if (Kind.isReadOnly())             return ReadOnlySection;
+
+  if (Kind.isThreadData())           return TLSDataSection;
+  if (Kind.isThreadBSS())            return TLSBSSSection;
+
+  // Note: we claim that common symbols are put in BSSSection, but they are
+  // really emitted with the magic .comm directive, which creates a symbol table
+  // entry but not a section.
+  if (Kind.isBSS() || Kind.isCommon()) return BSSSection;
+
+  if (Kind.isDataNoRel())            return DataSection;
+  if (Kind.isDataRelLocal())         return DataRelLocalSection;
+  if (Kind.isDataRel())              return DataRelSection;
+  if (Kind.isReadOnlyWithRelLocal()) return DataRelROLocalSection;
+
+  assert(Kind.isReadOnlyWithRel() && "Unknown section kind");
+  return DataRelROSection;
+}
+
+/// getSectionForConstant - Given a mergeable constant with the
+/// specified size and relocation information, return a section that it
+/// should be placed in.
+const MCSection *TargetLoweringObjectFileELF::
+getSectionForConstant(SectionKind Kind) const {
+  if (Kind.isMergeableConst4() && MergeableConst4Section)
+    return MergeableConst4Section;
+  if (Kind.isMergeableConst8() && MergeableConst8Section)
+    return MergeableConst8Section;
+  if (Kind.isMergeableConst16() && MergeableConst16Section)
+    return MergeableConst16Section;
+  if (Kind.isReadOnly())
+    return ReadOnlySection;
+
+  if (Kind.isReadOnlyWithRelLocal()) return DataRelROLocalSection;
+  assert(Kind.isReadOnlyWithRel() && "Unknown section kind");
+  return DataRelROSection;
+}
+
+const MCExpr *TargetLoweringObjectFileELF::
+getSymbolForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang,
+                             MachineModuleInfo *MMI, unsigned Encoding) const {
+
+  if (Encoding & dwarf::DW_EH_PE_indirect) {
+    MachineModuleInfoELF &ELFMMI = MMI->getObjFileInfo<MachineModuleInfoELF>();
+
+    SmallString<128> Name;
+    Mang->getNameWithPrefix(Name, GV, true);
+    Name += ".DW.stub";
+
+    // Add information about the stub reference to ELFMMI so that the stub
+    // gets emitted by the asmprinter.
+    MCSymbol *Sym = getContext().GetOrCreateSymbol(Name.str());
+    MCSymbol *&StubSym = ELFMMI.getGVStubEntry(Sym);
+    if (StubSym == 0) {
+      Name.clear();
+      Mang->getNameWithPrefix(Name, GV, false);
+      StubSym = getContext().GetOrCreateSymbol(Name.str());
+    }
+
+    return TargetLoweringObjectFile::
+      getSymbolForDwarfReference(Sym, MMI,
+                                 Encoding & ~dwarf::DW_EH_PE_indirect);
+  }
+
+  return TargetLoweringObjectFile::
+    getSymbolForDwarfGlobalReference(GV, Mang, MMI, Encoding);
+}
+
+//===----------------------------------------------------------------------===//
+//                                 MachO
+//===----------------------------------------------------------------------===//
+
+typedef StringMap<const MCSectionMachO*> MachOUniqueMapTy;
+
+TargetLoweringObjectFileMachO::~TargetLoweringObjectFileMachO() {
+  // If we have the MachO uniquing map, free it.
+  delete (MachOUniqueMapTy*)UniquingMap;
+}
+
+
+const MCSectionMachO *TargetLoweringObjectFileMachO::
+getMachOSection(StringRef Segment, StringRef Section,
+                unsigned TypeAndAttributes,
+                unsigned Reserved2, SectionKind Kind) const {
+  // We unique sections by their segment/section pair.  The returned section
+  // may not have the same flags as the requested section, if so this should be
+  // diagnosed by the client as an error.
+
+  // Create the map if it doesn't already exist.
+  if (UniquingMap == 0)
+    UniquingMap = new MachOUniqueMapTy();
+  MachOUniqueMapTy &Map = *(MachOUniqueMapTy*)UniquingMap;
+
+  // Form the name to look up.
+  SmallString<64> Name;
+  Name += Segment;
+  Name.push_back(',');
+  Name += Section;
+
+  // Do the lookup, if we have a hit, return it.
+  const MCSectionMachO *&Entry = Map[Name.str()];
+  if (Entry) return Entry;
+
+  // Otherwise, return a new section.
+  return Entry = MCSectionMachO::Create(Segment, Section, TypeAndAttributes,
+                                        Reserved2, Kind, getContext());
+}
+
+
+void TargetLoweringObjectFileMachO::Initialize(MCContext &Ctx,
+                                               const TargetMachine &TM) {
+  if (UniquingMap != 0)
+    ((MachOUniqueMapTy*)UniquingMap)->clear();
+  TargetLoweringObjectFile::Initialize(Ctx, TM);
+
+  TextSection // .text
+    = getMachOSection("__TEXT", "__text",
+                      MCSectionMachO::S_ATTR_PURE_INSTRUCTIONS,
+                      SectionKind::getText());
+  DataSection // .data
+    = getMachOSection("__DATA", "__data", 0, SectionKind::getDataRel());
+
+  CStringSection // .cstring
+    = getMachOSection("__TEXT", "__cstring", MCSectionMachO::S_CSTRING_LITERALS,
+                      SectionKind::getMergeable1ByteCString());
+  UStringSection
+    = getMachOSection("__TEXT","__ustring", 0,
+                      SectionKind::getMergeable2ByteCString());
+  FourByteConstantSection // .literal4
+    = getMachOSection("__TEXT", "__literal4", MCSectionMachO::S_4BYTE_LITERALS,
+                      SectionKind::getMergeableConst4());
+  EightByteConstantSection // .literal8
+    = getMachOSection("__TEXT", "__literal8", MCSectionMachO::S_8BYTE_LITERALS,
+                      SectionKind::getMergeableConst8());
+
+  // ld_classic doesn't support .literal16 in 32-bit mode, and ld64 falls back
+  // to using it in -static mode.
+  SixteenByteConstantSection = 0;
+  if (TM.getRelocationModel() != Reloc::Static &&
+      TM.getTargetData()->getPointerSize() == 32)
+    SixteenByteConstantSection =   // .literal16
+      getMachOSection("__TEXT", "__literal16",MCSectionMachO::S_16BYTE_LITERALS,
+                      SectionKind::getMergeableConst16());
+
+  ReadOnlySection  // .const
+    = getMachOSection("__TEXT", "__const", 0, SectionKind::getReadOnly());
+
+  TextCoalSection
+    = getMachOSection("__TEXT", "__textcoal_nt",
+                      MCSectionMachO::S_COALESCED |
+                      MCSectionMachO::S_ATTR_PURE_INSTRUCTIONS,
+                      SectionKind::getText());
+  ConstTextCoalSection
+    = getMachOSection("__TEXT", "__const_coal", MCSectionMachO::S_COALESCED,
+                      SectionKind::getText());
+  ConstDataCoalSection
+    = getMachOSection("__DATA","__const_coal", MCSectionMachO::S_COALESCED,
+                      SectionKind::getText());
+  ConstDataSection  // .const_data
+    = getMachOSection("__DATA", "__const", 0,
+                      SectionKind::getReadOnlyWithRel());
+  DataCoalSection
+    = getMachOSection("__DATA","__datacoal_nt", MCSectionMachO::S_COALESCED,
+                      SectionKind::getDataRel());
+  DataCommonSection
+    = getMachOSection("__DATA","__common", MCSectionMachO::S_ZEROFILL,
+                      SectionKind::getBSS());
+  DataBSSSection
+    = getMachOSection("__DATA","__bss", MCSectionMachO::S_ZEROFILL,
+                    SectionKind::getBSS());
+  
+
+  LazySymbolPointerSection
+    = getMachOSection("__DATA", "__la_symbol_ptr",
+                      MCSectionMachO::S_LAZY_SYMBOL_POINTERS,
+                      SectionKind::getMetadata());
+  NonLazySymbolPointerSection
+    = getMachOSection("__DATA", "__nl_symbol_ptr",
+                      MCSectionMachO::S_NON_LAZY_SYMBOL_POINTERS,
+                      SectionKind::getMetadata());
+
+  if (TM.getRelocationModel() == Reloc::Static) {
+    StaticCtorSection
+      = getMachOSection("__TEXT", "__constructor", 0,SectionKind::getDataRel());
+    StaticDtorSection
+      = getMachOSection("__TEXT", "__destructor", 0, SectionKind::getDataRel());
+  } else {
+    StaticCtorSection
+      = getMachOSection("__DATA", "__mod_init_func",
+                        MCSectionMachO::S_MOD_INIT_FUNC_POINTERS,
+                        SectionKind::getDataRel());
+    StaticDtorSection
+      = getMachOSection("__DATA", "__mod_term_func",
+                        MCSectionMachO::S_MOD_TERM_FUNC_POINTERS,
+                        SectionKind::getDataRel());
+  }
+
+  // Exception Handling.
+  LSDASection = getMachOSection("__DATA", "__gcc_except_tab", 0,
+                                SectionKind::getDataRel());
+  EHFrameSection =
+    getMachOSection("__TEXT", "__eh_frame",
+                    MCSectionMachO::S_COALESCED |
+                    MCSectionMachO::S_ATTR_NO_TOC |
+                    MCSectionMachO::S_ATTR_STRIP_STATIC_SYMS |
+                    MCSectionMachO::S_ATTR_LIVE_SUPPORT,
+                    SectionKind::getReadOnly());
+
+  // Debug Information.
+  DwarfAbbrevSection =
+    getMachOSection("__DWARF", "__debug_abbrev", MCSectionMachO::S_ATTR_DEBUG,
+                    SectionKind::getMetadata());
+  DwarfInfoSection =
+    getMachOSection("__DWARF", "__debug_info", MCSectionMachO::S_ATTR_DEBUG,
+                    SectionKind::getMetadata());
+  DwarfLineSection =
+    getMachOSection("__DWARF", "__debug_line", MCSectionMachO::S_ATTR_DEBUG,
+                    SectionKind::getMetadata());
+  DwarfFrameSection =
+    getMachOSection("__DWARF", "__debug_frame", MCSectionMachO::S_ATTR_DEBUG,
+                    SectionKind::getMetadata());
+  DwarfPubNamesSection =
+    getMachOSection("__DWARF", "__debug_pubnames", MCSectionMachO::S_ATTR_DEBUG,
+                    SectionKind::getMetadata());
+  DwarfPubTypesSection =
+    getMachOSection("__DWARF", "__debug_pubtypes", MCSectionMachO::S_ATTR_DEBUG,
+                    SectionKind::getMetadata());
+  DwarfStrSection =
+    getMachOSection("__DWARF", "__debug_str", MCSectionMachO::S_ATTR_DEBUG,
+                    SectionKind::getMetadata());
+  DwarfLocSection =
+    getMachOSection("__DWARF", "__debug_loc", MCSectionMachO::S_ATTR_DEBUG,
+                    SectionKind::getMetadata());
+  DwarfARangesSection =
+    getMachOSection("__DWARF", "__debug_aranges", MCSectionMachO::S_ATTR_DEBUG,
+                    SectionKind::getMetadata());
+  DwarfRangesSection =
+    getMachOSection("__DWARF", "__debug_ranges", MCSectionMachO::S_ATTR_DEBUG,
+                    SectionKind::getMetadata());
+  DwarfMacroInfoSection =
+    getMachOSection("__DWARF", "__debug_macinfo", MCSectionMachO::S_ATTR_DEBUG,
+                    SectionKind::getMetadata());
+  DwarfDebugInlineSection =
+    getMachOSection("__DWARF", "__debug_inlined", MCSectionMachO::S_ATTR_DEBUG,
+                    SectionKind::getMetadata());
+}
+
+const MCSection *TargetLoweringObjectFileMachO::
+getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind,
+                         Mangler *Mang, const TargetMachine &TM) const {
+  // Parse the section specifier and create it if valid.
+  StringRef Segment, Section;
+  unsigned TAA, StubSize;
+  std::string ErrorCode =
+    MCSectionMachO::ParseSectionSpecifier(GV->getSection(), Segment, Section,
+                                          TAA, StubSize);
+  if (!ErrorCode.empty()) {
+    // If invalid, report the error with llvm_report_error.
+    llvm_report_error("Global variable '" + GV->getNameStr() +
+                      "' has an invalid section specifier '" + GV->getSection()+
+                      "': " + ErrorCode + ".");
+    // Fall back to dropping it into the data section.
+    return DataSection;
+  }
+
+  // Get the section.
+  const MCSectionMachO *S =
+    getMachOSection(Segment, Section, TAA, StubSize, Kind);
+
+  // Okay, now that we got the section, verify that the TAA & StubSize agree.
+  // If the user declared multiple globals with different section flags, we need
+  // to reject it here.
+  if (S->getTypeAndAttributes() != TAA || S->getStubSize() != StubSize) {
+    // If invalid, report the error with llvm_report_error.
+    llvm_report_error("Global variable '" + GV->getNameStr() +
+                      "' section type or attributes does not match previous"
+                      " section specifier");
+  }
+
+  return S;
+}
+
+const MCSection *TargetLoweringObjectFileMachO::
+SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
+                       Mangler *Mang, const TargetMachine &TM) const {
+  assert(!Kind.isThreadLocal() && "Darwin doesn't support TLS");
+
+  if (Kind.isText())
+    return GV->isWeakForLinker() ? TextCoalSection : TextSection;
+
+  // If this is weak/linkonce, put this in a coalescable section, either in text
+  // or data depending on if it is writable.
+  if (GV->isWeakForLinker()) {
+    if (Kind.isReadOnly())
+      return ConstTextCoalSection;
+    return DataCoalSection;
+  }
+
+  // FIXME: Alignment check should be handled by section classifier.
+  if (Kind.isMergeable1ByteCString() ||
+      (Kind.isMergeable2ByteCString() && !GV->hasExternalLinkage())) {
+    if (TM.getTargetData()->getPreferredAlignment(
+                                              cast<GlobalVariable>(GV)) < 32) {
+      if (Kind.isMergeable1ByteCString())
+        return CStringSection;
+      assert(Kind.isMergeable2ByteCString());
+      return UStringSection;
+    }
+  }
+
+  if (Kind.isMergeableConst()) {
+    if (Kind.isMergeableConst4())
+      return FourByteConstantSection;
+    if (Kind.isMergeableConst8())
+      return EightByteConstantSection;
+    if (Kind.isMergeableConst16() && SixteenByteConstantSection)
+      return SixteenByteConstantSection;
+  }
+
+  // Otherwise, if it is readonly, but not something we can specially optimize,
+  // just drop it in .const.
+  if (Kind.isReadOnly())
+    return ReadOnlySection;
+
+  // If this is marked const, put it into a const section.  But if the dynamic
+  // linker needs to write to it, put it in the data segment.
+  if (Kind.isReadOnlyWithRel())
+    return ConstDataSection;
+
+  // Put zero initialized globals with strong external linkage in the
+  // DATA, __common section with the .zerofill directive.
+  if (Kind.isBSSExtern())
+    return DataCommonSection;
+
+  // Put zero initialized globals with local linkage in __DATA,__bss directive
+  // with the .zerofill directive (aka .lcomm).
+  if (Kind.isBSSLocal())
+    return DataBSSSection;
+  
+  // Otherwise, just drop the variable in the normal data section.
+  return DataSection;
+}
+
+const MCSection *
+TargetLoweringObjectFileMachO::getSectionForConstant(SectionKind Kind) const {
+  // If this constant requires a relocation, we have to put it in the data
+  // segment, not in the text segment.
+  if (Kind.isDataRel() || Kind.isReadOnlyWithRel())
+    return ConstDataSection;
+
+  if (Kind.isMergeableConst4())
+    return FourByteConstantSection;
+  if (Kind.isMergeableConst8())
+    return EightByteConstantSection;
+  if (Kind.isMergeableConst16() && SixteenByteConstantSection)
+    return SixteenByteConstantSection;
+  return ReadOnlySection;  // .const
+}
+
+/// shouldEmitUsedDirectiveFor - This hook allows targets to selectively decide
+/// not to emit the UsedDirective for some symbols in llvm.used.
+// FIXME: REMOVE this (rdar://7071300)
+bool TargetLoweringObjectFileMachO::
+shouldEmitUsedDirectiveFor(const GlobalValue *GV, Mangler *Mang) const {
+  /// On Darwin, internally linked data beginning with "L" or "l" does not have
+  /// the directive emitted (this occurs in ObjC metadata).
+  if (!GV) return false;
+
+  // Check whether the mangled name has the "Private" or "LinkerPrivate" prefix.
+  if (GV->hasLocalLinkage() && !isa<Function>(GV)) {
+    // FIXME: ObjC metadata is currently emitted as internal symbols that have
+    // \1L and \0l prefixes on them.  Fix them to be Private/LinkerPrivate and
+    // this horrible hack can go away.
+    SmallString<64> Name;
+    Mang->getNameWithPrefix(Name, GV, false);
+    if (Name[0] == 'L' || Name[0] == 'l')
+      return false;
+  }
+
+  return true;
+}
+
+const MCExpr *TargetLoweringObjectFileMachO::
+getSymbolForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang,
+                             MachineModuleInfo *MMI, unsigned Encoding) const {
+  // The mach-o version of this method defaults to returning a stub reference.
+
+  if (Encoding & DW_EH_PE_indirect) {
+    MachineModuleInfoMachO &MachOMMI =
+      MMI->getObjFileInfo<MachineModuleInfoMachO>();
+
+    SmallString<128> Name;
+    Mang->getNameWithPrefix(Name, GV, true);
+    Name += "$non_lazy_ptr";
+
+    // Add information about the stub reference to MachOMMI so that the stub
+    // gets emitted by the asmprinter.
+    MCSymbol *Sym = getContext().GetOrCreateSymbol(Name.str());
+    MCSymbol *&StubSym = MachOMMI.getGVStubEntry(Sym);
+    if (StubSym == 0) {
+      Name.clear();
+      Mang->getNameWithPrefix(Name, GV, false);
+      StubSym = getContext().GetOrCreateSymbol(Name.str());
+    }
+
+    return TargetLoweringObjectFile::
+      getSymbolForDwarfReference(Sym, MMI,
+                                 Encoding & ~dwarf::DW_EH_PE_indirect);
+  }
+
+  return TargetLoweringObjectFile::
+    getSymbolForDwarfGlobalReference(GV, Mang, MMI, Encoding);
+}
+
+unsigned TargetLoweringObjectFileMachO::getPersonalityEncoding() const {
+  return DW_EH_PE_indirect | DW_EH_PE_pcrel | DW_EH_PE_sdata4;
+}
+
+unsigned TargetLoweringObjectFileMachO::getLSDAEncoding() const {
+  return DW_EH_PE_pcrel;
+}
+
+unsigned TargetLoweringObjectFileMachO::getFDEEncoding() const {
+  return DW_EH_PE_pcrel;
+}
+
+unsigned TargetLoweringObjectFileMachO::getTTypeEncoding() const {
+  return DW_EH_PE_absptr;
+}
+
+//===----------------------------------------------------------------------===//
+//                                  COFF
+//===----------------------------------------------------------------------===//
+
+typedef StringMap<const MCSectionCOFF*> COFFUniqueMapTy;
+
+TargetLoweringObjectFileCOFF::~TargetLoweringObjectFileCOFF() {
+  delete (COFFUniqueMapTy*)UniquingMap;
+}
+
+
+const MCSection *TargetLoweringObjectFileCOFF::
+getCOFFSection(StringRef Name, bool isDirective, SectionKind Kind) const {
+  // Create the map if it doesn't already exist.
+  if (UniquingMap == 0)
+    UniquingMap = new MachOUniqueMapTy();
+  COFFUniqueMapTy &Map = *(COFFUniqueMapTy*)UniquingMap;
+
+  // Do the lookup, if we have a hit, return it.
+  const MCSectionCOFF *&Entry = Map[Name];
+  if (Entry) return Entry;
+
+  return Entry = MCSectionCOFF::Create(Name, isDirective, Kind, getContext());
+}
+
+void TargetLoweringObjectFileCOFF::Initialize(MCContext &Ctx,
+                                              const TargetMachine &TM) {
+  if (UniquingMap != 0)
+    ((COFFUniqueMapTy*)UniquingMap)->clear();
+  TargetLoweringObjectFile::Initialize(Ctx, TM);
+  TextSection = getCOFFSection("\t.text", true, SectionKind::getText());
+  DataSection = getCOFFSection("\t.data", true, SectionKind::getDataRel());
+  StaticCtorSection =
+    getCOFFSection(".ctors", false, SectionKind::getDataRel());
+  StaticDtorSection =
+    getCOFFSection(".dtors", false, SectionKind::getDataRel());
+
+  // FIXME: We're emitting LSDA info into a readonly section on COFF, even
+  // though it contains relocatable pointers.  In PIC mode, this is probably a
+  // big runtime hit for C++ apps.  Either the contents of the LSDA need to be
+  // adjusted or this should be a data section.
+  LSDASection =
+    getCOFFSection(".gcc_except_table", false, SectionKind::getReadOnly());
+  EHFrameSection =
+    getCOFFSection(".eh_frame", false, SectionKind::getDataRel());
+
+  // Debug info.
+  // FIXME: Don't use 'directive' mode here.
+  DwarfAbbrevSection =
+    getCOFFSection("\t.section\t.debug_abbrev,\"dr\"",
+                   true, SectionKind::getMetadata());
+  DwarfInfoSection =
+    getCOFFSection("\t.section\t.debug_info,\"dr\"",
+                   true, SectionKind::getMetadata());
+  DwarfLineSection =
+    getCOFFSection("\t.section\t.debug_line,\"dr\"",
+                   true, SectionKind::getMetadata());
+  DwarfFrameSection =
+    getCOFFSection("\t.section\t.debug_frame,\"dr\"",
+                   true, SectionKind::getMetadata());
+  DwarfPubNamesSection =
+    getCOFFSection("\t.section\t.debug_pubnames,\"dr\"",
+                   true, SectionKind::getMetadata());
+  DwarfPubTypesSection =
+    getCOFFSection("\t.section\t.debug_pubtypes,\"dr\"",
+                   true, SectionKind::getMetadata());
+  DwarfStrSection =
+    getCOFFSection("\t.section\t.debug_str,\"dr\"",
+                   true, SectionKind::getMetadata());
+  DwarfLocSection =
+    getCOFFSection("\t.section\t.debug_loc,\"dr\"",
+                   true, SectionKind::getMetadata());
+  DwarfARangesSection =
+    getCOFFSection("\t.section\t.debug_aranges,\"dr\"",
+                   true, SectionKind::getMetadata());
+  DwarfRangesSection =
+    getCOFFSection("\t.section\t.debug_ranges,\"dr\"",
+                   true, SectionKind::getMetadata());
+  DwarfMacroInfoSection =
+    getCOFFSection("\t.section\t.debug_macinfo,\"dr\"",
+                   true, SectionKind::getMetadata());
+}
+
+const MCSection *TargetLoweringObjectFileCOFF::
+getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind,
+                         Mangler *Mang, const TargetMachine &TM) const {
+  return getCOFFSection(GV->getSection(), false, Kind);
+}
+
+static const char *getCOFFSectionPrefixForUniqueGlobal(SectionKind Kind) {
+  if (Kind.isText())
+    return ".text$linkonce";
+  if (Kind.isWriteable())
+    return ".data$linkonce";
+  return ".rdata$linkonce";
+}
+
+
+const MCSection *TargetLoweringObjectFileCOFF::
+SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
+                       Mangler *Mang, const TargetMachine &TM) const {
+  assert(!Kind.isThreadLocal() && "Doesn't support TLS");
+
+  // If this global is linkonce/weak and the target handles this by emitting it
+  // into a 'uniqued' section name, create and return the section now.
+  if (GV->isWeakForLinker()) {
+    const char *Prefix = getCOFFSectionPrefixForUniqueGlobal(Kind);
+    SmallString<128> Name(Prefix, Prefix+strlen(Prefix));
+    Mang->getNameWithPrefix(Name, GV, false);
+    return getCOFFSection(Name.str(), false, Kind);
+  }
+
+  if (Kind.isText())
+    return getTextSection();
+
+  return getDataSection();
+}
+
diff --git a/libclamav/c++/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp b/libclamav/c++/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
index 6f4ca82..c840b39 100644
--- a/libclamav/c++/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
+++ b/libclamav/c++/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
@@ -160,7 +160,7 @@ bool TwoAddressInstructionPass::Sink3AddrInstruction(MachineBasicBlock *MBB,
                                            MachineBasicBlock::iterator OldPos) {
   // Check if it's safe to move this instruction.
   bool SeenStore = true; // Be conservative.
-  if (!MI->isSafeToMove(TII, SeenStore, AA))
+  if (!MI->isSafeToMove(TII, AA, SeenStore))
     return false;
 
   unsigned DefReg = 0;
@@ -454,13 +454,10 @@ MachineInstr *findOnlyInterestingUse(unsigned Reg, MachineBasicBlock *MBB,
                                      const TargetInstrInfo *TII,
                                      bool &IsCopy,
                                      unsigned &DstReg, bool &IsDstPhys) {
-  MachineRegisterInfo::use_nodbg_iterator UI = MRI->use_nodbg_begin(Reg);
-  if (UI == MRI->use_nodbg_end())
-    return 0;
-  MachineInstr &UseMI = *UI;
-  if (++UI != MRI->use_nodbg_end())
-    // More than one use.
+  if (!MRI->hasOneNonDBGUse(Reg))
+    // None or more than one use.
     return 0;
+  MachineInstr &UseMI = *MRI->use_nodbg_begin(Reg);
   if (UseMI.getParent() != MBB)
     return 0;
   unsigned SrcReg;
@@ -1028,7 +1025,7 @@ bool TwoAddressInstructionPass::runOnMachineFunction(MachineFunction &MF) {
           // copying it.
           if (DefMI &&
               DefMI->getDesc().isAsCheapAsAMove() &&
-              DefMI->isSafeToReMat(TII, regB, AA) &&
+              DefMI->isSafeToReMat(TII, AA, regB) &&
               isProfitableToReMat(regB, rc, mi, DefMI, mbbi, Dist)){
             DEBUG(dbgs() << "2addr: REMATTING : " << *DefMI << "\n");
             unsigned regASubIdx = mi->getOperand(DstIdx).getSubReg();
diff --git a/libclamav/c++/llvm/lib/CodeGen/VirtRegMap.cpp b/libclamav/c++/llvm/lib/CodeGen/VirtRegMap.cpp
index 5956b61..ed02696 100644
--- a/libclamav/c++/llvm/lib/CodeGen/VirtRegMap.cpp
+++ b/libclamav/c++/llvm/lib/CodeGen/VirtRegMap.cpp
@@ -261,19 +261,21 @@ bool VirtRegMap::FindUnusedRegisters(LiveIntervals* LIs) {
 
 void VirtRegMap::print(raw_ostream &OS, const Module* M) const {
   const TargetRegisterInfo* TRI = MF->getTarget().getRegisterInfo();
+  const MachineRegisterInfo &MRI = MF->getRegInfo();
 
   OS << "********** REGISTER MAP **********\n";
   for (unsigned i = TargetRegisterInfo::FirstVirtualRegister,
          e = MF->getRegInfo().getLastVirtReg(); i <= e; ++i) {
     if (Virt2PhysMap[i] != (unsigned)VirtRegMap::NO_PHYS_REG)
       OS << "[reg" << i << " -> " << TRI->getName(Virt2PhysMap[i])
-         << "]\n";
+         << "] " << MRI.getRegClass(i)->getName() << "\n";
   }
 
   for (unsigned i = TargetRegisterInfo::FirstVirtualRegister,
          e = MF->getRegInfo().getLastVirtReg(); i <= e; ++i)
     if (Virt2StackSlotMap[i] != VirtRegMap::NO_STACK_SLOT)
-      OS << "[reg" << i << " -> fi#" << Virt2StackSlotMap[i] << "]\n";
+      OS << "[reg" << i << " -> fi#" << Virt2StackSlotMap[i]
+         << "] " << MRI.getRegClass(i)->getName() << "\n";
   OS << '\n';
 }
 
diff --git a/libclamav/c++/llvm/lib/CodeGen/VirtRegRewriter.cpp b/libclamav/c++/llvm/lib/CodeGen/VirtRegRewriter.cpp
index 84e0398..7aa0a91 100644
--- a/libclamav/c++/llvm/lib/CodeGen/VirtRegRewriter.cpp
+++ b/libclamav/c++/llvm/lib/CodeGen/VirtRegRewriter.cpp
@@ -46,7 +46,7 @@ namespace {
 
 static cl::opt<RewriterName>
 RewriterOpt("rewriter",
-            cl::desc("Rewriter to use: (default: local)"),
+            cl::desc("Rewriter to use (default=local)"),
             cl::Prefix,
             cl::values(clEnumVal(local,   "local rewriter"),
                        clEnumVal(trivial, "trivial rewriter"),
diff --git a/libclamav/c++/llvm/lib/ExecutionEngine/ExecutionEngine.cpp b/libclamav/c++/llvm/lib/ExecutionEngine/ExecutionEngine.cpp
index a31ce38..b303510 100644
--- a/libclamav/c++/llvm/lib/ExecutionEngine/ExecutionEngine.cpp
+++ b/libclamav/c++/llvm/lib/ExecutionEngine/ExecutionEngine.cpp
@@ -339,12 +339,12 @@ int ExecutionEngine::runFunctionAsMain(Function *Fn,
    }
    // FALLS THROUGH
   case 1:
-   if (!FTy->getParamType(0)->isInteger(32)) {
+   if (!FTy->getParamType(0)->isIntegerTy(32)) {
      llvm_report_error("Invalid type for first argument of main() supplied");
    }
    // FALLS THROUGH
   case 0:
-   if (!isa<IntegerType>(FTy->getReturnType()) &&
+   if (!FTy->getReturnType()->isIntegerTy() &&
        !FTy->getReturnType()->isVoidTy()) {
      llvm_report_error("Invalid return type of main() supplied");
    }
@@ -600,22 +600,22 @@ GenericValue ExecutionEngine::getConstantValue(const Constant *C) {
       switch (Op0->getType()->getTypeID()) {
         default: llvm_unreachable("Invalid bitcast operand");
         case Type::IntegerTyID:
-          assert(DestTy->isFloatingPoint() && "invalid bitcast");
+          assert(DestTy->isFloatingPointTy() && "invalid bitcast");
           if (DestTy->isFloatTy())
             GV.FloatVal = GV.IntVal.bitsToFloat();
           else if (DestTy->isDoubleTy())
             GV.DoubleVal = GV.IntVal.bitsToDouble();
           break;
         case Type::FloatTyID: 
-          assert(DestTy->isInteger(32) && "Invalid bitcast");
+          assert(DestTy->isIntegerTy(32) && "Invalid bitcast");
           GV.IntVal.floatToBits(GV.FloatVal);
           break;
         case Type::DoubleTyID:
-          assert(DestTy->isInteger(64) && "Invalid bitcast");
+          assert(DestTy->isIntegerTy(64) && "Invalid bitcast");
           GV.IntVal.doubleToBits(GV.DoubleVal);
           break;
         case Type::PointerTyID:
-          assert(isa<PointerType>(DestTy) && "Invalid bitcast");
+          assert(DestTy->isPointerTy() && "Invalid bitcast");
           break; // getConstantValue(Op0)  above already converted it
       }
       return GV;
diff --git a/libclamav/c++/llvm/lib/ExecutionEngine/ExecutionEngineBindings.cpp b/libclamav/c++/llvm/lib/ExecutionEngine/ExecutionEngineBindings.cpp
index 141cb27..c7495d4 100644
--- a/libclamav/c++/llvm/lib/ExecutionEngine/ExecutionEngineBindings.cpp
+++ b/libclamav/c++/llvm/lib/ExecutionEngine/ExecutionEngineBindings.cpp
@@ -87,11 +87,11 @@ void LLVMDisposeGenericValue(LLVMGenericValueRef GenVal) {
 
 /*===-- Operations on execution engines -----------------------------------===*/
 
-LLVMBool LLVMCreateExecutionEngine(LLVMExecutionEngineRef *OutEE,
-                                   LLVMModuleProviderRef MP,
-                                   char **OutError) {
+LLVMBool LLVMCreateExecutionEngineForModule(LLVMExecutionEngineRef *OutEE,
+                                            LLVMModuleRef M,
+                                            char **OutError) {
   std::string Error;
-  EngineBuilder builder(unwrap(MP));
+  EngineBuilder builder(unwrap(M));
   builder.setEngineKind(EngineKind::Either)
          .setErrorStr(&Error);
   if (ExecutionEngine *EE = builder.create()){
@@ -102,11 +102,11 @@ LLVMBool LLVMCreateExecutionEngine(LLVMExecutionEngineRef *OutEE,
   return 1;
 }
 
-LLVMBool LLVMCreateInterpreter(LLVMExecutionEngineRef *OutInterp,
-                               LLVMModuleProviderRef MP,
-                               char **OutError) {
+LLVMBool LLVMCreateInterpreterForModule(LLVMExecutionEngineRef *OutInterp,
+                                        LLVMModuleRef M,
+                                        char **OutError) {
   std::string Error;
-  EngineBuilder builder(unwrap(MP));
+  EngineBuilder builder(unwrap(M));
   builder.setEngineKind(EngineKind::Interpreter)
          .setErrorStr(&Error);
   if (ExecutionEngine *Interp = builder.create()) {
@@ -117,12 +117,12 @@ LLVMBool LLVMCreateInterpreter(LLVMExecutionEngineRef *OutInterp,
   return 1;
 }
 
-LLVMBool LLVMCreateJITCompiler(LLVMExecutionEngineRef *OutJIT,
-                               LLVMModuleProviderRef MP,
-                               unsigned OptLevel,
-                               char **OutError) {
+LLVMBool LLVMCreateJITCompilerForModule(LLVMExecutionEngineRef *OutJIT,
+                                        LLVMModuleRef M,
+                                        unsigned OptLevel,
+                                        char **OutError) {
   std::string Error;
-  EngineBuilder builder(unwrap(MP));
+  EngineBuilder builder(unwrap(M));
   builder.setEngineKind(EngineKind::JIT)
          .setErrorStr(&Error)
          .setOptLevel((CodeGenOpt::Level)OptLevel);
@@ -134,6 +134,35 @@ LLVMBool LLVMCreateJITCompiler(LLVMExecutionEngineRef *OutJIT,
   return 1;
 }
 
+LLVMBool LLVMCreateExecutionEngine(LLVMExecutionEngineRef *OutEE,
+                                   LLVMModuleProviderRef MP,
+                                   char **OutError) {
+  /* The module provider is now actually a module. */
+  return LLVMCreateExecutionEngineForModule(OutEE,
+                                            reinterpret_cast<LLVMModuleRef>(MP),
+                                            OutError);
+}
+
+LLVMBool LLVMCreateInterpreter(LLVMExecutionEngineRef *OutInterp,
+                               LLVMModuleProviderRef MP,
+                               char **OutError) {
+  /* The module provider is now actually a module. */
+  return LLVMCreateInterpreterForModule(OutInterp,
+                                        reinterpret_cast<LLVMModuleRef>(MP),
+                                        OutError);
+}
+
+LLVMBool LLVMCreateJITCompiler(LLVMExecutionEngineRef *OutJIT,
+                               LLVMModuleProviderRef MP,
+                               unsigned OptLevel,
+                               char **OutError) {
+  /* The module provider is now actually a module. */
+  return LLVMCreateJITCompilerForModule(OutJIT,
+                                        reinterpret_cast<LLVMModuleRef>(MP),
+                                        OptLevel, OutError);
+}
+
+
 void LLVMDisposeExecutionEngine(LLVMExecutionEngineRef EE) {
   delete unwrap(EE);
 }
@@ -173,17 +202,29 @@ void LLVMFreeMachineCodeForFunction(LLVMExecutionEngineRef EE, LLVMValueRef F) {
   unwrap(EE)->freeMachineCodeForFunction(unwrap<Function>(F));
 }
 
+void LLVMAddModule(LLVMExecutionEngineRef EE, LLVMModuleRef M){
+  unwrap(EE)->addModule(unwrap(M));
+}
+
 void LLVMAddModuleProvider(LLVMExecutionEngineRef EE, LLVMModuleProviderRef MP){
-  unwrap(EE)->addModule(unwrap(MP));
+  /* The module provider is now actually a module. */
+  LLVMAddModule(EE, reinterpret_cast<LLVMModuleRef>(MP));
+}
+
+LLVMBool LLVMRemoveModule(LLVMExecutionEngineRef EE, LLVMModuleRef M,
+                          LLVMModuleRef *OutMod, char **OutError) {
+  Module *Mod = unwrap(M);
+  unwrap(EE)->removeModule(Mod);
+  *OutMod = wrap(Mod);
+  return 0;
 }
 
 LLVMBool LLVMRemoveModuleProvider(LLVMExecutionEngineRef EE,
                                   LLVMModuleProviderRef MP,
                                   LLVMModuleRef *OutMod, char **OutError) {
-  Module *M = unwrap(MP);
-  unwrap(EE)->removeModule(M);
-  *OutMod = wrap(M);
-  return 0;
+  /* The module provider is now actually a module. */
+  return LLVMRemoveModule(EE, reinterpret_cast<LLVMModuleRef>(MP), OutMod,
+                          OutError);
 }
 
 LLVMBool LLVMFindFunction(LLVMExecutionEngineRef EE, const char *Name,
diff --git a/libclamav/c++/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp b/libclamav/c++/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp
index 73f5558..a2aad5a 100644
--- a/libclamav/c++/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp
+++ b/libclamav/c++/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp
@@ -591,7 +591,7 @@ void Interpreter::popStackAndReturnValueToCaller(const Type *RetTy,
   ECStack.pop_back();
 
   if (ECStack.empty()) {  // Finished main.  Put result into exit code...
-    if (RetTy && RetTy->isInteger()) {          // Nonvoid return type?
+    if (RetTy && RetTy->isIntegerTy()) {          // Nonvoid return type?
       ExitValue = Result;   // Capture the exit value of the program
     } else {
       memset(&ExitValue.Untyped, 0, sizeof(ExitValue.Untyped));
@@ -761,7 +761,7 @@ void Interpreter::visitAllocaInst(AllocaInst &I) {
 GenericValue Interpreter::executeGEPOperation(Value *Ptr, gep_type_iterator I,
                                               gep_type_iterator E,
                                               ExecutionContext &SF) {
-  assert(isa<PointerType>(Ptr->getType()) &&
+  assert(Ptr->getType()->isPointerTy() &&
          "Cannot getElementOffset of a nonpointer type!");
 
   uint64_t Total = 0;
@@ -979,7 +979,7 @@ GenericValue Interpreter::executeFPToUIInst(Value *SrcVal, const Type *DstTy,
   const Type *SrcTy = SrcVal->getType();
   uint32_t DBitWidth = cast<IntegerType>(DstTy)->getBitWidth();
   GenericValue Dest, Src = getOperandValue(SrcVal, SF);
-  assert(SrcTy->isFloatingPoint() && "Invalid FPToUI instruction");
+  assert(SrcTy->isFloatingPointTy() && "Invalid FPToUI instruction");
 
   if (SrcTy->getTypeID() == Type::FloatTyID)
     Dest.IntVal = APIntOps::RoundFloatToAPInt(Src.FloatVal, DBitWidth);
@@ -993,7 +993,7 @@ GenericValue Interpreter::executeFPToSIInst(Value *SrcVal, const Type *DstTy,
   const Type *SrcTy = SrcVal->getType();
   uint32_t DBitWidth = cast<IntegerType>(DstTy)->getBitWidth();
   GenericValue Dest, Src = getOperandValue(SrcVal, SF);
-  assert(SrcTy->isFloatingPoint() && "Invalid FPToSI instruction");
+  assert(SrcTy->isFloatingPointTy() && "Invalid FPToSI instruction");
 
   if (SrcTy->getTypeID() == Type::FloatTyID)
     Dest.IntVal = APIntOps::RoundFloatToAPInt(Src.FloatVal, DBitWidth);
@@ -1005,7 +1005,7 @@ GenericValue Interpreter::executeFPToSIInst(Value *SrcVal, const Type *DstTy,
 GenericValue Interpreter::executeUIToFPInst(Value *SrcVal, const Type *DstTy,
                                             ExecutionContext &SF) {
   GenericValue Dest, Src = getOperandValue(SrcVal, SF);
-  assert(DstTy->isFloatingPoint() && "Invalid UIToFP instruction");
+  assert(DstTy->isFloatingPointTy() && "Invalid UIToFP instruction");
 
   if (DstTy->getTypeID() == Type::FloatTyID)
     Dest.FloatVal = APIntOps::RoundAPIntToFloat(Src.IntVal);
@@ -1017,7 +1017,7 @@ GenericValue Interpreter::executeUIToFPInst(Value *SrcVal, const Type *DstTy,
 GenericValue Interpreter::executeSIToFPInst(Value *SrcVal, const Type *DstTy,
                                             ExecutionContext &SF) {
   GenericValue Dest, Src = getOperandValue(SrcVal, SF);
-  assert(DstTy->isFloatingPoint() && "Invalid SIToFP instruction");
+  assert(DstTy->isFloatingPointTy() && "Invalid SIToFP instruction");
 
   if (DstTy->getTypeID() == Type::FloatTyID)
     Dest.FloatVal = APIntOps::RoundSignedAPIntToFloat(Src.IntVal);
@@ -1031,7 +1031,7 @@ GenericValue Interpreter::executePtrToIntInst(Value *SrcVal, const Type *DstTy,
                                               ExecutionContext &SF) {
   uint32_t DBitWidth = cast<IntegerType>(DstTy)->getBitWidth();
   GenericValue Dest, Src = getOperandValue(SrcVal, SF);
-  assert(isa<PointerType>(SrcVal->getType()) && "Invalid PtrToInt instruction");
+  assert(SrcVal->getType()->isPointerTy() && "Invalid PtrToInt instruction");
 
   Dest.IntVal = APInt(DBitWidth, (intptr_t) Src.PointerVal);
   return Dest;
@@ -1040,7 +1040,7 @@ GenericValue Interpreter::executePtrToIntInst(Value *SrcVal, const Type *DstTy,
 GenericValue Interpreter::executeIntToPtrInst(Value *SrcVal, const Type *DstTy,
                                               ExecutionContext &SF) {
   GenericValue Dest, Src = getOperandValue(SrcVal, SF);
-  assert(isa<PointerType>(DstTy) && "Invalid PtrToInt instruction");
+  assert(DstTy->isPointerTy() && "Invalid PtrToInt instruction");
 
   uint32_t PtrSize = TD.getPointerSizeInBits();
   if (PtrSize != Src.IntVal.getBitWidth())
@@ -1055,27 +1055,27 @@ GenericValue Interpreter::executeBitCastInst(Value *SrcVal, const Type *DstTy,
   
   const Type *SrcTy = SrcVal->getType();
   GenericValue Dest, Src = getOperandValue(SrcVal, SF);
-  if (isa<PointerType>(DstTy)) {
-    assert(isa<PointerType>(SrcTy) && "Invalid BitCast");
+  if (DstTy->isPointerTy()) {
+    assert(SrcTy->isPointerTy() && "Invalid BitCast");
     Dest.PointerVal = Src.PointerVal;
-  } else if (DstTy->isInteger()) {
+  } else if (DstTy->isIntegerTy()) {
     if (SrcTy->isFloatTy()) {
       Dest.IntVal.zext(sizeof(Src.FloatVal) * CHAR_BIT);
       Dest.IntVal.floatToBits(Src.FloatVal);
     } else if (SrcTy->isDoubleTy()) {
       Dest.IntVal.zext(sizeof(Src.DoubleVal) * CHAR_BIT);
       Dest.IntVal.doubleToBits(Src.DoubleVal);
-    } else if (SrcTy->isInteger()) {
+    } else if (SrcTy->isIntegerTy()) {
       Dest.IntVal = Src.IntVal;
     } else 
       llvm_unreachable("Invalid BitCast");
   } else if (DstTy->isFloatTy()) {
-    if (SrcTy->isInteger())
+    if (SrcTy->isIntegerTy())
       Dest.FloatVal = Src.IntVal.bitsToFloat();
     else
       Dest.FloatVal = Src.FloatVal;
   } else if (DstTy->isDoubleTy()) {
-    if (SrcTy->isInteger())
+    if (SrcTy->isIntegerTy())
       Dest.DoubleVal = Src.IntVal.bitsToDouble();
     else
       Dest.DoubleVal = Src.DoubleVal;
diff --git a/libclamav/c++/llvm/lib/ExecutionEngine/JIT/JIT.cpp b/libclamav/c++/llvm/lib/ExecutionEngine/JIT/JIT.cpp
index 236c219..b6c3367 100644
--- a/libclamav/c++/llvm/lib/ExecutionEngine/JIT/JIT.cpp
+++ b/libclamav/c++/llvm/lib/ExecutionEngine/JIT/JIT.cpp
@@ -412,12 +412,12 @@ GenericValue JIT::runFunction(Function *F,
 
   // Handle some common cases first.  These cases correspond to common `main'
   // prototypes.
-  if (RetTy->isInteger(32) || RetTy->isVoidTy()) {
+  if (RetTy->isIntegerTy(32) || RetTy->isVoidTy()) {
     switch (ArgValues.size()) {
     case 3:
-      if (FTy->getParamType(0)->isInteger(32) &&
-          isa<PointerType>(FTy->getParamType(1)) &&
-          isa<PointerType>(FTy->getParamType(2))) {
+      if (FTy->getParamType(0)->isIntegerTy(32) &&
+          FTy->getParamType(1)->isPointerTy() &&
+          FTy->getParamType(2)->isPointerTy()) {
         int (*PF)(int, char **, const char **) =
           (int(*)(int, char **, const char **))(intptr_t)FPtr;
 
@@ -430,8 +430,8 @@ GenericValue JIT::runFunction(Function *F,
       }
       break;
     case 2:
-      if (FTy->getParamType(0)->isInteger(32) &&
-          isa<PointerType>(FTy->getParamType(1))) {
+      if (FTy->getParamType(0)->isIntegerTy(32) &&
+          FTy->getParamType(1)->isPointerTy()) {
         int (*PF)(int, char **) = (int(*)(int, char **))(intptr_t)FPtr;
 
         // Call the function.
@@ -443,7 +443,7 @@ GenericValue JIT::runFunction(Function *F,
       break;
     case 1:
       if (FTy->getNumParams() == 1 &&
-          FTy->getParamType(0)->isInteger(32)) {
+          FTy->getParamType(0)->isIntegerTy(32)) {
         GenericValue rv;
         int (*PF)(int) = (int(*)(int))(intptr_t)FPtr;
         rv.IntVal = APInt(32, PF(ArgValues[0].IntVal.getZExtValue()));
diff --git a/libclamav/c++/llvm/lib/ExecutionEngine/JIT/JITDwarfEmitter.cpp b/libclamav/c++/llvm/lib/ExecutionEngine/JIT/JITDwarfEmitter.cpp
index c1051a9..946351b 100644
--- a/libclamav/c++/llvm/lib/ExecutionEngine/JIT/JITDwarfEmitter.cpp
+++ b/libclamav/c++/llvm/lib/ExecutionEngine/JIT/JITDwarfEmitter.cpp
@@ -522,7 +522,11 @@ JITDwarfEmitter::EmitCommonEHFrame(const Function* Personality) const {
       JCE->emitInt64(((intptr_t)Jit.getPointerToGlobal(Personality)));
     }
 
-    JCE->emitULEB128Bytes(dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4);
+    // LSDA encoding: This must match the encoding used in EmitEHFrame ()
+    if (PointerSize == 4)
+      JCE->emitULEB128Bytes(dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4);
+    else
+      JCE->emitULEB128Bytes(dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata8);
     JCE->emitULEB128Bytes(dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4);
   } else {
     JCE->emitULEB128Bytes(1);
diff --git a/libclamav/c++/llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp b/libclamav/c++/llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp
index 57c4375..783ebb4 100644
--- a/libclamav/c++/llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp
+++ b/libclamav/c++/llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp
@@ -156,53 +156,18 @@ namespace {
     // was no stub.  This function uses the call-site->function map to find a
     // relevant function, but asserts that only stubs and not other call sites
     // will be passed in.
-    Function *EraseStub(const MutexGuard &locked, void *Stub) {
-      CallSiteToFunctionMapTy::iterator C2F_I =
-        CallSiteToFunctionMap.find(Stub);
-      if (C2F_I == CallSiteToFunctionMap.end()) {
-        // Not a stub.
-        return NULL;
-      }
-
-      Function *const F = C2F_I->second;
-#ifndef NDEBUG
-      void *RealStub = FunctionToLazyStubMap.lookup(F);
-      assert(RealStub == Stub &&
-             "Call-site that wasn't a stub pass in to EraseStub");
-#endif
-      FunctionToLazyStubMap.erase(F);
-      CallSiteToFunctionMap.erase(C2F_I);
-
-      // Remove the stub from the function->call-sites map, and remove the whole
-      // entry from the map if that was the last call site.
-      FunctionToCallSitesMapTy::iterator F2C_I = FunctionToCallSitesMap.find(F);
-      assert(F2C_I != FunctionToCallSitesMap.end() &&
-             "FunctionToCallSitesMap broken");
-      bool Erased = F2C_I->second.erase(Stub);
-      (void)Erased;
-      assert(Erased && "FunctionToCallSitesMap broken");
-      if (F2C_I->second.empty())
-        FunctionToCallSitesMap.erase(F2C_I);
-
-      return F;
-    }
+    Function *EraseStub(const MutexGuard &locked, void *Stub);
 
-    void EraseAllCallSites(const MutexGuard &locked, Function *F) {
+    void EraseAllCallSitesFor(const MutexGuard &locked, Function *F) {
       assert(locked.holds(TheJIT->lock));
-      EraseAllCallSitesPrelocked(F);
-    }
-    void EraseAllCallSitesPrelocked(Function *F) {
-      FunctionToCallSitesMapTy::iterator F2C = FunctionToCallSitesMap.find(F);
-      if (F2C == FunctionToCallSitesMap.end())
-        return;
-      for (SmallPtrSet<void*, 1>::const_iterator I = F2C->second.begin(),
-             E = F2C->second.end(); I != E; ++I) {
-        bool Erased = CallSiteToFunctionMap.erase(*I);
-        (void)Erased;
-        assert(Erased && "Missing call site->function mapping");
-      }
-      FunctionToCallSitesMap.erase(F2C);
+      EraseAllCallSitesForPrelocked(F);
     }
+    void EraseAllCallSitesForPrelocked(Function *F);
+
+    // Erases _all_ call sites regardless of their function.  This is used to
+    // unregister the stub addresses from the StubToResolverMap in
+    // ~JITResolver().
+    void EraseAllCallSitesPrelocked();
   };
 
   /// JITResolver - Keep track of, and resolve, call sites for functions that
@@ -240,6 +205,8 @@ namespace {
       LazyResolverFn = jit.getJITInfo().getLazyResolverFunction(JITCompilerFn);
     }
 
+    ~JITResolver();
+
     /// getLazyFunctionStubIfAvailable - This returns a pointer to a function's
     /// lazy-compilation stub if it has already been created.
     void *getLazyFunctionStubIfAvailable(Function *F);
@@ -259,8 +226,6 @@ namespace {
     void getRelocatableGVs(SmallVectorImpl<GlobalValue*> &GVs,
                            SmallVectorImpl<void*> &Ptrs);
 
-    GlobalValue *invalidateStub(void *Stub);
-
     /// getGOTIndexForAddress - Return a new or existing index in the GOT for
     /// an address.  This function only manages slots, it does not manage the
     /// contents of the slots or the memory associated with the GOT.
@@ -305,6 +270,17 @@ namespace {
       --I;
       return I->second;
     }
+    /// True if any stubs refer to the given resolver. Only used in an assert().
+    /// O(N)
+    bool ResolverHasStubs(JITResolver* Resolver) const {
+      MutexGuard guard(Lock);
+      for (std::map<void*, JITResolver*>::const_iterator I = Map.begin(),
+             E = Map.end(); I != E; ++I) {
+        if (I->second == Resolver)
+          return true;
+      }
+      return false;
+    }
   };
   /// This needs to be static so that a lazy call stub can access it with no
   /// context except the address of the stub.
@@ -370,9 +346,6 @@ namespace {
     /// MMI - Machine module info for exception informations
     MachineModuleInfo* MMI;
 
-    // GVSet - a set to keep track of which globals have been seen
-    SmallPtrSet<const GlobalVariable*, 8> GVSet;
-
     // CurFn - The llvm function being emitted.  Only valid during
     // finishFunction().
     const Function *CurFn;
@@ -396,16 +369,6 @@ namespace {
     ValueMap<const Function *, EmittedCode,
              EmittedFunctionConfig> EmittedFunctions;
 
-    // CurFnStubUses - For a given Function, a vector of stubs that it
-    // references.  This facilitates the JIT detecting that a stub is no
-    // longer used, so that it may be deallocated.
-    DenseMap<AssertingVH<const Function>, SmallVector<void*, 1> > CurFnStubUses;
-
-    // StubFnRefs - For a given pointer to a stub, a set of Functions which
-    // reference the stub.  When the count of a stub's references drops to zero,
-    // the stub is unused.
-    DenseMap<void *, SmallPtrSet<const Function*, 1> > StubFnRefs;
-
     DILocation PrevDLT;
 
     /// Instance of the JIT
@@ -494,11 +457,6 @@ namespace {
     /// function body.
     void deallocateMemForFunction(const Function *F);
 
-    /// AddStubToCurrentFunction - Mark the current function being JIT'd as
-    /// using the stub at the specified address. Allows
-    /// deallocateMemForFunction to also remove stubs no longer referenced.
-    void AddStubToCurrentFunction(void *Stub);
-
     virtual void processDebugLoc(DebugLoc DL, bool BeforePrintingInsn);
 
     virtual void emitLabel(uint64_t LabelID) {
@@ -529,14 +487,86 @@ namespace {
                              bool MayNeedFarStub);
     void *getPointerToGVIndirectSym(GlobalValue *V, void *Reference);
     unsigned addSizeOfGlobal(const GlobalVariable *GV, unsigned Size);
-    unsigned addSizeOfGlobalsInConstantVal(const Constant *C, unsigned Size);
-    unsigned addSizeOfGlobalsInInitializer(const Constant *Init, unsigned Size);
+    unsigned addSizeOfGlobalsInConstantVal(
+      const Constant *C, unsigned Size,
+      SmallPtrSet<const GlobalVariable*, 8> &SeenGlobals,
+      SmallVectorImpl<const GlobalVariable*> &Worklist);
+    unsigned addSizeOfGlobalsInInitializer(
+      const Constant *Init, unsigned Size,
+      SmallPtrSet<const GlobalVariable*, 8> &SeenGlobals,
+      SmallVectorImpl<const GlobalVariable*> &Worklist);
     unsigned GetSizeOfGlobalsInBytes(MachineFunction &MF);
   };
 }
 
 void CallSiteValueMapConfig::onDelete(JITResolverState *JRS, Function *F) {
-  JRS->EraseAllCallSitesPrelocked(F);
+  JRS->EraseAllCallSitesForPrelocked(F);
+}
+
+Function *JITResolverState::EraseStub(const MutexGuard &locked, void *Stub) {
+  CallSiteToFunctionMapTy::iterator C2F_I =
+    CallSiteToFunctionMap.find(Stub);
+  if (C2F_I == CallSiteToFunctionMap.end()) {
+    // Not a stub.
+    return NULL;
+  }
+
+  StubToResolverMap->UnregisterStubResolver(Stub);
+
+  Function *const F = C2F_I->second;
+#ifndef NDEBUG
+  void *RealStub = FunctionToLazyStubMap.lookup(F);
+  assert(RealStub == Stub &&
+         "Call-site that wasn't a stub passed in to EraseStub");
+#endif
+  FunctionToLazyStubMap.erase(F);
+  CallSiteToFunctionMap.erase(C2F_I);
+
+  // Remove the stub from the function->call-sites map, and remove the whole
+  // entry from the map if that was the last call site.
+  FunctionToCallSitesMapTy::iterator F2C_I = FunctionToCallSitesMap.find(F);
+  assert(F2C_I != FunctionToCallSitesMap.end() &&
+         "FunctionToCallSitesMap broken");
+  bool Erased = F2C_I->second.erase(Stub);
+  (void)Erased;
+  assert(Erased && "FunctionToCallSitesMap broken");
+  if (F2C_I->second.empty())
+    FunctionToCallSitesMap.erase(F2C_I);
+
+  return F;
+}
+
+void JITResolverState::EraseAllCallSitesForPrelocked(Function *F) {
+  FunctionToCallSitesMapTy::iterator F2C = FunctionToCallSitesMap.find(F);
+  if (F2C == FunctionToCallSitesMap.end())
+    return;
+  StubToResolverMapTy &S2RMap = *StubToResolverMap;
+  for (SmallPtrSet<void*, 1>::const_iterator I = F2C->second.begin(),
+         E = F2C->second.end(); I != E; ++I) {
+    S2RMap.UnregisterStubResolver(*I);
+    bool Erased = CallSiteToFunctionMap.erase(*I);
+    (void)Erased;
+    assert(Erased && "Missing call site->function mapping");
+  }
+  FunctionToCallSitesMap.erase(F2C);
+}
+
+void JITResolverState::EraseAllCallSitesPrelocked() {
+  StubToResolverMapTy &S2RMap = *StubToResolverMap;
+  for (CallSiteToFunctionMapTy::const_iterator
+         I = CallSiteToFunctionMap.begin(),
+         E = CallSiteToFunctionMap.end(); I != E; ++I) {
+    S2RMap.UnregisterStubResolver(I->first);
+  }
+  CallSiteToFunctionMap.clear();
+  FunctionToCallSitesMap.clear();
+}
+
+JITResolver::~JITResolver() {
+  // No need to lock because we're in the destructor, and state isn't shared.
+  state.EraseAllCallSitesPrelocked();
+  assert(!StubToResolverMap->ResolverHasStubs(this) &&
+         "Resolver destroyed with stubs still alive.");
 }
 
 /// getLazyFunctionStubIfAvailable - This returns a pointer to a function stub
@@ -589,20 +619,22 @@ void *JITResolver::getLazyFunctionStub(Function *F) {
   DEBUG(dbgs() << "JIT: Lazy stub emitted at [" << Stub << "] for function '"
         << F->getName() << "'\n");
 
-  // Register this JITResolver as the one corresponding to this call site so
-  // JITCompilerFn will be able to find it.
-  StubToResolverMap->RegisterStubResolver(Stub, this);
-
-  // Finally, keep track of the stub-to-Function mapping so that the
-  // JITCompilerFn knows which function to compile!
-  state.AddCallSite(locked, Stub, F);
-
-  // If we are JIT'ing non-lazily but need to call a function that does not
-  // exist yet, add it to the JIT's work list so that we can fill in the stub
-  // address later.
-  if (!Actual && !TheJIT->isCompilingLazily())
-    if (!isNonGhostDeclaration(F) && !F->hasAvailableExternallyLinkage())
-      TheJIT->addPendingFunction(F);
+  if (TheJIT->isCompilingLazily()) {
+    // Register this JITResolver as the one corresponding to this call site so
+    // JITCompilerFn will be able to find it.
+    StubToResolverMap->RegisterStubResolver(Stub, this);
+
+    // Finally, keep track of the stub-to-Function mapping so that the
+    // JITCompilerFn knows which function to compile!
+    state.AddCallSite(locked, Stub, F);
+  } else if (!Actual) {
+    // If we are JIT'ing non-lazily but need to call a function that does not
+    // exist yet, add it to the JIT's work list so that we can fill in the
+    // stub address later.
+    assert(!isNonGhostDeclaration(F) && !F->hasAvailableExternallyLinkage() &&
+           "'Actual' should have been set above.");
+    TheJIT->addPendingFunction(F);
+  }
 
   return Stub;
 }
@@ -676,42 +708,6 @@ void JITResolver::getRelocatableGVs(SmallVectorImpl<GlobalValue*> &GVs,
   }
 }
 
-GlobalValue *JITResolver::invalidateStub(void *Stub) {
-  MutexGuard locked(TheJIT->lock);
-
-  // Remove the stub from the StubToResolverMap.
-  StubToResolverMap->UnregisterStubResolver(Stub);
-
-  GlobalToIndirectSymMapTy &GM = state.getGlobalToIndirectSymMap(locked);
-
-  // Look up the cheap way first, to see if it's a function stub we are
-  // invalidating.  If so, remove it from both the forward and reverse maps.
-  if (Function *F = state.EraseStub(locked, Stub)) {
-    return F;
-  }
-
-  // Otherwise, it might be an indirect symbol stub.  Find it and remove it.
-  for (GlobalToIndirectSymMapTy::iterator i = GM.begin(), e = GM.end();
-       i != e; ++i) {
-    if (i->second != Stub)
-      continue;
-    GlobalValue *GV = i->first;
-    GM.erase(i);
-    return GV;
-  }
-
-  // Lastly, check to see if it's in the ExternalFnToStubMap.
-  for (std::map<void *, void *>::iterator i = ExternalFnToStubMap.begin(),
-       e = ExternalFnToStubMap.end(); i != e; ++i) {
-    if (i->second != Stub)
-      continue;
-    ExternalFnToStubMap.erase(i);
-    break;
-  }
-
-  return 0;
-}
-
 /// JITCompilerFn - This function is called when a lazy compilation stub has
 /// been entered.  It looks up which function this stub corresponds to, compiles
 /// it if necessary, then returns the resultant function pointer.
@@ -797,7 +793,6 @@ void *JITEmitter::getPointerToGlobal(GlobalValue *V, void *Reference,
     // that we're returning the same address for the function as any previous
     // call.  TODO: Yes, this is wrong. The lazy stub isn't guaranteed to be
     // close enough to call.
-    AddStubToCurrentFunction(FnStub);
     return FnStub;
   }
 
@@ -814,18 +809,10 @@ void *JITEmitter::getPointerToGlobal(GlobalValue *V, void *Reference,
       return TheJIT->getPointerToFunction(F);
   }
 
-  // Otherwise, we may need a to emit a stub, and, conservatively, we
-  // always do so.
-  void *StubAddr = Resolver.getLazyFunctionStub(F);
-
-  // Add the stub to the current function's list of referenced stubs, so we can
-  // deallocate them if the current function is ever freed.  It's possible to
-  // return null from getLazyFunctionStub in the case of a weak extern that
-  // fails to resolve.
-  if (StubAddr)
-    AddStubToCurrentFunction(StubAddr);
-
-  return StubAddr;
+  // Otherwise, we may need a to emit a stub, and, conservatively, we always do
+  // so.  Note that it's possible to return null from getLazyFunctionStub in the
+  // case of a weak extern that fails to resolve.
+  return Resolver.getLazyFunctionStub(F);
 }
 
 void *JITEmitter::getPointerToGVIndirectSym(GlobalValue *V, void *Reference) {
@@ -833,24 +820,9 @@ void *JITEmitter::getPointerToGVIndirectSym(GlobalValue *V, void *Reference) {
   // resolved address.
   void *GVAddress = getPointerToGlobal(V, Reference, false);
   void *StubAddr = Resolver.getGlobalValueIndirectSym(V, GVAddress);
-
-  // Add the stub to the current function's list of referenced stubs, so we can
-  // deallocate them if the current function is ever freed.
-  AddStubToCurrentFunction(StubAddr);
-
   return StubAddr;
 }
 
-void JITEmitter::AddStubToCurrentFunction(void *StubAddr) {
-  assert(CurFn && "Stub added to current function, but current function is 0!");
-
-  SmallVectorImpl<void*> &StubsUsed = CurFnStubUses[CurFn];
-  StubsUsed.push_back(StubAddr);
-
-  SmallPtrSet<const Function *, 1> &FnRefs = StubFnRefs[StubAddr];
-  FnRefs.insert(CurFn);
-}
-
 void JITEmitter::processDebugLoc(DebugLoc DL, bool BeforePrintingInsn) {
   if (!DL.isUnknown()) {
     DILocation CurDLT = EmissionDetails.MF->getDILocation(DL);
@@ -922,11 +894,14 @@ unsigned JITEmitter::addSizeOfGlobal(const GlobalVariable *GV, unsigned Size) {
 }
 
 /// addSizeOfGlobalsInConstantVal - find any globals that we haven't seen yet
-/// but are referenced from the constant; put them in GVSet and add their
-/// size into the running total Size.
-
-unsigned JITEmitter::addSizeOfGlobalsInConstantVal(const Constant *C,
-                                              unsigned Size) {
+/// but are referenced from the constant; put them in SeenGlobals and the
+/// Worklist, and add their size into the running total Size.
+
+unsigned JITEmitter::addSizeOfGlobalsInConstantVal(
+    const Constant *C,
+    unsigned Size,
+    SmallPtrSet<const GlobalVariable*, 8> &SeenGlobals,
+    SmallVectorImpl<const GlobalVariable*> &Worklist) {
   // If its undefined, return the garbage.
   if (isa<UndefValue>(C))
     return Size;
@@ -948,7 +923,7 @@ unsigned JITEmitter::addSizeOfGlobalsInConstantVal(const Constant *C,
     case Instruction::PtrToInt:
     case Instruction::IntToPtr:
     case Instruction::BitCast: {
-      Size = addSizeOfGlobalsInConstantVal(Op0, Size);
+      Size = addSizeOfGlobalsInConstantVal(Op0, Size, SeenGlobals, Worklist);
       break;
     }
     case Instruction::Add:
@@ -964,8 +939,9 @@ unsigned JITEmitter::addSizeOfGlobalsInConstantVal(const Constant *C,
     case Instruction::And:
     case Instruction::Or:
     case Instruction::Xor: {
-      Size = addSizeOfGlobalsInConstantVal(Op0, Size);
-      Size = addSizeOfGlobalsInConstantVal(CE->getOperand(1), Size);
+      Size = addSizeOfGlobalsInConstantVal(Op0, Size, SeenGlobals, Worklist);
+      Size = addSizeOfGlobalsInConstantVal(CE->getOperand(1), Size,
+                                           SeenGlobals, Worklist);
       break;
     }
     default: {
@@ -979,8 +955,10 @@ unsigned JITEmitter::addSizeOfGlobalsInConstantVal(const Constant *C,
 
   if (C->getType()->getTypeID() == Type::PointerTyID)
     if (const GlobalVariable* GV = dyn_cast<GlobalVariable>(C))
-      if (GVSet.insert(GV))
+      if (SeenGlobals.insert(GV)) {
+        Worklist.push_back(GV);
         Size = addSizeOfGlobal(GV, Size);
+      }
 
   return Size;
 }
@@ -988,15 +966,18 @@ unsigned JITEmitter::addSizeOfGlobalsInConstantVal(const Constant *C,
 /// addSizeOfGLobalsInInitializer - handle any globals that we haven't seen yet
 /// but are referenced from the given initializer.
 
-unsigned JITEmitter::addSizeOfGlobalsInInitializer(const Constant *Init,
-                                              unsigned Size) {
+unsigned JITEmitter::addSizeOfGlobalsInInitializer(
+    const Constant *Init,
+    unsigned Size,
+    SmallPtrSet<const GlobalVariable*, 8> &SeenGlobals,
+    SmallVectorImpl<const GlobalVariable*> &Worklist) {
   if (!isa<UndefValue>(Init) &&
       !isa<ConstantVector>(Init) &&
       !isa<ConstantAggregateZero>(Init) &&
       !isa<ConstantArray>(Init) &&
       !isa<ConstantStruct>(Init) &&
       Init->getType()->isFirstClassType())
-    Size = addSizeOfGlobalsInConstantVal(Init, Size);
+    Size = addSizeOfGlobalsInConstantVal(Init, Size, SeenGlobals, Worklist);
   return Size;
 }
 
@@ -1007,7 +988,7 @@ unsigned JITEmitter::addSizeOfGlobalsInInitializer(const Constant *Init,
 
 unsigned JITEmitter::GetSizeOfGlobalsInBytes(MachineFunction &MF) {
   unsigned Size = 0;
-  GVSet.clear();
+  SmallPtrSet<const GlobalVariable*, 8> SeenGlobals;
 
   for (MachineFunction::iterator MBB = MF.begin(), E = MF.end();
        MBB != E; ++MBB) {
@@ -1031,7 +1012,7 @@ unsigned JITEmitter::GetSizeOfGlobalsInBytes(MachineFunction &MF) {
           // assuming the addresses of the new globals in this module
           // start at 0 (or something) and adjusting them after codegen
           // complete.  Another possibility is to grab a marker bit in GV.
-          if (GVSet.insert(GV))
+          if (SeenGlobals.insert(GV))
             // A variable as yet unseen.  Add in its size.
             Size = addSizeOfGlobal(GV, Size);
         }
@@ -1040,12 +1021,14 @@ unsigned JITEmitter::GetSizeOfGlobalsInBytes(MachineFunction &MF) {
   }
   DEBUG(dbgs() << "JIT: About to look through initializers\n");
   // Look for more globals that are referenced only from initializers.
-  // GVSet.end is computed each time because the set can grow as we go.
-  for (SmallPtrSet<const GlobalVariable *, 8>::iterator I = GVSet.begin();
-       I != GVSet.end(); I++) {
-    const GlobalVariable* GV = *I;
+  SmallVector<const GlobalVariable*, 8> Worklist(
+    SeenGlobals.begin(), SeenGlobals.end());
+  while (!Worklist.empty()) {
+    const GlobalVariable* GV = Worklist.back();
+    Worklist.pop_back();
     if (GV->hasInitializer())
-      Size = addSizeOfGlobalsInInitializer(GV->getInitializer(), Size);
+      Size = addSizeOfGlobalsInInitializer(GV->getInitializer(), Size,
+                                           SeenGlobals, Worklist);
   }
 
   return Size;
@@ -1347,40 +1330,6 @@ void JITEmitter::deallocateMemForFunction(const Function *F) {
   if (JITEmitDebugInfo) {
     DR->UnregisterFunction(F);
   }
-
-  // If the function did not reference any stubs, return.
-  if (CurFnStubUses.find(F) == CurFnStubUses.end())
-    return;
-
-  // For each referenced stub, erase the reference to this function, and then
-  // erase the list of referenced stubs.
-  SmallVectorImpl<void *> &StubList = CurFnStubUses[F];
-  for (unsigned i = 0, e = StubList.size(); i != e; ++i) {
-    void *Stub = StubList[i];
-
-    // If we already invalidated this stub for this function, continue.
-    if (StubFnRefs.count(Stub) == 0)
-      continue;
-
-    SmallPtrSet<const Function *, 1> &FnRefs = StubFnRefs[Stub];
-    FnRefs.erase(F);
-
-    // If this function was the last reference to the stub, invalidate the stub
-    // in the JITResolver.  Were there a memory manager deallocateStub routine,
-    // we could call that at this point too.
-    if (FnRefs.empty()) {
-      DEBUG(dbgs() << "\nJIT: Invalidated Stub at [" << Stub << "]\n");
-      StubFnRefs.erase(Stub);
-
-      // Invalidate the stub.  If it is a GV stub, update the JIT's global
-      // mapping for that GV to zero.
-      GlobalValue *GV = Resolver.invalidateStub(Stub);
-      if (GV) {
-        TheJIT->updateGlobalMapping(GV, 0);
-      }
-    }
-  }
-  CurFnStubUses.erase(F);
 }
 
 
diff --git a/libclamav/c++/llvm/lib/MC/CMakeLists.txt b/libclamav/c++/llvm/lib/MC/CMakeLists.txt
index 9ead33b..4cf71dc 100644
--- a/libclamav/c++/llvm/lib/MC/CMakeLists.txt
+++ b/libclamav/c++/llvm/lib/MC/CMakeLists.txt
@@ -18,4 +18,5 @@ add_llvm_library(LLVMMC
   MCStreamer.cpp
   MCSymbol.cpp
   MCValue.cpp
+  TargetAsmBackend.cpp
   )
diff --git a/libclamav/c++/llvm/lib/MC/MCAsmStreamer.cpp b/libclamav/c++/llvm/lib/MC/MCAsmStreamer.cpp
index 6add1b4..66a0a24 100644
--- a/libclamav/c++/llvm/lib/MC/MCAsmStreamer.cpp
+++ b/libclamav/c++/llvm/lib/MC/MCAsmStreamer.cpp
@@ -134,6 +134,9 @@ public:
                                     unsigned ValueSize = 1,
                                     unsigned MaxBytesToEmit = 0);
 
+  virtual void EmitCodeAlignment(unsigned ByteAlignment,
+                                 unsigned MaxBytesToEmit = 0);
+
   virtual void EmitValueToOffset(const MCExpr *Offset,
                                  unsigned char Value = 0);
 
@@ -513,6 +516,13 @@ void MCAsmStreamer::EmitValueToAlignment(unsigned ByteAlignment, int64_t Value,
   EmitEOL();
 }
 
+void MCAsmStreamer::EmitCodeAlignment(unsigned ByteAlignment,
+                                      unsigned MaxBytesToEmit) {
+  // Emit with a text fill value.
+  EmitValueToAlignment(ByteAlignment, MAI.getTextAlignFillValue(),
+                       1, MaxBytesToEmit);
+}
+
 void MCAsmStreamer::EmitValueToOffset(const MCExpr *Offset,
                                       unsigned char Value) {
   // FIXME: Verify that Offset is associated with the current section.
diff --git a/libclamav/c++/llvm/lib/MC/MCAssembler.cpp b/libclamav/c++/llvm/lib/MC/MCAssembler.cpp
index 653fbf2..96227db 100644
--- a/libclamav/c++/llvm/lib/MC/MCAssembler.cpp
+++ b/libclamav/c++/llvm/lib/MC/MCAssembler.cpp
@@ -42,6 +42,8 @@ STATISTIC(EmittedFragments, "Number of emitted assembler fragments");
 static void WriteFileData(raw_ostream &OS, const MCSectionData &SD,
                           MachObjectWriter &MOW);
 
+static uint64_t WriteNopData(uint64_t Count, MachObjectWriter &MOW);
+
 /// isVirtualSection - Check if this is a section which does not actually exist
 /// in the object file.
 static bool isVirtualSection(const MCSection &Section) {
@@ -51,7 +53,7 @@ static bool isVirtualSection(const MCSection &Section) {
   return (Type == MCSectionMachO::S_ZEROFILL);
 }
 
-static unsigned getFixupKindLog2Size(MCFixupKind Kind) {
+static unsigned getFixupKindLog2Size(unsigned Kind) {
   switch (Kind) {
   default: llvm_unreachable("invalid fixup kind!");
   case X86::reloc_pcrel_1byte:
@@ -64,7 +66,7 @@ static unsigned getFixupKindLog2Size(MCFixupKind Kind) {
   }
 }
 
-static bool isFixupKindPCRel(MCFixupKind Kind) {
+static bool isFixupKindPCRel(unsigned Kind) {
   switch (Kind) {
   default:
     return false;
@@ -439,6 +441,7 @@ public:
                                      std::vector<MachRelocationEntry> &Relocs) {
     uint32_t Address = Fragment.getOffset() + Fixup.Offset;
     unsigned IsPCRel = 0;
+    unsigned Log2Size = getFixupKindLog2Size(Fixup.Kind);
     unsigned Type = RIT_Vanilla;
 
     // See <reloc.h>.
@@ -454,12 +457,10 @@ public:
       Value2 = SD->getFragment()->getAddress() + SD->getOffset();
     }
 
-    unsigned Log2Size = getFixupKindLog2Size(Fixup.Kind);
-
     // The value which goes in the fixup is current value of the expression.
     Fixup.FixedValue = Value - Value2 + Target.getConstant();
     if (isFixupKindPCRel(Fixup.Kind)) {
-      Fixup.FixedValue -= Address + (1 << Log2Size);
+      Fixup.FixedValue -= Address;
       IsPCRel = 1;
     }
 
@@ -507,6 +508,7 @@ public:
     uint32_t Value = 0;
     unsigned Index = 0;
     unsigned IsPCRel = 0;
+    unsigned Log2Size = getFixupKindLog2Size(Fixup.Kind);
     unsigned IsExtern = 0;
     unsigned Type = 0;
 
@@ -544,10 +546,8 @@ public:
     // The value which goes in the fixup is current value of the expression.
     Fixup.FixedValue = Value + Target.getConstant();
 
-    unsigned Log2Size = getFixupKindLog2Size(Fixup.Kind);
-
     if (isFixupKindPCRel(Fixup.Kind)) {
-      Fixup.FixedValue -= Address + (1<<Log2Size);
+      Fixup.FixedValue -= Address;
       IsPCRel = 1;
     }
 
@@ -1060,6 +1060,64 @@ void MCAssembler::LayoutSection(MCSectionData &SD) {
     SD.setFileSize(Address - SD.getAddress());
 }
 
+/// WriteNopData - Write optimal nops to the output file for the \arg Count
+/// bytes.  This returns the number of bytes written.  It may return 0 if
+/// the \arg Count is more than the maximum optimal nops.
+///
+/// FIXME this is X86 32-bit specific and should move to a better place.
+static uint64_t WriteNopData(uint64_t Count, MachObjectWriter &MOW) {
+  static const uint8_t Nops[16][16] = {
+    // nop
+    {0x90},
+    // xchg %ax,%ax
+    {0x66, 0x90},
+    // nopl (%[re]ax)
+    {0x0f, 0x1f, 0x00},
+    // nopl 0(%[re]ax)
+    {0x0f, 0x1f, 0x40, 0x00},
+    // nopl 0(%[re]ax,%[re]ax,1)
+    {0x0f, 0x1f, 0x44, 0x00, 0x00},
+    // nopw 0(%[re]ax,%[re]ax,1)
+    {0x66, 0x0f, 0x1f, 0x44, 0x00, 0x00},
+    // nopl 0L(%[re]ax)
+    {0x0f, 0x1f, 0x80, 0x00, 0x00, 0x00, 0x00},
+    // nopl 0L(%[re]ax,%[re]ax,1)
+    {0x0f, 0x1f, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00},
+    // nopw 0L(%[re]ax,%[re]ax,1)
+    {0x66, 0x0f, 0x1f, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00},
+    // nopw %cs:0L(%[re]ax,%[re]ax,1)
+    {0x66, 0x2e, 0x0f, 0x1f, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00},
+    // nopl 0(%[re]ax,%[re]ax,1)
+    // nopw 0(%[re]ax,%[re]ax,1)
+    {0x0f, 0x1f, 0x44, 0x00, 0x00,
+     0x66, 0x0f, 0x1f, 0x44, 0x00, 0x00},
+    // nopw 0(%[re]ax,%[re]ax,1)
+    // nopw 0(%[re]ax,%[re]ax,1)
+    {0x66, 0x0f, 0x1f, 0x44, 0x00, 0x00,
+     0x66, 0x0f, 0x1f, 0x44, 0x00, 0x00},
+    // nopw 0(%[re]ax,%[re]ax,1)
+    // nopl 0L(%[re]ax) */
+    {0x66, 0x0f, 0x1f, 0x44, 0x00, 0x00,
+     0x0f, 0x1f, 0x80, 0x00, 0x00, 0x00, 0x00},
+    // nopl 0L(%[re]ax)
+    // nopl 0L(%[re]ax)
+    {0x0f, 0x1f, 0x80, 0x00, 0x00, 0x00, 0x00,
+     0x0f, 0x1f, 0x80, 0x00, 0x00, 0x00, 0x00},
+    // nopl 0L(%[re]ax)
+    // nopl 0L(%[re]ax,%[re]ax,1)
+    {0x0f, 0x1f, 0x80, 0x00, 0x00, 0x00, 0x00,
+     0x0f, 0x1f, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00}
+  };
+
+  if (Count > 15)
+    return 0;
+
+  for (uint64_t i = 0; i < Count; i++)
+    MOW.Write8 (uint8_t(Nops[Count - 1][i]));
+
+  return Count;
+}
+
 /// WriteFileData - Write the \arg F data to the output file.
 static void WriteFileData(raw_ostream &OS, const MCFragment &F,
                           MachObjectWriter &MOW) {
@@ -1083,6 +1141,14 @@ static void WriteFileData(raw_ostream &OS, const MCFragment &F,
                         "' is not a divisor of padding size '" +
                         Twine(AF.getFileSize()) + "'");
 
+    // See if we are aligning with nops, and if so do that first to try to fill
+    // the Count bytes.  Then if that did not fill any bytes or there are any
+    // bytes left to fill use the the Value and ValueSize to fill the rest.
+    if (AF.getEmitNops()) {
+      uint64_t NopByteCount = WriteNopData(Count, MOW);
+      Count -= NopByteCount;
+    }
+
     for (uint64_t i = 0; i != Count; ++i) {
       switch (AF.getValueSize()) {
       default:
diff --git a/libclamav/c++/llvm/lib/MC/MCMachOStreamer.cpp b/libclamav/c++/llvm/lib/MC/MCMachOStreamer.cpp
index 0c9627d..a7a8a5d 100644
--- a/libclamav/c++/llvm/lib/MC/MCMachOStreamer.cpp
+++ b/libclamav/c++/llvm/lib/MC/MCMachOStreamer.cpp
@@ -137,6 +137,8 @@ public:
   virtual void EmitValueToAlignment(unsigned ByteAlignment, int64_t Value = 0,
                                     unsigned ValueSize = 1,
                                     unsigned MaxBytesToEmit = 0);
+  virtual void EmitCodeAlignment(unsigned ByteAlignment,
+                                 unsigned MaxBytesToEmit = 0);
   virtual void EmitValueToOffset(const MCExpr *Offset,
                                  unsigned char Value = 0);
   
@@ -333,15 +335,13 @@ void MCMachOStreamer::EmitBytes(StringRef Data, unsigned AddrSpace) {
 
 void MCMachOStreamer::EmitValue(const MCExpr *Value, unsigned Size,
                                 unsigned AddrSpace) {
-  // Assume the front-end will have evaluate things absolute expressions, so
-  // just create data + fixup.
   MCDataFragment *DF = dyn_cast_or_null<MCDataFragment>(getCurrentFragment());
   if (!DF)
     DF = new MCDataFragment(CurSectionData);
 
   // Avoid fixups when possible.
   int64_t AbsValue;
-  if (Value->EvaluateAsAbsolute(AbsValue)) {
+  if (AddValueSymbols(Value)->EvaluateAsAbsolute(AbsValue)) {
     // FIXME: Endianness assumption.
     for (unsigned i = 0; i != Size; ++i)
       DF->getContents().push_back(uint8_t(AbsValue >> (i * 8)));
@@ -359,7 +359,20 @@ void MCMachOStreamer::EmitValueToAlignment(unsigned ByteAlignment,
   if (MaxBytesToEmit == 0)
     MaxBytesToEmit = ByteAlignment;
   new MCAlignFragment(ByteAlignment, Value, ValueSize, MaxBytesToEmit,
-                      CurSectionData);
+                      false /* EmitNops */, CurSectionData);
+
+  // Update the maximum alignment on the current section if necessary.
+  if (ByteAlignment > CurSectionData->getAlignment())
+    CurSectionData->setAlignment(ByteAlignment);
+}
+
+void MCMachOStreamer::EmitCodeAlignment(unsigned ByteAlignment,
+                                        unsigned MaxBytesToEmit) {
+  if (MaxBytesToEmit == 0)
+    MaxBytesToEmit = ByteAlignment;
+  // FIXME the 0x90 is the default x86 1 byte nop opcode.
+  new MCAlignFragment(ByteAlignment, 0x90, 1, MaxBytesToEmit,
+                      true /* EmitNops */, CurSectionData);
 
   // Update the maximum alignment on the current section if necessary.
   if (ByteAlignment > CurSectionData->getAlignment())
diff --git a/libclamav/c++/llvm/lib/MC/MCNullStreamer.cpp b/libclamav/c++/llvm/lib/MC/MCNullStreamer.cpp
index 46e9ebf..ab61799 100644
--- a/libclamav/c++/llvm/lib/MC/MCNullStreamer.cpp
+++ b/libclamav/c++/llvm/lib/MC/MCNullStreamer.cpp
@@ -55,6 +55,9 @@ namespace {
                                       unsigned ValueSize = 1,
                                       unsigned MaxBytesToEmit = 0) {}
 
+    virtual void EmitCodeAlignment(unsigned ByteAlignment,
+                                   unsigned MaxBytesToEmit = 0) {}
+
     virtual void EmitValueToOffset(const MCExpr *Offset,
                                    unsigned char Value = 0) {}
     
diff --git a/libclamav/c++/llvm/lib/MC/TargetAsmBackend.cpp b/libclamav/c++/llvm/lib/MC/TargetAsmBackend.cpp
new file mode 100644
index 0000000..918d272
--- /dev/null
+++ b/libclamav/c++/llvm/lib/MC/TargetAsmBackend.cpp
@@ -0,0 +1,19 @@
+//===-- TargetAsmBackend.cpp - Target Assembly Backend ---------------------==//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/Target/TargetAsmBackend.h"
+using namespace llvm;
+
+TargetAsmBackend::TargetAsmBackend(const Target &T)
+  : TheTarget(T)
+{
+}
+
+TargetAsmBackend::~TargetAsmBackend() {
+}
diff --git a/libclamav/c++/llvm/lib/Support/APFloat.cpp b/libclamav/c++/llvm/lib/Support/APFloat.cpp
index 1e6d22f..619f061 100644
--- a/libclamav/c++/llvm/lib/Support/APFloat.cpp
+++ b/libclamav/c++/llvm/lib/Support/APFloat.cpp
@@ -17,6 +17,7 @@
 #include "llvm/ADT/FoldingSet.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/MathExtras.h"
+#include <limits.h>
 #include <cstring>
 
 using namespace llvm;
@@ -625,17 +626,58 @@ APFloat::copySignificand(const APFloat &rhs)
 /* Make this number a NaN, with an arbitrary but deterministic value
    for the significand.  If double or longer, this is a signalling NaN,
    which may not be ideal.  If float, this is QNaN(0).  */
-void
-APFloat::makeNaN(unsigned type)
+void APFloat::makeNaN(bool SNaN, bool Negative, const APInt *fill)
 {
   category = fcNaN;
-  // FIXME: Add double and long double support for QNaN(0).
-  if (semantics->precision == 24 && semantics->maxExponent == 127) {
-    type |=  0x7fc00000U;
-    type &= ~0x80000000U;
-  } else
-    type = ~0U;
-  APInt::tcSet(significandParts(), type, partCount());
+  sign = Negative;
+
+  integerPart *significand = significandParts();
+  unsigned numParts = partCount();
+
+  // Set the significand bits to the fill.
+  if (!fill || fill->getNumWords() < numParts)
+    APInt::tcSet(significand, 0, numParts);
+  if (fill) {
+    APInt::tcAssign(significand, fill->getRawData(),
+                    std::min(fill->getNumWords(), numParts));
+
+    // Zero out the excess bits of the significand.
+    unsigned bitsToPreserve = semantics->precision - 1;
+    unsigned part = bitsToPreserve / 64;
+    bitsToPreserve %= 64;
+    significand[part] &= ((1ULL << bitsToPreserve) - 1);
+    for (part++; part != numParts; ++part)
+      significand[part] = 0;
+  }
+
+  unsigned QNaNBit = semantics->precision - 2;
+
+  if (SNaN) {
+    // We always have to clear the QNaN bit to make it an SNaN.
+    APInt::tcClearBit(significand, QNaNBit);
+
+    // If there are no bits set in the payload, we have to set
+    // *something* to make it a NaN instead of an infinity;
+    // conventionally, this is the next bit down from the QNaN bit.
+    if (APInt::tcIsZero(significand, numParts))
+      APInt::tcSetBit(significand, QNaNBit - 1);
+  } else {
+    // We always have to set the QNaN bit to make it a QNaN.
+    APInt::tcSetBit(significand, QNaNBit);
+  }
+
+  // For x87 extended precision, we want to make a NaN, not a
+  // pseudo-NaN.  Maybe we should expose the ability to make
+  // pseudo-NaNs?
+  if (semantics == &APFloat::x87DoubleExtended)
+    APInt::tcSetBit(significand, QNaNBit + 1);
+}
+
+APFloat APFloat::makeNaN(const fltSemantics &Sem, bool SNaN, bool Negative,
+                         const APInt *fill) {
+  APFloat value(Sem, uninitialized);
+  value.makeNaN(SNaN, Negative, fill);
+  return value;
 }
 
 APFloat &
@@ -700,9 +742,14 @@ APFloat::APFloat(const fltSemantics &ourSemantics) {
   sign = false;
 }
 
+APFloat::APFloat(const fltSemantics &ourSemantics, uninitializedTag tag) {
+  assertArithmeticOK(ourSemantics);
+  // Allocates storage if necessary but does not initialize it.
+  initialize(&ourSemantics);
+}
 
 APFloat::APFloat(const fltSemantics &ourSemantics,
-                 fltCategory ourCategory, bool negative, unsigned type)
+                 fltCategory ourCategory, bool negative)
 {
   assertArithmeticOK(ourSemantics);
   initialize(&ourSemantics);
@@ -711,7 +758,7 @@ APFloat::APFloat(const fltSemantics &ourSemantics,
   if (category == fcNormal)
     category = fcZero;
   else if (ourCategory == fcNaN)
-    makeNaN(type);
+    makeNaN();
 }
 
 APFloat::APFloat(const fltSemantics &ourSemantics, const StringRef& text)
@@ -2345,11 +2392,24 @@ APFloat::convertFromDecimalString(const StringRef &str, roundingMode rounding_mo
   if (decDigitValue(*D.firstSigDigit) >= 10U) {
     category = fcZero;
     fs = opOK;
-  } else if ((D.normalizedExponent + 1) * 28738
-             <= 8651 * (semantics->minExponent - (int) semantics->precision)) {
+
+  /* Check whether the normalized exponent is high enough to overflow
+     max during the log-rebasing in the max-exponent check below. */
+  } else if (D.normalizedExponent - 1 > INT_MAX / 42039) {
+    fs = handleOverflow(rounding_mode);
+
+  /* If it wasn't, then it also wasn't high enough to overflow max
+     during the log-rebasing in the min-exponent check.  Check that it
+     won't overflow min in either check, then perform the min-exponent
+     check. */
+  } else if (D.normalizedExponent - 1 < INT_MIN / 42039 ||
+             (D.normalizedExponent + 1) * 28738 <=
+               8651 * (semantics->minExponent - (int) semantics->precision)) {
     /* Underflow to zero and round.  */
     zeroSignificand();
     fs = normalize(rounding_mode, lfLessThanHalf);
+
+  /* We can finally safely perform the max-exponent check. */
   } else if ((D.normalizedExponent - 1) * 42039
              >= 12655 * semantics->maxExponent) {
     /* Overflow and round.  */
diff --git a/libclamav/c++/llvm/lib/Support/APInt.cpp b/libclamav/c++/llvm/lib/Support/APInt.cpp
index 3bce3f3..6a6384a 100644
--- a/libclamav/c++/llvm/lib/Support/APInt.cpp
+++ b/libclamav/c++/llvm/lib/Support/APInt.cpp
@@ -2344,13 +2344,21 @@ APInt::tcExtractBit(const integerPart *parts, unsigned int bit)
          & ((integerPart) 1 << bit % integerPartWidth)) != 0;
 }
 
-/* Set the given bit of a bignum.  */
+/* Set the given bit of a bignum. */
 void
 APInt::tcSetBit(integerPart *parts, unsigned int bit)
 {
   parts[bit / integerPartWidth] |= (integerPart) 1 << (bit % integerPartWidth);
 }
 
+/* Clears the given bit of a bignum. */
+void
+APInt::tcClearBit(integerPart *parts, unsigned int bit)
+{
+  parts[bit / integerPartWidth] &=
+    ~((integerPart) 1 << (bit % integerPartWidth));
+}
+
 /* Returns the bit number of the least significant set bit of a
    number.  If the input number has no bits set -1U is returned.  */
 unsigned int
diff --git a/libclamav/c++/llvm/lib/Support/CommandLine.cpp b/libclamav/c++/llvm/lib/Support/CommandLine.cpp
index 961dc1f..2ab4103 100644
--- a/libclamav/c++/llvm/lib/Support/CommandLine.cpp
+++ b/libclamav/c++/llvm/lib/Support/CommandLine.cpp
@@ -650,7 +650,7 @@ void cl::ParseCommandLineOptions(int argc, char **argv,
     if (Handler == 0) {
       if (SinkOpts.empty()) {
         errs() << ProgramName << ": Unknown command line argument '"
-             << argv[i] << "'.  Try: '" << argv[0] << " --help'\n";
+             << argv[i] << "'.  Try: '" << argv[0] << " -help'\n";
         ErrorParsing = true;
       } else {
         for (SmallVectorImpl<Option*>::iterator I = SinkOpts.begin(),
@@ -673,7 +673,7 @@ void cl::ParseCommandLineOptions(int argc, char **argv,
     errs() << ProgramName
          << ": Not enough positional command line arguments specified!\n"
          << "Must specify at least " << NumPositionalRequired
-         << " positional arguments: See: " << argv[0] << " --help\n";
+         << " positional arguments: See: " << argv[0] << " -help\n";
 
     ErrorParsing = true;
   } else if (!HasUnlimitedPositionals
@@ -681,7 +681,7 @@ void cl::ParseCommandLineOptions(int argc, char **argv,
     errs() << ProgramName
          << ": Too many positional arguments specified!\n"
          << "Can specify at most " << PositionalOpts.size()
-         << " positional arguments: See: " << argv[0] << " --help\n";
+         << " positional arguments: See: " << argv[0] << " -help\n";
     ErrorParsing = true;
 
   } else if (ConsumeAfterOpt == 0) {
@@ -1029,7 +1029,7 @@ void generic_parser_base::printOptionInfo(const Option &O,
 
 
 //===----------------------------------------------------------------------===//
-// --help and --help-hidden option implementation
+// -help and -help-hidden option implementation
 //
 
 static int OptNameCompare(const void *LHS, const void *RHS) {
@@ -1134,7 +1134,7 @@ static HelpPrinter NormalPrinter(false);
 static HelpPrinter HiddenPrinter(true);
 
 static cl::opt<HelpPrinter, true, parser<bool> >
-HOp("help", cl::desc("Display available options (--help-hidden for more)"),
+HOp("help", cl::desc("Display available options (-help-hidden for more)"),
     cl::location(NormalPrinter), cl::ValueDisallowed);
 
 static cl::opt<HelpPrinter, true, parser<bool> >
@@ -1222,8 +1222,8 @@ void cl::PrintHelpMessage() {
   // NormalPrinter variable is a HelpPrinter and the help gets printed when
   // its operator= is invoked. That's because the "normal" usages of the
   // help printer is to be assigned true/false depending on whether the
-  // --help option was given or not. Since we're circumventing that we have
-  // to make it look like --help was given, so we assign true.
+  // -help option was given or not. Since we're circumventing that we have
+  // to make it look like -help was given, so we assign true.
   NormalPrinter = true;
 }
 
diff --git a/libclamav/c++/llvm/lib/Support/FormattedStream.cpp b/libclamav/c++/llvm/lib/Support/FormattedStream.cpp
index 39b6cb3..c72b5a1 100644
--- a/libclamav/c++/llvm/lib/Support/FormattedStream.cpp
+++ b/libclamav/c++/llvm/lib/Support/FormattedStream.cpp
@@ -56,8 +56,6 @@ void formatted_raw_ostream::ComputeColumn(const char *Ptr, size_t Size) {
 /// PadToColumn - Align the output to some column number.
 ///
 /// \param NewCol - The column to move to.
-/// \param MinPad - The minimum space to give after the most recent
-/// I/O, even if the current column + minpad > newcol.
 ///
 formatted_raw_ostream &formatted_raw_ostream::PadToColumn(unsigned NewCol) { 
   // Figure out what's in the buffer and add it to the column count.
diff --git a/libclamav/c++/llvm/lib/Support/GraphWriter.cpp b/libclamav/c++/llvm/lib/Support/GraphWriter.cpp
index c8bca6e..ec84f9b 100644
--- a/libclamav/c++/llvm/lib/Support/GraphWriter.cpp
+++ b/libclamav/c++/llvm/lib/Support/GraphWriter.cpp
@@ -137,7 +137,7 @@ void llvm::DisplayGraph(const sys::Path &Filename, bool wait,
     args.clear();
     args.push_back(gv.c_str());
     args.push_back(PSFilename.c_str());
-    args.push_back("-spartan");
+    args.push_back("--spartan");
     args.push_back(0);
     
     ErrMsg.clear();
diff --git a/libclamav/c++/llvm/lib/Support/MemoryBuffer.cpp b/libclamav/c++/llvm/lib/Support/MemoryBuffer.cpp
index 9253b01..eb046d0 100644
--- a/libclamav/c++/llvm/lib/Support/MemoryBuffer.cpp
+++ b/libclamav/c++/llvm/lib/Support/MemoryBuffer.cpp
@@ -174,7 +174,8 @@ MemoryBuffer *MemoryBuffer::getFile(StringRef Filename, std::string *ErrStr,
 #ifdef O_BINARY
   OpenFlags |= O_BINARY;  // Open input file in binary mode on win32.
 #endif
-  int FD = ::open(Filename.str().c_str(), O_RDONLY|OpenFlags);
+  SmallString<256> PathBuf(Filename.begin(), Filename.end());
+  int FD = ::open(PathBuf.c_str(), O_RDONLY|OpenFlags);
   if (FD == -1) {
     if (ErrStr) *ErrStr = strerror(errno);
     return 0;
diff --git a/libclamav/c++/llvm/lib/Support/Regex.cpp b/libclamav/c++/llvm/lib/Support/Regex.cpp
index 618ca05..a7631de 100644
--- a/libclamav/c++/llvm/lib/Support/Regex.cpp
+++ b/libclamav/c++/llvm/lib/Support/Regex.cpp
@@ -90,3 +90,79 @@ bool Regex::match(const StringRef &String, SmallVectorImpl<StringRef> *Matches){
 
   return true;
 }
+
+std::string Regex::sub(StringRef Repl, StringRef String,
+                       std::string *Error) {
+  SmallVector<StringRef, 8> Matches;
+
+  // Reset error, if given.
+  if (Error && !Error->empty()) *Error = "";
+
+  // Return the input if there was no match.
+  if (!match(String, &Matches))
+    return String;
+
+  // Otherwise splice in the replacement string, starting with the prefix before
+  // the match.
+  std::string Res(String.begin(), Matches[0].begin());
+
+  // Then the replacement string, honoring possible substitutions.
+  while (!Repl.empty()) {
+    // Skip to the next escape.
+    std::pair<StringRef, StringRef> Split = Repl.split('\\');
+
+    // Add the skipped substring.
+    Res += Split.first;
+
+    // Check for terminimation and trailing backslash.
+    if (Split.second.empty()) {
+      if (Repl.size() != Split.first.size() &&
+          Error && Error->empty())
+        *Error = "replacement string contained trailing backslash";
+      break;
+    }
+
+    // Otherwise update the replacement string and interpret escapes.
+    Repl = Split.second;
+
+    // FIXME: We should have a StringExtras function for mapping C99 escapes.
+    switch (Repl[0]) {
+      // Treat all unrecognized characters as self-quoting.
+    default:
+      Res += Repl[0];
+      Repl = Repl.substr(1);
+      break;
+
+      // Single character escapes.
+    case 't':
+      Res += '\t';
+      Repl = Repl.substr(1);
+      break;
+    case 'n':
+      Res += '\n';
+      Repl = Repl.substr(1);
+      break;
+
+      // Decimal escapes are backreferences.
+    case '0': case '1': case '2': case '3': case '4':
+    case '5': case '6': case '7': case '8': case '9': {
+      // Extract the backreference number.
+      StringRef Ref = Repl.slice(0, Repl.find_first_not_of("0123456789"));
+      Repl = Repl.substr(Ref.size());
+
+      unsigned RefValue;
+      if (!Ref.getAsInteger(10, RefValue) &&
+          RefValue < Matches.size())
+        Res += Matches[RefValue];
+      else if (Error && Error->empty())
+        *Error = "invalid backreference string '" + Ref.str() + "'";
+      break;
+    }
+    }
+  }
+
+  // And finally the suffix.
+  Res += StringRef(Matches[0].end(), String.end() - Matches[0].end());
+
+  return Res;
+}
diff --git a/libclamav/c++/llvm/lib/Support/StringRef.cpp b/libclamav/c++/llvm/lib/Support/StringRef.cpp
index ae2640b..2b262dc 100644
--- a/libclamav/c++/llvm/lib/Support/StringRef.cpp
+++ b/libclamav/c++/llvm/lib/Support/StringRef.cpp
@@ -8,6 +8,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/APInt.h"
 
 using namespace llvm;
 
@@ -172,23 +173,28 @@ size_t StringRef::count(StringRef Str) const {
   return Count;
 }
 
+static unsigned GetAutoSenseRadix(StringRef &Str) {
+  if (Str.startswith("0x")) {
+    Str = Str.substr(2);
+    return 16;
+  } else if (Str.startswith("0b")) {
+    Str = Str.substr(2);
+    return 2;
+  } else if (Str.startswith("0")) {
+    return 8;
+  } else {
+    return 10;
+  }
+}
+
+
 /// GetAsUnsignedInteger - Workhorse method that converts a integer character
 /// sequence of radix up to 36 to an unsigned long long value.
 static bool GetAsUnsignedInteger(StringRef Str, unsigned Radix,
                                  unsigned long long &Result) {
   // Autosense radix if not specified.
-  if (Radix == 0) {
-    if (Str.startswith("0x")) {
-      Str = Str.substr(2);
-      Radix = 16;
-    } else if (Str.startswith("0b")) {
-      Str = Str.substr(2);
-      Radix = 2;
-    } else if (Str.startswith("0"))
-      Radix = 8;
-    else
-      Radix = 10;
-  }
+  if (Radix == 0)
+    Radix = GetAutoSenseRadix(Str);
   
   // Empty strings (after the radix autosense) are invalid.
   if (Str.empty()) return true;
@@ -272,3 +278,78 @@ bool StringRef::getAsInteger(unsigned Radix, unsigned &Result) const {
   Result = Val;
   return false;
 }  
+
+bool StringRef::getAsInteger(unsigned Radix, APInt &Result) const {
+  StringRef Str = *this;
+
+  // Autosense radix if not specified.
+  if (Radix == 0)
+    Radix = GetAutoSenseRadix(Str);
+
+  assert(Radix > 1 && Radix <= 36);
+  
+  // Empty strings (after the radix autosense) are invalid.
+  if (Str.empty()) return true;
+
+  // Skip leading zeroes.  This can be a significant improvement if
+  // it means we don't need > 64 bits.
+  while (!Str.empty() && Str.front() == '0')
+    Str = Str.substr(1);
+
+  // If it was nothing but zeroes....
+  if (Str.empty()) {
+    Result = APInt(64, 0);
+    return false;
+  }
+
+  // (Over-)estimate the required number of bits.
+  unsigned Log2Radix = 0;
+  while ((1U << Log2Radix) < Radix) Log2Radix++;
+  bool IsPowerOf2Radix = ((1U << Log2Radix) == Radix);
+
+  unsigned BitWidth = Log2Radix * Str.size();
+  if (BitWidth < Result.getBitWidth())
+    BitWidth = Result.getBitWidth(); // don't shrink the result
+  else
+    Result.zext(BitWidth);
+
+  APInt RadixAP, CharAP; // unused unless !IsPowerOf2Radix
+  if (!IsPowerOf2Radix) {
+    // These must have the same bit-width as Result.
+    RadixAP = APInt(BitWidth, Radix);
+    CharAP = APInt(BitWidth, 0);
+  }
+
+  // Parse all the bytes of the string given this radix.
+  Result = 0;
+  while (!Str.empty()) {
+    unsigned CharVal;
+    if (Str[0] >= '0' && Str[0] <= '9')
+      CharVal = Str[0]-'0';
+    else if (Str[0] >= 'a' && Str[0] <= 'z')
+      CharVal = Str[0]-'a'+10;
+    else if (Str[0] >= 'A' && Str[0] <= 'Z')
+      CharVal = Str[0]-'A'+10;
+    else
+      return true;
+    
+    // If the parsed value is larger than the integer radix, the string is
+    // invalid.
+    if (CharVal >= Radix)
+      return true;
+    
+    // Add in this character.
+    if (IsPowerOf2Radix) {
+      Result <<= Log2Radix;
+      Result |= CharVal;
+    } else {
+      Result *= RadixAP;
+      CharAP = CharVal;
+      Result += CharAP;
+    }
+
+    Str = Str.substr(1);
+  }
+  
+  return false;
+}
diff --git a/libclamav/c++/llvm/lib/Support/Triple.cpp b/libclamav/c++/llvm/lib/Support/Triple.cpp
index 5a76184..61bf0a7 100644
--- a/libclamav/c++/llvm/lib/Support/Triple.cpp
+++ b/libclamav/c++/llvm/lib/Support/Triple.cpp
@@ -40,6 +40,7 @@ const char *Triple::getArchTypeName(ArchType Kind) {
   case x86:     return "i386";
   case x86_64:  return "x86_64";
   case xcore:   return "xcore";
+  case mblaze:  return "mblaze";
   }
 
   return "<invalid>";
@@ -62,6 +63,8 @@ const char *Triple::getArchTypePrefix(ArchType Kind) {
   case ppc64:
   case ppc:     return "ppc";
 
+  case mblaze:  return "mblaze";
+
   case sparcv9:
   case sparc:   return "sparc";
 
@@ -127,6 +130,8 @@ Triple::ArchType Triple::getArchTypeForLLVMName(StringRef Name) {
     return ppc64;
   if (Name == "ppc")
     return ppc;
+  if (Name == "mblaze")
+    return mblaze;
   if (Name == "sparc")
     return sparc;
   if (Name == "sparcv9")
@@ -198,6 +203,8 @@ const char *Triple::getArchNameForAssembler() {
     return "ppc";
   if (Str == "powerpc64")
     return "ppc64";
+  if (Str == "mblaze" || Str == "microblaze")
+    return "mblaze";
   if (Str == "arm")
     return "arm";
   if (Str == "armv4t" || Str == "thumbv4t")
@@ -234,6 +241,8 @@ void Triple::Parse() const {
     Arch = ppc;
   else if ((ArchName == "powerpc64") || (ArchName == "ppu"))
     Arch = ppc64;
+  else if (ArchName == "mblaze")
+    Arch = mblaze;
   else if (ArchName == "arm" ||
            ArchName.startswith("armv") ||
            ArchName == "xscale")
diff --git a/libclamav/c++/llvm/lib/Support/raw_ostream.cpp b/libclamav/c++/llvm/lib/Support/raw_ostream.cpp
index 25c3fbd..071c924 100644
--- a/libclamav/c++/llvm/lib/Support/raw_ostream.cpp
+++ b/libclamav/c++/llvm/lib/Support/raw_ostream.cpp
@@ -368,6 +368,7 @@ void format_object_base::home() {
 /// if no error occurred.
 raw_fd_ostream::raw_fd_ostream(const char *Filename, std::string &ErrorInfo,
                                unsigned Flags) : pos(0) {
+  assert(Filename != 0 && "Filename is null");
   // Verify that we don't have both "append" and "excl".
   assert((!(Flags & F_Excl) || !(Flags & F_Append)) &&
          "Cannot specify both 'excl' and 'append' file creation flags!");
diff --git a/libclamav/c++/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp b/libclamav/c++/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp
index 6fe7c2c..8e537d8 100644
--- a/libclamav/c++/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp
+++ b/libclamav/c++/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp
@@ -643,6 +643,13 @@ ARMBaseInstrInfo::copyRegToReg(MachineBasicBlock &MBB,
   DebugLoc DL = DebugLoc::getUnknownLoc();
   if (I != MBB.end()) DL = I->getDebugLoc();
 
+  // tGPR is used sometimes in ARM instructions that need to avoid using
+  // certain registers.  Just treat it as GPR here.
+  if (DestRC == ARM::tGPRRegisterClass)
+    DestRC = ARM::GPRRegisterClass;
+  if (SrcRC == ARM::tGPRRegisterClass)
+    SrcRC = ARM::GPRRegisterClass;
+
   if (DestRC != SrcRC) {
     if (DestRC->getSize() != SrcRC->getSize())
       return false;
@@ -697,6 +704,11 @@ storeRegToStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator I,
                             MFI.getObjectSize(FI),
                             Align);
 
+  // tGPR is used sometimes in ARM instructions that need to avoid using
+  // certain registers.  Just treat it as GPR here.
+  if (RC == ARM::tGPRRegisterClass)
+    RC = ARM::GPRRegisterClass;
+
   if (RC == ARM::GPRRegisterClass) {
     AddDefaultPred(BuildMI(MBB, I, DL, get(ARM::STR))
                    .addReg(SrcReg, getKillRegState(isKill))
@@ -745,6 +757,11 @@ loadRegFromStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator I,
                             MFI.getObjectSize(FI),
                             Align);
 
+  // tGPR is used sometimes in ARM instructions that need to avoid using
+  // certain registers.  Just treat it as GPR here.
+  if (RC == ARM::tGPRRegisterClass)
+    RC = ARM::GPRRegisterClass;
+
   if (RC == ARM::GPRRegisterClass) {
     AddDefaultPred(BuildMI(MBB, I, DL, get(ARM::LDR), DestReg)
                    .addFrameIndex(FI).addReg(0).addImm(0).addMemOperand(MMO));
@@ -1020,9 +1037,8 @@ ARMBaseInstrInfo::duplicate(MachineInstr *Orig, MachineFunction &MF) const {
   return MI;
 }
 
-bool ARMBaseInstrInfo::isIdentical(const MachineInstr *MI0,
-                                  const MachineInstr *MI1,
-                                  const MachineRegisterInfo *MRI) const {
+bool ARMBaseInstrInfo::produceSameValue(const MachineInstr *MI0,
+                                        const MachineInstr *MI1) const {
   int Opcode = MI0->getOpcode();
   if (Opcode == ARM::t2LDRpci ||
       Opcode == ARM::t2LDRpci_pic ||
@@ -1051,7 +1067,7 @@ bool ARMBaseInstrInfo::isIdentical(const MachineInstr *MI0,
     return ACPV0->hasSameValue(ACPV1);
   }
 
-  return TargetInstrInfoImpl::isIdentical(MI0, MI1, MRI);
+  return MI0->isIdenticalTo(MI1, MachineInstr::IgnoreVRegDefs);
 }
 
 /// getInstrPredicate - If instruction is predicated, returns its predicate
diff --git a/libclamav/c++/llvm/lib/Target/ARM/ARMBaseInstrInfo.h b/libclamav/c++/llvm/lib/Target/ARM/ARMBaseInstrInfo.h
index 0d9d4a7..e095acc 100644
--- a/libclamav/c++/llvm/lib/Target/ARM/ARMBaseInstrInfo.h
+++ b/libclamav/c++/llvm/lib/Target/ARM/ARMBaseInstrInfo.h
@@ -289,8 +289,8 @@ public:
 
   MachineInstr *duplicate(MachineInstr *Orig, MachineFunction &MF) const;
 
-  virtual bool isIdentical(const MachineInstr *MI, const MachineInstr *Other,
-                           const MachineRegisterInfo *MRI) const;
+  virtual bool produceSameValue(const MachineInstr *MI0,
+                                const MachineInstr *MI1) const;
 };
 
 static inline
diff --git a/libclamav/c++/llvm/lib/Target/ARM/ARMBaseRegisterInfo.cpp b/libclamav/c++/llvm/lib/Target/ARM/ARMBaseRegisterInfo.cpp
index 91e3550..577c363 100644
--- a/libclamav/c++/llvm/lib/Target/ARM/ARMBaseRegisterInfo.cpp
+++ b/libclamav/c++/llvm/lib/Target/ARM/ARMBaseRegisterInfo.cpp
@@ -513,7 +513,7 @@ cannotEliminateFrame(const MachineFunction &MF) const {
 }
 
 /// estimateStackSize - Estimate and return the size of the frame.
-static unsigned estimateStackSize(MachineFunction &MF, MachineFrameInfo *MFI) {
+static unsigned estimateStackSize(MachineFunction &MF) {
   const MachineFrameInfo *FFI = MF.getFrameInfo();
   int Offset = 0;
   for (int i = FFI->getObjectIndexBegin(); i != 0; ++i) {
@@ -671,8 +671,16 @@ ARMBaseRegisterInfo::processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
     }
   }
 
+  // If any of the stack slot references may be out of range of an immediate
+  // offset, make sure a register (or a spill slot) is available for the
+  // register scavenger. Note that if we're indexing off the frame pointer, the
+  // effective stack size is 4 bytes larger since the FP points to the stack
+  // slot of the previous FP.
+  bool BigStack = RS &&
+    estimateStackSize(MF) + (hasFP(MF) ? 4 : 0) >= estimateRSStackSizeLimit(MF);
+
   bool ExtraCSSpill = false;
-  if (!CanEliminateFrame || cannotEliminateFrame(MF)) {
+  if (BigStack || !CanEliminateFrame || cannotEliminateFrame(MF)) {
     AFI->setHasStackFrame(true);
 
     // If LR is not spilled, but at least one of R4, R5, R6, and R7 is spilled.
@@ -727,51 +735,43 @@ ARMBaseRegisterInfo::processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
     // callee-saved register or reserve a special spill slot to facilitate
     // register scavenging. Thumb1 needs a spill slot for stack pointer
     // adjustments also, even when the frame itself is small.
-    if (RS && !ExtraCSSpill) {
-      MachineFrameInfo  *MFI = MF.getFrameInfo();
-      // If any of the stack slot references may be out of range of an
-      // immediate offset, make sure a register (or a spill slot) is
-      // available for the register scavenger. Note that if we're indexing
-      // off the frame pointer, the effective stack size is 4 bytes larger
-      // since the FP points to the stack slot of the previous FP.
-      if (estimateStackSize(MF, MFI) + (hasFP(MF) ? 4 : 0)
-          >= estimateRSStackSizeLimit(MF)) {
-        // If any non-reserved CS register isn't spilled, just spill one or two
-        // extra. That should take care of it!
-        unsigned NumExtras = TargetAlign / 4;
-        SmallVector<unsigned, 2> Extras;
-        while (NumExtras && !UnspilledCS1GPRs.empty()) {
-          unsigned Reg = UnspilledCS1GPRs.back();
-          UnspilledCS1GPRs.pop_back();
+    if (BigStack && !ExtraCSSpill) {
+      // If any non-reserved CS register isn't spilled, just spill one or two
+      // extra. That should take care of it!
+      unsigned NumExtras = TargetAlign / 4;
+      SmallVector<unsigned, 2> Extras;
+      while (NumExtras && !UnspilledCS1GPRs.empty()) {
+        unsigned Reg = UnspilledCS1GPRs.back();
+        UnspilledCS1GPRs.pop_back();
+        if (!isReservedReg(MF, Reg)) {
+          Extras.push_back(Reg);
+          NumExtras--;
+        }
+      }
+      // For non-Thumb1 functions, also check for hi-reg CS registers
+      if (!AFI->isThumb1OnlyFunction()) {
+        while (NumExtras && !UnspilledCS2GPRs.empty()) {
+          unsigned Reg = UnspilledCS2GPRs.back();
+          UnspilledCS2GPRs.pop_back();
           if (!isReservedReg(MF, Reg)) {
             Extras.push_back(Reg);
             NumExtras--;
           }
         }
-        // For non-Thumb1 functions, also check for hi-reg CS registers
-        if (!AFI->isThumb1OnlyFunction()) {
-          while (NumExtras && !UnspilledCS2GPRs.empty()) {
-            unsigned Reg = UnspilledCS2GPRs.back();
-            UnspilledCS2GPRs.pop_back();
-            if (!isReservedReg(MF, Reg)) {
-              Extras.push_back(Reg);
-              NumExtras--;
-            }
-          }
-        }
-        if (Extras.size() && NumExtras == 0) {
-          for (unsigned i = 0, e = Extras.size(); i != e; ++i) {
-            MF.getRegInfo().setPhysRegUsed(Extras[i]);
-            AFI->setCSRegisterIsSpilled(Extras[i]);
-          }
-        } else if (!AFI->isThumb1OnlyFunction()) {
-          // note: Thumb1 functions spill to R12, not the stack.
-          // Reserve a slot closest to SP or frame pointer.
-          const TargetRegisterClass *RC = ARM::GPRRegisterClass;
-          RS->setScavengingFrameIndex(MFI->CreateStackObject(RC->getSize(),
-                                                             RC->getAlignment(),
-                                                             false));
+      }
+      if (Extras.size() && NumExtras == 0) {
+        for (unsigned i = 0, e = Extras.size(); i != e; ++i) {
+          MF.getRegInfo().setPhysRegUsed(Extras[i]);
+          AFI->setCSRegisterIsSpilled(Extras[i]);
         }
+      } else if (!AFI->isThumb1OnlyFunction()) {
+        // note: Thumb1 functions spill to R12, not the stack.  Reserve a slot
+        // closest to SP or frame pointer.
+        const TargetRegisterClass *RC = ARM::GPRRegisterClass;
+        MachineFrameInfo *MFI = MF.getFrameInfo();
+        RS->setScavengingFrameIndex(MFI->CreateStackObject(RC->getSize(),
+                                                           RC->getAlignment(),
+                                                           false));
       }
     }
   }
@@ -1085,6 +1085,15 @@ hasReservedCallFrame(MachineFunction &MF) const {
   return !MF.getFrameInfo()->hasVarSizedObjects();
 }
 
+// canSimplifyCallFramePseudos - If there is a reserved call frame, the
+// call frame pseudos can be simplified. Unlike most targets, having a FP
+// is not sufficient here since we still may reference some objects via SP
+// even when FP is available in Thumb2 mode.
+bool ARMBaseRegisterInfo::
+canSimplifyCallFramePseudos(MachineFunction &MF) const {
+  return hasReservedCallFrame(MF) || MF.getFrameInfo()->hasVarSizedObjects();
+}
+
 static void
 emitSPUpdate(bool isARM,
              MachineBasicBlock &MBB, MachineBasicBlock::iterator &MBBI,
@@ -1119,13 +1128,14 @@ eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB,
 
       ARMFunctionInfo *AFI = MF.getInfo<ARMFunctionInfo>();
       assert(!AFI->isThumb1OnlyFunction() &&
-             "This eliminateCallFramePseudoInstr does not suppor Thumb1!");
+             "This eliminateCallFramePseudoInstr does not support Thumb1!");
       bool isARM = !AFI->isThumbFunction();
 
       // Replace the pseudo instruction with a new instruction...
       unsigned Opc = Old->getOpcode();
-      ARMCC::CondCodes Pred = (ARMCC::CondCodes)Old->getOperand(1).getImm();
-      // FIXME: Thumb2 version of ADJCALLSTACKUP and ADJCALLSTACKDOWN?
+      int PIdx = Old->findFirstPredOperandIdx();
+      ARMCC::CondCodes Pred = (PIdx == -1)
+        ? ARMCC::AL : (ARMCC::CondCodes)Old->getOperand(PIdx).getImm();
       if (Opc == ARM::ADJCALLSTACKDOWN || Opc == ARM::tADJCALLSTACKDOWN) {
         // Note: PredReg is operand 2 for ADJCALLSTACKDOWN.
         unsigned PredReg = Old->getOperand(2).getReg();
@@ -1149,7 +1159,6 @@ ARMBaseRegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II,
   MachineInstr &MI = *II;
   MachineBasicBlock &MBB = *MI.getParent();
   MachineFunction &MF = *MBB.getParent();
-  const MachineFrameInfo *MFI = MF.getFrameInfo();
   ARMFunctionInfo *AFI = MF.getInfo<ARMFunctionInfo>();
   assert(!AFI->isThumb1OnlyFunction() &&
          "This eliminateFrameIndex does not support Thumb1!");
@@ -1160,12 +1169,12 @@ ARMBaseRegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II,
   }
 
   int FrameIndex = MI.getOperand(i).getIndex();
-  int Offset = MFI->getObjectOffset(FrameIndex) + MFI->getStackSize() + SPAdj;
   unsigned FrameReg;
 
-  Offset = getFrameIndexReference(MF, FrameIndex, FrameReg);
+  int Offset = getFrameIndexReference(MF, FrameIndex, FrameReg);
   if (FrameReg != ARM::SP)
     SPAdj = 0;
+  Offset += SPAdj;
 
   // Modify MI as necessary to handle as much of 'Offset' as possible
   bool Done = false;
@@ -1256,7 +1265,7 @@ emitPrologue(MachineFunction &MF) const {
   MachineFrameInfo  *MFI = MF.getFrameInfo();
   ARMFunctionInfo *AFI = MF.getInfo<ARMFunctionInfo>();
   assert(!AFI->isThumb1OnlyFunction() &&
-         "This emitPrologue does not suppor Thumb1!");
+         "This emitPrologue does not support Thumb1!");
   bool isARM = !AFI->isThumbFunction();
   unsigned VARegSaveSize = AFI->getVarArgsRegSaveSize();
   unsigned NumBytes = MFI->getStackSize();
@@ -1341,7 +1350,9 @@ emitPrologue(MachineFunction &MF) const {
   unsigned DPRCSOffset  = NumBytes - (GPRCS1Size + GPRCS2Size + DPRCSSize);
   unsigned GPRCS2Offset = DPRCSOffset + DPRCSSize;
   unsigned GPRCS1Offset = GPRCS2Offset + GPRCS2Size;
-  AFI->setFramePtrSpillOffset(MFI->getObjectOffset(FramePtrSpillFI) + NumBytes);
+  if (STI.isTargetDarwin() || hasFP(MF))
+    AFI->setFramePtrSpillOffset(MFI->getObjectOffset(FramePtrSpillFI) +
+                                NumBytes);
   AFI->setGPRCalleeSavedArea1Offset(GPRCS1Offset);
   AFI->setGPRCalleeSavedArea2Offset(GPRCS2Offset);
   AFI->setDPRCalleeSavedAreaOffset(DPRCSOffset);
@@ -1417,7 +1428,7 @@ emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const {
   MachineFrameInfo *MFI = MF.getFrameInfo();
   ARMFunctionInfo *AFI = MF.getInfo<ARMFunctionInfo>();
   assert(!AFI->isThumb1OnlyFunction() &&
-         "This emitEpilogue does not suppor Thumb1!");
+         "This emitEpilogue does not support Thumb1!");
   bool isARM = !AFI->isThumbFunction();
 
   unsigned VARegSaveSize = AFI->getVarArgsRegSaveSize();
diff --git a/libclamav/c++/llvm/lib/Target/ARM/ARMBaseRegisterInfo.h b/libclamav/c++/llvm/lib/Target/ARM/ARMBaseRegisterInfo.h
index 33ba21d..64f6ff1 100644
--- a/libclamav/c++/llvm/lib/Target/ARM/ARMBaseRegisterInfo.h
+++ b/libclamav/c++/llvm/lib/Target/ARM/ARMBaseRegisterInfo.h
@@ -138,6 +138,7 @@ public:
   virtual bool requiresFrameIndexScavenging(const MachineFunction &MF) const;
 
   virtual bool hasReservedCallFrame(MachineFunction &MF) const;
+  virtual bool canSimplifyCallFramePseudos(MachineFunction &MF) const;
 
   virtual void eliminateCallFramePseudoInstr(MachineFunction &MF,
                                              MachineBasicBlock &MBB,
diff --git a/libclamav/c++/llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp b/libclamav/c++/llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp
index a458269..013e00a 100644
--- a/libclamav/c++/llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp
+++ b/libclamav/c++/llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp
@@ -65,7 +65,7 @@ public:
   }
 
   SDNode *Select(SDNode *N);
-  virtual void InstructionSelect();
+
   bool SelectShifterOperandReg(SDNode *Op, SDValue N, SDValue &A,
                                SDValue &B, SDValue &C);
   bool SelectAddrMode2(SDNode *Op, SDValue N, SDValue &Base,
@@ -201,11 +201,6 @@ static bool isOpcWithIntImmediate(SDNode *N, unsigned Opc, unsigned& Imm) {
 }
 
 
-void ARMDAGToDAGISel::InstructionSelect() {
-  SelectRoot(*CurDAG);
-  CurDAG->RemoveDeadNodes();
-}
-
 bool ARMDAGToDAGISel::SelectShifterOperandReg(SDNode *Op,
                                               SDValue N,
                                               SDValue &BaseReg,
diff --git a/libclamav/c++/llvm/lib/Target/ARM/ARMISelLowering.cpp b/libclamav/c++/llvm/lib/Target/ARM/ARMISelLowering.cpp
index 614e684..6a2c6bb 100644
--- a/libclamav/c++/llvm/lib/Target/ARM/ARMISelLowering.cpp
+++ b/libclamav/c++/llvm/lib/Target/ARM/ARMISelLowering.cpp
@@ -294,6 +294,7 @@ ARMTargetLowering::ARMTargetLowering(TargetMachine &TM)
     setTargetDAGCombine(ISD::SIGN_EXTEND);
     setTargetDAGCombine(ISD::ZERO_EXTEND);
     setTargetDAGCombine(ISD::ANY_EXTEND);
+    setTargetDAGCombine(ISD::SELECT_CC);
   }
 
   computeRegisterProperties();
@@ -544,6 +545,8 @@ const char *ARMTargetLowering::getTargetNodeName(unsigned Opcode) const {
   case ARMISD::VZIP:          return "ARMISD::VZIP";
   case ARMISD::VUZP:          return "ARMISD::VUZP";
   case ARMISD::VTRN:          return "ARMISD::VTRN";
+  case ARMISD::FMAX:          return "ARMISD::FMAX";
+  case ARMISD::FMIN:          return "ARMISD::FMIN";
   }
 }
 
@@ -863,7 +866,8 @@ ARMTargetLowering::LowerMemOpCallTo(SDValue Chain,
     return CreateCopyOfByValArgument(Arg, PtrOff, Chain, Flags, DAG, dl);
   }
   return DAG.getStore(Chain, dl, Arg, PtrOff,
-                      PseudoSourceValue::getStack(), LocMemOffset);
+                      PseudoSourceValue::getStack(), LocMemOffset,
+                      false, false, 0);
 }
 
 void ARMTargetLowering::PassF64ArgInRegs(DebugLoc dl, SelectionDAG &DAG,
@@ -920,7 +924,7 @@ ARMTargetLowering::LowerCall(SDValue Chain, SDValue Callee,
   // These operations are automatically eliminated by the prolog/epilog pass
   Chain = DAG.getCALLSEQ_START(Chain, DAG.getIntPtrConstant(NumBytes, true));
 
-  SDValue StackPtr = DAG.getRegister(ARM::SP, MVT::i32);
+  SDValue StackPtr = DAG.getCopyFromReg(Chain, dl, ARM::SP, getPointerTy());
 
   RegsToPassVector RegsToPass;
   SmallVector<SDValue, 8> MemOpChains;
@@ -969,8 +973,6 @@ ARMTargetLowering::LowerCall(SDValue Chain, SDValue Callee,
                            VA, ArgLocs[++i], StackPtr, MemOpChains, Flags);
         } else {
           assert(VA.isMemLoc());
-          if (StackPtr.getNode() == 0)
-            StackPtr = DAG.getCopyFromReg(Chain, dl, ARM::SP, getPointerTy());
 
           MemOpChains.push_back(LowerMemOpCallTo(Chain, StackPtr, Op1,
                                                  dl, DAG, VA, Flags));
@@ -983,8 +985,6 @@ ARMTargetLowering::LowerCall(SDValue Chain, SDValue Callee,
       RegsToPass.push_back(std::make_pair(VA.getLocReg(), Arg));
     } else {
       assert(VA.isMemLoc());
-      if (StackPtr.getNode() == 0)
-        StackPtr = DAG.getCopyFromReg(Chain, dl, ARM::SP, getPointerTy());
 
       MemOpChains.push_back(LowerMemOpCallTo(Chain, StackPtr, Arg,
                                              dl, DAG, VA, Flags));
@@ -1031,7 +1031,8 @@ ARMTargetLowering::LowerCall(SDValue Chain, SDValue Callee,
       CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr);
       Callee = DAG.getLoad(getPointerTy(), dl,
                            DAG.getEntryNode(), CPAddr,
-                           PseudoSourceValue::getConstantPool(), 0);
+                           PseudoSourceValue::getConstantPool(), 0,
+                           false, false, 0);
       SDValue PICLabel = DAG.getConstant(ARMPCLabelIndex, MVT::i32);
       Callee = DAG.getNode(ARMISD::PIC_ADD, dl,
                            getPointerTy(), Callee, PICLabel);
@@ -1052,7 +1053,8 @@ ARMTargetLowering::LowerCall(SDValue Chain, SDValue Callee,
       CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr);
       Callee = DAG.getLoad(getPointerTy(), dl,
                            DAG.getEntryNode(), CPAddr,
-                           PseudoSourceValue::getConstantPool(), 0);
+                           PseudoSourceValue::getConstantPool(), 0,
+                           false, false, 0);
       SDValue PICLabel = DAG.getConstant(ARMPCLabelIndex, MVT::i32);
       Callee = DAG.getNode(ARMISD::PIC_ADD, dl,
                            getPointerTy(), Callee, PICLabel);
@@ -1238,7 +1240,8 @@ SDValue ARMTargetLowering::LowerBlockAddress(SDValue Op, SelectionDAG &DAG) {
   }
   CPAddr = DAG.getNode(ARMISD::Wrapper, DL, PtrVT, CPAddr);
   SDValue Result = DAG.getLoad(PtrVT, DL, DAG.getEntryNode(), CPAddr,
-                               PseudoSourceValue::getConstantPool(), 0);
+                               PseudoSourceValue::getConstantPool(), 0,
+                               false, false, 0);
   if (RelocM == Reloc::Static)
     return Result;
   SDValue PICLabel = DAG.getConstant(ARMPCLabelIndex, MVT::i32);
@@ -1261,7 +1264,8 @@ ARMTargetLowering::LowerToTLSGeneralDynamicModel(GlobalAddressSDNode *GA,
   SDValue Argument = DAG.getTargetConstantPool(CPV, PtrVT, 4);
   Argument = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, Argument);
   Argument = DAG.getLoad(PtrVT, dl, DAG.getEntryNode(), Argument,
-                         PseudoSourceValue::getConstantPool(), 0);
+                         PseudoSourceValue::getConstantPool(), 0,
+                         false, false, 0);
   SDValue Chain = Argument.getValue(1);
 
   SDValue PICLabel = DAG.getConstant(ARMPCLabelIndex, MVT::i32);
@@ -1278,8 +1282,7 @@ ARMTargetLowering::LowerToTLSGeneralDynamicModel(GlobalAddressSDNode *GA,
     LowerCallTo(Chain, (const Type *) Type::getInt32Ty(*DAG.getContext()),
                 false, false, false, false,
                 0, CallingConv::C, false, /*isReturnValueUsed=*/true,
-                DAG.getExternalSymbol("__tls_get_addr", PtrVT), Args, DAG, dl,
-                DAG.GetOrdering(Chain.getNode()));
+                DAG.getExternalSymbol("__tls_get_addr", PtrVT), Args, DAG, dl);
   return CallResult.first;
 }
 
@@ -1308,21 +1311,24 @@ ARMTargetLowering::LowerToTLSExecModels(GlobalAddressSDNode *GA,
     Offset = DAG.getTargetConstantPool(CPV, PtrVT, 4);
     Offset = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, Offset);
     Offset = DAG.getLoad(PtrVT, dl, Chain, Offset,
-                         PseudoSourceValue::getConstantPool(), 0);
+                         PseudoSourceValue::getConstantPool(), 0,
+                         false, false, 0);
     Chain = Offset.getValue(1);
 
     SDValue PICLabel = DAG.getConstant(ARMPCLabelIndex, MVT::i32);
     Offset = DAG.getNode(ARMISD::PIC_ADD, dl, PtrVT, Offset, PICLabel);
 
     Offset = DAG.getLoad(PtrVT, dl, Chain, Offset,
-                         PseudoSourceValue::getConstantPool(), 0);
+                         PseudoSourceValue::getConstantPool(), 0,
+                         false, false, 0);
   } else {
     // local exec model
     ARMConstantPoolValue *CPV = new ARMConstantPoolValue(GV, "tpoff");
     Offset = DAG.getTargetConstantPool(CPV, PtrVT, 4);
     Offset = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, Offset);
     Offset = DAG.getLoad(PtrVT, dl, Chain, Offset,
-                         PseudoSourceValue::getConstantPool(), 0);
+                         PseudoSourceValue::getConstantPool(), 0,
+                         false, false, 0);
   }
 
   // The address of the thread local variable is the add of the thread
@@ -1358,13 +1364,15 @@ SDValue ARMTargetLowering::LowerGlobalAddressELF(SDValue Op,
     CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr);
     SDValue Result = DAG.getLoad(PtrVT, dl, DAG.getEntryNode(),
                                  CPAddr,
-                                 PseudoSourceValue::getConstantPool(), 0);
+                                 PseudoSourceValue::getConstantPool(), 0,
+                                 false, false, 0);
     SDValue Chain = Result.getValue(1);
     SDValue GOT = DAG.getGLOBAL_OFFSET_TABLE(PtrVT);
     Result = DAG.getNode(ISD::ADD, dl, PtrVT, Result, GOT);
     if (!UseGOTOFF)
       Result = DAG.getLoad(PtrVT, dl, Chain, Result,
-                           PseudoSourceValue::getGOT(), 0);
+                           PseudoSourceValue::getGOT(), 0,
+                           false, false, 0);
     return Result;
   } else {
     // If we have T2 ops, we can materialize the address directly via movt/movw
@@ -1376,7 +1384,8 @@ SDValue ARMTargetLowering::LowerGlobalAddressELF(SDValue Op,
       SDValue CPAddr = DAG.getTargetConstantPool(GV, PtrVT, 4);
       CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr);
       return DAG.getLoad(PtrVT, dl, DAG.getEntryNode(), CPAddr,
-                         PseudoSourceValue::getConstantPool(), 0);
+                         PseudoSourceValue::getConstantPool(), 0,
+                         false, false, 0);
     }
   }
 }
@@ -1403,7 +1412,8 @@ SDValue ARMTargetLowering::LowerGlobalAddressDarwin(SDValue Op,
   CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr);
 
   SDValue Result = DAG.getLoad(PtrVT, dl, DAG.getEntryNode(), CPAddr,
-                               PseudoSourceValue::getConstantPool(), 0);
+                               PseudoSourceValue::getConstantPool(), 0,
+                               false, false, 0);
   SDValue Chain = Result.getValue(1);
 
   if (RelocM == Reloc::PIC_) {
@@ -1413,7 +1423,8 @@ SDValue ARMTargetLowering::LowerGlobalAddressDarwin(SDValue Op,
 
   if (Subtarget->GVIsIndirectSymbol(GV, RelocM))
     Result = DAG.getLoad(PtrVT, dl, Chain, Result,
-                         PseudoSourceValue::getGOT(), 0);
+                         PseudoSourceValue::getGOT(), 0,
+                         false, false, 0);
 
   return Result;
 }
@@ -1434,7 +1445,8 @@ SDValue ARMTargetLowering::LowerGLOBAL_OFFSET_TABLE(SDValue Op,
   SDValue CPAddr = DAG.getTargetConstantPool(CPV, PtrVT, 4);
   CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr);
   SDValue Result = DAG.getLoad(PtrVT, dl, DAG.getEntryNode(), CPAddr,
-                               PseudoSourceValue::getConstantPool(), 0);
+                               PseudoSourceValue::getConstantPool(), 0,
+                               false, false, 0);
   SDValue PICLabel = DAG.getConstant(ARMPCLabelIndex, MVT::i32);
   return DAG.getNode(ARMISD::PIC_ADD, dl, PtrVT, Result, PICLabel);
 }
@@ -1467,7 +1479,8 @@ ARMTargetLowering::LowerINTRINSIC_WO_CHAIN(SDValue Op, SelectionDAG &DAG,
     CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr);
     SDValue Result =
       DAG.getLoad(PtrVT, dl, DAG.getEntryNode(), CPAddr,
-                  PseudoSourceValue::getConstantPool(), 0);
+                  PseudoSourceValue::getConstantPool(), 0,
+                  false, false, 0);
     SDValue Chain = Result.getValue(1);
 
     if (RelocM == Reloc::PIC_) {
@@ -1515,7 +1528,8 @@ static SDValue LowerVASTART(SDValue Op, SelectionDAG &DAG,
   EVT PtrVT = DAG.getTargetLoweringInfo().getPointerTy();
   SDValue FR = DAG.getFrameIndex(VarArgsFrameIndex, PtrVT);
   const Value *SV = cast<SrcValueSDNode>(Op.getOperand(2))->getValue();
-  return DAG.getStore(Op.getOperand(0), dl, FR, Op.getOperand(1), SV, 0);
+  return DAG.getStore(Op.getOperand(0), dl, FR, Op.getOperand(1), SV, 0,
+                      false, false, 0);
 }
 
 SDValue
@@ -1592,7 +1606,8 @@ ARMTargetLowering::GetF64FormalArgument(CCValAssign &VA, CCValAssign &NextVA,
     // Create load node to retrieve arguments from the stack.
     SDValue FIN = DAG.getFrameIndex(FI, getPointerTy());
     ArgValue2 = DAG.getLoad(MVT::i32, dl, Root, FIN,
-                            PseudoSourceValue::getFixedStack(FI), 0);
+                            PseudoSourceValue::getFixedStack(FI), 0,
+                            false, false, 0);
   } else {
     Reg = MF.addLiveIn(NextVA.getLocReg(), RC);
     ArgValue2 = DAG.getCopyFromReg(Root, dl, Reg, MVT::i32);
@@ -1707,7 +1722,8 @@ ARMTargetLowering::LowerFormalArguments(SDValue Chain,
       // Create load nodes to retrieve arguments from the stack.
       SDValue FIN = DAG.getFrameIndex(FI, getPointerTy());
       InVals.push_back(DAG.getLoad(VA.getValVT(), dl, Chain, FIN,
-                                   PseudoSourceValue::getFixedStack(FI), 0));
+                                   PseudoSourceValue::getFixedStack(FI), 0,
+                                   false, false, 0));
     }
   }
 
@@ -1745,7 +1761,8 @@ ARMTargetLowering::LowerFormalArguments(SDValue Chain,
         unsigned VReg = MF.addLiveIn(GPRArgRegs[NumGPRs], RC);
         SDValue Val = DAG.getCopyFromReg(Chain, dl, VReg, MVT::i32);
         SDValue Store = DAG.getStore(Val.getValue(1), dl, Val, FIN,
-                        PseudoSourceValue::getFixedStack(VarArgsFrameIndex), 0);
+                                     PseudoSourceValue::getFixedStack(VarArgsFrameIndex), 0,
+                                     false, false, 0);
         MemOps.push_back(Store);
         FIN = DAG.getNode(ISD::ADD, dl, getPointerTy(), FIN,
                           DAG.getConstant(4, getPointerTy()));
@@ -1939,13 +1956,14 @@ SDValue ARMTargetLowering::LowerBR_JT(SDValue Op, SelectionDAG &DAG) {
   }
   if (getTargetMachine().getRelocationModel() == Reloc::PIC_) {
     Addr = DAG.getLoad((EVT)MVT::i32, dl, Chain, Addr,
-                       PseudoSourceValue::getJumpTable(), 0);
+                       PseudoSourceValue::getJumpTable(), 0,
+                       false, false, 0);
     Chain = Addr.getValue(1);
     Addr = DAG.getNode(ISD::ADD, dl, PTy, Addr, Table);
     return DAG.getNode(ARMISD::BR_JT, dl, MVT::Other, Chain, Addr, JTI, UId);
   } else {
     Addr = DAG.getLoad(PTy, dl, Chain, Addr,
-                       PseudoSourceValue::getJumpTable(), 0);
+                       PseudoSourceValue::getJumpTable(), 0, false, false, 0);
     Chain = Addr.getValue(1);
     return DAG.getNode(ARMISD::BR_JT, dl, MVT::Other, Chain, Addr, JTI, UId);
   }
@@ -1993,7 +2011,8 @@ SDValue ARMTargetLowering::LowerFRAMEADDR(SDValue Op, SelectionDAG &DAG) {
     ? ARM::R7 : ARM::R11;
   SDValue FrameAddr = DAG.getCopyFromReg(DAG.getEntryNode(), dl, FrameReg, VT);
   while (Depth--)
-    FrameAddr = DAG.getLoad(VT, dl, DAG.getEntryNode(), FrameAddr, NULL, 0);
+    FrameAddr = DAG.getLoad(VT, dl, DAG.getEntryNode(), FrameAddr, NULL, 0,
+                            false, false, 0);
   return FrameAddr;
 }
 
@@ -2038,7 +2057,7 @@ ARMTargetLowering::EmitTargetCodeForMemcpy(SelectionDAG &DAG, DebugLoc dl,
       Loads[i] = DAG.getLoad(VT, dl, Chain,
                              DAG.getNode(ISD::ADD, dl, MVT::i32, Src,
                                          DAG.getConstant(SrcOff, MVT::i32)),
-                             SrcSV, SrcSVOff + SrcOff);
+                             SrcSV, SrcSVOff + SrcOff, false, false, 0);
       TFOps[i] = Loads[i].getValue(1);
       SrcOff += VTSize;
     }
@@ -2047,9 +2066,9 @@ ARMTargetLowering::EmitTargetCodeForMemcpy(SelectionDAG &DAG, DebugLoc dl,
     for (i = 0;
          i < MAX_LOADS_IN_LDM && EmittedNumMemOps + i < NumMemOps; ++i) {
       TFOps[i] = DAG.getStore(Chain, dl, Loads[i],
-                           DAG.getNode(ISD::ADD, dl, MVT::i32, Dst,
-                                       DAG.getConstant(DstOff, MVT::i32)),
-                           DstSV, DstSVOff + DstOff);
+                              DAG.getNode(ISD::ADD, dl, MVT::i32, Dst,
+                                          DAG.getConstant(DstOff, MVT::i32)),
+                              DstSV, DstSVOff + DstOff, false, false, 0);
       DstOff += VTSize;
     }
     Chain = DAG.getNode(ISD::TokenFactor, dl, MVT::Other, &TFOps[0], i);
@@ -2075,7 +2094,7 @@ ARMTargetLowering::EmitTargetCodeForMemcpy(SelectionDAG &DAG, DebugLoc dl,
     Loads[i] = DAG.getLoad(VT, dl, Chain,
                            DAG.getNode(ISD::ADD, dl, MVT::i32, Src,
                                        DAG.getConstant(SrcOff, MVT::i32)),
-                           SrcSV, SrcSVOff + SrcOff);
+                           SrcSV, SrcSVOff + SrcOff, false, false, 0);
     TFOps[i] = Loads[i].getValue(1);
     ++i;
     SrcOff += VTSize;
@@ -2097,7 +2116,7 @@ ARMTargetLowering::EmitTargetCodeForMemcpy(SelectionDAG &DAG, DebugLoc dl,
     TFOps[i] = DAG.getStore(Chain, dl, Loads[i],
                             DAG.getNode(ISD::ADD, dl, MVT::i32, Dst,
                                         DAG.getConstant(DstOff, MVT::i32)),
-                            DstSV, DstSVOff + DstOff);
+                            DstSV, DstSVOff + DstOff, false, false, 0);
     ++i;
     DstOff += VTSize;
     BytesLeft -= VTSize;
@@ -3835,23 +3854,106 @@ static SDValue PerformExtendCombine(SDNode *N, SelectionDAG &DAG,
   return SDValue();
 }
 
+/// PerformSELECT_CCCombine - Target-specific DAG combining for ISD::SELECT_CC
+/// to match f32 max/min patterns to use NEON vmax/vmin instructions.
+static SDValue PerformSELECT_CCCombine(SDNode *N, SelectionDAG &DAG,
+                                       const ARMSubtarget *ST) {
+  // If the target supports NEON, try to use vmax/vmin instructions for f32
+  // selects like "x < y ? x : y".  Unless the FiniteOnlyFPMath option is set,
+  // be careful about NaNs:  NEON's vmax/vmin return NaN if either operand is
+  // a NaN; only do the transformation when it matches that behavior.
+
+  // For now only do this when using NEON for FP operations; if using VFP, it
+  // is not obvious that the benefit outweighs the cost of switching to the
+  // NEON pipeline.
+  if (!ST->hasNEON() || !ST->useNEONForSinglePrecisionFP() ||
+      N->getValueType(0) != MVT::f32)
+    return SDValue();
+
+  SDValue CondLHS = N->getOperand(0);
+  SDValue CondRHS = N->getOperand(1);
+  SDValue LHS = N->getOperand(2);
+  SDValue RHS = N->getOperand(3);
+  ISD::CondCode CC = cast<CondCodeSDNode>(N->getOperand(4))->get();
+
+  unsigned Opcode = 0;
+  bool IsReversed;
+  if (DAG.isEqualTo(LHS, CondLHS) && DAG.isEqualTo(RHS, CondRHS)) {
+    IsReversed = false; // x CC y ? x : y
+  } else if (DAG.isEqualTo(LHS, CondRHS) && DAG.isEqualTo(RHS, CondLHS)) {
+    IsReversed = true ; // x CC y ? y : x
+  } else {
+    return SDValue();
+  }
+
+  bool IsUnordered;
+  switch (CC) {
+  default: break;
+  case ISD::SETOLT:
+  case ISD::SETOLE:
+  case ISD::SETLT:
+  case ISD::SETLE:
+  case ISD::SETULT:
+  case ISD::SETULE:
+    // If LHS is NaN, an ordered comparison will be false and the result will
+    // be the RHS, but vmin(NaN, RHS) = NaN.  Avoid this by checking that LHS
+    // != NaN.  Likewise, for unordered comparisons, check for RHS != NaN.
+    IsUnordered = (CC == ISD::SETULT || CC == ISD::SETULE);
+    if (!DAG.isKnownNeverNaN(IsUnordered ? RHS : LHS))
+      break;
+    // For less-than-or-equal comparisons, "+0 <= -0" will be true but vmin
+    // will return -0, so vmin can only be used for unsafe math or if one of
+    // the operands is known to be nonzero.
+    if ((CC == ISD::SETLE || CC == ISD::SETOLE || CC == ISD::SETULE) &&
+        !UnsafeFPMath &&
+        !(DAG.isKnownNeverZero(LHS) || DAG.isKnownNeverZero(RHS)))
+      break;
+    Opcode = IsReversed ? ARMISD::FMAX : ARMISD::FMIN;
+    break;
+
+  case ISD::SETOGT:
+  case ISD::SETOGE:
+  case ISD::SETGT:
+  case ISD::SETGE:
+  case ISD::SETUGT:
+  case ISD::SETUGE:
+    // If LHS is NaN, an ordered comparison will be false and the result will
+    // be the RHS, but vmax(NaN, RHS) = NaN.  Avoid this by checking that LHS
+    // != NaN.  Likewise, for unordered comparisons, check for RHS != NaN.
+    IsUnordered = (CC == ISD::SETUGT || CC == ISD::SETUGE);
+    if (!DAG.isKnownNeverNaN(IsUnordered ? RHS : LHS))
+      break;
+    // For greater-than-or-equal comparisons, "-0 >= +0" will be true but vmax
+    // will return +0, so vmax can only be used for unsafe math or if one of
+    // the operands is known to be nonzero.
+    if ((CC == ISD::SETGE || CC == ISD::SETOGE || CC == ISD::SETUGE) &&
+        !UnsafeFPMath &&
+        !(DAG.isKnownNeverZero(LHS) || DAG.isKnownNeverZero(RHS)))
+      break;
+    Opcode = IsReversed ? ARMISD::FMIN : ARMISD::FMAX;
+    break;
+  }
+
+  if (!Opcode)
+    return SDValue();
+  return DAG.getNode(Opcode, N->getDebugLoc(), N->getValueType(0), LHS, RHS);
+}
+
 SDValue ARMTargetLowering::PerformDAGCombine(SDNode *N,
                                              DAGCombinerInfo &DCI) const {
   switch (N->getOpcode()) {
   default: break;
-  case ISD::ADD:      return PerformADDCombine(N, DCI);
-  case ISD::SUB:      return PerformSUBCombine(N, DCI);
+  case ISD::ADD:        return PerformADDCombine(N, DCI);
+  case ISD::SUB:        return PerformSUBCombine(N, DCI);
   case ARMISD::VMOVRRD: return PerformVMOVRRDCombine(N, DCI);
-  case ISD::INTRINSIC_WO_CHAIN:
-    return PerformIntrinsicCombine(N, DCI.DAG);
+  case ISD::INTRINSIC_WO_CHAIN: return PerformIntrinsicCombine(N, DCI.DAG);
   case ISD::SHL:
   case ISD::SRA:
-  case ISD::SRL:
-    return PerformShiftCombine(N, DCI.DAG, Subtarget);
+  case ISD::SRL:        return PerformShiftCombine(N, DCI.DAG, Subtarget);
   case ISD::SIGN_EXTEND:
   case ISD::ZERO_EXTEND:
-  case ISD::ANY_EXTEND:
-    return PerformExtendCombine(N, DCI.DAG, Subtarget);
+  case ISD::ANY_EXTEND: return PerformExtendCombine(N, DCI.DAG, Subtarget);
+  case ISD::SELECT_CC:  return PerformSELECT_CCCombine(N, DCI.DAG, Subtarget);
   }
   return SDValue();
 }
diff --git a/libclamav/c++/llvm/lib/Target/ARM/ARMISelLowering.h b/libclamav/c++/llvm/lib/Target/ARM/ARMISelLowering.h
index 3c5df45..f8f8adc 100644
--- a/libclamav/c++/llvm/lib/Target/ARM/ARMISelLowering.h
+++ b/libclamav/c++/llvm/lib/Target/ARM/ARMISelLowering.h
@@ -131,7 +131,11 @@ namespace llvm {
       VREV16,       // reverse elements within 16-bit halfwords
       VZIP,         // zip (interleave)
       VUZP,         // unzip (deinterleave)
-      VTRN          // transpose
+      VTRN,         // transpose
+
+      // Floating-point max and min:
+      FMAX,
+      FMIN
     };
   }
 
diff --git a/libclamav/c++/llvm/lib/Target/ARM/ARMInstrFormats.td b/libclamav/c++/llvm/lib/Target/ARM/ARMInstrFormats.td
index db60458..76595fa 100644
--- a/libclamav/c++/llvm/lib/Target/ARM/ARMInstrFormats.td
+++ b/libclamav/c++/llvm/lib/Target/ARM/ARMInstrFormats.td
@@ -708,6 +708,20 @@ class AI3ldsbpr<dag oops, dag iops, Format f, InstrItinClass itin,
   let Inst{24}    = 1; // P bit
   let Inst{27-25} = 0b000;
 }
+class AI3lddpr<dag oops, dag iops, Format f, InstrItinClass itin,
+             string opc, string asm, string cstr, list<dag> pattern>
+  : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
+      opc, asm, cstr, pattern> {
+  let Inst{4}     = 1;
+  let Inst{5}     = 0; // H bit
+  let Inst{6}     = 1; // S bit
+  let Inst{7}     = 1;
+  let Inst{20}    = 0; // L bit
+  let Inst{21}    = 1; // W bit
+  let Inst{24}    = 1; // P bit
+  let Inst{27-25} = 0b000;
+}
+
 
 // Pre-indexed stores
 class AI3sthpr<dag oops, dag iops, Format f, InstrItinClass itin,
@@ -723,6 +737,19 @@ class AI3sthpr<dag oops, dag iops, Format f, InstrItinClass itin,
   let Inst{24}    = 1; // P bit
   let Inst{27-25} = 0b000;
 }
+class AI3stdpr<dag oops, dag iops, Format f, InstrItinClass itin,
+             string opc, string asm, string cstr, list<dag> pattern>
+  : I<oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, itin,
+      opc, asm, cstr, pattern> {
+  let Inst{4}     = 1;
+  let Inst{5}     = 1; // H bit
+  let Inst{6}     = 1; // S bit
+  let Inst{7}     = 1;
+  let Inst{20}    = 0; // L bit
+  let Inst{21}    = 1; // W bit
+  let Inst{24}    = 1; // P bit
+  let Inst{27-25} = 0b000;
+}
 
 // Post-indexed loads
 class AI3ldhpo<dag oops, dag iops, Format f, InstrItinClass itin,
@@ -734,7 +761,7 @@ class AI3ldhpo<dag oops, dag iops, Format f, InstrItinClass itin,
   let Inst{6}     = 0; // S bit
   let Inst{7}     = 1;
   let Inst{20}    = 1; // L bit
-  let Inst{21}    = 1; // W bit
+  let Inst{21}    = 0; // W bit
   let Inst{24}    = 0; // P bit
   let Inst{27-25} = 0b000;
 }
@@ -747,7 +774,7 @@ class AI3ldshpo<dag oops, dag iops, Format f, InstrItinClass itin,
   let Inst{6}     = 1; // S bit
   let Inst{7}     = 1;
   let Inst{20}    = 1; // L bit
-  let Inst{21}    = 1; // W bit
+  let Inst{21}    = 0; // W bit
   let Inst{24}    = 0; // P bit
   let Inst{27-25} = 0b000;
 }
@@ -760,7 +787,20 @@ class AI3ldsbpo<dag oops, dag iops, Format f, InstrItinClass itin,
   let Inst{6}     = 1; // S bit
   let Inst{7}     = 1;
   let Inst{20}    = 1; // L bit
-  let Inst{21}    = 1; // W bit
+  let Inst{21}    = 0; // W bit
+  let Inst{24}    = 0; // P bit
+  let Inst{27-25} = 0b000;
+}
+class AI3lddpo<dag oops, dag iops, Format f, InstrItinClass itin,
+             string opc, string asm, string cstr, list<dag> pattern>
+  : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
+      opc, asm, cstr, pattern> {
+  let Inst{4}     = 1;
+  let Inst{5}     = 0; // H bit
+  let Inst{6}     = 1; // S bit
+  let Inst{7}     = 1;
+  let Inst{20}    = 0; // L bit
+  let Inst{21}    = 0; // W bit
   let Inst{24}    = 0; // P bit
   let Inst{27-25} = 0b000;
 }
@@ -775,7 +815,20 @@ class AI3sthpo<dag oops, dag iops, Format f, InstrItinClass itin,
   let Inst{6}     = 0; // S bit
   let Inst{7}     = 1;
   let Inst{20}    = 0; // L bit
-  let Inst{21}    = 1; // W bit
+  let Inst{21}    = 0; // W bit
+  let Inst{24}    = 0; // P bit
+  let Inst{27-25} = 0b000;
+}
+class AI3stdpo<dag oops, dag iops, Format f, InstrItinClass itin,
+             string opc, string asm, string cstr, list<dag> pattern>
+  : I<oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, itin,
+      opc, asm, cstr, pattern> {
+  let Inst{4}     = 1;
+  let Inst{5}     = 1; // H bit
+  let Inst{6}     = 1; // S bit
+  let Inst{7}     = 1;
+  let Inst{20}    = 0; // L bit
+  let Inst{21}    = 0; // W bit
   let Inst{24}    = 0; // P bit
   let Inst{27-25} = 0b000;
 }
@@ -1150,6 +1203,19 @@ class T2Iidxldst<bit signed, bits<2> opcod, bit load, bit pre,
   let Inst{8} = 1; // The W bit.
 }
 
+// Helper class for disassembly only
+// A6.3.16 & A6.3.17
+// T2Imac - Thumb2 multiply [accumulate, and absolute difference] instructions.
+class T2I_mac<bit long, bits<3> op22_20, bits<4> op7_4, dag oops, dag iops,
+             InstrItinClass itin, string opc, string asm, list<dag> pattern>
+  : T2I<oops, iops, itin, opc, asm, pattern> {
+  let Inst{31-27} = 0b11111;
+  let Inst{26-24} = 0b011;
+  let Inst{23} = long;
+  let Inst{22-20} = op22_20;
+  let Inst{7-4} = op7_4;
+}
+
 // Tv5Pat - Same as Pat<>, but requires V5T Thumb mode.
 class Tv5Pat<dag pattern, dag result> : Pat<pattern, result> {
   list<Predicate> Predicates = [IsThumb1Only, HasV5T];
diff --git a/libclamav/c++/llvm/lib/Target/ARM/ARMInstrInfo.td b/libclamav/c++/llvm/lib/Target/ARM/ARMInstrInfo.td
index c733215..87c6f6e 100644
--- a/libclamav/c++/llvm/lib/Target/ARM/ARMInstrInfo.td
+++ b/libclamav/c++/llvm/lib/Target/ARM/ARMInstrInfo.td
@@ -130,8 +130,6 @@ def IsThumb2  : Predicate<"Subtarget->isThumb2()">;
 def IsARM     : Predicate<"!Subtarget->isThumb()">;
 def IsDarwin    : Predicate<"Subtarget->isTargetDarwin()">;
 def IsNotDarwin : Predicate<"!Subtarget->isTargetDarwin()">;
-def CarryDefIsUnused : Predicate<"!N->hasAnyUseOfValue(1)">;
-def CarryDefIsUsed   : Predicate<"N->hasAnyUseOfValue(1)">;
 
 // FIXME: Eventually this will be just "hasV6T2Ops".
 def UseMovt   : Predicate<"Subtarget->useMovt()">;
@@ -176,7 +174,7 @@ def imm16_31 : PatLeaf<(i32 imm), [{
   return (int32_t)N->getZExtValue() >= 16 && (int32_t)N->getZExtValue() < 32;
 }]>;
 
-def so_imm_neg : 
+def so_imm_neg :
   PatLeaf<(imm), [{
     return ARM_AM::getSOImmVal(-(int)N->getZExtValue()) != -1;
   }], so_imm_neg_XFORM>;
@@ -194,7 +192,7 @@ def sext_16_node : PatLeaf<(i32 GPR:$a), [{
 /// bf_inv_mask_imm predicate - An AND mask to clear an arbitrary width bitfield
 /// e.g., 0xf000ffff
 def bf_inv_mask_imm : Operand<i32>,
-                      PatLeaf<(imm), [{ 
+                      PatLeaf<(imm), [{
   uint32_t v = (uint32_t)N->getZExtValue();
   if (v == 0xffffffff)
     return 0;
@@ -227,7 +225,7 @@ def lo16AllZero : PatLeaf<(i32 imm), [{
   return (((uint32_t)N->getZExtValue()) & 0xFFFFUL) == 0;
 }], hi16>;
 
-/// imm0_65535 predicate - True if the 32-bit immediate is in the range 
+/// imm0_65535 predicate - True if the 32-bit immediate is in the range
 /// [0.65535].
 def imm0_65535 : PatLeaf<(i32 imm), [{
   return (uint32_t)N->getZExtValue() < 65536;
@@ -236,6 +234,21 @@ def imm0_65535 : PatLeaf<(i32 imm), [{
 class BinOpFrag<dag res> : PatFrag<(ops node:$LHS, node:$RHS), res>;
 class UnOpFrag <dag res> : PatFrag<(ops node:$Src), res>;
 
+/// adde and sube predicates - True based on whether the carry flag output
+/// will be needed or not.
+def adde_dead_carry :
+  PatFrag<(ops node:$LHS, node:$RHS), (adde node:$LHS, node:$RHS),
+  [{return !N->hasAnyUseOfValue(1);}]>;
+def sube_dead_carry :
+  PatFrag<(ops node:$LHS, node:$RHS), (sube node:$LHS, node:$RHS),
+  [{return !N->hasAnyUseOfValue(1);}]>;
+def adde_live_carry :
+  PatFrag<(ops node:$LHS, node:$RHS), (adde node:$LHS, node:$RHS),
+  [{return N->hasAnyUseOfValue(1);}]>;
+def sube_live_carry :
+  PatFrag<(ops node:$LHS, node:$RHS), (sube node:$LHS, node:$RHS),
+  [{return N->hasAnyUseOfValue(1);}]>;
+
 //===----------------------------------------------------------------------===//
 // Operand Definitions.
 //
@@ -501,6 +514,22 @@ multiclass AI_unary_rrot<bits<8> opcod, string opc, PatFrag opnode> {
   }
 }
 
+multiclass AI_unary_rrot_np<bits<8> opcod, string opc> {
+  def r     : AExtI<opcod, (outs GPR:$dst), (ins GPR:$src),
+                 IIC_iUNAr, opc, "\t$dst, $src",
+                 [/* For disassembly only; pattern left blank */]>,
+              Requires<[IsARM, HasV6]> {
+    let Inst{11-10} = 0b00;
+    let Inst{19-16} = 0b1111;
+  }
+  def r_rot : AExtI<opcod, (outs GPR:$dst), (ins GPR:$src, i32imm:$rot),
+                 IIC_iUNAsi, opc, "\t$dst, $src, ror $rot",
+                 [/* For disassembly only; pattern left blank */]>,
+              Requires<[IsARM, HasV6]> {
+    let Inst{19-16} = 0b1111;
+  }
+}
+
 /// AI_bin_rrot - A binary operation with two forms: one whose operand is a
 /// register and one whose operand is a register rotated by 8/16/24.
 multiclass AI_bin_rrot<bits<8> opcod, string opc, PatFrag opnode> {
@@ -510,13 +539,29 @@ multiclass AI_bin_rrot<bits<8> opcod, string opc, PatFrag opnode> {
                Requires<[IsARM, HasV6]> {
     let Inst{11-10} = 0b00;
   }
-  def rr_rot : AExtI<opcod, (outs GPR:$dst), (ins GPR:$LHS, GPR:$RHS, i32imm:$rot),
+  def rr_rot : AExtI<opcod, (outs GPR:$dst), (ins GPR:$LHS, GPR:$RHS,
+                                              i32imm:$rot),
                   IIC_iALUsi, opc, "\t$dst, $LHS, $RHS, ror $rot",
                   [(set GPR:$dst, (opnode GPR:$LHS,
                                           (rotr GPR:$RHS, rot_imm:$rot)))]>,
                   Requires<[IsARM, HasV6]>;
 }
 
+// For disassembly only.
+multiclass AI_bin_rrot_np<bits<8> opcod, string opc> {
+  def rr     : AExtI<opcod, (outs GPR:$dst), (ins GPR:$LHS, GPR:$RHS),
+                  IIC_iALUr, opc, "\t$dst, $LHS, $RHS",
+                  [/* For disassembly only; pattern left blank */]>,
+               Requires<[IsARM, HasV6]> {
+    let Inst{11-10} = 0b00;
+  }
+  def rr_rot : AExtI<opcod, (outs GPR:$dst), (ins GPR:$LHS, GPR:$RHS,
+                                              i32imm:$rot),
+                  IIC_iALUsi, opc, "\t$dst, $LHS, $RHS, ror $rot",
+                  [/* For disassembly only; pattern left blank */]>,
+                  Requires<[IsARM, HasV6]>;
+}
+
 /// AI1_adde_sube_irs - Define instructions and patterns for adde and sube.
 let Uses = [CPSR] in {
 multiclass AI1_adde_sube_irs<bits<4> opcod, string opc, PatFrag opnode,
@@ -524,13 +569,13 @@ multiclass AI1_adde_sube_irs<bits<4> opcod, string opc, PatFrag opnode,
   def ri : AsI1<opcod, (outs GPR:$dst), (ins GPR:$a, so_imm:$b),
                 DPFrm, IIC_iALUi, opc, "\t$dst, $a, $b",
                [(set GPR:$dst, (opnode GPR:$a, so_imm:$b))]>,
-               Requires<[IsARM, CarryDefIsUnused]> {
+               Requires<[IsARM]> {
     let Inst{25} = 1;
   }
   def rr : AsI1<opcod, (outs GPR:$dst), (ins GPR:$a, GPR:$b),
                 DPFrm, IIC_iALUr, opc, "\t$dst, $a, $b",
                [(set GPR:$dst, (opnode GPR:$a, GPR:$b))]>,
-               Requires<[IsARM, CarryDefIsUnused]> {
+               Requires<[IsARM]> {
     let isCommutable = Commutable;
     let Inst{11-4} = 0b00000000;
     let Inst{25} = 0;
@@ -538,7 +583,7 @@ multiclass AI1_adde_sube_irs<bits<4> opcod, string opc, PatFrag opnode,
   def rs : AsI1<opcod, (outs GPR:$dst), (ins GPR:$a, so_reg:$b),
                 DPSoRegFrm, IIC_iALUsr, opc, "\t$dst, $a, $b",
                [(set GPR:$dst, (opnode GPR:$a, so_reg:$b))]>,
-               Requires<[IsARM, CarryDefIsUnused]> {
+               Requires<[IsARM]> {
     let Inst{25} = 0;
   }
 }
@@ -549,16 +594,14 @@ multiclass AI1_adde_sube_s_irs<bits<4> opcod, string opc, PatFrag opnode,
   def Sri : AXI1<opcod, (outs GPR:$dst), (ins GPR:$a, so_imm:$b),
                 DPFrm, IIC_iALUi, !strconcat(opc, "\t$dst, $a, $b"),
                [(set GPR:$dst, (opnode GPR:$a, so_imm:$b))]>,
-               Requires<[IsARM, CarryDefIsUsed]> {
-    let Defs = [CPSR];
+               Requires<[IsARM]> {
     let Inst{20} = 1;
     let Inst{25} = 1;
   }
   def Srr : AXI1<opcod, (outs GPR:$dst), (ins GPR:$a, GPR:$b),
                 DPFrm, IIC_iALUr, !strconcat(opc, "\t$dst, $a, $b"),
                [(set GPR:$dst, (opnode GPR:$a, GPR:$b))]>,
-               Requires<[IsARM, CarryDefIsUsed]> {
-    let Defs = [CPSR];
+               Requires<[IsARM]> {
     let Inst{11-4} = 0b00000000;
     let Inst{20} = 1;
     let Inst{25} = 0;
@@ -566,8 +609,7 @@ multiclass AI1_adde_sube_s_irs<bits<4> opcod, string opc, PatFrag opnode,
   def Srs : AXI1<opcod, (outs GPR:$dst), (ins GPR:$a, so_reg:$b),
                 DPSoRegFrm, IIC_iALUsr, !strconcat(opc, "\t$dst, $a, $b"),
                [(set GPR:$dst, (opnode GPR:$a, so_reg:$b))]>,
-               Requires<[IsARM, CarryDefIsUsed]> {
-    let Defs = [CPSR];
+               Requires<[IsARM]> {
     let Inst{20} = 1;
     let Inst{25} = 0;
   }
@@ -593,13 +635,16 @@ PseudoInst<(outs), (ins cpinst_operand:$instid, cpinst_operand:$cpidx,
                     i32imm:$size), NoItinerary,
            "${instid:label} ${cpidx:cpentry}", []>;
 
-let Defs = [SP], Uses = [SP] in {
+// FIXME: Marking these as hasSideEffects is necessary to prevent machine DCE
+// from removing one half of the matched pairs. That breaks PEI, which assumes
+// these will always be in pairs, and asserts if it finds otherwise. Better way?
+let Defs = [SP], Uses = [SP], hasSideEffects = 1 in {
 def ADJCALLSTACKUP :
 PseudoInst<(outs), (ins i32imm:$amt1, i32imm:$amt2, pred:$p), NoItinerary,
            "@ ADJCALLSTACKUP $amt1",
            [(ARMcallseq_end timm:$amt1, timm:$amt2)]>;
 
-def ADJCALLSTACKDOWN : 
+def ADJCALLSTACKDOWN :
 PseudoInst<(outs), (ins i32imm:$amt, pred:$p), NoItinerary,
            "@ ADJCALLSTACKDOWN $amt",
            [(ARMcallseq_start timm:$amt)]>;
@@ -633,6 +678,14 @@ def WFI : AI<(outs), (ins), MiscFrm, NoItinerary, "wfi", "",
   let Inst{7-0} = 0b00000011;
 }
 
+def SEL : AI<(outs GPR:$dst), (ins GPR:$a, GPR:$b), DPFrm, NoItinerary, "sel",
+             "\t$dst, $a, $b",
+             [/* For disassembly only; pattern left blank */]>,
+          Requires<[IsARM, HasV6]> {
+  let Inst{27-20} = 0b01101000;
+  let Inst{7-4} = 0b1011;
+}
+
 def SEV : AI<(outs), (ins), MiscFrm, NoItinerary, "sev", "",
              [/* For disassembly only; pattern left blank */]>,
           Requires<[IsARM, HasV6T2]> {
@@ -664,6 +717,34 @@ def CPS : AXI<(outs),(ins i32imm:$opt), MiscFrm, NoItinerary, "cps${opt:cps}",
   let Inst{5} = 0;
 }
 
+// Preload signals the memory system of possible future data/instruction access.
+// These are for disassembly only.
+multiclass APreLoad<bit data, bit read, string opc> {
+
+  def i : AXI<(outs), (ins GPR:$base, i32imm:$imm), MiscFrm, NoItinerary,
+               !strconcat(opc, "\t[$base, $imm]"), []> {
+    let Inst{31-26} = 0b111101;
+    let Inst{25} = 0; // 0 for immediate form
+    let Inst{24} = data;
+    let Inst{22} = read;
+    let Inst{21-20} = 0b01;
+  }
+
+  def r : AXI<(outs), (ins addrmode2:$addr), MiscFrm, NoItinerary,
+               !strconcat(opc, "\t$addr"), []> {
+    let Inst{31-26} = 0b111101;
+    let Inst{25} = 1; // 1 for register form
+    let Inst{24} = data;
+    let Inst{22} = read;
+    let Inst{21-20} = 0b01;
+    let Inst{4} = 0;
+  }
+}
+
+defm PLD  : APreLoad<1, 1, "pld">;
+defm PLDW : APreLoad<1, 0, "pldw">;
+defm PLI  : APreLoad<0, 1, "pli">;
+
 def SETENDBE : AXI<(outs),(ins), MiscFrm, NoItinerary, "setend\tbe",
                    [/* For disassembly only; pattern left blank */]>,
                Requires<[IsARM]> {
@@ -761,7 +842,7 @@ def LEApcrelJT : AXI1<0x0, (outs GPR:$dst),
                          "(${label}_${id}-(",
                                   "${:private}PCRELL${:uid}+8))\n"),
                        !strconcat("${:private}PCRELL${:uid}:\n\t",
-                                  "add$p\t$dst, pc, #${:private}PCRELV${:uid}")),
+                                 "add$p\t$dst, pc, #${:private}PCRELV${:uid}")),
                    []> {
     let Inst{25} = 1;
 }
@@ -771,7 +852,7 @@ def LEApcrelJT : AXI1<0x0, (outs GPR:$dst),
 //
 
 let isReturn = 1, isTerminator = 1, isBarrier = 1 in
-  def BX_RET : AI<(outs), (ins), BrMiscFrm, IIC_Br, 
+  def BX_RET : AI<(outs), (ins), BrMiscFrm, IIC_Br,
                   "bx", "\tlr", [(ARMretflag)]> {
   let Inst{3-0}   = 0b1110;
   let Inst{7-4}   = 0b0001;
@@ -828,9 +909,10 @@ let isCall = 1,
   }
 
   // ARMv4T
-  def BX : ABXIx2<(outs), (ins GPR:$func, variable_ops),
+  // Note: Restrict $func to the tGPR regclass to prevent it being in LR.
+  def BX : ABXIx2<(outs), (ins tGPR:$func, variable_ops),
                   IIC_Br, "mov\tlr, pc\n\tbx\t$func",
-                  [(ARMcall_nolink GPR:$func)]>,
+                  [(ARMcall_nolink tGPR:$func)]>,
            Requires<[IsARM, IsNotDarwin]> {
     let Inst{7-4}   = 0b0001;
     let Inst{19-8}  = 0b111111111111;
@@ -865,9 +947,10 @@ let isCall = 1,
   }
 
   // ARMv4T
-  def BXr9 : ABXIx2<(outs), (ins GPR:$func, variable_ops),
+  // Note: Restrict $func to the tGPR regclass to prevent it being in LR.
+  def BXr9 : ABXIx2<(outs), (ins tGPR:$func, variable_ops),
                   IIC_Br, "mov\tlr, pc\n\tbx\t$func",
-                  [(ARMcall_nolink GPR:$func)]>, Requires<[IsARM, IsDarwin]> {
+                  [(ARMcall_nolink tGPR:$func)]>, Requires<[IsARM, IsDarwin]> {
     let Inst{7-4}   = 0b0001;
     let Inst{19-8}  = 0b111111111111;
     let Inst{27-20} = 0b00010010;
@@ -917,7 +1000,7 @@ let isBranch = 1, isTerminator = 1 in {
   } // isBarrier = 1
 
   // FIXME: should be able to write a pattern for ARMBrcond, but can't use
-  // a two-value operand where a dag node expects two operands. :( 
+  // a two-value operand where a dag node expects two operands. :(
   def Bcc : ABI<0b1010, (outs), (ins brtarget:$target),
                IIC_Br, "b", "\t$target",
                [/*(ARMbrcond bb:$target, imm:$cc, CCR:$ccr)*/]>;
@@ -931,25 +1014,61 @@ def BXJ : ABI<0b0001, (outs), (ins GPR:$func), NoItinerary, "bxj", "\t$func",
   let Inst{7-4} = 0b0010;
 }
 
-// Supervisor call (software interrupt) -- for disassembly only
+// Secure Monitor Call is a system instruction -- for disassembly only
+def SMC : ABI<0b0001, (outs), (ins i32imm:$opt), NoItinerary, "smc", "\t$opt",
+              [/* For disassembly only; pattern left blank */]> {
+  let Inst{23-20} = 0b0110;
+  let Inst{7-4} = 0b0111;
+}
+
+// Supervisor Call (Software Interrupt) -- for disassembly only
 let isCall = 1 in {
 def SVC : ABI<0b1111, (outs), (ins i32imm:$svc), IIC_Br, "svc", "\t$svc",
               [/* For disassembly only; pattern left blank */]>;
 }
 
+// Store Return State is a system instruction -- for disassembly only
+def SRSW : ABXI<{1,0,0,?}, (outs), (ins addrmode4:$addr, i32imm:$mode),
+                NoItinerary, "srs${addr:submode}\tsp!, $mode",
+                [/* For disassembly only; pattern left blank */]> {
+  let Inst{31-28} = 0b1111;
+  let Inst{22-20} = 0b110; // W = 1
+}
+
+def SRS  : ABXI<{1,0,0,?}, (outs), (ins addrmode4:$addr, i32imm:$mode),
+                NoItinerary, "srs${addr:submode}\tsp, $mode",
+                [/* For disassembly only; pattern left blank */]> {
+  let Inst{31-28} = 0b1111;
+  let Inst{22-20} = 0b100; // W = 0
+}
+
+// Return From Exception is a system instruction -- for disassembly only
+def RFEW : ABXI<{1,0,0,?}, (outs), (ins addrmode4:$addr, GPR:$base),
+                NoItinerary, "rfe${addr:submode}\t$base!",
+                [/* For disassembly only; pattern left blank */]> {
+  let Inst{31-28} = 0b1111;
+  let Inst{22-20} = 0b011; // W = 1
+}
+
+def RFE  : ABXI<{1,0,0,?}, (outs), (ins addrmode4:$addr, GPR:$base),
+                NoItinerary, "rfe${addr:submode}\t$base",
+                [/* For disassembly only; pattern left blank */]> {
+  let Inst{31-28} = 0b1111;
+  let Inst{22-20} = 0b001; // W = 0
+}
+
 //===----------------------------------------------------------------------===//
 //  Load / store Instructions.
 //
 
 // Load
-let canFoldAsLoad = 1, isReMaterializable = 1, mayHaveSideEffects = 1 in 
+let canFoldAsLoad = 1, isReMaterializable = 1 in
 def LDR  : AI2ldw<(outs GPR:$dst), (ins addrmode2:$addr), LdFrm, IIC_iLoadr,
                "ldr", "\t$dst, $addr",
                [(set GPR:$dst, (load addrmode2:$addr))]>;
 
 // Special LDR for loads from non-pc-relative constpools.
-let canFoldAsLoad = 1, mayLoad = 1, isReMaterializable = 1,
-    mayHaveSideEffects = 1  in
+let canFoldAsLoad = 1, mayLoad = 1, isReMaterializable = 1 in
 def LDRcp : AI2ldw<(outs GPR:$dst), (ins addrmode2:$addr), LdFrm, IIC_iLoadr,
                  "ldr", "\t$dst, $addr", []>;
 
@@ -958,7 +1077,7 @@ def LDRH  : AI3ldh<(outs GPR:$dst), (ins addrmode3:$addr), LdMiscFrm,
                   IIC_iLoadr, "ldrh", "\t$dst, $addr",
                   [(set GPR:$dst, (zextloadi16 addrmode3:$addr))]>;
 
-def LDRB  : AI2ldb<(outs GPR:$dst), (ins addrmode2:$addr), LdFrm, 
+def LDRB  : AI2ldb<(outs GPR:$dst), (ins addrmode2:$addr), LdFrm,
                   IIC_iLoadr, "ldrb", "\t$dst, $addr",
                   [(set GPR:$dst, (zextloadi8 addrmode2:$addr))]>;
 
@@ -1017,9 +1136,22 @@ def LDRSB_PRE : AI3ldsbpr<(outs GPR:$dst, GPR:$base_wb),
 def LDRSB_POST: AI3ldsbpo<(outs GPR:$dst, GPR:$base_wb),
                       (ins GPR:$base,am3offset:$offset), LdMiscFrm, IIC_iLoadru,
                    "ldrsb", "\t$dst, [$base], $offset", "$base = $base_wb", []>;
+
+// For disassembly only
+def LDRD_PRE : AI3lddpr<(outs GPR:$dst1, GPR:$dst2, GPR:$base_wb),
+                        (ins addrmode3:$addr), LdMiscFrm, IIC_iLoadr,
+                 "ldrd", "\t$dst1, $dst2, $addr!", "$addr.base = $base_wb", []>,
+                Requires<[IsARM, HasV5TE]>;
+
+// For disassembly only
+def LDRD_POST : AI3lddpo<(outs GPR:$dst1, GPR:$dst2, GPR:$base_wb),
+                       (ins GPR:$base,am3offset:$offset), LdMiscFrm, IIC_iLoadr,
+            "ldrd", "\t$dst1, $dst2, [$base], $offset", "$base = $base_wb", []>,
+                Requires<[IsARM, HasV5TE]>;
+
 }
 
-// LDRT and LDRBT are for disassembly only.
+// LDRT, LDRBT, LDRSBT, LDRHT, LDRSHT are for disassembly only.
 
 def LDRT : AI2ldwpo<(outs GPR:$dst, GPR:$base_wb),
                    (ins GPR:$base, am2offset:$offset), LdFrm, IIC_iLoadru,
@@ -1028,8 +1160,26 @@ def LDRT : AI2ldwpo<(outs GPR:$dst, GPR:$base_wb),
 }
 
 def LDRBT : AI2ldbpo<(outs GPR:$dst, GPR:$base_wb),
-                   (ins GPR:$base,am2offset:$offset), LdFrm, IIC_iLoadru,
-                   "ldrb", "\t$dst, [$base], $offset", "$base = $base_wb", []> {
+                  (ins GPR:$base,am2offset:$offset), LdFrm, IIC_iLoadru,
+                  "ldrbt", "\t$dst, [$base], $offset", "$base = $base_wb", []> {
+  let Inst{21} = 1; // overwrite
+}
+
+def LDRSBT : AI3ldsbpo<(outs GPR:$dst, GPR:$base_wb),
+                 (ins GPR:$base,am2offset:$offset), LdMiscFrm, IIC_iLoadru,
+                 "ldrsbt", "\t$dst, [$base], $offset", "$base = $base_wb", []> {
+  let Inst{21} = 1; // overwrite
+}
+
+def LDRHT : AI3ldhpo<(outs GPR:$dst, GPR:$base_wb),
+                  (ins GPR:$base, am3offset:$offset), LdMiscFrm, IIC_iLoadru,
+                  "ldrht", "\t$dst, [$base], $offset", "$base = $base_wb", []> {
+  let Inst{21} = 1; // overwrite
+}
+
+def LDRSHT : AI3ldshpo<(outs GPR:$dst, GPR:$base_wb),
+                 (ins GPR:$base,am3offset:$offset), LdMiscFrm, IIC_iLoadru,
+                 "ldrsht", "\t$dst, [$base], $offset", "$base = $base_wb", []> {
   let Inst{21} = 1; // overwrite
 }
 
@@ -1039,8 +1189,8 @@ def STR  : AI2stw<(outs), (ins GPR:$src, addrmode2:$addr), StFrm, IIC_iStorer,
                [(store GPR:$src, addrmode2:$addr)]>;
 
 // Stores with truncate
-def STRH : AI3sth<(outs), (ins GPR:$src, addrmode3:$addr), StMiscFrm, IIC_iStorer,
-               "strh", "\t$src, $addr",
+def STRH : AI3sth<(outs), (ins GPR:$src, addrmode3:$addr), StMiscFrm,
+               IIC_iStorer, "strh", "\t$src, $addr",
                [(truncstorei16 GPR:$src, addrmode3:$addr)]>;
 
 def STRB : AI2stb<(outs), (ins GPR:$src, addrmode2:$addr), StFrm, IIC_iStorer,
@@ -1055,51 +1205,65 @@ def STRD : AI3std<(outs), (ins GPR:$src1, GPR:$src2, addrmode3:$addr),
 
 // Indexed stores
 def STR_PRE  : AI2stwpr<(outs GPR:$base_wb),
-                     (ins GPR:$src, GPR:$base, am2offset:$offset), 
+                     (ins GPR:$src, GPR:$base, am2offset:$offset),
                      StFrm, IIC_iStoreru,
                     "str", "\t$src, [$base, $offset]!", "$base = $base_wb",
                     [(set GPR:$base_wb,
                       (pre_store GPR:$src, GPR:$base, am2offset:$offset))]>;
 
 def STR_POST : AI2stwpo<(outs GPR:$base_wb),
-                     (ins GPR:$src, GPR:$base,am2offset:$offset), 
+                     (ins GPR:$src, GPR:$base,am2offset:$offset),
                      StFrm, IIC_iStoreru,
                     "str", "\t$src, [$base], $offset", "$base = $base_wb",
                     [(set GPR:$base_wb,
                       (post_store GPR:$src, GPR:$base, am2offset:$offset))]>;
 
 def STRH_PRE : AI3sthpr<(outs GPR:$base_wb),
-                     (ins GPR:$src, GPR:$base,am3offset:$offset), 
+                     (ins GPR:$src, GPR:$base,am3offset:$offset),
                      StMiscFrm, IIC_iStoreru,
                      "strh", "\t$src, [$base, $offset]!", "$base = $base_wb",
                     [(set GPR:$base_wb,
                       (pre_truncsti16 GPR:$src, GPR:$base,am3offset:$offset))]>;
 
 def STRH_POST: AI3sthpo<(outs GPR:$base_wb),
-                     (ins GPR:$src, GPR:$base,am3offset:$offset), 
+                     (ins GPR:$src, GPR:$base,am3offset:$offset),
                      StMiscFrm, IIC_iStoreru,
                      "strh", "\t$src, [$base], $offset", "$base = $base_wb",
                     [(set GPR:$base_wb, (post_truncsti16 GPR:$src,
                                          GPR:$base, am3offset:$offset))]>;
 
 def STRB_PRE : AI2stbpr<(outs GPR:$base_wb),
-                     (ins GPR:$src, GPR:$base,am2offset:$offset), 
+                     (ins GPR:$src, GPR:$base,am2offset:$offset),
                      StFrm, IIC_iStoreru,
                      "strb", "\t$src, [$base, $offset]!", "$base = $base_wb",
                     [(set GPR:$base_wb, (pre_truncsti8 GPR:$src,
                                          GPR:$base, am2offset:$offset))]>;
 
 def STRB_POST: AI2stbpo<(outs GPR:$base_wb),
-                     (ins GPR:$src, GPR:$base,am2offset:$offset), 
+                     (ins GPR:$src, GPR:$base,am2offset:$offset),
                      StFrm, IIC_iStoreru,
                      "strb", "\t$src, [$base], $offset", "$base = $base_wb",
                     [(set GPR:$base_wb, (post_truncsti8 GPR:$src,
                                          GPR:$base, am2offset:$offset))]>;
 
-// STRT and STRBT are for disassembly only.
+// For disassembly only
+def STRD_PRE : AI3stdpr<(outs GPR:$base_wb),
+                     (ins GPR:$src1, GPR:$src2, GPR:$base, am3offset:$offset),
+                     StMiscFrm, IIC_iStoreru,
+                     "strd", "\t$src1, $src2, [$base, $offset]!",
+                     "$base = $base_wb", []>;
+
+// For disassembly only
+def STRD_POST: AI3stdpo<(outs GPR:$base_wb),
+                     (ins GPR:$src1, GPR:$src2, GPR:$base, am3offset:$offset),
+                     StMiscFrm, IIC_iStoreru,
+                     "strd", "\t$src1, $src2, [$base], $offset",
+                     "$base = $base_wb", []>;
+
+// STRT, STRBT, and STRHT are for disassembly only.
 
 def STRT : AI2stwpo<(outs GPR:$base_wb),
-                    (ins GPR:$src, GPR:$base,am2offset:$offset), 
+                    (ins GPR:$src, GPR:$base,am2offset:$offset),
                     StFrm, IIC_iStoreru,
                     "strt", "\t$src, [$base], $offset", "$base = $base_wb",
                     [/* For disassembly only; pattern left blank */]> {
@@ -1107,13 +1271,21 @@ def STRT : AI2stwpo<(outs GPR:$base_wb),
 }
 
 def STRBT : AI2stbpo<(outs GPR:$base_wb),
-                     (ins GPR:$src, GPR:$base,am2offset:$offset), 
+                     (ins GPR:$src, GPR:$base,am2offset:$offset),
                      StFrm, IIC_iStoreru,
                      "strbt", "\t$src, [$base], $offset", "$base = $base_wb",
                      [/* For disassembly only; pattern left blank */]> {
   let Inst{21} = 1; // overwrite
 }
 
+def STRHT: AI3sthpo<(outs GPR:$base_wb),
+                    (ins GPR:$src, GPR:$base,am3offset:$offset),
+                    StMiscFrm, IIC_iStoreru,
+                    "strht", "\t$src, [$base], $offset", "$base = $base_wb",
+                    [/* For disassembly only; pattern left blank */]> {
+  let Inst{21} = 1; // overwrite
+}
+
 //===----------------------------------------------------------------------===//
 //  Load / store multiple Instructions.
 //
@@ -1141,7 +1313,7 @@ def MOVr : AsI1<0b1101, (outs GPR:$dst), (ins GPR:$src), DPFrm, IIC_iMOVr,
   let Inst{25} = 0;
 }
 
-def MOVs : AsI1<0b1101, (outs GPR:$dst), (ins so_reg:$src), 
+def MOVs : AsI1<0b1101, (outs GPR:$dst), (ins so_reg:$src),
                 DPSoRegFrm, IIC_iMOVsr,
                 "mov", "\t$dst, $src", [(set GPR:$dst, so_reg:$src)]>, UnaryDP {
   let Inst{25} = 0;
@@ -1154,7 +1326,7 @@ def MOVi : AsI1<0b1101, (outs GPR:$dst), (ins so_imm:$src), DPFrm, IIC_iMOVi,
 }
 
 let isReMaterializable = 1, isAsCheapAsAMove = 1 in
-def MOVi16 : AI1<0b1000, (outs GPR:$dst), (ins i32imm:$src), 
+def MOVi16 : AI1<0b1000, (outs GPR:$dst), (ins i32imm:$src),
                  DPFrm, IIC_iMOVi,
                  "movw", "\t$dst, $src",
                  [(set GPR:$dst, imm0_65535:$src)]>,
@@ -1168,7 +1340,7 @@ def MOVTi16 : AI1<0b1010, (outs GPR:$dst), (ins GPR:$src, i32imm:$imm),
                   DPFrm, IIC_iMOVi,
                   "movt", "\t$dst, $imm",
                   [(set GPR:$dst,
-                        (or (and GPR:$src, 0xffff), 
+                        (or (and GPR:$src, 0xffff),
                             lo16AllZero:$imm))]>, UnaryDP,
                   Requires<[IsARM, HasV6T2]> {
   let Inst{20} = 0;
@@ -1187,7 +1359,7 @@ def MOVrx : AsI1<0b1101, (outs GPR:$dst), (ins GPR:$src), Pseudo, IIC_iMOVsi,
 // due to flag operands.
 
 let Defs = [CPSR] in {
-def MOVsrl_flag : AI1<0b1101, (outs GPR:$dst), (ins GPR:$src), Pseudo, 
+def MOVsrl_flag : AI1<0b1101, (outs GPR:$dst), (ins GPR:$src), Pseudo,
                       IIC_iMOVsi, "movs", "\t$dst, $src, lsr #1",
                       [(set GPR:$dst, (ARMsrl_flag GPR:$src))]>, UnaryDP;
 def MOVsra_flag : AI1<0b1101, (outs GPR:$dst), (ins GPR:$src), Pseudo,
@@ -1211,7 +1383,11 @@ defm SXTAB : AI_bin_rrot<0b01101010,
 defm SXTAH : AI_bin_rrot<0b01101011,
                "sxtah", BinOpFrag<(add node:$LHS, (sext_inreg node:$RHS,i16))>>;
 
-// TODO: SXT(A){B|H}16
+// For disassembly only
+defm SXTB16  : AI_unary_rrot_np<0b01101000, "sxtb16">;
+
+// For disassembly only
+defm SXTAB16 : AI_bin_rrot_np<0b01101000, "sxtab16">;
 
 // Zero extenders
 
@@ -1235,9 +1411,9 @@ defm UXTAH : AI_bin_rrot<0b01101111, "uxtah",
 }
 
 // This isn't safe in general, the add is two 16-bit units, not a 32-bit add.
-//defm UXTAB16 : xxx<"uxtab16", 0xff00ff>;
+// For disassembly only
+defm UXTAB16 : AI_bin_rrot_np<0b01101100, "uxtab16">;
 
-// TODO: UXT(A){B|H}16
 
 def SBFX  : I<(outs GPR:$dst),
               (ins GPR:$src, imm0_31:$lsb, imm0_31:$width),
@@ -1273,13 +1449,13 @@ defm SUBS : AI1_bin_s_irs<0b0010, "subs",
                           BinOpFrag<(subc node:$LHS, node:$RHS)>>;
 
 defm ADC : AI1_adde_sube_irs<0b0101, "adc",
-                             BinOpFrag<(adde node:$LHS, node:$RHS)>, 1>;
+                          BinOpFrag<(adde_dead_carry node:$LHS, node:$RHS)>, 1>;
 defm SBC : AI1_adde_sube_irs<0b0110, "sbc",
-                             BinOpFrag<(sube node:$LHS, node:$RHS)>>;
+                          BinOpFrag<(sube_dead_carry node:$LHS, node:$RHS)>>;
 defm ADCS : AI1_adde_sube_s_irs<0b0101, "adcs",
-                             BinOpFrag<(adde node:$LHS, node:$RHS)>, 1>;
+                          BinOpFrag<(adde_live_carry node:$LHS, node:$RHS)>, 1>;
 defm SBCS : AI1_adde_sube_s_irs<0b0110, "sbcs",
-                             BinOpFrag<(sube node:$LHS, node:$RHS)>>;
+                          BinOpFrag<(sube_live_carry node:$LHS, node:$RHS) >>;
 
 // These don't define reg/reg forms, because they are handled above.
 def RSBri : AsI1<0b0011, (outs GPR:$dst), (ins GPR:$a, so_imm:$b), DPFrm,
@@ -1313,14 +1489,14 @@ def RSBSrs : AI1<0b0011, (outs GPR:$dst), (ins GPR:$a, so_reg:$b), DPSoRegFrm,
 let Uses = [CPSR] in {
 def RSCri : AsI1<0b0111, (outs GPR:$dst), (ins GPR:$a, so_imm:$b),
                  DPFrm, IIC_iALUi, "rsc", "\t$dst, $a, $b",
-                 [(set GPR:$dst, (sube so_imm:$b, GPR:$a))]>,
-                 Requires<[IsARM, CarryDefIsUnused]> {
+                 [(set GPR:$dst, (sube_dead_carry so_imm:$b, GPR:$a))]>,
+                 Requires<[IsARM]> {
     let Inst{25} = 1;
 }
 def RSCrs : AsI1<0b0111, (outs GPR:$dst), (ins GPR:$a, so_reg:$b),
                  DPSoRegFrm, IIC_iALUsr, "rsc", "\t$dst, $a, $b",
-                 [(set GPR:$dst, (sube so_reg:$b, GPR:$a))]>,
-                 Requires<[IsARM, CarryDefIsUnused]> {
+                 [(set GPR:$dst, (sube_dead_carry so_reg:$b, GPR:$a))]>,
+                 Requires<[IsARM]> {
     let Inst{25} = 0;
 }
 }
@@ -1329,15 +1505,15 @@ def RSCrs : AsI1<0b0111, (outs GPR:$dst), (ins GPR:$a, so_reg:$b),
 let Defs = [CPSR], Uses = [CPSR] in {
 def RSCSri : AXI1<0b0111, (outs GPR:$dst), (ins GPR:$a, so_imm:$b),
                   DPFrm, IIC_iALUi, "rscs\t$dst, $a, $b",
-                  [(set GPR:$dst, (sube so_imm:$b, GPR:$a))]>,
-                  Requires<[IsARM, CarryDefIsUnused]> {
+                  [(set GPR:$dst, (sube_dead_carry so_imm:$b, GPR:$a))]>,
+                  Requires<[IsARM]> {
     let Inst{20} = 1;
     let Inst{25} = 1;
 }
 def RSCSrs : AXI1<0b0111, (outs GPR:$dst), (ins GPR:$a, so_reg:$b),
                   DPSoRegFrm, IIC_iALUsr, "rscs\t$dst, $a, $b",
-                  [(set GPR:$dst, (sube so_reg:$b, GPR:$a))]>,
-                  Requires<[IsARM, CarryDefIsUnused]> {
+                  [(set GPR:$dst, (sube_dead_carry so_reg:$b, GPR:$a))]>,
+                  Requires<[IsARM]> {
     let Inst{20} = 1;
     let Inst{25} = 0;
 }
@@ -1358,63 +1534,126 @@ def : ARMPat<(add    GPR:$src, so_imm_neg:$imm),
 // (mul X, 2^n+1) -> (add (X << n), X)
 // (mul X, 2^n-1) -> (rsb X, (X << n))
 
-// Saturating adds/subtracts -- for disassembly only
-
+// ARM Arithmetic Instruction -- for disassembly only
 // GPR:$dst = GPR:$a op GPR:$b
-class AQI<bits<8> op27_20, bits<4> op7_4, string opc, list<dag> pattern>
+class AAI<bits<8> op27_20, bits<4> op7_4, string opc>
   : AI<(outs GPR:$dst), (ins GPR:$a, GPR:$b), DPFrm, IIC_iALUr,
-       opc, "\t$dst, $a, $b", pattern> {
+       opc, "\t$dst, $a, $b",
+       [/* For disassembly only; pattern left blank */]> {
   let Inst{27-20} = op27_20;
   let Inst{7-4} = op7_4;
 }
 
-def QADD    : AQI<0b00010000, 0b0101, "qadd",
-                  [/* For disassembly only; pattern left blank */]>;
-
-def QADD16  : AQI<0b01100010, 0b0001, "qadd16",
-                  [/* For disassembly only; pattern left blank */]>;
-
-def QADD8   : AQI<0b01100010, 0b1001, "qadd8",
-                  [/* For disassembly only; pattern left blank */]>;
-
-def QASX    : AQI<0b01100010, 0b0011, "qasx",
-                  [/* For disassembly only; pattern left blank */]>;
-
-def QDADD   : AQI<0b00010100, 0b0101, "qdadd",
-                  [/* For disassembly only; pattern left blank */]>;
-
-def QDSUB   : AQI<0b00010110, 0b0101, "qdsub",
-                  [/* For disassembly only; pattern left blank */]>;
-
-def QSAX    : AQI<0b01100010, 0b0101, "qsax",
-                  [/* For disassembly only; pattern left blank */]>;
-
-def QSUB    : AQI<0b00010010, 0b0101, "qsub",
-                  [/* For disassembly only; pattern left blank */]>;
-
-def QSUB16  : AQI<0b01100010, 0b0111, "qsub16",
-                  [/* For disassembly only; pattern left blank */]>;
+// Saturating add/subtract -- for disassembly only
+
+def QADD    : AAI<0b00010000, 0b0101, "qadd">;
+def QADD16  : AAI<0b01100010, 0b0001, "qadd16">;
+def QADD8   : AAI<0b01100010, 0b1001, "qadd8">;
+def QASX    : AAI<0b01100010, 0b0011, "qasx">;
+def QDADD   : AAI<0b00010100, 0b0101, "qdadd">;
+def QDSUB   : AAI<0b00010110, 0b0101, "qdsub">;
+def QSAX    : AAI<0b01100010, 0b0101, "qsax">;
+def QSUB    : AAI<0b00010010, 0b0101, "qsub">;
+def QSUB16  : AAI<0b01100010, 0b0111, "qsub16">;
+def QSUB8   : AAI<0b01100010, 0b1111, "qsub8">;
+def UQADD16 : AAI<0b01100110, 0b0001, "uqadd16">;
+def UQADD8  : AAI<0b01100110, 0b1001, "uqadd8">;
+def UQASX   : AAI<0b01100110, 0b0011, "uqasx">;
+def UQSAX   : AAI<0b01100110, 0b0101, "uqsax">;
+def UQSUB16 : AAI<0b01100110, 0b0111, "uqsub16">;
+def UQSUB8  : AAI<0b01100110, 0b1111, "uqsub8">;
+
+// Signed/Unsigned add/subtract -- for disassembly only
+
+def SASX   : AAI<0b01100001, 0b0011, "sasx">;
+def SADD16 : AAI<0b01100001, 0b0001, "sadd16">;
+def SADD8  : AAI<0b01100001, 0b1001, "sadd8">;
+def SSAX   : AAI<0b01100001, 0b0101, "ssax">;
+def SSUB16 : AAI<0b01100001, 0b0111, "ssub16">;
+def SSUB8  : AAI<0b01100001, 0b1111, "ssub8">;
+def UASX   : AAI<0b01100101, 0b0011, "uasx">;
+def UADD16 : AAI<0b01100101, 0b0001, "uadd16">;
+def UADD8  : AAI<0b01100101, 0b1001, "uadd8">;
+def USAX   : AAI<0b01100101, 0b0101, "usax">;
+def USUB16 : AAI<0b01100101, 0b0111, "usub16">;
+def USUB8  : AAI<0b01100101, 0b1111, "usub8">;
+
+// Signed/Unsigned halving add/subtract -- for disassembly only
+
+def SHASX   : AAI<0b01100011, 0b0011, "shasx">;
+def SHADD16 : AAI<0b01100011, 0b0001, "shadd16">;
+def SHADD8  : AAI<0b01100011, 0b1001, "shadd8">;
+def SHSAX   : AAI<0b01100011, 0b0101, "shsax">;
+def SHSUB16 : AAI<0b01100011, 0b0111, "shsub16">;
+def SHSUB8  : AAI<0b01100011, 0b1111, "shsub8">;
+def UHASX   : AAI<0b01100111, 0b0011, "uhasx">;
+def UHADD16 : AAI<0b01100111, 0b0001, "uhadd16">;
+def UHADD8  : AAI<0b01100111, 0b1001, "uhadd8">;
+def UHSAX   : AAI<0b01100111, 0b0101, "uhsax">;
+def UHSUB16 : AAI<0b01100111, 0b0111, "uhsub16">;
+def UHSUB8  : AAI<0b01100111, 0b1111, "uhsub8">;
+
+// Unsigned Sum of Absolute Differences [and Accumulate] -- for disassembly only
+
+def USAD8  : AI<(outs GPR:$dst), (ins GPR:$a, GPR:$b),
+                MulFrm /* for convenience */, NoItinerary, "usad8",
+                "\t$dst, $a, $b", []>,
+             Requires<[IsARM, HasV6]> {
+  let Inst{27-20} = 0b01111000;
+  let Inst{15-12} = 0b1111;
+  let Inst{7-4} = 0b0001;
+}
+def USADA8 : AI<(outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$acc),
+                MulFrm /* for convenience */, NoItinerary, "usada8",
+                "\t$dst, $a, $b, $acc", []>,
+             Requires<[IsARM, HasV6]> {
+  let Inst{27-20} = 0b01111000;
+  let Inst{7-4} = 0b0001;
+}
 
-def QSUB8   : AQI<0b01100010, 0b1111, "qsub8",
-                  [/* For disassembly only; pattern left blank */]>;
+// Signed/Unsigned saturate -- for disassembly only
 
-def UQADD16 : AQI<0b01100110, 0b0001, "uqadd16",
-                  [/* For disassembly only; pattern left blank */]>;
+def SSATlsl : AI<(outs GPR:$dst), (ins i32imm:$bit_pos, GPR:$a, i32imm:$shamt),
+                 DPFrm, NoItinerary, "ssat", "\t$dst, $bit_pos, $a, lsl $shamt",
+                 [/* For disassembly only; pattern left blank */]> {
+  let Inst{27-21} = 0b0110101;
+  let Inst{6-4} = 0b001;
+}
 
-def UQADD8  : AQI<0b01100110, 0b1001, "uqadd8",
-                  [/* For disassembly only; pattern left blank */]>;
+def SSATasr : AI<(outs GPR:$dst), (ins i32imm:$bit_pos, GPR:$a, i32imm:$shamt),
+                 DPFrm, NoItinerary, "ssat", "\t$dst, $bit_pos, $a, asr $shamt",
+                 [/* For disassembly only; pattern left blank */]> {
+  let Inst{27-21} = 0b0110101;
+  let Inst{6-4} = 0b101;
+}
 
-def UQASX   : AQI<0b01100110, 0b0011, "uqasx",
-                  [/* For disassembly only; pattern left blank */]>;
+def SSAT16 : AI<(outs GPR:$dst), (ins i32imm:$bit_pos, GPR:$a), DPFrm,
+                NoItinerary, "ssat16", "\t$dst, $bit_pos, $a",
+                [/* For disassembly only; pattern left blank */]> {
+  let Inst{27-20} = 0b01101010;
+  let Inst{7-4} = 0b0011;
+}
 
-def UQSAX   : AQI<0b01100110, 0b0101, "uqsax",
-                  [/* For disassembly only; pattern left blank */]>;
+def USATlsl : AI<(outs GPR:$dst), (ins i32imm:$bit_pos, GPR:$a, i32imm:$shamt),
+                 DPFrm, NoItinerary, "usat", "\t$dst, $bit_pos, $a, lsl $shamt",
+                 [/* For disassembly only; pattern left blank */]> {
+  let Inst{27-21} = 0b0110111;
+  let Inst{6-4} = 0b001;
+}
 
-def UQSUB16 : AQI<0b01100110, 0b0111, "uqsub16",
-                  [/* For disassembly only; pattern left blank */]>;
+def USATasr : AI<(outs GPR:$dst), (ins i32imm:$bit_pos, GPR:$a, i32imm:$shamt),
+                 DPFrm, NoItinerary, "usat", "\t$dst, $bit_pos, $a, asr $shamt",
+                 [/* For disassembly only; pattern left blank */]> {
+  let Inst{27-21} = 0b0110111;
+  let Inst{6-4} = 0b101;
+}
 
-def UQSUB8  : AQI<0b01100110, 0b1111, "uqsub8",
-                  [/* For disassembly only; pattern left blank */]>;
+def USAT16 : AI<(outs GPR:$dst), (ins i32imm:$bit_pos, GPR:$a), DPFrm,
+                NoItinerary, "usat16", "\t$dst, $bit_pos, $a",
+                [/* For disassembly only; pattern left blank */]> {
+  let Inst{27-20} = 0b01101110;
+  let Inst{7-4} = 0b0011;
+}
 
 //===----------------------------------------------------------------------===//
 //  Bitwise Instructions.
@@ -1438,6 +1677,17 @@ def BFC    : I<(outs GPR:$dst), (ins GPR:$src, bf_inv_mask_imm:$imm),
   let Inst{6-0}   = 0b0011111;
 }
 
+// A8.6.18  BFI - Bitfield insert (Encoding A1)
+// Added for disassembler with the pattern field purposely left blank.
+def BFI    : I<(outs GPR:$dst), (ins GPR:$src, bf_inv_mask_imm:$imm),
+               AddrMode1, Size4Bytes, IndexModeNone, DPFrm, IIC_iUNAsi,
+               "bfi", "\t$dst, $src, $imm", "",
+               [/* For disassembly only; pattern left blank */]>,
+               Requires<[IsARM, HasV6T2]> {
+  let Inst{27-21} = 0b0111110;
+  let Inst{6-4}   = 0b001; // Rn: Inst{3-0} != 15
+}
+
 def  MVNr  : AsI1<0b1111, (outs GPR:$dst), (ins GPR:$src), DPFrm, IIC_iMOVr,
                   "mvn", "\t$dst, $src",
                   [(set GPR:$dst, (not GPR:$src))]>, UnaryDP {
@@ -1450,7 +1700,7 @@ def  MVNs  : AsI1<0b1111, (outs GPR:$dst), (ins so_reg:$src), DPSoRegFrm,
   let Inst{25} = 0;
 }
 let isReMaterializable = 1, isAsCheapAsAMove = 1 in
-def  MVNi  : AsI1<0b1111, (outs GPR:$dst), (ins so_imm:$imm), DPFrm, 
+def  MVNi  : AsI1<0b1111, (outs GPR:$dst), (ins so_imm:$imm), DPFrm,
                   IIC_iMOVi, "mvn", "\t$dst, $imm",
                   [(set GPR:$dst, so_imm_not:$imm)]>,UnaryDP {
     let Inst{25} = 1;
@@ -1513,6 +1763,14 @@ def SMMUL : AMul2I <0b0111010, (outs GPR:$dst), (ins GPR:$a, GPR:$b),
   let Inst{15-12} = 0b1111;
 }
 
+def SMMULR : AMul2I <0b0111010, (outs GPR:$dst), (ins GPR:$a, GPR:$b),
+               IIC_iMUL32, "smmulr", "\t$dst, $a, $b",
+               [/* For disassembly only; pattern left blank */]>,
+            Requires<[IsARM, HasV6]> {
+  let Inst{7-4}   = 0b0011; // R = 1
+  let Inst{15-12} = 0b1111;
+}
+
 def SMMLA : AMul2I <0b0111010, (outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$c),
                IIC_iMAC32, "smmla", "\t$dst, $a, $b, $c",
                [(set GPR:$dst, (add (mulhs GPR:$a, GPR:$b), GPR:$c))]>,
@@ -1520,6 +1778,12 @@ def SMMLA : AMul2I <0b0111010, (outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$c),
   let Inst{7-4}   = 0b0001;
 }
 
+def SMMLAR : AMul2I <0b0111010, (outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$c),
+               IIC_iMAC32, "smmlar", "\t$dst, $a, $b, $c",
+               [/* For disassembly only; pattern left blank */]>,
+            Requires<[IsARM, HasV6]> {
+  let Inst{7-4}   = 0b0011; // R = 1
+}
 
 def SMMLS : AMul2I <0b0111010, (outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$c),
                IIC_iMAC32, "smmls", "\t$dst, $a, $b, $c",
@@ -1528,6 +1792,13 @@ def SMMLS : AMul2I <0b0111010, (outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$c),
   let Inst{7-4}   = 0b1101;
 }
 
+def SMMLSR : AMul2I <0b0111010, (outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$c),
+               IIC_iMAC32, "smmlsr", "\t$dst, $a, $b, $c",
+               [/* For disassembly only; pattern left blank */]>,
+            Requires<[IsARM, HasV6]> {
+  let Inst{7-4}   = 0b1111; // R = 1
+}
+
 multiclass AI_smul<string opc, PatFrag opnode> {
   def BB : AMulxyI<0b0001011, (outs GPR:$dst), (ins GPR:$a, GPR:$b),
               IIC_iMUL32, !strconcat(opc, "bb"), "\t$dst, $a, $b",
@@ -1599,7 +1870,7 @@ multiclass AI_smla<string opc, PatFrag opnode> {
   def BT : AMulxyI<0b0001000, (outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$acc),
               IIC_iMAC16, !strconcat(opc, "bt"), "\t$dst, $a, $b, $acc",
               [(set GPR:$dst, (add GPR:$acc, (opnode (sext_inreg GPR:$a, i16),
-                                                     (sra GPR:$b, (i32 16)))))]>,
+                                                    (sra GPR:$b, (i32 16)))))]>,
            Requires<[IsARM, HasV5TE]> {
              let Inst{5} = 0;
              let Inst{6} = 1;
@@ -1678,7 +1949,54 @@ def SMLALTT : AMulxyI<0b0001010,(outs GPR:$ldst,GPR:$hdst),(ins GPR:$a,GPR:$b),
   let Inst{6} = 1;
 }
 
-// TODO: Dual halfword multiple: SMUAD, SMUSD, SMLAD, SMLSD, SMLALD, SMLSLD
+// Helper class for AI_smld -- for disassembly only
+class AMulDualI<bit long, bit sub, bit swap, dag oops, dag iops,
+                InstrItinClass itin, string opc, string asm>
+  : AI<oops, iops, MulFrm, itin, opc, asm, []>, Requires<[IsARM, HasV6]> {
+  let Inst{4}     = 1;
+  let Inst{5}     = swap;
+  let Inst{6}     = sub;
+  let Inst{7}     = 0;
+  let Inst{21-20} = 0b00;
+  let Inst{22}    = long;
+  let Inst{27-23} = 0b01110;
+}
+
+multiclass AI_smld<bit sub, string opc> {
+
+  def D : AMulDualI<0, sub, 0, (outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$acc),
+                  NoItinerary, !strconcat(opc, "d"), "\t$dst, $a, $b, $acc">;
+
+  def DX : AMulDualI<0, sub, 1, (outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$acc),
+                  NoItinerary, !strconcat(opc, "dx"), "\t$dst, $a, $b, $acc">;
+
+  def LD : AMulDualI<1, sub, 0, (outs GPR:$ldst,GPR:$hdst), (ins GPR:$a,GPR:$b),
+                  NoItinerary, !strconcat(opc, "ld"), "\t$ldst, $hdst, $a, $b">;
+
+  def LDX : AMulDualI<1, sub, 1, (outs GPR:$ldst,GPR:$hdst),(ins GPR:$a,GPR:$b),
+                  NoItinerary, !strconcat(opc, "ldx"),"\t$ldst, $hdst, $a, $b">;
+
+}
+
+defm SMLA : AI_smld<0, "smla">;
+defm SMLS : AI_smld<1, "smls">;
+
+multiclass AI_sdml<bit sub, string opc> {
+
+  def D : AMulDualI<0, sub, 0, (outs GPR:$dst), (ins GPR:$a, GPR:$b),
+                    NoItinerary, !strconcat(opc, "d"), "\t$dst, $a, $b"> {
+    let Inst{15-12} = 0b1111;
+  }
+
+  def DX : AMulDualI<0, sub, 1, (outs GPR:$dst), (ins GPR:$a, GPR:$b),
+                    NoItinerary, !strconcat(opc, "dx"), "\t$dst, $a, $b"> {
+    let Inst{15-12} = 0b1111;
+  }
+
+}
+
+defm SMUA : AI_sdml<0, "smua">;
+defm SMUS : AI_sdml<1, "smus">;
 
 //===----------------------------------------------------------------------===//
 //  Misc. Arithmetic Instructions.
@@ -1736,7 +2054,7 @@ def REVSH : AMiscA1I<0b01101111, (outs GPR:$dst), (ins GPR:$src), IIC_iUNAr,
 
 def PKHBT : AMiscA1I<0b01101000, (outs GPR:$dst),
                                  (ins GPR:$src1, GPR:$src2, i32imm:$shamt),
-               IIC_iALUsi, "pkhbt", "\t$dst, $src1, $src2, LSL $shamt",
+               IIC_iALUsi, "pkhbt", "\t$dst, $src1, $src2, lsl $shamt",
                [(set GPR:$dst, (or (and GPR:$src1, 0xFFFF),
                                    (and (shl GPR:$src2, (i32 imm:$shamt)),
                                         0xFFFF0000)))]>,
@@ -1753,7 +2071,7 @@ def : ARMV6Pat<(or (and GPR:$src1, 0xFFFF), (shl GPR:$src2, imm16_31:$shamt)),
 
 def PKHTB : AMiscA1I<0b01101000, (outs GPR:$dst),
                                  (ins GPR:$src1, GPR:$src2, i32imm:$shamt),
-               IIC_iALUsi, "pkhtb", "\t$dst, $src1, $src2, ASR $shamt",
+               IIC_iALUsi, "pkhtb", "\t$dst, $src1, $src2, asr $shamt",
                [(set GPR:$dst, (or (and GPR:$src1, 0xFFFF0000),
                                    (and (sra GPR:$src2, imm16_31:$shamt),
                                         0xFFFF)))]>, Requires<[IsARM, HasV6]> {
@@ -1799,7 +2117,7 @@ def : ARMPat<(ARMcmpZ GPR:$src, so_imm_neg:$imm),
 
 // Conditional moves
 // FIXME: should be able to write a pattern for ARMcmov, but can't use
-// a two-value operand where a dag node expects two operands. :( 
+// a two-value operand where a dag node expects two operands. :(
 def MOVCCr : AI1<0b1101, (outs GPR:$dst), (ins GPR:$false, GPR:$true), DPFrm,
                 IIC_iCMOVr, "mov", "\t$dst, $true",
       [/*(set GPR:$dst, (ARMcmov GPR:$false, GPR:$true, imm:$cc, CCR:$ccr))*/]>,
@@ -1837,6 +2155,7 @@ def Int_MemBarrierV7 : AInoP<(outs), (ins),
                         Requires<[IsARM, HasV7]> {
   let Inst{31-4} = 0xf57ff05;
   // FIXME: add support for options other than a full system DMB
+  // See DMB disassembly-only variants below.
   let Inst{3-0} = 0b1111;
 }
 
@@ -1847,6 +2166,7 @@ def Int_SyncBarrierV7 : AInoP<(outs), (ins),
                         Requires<[IsARM, HasV7]> {
   let Inst{31-4} = 0xf57ff04;
   // FIXME: add support for options other than a full system DSB
+  // See DSB disassembly-only variants below.
   let Inst{3-0} = 0b1111;
 }
 
@@ -1869,6 +2189,64 @@ def Int_SyncBarrierV6 : AInoP<(outs), (ins GPR:$zero),
 }
 }
 
+// Helper class for multiclass MemB -- for disassembly only
+class AMBI<string opc, string asm>
+  : AInoP<(outs), (ins), MiscFrm, NoItinerary, opc, asm,
+          [/* For disassembly only; pattern left blank */]>,
+    Requires<[IsARM, HasV7]> {
+  let Inst{31-20} = 0xf57;
+}
+
+multiclass MemB<bits<4> op7_4, string opc> {
+
+  def st : AMBI<opc, "\tst"> {
+    let Inst{7-4} = op7_4;
+    let Inst{3-0} = 0b1110;
+  }
+
+  def ish : AMBI<opc, "\tish"> {
+    let Inst{7-4} = op7_4;
+    let Inst{3-0} = 0b1011;
+  }
+
+  def ishst : AMBI<opc, "\tishst"> {
+    let Inst{7-4} = op7_4;
+    let Inst{3-0} = 0b1010;
+  }
+
+  def nsh : AMBI<opc, "\tnsh"> {
+    let Inst{7-4} = op7_4;
+    let Inst{3-0} = 0b0111;
+  }
+
+  def nshst : AMBI<opc, "\tnshst"> {
+    let Inst{7-4} = op7_4;
+    let Inst{3-0} = 0b0110;
+  }
+
+  def osh : AMBI<opc, "\tosh"> {
+    let Inst{7-4} = op7_4;
+    let Inst{3-0} = 0b0011;
+  }
+
+  def oshst : AMBI<opc, "\toshst"> {
+    let Inst{7-4} = op7_4;
+    let Inst{3-0} = 0b0010;
+  }
+}
+
+// These DMB variants are for disassembly only.
+defm DMB : MemB<0b0101, "dmb">;
+
+// These DSB variants are for disassembly only.
+defm DSB : MemB<0b0100, "dsb">;
+
+// ISB has only full system option -- for disassembly only
+def ISBsy : AMBI<"isb", ""> {
+  let Inst{7-4} = 0b0110;
+  let Inst{3-0} = 0b1111;
+}
+
 let usesCustomInserter = 1 in {
   let Uses = [CPSR] in {
     def ATOMIC_LOAD_ADD_I8 : PseudoInst<
@@ -2008,6 +2386,14 @@ def STREXD : AIstrex<0b01, (outs GPR:$success),
                     []>;
 }
 
+// Clear-Exclusive is for disassembly only.
+def CLREX : AXI<(outs), (ins), MiscFrm, NoItinerary, "clrex",
+                [/* For disassembly only; pattern left blank */]>,
+            Requires<[IsARM, HasV7]>  {
+  let Inst{31-20} = 0xf57;
+  let Inst{7-4} = 0b0001;
+}
+
 // SWP/SWPB are deprecated in V6/V7 and for disassembly only.
 let mayLoad = 1 in {
 def SWP : AI<(outs GPR:$dst), (ins GPR:$src, GPR:$ptr), LdStExFrm, NoItinerary,
@@ -2079,7 +2465,7 @@ let Defs =
 
 // Two piece so_imms.
 let isReMaterializable = 1 in
-def MOVi2pieces : AI1x2<(outs GPR:$dst), (ins so_imm2part:$src), 
+def MOVi2pieces : AI1x2<(outs GPR:$dst), (ins so_imm2part:$src),
                          Pseudo, IIC_iMOVi,
                          "mov", "\t$dst, $src",
                          [(set GPR:$dst, so_imm2part:$src)]>,
@@ -2104,7 +2490,7 @@ def : ARMPat<(add GPR:$LHS, so_neg_imm2part:$RHS),
 // FIXME: Remove this when we can do generalized remat.
 let isReMaterializable = 1 in
 def MOVi32imm : AI1x2<(outs GPR:$dst), (ins i32imm:$src), Pseudo, IIC_iMOVi,
-                    "movw", "\t$dst, ${src:lo16}\n\tmovt${p}\t$dst, ${src:hi16}",
+                   "movw", "\t$dst, ${src:lo16}\n\tmovt${p}\t$dst, ${src:hi16}",
                      [(set GPR:$dst, (i32 imm:$src))]>,
                Requires<[IsARM, HasV6T2]>;
 
@@ -2231,6 +2617,102 @@ def CDP2 : ABXI<0b1110, (outs), (ins nohash_imm:$cop, i32imm:$opc1,
   let Inst{4} = 0;
 }
 
+class ACI<dag oops, dag iops, string opc, string asm>
+  : I<oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, BrFrm, NoItinerary,
+      opc, asm, "", [/* For disassembly only; pattern left blank */]> {
+  let Inst{27-25} = 0b110;
+}
+
+multiclass LdStCop<bits<4> op31_28, bit load, string opc> {
+
+  def _OFFSET : ACI<(outs),
+      (ins nohash_imm:$cop, nohash_imm:$CRd, addrmode2:$addr),
+      opc, "\tp$cop, cr$CRd, $addr"> {
+    let Inst{31-28} = op31_28;
+    let Inst{24} = 1; // P = 1
+    let Inst{21} = 0; // W = 0
+    let Inst{22} = 0; // D = 0
+    let Inst{20} = load;
+  }
+
+  def _PRE : ACI<(outs),
+      (ins nohash_imm:$cop, nohash_imm:$CRd, addrmode2:$addr),
+      opc, "\tp$cop, cr$CRd, $addr!"> {
+    let Inst{31-28} = op31_28;
+    let Inst{24} = 1; // P = 1
+    let Inst{21} = 1; // W = 1
+    let Inst{22} = 0; // D = 0
+    let Inst{20} = load;
+  }
+
+  def _POST : ACI<(outs),
+      (ins nohash_imm:$cop, nohash_imm:$CRd, GPR:$base, am2offset:$offset),
+      opc, "\tp$cop, cr$CRd, [$base], $offset"> {
+    let Inst{31-28} = op31_28;
+    let Inst{24} = 0; // P = 0
+    let Inst{21} = 1; // W = 1
+    let Inst{22} = 0; // D = 0
+    let Inst{20} = load;
+  }
+
+  def _OPTION : ACI<(outs),
+      (ins nohash_imm:$cop, nohash_imm:$CRd, GPR:$base, i32imm:$option),
+      opc, "\tp$cop, cr$CRd, [$base], $option"> {
+    let Inst{31-28} = op31_28;
+    let Inst{24} = 0; // P = 0
+    let Inst{23} = 1; // U = 1
+    let Inst{21} = 0; // W = 0
+    let Inst{22} = 0; // D = 0
+    let Inst{20} = load;
+  }
+
+  def L_OFFSET : ACI<(outs),
+      (ins nohash_imm:$cop, nohash_imm:$CRd, addrmode2:$addr),
+      opc, "l\tp$cop, cr$CRd, $addr"> {
+    let Inst{31-28} = op31_28;
+    let Inst{24} = 1; // P = 1
+    let Inst{21} = 0; // W = 0
+    let Inst{22} = 1; // D = 1
+    let Inst{20} = load;
+  }
+
+  def L_PRE : ACI<(outs),
+      (ins nohash_imm:$cop, nohash_imm:$CRd, addrmode2:$addr),
+      opc, "l\tp$cop, cr$CRd, $addr!"> {
+    let Inst{31-28} = op31_28;
+    let Inst{24} = 1; // P = 1
+    let Inst{21} = 1; // W = 1
+    let Inst{22} = 1; // D = 1
+    let Inst{20} = load;
+  }
+
+  def L_POST : ACI<(outs),
+      (ins nohash_imm:$cop, nohash_imm:$CRd, GPR:$base, am2offset:$offset),
+      opc, "l\tp$cop, cr$CRd, [$base], $offset"> {
+    let Inst{31-28} = op31_28;
+    let Inst{24} = 0; // P = 0
+    let Inst{21} = 1; // W = 1
+    let Inst{22} = 1; // D = 1
+    let Inst{20} = load;
+  }
+
+  def L_OPTION : ACI<(outs),
+      (ins nohash_imm:$cop, nohash_imm:$CRd, GPR:$base, nohash_imm:$option),
+      opc, "l\tp$cop, cr$CRd, [$base], $option"> {
+    let Inst{31-28} = op31_28;
+    let Inst{24} = 0; // P = 0
+    let Inst{23} = 1; // U = 1
+    let Inst{21} = 0; // W = 0
+    let Inst{22} = 1; // D = 1
+    let Inst{20} = load;
+  }
+}
+
+defm LDC  : LdStCop<{?,?,?,?}, 1, "ldc">;
+defm LDC2 : LdStCop<0b1111,    1, "ldc2">;
+defm STC  : LdStCop<{?,?,?,?}, 0, "stc">;
+defm STC2 : LdStCop<0b1111,    0, "stc2">;
+
 def MCR : ABI<0b1110, (outs), (ins nohash_imm:$cop, i32imm:$opc1,
               GPR:$Rt, nohash_imm:$CRn, nohash_imm:$CRm, i32imm:$opc2),
               NoItinerary, "mcr", "\tp$cop, $opc1, $Rt, cr$CRn, cr$CRm, $opc2",
@@ -2312,14 +2794,28 @@ def MRSsys : ABI<0b0001,(outs GPR:$dst),(ins), NoItinerary,"mrs","\t$dst, spsr",
 }
 
 // FIXME: mask is ignored for the time being.
-def MSR : ABI<0b0001,(outs),(ins GPR:$src), NoItinerary, "mrs", "\tcpsr, $src",
+def MSR : ABI<0b0001,(outs),(ins GPR:$src), NoItinerary, "msr", "\tcpsr, $src",
               [/* For disassembly only; pattern left blank */]> {
   let Inst{23-20} = 0b0010;
   let Inst{7-4} = 0b0000;
 }
 
 // FIXME: mask is ignored for the time being.
-def MSRsys : ABI<0b0001,(outs),(ins GPR:$src),NoItinerary,"mrs","\tspsr, $src",
+def MSRi : ABI<0b0011,(outs),(ins so_imm:$a), NoItinerary, "msr", "\tcpsr, $a",
+              [/* For disassembly only; pattern left blank */]> {
+  let Inst{23-20} = 0b0010;
+  let Inst{7-4} = 0b0000;
+}
+
+// FIXME: mask is ignored for the time being.
+def MSRsys : ABI<0b0001,(outs),(ins GPR:$src),NoItinerary,"msr","\tspsr, $src",
+              [/* For disassembly only; pattern left blank */]> {
+  let Inst{23-20} = 0b0110;
+  let Inst{7-4} = 0b0000;
+}
+
+// FIXME: mask is ignored for the time being.
+def MSRsysi : ABI<0b0011,(outs),(ins so_imm:$a),NoItinerary,"msr","\tspsr, $a",
               [/* For disassembly only; pattern left blank */]> {
   let Inst{23-20} = 0b0110;
   let Inst{7-4} = 0b0000;
diff --git a/libclamav/c++/llvm/lib/Target/ARM/ARMInstrNEON.td b/libclamav/c++/llvm/lib/Target/ARM/ARMInstrNEON.td
index e2be7ba..3aa0810 100644
--- a/libclamav/c++/llvm/lib/Target/ARM/ARMInstrNEON.td
+++ b/libclamav/c++/llvm/lib/Target/ARM/ARMInstrNEON.td
@@ -83,11 +83,17 @@ def NEONvrev32    : SDNode<"ARMISD::VREV32", SDTARMVSHUF>;
 def NEONvrev16    : SDNode<"ARMISD::VREV16", SDTARMVSHUF>;
 
 def SDTARMVSHUF2  : SDTypeProfile<2, 2, [SDTCisVec<0>, SDTCisSameAs<0, 1>,
-                                         SDTCisSameAs<0, 2>, SDTCisSameAs<0, 3>]>;
+                                         SDTCisSameAs<0, 2>,
+                                         SDTCisSameAs<0, 3>]>;
 def NEONzip       : SDNode<"ARMISD::VZIP", SDTARMVSHUF2>;
 def NEONuzp       : SDNode<"ARMISD::VUZP", SDTARMVSHUF2>;
 def NEONtrn       : SDNode<"ARMISD::VTRN", SDTARMVSHUF2>;
 
+def SDTARMFMAX    : SDTypeProfile<1, 2, [SDTCisVT<0, f32>, SDTCisSameAs<0, 1>,
+                                         SDTCisSameAs<0, 2>]>;
+def NEONfmax      : SDNode<"ARMISD::FMAX", SDTARMFMAX>;
+def NEONfmin      : SDNode<"ARMISD::FMIN", SDTARMFMAX>;
+
 //===----------------------------------------------------------------------===//
 // NEON operand definitions
 //===----------------------------------------------------------------------===//
@@ -123,9 +129,7 @@ def h64imm : Operand<i64> {
 let mayLoad = 1, hasExtraDefRegAllocReq = 1 in {
 def VLDMD : NI<(outs),
                (ins addrmode_neonldstm:$addr, reglist:$dst1, variable_ops),
-               IIC_fpLoadm,
-               "vldm", "${addr:submode} ${addr:base}, $dst1",
-               []> {
+               IIC_fpLoadm, "vldm", "${addr:submode} ${addr:base}, $dst1", []> {
   let Inst{27-25} = 0b110;
   let Inst{20}    = 1;
   let Inst{11-9}  = 0b101;
@@ -133,9 +137,7 @@ def VLDMD : NI<(outs),
 
 def VLDMS : NI<(outs),
                (ins addrmode_neonldstm:$addr, reglist:$dst1, variable_ops),
-               IIC_fpLoadm,
-               "vldm", "${addr:submode} ${addr:base}, $dst1",
-               []> {
+               IIC_fpLoadm, "vldm", "${addr:submode} ${addr:base}, $dst1", []> {
   let Inst{27-25} = 0b110;
   let Inst{20}    = 1;
   let Inst{11-9}  = 0b101;
@@ -144,10 +146,9 @@ def VLDMS : NI<(outs),
 */
 
 // Use vldmia to load a Q register as a D register pair.
-def VLDRQ : NI4<(outs QPR:$dst), (ins addrmode4:$addr),
-               IIC_fpLoadm,
-               "vldmia", "$addr, ${dst:dregpair}",
-               [(set QPR:$dst, (v2f64 (load addrmode4:$addr)))]> {
+def VLDRQ : NI4<(outs QPR:$dst), (ins addrmode4:$addr), IIC_fpLoadm,
+                "vldmia", "$addr, ${dst:dregpair}",
+                [(set QPR:$dst, (v2f64 (load addrmode4:$addr)))]> {
   let Inst{27-25} = 0b110;
   let Inst{24}    = 0; // P bit
   let Inst{23}    = 1; // U bit
@@ -156,10 +157,9 @@ def VLDRQ : NI4<(outs QPR:$dst), (ins addrmode4:$addr),
 }
 
 // Use vstmia to store a Q register as a D register pair.
-def VSTRQ : NI4<(outs), (ins QPR:$src, addrmode4:$addr),
-               IIC_fpStorem,
-               "vstmia", "$addr, ${src:dregpair}",
-               [(store (v2f64 QPR:$src), addrmode4:$addr)]> {
+def VSTRQ : NI4<(outs), (ins QPR:$src, addrmode4:$addr), IIC_fpStorem,
+                "vstmia", "$addr, ${src:dregpair}",
+                [(store (v2f64 QPR:$src), addrmode4:$addr)]> {
   let Inst{27-25} = 0b110;
   let Inst{24}    = 0; // P bit
   let Inst{23}    = 1; // U bit
@@ -191,6 +191,29 @@ def  VLD1q32  : VLD1Q<0b1000, "vld1", "32", v4i32, int_arm_neon_vld1>;
 def  VLD1qf   : VLD1Q<0b1000, "vld1", "32", v4f32, int_arm_neon_vld1>;
 def  VLD1q64  : VLD1Q<0b1100, "vld1", "64", v2i64, int_arm_neon_vld1>;
 
+// These (dreg triple/quadruple) are for disassembly only.
+class VLD1D3<bits<4> op7_4, string OpcodeStr, string Dt>
+  : NLdSt<0, 0b10, 0b0110, op7_4, (outs DPR:$dst1, DPR:$dst2, DPR:$dst3),
+          (ins addrmode6:$addr), IIC_VLD1, OpcodeStr, Dt,
+          "\\{$dst1, $dst2, $dst3\\}, $addr", "",
+          [/* For disassembly only; pattern left blank */]>;
+class VLD1D4<bits<4> op7_4, string OpcodeStr, string Dt>
+  : NLdSt<0,0b10,0b0010,op7_4,(outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4),
+          (ins addrmode6:$addr), IIC_VLD1, OpcodeStr, Dt,
+          "\\{$dst1, $dst2, $dst3, $dst4\\}, $addr", "",
+          [/* For disassembly only; pattern left blank */]>;
+
+def  VLD1d8T  : VLD1D3<0b0000, "vld1", "8">;
+def  VLD1d16T : VLD1D3<0b0100, "vld1", "16">;
+def  VLD1d32T : VLD1D3<0b1000, "vld1", "32">;
+//def  VLD1d64T : VLD1D3<0b1100, "vld1", "64">;
+
+def  VLD1d8Q  : VLD1D4<0b0000, "vld1", "8">;
+def  VLD1d16Q : VLD1D4<0b0100, "vld1", "16">;
+def  VLD1d32Q : VLD1D4<0b1000, "vld1", "32">;
+//def  VLD1d64Q : VLD1D4<0b1100, "vld1", "64">;
+
+
 let mayLoad = 1, hasExtraDefRegAllocReq = 1 in {
 
 //   VLD2     : Vector Load (multiple 2-element structures)
@@ -216,6 +239,16 @@ def  VLD2q8   : VLD2Q<0b0000, "vld2", "8">;
 def  VLD2q16  : VLD2Q<0b0100, "vld2", "16">;
 def  VLD2q32  : VLD2Q<0b1000, "vld2", "32">;
 
+// These (double-spaced dreg pair) are for disassembly only.
+class VLD2Ddbl<bits<4> op7_4, string OpcodeStr, string Dt>
+  : NLdSt<0,0b10,0b1001,op7_4, (outs DPR:$dst1, DPR:$dst2),
+          (ins addrmode6:$addr), IIC_VLD2,
+          OpcodeStr, Dt, "\\{$dst1, $dst2\\}, $addr", "", []>;
+
+def  VLD2d8D  : VLD2Ddbl<0b0000, "vld2", "8">;
+def  VLD2d16D : VLD2Ddbl<0b0100, "vld2", "16">;
+def  VLD2d32D : VLD2Ddbl<0b1000, "vld2", "32">;
+
 //   VLD3     : Vector Load (multiple 3-element structures)
 class VLD3D<bits<4> op7_4, string OpcodeStr, string Dt>
   : NLdSt<0,0b10,0b0100,op7_4, (outs DPR:$dst1, DPR:$dst2, DPR:$dst3),
@@ -285,105 +318,64 @@ def  VLD4q32b : VLD4WB<0b1000, "vld4", "32">;
 class VLD2LN<bits<4> op11_8, string OpcodeStr, string Dt>
   : NLdSt<1,0b10,op11_8,{?,?,?,?}, (outs DPR:$dst1, DPR:$dst2),
             (ins addrmode6:$addr, DPR:$src1, DPR:$src2, nohash_imm:$lane),
-            IIC_VLD2,
-            OpcodeStr, Dt, "\\{$dst1[$lane], $dst2[$lane]\\}, $addr",
+            IIC_VLD2, OpcodeStr, Dt, "\\{$dst1[$lane], $dst2[$lane]\\}, $addr",
             "$src1 = $dst1, $src2 = $dst2", []>;
 
 // vld2 to single-spaced registers.
 def VLD2LNd8  : VLD2LN<0b0001, "vld2", "8">;
-def VLD2LNd16 : VLD2LN<0b0101, "vld2", "16"> {
-  let Inst{5} = 0;
-}
-def VLD2LNd32 : VLD2LN<0b1001, "vld2", "32"> {
-  let Inst{6} = 0;
-}
+def VLD2LNd16 : VLD2LN<0b0101, "vld2", "16"> { let Inst{5} = 0; }
+def VLD2LNd32 : VLD2LN<0b1001, "vld2", "32"> { let Inst{6} = 0; }
 
 // vld2 to double-spaced even registers.
-def VLD2LNq16a: VLD2LN<0b0101, "vld2", "16"> {
-  let Inst{5} = 1;
-}
-def VLD2LNq32a: VLD2LN<0b1001, "vld2", "32"> {
-  let Inst{6} = 1;
-}
+def VLD2LNq16a: VLD2LN<0b0101, "vld2", "16"> { let Inst{5} = 1; }
+def VLD2LNq32a: VLD2LN<0b1001, "vld2", "32"> { let Inst{6} = 1; }
 
 // vld2 to double-spaced odd registers.
-def VLD2LNq16b: VLD2LN<0b0101, "vld2", "16"> {
-  let Inst{5} = 1;
-}
-def VLD2LNq32b: VLD2LN<0b1001, "vld2", "32"> {
-  let Inst{6} = 1;
-}
+def VLD2LNq16b: VLD2LN<0b0101, "vld2", "16"> { let Inst{5} = 1; }
+def VLD2LNq32b: VLD2LN<0b1001, "vld2", "32"> { let Inst{6} = 1; }
 
 //   VLD3LN   : Vector Load (single 3-element structure to one lane)
 class VLD3LN<bits<4> op11_8, string OpcodeStr, string Dt>
   : NLdSt<1,0b10,op11_8,{?,?,?,?}, (outs DPR:$dst1, DPR:$dst2, DPR:$dst3),
             (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3,
-            nohash_imm:$lane), IIC_VLD3,
-            OpcodeStr, Dt,
+            nohash_imm:$lane), IIC_VLD3, OpcodeStr, Dt,
             "\\{$dst1[$lane], $dst2[$lane], $dst3[$lane]\\}, $addr",
             "$src1 = $dst1, $src2 = $dst2, $src3 = $dst3", []>;
 
 // vld3 to single-spaced registers.
-def VLD3LNd8  : VLD3LN<0b0010, "vld3", "8"> {
-  let Inst{4} = 0;
-}
-def VLD3LNd16 : VLD3LN<0b0110, "vld3", "16"> {
-  let Inst{5-4} = 0b00;
-}
-def VLD3LNd32 : VLD3LN<0b1010, "vld3", "32"> {
-  let Inst{6-4} = 0b000;
-}
+def VLD3LNd8  : VLD3LN<0b0010, "vld3", "8"> { let Inst{4} = 0; }
+def VLD3LNd16 : VLD3LN<0b0110, "vld3", "16"> { let Inst{5-4} = 0b00; }
+def VLD3LNd32 : VLD3LN<0b1010, "vld3", "32"> { let Inst{6-4} = 0b000; }
 
 // vld3 to double-spaced even registers.
-def VLD3LNq16a: VLD3LN<0b0110, "vld3", "16"> {
-  let Inst{5-4} = 0b10;
-}
-def VLD3LNq32a: VLD3LN<0b1010, "vld3", "32"> {
-  let Inst{6-4} = 0b100;
-}
+def VLD3LNq16a: VLD3LN<0b0110, "vld3", "16"> { let Inst{5-4} = 0b10; }
+def VLD3LNq32a: VLD3LN<0b1010, "vld3", "32"> { let Inst{6-4} = 0b100; }
 
 // vld3 to double-spaced odd registers.
-def VLD3LNq16b: VLD3LN<0b0110, "vld3", "16"> {
-  let Inst{5-4} = 0b10;
-}
-def VLD3LNq32b: VLD3LN<0b1010, "vld3", "32"> {
-  let Inst{6-4} = 0b100;
-}
+def VLD3LNq16b: VLD3LN<0b0110, "vld3", "16"> { let Inst{5-4} = 0b10; }
+def VLD3LNq32b: VLD3LN<0b1010, "vld3", "32"> { let Inst{6-4} = 0b100; }
 
 //   VLD4LN   : Vector Load (single 4-element structure to one lane)
 class VLD4LN<bits<4> op11_8, string OpcodeStr, string Dt>
   : NLdSt<1,0b10,op11_8,{?,?,?,?},
             (outs DPR:$dst1, DPR:$dst2, DPR:$dst3, DPR:$dst4),
             (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4,
-            nohash_imm:$lane), IIC_VLD4,
-            OpcodeStr, Dt,
+            nohash_imm:$lane), IIC_VLD4, OpcodeStr, Dt,
           "\\{$dst1[$lane], $dst2[$lane], $dst3[$lane], $dst4[$lane]\\}, $addr",
             "$src1 = $dst1, $src2 = $dst2, $src3 = $dst3, $src4 = $dst4", []>;
 
 // vld4 to single-spaced registers.
 def VLD4LNd8  : VLD4LN<0b0011, "vld4", "8">;
-def VLD4LNd16 : VLD4LN<0b0111, "vld4", "16"> {
-  let Inst{5} = 0;
-}
-def VLD4LNd32 : VLD4LN<0b1011, "vld4", "32"> {
-  let Inst{6} = 0;
-}
+def VLD4LNd16 : VLD4LN<0b0111, "vld4", "16"> { let Inst{5} = 0; }
+def VLD4LNd32 : VLD4LN<0b1011, "vld4", "32"> { let Inst{6} = 0; }
 
 // vld4 to double-spaced even registers.
-def VLD4LNq16a: VLD4LN<0b0111, "vld4", "16"> {
-  let Inst{5} = 1;
-}
-def VLD4LNq32a: VLD4LN<0b1011, "vld4", "32"> {
-  let Inst{6} = 1;
-}
+def VLD4LNq16a: VLD4LN<0b0111, "vld4", "16"> { let Inst{5} = 1; }
+def VLD4LNq32a: VLD4LN<0b1011, "vld4", "32"> { let Inst{6} = 1; }
 
 // vld4 to double-spaced odd registers.
-def VLD4LNq16b: VLD4LN<0b0111, "vld4", "16"> {
-  let Inst{5} = 1;
-}
-def VLD4LNq32b: VLD4LN<0b1011, "vld4", "32"> {
-  let Inst{6} = 1;
-}
+def VLD4LNq16b: VLD4LN<0b0111, "vld4", "16"> { let Inst{5} = 1; }
+def VLD4LNq32b: VLD4LN<0b1011, "vld4", "32"> { let Inst{6} = 1; }
 
 //   VLD1DUP  : Vector Load (single element to all lanes)
 //   VLD2DUP  : Vector Load (single 2-element structure to all lanes)
@@ -418,6 +410,31 @@ def  VST1qf   : VST1Q<0b1000, "vst1", "32", v4f32, int_arm_neon_vst1>;
 def  VST1q64  : VST1Q<0b1100, "vst1", "64", v2i64, int_arm_neon_vst1>;
 } // hasExtraSrcRegAllocReq
 
+// These (dreg triple/quadruple) are for disassembly only.
+class VST1D3<bits<4> op7_4, string OpcodeStr, string Dt>
+  : NLdSt<0, 0b00, 0b0110, op7_4, (outs),
+          (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3), IIC_VST,
+          OpcodeStr, Dt,
+          "\\{$src1, $src2, $src3\\}, $addr", "",
+          [/* For disassembly only; pattern left blank */]>;
+class VST1D4<bits<4> op7_4, string OpcodeStr, string Dt>
+  : NLdSt<0, 0b00, 0b0010, op7_4, (outs),
+          (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4),
+          IIC_VST, OpcodeStr, Dt,
+          "\\{$src1, $src2, $src3, $src4\\}, $addr", "",
+          [/* For disassembly only; pattern left blank */]>;
+
+def  VST1d8T  : VST1D3<0b0000, "vst1", "8">;
+def  VST1d16T : VST1D3<0b0100, "vst1", "16">;
+def  VST1d32T : VST1D3<0b1000, "vst1", "32">;
+//def  VST1d64T : VST1D3<0b1100, "vst1", "64">;
+
+def  VST1d8Q  : VST1D4<0b0000, "vst1", "8">;
+def  VST1d16Q : VST1D4<0b0100, "vst1", "16">;
+def  VST1d32Q : VST1D4<0b1000, "vst1", "32">;
+//def  VST1d64Q : VST1D4<0b1100, "vst1", "64">;
+
+
 let mayStore = 1, hasExtraSrcRegAllocReq = 1 in {
 
 //   VST2     : Vector Store (multiple 2-element structures)
@@ -428,8 +445,7 @@ class VST2D<bits<4> op7_4, string OpcodeStr, string Dt>
 class VST2Q<bits<4> op7_4, string OpcodeStr, string Dt>
   : NLdSt<0,0b00,0b0011,op7_4, (outs),
           (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4),
-          IIC_VST,
-          OpcodeStr, Dt, "\\{$src1, $src2, $src3, $src4\\}, $addr",
+          IIC_VST, OpcodeStr, Dt, "\\{$src1, $src2, $src3, $src4\\}, $addr",
           "", []>;
 
 def  VST2d8   : VST2D<0b0000, "vst2", "8">;
@@ -443,6 +459,16 @@ def  VST2q8   : VST2Q<0b0000, "vst2", "8">;
 def  VST2q16  : VST2Q<0b0100, "vst2", "16">;
 def  VST2q32  : VST2Q<0b1000, "vst2", "32">;
 
+// These (double-spaced dreg pair) are for disassembly only.
+class VST2Ddbl<bits<4> op7_4, string OpcodeStr, string Dt>
+  : NLdSt<0, 0b00, 0b1001, op7_4, (outs),
+          (ins addrmode6:$addr, DPR:$src1, DPR:$src2), IIC_VST,
+          OpcodeStr, Dt, "\\{$src1, $src2\\}, $addr", "", []>;
+
+def  VST2d8D  : VST2Ddbl<0b0000, "vst2", "8">;
+def  VST2d16D : VST2Ddbl<0b0100, "vst2", "16">;
+def  VST2d32D : VST2Ddbl<0b1000, "vst2", "32">;
+
 //   VST3     : Vector Store (multiple 3-element structures)
 class VST3D<bits<4> op7_4, string OpcodeStr, string Dt>
   : NLdSt<0,0b00,0b0100,op7_4, (outs),
@@ -476,14 +502,12 @@ def  VST3q32b : VST3WB<0b1000, "vst3", "32">;
 class VST4D<bits<4> op7_4, string OpcodeStr, string Dt>
   : NLdSt<0,0b00,0b0000,op7_4, (outs),
           (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4),
-          IIC_VST,
-          OpcodeStr, Dt, "\\{$src1, $src2, $src3, $src4\\}, $addr",
+          IIC_VST, OpcodeStr, Dt, "\\{$src1, $src2, $src3, $src4\\}, $addr",
           "", []>;
 class VST4WB<bits<4> op7_4, string OpcodeStr, string Dt>
   : NLdSt<0,0b00,0b0001,op7_4, (outs GPR:$wb),
           (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4),
-          IIC_VST,
-          OpcodeStr, Dt, "\\{$src1, $src2, $src3, $src4\\}, $addr",
+          IIC_VST, OpcodeStr, Dt, "\\{$src1, $src2, $src3, $src4\\}, $addr",
           "$addr.addr = $wb", []>;
 
 def  VST4d8   : VST4D<0b0000, "vst4", "8">;
@@ -511,104 +535,63 @@ def  VST4q32b : VST4WB<0b1000, "vst4", "32">;
 //   VST2LN   : Vector Store (single 2-element structure from one lane)
 class VST2LN<bits<4> op11_8, string OpcodeStr, string Dt>
   : NLdSt<1,0b00,op11_8,{?,?,?,?}, (outs),
-            (ins addrmode6:$addr, DPR:$src1, DPR:$src2, nohash_imm:$lane),
-            IIC_VST,
-            OpcodeStr, Dt, "\\{$src1[$lane], $src2[$lane]\\}, $addr",
-            "", []>;
+          (ins addrmode6:$addr, DPR:$src1, DPR:$src2, nohash_imm:$lane),
+          IIC_VST, OpcodeStr, Dt, "\\{$src1[$lane], $src2[$lane]\\}, $addr",
+          "", []>;
 
 // vst2 to single-spaced registers.
 def VST2LNd8  : VST2LN<0b0001, "vst2", "8">;
-def VST2LNd16 : VST2LN<0b0101, "vst2", "16"> {
-  let Inst{5} = 0;
-}
-def VST2LNd32 : VST2LN<0b1001, "vst2", "32"> {
-  let Inst{6} = 0;
-}
+def VST2LNd16 : VST2LN<0b0101, "vst2", "16"> { let Inst{5} = 0; }
+def VST2LNd32 : VST2LN<0b1001, "vst2", "32"> { let Inst{6} = 0; }
 
 // vst2 to double-spaced even registers.
-def VST2LNq16a: VST2LN<0b0101, "vst2", "16"> {
-  let Inst{5} = 1;
-}
-def VST2LNq32a: VST2LN<0b1001, "vst2", "32"> {
-  let Inst{6} = 1;
-}
+def VST2LNq16a: VST2LN<0b0101, "vst2", "16"> { let Inst{5} = 1; }
+def VST2LNq32a: VST2LN<0b1001, "vst2", "32"> { let Inst{6} = 1; }
 
 // vst2 to double-spaced odd registers.
-def VST2LNq16b: VST2LN<0b0101, "vst2", "16"> {
-  let Inst{5} = 1;
-}
-def VST2LNq32b: VST2LN<0b1001, "vst2", "32"> {
-  let Inst{6} = 1;
-}
+def VST2LNq16b: VST2LN<0b0101, "vst2", "16"> { let Inst{5} = 1; }
+def VST2LNq32b: VST2LN<0b1001, "vst2", "32"> { let Inst{6} = 1; }
 
 //   VST3LN   : Vector Store (single 3-element structure from one lane)
 class VST3LN<bits<4> op11_8, string OpcodeStr, string Dt>
   : NLdSt<1,0b00,op11_8,{?,?,?,?}, (outs),
-            (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3,
-            nohash_imm:$lane), IIC_VST,
-            OpcodeStr, Dt,
-            "\\{$src1[$lane], $src2[$lane], $src3[$lane]\\}, $addr", "", []>;
+          (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3,
+           nohash_imm:$lane), IIC_VST, OpcodeStr, Dt,
+          "\\{$src1[$lane], $src2[$lane], $src3[$lane]\\}, $addr", "", []>;
 
 // vst3 to single-spaced registers.
-def VST3LNd8  : VST3LN<0b0010, "vst3", "8"> {
-  let Inst{4} = 0;
-}
-def VST3LNd16 : VST3LN<0b0110, "vst3", "16"> {
-  let Inst{5-4} = 0b00;
-}
-def VST3LNd32 : VST3LN<0b1010, "vst3", "32"> {
-  let Inst{6-4} = 0b000;
-}
+def VST3LNd8  : VST3LN<0b0010, "vst3", "8"> { let Inst{4} = 0; }
+def VST3LNd16 : VST3LN<0b0110, "vst3", "16"> { let Inst{5-4} = 0b00; }
+def VST3LNd32 : VST3LN<0b1010, "vst3", "32"> { let Inst{6-4} = 0b000; }
 
 // vst3 to double-spaced even registers.
-def VST3LNq16a: VST3LN<0b0110, "vst3", "16"> {
-  let Inst{5-4} = 0b10;
-}
-def VST3LNq32a: VST3LN<0b1010, "vst3", "32"> {
-  let Inst{6-4} = 0b100;
-}
+def VST3LNq16a: VST3LN<0b0110, "vst3", "16"> { let Inst{5-4} = 0b10; }
+def VST3LNq32a: VST3LN<0b1010, "vst3", "32"> { let Inst{6-4} = 0b100; }
 
 // vst3 to double-spaced odd registers.
-def VST3LNq16b: VST3LN<0b0110, "vst3", "16"> {
-  let Inst{5-4} = 0b10;
-}
-def VST3LNq32b: VST3LN<0b1010, "vst3", "32"> {
-  let Inst{6-4} = 0b100;
-}
+def VST3LNq16b: VST3LN<0b0110, "vst3", "16"> { let Inst{5-4} = 0b10; }
+def VST3LNq32b: VST3LN<0b1010, "vst3", "32"> { let Inst{6-4} = 0b100; }
 
 //   VST4LN   : Vector Store (single 4-element structure from one lane)
 class VST4LN<bits<4> op11_8, string OpcodeStr, string Dt>
   : NLdSt<1,0b00,op11_8,{?,?,?,?}, (outs),
-            (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4,
-            nohash_imm:$lane), IIC_VST,
-            OpcodeStr, Dt,
+          (ins addrmode6:$addr, DPR:$src1, DPR:$src2, DPR:$src3, DPR:$src4,
+           nohash_imm:$lane), IIC_VST, OpcodeStr, Dt,
           "\\{$src1[$lane], $src2[$lane], $src3[$lane], $src4[$lane]\\}, $addr",
-            "", []>;
+          "", []>;
 
 // vst4 to single-spaced registers.
 def VST4LNd8  : VST4LN<0b0011, "vst4", "8">;
-def VST4LNd16 : VST4LN<0b0111, "vst4", "16"> {
-  let Inst{5} = 0;
-}
-def VST4LNd32 : VST4LN<0b1011, "vst4", "32"> {
-  let Inst{6} = 0;
-}
+def VST4LNd16 : VST4LN<0b0111, "vst4", "16"> { let Inst{5} = 0; }
+def VST4LNd32 : VST4LN<0b1011, "vst4", "32"> { let Inst{6} = 0; }
 
 // vst4 to double-spaced even registers.
-def VST4LNq16a: VST4LN<0b0111, "vst4", "16"> {
-  let Inst{5} = 1;
-}
-def VST4LNq32a: VST4LN<0b1011, "vst4", "32"> {
-  let Inst{6} = 1;
-}
+def VST4LNq16a: VST4LN<0b0111, "vst4", "16"> { let Inst{5} = 1; }
+def VST4LNq32a: VST4LN<0b1011, "vst4", "32"> { let Inst{6} = 1; }
 
 // vst4 to double-spaced odd registers.
-def VST4LNq16b: VST4LN<0b0111, "vst4", "16"> {
-  let Inst{5} = 1;
-}
-def VST4LNq32b: VST4LN<0b1011, "vst4", "32"> {
-  let Inst{6} = 1;
-}
+def VST4LNq16b: VST4LN<0b0111, "vst4", "16"> { let Inst{5} = 1; }
+def VST4LNq32b: VST4LN<0b1011, "vst4", "32"> { let Inst{6} = 1; }
 
 } // mayStore = 1, hasExtraSrcRegAllocReq = 1
 
@@ -656,34 +639,26 @@ def SubReg_i32_lane : SDNodeXForm<imm, [{
 // Instruction Classes
 //===----------------------------------------------------------------------===//
 
-// Basic 2-register operations, both double- and quad-register.
+// Basic 2-register operations: single-, double- and quad-register.
+class N2VS<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
+           bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
+           string Dt, ValueType ResTy, ValueType OpTy, SDNode OpNode>
+  : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4,
+        (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src),
+        IIC_VUNAD, OpcodeStr, Dt, "$dst, $src", "", []>;
 class N2VD<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
-           bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,string Dt,
-           ValueType ResTy, ValueType OpTy, SDNode OpNode>
+           bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
+           string Dt, ValueType ResTy, ValueType OpTy, SDNode OpNode>
   : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4, (outs DPR:$dst),
         (ins DPR:$src), IIC_VUNAD, OpcodeStr, Dt, "$dst, $src", "",
         [(set DPR:$dst, (ResTy (OpNode (OpTy DPR:$src))))]>;
 class N2VQ<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
-           bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,string Dt,
-           ValueType ResTy, ValueType OpTy, SDNode OpNode>
+           bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,
+           string Dt, ValueType ResTy, ValueType OpTy, SDNode OpNode>
   : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 1, op4, (outs QPR:$dst),
         (ins QPR:$src), IIC_VUNAQ, OpcodeStr, Dt, "$dst, $src", "",
         [(set QPR:$dst, (ResTy (OpNode (OpTy QPR:$src))))]>;
 
-// Basic 2-register operations, scalar single-precision.
-class N2VDs<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
-            bits<2> op17_16, bits<5> op11_7, bit op4, string OpcodeStr,string Dt,
-            ValueType ResTy, ValueType OpTy, SDNode OpNode>
-  : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4,
-        (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src),
-        IIC_VUNAD, OpcodeStr, Dt, "$dst, $src", "", []>;
-
-class N2VDsPat<SDNode OpNode, ValueType ResTy, ValueType OpTy, NeonI Inst>
-  : NEONFPPat<(ResTy (OpNode SPR:$a)),
-       (EXTRACT_SUBREG
-           (Inst (INSERT_SUBREG (OpTy (IMPLICIT_DEF)), SPR:$a, arm_ssubreg_0)),
-        arm_ssubreg_0)>;
-
 // Basic 2-register intrinsics, both double- and quad-register.
 class N2VDInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
               bits<2> op17_16, bits<5> op11_7, bit op4, 
@@ -700,21 +675,6 @@ class N2VQInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
         (ins QPR:$src), itin, OpcodeStr, Dt, "$dst, $src", "",
         [(set QPR:$dst, (ResTy (IntOp (OpTy QPR:$src))))]>;
 
-// Basic 2-register intrinsics, scalar single-precision
-class N2VDInts<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
-              bits<2> op17_16, bits<5> op11_7, bit op4, 
-              InstrItinClass itin, string OpcodeStr, string Dt,
-              ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
-  : N2V<op24_23, op21_20, op19_18, op17_16, op11_7, 0, op4,
-        (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src), itin,
-        OpcodeStr, Dt, "$dst, $src", "", []>;
-
-class N2VDIntsPat<SDNode OpNode, NeonI Inst>
-  : NEONFPPat<(f32 (OpNode SPR:$a)),
-       (EXTRACT_SUBREG
-           (Inst (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$a, arm_ssubreg_0)),
-        arm_ssubreg_0)>;
-
 // Narrow 2-register intrinsics.
 class N2VNInt<bits<2> op24_23, bits<2> op21_20, bits<2> op19_18,
               bits<2> op17_16, bits<5> op11_7, bit op6, bit op4,
@@ -742,15 +702,22 @@ class N2VDShuffle<bits<2> op19_18, bits<5> op11_7, string OpcodeStr, string Dt>
 class N2VQShuffle<bits<2> op19_18, bits<5> op11_7,
                   InstrItinClass itin, string OpcodeStr, string Dt>
   : N2V<0b11, 0b11, op19_18, 0b10, op11_7, 1, 0, (outs QPR:$dst1, QPR:$dst2),
-        (ins QPR:$src1, QPR:$src2), itin, 
-        OpcodeStr, Dt, "$dst1, $dst2",
+        (ins QPR:$src1, QPR:$src2), itin, OpcodeStr, Dt, "$dst1, $dst2",
         "$src1 = $dst1, $src2 = $dst2", []>;
 
-// Basic 3-register operations, both double- and quad-register.
+// Basic 3-register operations: single-, double- and quad-register.
+class N3VS<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
+           string OpcodeStr, string Dt, ValueType ResTy, ValueType OpTy,
+           SDNode OpNode, bit Commutable>
+  : N3V<op24, op23, op21_20, op11_8, 0, op4,
+        (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src1, DPR_VFP2:$src2), IIC_VBIND,
+        OpcodeStr, Dt, "$dst, $src1, $src2", "", []> {
+  let isCommutable = Commutable;
+}
+
 class N3VD<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
            InstrItinClass itin, string OpcodeStr, string Dt,
-           ValueType ResTy, ValueType OpTy,
-           SDNode OpNode, bit Commutable>
+           ValueType ResTy, ValueType OpTy, SDNode OpNode, bit Commutable>
   : N3V<op24, op23, op21_20, op11_8, 0, op4,
         (outs DPR:$dst), (ins DPR:$src1, DPR:$src2), itin, 
         OpcodeStr, Dt, "$dst, $src1, $src2", "",
@@ -763,9 +730,9 @@ class N3VDX<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
            ValueType ResTy, ValueType OpTy,
            SDNode OpNode, bit Commutable>
   : N3VX<op24, op23, op21_20, op11_8, 0, op4,
-        (outs DPR:$dst), (ins DPR:$src1, DPR:$src2), itin, 
-        OpcodeStr, "$dst, $src1, $src2", "",
-        [(set DPR:$dst, (ResTy (OpNode (OpTy DPR:$src1), (OpTy DPR:$src2))))]> {
+         (outs DPR:$dst), (ins DPR:$src1, DPR:$src2), itin, 
+         OpcodeStr, "$dst, $src1, $src2", "",
+         [(set DPR:$dst, (ResTy (OpNode (OpTy DPR:$src1), (OpTy DPR:$src2))))]>{
   let isCommutable = Commutable;
 }
 class N3VDSL<bits<2> op21_20, bits<4> op11_8, 
@@ -776,27 +743,23 @@ class N3VDSL<bits<2> op21_20, bits<4> op11_8,
         itin, OpcodeStr, Dt, "$dst, $src1, $src2[$lane]", "",
         [(set (Ty DPR:$dst),
               (Ty (ShOp (Ty DPR:$src1),
-                        (Ty (NEONvduplane (Ty DPR_VFP2:$src2),
-                                          imm:$lane)))))]> {
+                        (Ty (NEONvduplane (Ty DPR_VFP2:$src2), imm:$lane)))))]>{
   let isCommutable = 0;
 }
 class N3VDSL16<bits<2> op21_20, bits<4> op11_8, 
                string OpcodeStr, string Dt, ValueType Ty, SDNode ShOp>
   : N3V<0, 1, op21_20, op11_8, 1, 0,
         (outs DPR:$dst), (ins DPR:$src1, DPR_8:$src2, nohash_imm:$lane),
-        IIC_VMULi16D,
-        OpcodeStr, Dt, "$dst, $src1, $src2[$lane]", "",
+        IIC_VMULi16D, OpcodeStr, Dt, "$dst, $src1, $src2[$lane]", "",
         [(set (Ty DPR:$dst),
               (Ty (ShOp (Ty DPR:$src1),
-                        (Ty (NEONvduplane (Ty DPR_8:$src2),
-                                          imm:$lane)))))]> {
+                        (Ty (NEONvduplane (Ty DPR_8:$src2), imm:$lane)))))]> {
   let isCommutable = 0;
 }
 
 class N3VQ<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
            InstrItinClass itin, string OpcodeStr, string Dt,
-           ValueType ResTy, ValueType OpTy,
-           SDNode OpNode, bit Commutable>
+           ValueType ResTy, ValueType OpTy, SDNode OpNode, bit Commutable>
   : N3V<op24, op23, op21_20, op11_8, 1, op4,
         (outs QPR:$dst), (ins QPR:$src1, QPR:$src2), itin, 
         OpcodeStr, Dt, "$dst, $src1, $src2", "",
@@ -805,12 +768,11 @@ class N3VQ<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
 }
 class N3VQX<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
            InstrItinClass itin, string OpcodeStr,
-           ValueType ResTy, ValueType OpTy,
-           SDNode OpNode, bit Commutable>
+           ValueType ResTy, ValueType OpTy, SDNode OpNode, bit Commutable>
   : N3VX<op24, op23, op21_20, op11_8, 1, op4,
-        (outs QPR:$dst), (ins QPR:$src1, QPR:$src2), itin, 
-        OpcodeStr, "$dst, $src1, $src2", "",
-        [(set QPR:$dst, (ResTy (OpNode (OpTy QPR:$src1), (OpTy QPR:$src2))))]> {
+         (outs QPR:$dst), (ins QPR:$src1, QPR:$src2), itin, 
+         OpcodeStr, "$dst, $src1, $src2", "",
+         [(set QPR:$dst, (ResTy (OpNode (OpTy QPR:$src1), (OpTy QPR:$src2))))]>{
   let isCommutable = Commutable;
 }
 class N3VQSL<bits<2> op21_20, bits<4> op11_8, 
@@ -825,13 +787,11 @@ class N3VQSL<bits<2> op21_20, bits<4> op11_8,
                                                 imm:$lane)))))]> {
   let isCommutable = 0;
 }
-class N3VQSL16<bits<2> op21_20, bits<4> op11_8, 
-               string OpcodeStr, string Dt,
+class N3VQSL16<bits<2> op21_20, bits<4> op11_8, string OpcodeStr, string Dt,
                ValueType ResTy, ValueType OpTy, SDNode ShOp>
   : N3V<1, 1, op21_20, op11_8, 1, 0,
         (outs QPR:$dst), (ins QPR:$src1, DPR_8:$src2, nohash_imm:$lane),
-        IIC_VMULi16Q,
-        OpcodeStr, Dt, "$dst, $src1, $src2[$lane]", "",
+        IIC_VMULi16Q, OpcodeStr, Dt, "$dst, $src1, $src2[$lane]", "",
         [(set (ResTy QPR:$dst),
               (ResTy (ShOp (ResTy QPR:$src1),
                            (ResTy (NEONvduplane (OpTy DPR_8:$src2),
@@ -839,27 +799,10 @@ class N3VQSL16<bits<2> op21_20, bits<4> op11_8,
   let isCommutable = 0;
 }
 
-// Basic 3-register operations, scalar single-precision
-class N3VDs<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
-           string OpcodeStr, string Dt, ValueType ResTy, ValueType OpTy,
-           SDNode OpNode, bit Commutable>
-  : N3V<op24, op23, op21_20, op11_8, 0, op4,
-        (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src1, DPR_VFP2:$src2), IIC_VBIND,
-        OpcodeStr, Dt, "$dst, $src1, $src2", "", []> {
-  let isCommutable = Commutable;
-}
-class N3VDsPat<SDNode OpNode, NeonI Inst>
-  : NEONFPPat<(f32 (OpNode SPR:$a, SPR:$b)),
-       (EXTRACT_SUBREG
-           (Inst (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$a, arm_ssubreg_0),
-                 (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$b, arm_ssubreg_0)),
-        arm_ssubreg_0)>;
-
 // Basic 3-register intrinsics, both double- and quad-register.
 class N3VDInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
               InstrItinClass itin, string OpcodeStr, string Dt,
-              ValueType ResTy, ValueType OpTy,
-              Intrinsic IntOp, bit Commutable>
+              ValueType ResTy, ValueType OpTy, Intrinsic IntOp, bit Commutable>
   : N3V<op24, op23, op21_20, op11_8, 0, op4,
         (outs DPR:$dst), (ins DPR:$src1, DPR:$src2), itin, 
         OpcodeStr, Dt, "$dst, $src1, $src2", "",
@@ -891,8 +834,7 @@ class N3VDIntSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
 
 class N3VQInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
               InstrItinClass itin, string OpcodeStr, string Dt,
-              ValueType ResTy, ValueType OpTy,
-              Intrinsic IntOp, bit Commutable>
+              ValueType ResTy, ValueType OpTy, Intrinsic IntOp, bit Commutable>
   : N3V<op24, op23, op21_20, op11_8, 1, op4,
         (outs QPR:$dst), (ins QPR:$src1, QPR:$src2), itin, 
         OpcodeStr, Dt, "$dst, $src1, $src2", "",
@@ -924,7 +866,15 @@ class N3VQIntSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
   let isCommutable = 0;
 }
 
-// Multiply-Add/Sub operations, both double- and quad-register.
+// Multiply-Add/Sub operations: single-, double- and quad-register.
+class N3VSMulOp<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
+                InstrItinClass itin, string OpcodeStr, string Dt,
+                ValueType Ty, SDNode MulOp, SDNode OpNode>
+  : N3V<op24, op23, op21_20, op11_8, 0, op4,
+        (outs DPR_VFP2:$dst),
+        (ins DPR_VFP2:$src1, DPR_VFP2:$src2, DPR_VFP2:$src3), itin,
+        OpcodeStr, Dt, "$dst, $src2, $src3", "$src1 = $dst", []>;
+
 class N3VDMulOp<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
                 InstrItinClass itin, string OpcodeStr, string Dt,
                 ValueType Ty, SDNode MulOp, SDNode OpNode>
@@ -976,8 +926,8 @@ class N3VQMulOpSL<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
         [(set (ResTy QPR:$dst),
               (ResTy (ShOp (ResTy QPR:$src1),
                            (ResTy (MulOp QPR:$src2,
-                                         (ResTy (NEONvduplane (OpTy DPR_VFP2:$src3),
-                                                              imm:$lane)))))))]>;
+                                   (ResTy (NEONvduplane (OpTy DPR_VFP2:$src3),
+                                                        imm:$lane)))))))]>;
 class N3VQMulOpSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
                     string OpcodeStr, string Dt,
                     ValueType ResTy, ValueType OpTy,
@@ -989,25 +939,8 @@ class N3VQMulOpSL16<bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
         [(set (ResTy QPR:$dst),
               (ResTy (ShOp (ResTy QPR:$src1),
                            (ResTy (MulOp QPR:$src2,
-                                         (ResTy (NEONvduplane (OpTy DPR_8:$src3),
-                                                              imm:$lane)))))))]>;
-
-// Multiply-Add/Sub operations, scalar single-precision
-class N3VDMulOps<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
-                 InstrItinClass itin, string OpcodeStr, string Dt,
-                 ValueType Ty, SDNode MulOp, SDNode OpNode>
-  : N3V<op24, op23, op21_20, op11_8, 0, op4,
-        (outs DPR_VFP2:$dst),
-        (ins DPR_VFP2:$src1, DPR_VFP2:$src2, DPR_VFP2:$src3), itin,
-        OpcodeStr, Dt, "$dst, $src2, $src3", "$src1 = $dst", []>;
-
-class N3VDMulOpsPat<SDNode MulNode, SDNode OpNode, NeonI Inst>
-  : NEONFPPat<(f32 (OpNode SPR:$acc, (f32 (MulNode SPR:$a, SPR:$b)))),
-      (EXTRACT_SUBREG
-          (Inst (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$acc, arm_ssubreg_0),
-                (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$a,   arm_ssubreg_0),
-                (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)), SPR:$b,   arm_ssubreg_0)),
-       arm_ssubreg_0)>;
+                                   (ResTy (NEONvduplane (OpTy DPR_8:$src3),
+                                                        imm:$lane)))))))]>;
 
 // Neon 3-argument intrinsics, both double- and quad-register.
 // The destination register is also used as the first source operand register.
@@ -1050,9 +983,9 @@ class N3VLInt3SL<bit op24, bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
                             (OpTy DPR:$src2),
                             (OpTy (NEONvduplane (OpTy DPR_VFP2:$src3),
                                                 imm:$lane)))))]>;
-class N3VLInt3SL16<bit op24, bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
-                   string OpcodeStr, string Dt, ValueType ResTy, ValueType OpTy,
-                   Intrinsic IntOp>
+class N3VLInt3SL16<bit op24, bits<2> op21_20, bits<4> op11_8,
+                   InstrItinClass itin, string OpcodeStr, string Dt,
+                   ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
   : N3V<op24, 1, op21_20, op11_8, 1, 0,
         (outs QPR:$dst),
         (ins QPR:$src1, DPR:$src2, DPR_8:$src3, nohash_imm:$lane), itin,
@@ -1063,7 +996,6 @@ class N3VLInt3SL16<bit op24, bits<2> op21_20, bits<4> op11_8, InstrItinClass iti
                             (OpTy (NEONvduplane (OpTy DPR_8:$src3),
                                                 imm:$lane)))))]>;
 
-
 // Narrowing 3-register intrinsics.
 class N3VNInt<bit op24, bit op23, bits<2> op21_20, bits<4> op11_8, bit op4,
               string OpcodeStr, string Dt, ValueType TyD, ValueType TyQ,
@@ -1095,9 +1027,9 @@ class N3VLIntSL<bit op24, bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
               (ResTy (IntOp (OpTy DPR:$src1),
                             (OpTy (NEONvduplane (OpTy DPR_VFP2:$src2),
                                                 imm:$lane)))))]>;
-class N3VLIntSL16<bit op24, bits<2> op21_20, bits<4> op11_8, InstrItinClass itin,
-                  string OpcodeStr, string Dt, ValueType ResTy, ValueType OpTy, 
-                  Intrinsic IntOp>
+class N3VLIntSL16<bit op24, bits<2> op21_20, bits<4> op11_8,
+                  InstrItinClass itin, string OpcodeStr, string Dt,
+                  ValueType ResTy, ValueType OpTy, Intrinsic IntOp>
   : N3V<op24, 1, op21_20, op11_8, 1, 0,
         (outs QPR:$dst), (ins DPR:$src1, DPR_8:$src2, nohash_imm:$lane), 
         itin, OpcodeStr, Dt, "$dst, $src1, $src2[$lane]", "",
@@ -1249,6 +1181,45 @@ class N2VCvtQ<bit op24, bit op23, bits<4> op11_8, bit op7, bit op4,
 //   S = single int (32 bit) elements
 //   D = double int (64 bit) elements
 
+// Neon 2-register vector operations -- for disassembly only.
+
+// First with only element sizes of 8, 16 and 32 bits:
+multiclass N2V_QHS_cmp<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
+                       bits<5> op11_7, bit op4, string opc, string Dt,
+                       string asm> {
+  // 64-bit vector types.
+  def v8i8  : N2V<op24_23, op21_20, 0b00, op17_16, op11_7, 0, op4,
+                  (outs DPR:$dst), (ins DPR:$src), NoItinerary,
+                  opc, !strconcat(Dt, "8"), asm, "", []>;
+  def v4i16 : N2V<op24_23, op21_20, 0b01, op17_16, op11_7, 0, op4,
+                  (outs DPR:$dst), (ins DPR:$src), NoItinerary,
+                  opc, !strconcat(Dt, "16"), asm, "", []>;
+  def v2i32 : N2V<op24_23, op21_20, 0b10, op17_16, op11_7, 0, op4,
+                  (outs DPR:$dst), (ins DPR:$src), NoItinerary,
+                  opc, !strconcat(Dt, "32"), asm, "", []>;
+  def v2f32 : N2V<op24_23, op21_20, 0b10, op17_16, op11_7, 0, op4,
+                  (outs DPR:$dst), (ins DPR:$src), NoItinerary,
+                  opc, "f32", asm, "", []> {
+    let Inst{10} = 1; // overwrite F = 1
+  }
+
+  // 128-bit vector types.
+  def v16i8 : N2V<op24_23, op21_20, 0b00, op17_16, op11_7, 1, op4,
+                  (outs QPR:$dst), (ins QPR:$src), NoItinerary,
+                  opc, !strconcat(Dt, "8"), asm, "", []>;
+  def v8i16 : N2V<op24_23, op21_20, 0b01, op17_16, op11_7, 1, op4,
+                  (outs QPR:$dst), (ins QPR:$src), NoItinerary,
+                  opc, !strconcat(Dt, "16"), asm, "", []>;
+  def v4i32 : N2V<op24_23, op21_20, 0b10, op17_16, op11_7, 1, op4,
+                  (outs QPR:$dst), (ins QPR:$src), NoItinerary,
+                  opc, !strconcat(Dt, "32"), asm, "", []>;
+  def v4f32 : N2V<op24_23, op21_20, 0b10, op17_16, op11_7, 1, op4,
+                  (outs QPR:$dst), (ins QPR:$src), NoItinerary,
+                  opc, "f32", asm, "", []> {
+    let Inst{10} = 1; // overwrite F = 1
+  }
+}
+
 // Neon 3-register vector operations.
 
 // First with only element sizes of 8, 16 and 32 bits:
@@ -1262,22 +1233,22 @@ multiclass N3V_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
                    OpcodeStr, !strconcat(Dt, "8"),
                    v8i8, v8i8, OpNode, Commutable>;
   def v4i16 : N3VD<op24, op23, 0b01, op11_8, op4, itinD16,
-                 OpcodeStr, !strconcat(Dt, "16"),
-                 v4i16, v4i16, OpNode, Commutable>;
+                   OpcodeStr, !strconcat(Dt, "16"),
+                   v4i16, v4i16, OpNode, Commutable>;
   def v2i32 : N3VD<op24, op23, 0b10, op11_8, op4, itinD32,
-                 OpcodeStr, !strconcat(Dt, "32"),
-                 v2i32, v2i32, OpNode, Commutable>;
+                   OpcodeStr, !strconcat(Dt, "32"),
+                   v2i32, v2i32, OpNode, Commutable>;
 
   // 128-bit vector types.
   def v16i8 : N3VQ<op24, op23, 0b00, op11_8, op4, itinQ16,
-                  OpcodeStr, !strconcat(Dt, "8"),
-                  v16i8, v16i8, OpNode, Commutable>;
+                   OpcodeStr, !strconcat(Dt, "8"),
+                   v16i8, v16i8, OpNode, Commutable>;
   def v8i16 : N3VQ<op24, op23, 0b01, op11_8, op4, itinQ16,
-                 OpcodeStr, !strconcat(Dt, "16"),
-                 v8i16, v8i16, OpNode, Commutable>;
+                   OpcodeStr, !strconcat(Dt, "16"),
+                   v8i16, v8i16, OpNode, Commutable>;
   def v4i32 : N3VQ<op24, op23, 0b10, op11_8, op4, itinQ32,
-                 OpcodeStr, !strconcat(Dt, "32"),
-                 v4i32, v4i32, OpNode, Commutable>;
+                   OpcodeStr, !strconcat(Dt, "32"),
+                   v4i32, v4i32, OpNode, Commutable>;
 }
 
 multiclass N3VSL_HS<bits<4> op11_8, string OpcodeStr, string Dt, SDNode ShOp> {
@@ -1372,7 +1343,7 @@ multiclass N3VIntSL_HS<bits<4> op11_8,
   def v2i32 : N3VDIntSL<0b10, op11_8, itinD32,
                         OpcodeStr, !strconcat(Dt, "32"), v2i32, IntOp>;
   def v8i16 : N3VQIntSL16<0b01, op11_8, itinQ16,
-                        OpcodeStr, !strconcat(Dt, "16"), v8i16, v4i16, IntOp>;
+                          OpcodeStr, !strconcat(Dt, "16"), v8i16, v4i16, IntOp>;
   def v4i32 : N3VQIntSL<0b10, op11_8, itinQ32,
                         OpcodeStr, !strconcat(Dt, "32"), v4i32, v2i32, IntOp>;
 }
@@ -1386,8 +1357,8 @@ multiclass N3VInt_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
   : N3VInt_HS<op24, op23, op11_8, op4, itinD16, itinD32, itinQ16, itinQ32,
               OpcodeStr, Dt, IntOp, Commutable> {
   def v8i8  : N3VDInt<op24, op23, 0b00, op11_8, op4, itinD16,
-                     OpcodeStr, !strconcat(Dt, "8"),
-                     v8i8, v8i8, IntOp, Commutable>;
+                      OpcodeStr, !strconcat(Dt, "8"),
+                      v8i8, v8i8, IntOp, Commutable>;
   def v16i8 : N3VQInt<op24, op23, 0b00, op11_8, op4, itinQ16,
                       OpcodeStr, !strconcat(Dt, "8"),
                       v16i8, v16i8, IntOp, Commutable>;
@@ -1402,11 +1373,11 @@ multiclass N3VInt_QHSD<bit op24, bit op23, bits<4> op11_8, bit op4,
   : N3VInt_QHS<op24, op23, op11_8, op4, itinD16, itinD32, itinQ16, itinQ32,
                OpcodeStr, Dt, IntOp, Commutable> {
   def v1i64 : N3VDInt<op24, op23, 0b11, op11_8, op4, itinD32,
-                   OpcodeStr, !strconcat(Dt, "64"),
-                   v1i64, v1i64, IntOp, Commutable>;
+                      OpcodeStr, !strconcat(Dt, "64"),
+                      v1i64, v1i64, IntOp, Commutable>;
   def v2i64 : N3VQInt<op24, op23, 0b11, op11_8, op4, itinQ32,
-                   OpcodeStr, !strconcat(Dt, "64"),
-                   v2i64, v2i64, IntOp, Commutable>;
+                      OpcodeStr, !strconcat(Dt, "64"),
+                      v2i64, v2i64, IntOp, Commutable>;
 }
 
 
@@ -1511,9 +1482,11 @@ multiclass N3VMulOpSL_HS<bits<4> op11_8,
   def v2i32 : N3VDMulOpSL<0b10, op11_8, itinD32,
                           OpcodeStr, !strconcat(Dt, "32"), v2i32, mul, ShOp>;
   def v8i16 : N3VQMulOpSL16<0b01, op11_8, itinQ16,
-                      OpcodeStr, !strconcat(Dt, "16"), v8i16, v4i16, mul, ShOp>;
+                            OpcodeStr, !strconcat(Dt, "16"), v8i16, v4i16,
+                            mul, ShOp>;
   def v4i32 : N3VQMulOpSL<0b10, op11_8, itinQ32,
-                      OpcodeStr, !strconcat(Dt, "32"), v4i32, v2i32, mul, ShOp>;
+                          OpcodeStr, !strconcat(Dt, "32"), v4i32, v2i32,
+                          mul, ShOp>;
 }
 
 // Neon 3-argument intrinsics,
@@ -1522,19 +1495,19 @@ multiclass N3VInt3_QHS<bit op24, bit op23, bits<4> op11_8, bit op4,
                        string OpcodeStr, string Dt, Intrinsic IntOp> {
   // 64-bit vector types.
   def v8i8  : N3VDInt3<op24, op23, 0b00, op11_8, op4, IIC_VMACi16D,
-                        OpcodeStr, !strconcat(Dt, "8"), v8i8, v8i8, IntOp>;
+                       OpcodeStr, !strconcat(Dt, "8"), v8i8, v8i8, IntOp>;
   def v4i16 : N3VDInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16D,
-                        OpcodeStr, !strconcat(Dt, "16"), v4i16, v4i16, IntOp>;
+                       OpcodeStr, !strconcat(Dt, "16"), v4i16, v4i16, IntOp>;
   def v2i32 : N3VDInt3<op24, op23, 0b10, op11_8, op4, IIC_VMACi32D,
-                        OpcodeStr, !strconcat(Dt, "32"), v2i32, v2i32, IntOp>;
+                       OpcodeStr, !strconcat(Dt, "32"), v2i32, v2i32, IntOp>;
 
   // 128-bit vector types.
   def v16i8 : N3VQInt3<op24, op23, 0b00, op11_8, op4, IIC_VMACi16Q,
-                        OpcodeStr, !strconcat(Dt, "8"), v16i8, v16i8, IntOp>;
+                       OpcodeStr, !strconcat(Dt, "8"), v16i8, v16i8, IntOp>;
   def v8i16 : N3VQInt3<op24, op23, 0b01, op11_8, op4, IIC_VMACi16Q,
-                        OpcodeStr, !strconcat(Dt, "16"), v8i16, v8i16, IntOp>;
+                       OpcodeStr, !strconcat(Dt, "16"), v8i16, v8i16, IntOp>;
   def v4i32 : N3VQInt3<op24, op23, 0b10, op11_8, op4, IIC_VMACi32Q,
-                        OpcodeStr, !strconcat(Dt, "32"), v4i32, v4i32, IntOp>;
+                       OpcodeStr, !strconcat(Dt, "32"), v4i32, v4i32, IntOp>;
 }
 
 
@@ -1576,17 +1549,17 @@ multiclass N2VInt_QHS<bits<2> op24_23, bits<2> op21_20, bits<2> op17_16,
   def v8i8  : N2VDInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
                       itinD, OpcodeStr, !strconcat(Dt, "8"), v8i8, v8i8, IntOp>;
   def v4i16 : N2VDInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
-                   itinD, OpcodeStr, !strconcat(Dt, "16"), v4i16, v4i16, IntOp>;
+                      itinD, OpcodeStr, !strconcat(Dt, "16"),v4i16,v4i16,IntOp>;
   def v2i32 : N2VDInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
-                   itinD, OpcodeStr, !strconcat(Dt, "32"), v2i32, v2i32, IntOp>;
+                      itinD, OpcodeStr, !strconcat(Dt, "32"),v2i32,v2i32,IntOp>;
 
   // 128-bit vector types.
   def v16i8 : N2VQInt<op24_23, op21_20, 0b00, op17_16, op11_7, op4,
-                    itinQ, OpcodeStr, !strconcat(Dt, "8"), v16i8, v16i8, IntOp>;
+                      itinQ, OpcodeStr, !strconcat(Dt, "8"), v16i8,v16i8,IntOp>;
   def v8i16 : N2VQInt<op24_23, op21_20, 0b01, op17_16, op11_7, op4,
-                   itinQ, OpcodeStr, !strconcat(Dt, "16"), v8i16, v8i16, IntOp>;
+                      itinQ, OpcodeStr, !strconcat(Dt, "16"),v8i16,v8i16,IntOp>;
   def v4i32 : N2VQInt<op24_23, op21_20, 0b10, op17_16, op11_7, op4,
-                   itinQ, OpcodeStr, !strconcat(Dt, "32"), v4i32, v4i32, IntOp>;
+                      itinQ, OpcodeStr, !strconcat(Dt, "32"),v4i32,v4i32,IntOp>;
 }
 
 
@@ -1846,29 +1819,31 @@ def  VMULpd   : N3VDInt<1, 0, 0b00, 0b1001, 1, IIC_VMULi16D, "vmul", "p8",
 def  VMULpq   : N3VQInt<1, 0, 0b00, 0b1001, 1, IIC_VMULi16Q, "vmul", "p8",
                         v16i8, v16i8, int_arm_neon_vmulp, 1>;
 def  VMULfd   : N3VD<1, 0, 0b00, 0b1101, 1, IIC_VBIND, "vmul", "f32",
-                        v2f32, v2f32, fmul, 1>;
+                     v2f32, v2f32, fmul, 1>;
 def  VMULfq   : N3VQ<1, 0, 0b00, 0b1101, 1, IIC_VBINQ, "vmul", "f32",
-                        v4f32, v4f32, fmul, 1>;
-defm VMULsl  : N3VSL_HS<0b1000, "vmul", "i", mul>;
-def VMULslfd : N3VDSL<0b10, 0b1001, IIC_VBIND, "vmul", "f32", v2f32, fmul>;
-def VMULslfq : N3VQSL<0b10, 0b1001, IIC_VBINQ, "vmul", "f32", v4f32, v2f32, fmul>;
+                     v4f32, v4f32, fmul, 1>;
+defm VMULsl   : N3VSL_HS<0b1000, "vmul", "i", mul>;
+def  VMULslfd : N3VDSL<0b10, 0b1001, IIC_VBIND, "vmul", "f32", v2f32, fmul>;
+def  VMULslfq : N3VQSL<0b10, 0b1001, IIC_VBINQ, "vmul", "f32", v4f32,
+                       v2f32, fmul>;
+
 def : Pat<(v8i16 (mul (v8i16 QPR:$src1),
                       (v8i16 (NEONvduplane (v8i16 QPR:$src2), imm:$lane)))),
           (v8i16 (VMULslv8i16 (v8i16 QPR:$src1),
                               (v4i16 (EXTRACT_SUBREG QPR:$src2,
-                                                     (DSubReg_i16_reg imm:$lane))),
+                                      (DSubReg_i16_reg imm:$lane))),
                               (SubReg_i16_lane imm:$lane)))>;
 def : Pat<(v4i32 (mul (v4i32 QPR:$src1),
                       (v4i32 (NEONvduplane (v4i32 QPR:$src2), imm:$lane)))),
           (v4i32 (VMULslv4i32 (v4i32 QPR:$src1),
                               (v2i32 (EXTRACT_SUBREG QPR:$src2,
-                                                     (DSubReg_i32_reg imm:$lane))),
+                                      (DSubReg_i32_reg imm:$lane))),
                               (SubReg_i32_lane imm:$lane)))>;
 def : Pat<(v4f32 (fmul (v4f32 QPR:$src1),
                        (v4f32 (NEONvduplane (v4f32 QPR:$src2), imm:$lane)))),
           (v4f32 (VMULslfq (v4f32 QPR:$src1),
                            (v2f32 (EXTRACT_SUBREG QPR:$src2,
-                                                  (DSubReg_i32_reg imm:$lane))),
+                                   (DSubReg_i32_reg imm:$lane))),
                            (SubReg_i32_lane imm:$lane)))>;
 
 //   VQDMULH  : Vector Saturating Doubling Multiply Returning High Half
@@ -1883,14 +1858,14 @@ def : Pat<(v8i16 (int_arm_neon_vqdmulh (v8i16 QPR:$src1),
                                                             imm:$lane)))),
           (v8i16 (VQDMULHslv8i16 (v8i16 QPR:$src1),
                                  (v4i16 (EXTRACT_SUBREG QPR:$src2,
-                                                  (DSubReg_i16_reg imm:$lane))),
+                                         (DSubReg_i16_reg imm:$lane))),
                                  (SubReg_i16_lane imm:$lane)))>;
 def : Pat<(v4i32 (int_arm_neon_vqdmulh (v4i32 QPR:$src1),
                                        (v4i32 (NEONvduplane (v4i32 QPR:$src2),
                                                             imm:$lane)))),
           (v4i32 (VQDMULHslv4i32 (v4i32 QPR:$src1),
                                  (v2i32 (EXTRACT_SUBREG QPR:$src2,
-                                                  (DSubReg_i32_reg imm:$lane))),
+                                         (DSubReg_i32_reg imm:$lane))),
                                  (SubReg_i32_lane imm:$lane)))>;
 
 //   VQRDMULH : Vector Rounding Saturating Doubling Multiply Returning High Half
@@ -1905,14 +1880,14 @@ def : Pat<(v8i16 (int_arm_neon_vqrdmulh (v8i16 QPR:$src1),
                                                              imm:$lane)))),
           (v8i16 (VQRDMULHslv8i16 (v8i16 QPR:$src1),
                                   (v4i16 (EXTRACT_SUBREG QPR:$src2,
-                                                         (DSubReg_i16_reg imm:$lane))),
+                                          (DSubReg_i16_reg imm:$lane))),
                                   (SubReg_i16_lane imm:$lane)))>;
 def : Pat<(v4i32 (int_arm_neon_vqrdmulh (v4i32 QPR:$src1),
                                         (v4i32 (NEONvduplane (v4i32 QPR:$src2),
                                                              imm:$lane)))),
           (v4i32 (VQRDMULHslv4i32 (v4i32 QPR:$src1),
                                   (v2i32 (EXTRACT_SUBREG QPR:$src2,
-                                                  (DSubReg_i32_reg imm:$lane))),
+                                          (DSubReg_i32_reg imm:$lane))),
                                   (SubReg_i32_lane imm:$lane)))>;
 
 //   VMULL    : Vector Multiply Long (integer and polynomial) (Q = D * D)
@@ -1950,30 +1925,28 @@ def  VMLAslfq : N3VQMulOpSL<0b10, 0b0001, IIC_VMACQ, "vmla", "f32",
                             v4f32, v2f32, fmul, fadd>;
 
 def : Pat<(v8i16 (add (v8i16 QPR:$src1),
-                      (mul (v8i16 QPR:$src2),
-                           (v8i16 (NEONvduplane (v8i16 QPR:$src3), imm:$lane))))),
-          (v8i16 (VMLAslv8i16 (v8i16 QPR:$src1),
-                              (v8i16 QPR:$src2),
+                  (mul (v8i16 QPR:$src2),
+                       (v8i16 (NEONvduplane (v8i16 QPR:$src3), imm:$lane))))),
+          (v8i16 (VMLAslv8i16 (v8i16 QPR:$src1), (v8i16 QPR:$src2),
                               (v4i16 (EXTRACT_SUBREG QPR:$src3,
-                                                     (DSubReg_i16_reg imm:$lane))),
+                                      (DSubReg_i16_reg imm:$lane))),
                               (SubReg_i16_lane imm:$lane)))>;
 
 def : Pat<(v4i32 (add (v4i32 QPR:$src1),
-                      (mul (v4i32 QPR:$src2),
-                           (v4i32 (NEONvduplane (v4i32 QPR:$src3), imm:$lane))))),
-          (v4i32 (VMLAslv4i32 (v4i32 QPR:$src1),
-                              (v4i32 QPR:$src2),
+                  (mul (v4i32 QPR:$src2),
+                       (v4i32 (NEONvduplane (v4i32 QPR:$src3), imm:$lane))))),
+          (v4i32 (VMLAslv4i32 (v4i32 QPR:$src1), (v4i32 QPR:$src2),
                               (v2i32 (EXTRACT_SUBREG QPR:$src3,
-                                                  (DSubReg_i32_reg imm:$lane))),
+                                      (DSubReg_i32_reg imm:$lane))),
                               (SubReg_i32_lane imm:$lane)))>;
 
 def : Pat<(v4f32 (fadd (v4f32 QPR:$src1),
-                       (fmul (v4f32 QPR:$src2),
-                             (v4f32 (NEONvduplane (v4f32 QPR:$src3), imm:$lane))))),
+                  (fmul (v4f32 QPR:$src2),
+                        (v4f32 (NEONvduplane (v4f32 QPR:$src3), imm:$lane))))),
           (v4f32 (VMLAslfq (v4f32 QPR:$src1),
                            (v4f32 QPR:$src2),
                            (v2f32 (EXTRACT_SUBREG QPR:$src3,
-                                                  (DSubReg_i32_reg imm:$lane))),
+                                   (DSubReg_i32_reg imm:$lane))),
                            (SubReg_i32_lane imm:$lane)))>;
 
 //   VMLAL    : Vector Multiply Accumulate Long (Q += D * D)
@@ -2003,30 +1976,27 @@ def  VMLSslfq : N3VQMulOpSL<0b10, 0b0101, IIC_VMACQ, "vmls", "f32",
                             v4f32, v2f32, fmul, fsub>;
 
 def : Pat<(v8i16 (sub (v8i16 QPR:$src1),
-                      (mul (v8i16 QPR:$src2),
-                           (v8i16 (NEONvduplane (v8i16 QPR:$src3), imm:$lane))))),
-          (v8i16 (VMLSslv8i16 (v8i16 QPR:$src1),
-                              (v8i16 QPR:$src2),
+                  (mul (v8i16 QPR:$src2),
+                       (v8i16 (NEONvduplane (v8i16 QPR:$src3), imm:$lane))))),
+          (v8i16 (VMLSslv8i16 (v8i16 QPR:$src1), (v8i16 QPR:$src2),
                               (v4i16 (EXTRACT_SUBREG QPR:$src3,
-                                                     (DSubReg_i16_reg imm:$lane))),
+                                      (DSubReg_i16_reg imm:$lane))),
                               (SubReg_i16_lane imm:$lane)))>;
 
 def : Pat<(v4i32 (sub (v4i32 QPR:$src1),
-                      (mul (v4i32 QPR:$src2),
-                         (v4i32 (NEONvduplane (v4i32 QPR:$src3), imm:$lane))))),
-          (v4i32 (VMLSslv4i32 (v4i32 QPR:$src1),
-                              (v4i32 QPR:$src2),
+                  (mul (v4i32 QPR:$src2),
+                     (v4i32 (NEONvduplane (v4i32 QPR:$src3), imm:$lane))))),
+          (v4i32 (VMLSslv4i32 (v4i32 QPR:$src1), (v4i32 QPR:$src2),
                               (v2i32 (EXTRACT_SUBREG QPR:$src3,
-                                                     (DSubReg_i32_reg imm:$lane))),
+                                      (DSubReg_i32_reg imm:$lane))),
                               (SubReg_i32_lane imm:$lane)))>;
 
 def : Pat<(v4f32 (fsub (v4f32 QPR:$src1),
-                       (fmul (v4f32 QPR:$src2),
-                           (v4f32 (NEONvduplane (v4f32 QPR:$src3), imm:$lane))))),
-          (v4f32 (VMLSslfq (v4f32 QPR:$src1),
-                           (v4f32 QPR:$src2),
+                  (fmul (v4f32 QPR:$src2),
+                        (v4f32 (NEONvduplane (v4f32 QPR:$src3), imm:$lane))))),
+          (v4f32 (VMLSslfq (v4f32 QPR:$src1), (v4f32 QPR:$src2),
                            (v2f32 (EXTRACT_SUBREG QPR:$src3,
-                                                  (DSubReg_i32_reg imm:$lane))),
+                                   (DSubReg_i32_reg imm:$lane))),
                            (SubReg_i32_lane imm:$lane)))>;
 
 //   VMLSL    : Vector Multiply Subtract Long (Q -= D * D)
@@ -2088,6 +2058,10 @@ def  VCEQfd   : N3VD<0,0,0b00,0b1110,0, IIC_VBIND, "vceq", "f32", v2i32, v2f32,
                      NEONvceq, 1>;
 def  VCEQfq   : N3VQ<0,0,0b00,0b1110,0, IIC_VBINQ, "vceq", "f32", v4i32, v4f32,
                      NEONvceq, 1>;
+// For disassembly only.
+defm VCEQz    : N2V_QHS_cmp<0b11, 0b11, 0b01, 0b00010, 0, "vceq", "i",
+                           "$dst, $src, #0">;
+
 //   VCGE     : Vector Compare Greater Than or Equal
 defm VCGEs    : N3V_QHS<0, 0, 0b0011, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
                         IIC_VBINi4Q, "vcge", "s", NEONvcge, 0>;
@@ -2097,6 +2071,13 @@ def  VCGEfd   : N3VD<1,0,0b00,0b1110,0, IIC_VBIND, "vcge", "f32",
                      v2i32, v2f32, NEONvcge, 0>;
 def  VCGEfq   : N3VQ<1,0,0b00,0b1110,0, IIC_VBINQ, "vcge", "f32", v4i32, v4f32,
                      NEONvcge, 0>;
+// For disassembly only.
+defm VCGEz    : N2V_QHS_cmp<0b11, 0b11, 0b01, 0b00001, 0, "vcge", "s",
+                            "$dst, $src, #0">;
+// For disassembly only.
+defm VCLEz    : N2V_QHS_cmp<0b11, 0b11, 0b01, 0b00011, 0, "vcle", "s",
+                            "$dst, $src, #0">;
+
 //   VCGT     : Vector Compare Greater Than
 defm VCGTs    : N3V_QHS<0, 0, 0b0011, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q, 
                         IIC_VBINi4Q, "vcgt", "s", NEONvcgt, 0>;
@@ -2106,6 +2087,13 @@ def  VCGTfd   : N3VD<1,0,0b10,0b1110,0, IIC_VBIND, "vcgt", "f32", v2i32, v2f32,
                      NEONvcgt, 0>;
 def  VCGTfq   : N3VQ<1,0,0b10,0b1110,0, IIC_VBINQ, "vcgt", "f32", v4i32, v4f32,
                      NEONvcgt, 0>;
+// For disassembly only.
+defm VCGTz    : N2V_QHS_cmp<0b11, 0b11, 0b01, 0b00000, 0, "vcgt", "s",
+                            "$dst, $src, #0">;
+// For disassembly only.
+defm VCLTz    : N2V_QHS_cmp<0b11, 0b11, 0b01, 0b00100, 0, "vclt", "s",
+                            "$dst, $src, #0">;
+
 //   VACGE    : Vector Absolute Compare Greater Than or Equal (aka VCAGE)
 def  VACGEd   : N3VDInt<1, 0, 0b00, 0b1110, 1, IIC_VBIND, "vacge", "f32",
                         v2i32, v2f32, int_arm_neon_vacged, 0>;
@@ -2247,9 +2235,9 @@ defm VABALu   : N3VLInt3_QHS<1,1,0b0101,0, "vabal", "u", int_arm_neon_vabalu>;
 // Vector Maximum and Minimum.
 
 //   VMAX     : Vector Maximum
-defm VMAXs    : N3VInt_QHS<0, 0, 0b0110, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
+defm VMAXs    : N3VInt_QHS<0,0,0b0110,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
                            IIC_VBINi4Q, "vmax", "s", int_arm_neon_vmaxs, 1>;
-defm VMAXu    : N3VInt_QHS<1, 0, 0b0110, 0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
+defm VMAXu    : N3VInt_QHS<1,0,0b0110,0, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
                            IIC_VBINi4Q, "vmax", "u", int_arm_neon_vmaxu, 1>;
 def  VMAXfd   : N3VDInt<0, 0, 0b00, 0b1111, 0, IIC_VBIND, "vmax", "f32",
                         v2f32, v2f32, int_arm_neon_vmaxs, 1>;
@@ -2257,9 +2245,9 @@ def  VMAXfq   : N3VQInt<0, 0, 0b00, 0b1111, 0, IIC_VBINQ, "vmax", "f32",
                         v4f32, v4f32, int_arm_neon_vmaxs, 1>;
 
 //   VMIN     : Vector Minimum
-defm VMINs    : N3VInt_QHS<0, 0, 0b0110, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
+defm VMINs    : N3VInt_QHS<0,0,0b0110,1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
                            IIC_VBINi4Q, "vmin", "s", int_arm_neon_vmins, 1>;
-defm VMINu    : N3VInt_QHS<1, 0, 0b0110, 1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
+defm VMINu    : N3VInt_QHS<1,0,0b0110,1, IIC_VBINi4D, IIC_VBINi4D, IIC_VBINi4Q,
                            IIC_VBINi4Q, "vmin", "u", int_arm_neon_vminu, 1>;
 def  VMINfd   : N3VDInt<0, 0, 0b10, 0b1111, 0, IIC_VBIND, "vmin", "f32",
                         v2f32, v2f32, int_arm_neon_vmins, 1>;
@@ -2401,16 +2389,17 @@ def  VSHLLi32 : N2VLShMax<1, 1, 0b111010, 0b0011, 0, 0, 0, "vshll", "i32",
                           v2i64, v2i32, NEONvshlli>;
 
 //   VSHRN    : Vector Shift Right and Narrow
-defm VSHRN    : N2VNSh_HSD<0,1,0b1000,0,0,1, IIC_VSHLiD, "vshrn", "i", NEONvshrn>;
+defm VSHRN    : N2VNSh_HSD<0,1,0b1000,0,0,1, IIC_VSHLiD, "vshrn", "i",
+                           NEONvshrn>;
 
 //   VRSHL    : Vector Rounding Shift
 defm VRSHLs   : N3VInt_QHSD<0,0,0b0101,0, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
-                            IIC_VSHLi4Q, "vrshl", "s", int_arm_neon_vrshifts, 0>;
+                            IIC_VSHLi4Q, "vrshl", "s", int_arm_neon_vrshifts,0>;
 defm VRSHLu   : N3VInt_QHSD<1,0,0b0101,0, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
-                            IIC_VSHLi4Q, "vrshl", "u", int_arm_neon_vrshiftu, 0>;
+                            IIC_VSHLi4Q, "vrshl", "u", int_arm_neon_vrshiftu,0>;
 //   VRSHR    : Vector Rounding Shift Right
-defm VRSHRs   : N2VSh_QHSD<0, 1, 0b0010, 1, IIC_VSHLi4D, "vrshr", "s", NEONvrshrs>;
-defm VRSHRu   : N2VSh_QHSD<1, 1, 0b0010, 1, IIC_VSHLi4D, "vrshr", "u", NEONvrshru>;
+defm VRSHRs   : N2VSh_QHSD<0,1,0b0010,1, IIC_VSHLi4D, "vrshr", "s", NEONvrshrs>;
+defm VRSHRu   : N2VSh_QHSD<1,1,0b0010,1, IIC_VSHLi4D, "vrshr", "u", NEONvrshru>;
 
 //   VRSHRN   : Vector Rounding Shift Right and Narrow
 defm VRSHRN   : N2VNSh_HSD<0, 1, 0b1000, 0, 1, 1, IIC_VSHLi4D, "vrshrn", "i",
@@ -2418,14 +2407,14 @@ defm VRSHRN   : N2VNSh_HSD<0, 1, 0b1000, 0, 1, 1, IIC_VSHLi4D, "vrshrn", "i",
 
 //   VQSHL    : Vector Saturating Shift
 defm VQSHLs   : N3VInt_QHSD<0,0,0b0100,1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
-                            IIC_VSHLi4Q, "vqshl", "s", int_arm_neon_vqshifts, 0>;
+                            IIC_VSHLi4Q, "vqshl", "s", int_arm_neon_vqshifts,0>;
 defm VQSHLu   : N3VInt_QHSD<1,0,0b0100,1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
-                            IIC_VSHLi4Q, "vqshl", "u", int_arm_neon_vqshiftu, 0>;
+                            IIC_VSHLi4Q, "vqshl", "u", int_arm_neon_vqshiftu,0>;
 //   VQSHL    : Vector Saturating Shift Left (Immediate)
-defm VQSHLsi  : N2VSh_QHSD<0, 1, 0b0111, 1, IIC_VSHLi4D, "vqshl", "s", NEONvqshls>;
-defm VQSHLui  : N2VSh_QHSD<1, 1, 0b0111, 1, IIC_VSHLi4D, "vqshl", "u", NEONvqshlu>;
+defm VQSHLsi  : N2VSh_QHSD<0,1,0b0111,1, IIC_VSHLi4D, "vqshl", "s", NEONvqshls>;
+defm VQSHLui  : N2VSh_QHSD<1,1,0b0111,1, IIC_VSHLi4D, "vqshl", "u", NEONvqshlu>;
 //   VQSHLU   : Vector Saturating Shift Left (Immediate, Unsigned)
-defm VQSHLsu  : N2VSh_QHSD<1, 1, 0b0110, 1, IIC_VSHLi4D, "vqshlu", "s", NEONvqshlsu>;
+defm VQSHLsu  : N2VSh_QHSD<1,1,0b0110,1, IIC_VSHLi4D, "vqshlu","s",NEONvqshlsu>;
 
 //   VQSHRN   : Vector Saturating Shift Right and Narrow
 defm VQSHRNs  : N2VNSh_HSD<0, 1, 0b1001, 0, 0, 1, IIC_VSHLi4D, "vqshrn", "s",
@@ -2438,10 +2427,10 @@ defm VQSHRUN  : N2VNSh_HSD<1, 1, 0b1000, 0, 0, 1, IIC_VSHLi4D, "vqshrun", "s",
                            NEONvqshrnsu>;
 
 //   VQRSHL   : Vector Saturating Rounding Shift
-defm VQRSHLs  : N3VInt_QHSD<0, 0, 0b0101, 1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
+defm VQRSHLs  : N3VInt_QHSD<0,0,0b0101,1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
                             IIC_VSHLi4Q, "vqrshl", "s",
                             int_arm_neon_vqrshifts, 0>;
-defm VQRSHLu  : N3VInt_QHSD<1, 0, 0b0101, 1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
+defm VQRSHLu  : N3VInt_QHSD<1,0,0b0101,1, IIC_VSHLi4D, IIC_VSHLi4D, IIC_VSHLi4Q,
                             IIC_VSHLi4Q, "vqrshl", "u",
                             int_arm_neon_vqrshiftu, 0>;
 
@@ -2508,7 +2497,7 @@ def  VNEGs16q : VNEGQ<0b01, "vneg", "s16", v8i16>;
 def  VNEGs32q : VNEGQ<0b10, "vneg", "s32", v4i32>;
 
 //   VNEG     : Vector Negate (floating-point)
-def  VNEGf32d : N2V<0b11, 0b11, 0b10, 0b01, 0b01111, 0, 0,
+def  VNEGfd   : N2V<0b11, 0b11, 0b10, 0b01, 0b01111, 0, 0,
                     (outs DPR:$dst), (ins DPR:$src), IIC_VUNAD,
                     "vneg", "f32", "$dst, $src", "",
                     [(set DPR:$dst, (v2f32 (fneg DPR:$src)))]>;
@@ -2547,6 +2536,14 @@ def  VCNTq    : N2VQInt<0b11, 0b11, 0b00, 0b00, 0b01010, 0,
                         IIC_VCNTiQ, "vcnt", "8",
                         v16i8, v16i8, int_arm_neon_vcnt>;
 
+// Vector Swap -- for disassembly only.
+def  VSWPd    : N2VX<0b11, 0b11, 0b00, 0b10, 0b00000, 0, 0,
+                     (outs DPR:$dst), (ins DPR:$src), NoItinerary,
+                     "vswp", "$dst, $src", "", []>;
+def  VSWPq    : N2VX<0b11, 0b11, 0b00, 0b10, 0b00000, 1, 0,
+                     (outs QPR:$dst), (ins QPR:$src), NoItinerary,
+                     "vswp", "$dst, $src", "", []>;
+
 // Vector Move Operations.
 
 //   VMOV     : Vector Move (Register)
@@ -2678,10 +2675,10 @@ def : Pat<(extractelt (v4i32 QPR:$src), imm:$lane),
                              (DSubReg_i32_reg imm:$lane))),
                      (SubReg_i32_lane imm:$lane))>;
 def : Pat<(extractelt (v2f32 DPR:$src1), imm:$src2),
-          (EXTRACT_SUBREG (v2f32 (COPY_TO_REGCLASS (v2f32 DPR:$src1), DPR_VFP2)),
+          (EXTRACT_SUBREG (v2f32 (COPY_TO_REGCLASS (v2f32 DPR:$src1),DPR_VFP2)),
                           (SSubReg_f32_reg imm:$src2))>;
 def : Pat<(extractelt (v4f32 QPR:$src1), imm:$src2),
-          (EXTRACT_SUBREG (v4f32 (COPY_TO_REGCLASS (v4f32 QPR:$src1), QPR_VFP2)),
+          (EXTRACT_SUBREG (v4f32 (COPY_TO_REGCLASS (v4f32 QPR:$src1),QPR_VFP2)),
                           (SSubReg_f32_reg imm:$src2))>;
 //def : Pat<(extractelt (v2i64 QPR:$src1), imm:$src2),
 //          (EXTRACT_SUBREG QPR:$src1, (DSubReg_f64_reg imm:$src2))>;
@@ -2849,11 +2846,13 @@ def  VDUPfqf  : N2V<0b11, 0b11, {?,1}, {0,0}, 0b11000, 1, 0,
 
 def : Pat<(v2i64 (NEONvduplane (v2i64 QPR:$src), imm:$lane)),
           (INSERT_SUBREG QPR:$src, 
-                         (i64 (EXTRACT_SUBREG QPR:$src, (DSubReg_f64_reg imm:$lane))),
+                         (i64 (EXTRACT_SUBREG QPR:$src,
+                               (DSubReg_f64_reg imm:$lane))),
                          (DSubReg_f64_other_reg imm:$lane))>;
 def : Pat<(v2f64 (NEONvduplane (v2f64 QPR:$src), imm:$lane)),
           (INSERT_SUBREG QPR:$src, 
-                         (f64 (EXTRACT_SUBREG QPR:$src, (DSubReg_f64_reg imm:$lane))),
+                         (f64 (EXTRACT_SUBREG QPR:$src,
+                               (DSubReg_f64_reg imm:$lane))),
                          (DSubReg_f64_other_reg imm:$lane))>;
 
 //   VMOVN    : Vector Narrowing Move
@@ -3092,70 +3091,110 @@ def  VTBX4
 // NEON instructions for single-precision FP math
 //===----------------------------------------------------------------------===//
 
+class N2VSPat<SDNode OpNode, ValueType ResTy, ValueType OpTy, NeonI Inst>
+  : NEONFPPat<(ResTy (OpNode SPR:$a)),
+              (EXTRACT_SUBREG (Inst (INSERT_SUBREG (OpTy (IMPLICIT_DEF)),
+                                                   SPR:$a, arm_ssubreg_0)),
+                              arm_ssubreg_0)>;
+
+class N3VSPat<SDNode OpNode, NeonI Inst>
+  : NEONFPPat<(f32 (OpNode SPR:$a, SPR:$b)),
+              (EXTRACT_SUBREG (Inst (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)),
+                                                   SPR:$a, arm_ssubreg_0),
+                                    (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)),
+                                                   SPR:$b, arm_ssubreg_0)),
+                              arm_ssubreg_0)>;
+
+class N3VSMulOpPat<SDNode MulNode, SDNode OpNode, NeonI Inst>
+  : NEONFPPat<(f32 (OpNode SPR:$acc, (f32 (MulNode SPR:$a, SPR:$b)))),
+              (EXTRACT_SUBREG (Inst (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)),
+                                                   SPR:$acc, arm_ssubreg_0),
+                                    (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)),
+                                                   SPR:$a, arm_ssubreg_0),
+                                    (INSERT_SUBREG (v2f32 (IMPLICIT_DEF)),
+                                                   SPR:$b, arm_ssubreg_0)),
+                              arm_ssubreg_0)>;
+
 // These need separate instructions because they must use DPR_VFP2 register
 // class which have SPR sub-registers.
 
 // Vector Add Operations used for single-precision FP
 let neverHasSideEffects = 1 in
-def VADDfd_sfp : N3VDs<0, 0, 0b00, 0b1101, 0, "vadd", "f32", v2f32, v2f32, fadd,1>;
-def : N3VDsPat<fadd, VADDfd_sfp>;
+def VADDfd_sfp : N3VS<0,0,0b00,0b1101,0, "vadd", "f32", v2f32, v2f32, fadd, 1>;
+def : N3VSPat<fadd, VADDfd_sfp>;
 
 // Vector Sub Operations used for single-precision FP
 let neverHasSideEffects = 1 in
-def VSUBfd_sfp : N3VDs<0, 0, 0b10, 0b1101, 0, "vsub", "f32", v2f32, v2f32, fsub,0>;
-def : N3VDsPat<fsub, VSUBfd_sfp>;
+def VSUBfd_sfp : N3VS<0,0,0b10,0b1101,0, "vsub", "f32", v2f32, v2f32, fsub, 0>;
+def : N3VSPat<fsub, VSUBfd_sfp>;
 
 // Vector Multiply Operations used for single-precision FP
 let neverHasSideEffects = 1 in
-def VMULfd_sfp : N3VDs<1, 0, 0b00, 0b1101, 1, "vmul", "f32", v2f32, v2f32, fmul,1>;
-def : N3VDsPat<fmul, VMULfd_sfp>;
+def VMULfd_sfp : N3VS<1,0,0b00,0b1101,1, "vmul", "f32", v2f32, v2f32, fmul, 1>;
+def : N3VSPat<fmul, VMULfd_sfp>;
 
 // Vector Multiply-Accumulate/Subtract used for single-precision FP
 // vml[as].f32 can cause 4-8 cycle stalls in following ASIMD instructions, so
 // we want to avoid them for now. e.g., alternating vmla/vadd instructions.
 
 //let neverHasSideEffects = 1 in
-//def VMLAfd_sfp : N3VDMulOps<0, 0, 0b00, 0b1101, 1, IIC_VMACD, "vmla", "f32", v2f32,fmul,fadd>;
-//def : N3VDMulOpsPat<fmul, fadd, VMLAfd_sfp>;
+//def VMLAfd_sfp : N3VSMulOp<0,0,0b00,0b1101,1, IIC_VMACD, "vmla", "f32",
+//                            v2f32, fmul, fadd>;
+//def : N3VSMulOpPat<fmul, fadd, VMLAfd_sfp>;
 
 //let neverHasSideEffects = 1 in
-//def VMLSfd_sfp : N3VDMulOps<0, 0, 0b10, 0b1101, 1, IIC_VMACD, "vmls", "f32", v2f32,fmul,fsub>;
-//def : N3VDMulOpsPat<fmul, fsub, VMLSfd_sfp>;
+//def VMLSfd_sfp : N3VSMulOp<0,0,0b10,0b1101,1, IIC_VMACD, "vmls", "f32",
+//                            v2f32, fmul, fsub>;
+//def : N3VSMulOpPat<fmul, fsub, VMLSfd_sfp>;
 
 // Vector Absolute used for single-precision FP
 let neverHasSideEffects = 1 in
-def  VABSfd_sfp : N2VDInts<0b11, 0b11, 0b10, 0b01, 0b01110, 0,
-                           IIC_VUNAD, "vabs", "f32",
-                           v2f32, v2f32, int_arm_neon_vabs>;
-def : N2VDIntsPat<fabs, VABSfd_sfp>;
+def  VABSfd_sfp : N2V<0b11, 0b11, 0b10, 0b01, 0b01110, 0, 0,
+                      (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src), IIC_VUNAD,
+                      "vabs", "f32", "$dst, $src", "", []>;
+def : N2VSPat<fabs, f32, v2f32, VABSfd_sfp>;
 
 // Vector Negate used for single-precision FP
 let neverHasSideEffects = 1 in
-def  VNEGf32d_sfp : N2V<0b11, 0b11, 0b10, 0b01, 0b01111, 0, 0,
-                        (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src), IIC_VUNAD,
-                        "vneg", "f32", "$dst, $src", "", []>;
-def : N2VDIntsPat<fneg, VNEGf32d_sfp>;
+def  VNEGfd_sfp : N2V<0b11, 0b11, 0b10, 0b01, 0b01111, 0, 0,
+                      (outs DPR_VFP2:$dst), (ins DPR_VFP2:$src), IIC_VUNAD,
+                      "vneg", "f32", "$dst, $src", "", []>;
+def : N2VSPat<fneg, f32, v2f32, VNEGfd_sfp>;
+
+// Vector Maximum used for single-precision FP
+let neverHasSideEffects = 1 in
+def VMAXfd_sfp : N3V<0, 0, 0b00, 0b1111, 0, 0, (outs DPR_VFP2:$dst),
+                     (ins DPR_VFP2:$src1, DPR_VFP2:$src2), IIC_VBIND,
+                     "vmax", "f32", "$dst, $src1, $src2", "", []>;
+def : N3VSPat<NEONfmax, VMAXfd_sfp>;
+
+// Vector Minimum used for single-precision FP
+let neverHasSideEffects = 1 in
+def VMINfd_sfp : N3V<0, 0, 0b00, 0b1111, 0, 0, (outs DPR_VFP2:$dst),
+                     (ins DPR_VFP2:$src1, DPR_VFP2:$src2), IIC_VBIND,
+                     "vmin", "f32", "$dst, $src1, $src2", "", []>;
+def : N3VSPat<NEONfmin, VMINfd_sfp>;
 
 // Vector Convert between single-precision FP and integer
 let neverHasSideEffects = 1 in
-def  VCVTf2sd_sfp : N2VDs<0b11, 0b11, 0b10, 0b11, 0b01110, 0, "vcvt", "s32.f32",
-                          v2i32, v2f32, fp_to_sint>;
-def : N2VDsPat<arm_ftosi, f32, v2f32, VCVTf2sd_sfp>;
+def  VCVTf2sd_sfp : N2VS<0b11, 0b11, 0b10, 0b11, 0b01110, 0, "vcvt", "s32.f32",
+                         v2i32, v2f32, fp_to_sint>;
+def : N2VSPat<arm_ftosi, f32, v2f32, VCVTf2sd_sfp>;
 
 let neverHasSideEffects = 1 in
-def  VCVTf2ud_sfp : N2VDs<0b11, 0b11, 0b10, 0b11, 0b01111, 0, "vcvt", "u32.f32",
-                          v2i32, v2f32, fp_to_uint>;
-def : N2VDsPat<arm_ftoui, f32, v2f32, VCVTf2ud_sfp>;
+def  VCVTf2ud_sfp : N2VS<0b11, 0b11, 0b10, 0b11, 0b01111, 0, "vcvt", "u32.f32",
+                         v2i32, v2f32, fp_to_uint>;
+def : N2VSPat<arm_ftoui, f32, v2f32, VCVTf2ud_sfp>;
 
 let neverHasSideEffects = 1 in
-def  VCVTs2fd_sfp : N2VDs<0b11, 0b11, 0b10, 0b11, 0b01100, 0, "vcvt", "f32.s32",
-                          v2f32, v2i32, sint_to_fp>;
-def : N2VDsPat<arm_sitof, f32, v2i32, VCVTs2fd_sfp>;
+def  VCVTs2fd_sfp : N2VS<0b11, 0b11, 0b10, 0b11, 0b01100, 0, "vcvt", "f32.s32",
+                         v2f32, v2i32, sint_to_fp>;
+def : N2VSPat<arm_sitof, f32, v2i32, VCVTs2fd_sfp>;
 
 let neverHasSideEffects = 1 in
-def  VCVTu2fd_sfp : N2VDs<0b11, 0b11, 0b10, 0b11, 0b01101, 0, "vcvt", "f32.u32",
-                          v2f32, v2i32, uint_to_fp>;
-def : N2VDsPat<arm_uitof, f32, v2i32, VCVTu2fd_sfp>;
+def  VCVTu2fd_sfp : N2VS<0b11, 0b11, 0b10, 0b11, 0b01101, 0, "vcvt", "f32.u32",
+                         v2f32, v2i32, uint_to_fp>;
+def : N2VSPat<arm_uitof, f32, v2i32, VCVTu2fd_sfp>;
 
 //===----------------------------------------------------------------------===//
 // Non-Instruction Patterns
diff --git a/libclamav/c++/llvm/lib/Target/ARM/ARMInstrThumb.td b/libclamav/c++/llvm/lib/Target/ARM/ARMInstrThumb.td
index 64142ad..786dd65 100644
--- a/libclamav/c++/llvm/lib/Target/ARM/ARMInstrThumb.td
+++ b/libclamav/c++/llvm/lib/Target/ARM/ARMInstrThumb.td
@@ -120,7 +120,10 @@ def t_addrmode_sp : Operand<i32>,
 //  Miscellaneous Instructions.
 //
 
-let Defs = [SP], Uses = [SP] in {
+// FIXME: Marking these as hasSideEffects is necessary to prevent machine DCE
+// from removing one half of the matched pairs. That breaks PEI, which assumes
+// these will always be in pairs, and asserts if it finds otherwise. Better way?
+let Defs = [SP], Uses = [SP], hasSideEffects = 1 in {
 def tADJCALLSTACKUP :
 PseudoInst<(outs), (ins i32imm:$amt1, i32imm:$amt2), NoItinerary,
            "@ tADJCALLSTACKUP $amt1",
@@ -132,6 +135,55 @@ PseudoInst<(outs), (ins i32imm:$amt), NoItinerary,
            [(ARMcallseq_start imm:$amt)]>, Requires<[IsThumb1Only]>;
 }
 
+def tNOP : T1pI<(outs), (ins), NoItinerary, "nop", "",
+                [/* For disassembly only; pattern left blank */]>,
+           T1Encoding<0b101111> {
+  let Inst{9-8} = 0b11;
+  let Inst{7-0} = 0b00000000;
+} 
+
+def tYIELD : T1pI<(outs), (ins), NoItinerary, "yield", "",
+                  [/* For disassembly only; pattern left blank */]>,
+             T1Encoding<0b101111> {
+  let Inst{9-8} = 0b11;
+  let Inst{7-0} = 0b00010000;
+} 
+
+def tWFE : T1pI<(outs), (ins), NoItinerary, "wfe", "",
+                [/* For disassembly only; pattern left blank */]>,
+           T1Encoding<0b101111> {
+  let Inst{9-8} = 0b11;
+  let Inst{7-0} = 0b00100000;
+} 
+
+def tWFI : T1pI<(outs), (ins), NoItinerary, "wfi", "",
+                [/* For disassembly only; pattern left blank */]>,
+           T1Encoding<0b101111> {
+  let Inst{9-8} = 0b11;
+  let Inst{7-0} = 0b00110000;
+} 
+
+def tSEV : T1pI<(outs), (ins), NoItinerary, "sev", "",
+                [/* For disassembly only; pattern left blank */]>,
+           T1Encoding<0b101111> {
+  let Inst{9-8} = 0b11;
+  let Inst{7-0} = 0b01000000;
+} 
+
+def tSETENDBE : T1I<(outs), (ins), NoItinerary, "setend\tbe",
+                    [/* For disassembly only; pattern left blank */]>,
+                T1Encoding<0b101101> {
+  let Inst{9-5} = 0b10010;
+  let Inst{3} = 1;
+}
+
+def tSETENDLE : T1I<(outs), (ins), NoItinerary, "setend\tle",
+                    [/* For disassembly only; pattern left blank */]>,
+                T1Encoding<0b101101> {
+  let Inst{9-5} = 0b10010;
+  let Inst{3} = 0;
+}
+
 // The i32imm operand $val can be used by a debugger to store more information
 // about the breakpoint.
 def tBKPT : T1I<(outs), (ins i32imm:$val), NoItinerary, "bkpt\t$val",
@@ -140,6 +192,19 @@ def tBKPT : T1I<(outs), (ins i32imm:$val), NoItinerary, "bkpt\t$val",
   let Inst{9-8} = 0b10;
 }
 
+// Change Processor State is a system instruction -- for disassembly only.
+// The singleton $opt operand contains the following information:
+// opt{4-0} = mode ==> don't care
+// opt{5} = changemode ==> 0 (false for 16-bit Thumb instr)
+// opt{8-6} = AIF from Inst{2-0}
+// opt{10-9} = 1:imod from Inst{4} with 0b10 as enable and 0b11 as disable
+//
+// The opt{4-0} and opt{5} sub-fields are to accommodate 32-bit Thumb and ARM
+// CPS which has more options.
+def tCPS : T1I<(outs), (ins i32imm:$opt), NoItinerary, "cps${opt:cps}",
+              [/* For disassembly only; pattern left blank */]>,
+           T1Misc<0b0110011>;
+
 // For both thumb1 and thumb2.
 let isNotDuplicable = 1 in
 def tPICADD : TIt<(outs GPR:$dst), (ins GPR:$lhs, pclabel:$cp), IIC_iALUr,
@@ -208,7 +273,7 @@ let isReturn = 1, isTerminator = 1, isBarrier = 1 in {
     let Inst{6-3} = 0b1110; // Rm = lr
   }
   // Alternative return instruction used by vararg functions.
-  def tBX_RET_vararg : TI<(outs), (ins tGPR:$target), IIC_Br, "bx\t$target", []>,
+  def tBX_RET_vararg : TI<(outs), (ins tGPR:$target), IIC_Br, "bx\t$target",[]>,
                        T1Special<{1,1,0,?}>; // A6.2.3 & A8.6.25
 }
 
@@ -236,20 +301,20 @@ let isCall = 1,
           D24, D25, D26, D27, D28, D29, D30, D31, CPSR, FPSCR] in {
   // Also used for Thumb2
   def tBL  : TIx2<0b11110, 0b11, 1,
-                  (outs), (ins i32imm:$func, variable_ops), IIC_Br, 
+                  (outs), (ins i32imm:$func, variable_ops), IIC_Br,
                   "bl\t${func:call}",
                   [(ARMtcall tglobaladdr:$func)]>,
              Requires<[IsThumb, IsNotDarwin]>;
 
   // ARMv5T and above, also used for Thumb2
   def tBLXi : TIx2<0b11110, 0b11, 0,
-                   (outs), (ins i32imm:$func, variable_ops), IIC_Br, 
+                   (outs), (ins i32imm:$func, variable_ops), IIC_Br,
                    "blx\t${func:call}",
                    [(ARMcall tglobaladdr:$func)]>,
               Requires<[IsThumb, HasV5T, IsNotDarwin]>;
 
   // Also used for Thumb2
-  def tBLXr : TI<(outs), (ins GPR:$func, variable_ops), IIC_Br, 
+  def tBLXr : TI<(outs), (ins GPR:$func, variable_ops), IIC_Br,
                   "blx\t$func",
                   [(ARMtcall GPR:$func)]>,
               Requires<[IsThumb, HasV5T, IsNotDarwin]>,
@@ -257,7 +322,7 @@ let isCall = 1,
 
   // ARMv4T
   def tBX : TIx2<{?,?,?,?,?}, {?,?}, ?,
-                  (outs), (ins tGPR:$func, variable_ops), IIC_Br, 
+                  (outs), (ins tGPR:$func, variable_ops), IIC_Br,
                   "mov\tlr, pc\n\tbx\t$func",
                   [(ARMcall_nolink tGPR:$func)]>,
             Requires<[IsThumb1Only, IsNotDarwin]>;
@@ -271,20 +336,20 @@ let isCall = 1,
           D24, D25, D26, D27, D28, D29, D30, D31, CPSR, FPSCR] in {
   // Also used for Thumb2
   def tBLr9 : TIx2<0b11110, 0b11, 1,
-                   (outs), (ins i32imm:$func, variable_ops), IIC_Br, 
+                   (outs), (ins i32imm:$func, variable_ops), IIC_Br,
                    "bl\t${func:call}",
                    [(ARMtcall tglobaladdr:$func)]>,
               Requires<[IsThumb, IsDarwin]>;
 
   // ARMv5T and above, also used for Thumb2
   def tBLXi_r9 : TIx2<0b11110, 0b11, 0,
-                      (outs), (ins i32imm:$func, variable_ops), IIC_Br, 
+                      (outs), (ins i32imm:$func, variable_ops), IIC_Br,
                       "blx\t${func:call}",
                       [(ARMcall tglobaladdr:$func)]>,
                  Requires<[IsThumb, HasV5T, IsDarwin]>;
 
   // Also used for Thumb2
-  def tBLXr_r9 : TI<(outs), (ins GPR:$func, variable_ops), IIC_Br, 
+  def tBLXr_r9 : TI<(outs), (ins GPR:$func, variable_ops), IIC_Br,
                     "blx\t$func",
                     [(ARMtcall GPR:$func)]>,
                  Requires<[IsThumb, HasV5T, IsDarwin]>,
@@ -292,7 +357,7 @@ let isCall = 1,
 
   // ARMv4T
   def tBXr9 : TIx2<{?,?,?,?,?}, {?,?}, ?,
-                   (outs), (ins tGPR:$func, variable_ops), IIC_Br, 
+                   (outs), (ins tGPR:$func, variable_ops), IIC_Br,
                    "mov\tlr, pc\n\tbx\t$func",
                    [(ARMcall_nolink tGPR:$func)]>,
               Requires<[IsThumb1Only, IsDarwin]>;
@@ -307,7 +372,7 @@ let isBranch = 1, isTerminator = 1 in {
 
   // Far jump
   let Defs = [LR] in
-  def tBfar : TIx2<0b11110, 0b11, 1, (outs), (ins brtarget:$target), IIC_Br, 
+  def tBfar : TIx2<0b11110, 0b11, 1, (outs), (ins brtarget:$target), IIC_Br,
                     "bl\t$target\t@ far jump",[]>;
 
   def tBR_JTr : T1JTI<(outs),
@@ -340,16 +405,34 @@ let isBranch = 1, isTerminator = 1 in {
               T1Misc<{1,0,?,1,?,?,?}>;
 }
 
+// A8.6.218 Supervisor Call (Software Interrupt) -- for disassembly only
+// A8.6.16 B: Encoding T1
+// If Inst{11-8} == 0b1111 then SEE SVC
+let isCall = 1 in {
+def tSVC : T1pI<(outs), (ins i32imm:$svc), IIC_Br, "svc", "\t$svc", []>,
+           Encoding16 {
+  let Inst{15-12} = 0b1101;
+  let Inst{11-8} = 0b1111;
+}
+}
+
+// A8.6.16 B: Encoding T1 -- for disassembly only
+// If Inst{11-8} == 0b1110 then UNDEFINED
+def tTRAP : T1I<(outs), (ins), IIC_Br, "trap", []>, Encoding16 {
+  let Inst{15-12} = 0b1101;
+  let Inst{11-8} = 0b1110;
+}
+
 //===----------------------------------------------------------------------===//
 //  Load Store Instructions.
 //
 
-let canFoldAsLoad = 1, isReMaterializable = 1, mayHaveSideEffects = 1 in
-def tLDR : T1pI4<(outs tGPR:$dst), (ins t_addrmode_s4:$addr), IIC_iLoadr, 
+let canFoldAsLoad = 1, isReMaterializable = 1 in
+def tLDR : T1pI4<(outs tGPR:$dst), (ins t_addrmode_s4:$addr), IIC_iLoadr,
                "ldr", "\t$dst, $addr",
                [(set tGPR:$dst, (load t_addrmode_s4:$addr))]>,
            T1LdSt<0b100>;
-def tLDRi: T1pI4<(outs tGPR:$dst), (ins t_addrmode_s4:$addr), IIC_iLoadr, 
+def tLDRi: T1pI4<(outs tGPR:$dst), (ins t_addrmode_s4:$addr), IIC_iLoadr,
                "ldr", "\t$dst, $addr",
                []>,
            T1LdSt4Imm<{1,?,?}>;
@@ -399,15 +482,14 @@ def tRestore : T1pIs<(outs tGPR:$dst), (ins t_addrmode_sp:$addr), IIC_iLoadi,
 
 // Load tconstpool
 // FIXME: Use ldr.n to work around a Darwin assembler bug.
-let canFoldAsLoad = 1, isReMaterializable = 1, mayHaveSideEffects = 1  in 
+let canFoldAsLoad = 1, isReMaterializable = 1 in
 def tLDRpci : T1pIs<(outs tGPR:$dst), (ins i32imm:$addr), IIC_iLoadi,
                   "ldr", ".n\t$dst, $addr",
                   [(set tGPR:$dst, (load (ARMWrapper tconstpool:$addr)))]>,
               T1Encoding<{0,1,0,0,1,?}>; // A6.2 & A8.6.59
 
 // Special LDR for loads from non-pc-relative constpools.
-let canFoldAsLoad = 1, mayLoad = 1, isReMaterializable = 1,
-    mayHaveSideEffects = 1  in
+let canFoldAsLoad = 1, mayLoad = 1, isReMaterializable = 1 in
 def tLDRcp  : T1pIs<(outs tGPR:$dst), (ins i32imm:$addr), IIC_iLoadi,
                   "ldr", "\t$dst, $addr", []>,
               T1LdStSP<{1,?,?}>;
@@ -652,7 +734,7 @@ def tMOVgpr2gpr  : T1I<(outs GPR:$dst), (ins GPR:$src), IIC_iMOVr,
 // multiply register
 let isCommutable = 1 in
 def tMUL : T1sIt<(outs tGPR:$dst), (ins tGPR:$lhs, tGPR:$rhs), IIC_iMUL32,
-                 "mul", "\t$dst, $rhs",
+                 "mul", "\t$dst, $rhs, $dst", /* A8.6.105 MUL Encoding T1 */
                  [(set tGPR:$dst, (mul tGPR:$lhs, tGPR:$rhs))]>,
            T1DataProcessing<0b1101>;
 
@@ -769,7 +851,7 @@ def tUXTH  : T1pI<(outs tGPR:$dst), (ins tGPR:$src), IIC_iUNAr,
              T1Misc<{0,0,1,0,1,0,?}>;
 
 
-// Conditional move tMOVCCr - Used to implement the Thumb SELECT_CC DAG operation.
+// Conditional move tMOVCCr - Used to implement the Thumb SELECT_CC operation.
 // Expanded after instruction selection into a branch sequence.
 let usesCustomInserter = 1 in  // Expanded after instruction selection.
   def tMOVCCr_pseudo :
diff --git a/libclamav/c++/llvm/lib/Target/ARM/ARMInstrThumb2.td b/libclamav/c++/llvm/lib/Target/ARM/ARMInstrThumb2.td
index 55c7aa2..6241766 100644
--- a/libclamav/c++/llvm/lib/Target/ARM/ARMInstrThumb2.td
+++ b/libclamav/c++/llvm/lib/Target/ARM/ARMInstrThumb2.td
@@ -13,7 +13,7 @@
 
 // IT block predicate field
 def it_pred : Operand<i32> {
-  let PrintMethod = "printPredicateOperand";
+  let PrintMethod = "printMandatoryPredicateOperand";
 }
 
 // IT block condition mask
@@ -53,10 +53,10 @@ def t2_so_imm_neg_XFORM : SDNodeXForm<imm, [{
 // bits [bits 0-7], the 4-bit shift/splat amount is the next 4 bits [bits 8-11].
 def t2_so_imm : Operand<i32>,
                 PatLeaf<(imm), [{
-  return ARM_AM::getT2SOImmVal((uint32_t)N->getZExtValue()) != -1; 
+  return ARM_AM::getT2SOImmVal((uint32_t)N->getZExtValue()) != -1;
 }]>;
 
-// t2_so_imm_not - Match an immediate that is a complement 
+// t2_so_imm_not - Match an immediate that is a complement
 // of a t2_so_imm.
 def t2_so_imm_not : Operand<i32>,
                     PatLeaf<(imm), [{
@@ -114,13 +114,13 @@ def imm0_4095 : Operand<i32>,
   return (uint32_t)N->getZExtValue() < 4096;
 }]>;
 
-def imm0_4095_neg : PatLeaf<(i32 imm), [{ 
- return (uint32_t)(-N->getZExtValue()) < 4096; 
-}], imm_neg_XFORM>; 
+def imm0_4095_neg : PatLeaf<(i32 imm), [{
+ return (uint32_t)(-N->getZExtValue()) < 4096;
+}], imm_neg_XFORM>;
 
 def imm0_255_neg : PatLeaf<(i32 imm), [{
   return (uint32_t)(-N->getZExtValue()) < 255;
-}], imm_neg_XFORM>; 
+}], imm_neg_XFORM>;
 
 // Define Thumb2 specific addressing modes.
 
@@ -131,7 +131,7 @@ def t2addrmode_imm12 : Operand<i32>,
   let MIOperandInfo = (ops GPR:$base, i32imm:$offsimm);
 }
 
-// t2addrmode_imm8  := reg - imm8
+// t2addrmode_imm8  := reg +/- imm8
 def t2addrmode_imm8 : Operand<i32>,
                       ComplexPattern<i32, 2, "SelectT2AddrModeImm8", []> {
   let PrintMethod = "printT2AddrModeImm8Operand";
@@ -208,7 +208,7 @@ multiclass T2I_un_irs<bits<4> opcod, string opc, PatFrag opnode,
 /// T2I_bin_irs - Defines a set of (op reg, {so_imm|r|so_reg}) patterns for a
 //  binary operation that produces a value. These are predicable and can be
 /// changed to modify CPSR.
-multiclass T2I_bin_irs<bits<4> opcod, string opc, PatFrag opnode, 
+multiclass T2I_bin_irs<bits<4> opcod, string opc, PatFrag opnode,
                        bit Commutable = 0, string wide =""> {
    // shifted imm
    def ri : T2sI<(outs GPR:$dst), (ins GPR:$lhs, t2_so_imm:$rhs), IIC_iALUi,
@@ -368,15 +368,16 @@ multiclass T2I_bin_ii12rs<bits<3> op23_21, string opc, PatFrag opnode,
 }
 
 /// T2I_adde_sube_irs - Defines a set of (op reg, {so_imm|r|so_reg}) patterns
-/// for a binary operation that produces a value and use and define the carry
+/// for a binary operation that produces a value and use the carry
 /// bit. It's not predicable.
 let Uses = [CPSR] in {
-multiclass T2I_adde_sube_irs<bits<4> opcod, string opc, PatFrag opnode, bit Commutable = 0> {
+multiclass T2I_adde_sube_irs<bits<4> opcod, string opc, PatFrag opnode,
+                             bit Commutable = 0> {
    // shifted imm
    def ri : T2sI<(outs GPR:$dst), (ins GPR:$lhs, t2_so_imm:$rhs), IIC_iALUi,
                  opc, "\t$dst, $lhs, $rhs",
                  [(set GPR:$dst, (opnode GPR:$lhs, t2_so_imm:$rhs))]>,
-                 Requires<[IsThumb2, CarryDefIsUnused]> {
+                 Requires<[IsThumb2]> {
      let Inst{31-27} = 0b11110;
      let Inst{25} = 0;
      let Inst{24-21} = opcod;
@@ -387,7 +388,7 @@ multiclass T2I_adde_sube_irs<bits<4> opcod, string opc, PatFrag opnode, bit Comm
    def rr : T2sI<(outs GPR:$dst), (ins GPR:$lhs, GPR:$rhs), IIC_iALUr,
                  opc, ".w\t$dst, $lhs, $rhs",
                  [(set GPR:$dst, (opnode GPR:$lhs, GPR:$rhs))]>,
-                 Requires<[IsThumb2, CarryDefIsUnused]> {
+                 Requires<[IsThumb2]> {
      let isCommutable = Commutable;
      let Inst{31-27} = 0b11101;
      let Inst{26-25} = 0b01;
@@ -401,19 +402,23 @@ multiclass T2I_adde_sube_irs<bits<4> opcod, string opc, PatFrag opnode, bit Comm
    def rs : T2sI<(outs GPR:$dst), (ins GPR:$lhs, t2_so_reg:$rhs), IIC_iALUsi,
                  opc, ".w\t$dst, $lhs, $rhs",
                  [(set GPR:$dst, (opnode GPR:$lhs, t2_so_reg:$rhs))]>,
-                 Requires<[IsThumb2, CarryDefIsUnused]> {
+                 Requires<[IsThumb2]> {
      let Inst{31-27} = 0b11101;
      let Inst{26-25} = 0b01;
      let Inst{24-21} = opcod;
      let Inst{20} = 0; // The S bit.
    }
-   // Carry setting variants
+}
+
+// Carry setting variants
+let Defs = [CPSR] in {
+multiclass T2I_adde_sube_s_irs<bits<4> opcod, string opc, PatFrag opnode,
+                               bit Commutable = 0> {
    // shifted imm
-   def Sri : T2XI<(outs GPR:$dst), (ins GPR:$lhs, t2_so_imm:$rhs), IIC_iALUi,
-                  !strconcat(opc, "s\t$dst, $lhs, $rhs"),
-                  [(set GPR:$dst, (opnode GPR:$lhs, t2_so_imm:$rhs))]>,
-                  Requires<[IsThumb2, CarryDefIsUsed]> {
-     let Defs = [CPSR];
+   def ri : T2sI<(outs GPR:$dst), (ins GPR:$lhs, t2_so_imm:$rhs), IIC_iALUi,
+                 opc, "\t$dst, $lhs, $rhs",
+                 [(set GPR:$dst, (opnode GPR:$lhs, t2_so_imm:$rhs))]>,
+                 Requires<[IsThumb2]> {
      let Inst{31-27} = 0b11110;
      let Inst{25} = 0;
      let Inst{24-21} = opcod;
@@ -421,11 +426,10 @@ multiclass T2I_adde_sube_irs<bits<4> opcod, string opc, PatFrag opnode, bit Comm
      let Inst{15} = 0;
    }
    // register
-   def Srr : T2XI<(outs GPR:$dst), (ins GPR:$lhs, GPR:$rhs), IIC_iALUr,
-                  !strconcat(opc, "s.w\t$dst, $lhs, $rhs"),
-                  [(set GPR:$dst, (opnode GPR:$lhs, GPR:$rhs))]>,
-                  Requires<[IsThumb2, CarryDefIsUsed]> {
-     let Defs = [CPSR];
+   def rr : T2sI<(outs GPR:$dst), (ins GPR:$lhs, GPR:$rhs), IIC_iALUr,
+                 opc, ".w\t$dst, $lhs, $rhs",
+                 [(set GPR:$dst, (opnode GPR:$lhs, GPR:$rhs))]>,
+                 Requires<[IsThumb2]> {
      let isCommutable = Commutable;
      let Inst{31-27} = 0b11101;
      let Inst{26-25} = 0b01;
@@ -436,11 +440,10 @@ multiclass T2I_adde_sube_irs<bits<4> opcod, string opc, PatFrag opnode, bit Comm
      let Inst{5-4} = 0b00; // type
    }
    // shifted register
-   def Srs : T2XI<(outs GPR:$dst), (ins GPR:$lhs, t2_so_reg:$rhs), IIC_iALUsi,
-                  !strconcat(opc, "s.w\t$dst, $lhs, $rhs"),
-                  [(set GPR:$dst, (opnode GPR:$lhs, t2_so_reg:$rhs))]>,
-                  Requires<[IsThumb2, CarryDefIsUsed]> {
-     let Defs = [CPSR];
+   def rs : T2sI<(outs GPR:$dst), (ins GPR:$lhs, t2_so_reg:$rhs), IIC_iALUsi,
+                 opc, ".w\t$dst, $lhs, $rhs",
+                 [(set GPR:$dst, (opnode GPR:$lhs, t2_so_reg:$rhs))]>,
+                 Requires<[IsThumb2]> {
      let Inst{31-27} = 0b11101;
      let Inst{26-25} = 0b01;
      let Inst{24-21} = opcod;
@@ -448,6 +451,7 @@ multiclass T2I_adde_sube_irs<bits<4> opcod, string opc, PatFrag opnode, bit Comm
    }
 }
 }
+}
 
 /// T2I_rbin_s_is - Same as T2I_rbin_is except sets 's' bit.
 let Defs = [CPSR] in {
@@ -626,19 +630,6 @@ multiclass T2I_st<bits<2> opcod, string opc, PatFrag opnode> {
   }
 }
 
-/// T2I_picld - Defines the PIC load pattern.
-class T2I_picld<string opc, PatFrag opnode> :
-      T2I<(outs GPR:$dst), (ins addrmodepc:$addr), IIC_iLoadi,
-          !strconcat("\n${addr:label}:\n\t", opc), "\t$dst, $addr",
-          [(set GPR:$dst, (opnode addrmodepc:$addr))]>;
-
-/// T2I_picst - Defines the PIC store pattern.
-class T2I_picst<string opc, PatFrag opnode> :
-      T2I<(outs), (ins GPR:$src, addrmodepc:$addr), IIC_iStorer,
-          !strconcat("\n${addr:label}:\n\t", opc), "\t$src, $addr",
-          [(opnode GPR:$src, addrmodepc:$addr)]>;
-
-
 /// T2I_unary_rrot - A unary operation with two forms: one whose operand is a
 /// register and one whose operand is a register rotated by 8/16/24.
 multiclass T2I_unary_rrot<bits<3> opcod, string opc, PatFrag opnode> {
@@ -666,6 +657,57 @@ multiclass T2I_unary_rrot<bits<3> opcod, string opc, PatFrag opnode> {
    }
 }
 
+// SXTB16 and UXTB16 do not need the .w qualifier.
+multiclass T2I_unary_rrot_nw<bits<3> opcod, string opc, PatFrag opnode> {
+  def r     : T2I<(outs GPR:$dst), (ins GPR:$src), IIC_iUNAr,
+                  opc, "\t$dst, $src",
+                 [(set GPR:$dst, (opnode GPR:$src))]> {
+     let Inst{31-27} = 0b11111;
+     let Inst{26-23} = 0b0100;
+     let Inst{22-20} = opcod;
+     let Inst{19-16} = 0b1111; // Rn
+     let Inst{15-12} = 0b1111;
+     let Inst{7} = 1;
+     let Inst{5-4} = 0b00; // rotate
+   }
+  def r_rot : T2I<(outs GPR:$dst), (ins GPR:$src, i32imm:$rot), IIC_iUNAsi,
+                  opc, "\t$dst, $src, ror $rot",
+                 [(set GPR:$dst, (opnode (rotr GPR:$src, rot_imm:$rot)))]> {
+     let Inst{31-27} = 0b11111;
+     let Inst{26-23} = 0b0100;
+     let Inst{22-20} = opcod;
+     let Inst{19-16} = 0b1111; // Rn
+     let Inst{15-12} = 0b1111;
+     let Inst{7} = 1;
+     let Inst{5-4} = {?,?}; // rotate
+   }
+}
+
+// DO variant - disassembly only, no pattern
+
+multiclass T2I_unary_rrot_DO<bits<3> opcod, string opc> {
+  def r     : T2I<(outs GPR:$dst), (ins GPR:$src), IIC_iUNAr,
+                  opc, "\t$dst, $src", []> {
+     let Inst{31-27} = 0b11111;
+     let Inst{26-23} = 0b0100;
+     let Inst{22-20} = opcod;
+     let Inst{19-16} = 0b1111; // Rn
+     let Inst{15-12} = 0b1111;
+     let Inst{7} = 1;
+     let Inst{5-4} = 0b00; // rotate
+   }
+  def r_rot : T2I<(outs GPR:$dst), (ins GPR:$src, i32imm:$rot), IIC_iUNAsi,
+                  opc, "\t$dst, $src, ror $rot", []> {
+     let Inst{31-27} = 0b11111;
+     let Inst{26-23} = 0b0100;
+     let Inst{22-20} = opcod;
+     let Inst{19-16} = 0b1111; // Rn
+     let Inst{15-12} = 0b1111;
+     let Inst{7} = 1;
+     let Inst{5-4} = {?,?}; // rotate
+   }
+}
+
 /// T2I_bin_rrot - A binary operation with two forms: one whose operand is a
 /// register and one whose operand is a register rotated by 8/16/24.
 multiclass T2I_bin_rrot<bits<3> opcod, string opc, PatFrag opnode> {
@@ -692,6 +734,29 @@ multiclass T2I_bin_rrot<bits<3> opcod, string opc, PatFrag opnode> {
    }
 }
 
+// DO variant - disassembly only, no pattern
+
+multiclass T2I_bin_rrot_DO<bits<3> opcod, string opc> {
+  def rr     : T2I<(outs GPR:$dst), (ins GPR:$LHS, GPR:$RHS), IIC_iALUr,
+                  opc, "\t$dst, $LHS, $RHS", []> {
+     let Inst{31-27} = 0b11111;
+     let Inst{26-23} = 0b0100;
+     let Inst{22-20} = opcod;
+     let Inst{15-12} = 0b1111;
+     let Inst{7} = 1;
+     let Inst{5-4} = 0b00; // rotate
+   }
+  def rr_rot : T2I<(outs GPR:$dst), (ins GPR:$LHS, GPR:$RHS, i32imm:$rot),
+                  IIC_iALUsr, opc, "\t$dst, $LHS, $RHS, ror $rot", []> {
+     let Inst{31-27} = 0b11111;
+     let Inst{26-23} = 0b0100;
+     let Inst{22-20} = opcod;
+     let Inst{15-12} = 0b1111;
+     let Inst{7} = 1;
+     let Inst{5-4} = {?,?}; // rotate
+   }
+}
+
 //===----------------------------------------------------------------------===//
 // Instructions
 //===----------------------------------------------------------------------===//
@@ -734,7 +799,7 @@ def t2ADDrSPi   : T2sI<(outs GPR:$dst), (ins GPR:$sp, t2_so_imm:$imm),
   let Inst{19-16} = 0b1101; // Rn = sp
   let Inst{15} = 0;
 }
-def t2ADDrSPi12 : T2I<(outs GPR:$dst), (ins GPR:$sp, imm0_4095:$imm), 
+def t2ADDrSPi12 : T2I<(outs GPR:$dst), (ins GPR:$sp, imm0_4095:$imm),
                        IIC_iALUi, "addw", "\t$dst, $sp, $imm", []> {
   let Inst{31-27} = 0b11110;
   let Inst{25} = 1;
@@ -787,6 +852,25 @@ def t2SUBrSPs   : T2sI<(outs GPR:$dst), (ins GPR:$sp, t2_so_reg:$rhs),
   let Inst{15} = 0;
 }
 
+// Signed and unsigned division, for disassembly only
+def t2SDIV : T2I<(outs GPR:$dst), (ins GPR:$a, GPR:$b), IIC_iALUi, 
+                 "sdiv", "\t$dst, $a, $b", []> {
+  let Inst{31-27} = 0b11111;
+  let Inst{26-21} = 0b011100;
+  let Inst{20} = 0b1;
+  let Inst{15-12} = 0b1111;
+  let Inst{7-4} = 0b1111;
+}
+
+def t2UDIV : T2I<(outs GPR:$dst), (ins GPR:$a, GPR:$b), IIC_iALUi, 
+                 "udiv", "\t$dst, $a, $b", []> {
+  let Inst{31-27} = 0b11111;
+  let Inst{26-21} = 0b011101;
+  let Inst{20} = 0b1;
+  let Inst{15-12} = 0b1111;
+  let Inst{7-4} = 0b1111;
+}
+
 // Pseudo instruction that will expand into a t2SUBrSPi + a copy.
 let usesCustomInserter = 1 in { // Expanded after instruction selection.
 def t2SUBrSPi_   : PseudoInst<(outs GPR:$dst), (ins GPR:$sp, t2_so_imm:$imm),
@@ -803,7 +887,7 @@ def t2SUBrSPs_   : PseudoInst<(outs GPR:$dst), (ins GPR:$sp, t2_so_reg:$rhs),
 //
 
 // Load
-let canFoldAsLoad = 1, isReMaterializable = 1, mayHaveSideEffects = 1  in 
+let canFoldAsLoad = 1, isReMaterializable = 1  in
 defm t2LDR   : T2I_ld<0, 0b10, "ldr",  UnOpFrag<(load node:$Src)>>;
 
 // Loads with zero extension
@@ -925,10 +1009,32 @@ def t2LDRSH_POST : T2Iidxldst<1, 0b01, 1, 0, (outs GPR:$dst, GPR:$base_wb),
                             []>;
 }
 
+// LDRT, LDRBT, LDRHT, LDRSBT, LDRSHT all have offset mode (PUW=0b110) and are
+// for disassembly only.
+// Ref: A8.6.57 LDR (immediate, Thumb) Encoding T4
+class T2IldT<bit signed, bits<2> type, string opc>
+  : T2Ii8<(outs GPR:$dst), (ins t2addrmode_imm8:$addr), IIC_iLoadi, opc,
+          "\t$dst, $addr", []> {
+  let Inst{31-27} = 0b11111;
+  let Inst{26-25} = 0b00;
+  let Inst{24} = signed;
+  let Inst{23} = 0;
+  let Inst{22-21} = type;
+  let Inst{20} = 1; // load
+  let Inst{11} = 1;
+  let Inst{10-8} = 0b110; // PUW.
+}
+
+def t2LDRT   : T2IldT<0, 0b10, "ldrt">;
+def t2LDRBT  : T2IldT<0, 0b00, "ldrbt">;
+def t2LDRHT  : T2IldT<0, 0b01, "ldrht">;
+def t2LDRSBT : T2IldT<1, 0b00, "ldrsbt">;
+def t2LDRSHT : T2IldT<1, 0b01, "ldrsht">;
+
 // Store
-defm t2STR   : T2I_st<0b10, "str",  BinOpFrag<(store node:$LHS, node:$RHS)>>;
-defm t2STRB  : T2I_st<0b00, "strb", BinOpFrag<(truncstorei8 node:$LHS, node:$RHS)>>;
-defm t2STRH  : T2I_st<0b01, "strh", BinOpFrag<(truncstorei16 node:$LHS, node:$RHS)>>;
+defm t2STR :T2I_st<0b10,"str", BinOpFrag<(store node:$LHS, node:$RHS)>>;
+defm t2STRB:T2I_st<0b00,"strb",BinOpFrag<(truncstorei8 node:$LHS, node:$RHS)>>;
+defm t2STRH:T2I_st<0b01,"strh",BinOpFrag<(truncstorei16 node:$LHS, node:$RHS)>>;
 
 // Store doubleword
 let mayLoad = 1, hasExtraSrcRegAllocReq = 1 in
@@ -979,9 +1085,98 @@ def t2STRB_POST : T2Iidxldst<0, 0b00, 0, 0, (outs GPR:$base_wb),
         [(set GPR:$base_wb,
               (post_truncsti8 GPR:$src, GPR:$base, t2am_imm8_offset:$offset))]>;
 
+// STRT, STRBT, STRHT all have offset mode (PUW=0b110) and are for disassembly
+// only.
+// Ref: A8.6.193 STR (immediate, Thumb) Encoding T4
+class T2IstT<bits<2> type, string opc>
+  : T2Ii8<(outs GPR:$src), (ins t2addrmode_imm8:$addr), IIC_iStorei, opc,
+          "\t$src, $addr", []> {
+  let Inst{31-27} = 0b11111;
+  let Inst{26-25} = 0b00;
+  let Inst{24} = 0; // not signed
+  let Inst{23} = 0;
+  let Inst{22-21} = type;
+  let Inst{20} = 0; // store
+  let Inst{11} = 1;
+  let Inst{10-8} = 0b110; // PUW
+}
+
+def t2STRT   : T2IstT<0b10, "strt">;
+def t2STRBT  : T2IstT<0b00, "strbt">;
+def t2STRHT  : T2IstT<0b01, "strht">;
 
 // FIXME: ldrd / strd pre / post variants
 
+// T2Ipl (Preload Data/Instruction) signals the memory system of possible future
+// data/instruction access.  These are for disassembly only.
+multiclass T2Ipl<bit instr, bit write, string opc> {
+
+  def i12 : T2I<(outs), (ins t2addrmode_imm12:$addr), IIC_iLoadi, opc,
+                "\t$addr", []> {
+    let Inst{31-25} = 0b1111100;
+    let Inst{24} = instr;
+    let Inst{23} = 1; // U = 1
+    let Inst{22} = 0;
+    let Inst{21} = write;
+    let Inst{20} = 1;
+    let Inst{15-12} = 0b1111;
+  }
+
+  def i8 : T2I<(outs), (ins t2addrmode_imm8:$addr), IIC_iLoadi, opc,
+                "\t$addr", []> {
+    let Inst{31-25} = 0b1111100;
+    let Inst{24} = instr;
+    let Inst{23} = 0; // U = 0
+    let Inst{22} = 0;
+    let Inst{21} = write;
+    let Inst{20} = 1;
+    let Inst{15-12} = 0b1111;
+    let Inst{11-8} = 0b1100;
+  }
+
+  // A8.6.118 #0 and #-0 differs.  Translates -0 to -1, -1 to -2, ..., etc.
+  def pci : T2I<(outs), (ins GPR:$base, i32imm:$imm), IIC_iLoadi, opc,
+                "\t[pc, ${imm:negzero}]", []> {
+    let Inst{31-25} = 0b1111100;
+    let Inst{24} = instr;
+    let Inst{23} = ?; // add = (U == 1)
+    let Inst{22} = 0;
+    let Inst{21} = write;
+    let Inst{20} = 1;
+    let Inst{19-16} = 0b1111; // Rn = 0b1111
+    let Inst{15-12} = 0b1111;
+  }
+
+  def r   : T2I<(outs), (ins GPR:$base, GPR:$a), IIC_iLoadi, opc,
+                "\t[$base, $a]", []> {
+    let Inst{31-25} = 0b1111100;
+    let Inst{24} = instr;
+    let Inst{23} = 0; // add = TRUE for T1
+    let Inst{22} = 0;
+    let Inst{21} = write;
+    let Inst{20} = 1;
+    let Inst{15-12} = 0b1111;
+    let Inst{11-6} = 0000000;
+    let Inst{5-4} = 0b00; // no shift is applied
+  }
+
+  def s   : T2I<(outs), (ins GPR:$base, GPR:$a, i32imm:$shamt), IIC_iLoadi, opc,
+                "\t[$base, $a, lsl $shamt]", []> {
+    let Inst{31-25} = 0b1111100;
+    let Inst{24} = instr;
+    let Inst{23} = 0; // add = TRUE for T1
+    let Inst{22} = 0;
+    let Inst{21} = write;
+    let Inst{20} = 1;
+    let Inst{15-12} = 0b1111;
+    let Inst{11-6} = 0000000;
+  }
+}
+
+defm t2PLD  : T2Ipl<0, 0, "pld">;
+defm t2PLDW : T2Ipl<0, 1, "pldw">;
+defm t2PLI  : T2Ipl<1, 0, "pli">;
+
 //===----------------------------------------------------------------------===//
 //  Load / store multiple Instructions.
 //
@@ -989,7 +1184,7 @@ def t2STRB_POST : T2Iidxldst<0, 0b00, 0, 0, (outs GPR:$base_wb),
 let mayLoad = 1, hasExtraDefRegAllocReq = 1 in
 def t2LDM : T2XI<(outs),
                  (ins addrmode4:$addr, pred:$p, reglist:$wb, variable_ops),
-              IIC_iLoadm, "ldm${addr:submode}${p}${addr:wide}\t$addr, $wb", []> {
+             IIC_iLoadm, "ldm${addr:submode}${p}${addr:wide}\t$addr, $wb", []> {
   let Inst{31-27} = 0b11101;
   let Inst{26-25} = 0b00;
   let Inst{24-23} = {?, ?}; // IA: '01', DB: '10'
@@ -1001,7 +1196,7 @@ def t2LDM : T2XI<(outs),
 let mayStore = 1, hasExtraSrcRegAllocReq = 1 in
 def t2STM : T2XI<(outs),
                  (ins addrmode4:$addr, pred:$p, reglist:$wb, variable_ops),
-             IIC_iStorem, "stm${addr:submode}${p}${addr:wide}\t$addr, $wb", []> {
+            IIC_iStorem, "stm${addr:submode}${p}${addr:wide}\t$addr, $wb", []> {
   let Inst{31-27} = 0b11101;
   let Inst{26-25} = 0b00;
   let Inst{24-23} = {?, ?}; // IA: '01', DB: '10'
@@ -1074,13 +1269,15 @@ defm t2SXTB  : T2I_unary_rrot<0b100, "sxtb",
                               UnOpFrag<(sext_inreg node:$Src, i8)>>;
 defm t2SXTH  : T2I_unary_rrot<0b000, "sxth",
                               UnOpFrag<(sext_inreg node:$Src, i16)>>;
+defm t2SXTB16 : T2I_unary_rrot_DO<0b010, "sxtb16">;
 
 defm t2SXTAB : T2I_bin_rrot<0b100, "sxtab",
                         BinOpFrag<(add node:$LHS, (sext_inreg node:$RHS, i8))>>;
 defm t2SXTAH : T2I_bin_rrot<0b000, "sxtah",
                         BinOpFrag<(add node:$LHS, (sext_inreg node:$RHS,i16))>>;
+defm t2SXTAB16 : T2I_bin_rrot_DO<0b010, "sxtab16">;
 
-// TODO: SXT(A){B|H}16
+// TODO: SXT(A){B|H}16 - done for disassembly only
 
 // Zero extenders
 
@@ -1089,7 +1286,7 @@ defm t2UXTB   : T2I_unary_rrot<0b101, "uxtb",
                                UnOpFrag<(and node:$Src, 0x000000FF)>>;
 defm t2UXTH   : T2I_unary_rrot<0b001, "uxth",
                                UnOpFrag<(and node:$Src, 0x0000FFFF)>>;
-defm t2UXTB16 : T2I_unary_rrot<0b011, "uxtb16",
+defm t2UXTB16 : T2I_unary_rrot_nw<0b011, "uxtb16",
                                UnOpFrag<(and node:$Src, 0x00FF00FF)>>;
 
 def : T2Pat<(and (shl GPR:$Src, (i32 8)), 0xFF00FF),
@@ -1101,6 +1298,7 @@ defm t2UXTAB : T2I_bin_rrot<0b101, "uxtab",
                            BinOpFrag<(add node:$LHS, (and node:$RHS, 0x00FF))>>;
 defm t2UXTAH : T2I_bin_rrot<0b001, "uxtah",
                            BinOpFrag<(add node:$LHS, (and node:$RHS, 0xFFFF))>>;
+defm t2UXTAB16 : T2I_bin_rrot_DO<0b011, "uxtab16">;
 }
 
 //===----------------------------------------------------------------------===//
@@ -1119,9 +1317,13 @@ defm t2SUBS : T2I_bin_s_irs <0b1101, "sub",
                              BinOpFrag<(subc node:$LHS, node:$RHS)>>;
 
 defm t2ADC  : T2I_adde_sube_irs<0b1010, "adc",
-                                BinOpFrag<(adde node:$LHS, node:$RHS)>, 1>;
+                          BinOpFrag<(adde_dead_carry node:$LHS, node:$RHS)>, 1>;
 defm t2SBC  : T2I_adde_sube_irs<0b1011, "sbc",
-                                BinOpFrag<(sube node:$LHS, node:$RHS)>>;
+                          BinOpFrag<(sube_dead_carry node:$LHS, node:$RHS)>>;
+defm t2ADCS : T2I_adde_sube_s_irs<0b1010, "adc",
+                          BinOpFrag<(adde_live_carry node:$LHS, node:$RHS)>, 1>;
+defm t2SBCS : T2I_adde_sube_s_irs<0b1011, "sbc",
+                          BinOpFrag<(sube_live_carry node:$LHS, node:$RHS)>>;
 
 // RSB
 defm t2RSB  : T2I_rbin_is   <0b1110, "rsb",
@@ -1138,6 +1340,155 @@ def : T2Pat<(add       GPR:$src, t2_so_imm_neg:$imm),
 def : T2Pat<(add       GPR:$src, imm0_4095_neg:$imm),
             (t2SUBri12 GPR:$src, imm0_4095_neg:$imm)>;
 
+// Select Bytes -- for disassembly only
+
+def t2SEL : T2I<(outs GPR:$dst), (ins GPR:$a, GPR:$b), NoItinerary, "sel",
+                "\t$dst, $a, $b", []> {
+  let Inst{31-27} = 0b11111;
+  let Inst{26-24} = 0b010;
+  let Inst{23} = 0b1;
+  let Inst{22-20} = 0b010;
+  let Inst{15-12} = 0b1111;
+  let Inst{7} = 0b1;
+  let Inst{6-4} = 0b000;
+}
+
+// A6.3.13, A6.3.14, A6.3.15 Parallel addition and subtraction (signed/unsigned)
+// And Miscellaneous operations -- for disassembly only
+class T2I_pam<bits<3> op22_20, bits<4> op7_4, string opc>
+  : T2I<(outs GPR:$dst), (ins GPR:$a, GPR:$b), NoItinerary, opc,
+        "\t$dst, $a, $b", [/* For disassembly only; pattern left blank */]> {
+  let Inst{31-27} = 0b11111;
+  let Inst{26-23} = 0b0101;
+  let Inst{22-20} = op22_20;
+  let Inst{15-12} = 0b1111;
+  let Inst{7-4} = op7_4;
+}
+
+// Saturating add/subtract -- for disassembly only
+
+def t2QADD    : T2I_pam<0b000, 0b1000, "qadd">;
+def t2QADD16  : T2I_pam<0b001, 0b0001, "qadd16">;
+def t2QADD8   : T2I_pam<0b000, 0b0001, "qadd8">;
+def t2QASX    : T2I_pam<0b010, 0b0001, "qasx">;
+def t2QDADD   : T2I_pam<0b000, 0b1001, "qdadd">;
+def t2QDSUB   : T2I_pam<0b000, 0b1011, "qdsub">;
+def t2QSAX    : T2I_pam<0b110, 0b0001, "qsax">;
+def t2QSUB    : T2I_pam<0b000, 0b1010, "qsub">;
+def t2QSUB16  : T2I_pam<0b101, 0b0001, "qsub16">;
+def t2QSUB8   : T2I_pam<0b100, 0b0001, "qsub8">;
+def t2UQADD16 : T2I_pam<0b001, 0b0101, "uqadd16">;
+def t2UQADD8  : T2I_pam<0b000, 0b0101, "uqadd8">;
+def t2UQASX   : T2I_pam<0b010, 0b0101, "uqasx">;
+def t2UQSAX   : T2I_pam<0b110, 0b0101, "uqsax">;
+def t2UQSUB16 : T2I_pam<0b101, 0b0101, "uqsub16">;
+def t2UQSUB8  : T2I_pam<0b100, 0b0101, "uqsub8">;
+
+// Signed/Unsigned add/subtract -- for disassembly only
+
+def t2SASX    : T2I_pam<0b010, 0b0000, "sasx">;
+def t2SADD16  : T2I_pam<0b001, 0b0000, "sadd16">;
+def t2SADD8   : T2I_pam<0b000, 0b0000, "sadd8">;
+def t2SSAX    : T2I_pam<0b110, 0b0000, "ssax">;
+def t2SSUB16  : T2I_pam<0b101, 0b0000, "ssub16">;
+def t2SSUB8   : T2I_pam<0b100, 0b0000, "ssub8">;
+def t2UASX    : T2I_pam<0b010, 0b0100, "uasx">;
+def t2UADD16  : T2I_pam<0b001, 0b0100, "uadd16">;
+def t2UADD8   : T2I_pam<0b000, 0b0100, "uadd8">;
+def t2USAX    : T2I_pam<0b110, 0b0100, "usax">;
+def t2USUB16  : T2I_pam<0b101, 0b0100, "usub16">;
+def t2USUB8   : T2I_pam<0b100, 0b0100, "usub8">;
+
+// Signed/Unsigned halving add/subtract -- for disassembly only
+
+def t2SHASX   : T2I_pam<0b010, 0b0010, "shasx">;
+def t2SHADD16 : T2I_pam<0b001, 0b0010, "shadd16">;
+def t2SHADD8  : T2I_pam<0b000, 0b0010, "shadd8">;
+def t2SHSAX   : T2I_pam<0b110, 0b0010, "shsax">;
+def t2SHSUB16 : T2I_pam<0b101, 0b0010, "shsub16">;
+def t2SHSUB8  : T2I_pam<0b100, 0b0010, "shsub8">;
+def t2UHASX   : T2I_pam<0b010, 0b0110, "uhasx">;
+def t2UHADD16 : T2I_pam<0b001, 0b0110, "uhadd16">;
+def t2UHADD8  : T2I_pam<0b000, 0b0110, "uhadd8">;
+def t2UHSAX   : T2I_pam<0b110, 0b0110, "uhsax">;
+def t2UHSUB16 : T2I_pam<0b101, 0b0110, "uhsub16">;
+def t2UHSUB8  : T2I_pam<0b100, 0b0110, "uhsub8">;
+
+// Unsigned Sum of Absolute Differences [and Accumulate] -- for disassembly only
+
+def t2USAD8   : T2I_mac<0, 0b111, 0b0000, (outs GPR:$dst), (ins GPR:$a, GPR:$b),
+                        NoItinerary, "usad8", "\t$dst, $a, $b", []> {
+  let Inst{15-12} = 0b1111;
+}
+def t2USADA8  : T2I_mac<0, 0b111, 0b0000, (outs GPR:$dst),
+                        (ins GPR:$a, GPR:$b, GPR:$acc), NoItinerary, "usada8",
+                        "\t$dst, $a, $b, $acc", []>;
+
+// Signed/Unsigned saturate -- for disassembly only
+
+def t2SSATlsl : T2I<(outs GPR:$dst), (ins i32imm:$bit_pos,GPR:$a,i32imm:$shamt),
+                    NoItinerary, "ssat", "\t$dst, $bit_pos, $a, lsl $shamt",
+                    [/* For disassembly only; pattern left blank */]> {
+  let Inst{31-27} = 0b11110;
+  let Inst{25-22} = 0b1100;
+  let Inst{20} = 0;
+  let Inst{15} = 0;
+  let Inst{21} = 0;        // sh = '0'
+}
+
+def t2SSATasr : T2I<(outs GPR:$dst), (ins i32imm:$bit_pos,GPR:$a,i32imm:$shamt),
+                    NoItinerary, "ssat", "\t$dst, $bit_pos, $a, asr $shamt",
+                    [/* For disassembly only; pattern left blank */]> {
+  let Inst{31-27} = 0b11110;
+  let Inst{25-22} = 0b1100;
+  let Inst{20} = 0;
+  let Inst{15} = 0;
+  let Inst{21} = 1;        // sh = '1'
+}
+
+def t2SSAT16 : T2I<(outs GPR:$dst), (ins i32imm:$bit_pos, GPR:$a), NoItinerary,
+                   "ssat16", "\t$dst, $bit_pos, $a",
+                   [/* For disassembly only; pattern left blank */]> {
+  let Inst{31-27} = 0b11110;
+  let Inst{25-22} = 0b1100;
+  let Inst{20} = 0;
+  let Inst{15} = 0;
+  let Inst{21} = 1;        // sh = '1'
+  let Inst{14-12} = 0b000; // imm3 = '000'
+  let Inst{7-6} = 0b00;    // imm2 = '00'
+}
+
+def t2USATlsl : T2I<(outs GPR:$dst), (ins i32imm:$bit_pos,GPR:$a,i32imm:$shamt),
+                     NoItinerary, "usat", "\t$dst, $bit_pos, $a, lsl $shamt",
+                     [/* For disassembly only; pattern left blank */]> {
+  let Inst{31-27} = 0b11110;
+  let Inst{25-22} = 0b1110;
+  let Inst{20} = 0;
+  let Inst{15} = 0;
+  let Inst{21} = 0;        // sh = '0'
+}
+
+def t2USATasr : T2I<(outs GPR:$dst), (ins i32imm:$bit_pos,GPR:$a,i32imm:$shamt),
+                     NoItinerary, "usat", "\t$dst, $bit_pos, $a, asr $shamt",
+                     [/* For disassembly only; pattern left blank */]> {
+  let Inst{31-27} = 0b11110;
+  let Inst{25-22} = 0b1110;
+  let Inst{20} = 0;
+  let Inst{15} = 0;
+  let Inst{21} = 1;        // sh = '1'
+}
+
+def t2USAT16 : T2I<(outs GPR:$dst), (ins i32imm:$bit_pos, GPR:$a), NoItinerary,
+                   "usat16", "\t$dst, $bit_pos, $a",
+                   [/* For disassembly only; pattern left blank */]> {
+  let Inst{31-27} = 0b11110;
+  let Inst{25-22} = 0b1110;
+  let Inst{20} = 0;
+  let Inst{15} = 0;
+  let Inst{21} = 1;        // sh = '1'
+  let Inst{14-12} = 0b000; // imm3 = '000'
+  let Inst{7-6} = 0b00;    // imm2 = '00'
+}
 
 //===----------------------------------------------------------------------===//
 //  Shift and rotate Instructions.
@@ -1342,6 +1693,8 @@ def t2UMAAL : T2I<(outs GPR:$ldst, GPR:$hdst), (ins GPR:$a, GPR:$b), IIC_iMAC64,
 }
 } // neverHasSideEffects
 
+// Rounding variants of the below included for disassembly only
+
 // Most significant word multiply
 def t2SMMUL : T2I<(outs GPR:$dst), (ins GPR:$a, GPR:$b), IIC_iMUL32,
                   "smmul", "\t$dst, $a, $b",
@@ -1353,6 +1706,15 @@ def t2SMMUL : T2I<(outs GPR:$dst), (ins GPR:$a, GPR:$b), IIC_iMUL32,
   let Inst{7-4} = 0b0000; // No Rounding (Inst{4} = 0)
 }
 
+def t2SMMULR : T2I<(outs GPR:$dst), (ins GPR:$a, GPR:$b), IIC_iMUL32,
+                  "smmulr", "\t$dst, $a, $b", []> {
+  let Inst{31-27} = 0b11111;
+  let Inst{26-23} = 0b0110;
+  let Inst{22-20} = 0b101;
+  let Inst{15-12} = 0b1111; // Ra = 0b1111 (no accumulate)
+  let Inst{7-4} = 0b0001; // Rounding (Inst{4} = 1)
+}
+
 def t2SMMLA : T2I<(outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$c), IIC_iMAC32,
                   "smmla", "\t$dst, $a, $b, $c",
                   [(set GPR:$dst, (add (mulhs GPR:$a, GPR:$b), GPR:$c))]> {
@@ -1363,6 +1725,14 @@ def t2SMMLA : T2I<(outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$c), IIC_iMAC32,
   let Inst{7-4} = 0b0000; // No Rounding (Inst{4} = 0)
 }
 
+def t2SMMLAR : T2I<(outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$c), IIC_iMAC32,
+                  "smmlar", "\t$dst, $a, $b, $c", []> {
+  let Inst{31-27} = 0b11111;
+  let Inst{26-23} = 0b0110;
+  let Inst{22-20} = 0b101;
+  let Inst{15-12} = {?, ?, ?, ?}; // Ra
+  let Inst{7-4} = 0b0001; // Rounding (Inst{4} = 1)
+}
 
 def t2SMMLS : T2I <(outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$c), IIC_iMAC32,
                    "smmls", "\t$dst, $a, $b, $c",
@@ -1374,6 +1744,15 @@ def t2SMMLS : T2I <(outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$c), IIC_iMAC32,
   let Inst{7-4} = 0b0000; // No Rounding (Inst{4} = 0)
 }
 
+def t2SMMLSR : T2I <(outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$c), IIC_iMAC32,
+                   "smmlsr", "\t$dst, $a, $b, $c", []> {
+  let Inst{31-27} = 0b11111;
+  let Inst{26-23} = 0b0110;
+  let Inst{22-20} = 0b110;
+  let Inst{15-12} = {?, ?, ?, ?}; // Ra
+  let Inst{7-4} = 0b0001; // Rounding (Inst{4} = 1)
+}
+
 multiclass T2I_smul<string opc, PatFrag opnode> {
   def BB : T2I<(outs GPR:$dst), (ins GPR:$a, GPR:$b), IIC_iMUL32,
               !strconcat(opc, "bb"), "\t$dst, $a, $b",
@@ -1466,7 +1845,7 @@ multiclass T2I_smla<string opc, PatFrag opnode> {
   def BT : T2I<(outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$acc), IIC_iMAC16,
              !strconcat(opc, "bt"), "\t$dst, $a, $b, $acc",
              [(set GPR:$dst, (add GPR:$acc, (opnode (sext_inreg GPR:$a, i16),
-                                                    (sra GPR:$b, (i32 16)))))]> {
+                                                   (sra GPR:$b, (i32 16)))))]> {
     let Inst{31-27} = 0b11111;
     let Inst{26-23} = 0b0110;
     let Inst{22-20} = 0b001;
@@ -1490,7 +1869,7 @@ multiclass T2I_smla<string opc, PatFrag opnode> {
   def TT : T2I<(outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$acc), IIC_iMAC16,
               !strconcat(opc, "tt"), "\t$dst, $a, $b, $acc",
              [(set GPR:$dst, (add GPR:$acc, (opnode (sra GPR:$a, (i32 16)),
-                                                    (sra GPR:$b, (i32 16)))))]> {
+                                                   (sra GPR:$b, (i32 16)))))]> {
     let Inst{31-27} = 0b11111;
     let Inst{26-23} = 0b0110;
     let Inst{22-20} = 0b001;
@@ -1502,7 +1881,7 @@ multiclass T2I_smla<string opc, PatFrag opnode> {
   def WB : T2I<(outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$acc), IIC_iMAC16,
               !strconcat(opc, "wb"), "\t$dst, $a, $b, $acc",
               [(set GPR:$dst, (add GPR:$acc, (sra (opnode GPR:$a,
-                                       (sext_inreg GPR:$b, i16)), (i32 16))))]> {
+                                      (sext_inreg GPR:$b, i16)), (i32 16))))]> {
     let Inst{31-27} = 0b11111;
     let Inst{26-23} = 0b0110;
     let Inst{22-20} = 0b011;
@@ -1514,7 +1893,7 @@ multiclass T2I_smla<string opc, PatFrag opnode> {
   def WT : T2I<(outs GPR:$dst), (ins GPR:$a, GPR:$b, GPR:$acc), IIC_iMAC16,
               !strconcat(opc, "wt"), "\t$dst, $a, $b, $acc",
               [(set GPR:$dst, (add GPR:$acc, (sra (opnode GPR:$a,
-                                         (sra GPR:$b, (i32 16))), (i32 16))))]> {
+                                        (sra GPR:$b, (i32 16))), (i32 16))))]> {
     let Inst{31-27} = 0b11111;
     let Inst{26-23} = 0b0110;
     let Inst{22-20} = 0b011;
@@ -1527,16 +1906,70 @@ multiclass T2I_smla<string opc, PatFrag opnode> {
 defm t2SMUL : T2I_smul<"smul", BinOpFrag<(mul node:$LHS, node:$RHS)>>;
 defm t2SMLA : T2I_smla<"smla", BinOpFrag<(mul node:$LHS, node:$RHS)>>;
 
-// TODO: Halfword multiple accumulate long: SMLAL<x><y>
-// TODO: Dual halfword multiple: SMUAD, SMUSD, SMLAD, SMLSD, SMLALD, SMLSLD
-
+// Halfword multiple accumulate long: SMLAL<x><y> -- for disassembly only
+def t2SMLALBB : T2I_mac<1, 0b100, 0b1000, (outs GPR:$ldst,GPR:$hdst),
+           (ins GPR:$a,GPR:$b), IIC_iMAC64, "smlalbb", "\t$ldst, $hdst, $a, $b",
+           [/* For disassembly only; pattern left blank */]>;
+def t2SMLALBT : T2I_mac<1, 0b100, 0b1001, (outs GPR:$ldst,GPR:$hdst),
+           (ins GPR:$a,GPR:$b), IIC_iMAC64, "smlalbt", "\t$ldst, $hdst, $a, $b",
+           [/* For disassembly only; pattern left blank */]>;
+def t2SMLALTB : T2I_mac<1, 0b100, 0b1010, (outs GPR:$ldst,GPR:$hdst),
+           (ins GPR:$a,GPR:$b), IIC_iMAC64, "smlaltb", "\t$ldst, $hdst, $a, $b",
+           [/* For disassembly only; pattern left blank */]>;
+def t2SMLALTT : T2I_mac<1, 0b100, 0b1011, (outs GPR:$ldst,GPR:$hdst),
+           (ins GPR:$a,GPR:$b), IIC_iMAC64, "smlaltt", "\t$ldst, $hdst, $a, $b",
+           [/* For disassembly only; pattern left blank */]>;
+
+// Dual halfword multiple: SMUAD, SMUSD, SMLAD, SMLSD, SMLALD, SMLSLD
+// These are for disassembly only.
+
+def t2SMUAD   : T2I_mac<0, 0b010, 0b0000, (outs GPR:$dst), (ins GPR:$a, GPR:$b),
+                        IIC_iMAC32, "smuad", "\t$dst, $a, $b", []> {
+  let Inst{15-12} = 0b1111;
+}
+def t2SMUADX  : T2I_mac<0, 0b010, 0b0001, (outs GPR:$dst), (ins GPR:$a, GPR:$b),
+                        IIC_iMAC32, "smuadx", "\t$dst, $a, $b", []> {
+  let Inst{15-12} = 0b1111;
+}
+def t2SMUSD   : T2I_mac<0, 0b100, 0b0000, (outs GPR:$dst), (ins GPR:$a, GPR:$b),
+                        IIC_iMAC32, "smusd", "\t$dst, $a, $b", []> {
+  let Inst{15-12} = 0b1111;
+}
+def t2SMUSDX  : T2I_mac<0, 0b100, 0b0001, (outs GPR:$dst), (ins GPR:$a, GPR:$b),
+                        IIC_iMAC32, "smusdx", "\t$dst, $a, $b", []> {
+  let Inst{15-12} = 0b1111;
+}
+def t2SMLAD   : T2I_mac<0, 0b010, 0b0000, (outs GPR:$dst),
+                        (ins GPR:$a, GPR:$b, GPR:$acc), IIC_iMAC32, "smlad",
+                        "\t$dst, $a, $b, $acc", []>;
+def t2SMLADX  : T2I_mac<0, 0b010, 0b0001, (outs GPR:$dst),
+                        (ins GPR:$a, GPR:$b, GPR:$acc), IIC_iMAC32, "smladx",
+                        "\t$dst, $a, $b, $acc", []>;
+def t2SMLSD   : T2I_mac<0, 0b100, 0b0000, (outs GPR:$dst),
+                        (ins GPR:$a, GPR:$b, GPR:$acc), IIC_iMAC32, "smlsd",
+                        "\t$dst, $a, $b, $acc", []>;
+def t2SMLSDX  : T2I_mac<0, 0b100, 0b0001, (outs GPR:$dst),
+                        (ins GPR:$a, GPR:$b, GPR:$acc), IIC_iMAC32, "smlsdx",
+                        "\t$dst, $a, $b, $acc", []>;
+def t2SMLALD  : T2I_mac<1, 0b100, 0b1100, (outs GPR:$ldst,GPR:$hdst),
+                        (ins GPR:$a,GPR:$b), IIC_iMAC64, "smlald",
+                        "\t$ldst, $hdst, $a, $b", []>;
+def t2SMLALDX : T2I_mac<1, 0b100, 0b1101, (outs GPR:$ldst,GPR:$hdst),
+                        (ins GPR:$a,GPR:$b), IIC_iMAC64, "smlaldx",
+                        "\t$ldst, $hdst, $a, $b", []>;
+def t2SMLSLD  : T2I_mac<1, 0b101, 0b1100, (outs GPR:$ldst,GPR:$hdst),
+                        (ins GPR:$a,GPR:$b), IIC_iMAC64, "smlsld",
+                        "\t$ldst, $hdst, $a, $b", []>;
+def t2SMLSLDX : T2I_mac<1, 0b101, 0b1101, (outs GPR:$ldst,GPR:$hdst),
+                        (ins GPR:$a,GPR:$b), IIC_iMAC64, "smlsldx",
+                        "\t$ldst, $hdst, $a, $b", []>;
 
 //===----------------------------------------------------------------------===//
 //  Misc. Arithmetic Instructions.
 //
 
-class T2I_misc<bits<2> op1, bits<2> op2, dag oops, dag iops, InstrItinClass itin,
-              string opc, string asm, list<dag> pattern>
+class T2I_misc<bits<2> op1, bits<2> op2, dag oops, dag iops,
+      InstrItinClass itin, string opc, string asm, list<dag> pattern>
   : T2I<oops, iops, itin, opc, asm, pattern> {
   let Inst{31-27} = 0b11111;
   let Inst{26-22} = 0b01010;
@@ -1572,7 +2005,7 @@ def t2REVSH : T2I_misc<0b01, 0b11, (outs GPR:$dst), (ins GPR:$src), IIC_iUNAr,
                           (shl GPR:$src, (i32 8))), i16))]>;
 
 def t2PKHBT : T2I<(outs GPR:$dst), (ins GPR:$src1, GPR:$src2, i32imm:$shamt),
-                  IIC_iALUsi, "pkhbt", "\t$dst, $src1, $src2, LSL $shamt",
+                  IIC_iALUsi, "pkhbt", "\t$dst, $src1, $src2, lsl $shamt",
                   [(set GPR:$dst, (or (and GPR:$src1, 0xFFFF),
                                       (and (shl GPR:$src2, (i32 imm:$shamt)),
                                            0xFFFF0000)))]> {
@@ -1590,7 +2023,7 @@ def : T2Pat<(or (and GPR:$src1, 0xFFFF), (shl GPR:$src2, imm16_31:$shamt)),
             (t2PKHBT GPR:$src1, GPR:$src2, imm16_31:$shamt)>;
 
 def t2PKHTB : T2I<(outs GPR:$dst), (ins GPR:$src1, GPR:$src2, i32imm:$shamt),
-                  IIC_iALUsi, "pkhtb", "\t$dst, $src1, $src2, ASR $shamt",
+                  IIC_iALUsi, "pkhtb", "\t$dst, $src1, $src2, asr $shamt",
                   [(set GPR:$dst, (or (and GPR:$src1, 0xFFFF0000),
                                       (and (sra GPR:$src2, imm16_31:$shamt),
                                            0xFFFF)))]> {
@@ -1643,7 +2076,7 @@ defm t2TEQ  : T2I_cmp_irs<0b0100, "teq",
 
 // Conditional moves
 // FIXME: should be able to write a pattern for ARMcmov, but can't use
-// a two-value operand where a dag node expects two operands. :( 
+// a two-value operand where a dag node expects two operands. :(
 def t2MOVCCr : T2I<(outs GPR:$dst), (ins GPR:$false, GPR:$true), IIC_iCMOVr,
                    "mov", ".w\t$dst, $true",
       [/*(set GPR:$dst, (ARMcmov GPR:$false, GPR:$true, imm:$cc, CCR:$ccr))*/]>,
@@ -1723,6 +2156,66 @@ def t2Int_SyncBarrierV7 : AInoP<(outs), (ins),
 }
 }
 
+// Helper class for multiclass T2MemB -- for disassembly only
+class T2I_memb<string opc, string asm>
+  : T2I<(outs), (ins), NoItinerary, opc, asm,
+        [/* For disassembly only; pattern left blank */]>,
+    Requires<[IsThumb2, HasV7]> {
+  let Inst{31-20} = 0xf3b;
+  let Inst{15-14} = 0b10;
+  let Inst{12} = 0;
+}
+
+multiclass T2MemB<bits<4> op7_4, string opc> {
+
+  def st : T2I_memb<opc, "\tst"> {
+    let Inst{7-4} = op7_4;
+    let Inst{3-0} = 0b1110;
+  }
+
+  def ish : T2I_memb<opc, "\tish"> {
+    let Inst{7-4} = op7_4;
+    let Inst{3-0} = 0b1011;
+  }
+
+  def ishst : T2I_memb<opc, "\tishst"> {
+    let Inst{7-4} = op7_4;
+    let Inst{3-0} = 0b1010;
+  }
+
+  def nsh : T2I_memb<opc, "\tnsh"> {
+    let Inst{7-4} = op7_4;
+    let Inst{3-0} = 0b0111;
+  }
+
+  def nshst : T2I_memb<opc, "\tnshst"> {
+    let Inst{7-4} = op7_4;
+    let Inst{3-0} = 0b0110;
+  }
+
+  def osh : T2I_memb<opc, "\tosh"> {
+    let Inst{7-4} = op7_4;
+    let Inst{3-0} = 0b0011;
+  }
+
+  def oshst : T2I_memb<opc, "\toshst"> {
+    let Inst{7-4} = op7_4;
+    let Inst{3-0} = 0b0010;
+  }
+}
+
+// These DMB variants are for disassembly only.
+defm t2DMB : T2MemB<0b0101, "dmb">;
+
+// These DSB variants are for disassembly only.
+defm t2DSB : T2MemB<0b0100, "dsb">;
+
+// ISB has only full system option -- for disassembly only
+def t2ISBsy : T2I_memb<"isb", ""> {
+  let Inst{7-4} = 0b0110;
+  let Inst{3-0} = 0b1111;
+}
+
 class T2I_ldrex<bits<2> opcod, dag oops, dag iops, AddrMode am, SizeFlagVal sz,
                 InstrItinClass itin, string opc, string asm, string cstr,
                 list<dag> pattern, bits<4> rt2 = 0b1111>
@@ -1789,6 +2282,16 @@ def t2STREXD : T2I_strex<0b11, (outs GPR:$success),
                          {?, ?, ?, ?}>;
 }
 
+// Clear-Exclusive is for disassembly only.
+def t2CLREX : T2I<(outs), (ins), NoItinerary, "clrex", "",
+                  [/* For disassembly only; pattern left blank */]>,
+            Requires<[IsARM, HasV7]>  {
+  let Inst{31-20} = 0xf3b;
+  let Inst{15-14} = 0b10;
+  let Inst{12} = 0;
+  let Inst{7-4} = 0b0010;
+}
+
 //===----------------------------------------------------------------------===//
 // TLS Instructions
 //
@@ -1906,6 +2409,24 @@ def t2TBH :
   let Inst{15-8} = 0b11110000;
   let Inst{7-4} = 0b0001; // H form
 }
+
+// Generic versions of the above two instructions, for disassembly only
+
+def t2TBBgen : T2I<(outs), (ins GPR:$a, GPR:$b), IIC_Br,
+                    "tbb", "\t[$a, $b]", []>{
+  let Inst{31-27} = 0b11101;
+  let Inst{26-20} = 0b0001101;
+  let Inst{15-8} = 0b11110000;
+  let Inst{7-4} = 0b0000; // B form
+}
+
+def t2TBHgen : T2I<(outs), (ins GPR:$a, GPR:$b), IIC_Br,
+                   "tbh", "\t[$a, $b, lsl #1]", []> {
+  let Inst{31-27} = 0b11101;
+  let Inst{26-20} = 0b0001101;
+  let Inst{15-8} = 0b11110000;
+  let Inst{7-4} = 0b0001; // H form
+}
 } // isNotDuplicable, isIndirectBranch
 
 } // isBranch, isTerminator, isBarrier
@@ -1931,6 +2452,119 @@ def t2IT : Thumb2XI<(outs), (ins it_pred:$cc, it_mask:$mask),
   let Inst{15-8} = 0b10111111;
 }
 
+// Branch and Exchange Jazelle -- for disassembly only
+// Rm = Inst{19-16}
+def t2BXJ : T2I<(outs), (ins GPR:$func), NoItinerary, "bxj", "\t$func",
+              [/* For disassembly only; pattern left blank */]> {
+  let Inst{31-27} = 0b11110;
+  let Inst{26} = 0;
+  let Inst{25-20} = 0b111100;
+  let Inst{15-14} = 0b10;
+  let Inst{12} = 0;
+}
+
+// Change Processor State is a system instruction -- for disassembly only.
+// The singleton $opt operand contains the following information:
+// opt{4-0} = mode from Inst{4-0}
+// opt{5} = changemode from Inst{17}
+// opt{8-6} = AIF from Inst{8-6}
+// opt{10-9} = imod from Inst{19-18} with 0b10 as enable and 0b11 as disable
+def t2CPS : T2XI<(outs),(ins i32imm:$opt), NoItinerary, "cps${opt:cps}",
+                 [/* For disassembly only; pattern left blank */]> {
+  let Inst{31-27} = 0b11110;
+  let Inst{26} = 0;
+  let Inst{25-20} = 0b111010;
+  let Inst{15-14} = 0b10;
+  let Inst{12} = 0;
+}
+
+// A6.3.4 Branches and miscellaneous control
+// Table A6-14 Change Processor State, and hint instructions
+// Helper class for disassembly only.
+class T2I_hint<bits<8> op7_0, string opc, string asm>
+  : T2I<(outs), (ins), NoItinerary, opc, asm,
+        [/* For disassembly only; pattern left blank */]> {
+  let Inst{31-20} = 0xf3a;
+  let Inst{15-14} = 0b10;
+  let Inst{12} = 0;
+  let Inst{10-8} = 0b000;
+  let Inst{7-0} = op7_0;
+}
+
+def t2NOP   : T2I_hint<0b00000000, "nop",   ".w">;
+def t2YIELD : T2I_hint<0b00000001, "yield", ".w">;
+def t2WFE   : T2I_hint<0b00000010, "wfe",   ".w">;
+def t2WFI   : T2I_hint<0b00000011, "wfi",   ".w">;
+def t2SEV   : T2I_hint<0b00000100, "sev",   ".w">;
+
+def t2DBG : T2I<(outs),(ins i32imm:$opt), NoItinerary, "dbg", "\t$opt",
+                [/* For disassembly only; pattern left blank */]> {
+  let Inst{31-20} = 0xf3a;
+  let Inst{15-14} = 0b10;
+  let Inst{12} = 0;
+  let Inst{10-8} = 0b000;
+  let Inst{7-4} = 0b1111;
+}
+
+// Secure Monitor Call is a system instruction -- for disassembly only
+// Option = Inst{19-16}
+def t2SMC : T2I<(outs), (ins i32imm:$opt), NoItinerary, "smc", "\t$opt",
+                [/* For disassembly only; pattern left blank */]> {
+  let Inst{31-27} = 0b11110;
+  let Inst{26-20} = 0b1111111;
+  let Inst{15-12} = 0b1000;
+}
+
+// Store Return State is a system instruction -- for disassembly only
+def t2SRSDBW : T2I<(outs),(ins i32imm:$mode),NoItinerary,"srsdb","\tsp!, $mode",
+                   [/* For disassembly only; pattern left blank */]> {
+  let Inst{31-27} = 0b11101;
+  let Inst{26-20} = 0b0000010; // W = 1
+}
+
+def t2SRSDB  : T2I<(outs),(ins i32imm:$mode),NoItinerary,"srsdb","\tsp, $mode",
+                   [/* For disassembly only; pattern left blank */]> {
+  let Inst{31-27} = 0b11101;
+  let Inst{26-20} = 0b0000000; // W = 0
+}
+
+def t2SRSIAW : T2I<(outs),(ins i32imm:$mode),NoItinerary,"srsia","\tsp!, $mode",
+                   [/* For disassembly only; pattern left blank */]> {
+  let Inst{31-27} = 0b11101;
+  let Inst{26-20} = 0b0011010; // W = 1
+}
+
+def t2SRSIA  : T2I<(outs), (ins i32imm:$mode),NoItinerary,"srsia","\tsp, $mode",
+                   [/* For disassembly only; pattern left blank */]> {
+  let Inst{31-27} = 0b11101;
+  let Inst{26-20} = 0b0011000; // W = 0
+}
+
+// Return From Exception is a system instruction -- for disassembly only
+def t2RFEDBW : T2I<(outs), (ins GPR:$base), NoItinerary, "rfedb", "\t$base!",
+                   [/* For disassembly only; pattern left blank */]> {
+  let Inst{31-27} = 0b11101;
+  let Inst{26-20} = 0b0000011; // W = 1
+}
+
+def t2RFEDB  : T2I<(outs), (ins GPR:$base), NoItinerary, "rfeab", "\t$base",
+                   [/* For disassembly only; pattern left blank */]> {
+  let Inst{31-27} = 0b11101;
+  let Inst{26-20} = 0b0000001; // W = 0
+}
+
+def t2RFEIAW : T2I<(outs), (ins GPR:$base), NoItinerary, "rfeia", "\t$base!",
+                   [/* For disassembly only; pattern left blank */]> {
+  let Inst{31-27} = 0b11101;
+  let Inst{26-20} = 0b0011011; // W = 1
+}
+
+def t2RFEIA  : T2I<(outs), (ins GPR:$base), NoItinerary, "rfeia", "\t$base",
+                   [/* For disassembly only; pattern left blank */]> {
+  let Inst{31-27} = 0b11101;
+  let Inst{26-20} = 0b0011001; // W = 0
+}
+
 //===----------------------------------------------------------------------===//
 // Non-Instruction Patterns
 //
@@ -1970,9 +2604,59 @@ def : T2Pat<(ARMWrapperJT tjumptable:$dst, imm:$id),
 // Pseudo instruction that combines ldr from constpool and add pc. This should
 // be expanded into two instructions late to allow if-conversion and
 // scheduling.
-let canFoldAsLoad = 1, isReMaterializable = 1, mayHaveSideEffects = 1 in 
+let canFoldAsLoad = 1, isReMaterializable = 1 in
 def t2LDRpci_pic : PseudoInst<(outs GPR:$dst), (ins i32imm:$addr, pclabel:$cp),
                    NoItinerary, "@ ldr.w\t$dst, $addr\n$cp:\n\tadd\t$dst, pc",
                [(set GPR:$dst, (ARMpic_add (load (ARMWrapper tconstpool:$addr)),
                                            imm:$cp))]>,
                Requires<[IsThumb2]>;
+
+//===----------------------------------------------------------------------===//
+// Move between special register and ARM core register -- for disassembly only
+//
+
+// Rd = Instr{11-8}
+def t2MRS : T2I<(outs GPR:$dst), (ins), NoItinerary, "mrs", "\t$dst, cpsr",
+                [/* For disassembly only; pattern left blank */]> {
+  let Inst{31-27} = 0b11110;
+  let Inst{26} = 0;
+  let Inst{25-21} = 0b11111;
+  let Inst{20} = 0; // The R bit.
+  let Inst{15-14} = 0b10;
+  let Inst{12} = 0;
+}
+
+// Rd = Instr{11-8}
+def t2MRSsys : T2I<(outs GPR:$dst), (ins), NoItinerary, "mrs", "\t$dst, spsr",
+                   [/* For disassembly only; pattern left blank */]> {
+  let Inst{31-27} = 0b11110;
+  let Inst{26} = 0;
+  let Inst{25-21} = 0b11111;
+  let Inst{20} = 1; // The R bit.
+  let Inst{15-14} = 0b10;
+  let Inst{12} = 0;
+}
+
+// FIXME: mask is ignored for the time being.
+// Rn = Inst{19-16}
+def t2MSR : T2I<(outs), (ins GPR:$src), NoItinerary, "msr", "\tcpsr, $src",
+                [/* For disassembly only; pattern left blank */]> {
+  let Inst{31-27} = 0b11110;
+  let Inst{26} = 0;
+  let Inst{25-21} = 0b11100;
+  let Inst{20} = 0; // The R bit.
+  let Inst{15-14} = 0b10;
+  let Inst{12} = 0;
+}
+
+// FIXME: mask is ignored for the time being.
+// Rn = Inst{19-16}
+def t2MSRsys : T2I<(outs), (ins GPR:$src), NoItinerary, "msr", "\tspsr, $src",
+                   [/* For disassembly only; pattern left blank */]> {
+  let Inst{31-27} = 0b11110;
+  let Inst{26} = 0;
+  let Inst{25-21} = 0b11100;
+  let Inst{20} = 1; // The R bit.
+  let Inst{15-14} = 0b10;
+  let Inst{12} = 0;
+}
diff --git a/libclamav/c++/llvm/lib/Target/ARM/ARMInstrVFP.td b/libclamav/c++/llvm/lib/Target/ARM/ARMInstrVFP.td
index e516593..7c117ed 100644
--- a/libclamav/c++/llvm/lib/Target/ARM/ARMInstrVFP.td
+++ b/libclamav/c++/llvm/lib/Target/ARM/ARMInstrVFP.td
@@ -54,7 +54,7 @@ def vfp_f64imm : Operand<f64>,
 //  Load / store Instructions.
 //
 
-let canFoldAsLoad = 1, isReMaterializable = 1, mayHaveSideEffects = 1 in {
+let canFoldAsLoad = 1, isReMaterializable = 1 in {
 def VLDRD : ADI5<0b1101, 0b01, (outs DPR:$dst), (ins addrmode5:$addr),
                  IIC_fpLoad64, "vldr", ".64\t$dst, $addr",
                  [(set DPR:$dst, (load addrmode5:$addr))]>;
diff --git a/libclamav/c++/llvm/lib/Target/ARM/ARMJITInfo.cpp b/libclamav/c++/llvm/lib/Target/ARM/ARMJITInfo.cpp
index bef5a06..8c0b720 100644
--- a/libclamav/c++/llvm/lib/Target/ARM/ARMJITInfo.cpp
+++ b/libclamav/c++/llvm/lib/Target/ARM/ARMJITInfo.cpp
@@ -60,7 +60,7 @@ extern "C" {
     // whole compilation callback doesn't exist as far as the caller is
     // concerned, so we can't just preserve the callee saved regs.
     "stmdb sp!, {r0, r1, r2, r3, lr}\n"
-#ifndef __SOFTFP__
+#if (defined(__VFP_FP__) && !defined(__SOFTFP__))
     "fstmfdd sp!, {d0, d1, d2, d3, d4, d5, d6, d7}\n"
 #endif
     // The LR contains the address of the stub function on entry.
@@ -83,7 +83,7 @@ extern "C" {
     // 6-20 | D0..D7 | Saved VFP registers
     //      +--------+
     //
-#ifndef __SOFTFP__
+#if (defined(__VFP_FP__) && !defined(__SOFTFP__))
     // Restore VFP caller-saved registers.
     "fldmfdd sp!, {d0, d1, d2, d3, d4, d5, d6, d7}\n"
 #endif
diff --git a/libclamav/c++/llvm/lib/Target/ARM/ARMLoadStoreOptimizer.cpp b/libclamav/c++/llvm/lib/Target/ARM/ARMLoadStoreOptimizer.cpp
index 4e2d181..19f1e3b 100644
--- a/libclamav/c++/llvm/lib/Target/ARM/ARMLoadStoreOptimizer.cpp
+++ b/libclamav/c++/llvm/lib/Target/ARM/ARMLoadStoreOptimizer.cpp
@@ -748,11 +748,24 @@ static bool isMemoryOp(const MachineInstr *MI) {
     if (MMO->isVolatile())
       return false;
 
-    // Unaligned ldr/str is emulated by some kernels, but unaligned ldm/stm is not.
+    // Unaligned ldr/str is emulated by some kernels, but unaligned ldm/stm is
+    // not.
     if (MMO->getAlignment() < 4)
       return false;
   }
 
+  // str <undef> could probably be eliminated entirely, but for now we just want
+  // to avoid making a mess of it.
+  // FIXME: Use str <undef> as a wildcard to enable better stm folding.
+  if (MI->getNumOperands() > 0 && MI->getOperand(0).isReg() &&
+      MI->getOperand(0).isUndef())
+    return false;
+
+  // Likewise don't mess with references to undefined addresses.
+  if (MI->getNumOperands() > 1 && MI->getOperand(1).isReg() &&
+      MI->getOperand(1).isUndef())
+    return false;
+
   int Opcode = MI->getOpcode();
   switch (Opcode) {
   default: break;
diff --git a/libclamav/c++/llvm/lib/Target/ARM/ARMTargetObjectFile.h b/libclamav/c++/llvm/lib/Target/ARM/ARMTargetObjectFile.h
index 9703403..a488c0a 100644
--- a/libclamav/c++/llvm/lib/Target/ARM/ARMTargetObjectFile.h
+++ b/libclamav/c++/llvm/lib/Target/ARM/ARMTargetObjectFile.h
@@ -10,7 +10,7 @@
 #ifndef LLVM_TARGET_ARM_TARGETOBJECTFILE_H
 #define LLVM_TARGET_ARM_TARGETOBJECTFILE_H
 
-#include "llvm/Target/TargetLoweringObjectFile.h"
+#include "llvm/CodeGen/TargetLoweringObjectFileImpl.h"
 #include "llvm/MC/MCSectionELF.h"
 
 namespace llvm {
@@ -24,7 +24,7 @@ namespace llvm {
 
       if (TM.getSubtarget<ARMSubtarget>().isAAPCS_ABI()) {
         StaticCtorSection =
-          getELFSection(".init_array", MCSectionELF::SHT_INIT_ARRAY, 
+          getELFSection(".init_array", MCSectionELF::SHT_INIT_ARRAY,
                         MCSectionELF::SHF_WRITE | MCSectionELF::SHF_ALLOC,
                         SectionKind::getDataRel());
         StaticDtorSection =
diff --git a/libclamav/c++/llvm/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp b/libclamav/c++/llvm/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
index 0a75c09..d6d595c 100644
--- a/libclamav/c++/llvm/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
+++ b/libclamav/c++/llvm/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
@@ -30,6 +30,7 @@
 #include "llvm/CodeGen/MachineModuleInfoImpls.h"
 #include "llvm/CodeGen/MachineFunctionPass.h"
 #include "llvm/CodeGen/MachineJumpTableInfo.h"
+#include "llvm/CodeGen/TargetLoweringObjectFileImpl.h"
 #include "llvm/MC/MCAsmInfo.h"
 #include "llvm/MC/MCContext.h"
 #include "llvm/MC/MCInst.h"
@@ -37,7 +38,6 @@
 #include "llvm/MC/MCStreamer.h"
 #include "llvm/MC/MCSymbol.h"
 #include "llvm/Target/TargetData.h"
-#include "llvm/Target/TargetLoweringObjectFile.h"
 #include "llvm/Target/TargetMachine.h"
 #include "llvm/Target/TargetOptions.h"
 #include "llvm/Target/TargetRegistry.h"
@@ -122,6 +122,7 @@ namespace {
     void printT2AddrModeSoRegOperand(const MachineInstr *MI, int OpNum);
 
     void printPredicateOperand(const MachineInstr *MI, int OpNum);
+    void printMandatoryPredicateOperand(const MachineInstr *MI, int OpNum);
     void printSBitModifierOperand(const MachineInstr *MI, int OpNum);
     void printPCLabel(const MachineInstr *MI, int OpNum);
     void printRegisterList(const MachineInstr *MI, int OpNum);
@@ -786,6 +787,12 @@ void ARMAsmPrinter::printPredicateOperand(const MachineInstr *MI, int OpNum) {
     O << ARMCondCodeToString(CC);
 }
 
+void ARMAsmPrinter::printMandatoryPredicateOperand(const MachineInstr *MI,
+                                                   int OpNum) {
+  ARMCC::CondCodes CC = (ARMCC::CondCodes)MI->getOperand(OpNum).getImm();
+  O << ARMCondCodeToString(CC);
+}
+
 void ARMAsmPrinter::printSBitModifierOperand(const MachineInstr *MI, int OpNum){
   unsigned Reg = MI->getOperand(OpNum).getReg();
   if (Reg) {
diff --git a/libclamav/c++/llvm/lib/Target/ARM/AsmPrinter/ARMInstPrinter.cpp b/libclamav/c++/llvm/lib/Target/ARM/AsmPrinter/ARMInstPrinter.cpp
index d7d8e09..a2084b0 100644
--- a/libclamav/c++/llvm/lib/Target/ARM/AsmPrinter/ARMInstPrinter.cpp
+++ b/libclamav/c++/llvm/lib/Target/ARM/AsmPrinter/ARMInstPrinter.cpp
@@ -325,6 +325,12 @@ void ARMInstPrinter::printPredicateOperand(const MCInst *MI, unsigned OpNum) {
     O << ARMCondCodeToString(CC);
 }
 
+void ARMInstPrinter::printMandatoryPredicateOperand(const MCInst *MI, 
+                                                    unsigned OpNum) {
+  ARMCC::CondCodes CC = (ARMCC::CondCodes)MI->getOperand(OpNum).getImm();
+  O << ARMCondCodeToString(CC);
+}
+
 void ARMInstPrinter::printSBitModifierOperand(const MCInst *MI, unsigned OpNum){
   if (MI->getOperand(OpNum).getReg()) {
     assert(MI->getOperand(OpNum).getReg() == ARM::CPSR &&
diff --git a/libclamav/c++/llvm/lib/Target/ARM/AsmPrinter/ARMInstPrinter.h b/libclamav/c++/llvm/lib/Target/ARM/AsmPrinter/ARMInstPrinter.h
index 23a7f05..b7964c9 100644
--- a/libclamav/c++/llvm/lib/Target/ARM/AsmPrinter/ARMInstPrinter.h
+++ b/libclamav/c++/llvm/lib/Target/ARM/AsmPrinter/ARMInstPrinter.h
@@ -71,6 +71,7 @@ public:
   void printT2AddrModeSoRegOperand(const MCInst *MI, unsigned OpNum) {}
   
   void printPredicateOperand(const MCInst *MI, unsigned OpNum);
+  void printMandatoryPredicateOperand(const MCInst *MI, unsigned OpNum);
   void printSBitModifierOperand(const MCInst *MI, unsigned OpNum);
   void printRegisterList(const MCInst *MI, unsigned OpNum);
   void printCPInstOperand(const MCInst *MI, unsigned OpNum,
diff --git a/libclamav/c++/llvm/lib/Target/ARM/README.txt b/libclamav/c++/llvm/lib/Target/ARM/README.txt
index 9efb5a1..57b65cf 100644
--- a/libclamav/c++/llvm/lib/Target/ARM/README.txt
+++ b/libclamav/c++/llvm/lib/Target/ARM/README.txt
@@ -10,6 +10,8 @@ Reimplement 'select' in terms of 'SEL'.
 * Implement pre/post increment support.  (e.g. PR935)
 * Implement smarter constant generation for binops with large immediates.
 
+A few ARMv6T2 ops should be pattern matched: BFI, SBFX, and UBFX
+
 //===---------------------------------------------------------------------===//
 
 Crazy idea:  Consider code that uses lots of 8-bit or 16-bit values.  By the
diff --git a/libclamav/c++/llvm/lib/Target/ARM/Thumb1RegisterInfo.cpp b/libclamav/c++/llvm/lib/Target/ARM/Thumb1RegisterInfo.cpp
index d6630ce..163d1e9 100644
--- a/libclamav/c++/llvm/lib/Target/ARM/Thumb1RegisterInfo.cpp
+++ b/libclamav/c++/llvm/lib/Target/ARM/Thumb1RegisterInfo.cpp
@@ -450,9 +450,9 @@ Thumb1RegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II,
     Offset -= AFI->getGPRCalleeSavedArea1Offset();
   else if (AFI->isGPRCalleeSavedArea2Frame(FrameIndex))
     Offset -= AFI->getGPRCalleeSavedArea2Offset();
-  else if (hasFP(MF)) {
-    assert(SPAdj == 0 && "Unexpected");
-    // There is alloca()'s in this function, must reference off the frame
+  else if (MF.getFrameInfo()->hasVarSizedObjects()) {
+    assert(SPAdj == 0 && hasFP(MF) && "Unexpected");
+    // There are alloca()'s in this function, must reference off the frame
     // pointer instead.
     FrameReg = getFrameRegister(MF);
     Offset -= AFI->getFramePtrSpillOffset();
@@ -778,9 +778,19 @@ static bool isCalleeSavedRegister(unsigned Reg, const unsigned *CSRegs) {
 }
 
 static bool isCSRestore(MachineInstr *MI, const unsigned *CSRegs) {
-  return (MI->getOpcode() == ARM::tRestore &&
-          MI->getOperand(1).isFI() &&
-          isCalleeSavedRegister(MI->getOperand(0).getReg(), CSRegs));
+  if (MI->getOpcode() == ARM::tRestore &&
+      MI->getOperand(1).isFI() &&
+      isCalleeSavedRegister(MI->getOperand(0).getReg(), CSRegs))
+    return true;
+  else if (MI->getOpcode() == ARM::tPOP) {
+    // The first three operands are predicates and such. The last two are
+    // imp-def and imp-use of SP. Check everything in between.
+    for (int i = 3, e = MI->getNumOperands() - 2; i != e; ++i)
+      if (!isCalleeSavedRegister(MI->getOperand(i).getReg(), CSRegs))
+        return false;
+    return true;
+  }
+  return false;
 }
 
 void Thumb1RegisterInfo::emitEpilogue(MachineFunction &MF,
@@ -794,13 +804,13 @@ void Thumb1RegisterInfo::emitEpilogue(MachineFunction &MF,
   ARMFunctionInfo *AFI = MF.getInfo<ARMFunctionInfo>();
   unsigned VARegSaveSize = AFI->getVarArgsRegSaveSize();
   int NumBytes = (int)MFI->getStackSize();
+  const unsigned *CSRegs = getCalleeSavedRegs();
 
   if (!AFI->hasStackFrame()) {
     if (NumBytes != 0)
       emitSPUpdate(MBB, MBBI, TII, dl, *this, NumBytes);
   } else {
     // Unwind MBBI to point to first LDR / VLDRD.
-    const unsigned *CSRegs = getCalleeSavedRegs();
     if (MBBI != MBB.begin()) {
       do
         --MBBI;
@@ -836,6 +846,9 @@ void Thumb1RegisterInfo::emitEpilogue(MachineFunction &MF,
   }
 
   if (VARegSaveSize) {
+    // Move back past the callee-saved register restoration
+    while (MBBI != MBB.end() && isCSRestore(MBBI, CSRegs))
+      ++MBBI;
     // Epilogue for vararg functions: pop LR to R3 and branch off it.
     AddDefaultPred(BuildMI(MBB, MBBI, dl, TII.get(ARM::tPOP)))
       .addReg(0) // No write back.
@@ -845,6 +858,7 @@ void Thumb1RegisterInfo::emitEpilogue(MachineFunction &MF,
 
     BuildMI(MBB, MBBI, dl, TII.get(ARM::tBX_RET_vararg))
       .addReg(ARM::R3, RegState::Kill);
+    // erase the old tBX_RET instruction
     MBB.erase(MBBI);
   }
 }
diff --git a/libclamav/c++/llvm/lib/Target/MSP430/AsmPrinter/Makefile b/libclamav/c++/llvm/lib/Target/MSP430/AsmPrinter/Makefile
deleted file mode 100644
index e69de29..0000000
diff --git a/libclamav/c++/llvm/lib/Target/PIC16/AsmPrinter/Makefile b/libclamav/c++/llvm/lib/Target/PIC16/AsmPrinter/Makefile
deleted file mode 100644
index e69de29..0000000
diff --git a/libclamav/c++/llvm/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp b/libclamav/c++/llvm/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp
index afc90b1..ac901d0 100644
--- a/libclamav/c++/llvm/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp
+++ b/libclamav/c++/llvm/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp
@@ -31,13 +31,13 @@
 #include "llvm/CodeGen/MachineInstr.h"
 #include "llvm/CodeGen/MachineInstrBuilder.h"
 #include "llvm/CodeGen/MachineModuleInfoImpls.h"
+#include "llvm/CodeGen/TargetLoweringObjectFileImpl.h"
 #include "llvm/MC/MCAsmInfo.h"
 #include "llvm/MC/MCContext.h"
 #include "llvm/MC/MCSectionMachO.h"
 #include "llvm/MC/MCStreamer.h"
 #include "llvm/MC/MCSymbol.h"
 #include "llvm/Target/Mangler.h"
-#include "llvm/Target/TargetLoweringObjectFile.h"
 #include "llvm/Target/TargetRegisterInfo.h"
 #include "llvm/Target/TargetInstrInfo.h"
 #include "llvm/Target/TargetOptions.h"
diff --git a/libclamav/c++/llvm/lib/Target/PowerPC/PPCCallingConv.td b/libclamav/c++/llvm/lib/Target/PowerPC/PPCCallingConv.td
index c7ce171..155fba2 100644
--- a/libclamav/c++/llvm/lib/Target/PowerPC/PPCCallingConv.td
+++ b/libclamav/c++/llvm/lib/Target/PowerPC/PPCCallingConv.td
@@ -66,28 +66,13 @@ def CC_PPC : CallingConv<[
 // PowerPC System V Release 4 ABI
 //===----------------------------------------------------------------------===//
 
-// _Complex arguments are never split, thus their two scalars are either
-// passed both in argument registers or both on the stack. Also _Complex
-// arguments are always passed in general purpose registers, never in
-// Floating-point registers or vector registers. Arguments which should go
-// on the stack are marked with the inreg parameter attribute.
-// Giving inreg this target-dependent (and counter-intuitive) meaning
-// simplifies things, because functions calls are not always coming from the
-// frontend but are also created implicitly e.g. for libcalls. If inreg would
-// actually mean that the argument is passed in a register, then all places
-// which create function calls/function definitions implicitly would need to
-// be aware of this fact and would need to mark arguments accordingly. With
-// inreg meaning that the argument is passed on the stack, this is not an
-// issue, except for calls which involve _Complex types.
-
 def CC_PPC_SVR4_Common : CallingConv<[
   // The ABI requires i64 to be passed in two adjacent registers with the first
   // register having an odd register number.
   CCIfType<[i32], CCIfSplit<CCCustom<"CC_PPC_SVR4_Custom_AlignArgRegs">>>,
 
   // The first 8 integer arguments are passed in integer registers.
-  CCIfType<[i32], CCIf<"!ArgFlags.isInReg()",
-    CCAssignToReg<[R3, R4, R5, R6, R7, R8, R9, R10]>>>,
+  CCIfType<[i32], CCAssignToReg<[R3, R4, R5, R6, R7, R8, R9, R10]>>,
 
   // Make sure the i64 words from a long double are either both passed in
   // registers or both passed on the stack.
diff --git a/libclamav/c++/llvm/lib/Target/PowerPC/PPCHazardRecognizers.cpp b/libclamav/c++/llvm/lib/Target/PowerPC/PPCHazardRecognizers.cpp
index 3a15f7e..66dfd4b 100644
--- a/libclamav/c++/llvm/lib/Target/PowerPC/PPCHazardRecognizers.cpp
+++ b/libclamav/c++/llvm/lib/Target/PowerPC/PPCHazardRecognizers.cpp
@@ -257,7 +257,7 @@ void PPCHazardRecognizer970::EmitInstruction(SUnit *SU) {
     case PPC::STWX:   case PPC::STWX8:
     case PPC::STWUX:
     case PPC::STW:    case PPC::STW8:
-    case PPC::STWU:   case PPC::STWU8:
+    case PPC::STWU:
     case PPC::STVEWX:
     case PPC::STFIWX:
     case PPC::STWBRX:
diff --git a/libclamav/c++/llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp b/libclamav/c++/llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp
index 004997f..9d79c0d 100644
--- a/libclamav/c++/llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp
+++ b/libclamav/c++/llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp
@@ -156,10 +156,6 @@ namespace {
     SDValue BuildSDIVSequence(SDNode *N);
     SDValue BuildUDIVSequence(SDNode *N);
     
-    /// InstructionSelect - This callback is invoked by
-    /// SelectionDAGISel when it has created a SelectionDAG for us to codegen.
-    virtual void InstructionSelect();
-    
     void InsertVRSaveCode(MachineFunction &MF);
 
     virtual const char *getPassName() const {
@@ -184,14 +180,6 @@ private:
   };
 }
 
-/// InstructionSelect - This callback is invoked by
-/// SelectionDAGISel when it has created a SelectionDAG for us to codegen.
-void PPCDAGToDAGISel::InstructionSelect() {
-  // Select target instructions for the DAG.
-  SelectRoot(*CurDAG);
-  CurDAG->RemoveDeadNodes();
-}
-
 /// InsertVRSaveCode - Once the entire function has been instruction selected,
 /// all virtual registers are created and all machine instructions are built,
 /// check to see if we need to save/restore VRSAVE.  If so, do it.
diff --git a/libclamav/c++/llvm/lib/Target/PowerPC/PPCISelLowering.cpp b/libclamav/c++/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
index a11d624..3d81afa 100644
--- a/libclamav/c++/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
+++ b/libclamav/c++/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
@@ -25,13 +25,13 @@
 #include "llvm/CodeGen/MachineRegisterInfo.h"
 #include "llvm/CodeGen/PseudoSourceValue.h"
 #include "llvm/CodeGen/SelectionDAG.h"
+#include "llvm/CodeGen/TargetLoweringObjectFileImpl.h"
 #include "llvm/CallingConv.h"
 #include "llvm/Constants.h"
 #include "llvm/Function.h"
 #include "llvm/Intrinsics.h"
 #include "llvm/Support/MathExtras.h"
 #include "llvm/Target/TargetOptions.h"
-#include "llvm/Target/TargetLoweringObjectFile.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/raw_ostream.h"
@@ -1243,7 +1243,8 @@ SDValue PPCTargetLowering::LowerGlobalAddress(SDValue Op,
 
   // If the global is weak or external, we have to go through the lazy
   // resolution stub.
-  return DAG.getLoad(PtrVT, dl, DAG.getEntryNode(), Lo, NULL, 0);
+  return DAG.getLoad(PtrVT, dl, DAG.getEntryNode(), Lo, NULL, 0,
+                     false, false, 0);
 }
 
 SDValue PPCTargetLowering::LowerSETCC(SDValue Op, SelectionDAG &DAG) {
@@ -1333,7 +1334,7 @@ SDValue PPCTargetLowering::LowerTRAMPOLINE(SDValue Op, SelectionDAG &DAG) {
                 false, false, false, false, 0, CallingConv::C, false,
                 /*isReturnValueUsed=*/true,
                 DAG.getExternalSymbol("__trampoline_setup", PtrVT),
-                Args, DAG, dl, DAG.GetOrdering(Chain.getNode()));
+                Args, DAG, dl);
 
   SDValue Ops[] =
     { CallResult.first, CallResult.second };
@@ -1355,7 +1356,8 @@ SDValue PPCTargetLowering::LowerVASTART(SDValue Op, SelectionDAG &DAG,
     EVT PtrVT = DAG.getTargetLoweringInfo().getPointerTy();
     SDValue FR = DAG.getFrameIndex(VarArgsFrameIndex, PtrVT);
     const Value *SV = cast<SrcValueSDNode>(Op.getOperand(2))->getValue();
-    return DAG.getStore(Op.getOperand(0), dl, FR, Op.getOperand(1), SV, 0);
+    return DAG.getStore(Op.getOperand(0), dl, FR, Op.getOperand(1), SV, 0,
+                        false, false, 0);
   }
 
   // For the 32-bit SVR4 ABI we follow the layout of the va_list struct.
@@ -1405,25 +1407,29 @@ SDValue PPCTargetLowering::LowerVASTART(SDValue Op, SelectionDAG &DAG,
 
   // Store first byte : number of int regs
   SDValue firstStore = DAG.getTruncStore(Op.getOperand(0), dl, ArgGPR,
-                                         Op.getOperand(1), SV, 0, MVT::i8);
+                                         Op.getOperand(1), SV, 0, MVT::i8,
+                                         false, false, 0);
   uint64_t nextOffset = FPROffset;
   SDValue nextPtr = DAG.getNode(ISD::ADD, dl, PtrVT, Op.getOperand(1),
                                   ConstFPROffset);
 
   // Store second byte : number of float regs
   SDValue secondStore =
-    DAG.getTruncStore(firstStore, dl, ArgFPR, nextPtr, SV, nextOffset, MVT::i8);
+    DAG.getTruncStore(firstStore, dl, ArgFPR, nextPtr, SV, nextOffset, MVT::i8,
+                      false, false, 0);
   nextOffset += StackOffset;
   nextPtr = DAG.getNode(ISD::ADD, dl, PtrVT, nextPtr, ConstStackOffset);
 
   // Store second word : arguments given on stack
   SDValue thirdStore =
-    DAG.getStore(secondStore, dl, StackOffsetFI, nextPtr, SV, nextOffset);
+    DAG.getStore(secondStore, dl, StackOffsetFI, nextPtr, SV, nextOffset,
+                 false, false, 0);
   nextOffset += FrameOffset;
   nextPtr = DAG.getNode(ISD::ADD, dl, PtrVT, nextPtr, ConstFrameOffset);
 
   // Store third word : arguments given in registers
-  return DAG.getStore(thirdStore, dl, FR, nextPtr, SV, nextOffset);
+  return DAG.getStore(thirdStore, dl, FR, nextPtr, SV, nextOffset,
+                      false, false, 0);
 
 }
 
@@ -1628,7 +1634,8 @@ PPCTargetLowering::LowerFormalArguments_SVR4(
 
       // Create load nodes to retrieve arguments from the stack.
       SDValue FIN = DAG.getFrameIndex(FI, PtrVT);
-      InVals.push_back(DAG.getLoad(VA.getValVT(), dl, Chain, FIN, NULL, 0));
+      InVals.push_back(DAG.getLoad(VA.getValVT(), dl, Chain, FIN, NULL, 0,
+                                   false, false, 0));
     }
   }
 
@@ -1700,7 +1707,8 @@ PPCTargetLowering::LowerFormalArguments_SVR4(
     unsigned GPRIndex = 0;
     for (; GPRIndex != VarArgsNumGPR; ++GPRIndex) {
       SDValue Val = DAG.getRegister(GPArgRegs[GPRIndex], PtrVT);
-      SDValue Store = DAG.getStore(Chain, dl, Val, FIN, NULL, 0);
+      SDValue Store = DAG.getStore(Chain, dl, Val, FIN, NULL, 0,
+                                   false, false, 0);
       MemOps.push_back(Store);
       // Increment the address by four for the next argument to store
       SDValue PtrOff = DAG.getConstant(PtrVT.getSizeInBits()/8, PtrVT);
@@ -1714,7 +1722,8 @@ PPCTargetLowering::LowerFormalArguments_SVR4(
       unsigned VReg = MF.addLiveIn(GPArgRegs[GPRIndex], &PPC::GPRCRegClass);
 
       SDValue Val = DAG.getCopyFromReg(Chain, dl, VReg, PtrVT);
-      SDValue Store = DAG.getStore(Val.getValue(1), dl, Val, FIN, NULL, 0);
+      SDValue Store = DAG.getStore(Val.getValue(1), dl, Val, FIN, NULL, 0,
+                                   false, false, 0);
       MemOps.push_back(Store);
       // Increment the address by four for the next argument to store
       SDValue PtrOff = DAG.getConstant(PtrVT.getSizeInBits()/8, PtrVT);
@@ -1729,7 +1738,8 @@ PPCTargetLowering::LowerFormalArguments_SVR4(
     unsigned FPRIndex = 0;
     for (FPRIndex = 0; FPRIndex != VarArgsNumFPR; ++FPRIndex) {
       SDValue Val = DAG.getRegister(FPArgRegs[FPRIndex], MVT::f64);
-      SDValue Store = DAG.getStore(Chain, dl, Val, FIN, NULL, 0);
+      SDValue Store = DAG.getStore(Chain, dl, Val, FIN, NULL, 0,
+                                   false, false, 0);
       MemOps.push_back(Store);
       // Increment the address by eight for the next argument to store
       SDValue PtrOff = DAG.getConstant(EVT(MVT::f64).getSizeInBits()/8,
@@ -1741,7 +1751,8 @@ PPCTargetLowering::LowerFormalArguments_SVR4(
       unsigned VReg = MF.addLiveIn(FPArgRegs[FPRIndex], &PPC::F8RCRegClass);
 
       SDValue Val = DAG.getCopyFromReg(Chain, dl, VReg, MVT::f64);
-      SDValue Store = DAG.getStore(Val.getValue(1), dl, Val, FIN, NULL, 0);
+      SDValue Store = DAG.getStore(Val.getValue(1), dl, Val, FIN, NULL, 0,
+                                   false, false, 0);
       MemOps.push_back(Store);
       // Increment the address by eight for the next argument to store
       SDValue PtrOff = DAG.getConstant(EVT(MVT::f64).getSizeInBits()/8,
@@ -1903,7 +1914,9 @@ PPCTargetLowering::LowerFormalArguments_Darwin(
           unsigned VReg = MF.addLiveIn(GPR[GPR_idx], &PPC::GPRCRegClass);
           SDValue Val = DAG.getCopyFromReg(Chain, dl, VReg, PtrVT);
           SDValue Store = DAG.getTruncStore(Val.getValue(1), dl, Val, FIN,
-                               NULL, 0, ObjSize==1 ? MVT::i8 : MVT::i16 );
+                                            NULL, 0,
+                                            ObjSize==1 ? MVT::i8 : MVT::i16,
+                                            false, false, 0);
           MemOps.push_back(Store);
           ++GPR_idx;
         }
@@ -1921,7 +1934,8 @@ PPCTargetLowering::LowerFormalArguments_Darwin(
           int FI = MFI->CreateFixedObject(PtrByteSize, ArgOffset, true, false);
           SDValue FIN = DAG.getFrameIndex(FI, PtrVT);
           SDValue Val = DAG.getCopyFromReg(Chain, dl, VReg, PtrVT);
-          SDValue Store = DAG.getStore(Val.getValue(1), dl, Val, FIN, NULL, 0);
+          SDValue Store = DAG.getStore(Val.getValue(1), dl, Val, FIN, NULL, 0,
+                                       false, false, 0);
           MemOps.push_back(Store);
           ++GPR_idx;
           ArgOffset += PtrByteSize;
@@ -2045,7 +2059,8 @@ PPCTargetLowering::LowerFormalArguments_Darwin(
                                       CurArgOffset + (ArgSize - ObjSize),
                                       isImmutable, false);
       SDValue FIN = DAG.getFrameIndex(FI, PtrVT);
-      ArgVal = DAG.getLoad(ObjectVT, dl, Chain, FIN, NULL, 0);
+      ArgVal = DAG.getLoad(ObjectVT, dl, Chain, FIN, NULL, 0,
+                           false, false, 0);
     }
 
     InVals.push_back(ArgVal);
@@ -2091,7 +2106,8 @@ PPCTargetLowering::LowerFormalArguments_Darwin(
         VReg = MF.addLiveIn(GPR[GPR_idx], &PPC::GPRCRegClass);
 
       SDValue Val = DAG.getCopyFromReg(Chain, dl, VReg, PtrVT);
-      SDValue Store = DAG.getStore(Val.getValue(1), dl, Val, FIN, NULL, 0);
+      SDValue Store = DAG.getStore(Val.getValue(1), dl, Val, FIN, NULL, 0,
+                                   false, false, 0);
       MemOps.push_back(Store);
       // Increment the address by four for the next argument to store
       SDValue PtrOff = DAG.getConstant(PtrVT.getSizeInBits()/8, PtrVT);
@@ -2271,7 +2287,7 @@ StoreTailCallArgumentsToStackSlot(SelectionDAG &DAG,
     // Store relative to framepointer.
     MemOpChains.push_back(DAG.getStore(Chain, dl, Arg, FIN,
                                        PseudoSourceValue::getFixedStack(FI),
-                                       0));
+                                       0, false, false, 0));
   }
 }
 
@@ -2297,7 +2313,8 @@ static SDValue EmitTailCallStoreFPAndRetAddr(SelectionDAG &DAG,
     EVT VT = isPPC64 ? MVT::i64 : MVT::i32;
     SDValue NewRetAddrFrIdx = DAG.getFrameIndex(NewRetAddr, VT);
     Chain = DAG.getStore(Chain, dl, OldRetAddr, NewRetAddrFrIdx,
-                         PseudoSourceValue::getFixedStack(NewRetAddr), 0);
+                         PseudoSourceValue::getFixedStack(NewRetAddr), 0,
+                         false, false, 0);
 
     // When using the 32/64-bit SVR4 ABI there is no need to move the FP stack
     // slot as the FP is never overwritten.
@@ -2308,7 +2325,8 @@ static SDValue EmitTailCallStoreFPAndRetAddr(SelectionDAG &DAG,
                                                           true, false);
       SDValue NewFramePtrIdx = DAG.getFrameIndex(NewFPIdx, VT);
       Chain = DAG.getStore(Chain, dl, OldFP, NewFramePtrIdx,
-                           PseudoSourceValue::getFixedStack(NewFPIdx), 0);
+                           PseudoSourceValue::getFixedStack(NewFPIdx), 0,
+                           false, false, 0);
     }
   }
   return Chain;
@@ -2346,14 +2364,16 @@ SDValue PPCTargetLowering::EmitTailCallLoadFPAndRetAddr(SelectionDAG & DAG,
     // Load the LR and FP stack slot for later adjusting.
     EVT VT = PPCSubTarget.isPPC64() ? MVT::i64 : MVT::i32;
     LROpOut = getReturnAddrFrameIndex(DAG);
-    LROpOut = DAG.getLoad(VT, dl, Chain, LROpOut, NULL, 0);
+    LROpOut = DAG.getLoad(VT, dl, Chain, LROpOut, NULL, 0,
+                          false, false, 0);
     Chain = SDValue(LROpOut.getNode(), 1);
     
     // When using the 32/64-bit SVR4 ABI there is no need to load the FP stack
     // slot as the FP is never overwritten.
     if (isDarwinABI) {
       FPOpOut = getFramePointerFrameIndex(DAG);
-      FPOpOut = DAG.getLoad(VT, dl, Chain, FPOpOut, NULL, 0);
+      FPOpOut = DAG.getLoad(VT, dl, Chain, FPOpOut, NULL, 0,
+                            false, false, 0);
       Chain = SDValue(FPOpOut.getNode(), 1);
     }
   }
@@ -2395,7 +2415,8 @@ LowerMemOpCallTo(SelectionDAG &DAG, MachineFunction &MF, SDValue Chain,
       PtrOff = DAG.getNode(ISD::ADD, dl, PtrVT, StackPtr,
                            DAG.getConstant(ArgOffset, PtrVT));
     }
-    MemOpChains.push_back(DAG.getStore(Chain, dl, Arg, PtrOff, NULL, 0));
+    MemOpChains.push_back(DAG.getStore(Chain, dl, Arg, PtrOff, NULL, 0,
+                                       false, false, 0));
   // Calculate and remember argument location.
   } else CalculateTailCallArgDest(DAG, MF, isPPC64, Arg, SPDiff, ArgOffset,
                                   TailCallArguments);
@@ -2862,7 +2883,8 @@ PPCTargetLowering::LowerCall_SVR4(SDValue Chain, SDValue Callee,
         PtrOff = DAG.getNode(ISD::ADD, dl, getPointerTy(), StackPtr, PtrOff);
 
         MemOpChains.push_back(DAG.getStore(Chain, dl, Arg, PtrOff,
-                              PseudoSourceValue::getStack(), LocMemOffset));
+                                           PseudoSourceValue::getStack(), LocMemOffset,
+                                           false, false, 0));
       } else {
         // Calculate and remember argument location.
         CalculateTailCallArgDest(DAG, MF, false, Arg, SPDiff, LocMemOffset,
@@ -3024,7 +3046,7 @@ PPCTargetLowering::LowerCall_Darwin(SDValue Chain, SDValue Callee,
         EVT VT = (Size==1) ? MVT::i8 : MVT::i16;
         if (GPR_idx != NumGPRs) {
           SDValue Load = DAG.getExtLoad(ISD::EXTLOAD, dl, PtrVT, Chain, Arg,
-                                          NULL, 0, VT);
+                                        NULL, 0, VT, false, false, 0);
           MemOpChains.push_back(Load.getValue(1));
           RegsToPass.push_back(std::make_pair(GPR[GPR_idx++], Load));
 
@@ -3061,7 +3083,8 @@ PPCTargetLowering::LowerCall_Darwin(SDValue Chain, SDValue Callee,
         SDValue Const = DAG.getConstant(j, PtrOff.getValueType());
         SDValue AddArg = DAG.getNode(ISD::ADD, dl, PtrVT, Arg, Const);
         if (GPR_idx != NumGPRs) {
-          SDValue Load = DAG.getLoad(PtrVT, dl, Chain, AddArg, NULL, 0);
+          SDValue Load = DAG.getLoad(PtrVT, dl, Chain, AddArg, NULL, 0,
+                                     false, false, 0);
           MemOpChains.push_back(Load.getValue(1));
           RegsToPass.push_back(std::make_pair(GPR[GPR_idx++], Load));
           ArgOffset += PtrByteSize;
@@ -3092,19 +3115,22 @@ PPCTargetLowering::LowerCall_Darwin(SDValue Chain, SDValue Callee,
         RegsToPass.push_back(std::make_pair(FPR[FPR_idx++], Arg));
 
         if (isVarArg) {
-          SDValue Store = DAG.getStore(Chain, dl, Arg, PtrOff, NULL, 0);
+          SDValue Store = DAG.getStore(Chain, dl, Arg, PtrOff, NULL, 0,
+                                       false, false, 0);
           MemOpChains.push_back(Store);
 
           // Float varargs are always shadowed in available integer registers
           if (GPR_idx != NumGPRs) {
-            SDValue Load = DAG.getLoad(PtrVT, dl, Store, PtrOff, NULL, 0);
+            SDValue Load = DAG.getLoad(PtrVT, dl, Store, PtrOff, NULL, 0,
+                                       false, false, 0);
             MemOpChains.push_back(Load.getValue(1));
             RegsToPass.push_back(std::make_pair(GPR[GPR_idx++], Load));
           }
           if (GPR_idx != NumGPRs && Arg.getValueType() == MVT::f64 && !isPPC64){
             SDValue ConstFour = DAG.getConstant(4, PtrOff.getValueType());
             PtrOff = DAG.getNode(ISD::ADD, dl, PtrVT, PtrOff, ConstFour);
-            SDValue Load = DAG.getLoad(PtrVT, dl, Store, PtrOff, NULL, 0);
+            SDValue Load = DAG.getLoad(PtrVT, dl, Store, PtrOff, NULL, 0,
+                                       false, false, 0);
             MemOpChains.push_back(Load.getValue(1));
             RegsToPass.push_back(std::make_pair(GPR[GPR_idx++], Load));
           }
@@ -3147,10 +3173,12 @@ PPCTargetLowering::LowerCall_Darwin(SDValue Chain, SDValue Callee,
         // entirely in R registers.  Maybe later.
         PtrOff = DAG.getNode(ISD::ADD, dl, PtrVT, StackPtr,
                             DAG.getConstant(ArgOffset, PtrVT));
-        SDValue Store = DAG.getStore(Chain, dl, Arg, PtrOff, NULL, 0);
+        SDValue Store = DAG.getStore(Chain, dl, Arg, PtrOff, NULL, 0,
+                                     false, false, 0);
         MemOpChains.push_back(Store);
         if (VR_idx != NumVRs) {
-          SDValue Load = DAG.getLoad(MVT::v4f32, dl, Store, PtrOff, NULL, 0);
+          SDValue Load = DAG.getLoad(MVT::v4f32, dl, Store, PtrOff, NULL, 0,
+                                     false, false, 0);
           MemOpChains.push_back(Load.getValue(1));
           RegsToPass.push_back(std::make_pair(VR[VR_idx++], Load));
         }
@@ -3160,7 +3188,8 @@ PPCTargetLowering::LowerCall_Darwin(SDValue Chain, SDValue Callee,
             break;
           SDValue Ix = DAG.getNode(ISD::ADD, dl, PtrVT, PtrOff,
                                   DAG.getConstant(i, PtrVT));
-          SDValue Load = DAG.getLoad(PtrVT, dl, Store, Ix, NULL, 0);
+          SDValue Load = DAG.getLoad(PtrVT, dl, Store, Ix, NULL, 0,
+                                     false, false, 0);
           MemOpChains.push_back(Load.getValue(1));
           RegsToPass.push_back(std::make_pair(GPR[GPR_idx++], Load));
         }
@@ -3225,7 +3254,8 @@ PPCTargetLowering::LowerCall_Darwin(SDValue Chain, SDValue Callee,
     // TOC save area offset.
     SDValue PtrOff = DAG.getIntPtrConstant(40);
     SDValue AddPtr = DAG.getNode(ISD::ADD, dl, PtrVT, StackPtr, PtrOff);
-    Chain = DAG.getStore(Val.getValue(1), dl, Val, AddPtr, NULL, 0);
+    Chain = DAG.getStore(Val.getValue(1), dl, Val, AddPtr, NULL, 0,
+                         false, false, 0);
   }
 
   // Build a sequence of copy-to-reg nodes chained together with token chain
@@ -3300,13 +3330,15 @@ SDValue PPCTargetLowering::LowerSTACKRESTORE(SDValue Op, SelectionDAG &DAG,
   SDValue SaveSP = Op.getOperand(1);
 
   // Load the old link SP.
-  SDValue LoadLinkSP = DAG.getLoad(PtrVT, dl, Chain, StackPtr, NULL, 0);
+  SDValue LoadLinkSP = DAG.getLoad(PtrVT, dl, Chain, StackPtr, NULL, 0,
+                                   false, false, 0);
 
   // Restore the stack pointer.
   Chain = DAG.getCopyToReg(LoadLinkSP.getValue(1), dl, SP, SaveSP);
 
   // Store the old link SP.
-  return DAG.getStore(Chain, dl, LoadLinkSP, StackPtr, NULL, 0);
+  return DAG.getStore(Chain, dl, LoadLinkSP, StackPtr, NULL, 0,
+                      false, false, 0);
 }
 
 
@@ -3483,14 +3515,16 @@ SDValue PPCTargetLowering::LowerFP_TO_INT(SDValue Op, SelectionDAG &DAG,
   SDValue FIPtr = DAG.CreateStackTemporary(MVT::f64);
 
   // Emit a store to the stack slot.
-  SDValue Chain = DAG.getStore(DAG.getEntryNode(), dl, Tmp, FIPtr, NULL, 0);
+  SDValue Chain = DAG.getStore(DAG.getEntryNode(), dl, Tmp, FIPtr, NULL, 0,
+                               false, false, 0);
 
   // Result is a load from the stack slot.  If loading 4 bytes, make sure to
   // add in a bias.
   if (Op.getValueType() == MVT::i32)
     FIPtr = DAG.getNode(ISD::ADD, dl, FIPtr.getValueType(), FIPtr,
                         DAG.getConstant(4, FIPtr.getValueType()));
-  return DAG.getLoad(Op.getValueType(), dl, Chain, FIPtr, NULL, 0);
+  return DAG.getLoad(Op.getValueType(), dl, Chain, FIPtr, NULL, 0,
+                     false, false, 0);
 }
 
 SDValue PPCTargetLowering::LowerSINT_TO_FP(SDValue Op, SelectionDAG &DAG) {
@@ -3533,7 +3567,7 @@ SDValue PPCTargetLowering::LowerSINT_TO_FP(SDValue Op, SelectionDAG &DAG) {
     DAG.getMemIntrinsicNode(PPCISD::STD_32, dl, DAG.getVTList(MVT::Other),
                             Ops, 4, MVT::i64, MMO);
   // Load the value as a double.
-  SDValue Ld = DAG.getLoad(MVT::f64, dl, Store, FIdx, NULL, 0);
+  SDValue Ld = DAG.getLoad(MVT::f64, dl, Store, FIdx, NULL, 0, false, false, 0);
 
   // FCFID it and return it.
   SDValue FP = DAG.getNode(PPCISD::FCFID, dl, MVT::f64, Ld);
@@ -3578,12 +3612,13 @@ SDValue PPCTargetLowering::LowerFLT_ROUNDS_(SDValue Op, SelectionDAG &DAG) {
   int SSFI = MF.getFrameInfo()->CreateStackObject(8, 8, false);
   SDValue StackSlot = DAG.getFrameIndex(SSFI, PtrVT);
   SDValue Store = DAG.getStore(DAG.getEntryNode(), dl, Chain,
-                                 StackSlot, NULL, 0);
+                               StackSlot, NULL, 0, false, false, 0);
 
   // Load FP Control Word from low 32 bits of stack slot.
   SDValue Four = DAG.getConstant(4, PtrVT);
   SDValue Addr = DAG.getNode(ISD::ADD, dl, PtrVT, StackSlot, Four);
-  SDValue CWD = DAG.getLoad(MVT::i32, dl, Store, Addr, NULL, 0);
+  SDValue CWD = DAG.getLoad(MVT::i32, dl, Store, Addr, NULL, 0,
+                            false, false, 0);
 
   // Transform as necessary
   SDValue CWD1 =
@@ -4249,9 +4284,11 @@ SDValue PPCTargetLowering::LowerSCALAR_TO_VECTOR(SDValue Op,
 
   // Store the input value into Value#0 of the stack slot.
   SDValue Store = DAG.getStore(DAG.getEntryNode(), dl,
-                                 Op.getOperand(0), FIdx, NULL, 0);
+                               Op.getOperand(0), FIdx, NULL, 0,
+                               false, false, 0);
   // Load it out.
-  return DAG.getLoad(Op.getValueType(), dl, Store, FIdx, NULL, 0);
+  return DAG.getLoad(Op.getValueType(), dl, Store, FIdx, NULL, 0,
+                     false, false, 0);
 }
 
 SDValue PPCTargetLowering::LowerMUL(SDValue Op, SelectionDAG &DAG) {
@@ -5460,7 +5497,8 @@ SDValue PPCTargetLowering::LowerRETURNADDR(SDValue Op, SelectionDAG &DAG) {
   // to the stack.
   FuncInfo->setLRStoreRequired();
   return DAG.getLoad(getPointerTy(), dl,
-                     DAG.getEntryNode(), RetAddrFI, NULL, 0);
+                     DAG.getEntryNode(), RetAddrFI, NULL, 0,
+                     false, false, 0);
 }
 
 SDValue PPCTargetLowering::LowerFRAMEADDR(SDValue Op, SelectionDAG &DAG) {
diff --git a/libclamav/c++/llvm/lib/Target/PowerPC/PPCInstr64Bit.td b/libclamav/c++/llvm/lib/Target/PowerPC/PPCInstr64Bit.td
index 219efb9..a0781b9 100644
--- a/libclamav/c++/llvm/lib/Target/PowerPC/PPCInstr64Bit.td
+++ b/libclamav/c++/llvm/lib/Target/PowerPC/PPCInstr64Bit.td
@@ -366,7 +366,7 @@ def ADDE8   : XOForm_1<31, 138, 0, (outs G8RC:$rT), (ins G8RC:$rA, G8RC:$rB),
                        [(set G8RC:$rT, (adde G8RC:$rA, G8RC:$rB))]>;
 def ADDME8  : XOForm_3<31, 234, 0, (outs G8RC:$rT), (ins G8RC:$rA),
                        "addme $rT, $rA", IntGeneral,
-                       [(set G8RC:$rT, (adde G8RC:$rA, immAllOnes))]>;
+                       [(set G8RC:$rT, (adde G8RC:$rA, -1))]>;
 def ADDZE8  : XOForm_3<31, 202, 0, (outs G8RC:$rT), (ins G8RC:$rA),
                        "addze $rT, $rA", IntGeneral,
                        [(set G8RC:$rT, (adde G8RC:$rA, 0))]>;
@@ -375,7 +375,7 @@ def SUBFE8  : XOForm_1<31, 136, 0, (outs G8RC:$rT), (ins G8RC:$rA, G8RC:$rB),
                        [(set G8RC:$rT, (sube G8RC:$rB, G8RC:$rA))]>;
 def SUBFME8 : XOForm_3<31, 232, 0, (outs G8RC:$rT), (ins G8RC:$rA),
                        "subfme $rT, $rA", IntGeneral,
-                       [(set G8RC:$rT, (sube immAllOnes, G8RC:$rA))]>;
+                       [(set G8RC:$rT, (sube -1, G8RC:$rA))]>;
 def SUBFZE8 : XOForm_3<31, 200, 0, (outs G8RC:$rT), (ins G8RC:$rA),
                        "subfze $rT, $rA", IntGeneral,
                        [(set G8RC:$rT, (sube 0, G8RC:$rA))]>;
@@ -635,13 +635,6 @@ def STHU8 : DForm_1<45, (outs ptr_rc:$ea_res), (ins G8RC:$rS,
                         (pre_truncsti16 G8RC:$rS, ptr_rc:$ptrreg, 
                                         iaddroff:$ptroff))]>,
                     RegConstraint<"$ptrreg = $ea_res">, NoEncode<"$ea_res">;
-def STWU8 : DForm_1<37, (outs ptr_rc:$ea_res), (ins G8RC:$rS,
-                             symbolLo:$ptroff, ptr_rc:$ptrreg),
-                    "stwu $rS, $ptroff($ptrreg)", LdStGeneral,
-                    [(set ptr_rc:$ea_res, (pre_store G8RC:$rS, ptr_rc:$ptrreg, 
-                                                     iaddroff:$ptroff))]>,
-                    RegConstraint<"$ptrreg = $ea_res">, NoEncode<"$ea_res">;
-
 
 def STDU : DSForm_1<62, 1, (outs ptr_rc:$ea_res), (ins G8RC:$rS,
                                 s16immX4:$ptroff, ptr_rc:$ptrreg),
diff --git a/libclamav/c++/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp b/libclamav/c++/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp
index 3db623a..9895bea 100644
--- a/libclamav/c++/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp
+++ b/libclamav/c++/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp
@@ -19,6 +19,7 @@
 #include "PPCTargetMachine.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/CodeGen/MachineInstrBuilder.h"
+#include "llvm/CodeGen/MachineRegisterInfo.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/raw_ostream.h"
@@ -73,8 +74,7 @@ bool PPCInstrInfo::isMoveInstr(const MachineInstr& MI,
       destReg = MI.getOperand(0).getReg();
       return true;
     }
-  } else if (oc == PPC::FMRS || oc == PPC::FMRD ||
-             oc == PPC::FMRSD) {      // fmr r1, r2
+  } else if (oc == PPC::FMR || oc == PPC::FMRSD) { // fmr r1, r2
     assert(MI.getNumOperands() >= 2 &&
            MI.getOperand(0).isReg() &&
            MI.getOperand(1).isReg() &&
@@ -344,10 +344,9 @@ bool PPCInstrInfo::copyRegToReg(MachineBasicBlock &MBB,
     BuildMI(MBB, MI, DL, get(PPC::OR), DestReg).addReg(SrcReg).addReg(SrcReg);
   } else if (DestRC == PPC::G8RCRegisterClass) {
     BuildMI(MBB, MI, DL, get(PPC::OR8), DestReg).addReg(SrcReg).addReg(SrcReg);
-  } else if (DestRC == PPC::F4RCRegisterClass) {
-    BuildMI(MBB, MI, DL, get(PPC::FMRS), DestReg).addReg(SrcReg);
-  } else if (DestRC == PPC::F8RCRegisterClass) {
-    BuildMI(MBB, MI, DL, get(PPC::FMRD), DestReg).addReg(SrcReg);
+  } else if (DestRC == PPC::F4RCRegisterClass ||
+             DestRC == PPC::F8RCRegisterClass) {
+    BuildMI(MBB, MI, DL, get(PPC::FMR), DestReg).addReg(SrcReg);
   } else if (DestRC == PPC::CRRCRegisterClass) {
     BuildMI(MBB, MI, DL, get(PPC::MCRF), DestReg).addReg(SrcReg);
   } else if (DestRC == PPC::VRRCRegisterClass) {
@@ -688,33 +687,21 @@ MachineInstr *PPCInstrInfo::foldMemoryOperandImpl(MachineFunction &MF,
                                         getUndefRegState(isUndef)),
                                 FrameIndex);
     }
-  } else if (Opc == PPC::FMRD) {
-    if (OpNum == 0) {  // move -> store
-      unsigned InReg = MI->getOperand(1).getReg();
-      bool isKill = MI->getOperand(1).isKill();
-      bool isUndef = MI->getOperand(1).isUndef();
-      NewMI = addFrameReference(BuildMI(MF, MI->getDebugLoc(), get(PPC::STFD))
-                                .addReg(InReg,
-                                        getKillRegState(isKill) |
-                                        getUndefRegState(isUndef)),
-                                FrameIndex);
-    } else {           // move -> load
-      unsigned OutReg = MI->getOperand(0).getReg();
-      bool isDead = MI->getOperand(0).isDead();
-      bool isUndef = MI->getOperand(0).isUndef();
-      NewMI = addFrameReference(BuildMI(MF, MI->getDebugLoc(), get(PPC::LFD))
-                                .addReg(OutReg,
-                                        RegState::Define |
-                                        getDeadRegState(isDead) |
-                                        getUndefRegState(isUndef)),
-                                FrameIndex);
-    }
-  } else if (Opc == PPC::FMRS) {
+  } else if (Opc == PPC::FMR || Opc == PPC::FMRSD) {
+    // The register may be F4RC or F8RC, and that determines the memory op.
+    unsigned OrigReg = MI->getOperand(OpNum).getReg();
+    // We cannot tell the register class from a physreg alone.
+    if (TargetRegisterInfo::isPhysicalRegister(OrigReg))
+      return NULL;
+    const TargetRegisterClass *RC = MF.getRegInfo().getRegClass(OrigReg);
+    const bool is64 = RC == PPC::F8RCRegisterClass;
+
     if (OpNum == 0) {  // move -> store
       unsigned InReg = MI->getOperand(1).getReg();
       bool isKill = MI->getOperand(1).isKill();
       bool isUndef = MI->getOperand(1).isUndef();
-      NewMI = addFrameReference(BuildMI(MF, MI->getDebugLoc(), get(PPC::STFS))
+      NewMI = addFrameReference(BuildMI(MF, MI->getDebugLoc(),
+                                        get(is64 ? PPC::STFD : PPC::STFS))
                                 .addReg(InReg,
                                         getKillRegState(isKill) |
                                         getUndefRegState(isUndef)),
@@ -723,7 +710,8 @@ MachineInstr *PPCInstrInfo::foldMemoryOperandImpl(MachineFunction &MF,
       unsigned OutReg = MI->getOperand(0).getReg();
       bool isDead = MI->getOperand(0).isDead();
       bool isUndef = MI->getOperand(0).isUndef();
-      NewMI = addFrameReference(BuildMI(MF, MI->getDebugLoc(), get(PPC::LFS))
+      NewMI = addFrameReference(BuildMI(MF, MI->getDebugLoc(),
+                                        get(is64 ? PPC::LFD : PPC::LFS))
                                 .addReg(OutReg,
                                         RegState::Define |
                                         getDeadRegState(isDead) |
@@ -749,7 +737,7 @@ bool PPCInstrInfo::canFoldMemoryOperand(const MachineInstr *MI,
   else if ((Opc == PPC::OR8 &&
               MI->getOperand(1).getReg() == MI->getOperand(2).getReg()))
     return true;
-  else if (Opc == PPC::FMRD || Opc == PPC::FMRS)
+  else if (Opc == PPC::FMR || Opc == PPC::FMRSD)
     return true;
 
   return false;
diff --git a/libclamav/c++/llvm/lib/Target/PowerPC/PPCInstrInfo.td b/libclamav/c++/llvm/lib/Target/PowerPC/PPCInstrInfo.td
index 842f8ee..845cd8f 100644
--- a/libclamav/c++/llvm/lib/Target/PowerPC/PPCInstrInfo.td
+++ b/libclamav/c++/llvm/lib/Target/PowerPC/PPCInstrInfo.td
@@ -1019,20 +1019,16 @@ let Uses = [RM] in {
   }
 }
 
-/// FMR is split into 3 versions, one for 4/8 byte FP, and one for extending.
+/// FMR is split into 2 versions, one for 4/8 byte FP, and one for extending.
 ///
 /// Note that these are defined as pseudo-ops on the PPC970 because they are
 /// often coalesced away and we don't want the dispatch group builder to think
 /// that they will fill slots (which could cause the load of a LSU reject to
 /// sneak into a d-group with a store).
-def FMRS   : XForm_26<63, 72, (outs F4RC:$frD), (ins F4RC:$frB),
-                      "fmr $frD, $frB", FPGeneral,
-                      []>,  // (set F4RC:$frD, F4RC:$frB)
-                      PPC970_Unit_Pseudo;
-def FMRD   : XForm_26<63, 72, (outs F8RC:$frD), (ins F8RC:$frB),
-                      "fmr $frD, $frB", FPGeneral,
-                      []>,  // (set F8RC:$frD, F8RC:$frB)
-                      PPC970_Unit_Pseudo;
+def FMR   : XForm_26<63, 72, (outs F4RC:$frD), (ins F4RC:$frB),
+                     "fmr $frD, $frB", FPGeneral,
+                     []>,  // (set F4RC:$frD, F4RC:$frB)
+                     PPC970_Unit_Pseudo;
 def FMRSD  : XForm_26<63, 72, (outs F8RC:$frD), (ins F4RC:$frB),
                       "fmr $frD, $frB", FPGeneral,
                       [(set F8RC:$frD, (fextend F4RC:$frB))]>,
@@ -1215,7 +1211,7 @@ def ADDE  : XOForm_1<31, 138, 0, (outs GPRC:$rT), (ins GPRC:$rA, GPRC:$rB),
                       [(set GPRC:$rT, (adde GPRC:$rA, GPRC:$rB))]>;
 def ADDME  : XOForm_3<31, 234, 0, (outs GPRC:$rT), (ins GPRC:$rA),
                       "addme $rT, $rA", IntGeneral,
-                      [(set GPRC:$rT, (adde GPRC:$rA, immAllOnes))]>;
+                      [(set GPRC:$rT, (adde GPRC:$rA, -1))]>;
 def ADDZE  : XOForm_3<31, 202, 0, (outs GPRC:$rT), (ins GPRC:$rA),
                       "addze $rT, $rA", IntGeneral,
                       [(set GPRC:$rT, (adde GPRC:$rA, 0))]>;
@@ -1224,7 +1220,7 @@ def SUBFE : XOForm_1<31, 136, 0, (outs GPRC:$rT), (ins GPRC:$rA, GPRC:$rB),
                       [(set GPRC:$rT, (sube GPRC:$rB, GPRC:$rA))]>;
 def SUBFME : XOForm_3<31, 232, 0, (outs GPRC:$rT), (ins GPRC:$rA),
                       "subfme $rT, $rA", IntGeneral,
-                      [(set GPRC:$rT, (sube immAllOnes, GPRC:$rA))]>;
+                      [(set GPRC:$rT, (sube -1, GPRC:$rA))]>;
 def SUBFZE : XOForm_3<31, 200, 0, (outs GPRC:$rT), (ins GPRC:$rA),
                       "subfze $rT, $rA", IntGeneral,
                       [(set GPRC:$rT, (sube 0, GPRC:$rA))]>;
@@ -1480,11 +1476,11 @@ def : Pat<(extloadf32 xaddr:$src),
           (FMRSD (LFSX xaddr:$src))>;
 
 // Memory barriers
-def : Pat<(membarrier (i32 imm:$ll),
-                      (i32 imm:$ls),
-                      (i32 imm:$sl),
-                      (i32 imm:$ss),
-                      (i32 imm:$device)),
+def : Pat<(membarrier (i32 imm /*ll*/),
+                      (i32 imm /*ls*/),
+                      (i32 imm /*sl*/),
+                      (i32 imm /*ss*/),
+                      (i32 imm /*device*/)),
            (SYNC)>;
 
 include "PPCInstrAltivec.td"
diff --git a/libclamav/c++/llvm/lib/Target/PowerPC/PPCRegisterInfo.td b/libclamav/c++/llvm/lib/Target/PowerPC/PPCRegisterInfo.td
index 049e893..1cb7340 100644
--- a/libclamav/c++/llvm/lib/Target/PowerPC/PPCRegisterInfo.td
+++ b/libclamav/c++/llvm/lib/Target/PowerPC/PPCRegisterInfo.td
@@ -287,10 +287,8 @@ def GPRC : RegisterClass<"PPC", [i32], 32,
     GPRCClass::allocation_order_begin(const MachineFunction &MF) const {
       // 32-bit SVR4 ABI: r2 is reserved for the OS.
       // 64-bit SVR4 ABI: r2 is reserved for the TOC pointer.
-      if (!MF.getTarget().getSubtarget<PPCSubtarget>().isDarwin())
-        return begin()+1;
-
-      return begin();
+      // Darwin: R2 is reserved for CR save/restore sequence.
+      return begin()+1;
     }
     GPRCClass::iterator
     GPRCClass::allocation_order_end(const MachineFunction &MF) const {
@@ -325,10 +323,8 @@ def G8RC : RegisterClass<"PPC", [i64], 64,
     G8RCClass::iterator
     G8RCClass::allocation_order_begin(const MachineFunction &MF) const {
       // 64-bit SVR4 ABI: r2 is reserved for the TOC pointer.
-      if (!MF.getTarget().getSubtarget<PPCSubtarget>().isDarwin())
-        return begin()+1;
-
-      return begin();
+      // Darwin: r2 is reserved for CR save/restore sequence.
+      return begin()+1;
     }
     G8RCClass::iterator
     G8RCClass::allocation_order_end(const MachineFunction &MF) const {
diff --git a/libclamav/c++/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp b/libclamav/c++/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp
index 22eecd4..cac6962 100644
--- a/libclamav/c++/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp
+++ b/libclamav/c++/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp
@@ -115,32 +115,3 @@ bool PPCTargetMachine::addCodeEmitter(PassManagerBase &PM,
 
   return false;
 }
-
-/// getLSDAEncoding - Returns the LSDA pointer encoding. The choices are 4-byte,
-/// 8-byte, and target default. The CIE is hard-coded to indicate that the LSDA
-/// pointer in the FDE section is an "sdata4", and should be encoded as a 4-byte
-/// pointer by default. However, some systems may require a different size due
-/// to bugs or other conditions. We will default to a 4-byte encoding unless the
-/// system tells us otherwise.
-///
-/// The issue is when the CIE says their is an LSDA. That mandates that every
-/// FDE have an LSDA slot. But if the function does not need an LSDA. There
-/// needs to be some way to signify there is none. The LSDA is encoded as
-/// pc-rel. But you don't look for some magic value after adding the pc. You
-/// have to look for a zero before adding the pc. The problem is that the size
-/// of the zero to look for depends on the encoding. The unwinder bug in SL is
-/// that it always checks for a pointer-size zero. So on x86_64 it looks for 8
-/// bytes of zero. If you have an LSDA, it works fine since the 8-bytes are
-/// non-zero so it goes ahead and then reads the value based on the encoding.
-/// But if you use sdata4 and there is no LSDA, then the test for zero gives a
-/// false negative and the unwinder thinks there is an LSDA.
-///
-/// FIXME: This call-back isn't good! We should be using the correct encoding
-/// regardless of the system. However, there are some systems which have bugs
-/// that prevent this from occuring.
-DwarfLSDAEncoding::Encoding PPCTargetMachine::getLSDAEncoding() const {
-  if (Subtarget.isDarwin() && Subtarget.getDarwinVers() != 10)
-    return DwarfLSDAEncoding::Default;
-
-  return DwarfLSDAEncoding::EightByte;
-}
diff --git a/libclamav/c++/llvm/lib/Target/PowerPC/PPCTargetMachine.h b/libclamav/c++/llvm/lib/Target/PowerPC/PPCTargetMachine.h
index a654435..ac9ae2b 100644
--- a/libclamav/c++/llvm/lib/Target/PowerPC/PPCTargetMachine.h
+++ b/libclamav/c++/llvm/lib/Target/PowerPC/PPCTargetMachine.h
@@ -57,18 +57,6 @@ public:
     return InstrItins;
   }
 
-  /// getLSDAEncoding - Returns the LSDA pointer encoding. The choices are
-  /// 4-byte, 8-byte, and target default. The CIE is hard-coded to indicate that
-  /// the LSDA pointer in the FDE section is an "sdata4", and should be encoded
-  /// as a 4-byte pointer by default. However, some systems may require a
-  /// different size due to bugs or other conditions. We will default to a
-  /// 4-byte encoding unless the system tells us otherwise.
-  ///
-  /// FIXME: This call-back isn't good! We should be using the correct encoding
-  /// regardless of the system. However, there are some systems which have bugs
-  /// that prevent this from occuring.
-  virtual DwarfLSDAEncoding::Encoding getLSDAEncoding() const;
-
   // Pass Pipeline Configuration
   virtual bool addInstSelector(PassManagerBase &PM, CodeGenOpt::Level OptLevel);
   virtual bool addPreEmitPass(PassManagerBase &PM, CodeGenOpt::Level OptLevel);
diff --git a/libclamav/c++/llvm/lib/Target/PowerPC/README.txt b/libclamav/c++/llvm/lib/Target/PowerPC/README.txt
index e49bda0..3465779 100644
--- a/libclamav/c++/llvm/lib/Target/PowerPC/README.txt
+++ b/libclamav/c++/llvm/lib/Target/PowerPC/README.txt
@@ -889,7 +889,7 @@ entry:
 ; recognize a more elaborate tree than a simple SETxx.
 
 define double @test_FNEG_sel(double %A, double %B, double %C) {
-        %D = sub double -0.000000e+00, %A               ; <double> [#uses=1]
+        %D = fsub double -0.000000e+00, %A               ; <double> [#uses=1]
         %Cond = fcmp ugt double %D, -0.000000e+00               ; <i1> [#uses=1]
         %E = select i1 %Cond, double %B, double %C              ; <double> [#uses=1]
         ret double %E
diff --git a/libclamav/c++/llvm/lib/Target/TargetData.cpp b/libclamav/c++/llvm/lib/Target/TargetData.cpp
index 295b30f..9a16808 100644
--- a/libclamav/c++/llvm/lib/Target/TargetData.cpp
+++ b/libclamav/c++/llvm/lib/Target/TargetData.cpp
@@ -580,7 +580,7 @@ const IntegerType *TargetData::getIntPtrType(LLVMContext &C) const {
 uint64_t TargetData::getIndexedOffset(const Type *ptrTy, Value* const* Indices,
                                       unsigned NumIndices) const {
   const Type *Ty = ptrTy;
-  assert(isa<PointerType>(Ty) && "Illegal argument for getIndexedOffset()");
+  assert(Ty->isPointerTy() && "Illegal argument for getIndexedOffset()");
   uint64_t Result = 0;
 
   generic_gep_type_iterator<Value* const*>
diff --git a/libclamav/c++/llvm/lib/Target/TargetLoweringObjectFile.cpp b/libclamav/c++/llvm/lib/Target/TargetLoweringObjectFile.cpp
index a231ebc..82619c7 100644
--- a/libclamav/c++/llvm/lib/Target/TargetLoweringObjectFile.cpp
+++ b/libclamav/c++/llvm/lib/Target/TargetLoweringObjectFile.cpp
@@ -19,17 +19,15 @@
 #include "llvm/GlobalVariable.h"
 #include "llvm/MC/MCContext.h"
 #include "llvm/MC/MCExpr.h"
-#include "llvm/MC/MCSectionMachO.h"
-#include "llvm/MC/MCSectionELF.h"
 #include "llvm/MC/MCSymbol.h"
 #include "llvm/Target/Mangler.h"
 #include "llvm/Target/TargetData.h"
 #include "llvm/Target/TargetMachine.h"
 #include "llvm/Target/TargetOptions.h"
+#include "llvm/Support/Dwarf.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/ADT/SmallString.h"
-#include "llvm/ADT/StringExtras.h"
 using namespace llvm;
 
 //===----------------------------------------------------------------------===//
@@ -289,832 +287,54 @@ TargetLoweringObjectFile::getSectionForConstant(SectionKind Kind) const {
 }
 
 /// getSymbolForDwarfGlobalReference - Return an MCExpr to use for a
-/// pc-relative reference to the specified global variable from exception
-/// handling information.  In addition to the symbol, this returns
-/// by-reference:
-///
-/// IsIndirect - True if the returned symbol is actually a stub that contains
-///    the address of the symbol, false if the symbol is the global itself.
-///
-/// IsPCRel - True if the symbol reference is already pc-relative, false if
-///    the caller needs to subtract off the address of the reference from the
-///    symbol.
-///
+/// reference to the specified global variable from exception
+/// handling information.
 const MCExpr *TargetLoweringObjectFile::
 getSymbolForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang,
-                                 MachineModuleInfo *MMI,
-                                 bool &IsIndirect, bool &IsPCRel) const {
-  // The generic implementation of this just returns a direct reference to the
-  // symbol.
-  IsIndirect = false;
-  IsPCRel    = false;
-  
+                             MachineModuleInfo *MMI, unsigned Encoding) const {
   // FIXME: Use GetGlobalValueSymbol.
   SmallString<128> Name;
   Mang->getNameWithPrefix(Name, GV, false);
-  return MCSymbolRefExpr::Create(Name.str(), getContext());
-}
-
-
-//===----------------------------------------------------------------------===//
-//                                  ELF
-//===----------------------------------------------------------------------===//
-typedef StringMap<const MCSectionELF*> ELFUniqueMapTy;
-
-TargetLoweringObjectFileELF::~TargetLoweringObjectFileELF() {
-  // If we have the section uniquing map, free it.
-  delete (ELFUniqueMapTy*)UniquingMap;
-}
-
-const MCSection *TargetLoweringObjectFileELF::
-getELFSection(StringRef Section, unsigned Type, unsigned Flags,
-              SectionKind Kind, bool IsExplicit) const {
-  if (UniquingMap == 0)
-    UniquingMap = new ELFUniqueMapTy();
-  ELFUniqueMapTy &Map = *(ELFUniqueMapTy*)UniquingMap;
-
-  // Do the lookup, if we have a hit, return it.
-  const MCSectionELF *&Entry = Map[Section];
-  if (Entry) return Entry;
-
-  return Entry = MCSectionELF::Create(Section, Type, Flags, Kind, IsExplicit,
-                                      getContext());
-}
-
-void TargetLoweringObjectFileELF::Initialize(MCContext &Ctx,
-                                             const TargetMachine &TM) {
-  if (UniquingMap != 0)
-    ((ELFUniqueMapTy*)UniquingMap)->clear();
-  TargetLoweringObjectFile::Initialize(Ctx, TM);
-
-  BSSSection =
-    getELFSection(".bss", MCSectionELF::SHT_NOBITS,
-                  MCSectionELF::SHF_WRITE | MCSectionELF::SHF_ALLOC,
-                  SectionKind::getBSS());
-
-  TextSection =
-    getELFSection(".text", MCSectionELF::SHT_PROGBITS,
-                  MCSectionELF::SHF_EXECINSTR | MCSectionELF::SHF_ALLOC,
-                  SectionKind::getText());
-
-  DataSection =
-    getELFSection(".data", MCSectionELF::SHT_PROGBITS,
-                  MCSectionELF::SHF_WRITE | MCSectionELF::SHF_ALLOC,
-                  SectionKind::getDataRel());
-
-  ReadOnlySection =
-    getELFSection(".rodata", MCSectionELF::SHT_PROGBITS,
-                  MCSectionELF::SHF_ALLOC,
-                  SectionKind::getReadOnly());
-
-  TLSDataSection =
-    getELFSection(".tdata", MCSectionELF::SHT_PROGBITS,
-                  MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_TLS |
-                  MCSectionELF::SHF_WRITE, SectionKind::getThreadData());
-
-  TLSBSSSection =
-    getELFSection(".tbss", MCSectionELF::SHT_NOBITS,
-                  MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_TLS |
-                  MCSectionELF::SHF_WRITE, SectionKind::getThreadBSS());
-
-  DataRelSection =
-    getELFSection(".data.rel", MCSectionELF::SHT_PROGBITS,
-                  MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_WRITE,
-                  SectionKind::getDataRel());
-
-  DataRelLocalSection =
-    getELFSection(".data.rel.local", MCSectionELF::SHT_PROGBITS,
-                  MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_WRITE,
-                  SectionKind::getDataRelLocal());
-
-  DataRelROSection =
-    getELFSection(".data.rel.ro", MCSectionELF::SHT_PROGBITS,
-                  MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_WRITE,
-                  SectionKind::getReadOnlyWithRel());
-
-  DataRelROLocalSection =
-    getELFSection(".data.rel.ro.local", MCSectionELF::SHT_PROGBITS,
-                  MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_WRITE,
-                  SectionKind::getReadOnlyWithRelLocal());
-
-  MergeableConst4Section =
-    getELFSection(".rodata.cst4", MCSectionELF::SHT_PROGBITS,
-                  MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_MERGE,
-                  SectionKind::getMergeableConst4());
-
-  MergeableConst8Section =
-    getELFSection(".rodata.cst8", MCSectionELF::SHT_PROGBITS,
-                  MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_MERGE,
-                  SectionKind::getMergeableConst8());
-
-  MergeableConst16Section =
-    getELFSection(".rodata.cst16", MCSectionELF::SHT_PROGBITS,
-                  MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_MERGE,
-                  SectionKind::getMergeableConst16());
-
-  StaticCtorSection =
-    getELFSection(".ctors", MCSectionELF::SHT_PROGBITS,
-                  MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_WRITE,
-                  SectionKind::getDataRel());
-
-  StaticDtorSection =
-    getELFSection(".dtors", MCSectionELF::SHT_PROGBITS,
-                  MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_WRITE,
-                  SectionKind::getDataRel());
-
-  // Exception Handling Sections.
-
-  // FIXME: We're emitting LSDA info into a readonly section on ELF, even though
-  // it contains relocatable pointers.  In PIC mode, this is probably a big
-  // runtime hit for C++ apps.  Either the contents of the LSDA need to be
-  // adjusted or this should be a data section.
-  LSDASection =
-    getELFSection(".gcc_except_table", MCSectionELF::SHT_PROGBITS,
-                  MCSectionELF::SHF_ALLOC, SectionKind::getReadOnly());
-  EHFrameSection =
-    getELFSection(".eh_frame", MCSectionELF::SHT_PROGBITS,
-                  MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_WRITE,
-                  SectionKind::getDataRel());
-
-  // Debug Info Sections.
-  DwarfAbbrevSection =
-    getELFSection(".debug_abbrev", MCSectionELF::SHT_PROGBITS, 0,
-                  SectionKind::getMetadata());
-  DwarfInfoSection =
-    getELFSection(".debug_info", MCSectionELF::SHT_PROGBITS, 0,
-                  SectionKind::getMetadata());
-  DwarfLineSection =
-    getELFSection(".debug_line", MCSectionELF::SHT_PROGBITS, 0,
-                  SectionKind::getMetadata());
-  DwarfFrameSection =
-    getELFSection(".debug_frame", MCSectionELF::SHT_PROGBITS, 0,
-                  SectionKind::getMetadata());
-  DwarfPubNamesSection =
-    getELFSection(".debug_pubnames", MCSectionELF::SHT_PROGBITS, 0,
-                  SectionKind::getMetadata());
-  DwarfPubTypesSection =
-    getELFSection(".debug_pubtypes", MCSectionELF::SHT_PROGBITS, 0,
-                  SectionKind::getMetadata());
-  DwarfStrSection =
-    getELFSection(".debug_str", MCSectionELF::SHT_PROGBITS, 0,
-                  SectionKind::getMetadata());
-  DwarfLocSection =
-    getELFSection(".debug_loc", MCSectionELF::SHT_PROGBITS, 0,
-                  SectionKind::getMetadata());
-  DwarfARangesSection =
-    getELFSection(".debug_aranges", MCSectionELF::SHT_PROGBITS, 0,
-                  SectionKind::getMetadata());
-  DwarfRangesSection =
-    getELFSection(".debug_ranges", MCSectionELF::SHT_PROGBITS, 0,
-                  SectionKind::getMetadata());
-  DwarfMacroInfoSection =
-    getELFSection(".debug_macinfo", MCSectionELF::SHT_PROGBITS, 0,
-                  SectionKind::getMetadata());
-}
-
-
-static SectionKind
-getELFKindForNamedSection(StringRef Name, SectionKind K) {
-  if (Name.empty() || Name[0] != '.') return K;
-
-  // Some lame default implementation based on some magic section names.
-  if (Name == ".bss" ||
-      Name.startswith(".bss.") ||
-      Name.startswith(".gnu.linkonce.b.") ||
-      Name.startswith(".llvm.linkonce.b.") ||
-      Name == ".sbss" ||
-      Name.startswith(".sbss.") ||
-      Name.startswith(".gnu.linkonce.sb.") ||
-      Name.startswith(".llvm.linkonce.sb."))
-    return SectionKind::getBSS();
-
-  if (Name == ".tdata" ||
-      Name.startswith(".tdata.") ||
-      Name.startswith(".gnu.linkonce.td.") ||
-      Name.startswith(".llvm.linkonce.td."))
-    return SectionKind::getThreadData();
-
-  if (Name == ".tbss" ||
-      Name.startswith(".tbss.") ||
-      Name.startswith(".gnu.linkonce.tb.") ||
-      Name.startswith(".llvm.linkonce.tb."))
-    return SectionKind::getThreadBSS();
-
-  return K;
-}
-
-
-static unsigned getELFSectionType(StringRef Name, SectionKind K) {
-
-  if (Name == ".init_array")
-    return MCSectionELF::SHT_INIT_ARRAY;
-
-  if (Name == ".fini_array")
-    return MCSectionELF::SHT_FINI_ARRAY;
+  const MCSymbol *Sym = getContext().GetOrCreateSymbol(Name.str());
 
-  if (Name == ".preinit_array")
-    return MCSectionELF::SHT_PREINIT_ARRAY;
-
-  if (K.isBSS() || K.isThreadBSS())
-    return MCSectionELF::SHT_NOBITS;
-
-  return MCSectionELF::SHT_PROGBITS;
-}
-
-
-static unsigned
-getELFSectionFlags(SectionKind K) {
-  unsigned Flags = 0;
-
-  if (!K.isMetadata())
-    Flags |= MCSectionELF::SHF_ALLOC;
-
-  if (K.isText())
-    Flags |= MCSectionELF::SHF_EXECINSTR;
-
-  if (K.isWriteable())
-    Flags |= MCSectionELF::SHF_WRITE;
-
-  if (K.isThreadLocal())
-    Flags |= MCSectionELF::SHF_TLS;
-
-  // K.isMergeableConst() is left out to honour PR4650
-  if (K.isMergeableCString() || K.isMergeableConst4() ||
-      K.isMergeableConst8() || K.isMergeableConst16())
-    Flags |= MCSectionELF::SHF_MERGE;
-
-  if (K.isMergeableCString())
-    Flags |= MCSectionELF::SHF_STRINGS;
-
-  return Flags;
-}
-
-
-const MCSection *TargetLoweringObjectFileELF::
-getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind,
-                         Mangler *Mang, const TargetMachine &TM) const {
-  StringRef SectionName = GV->getSection();
-
-  // Infer section flags from the section name if we can.
-  Kind = getELFKindForNamedSection(SectionName, Kind);
-
-  return getELFSection(SectionName,
-                       getELFSectionType(SectionName, Kind),
-                       getELFSectionFlags(Kind), Kind, true);
-}
-
-static const char *getSectionPrefixForUniqueGlobal(SectionKind Kind) {
-  if (Kind.isText())                 return ".gnu.linkonce.t.";
-  if (Kind.isReadOnly())             return ".gnu.linkonce.r.";
-
-  if (Kind.isThreadData())           return ".gnu.linkonce.td.";
-  if (Kind.isThreadBSS())            return ".gnu.linkonce.tb.";
-
-  if (Kind.isDataNoRel())            return ".gnu.linkonce.d.";
-  if (Kind.isDataRelLocal())         return ".gnu.linkonce.d.rel.local.";
-  if (Kind.isDataRel())              return ".gnu.linkonce.d.rel.";
-  if (Kind.isReadOnlyWithRelLocal()) return ".gnu.linkonce.d.rel.ro.local.";
-
-  assert(Kind.isReadOnlyWithRel() && "Unknown section kind");
-  return ".gnu.linkonce.d.rel.ro.";
+  return getSymbolForDwarfReference(Sym, MMI, Encoding);
 }
 
-const MCSection *TargetLoweringObjectFileELF::
-SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
-                       Mangler *Mang, const TargetMachine &TM) const {
-
-  // If this global is linkonce/weak and the target handles this by emitting it
-  // into a 'uniqued' section name, create and return the section now.
-  if (GV->isWeakForLinker() && !Kind.isCommon() && !Kind.isBSS()) {
-    const char *Prefix = getSectionPrefixForUniqueGlobal(Kind);
-    SmallString<128> Name;
-    Name.append(Prefix, Prefix+strlen(Prefix));
-    Mang->getNameWithPrefix(Name, GV, false);
-    return getELFSection(Name.str(), getELFSectionType(Name.str(), Kind),
-                         getELFSectionFlags(Kind), Kind);
-  }
-
-  if (Kind.isText()) return TextSection;
-
-  if (Kind.isMergeable1ByteCString() ||
-      Kind.isMergeable2ByteCString() ||
-      Kind.isMergeable4ByteCString()) {
-
-    // We also need alignment here.
-    // FIXME: this is getting the alignment of the character, not the
-    // alignment of the global!
-    unsigned Align =
-      TM.getTargetData()->getPreferredAlignment(cast<GlobalVariable>(GV));
-
-    const char *SizeSpec = ".rodata.str1.";
-    if (Kind.isMergeable2ByteCString())
-      SizeSpec = ".rodata.str2.";
-    else if (Kind.isMergeable4ByteCString())
-      SizeSpec = ".rodata.str4.";
-    else
-      assert(Kind.isMergeable1ByteCString() && "unknown string width");
-
-
-    std::string Name = SizeSpec + utostr(Align);
-    return getELFSection(Name, MCSectionELF::SHT_PROGBITS,
-                         MCSectionELF::SHF_ALLOC |
-                         MCSectionELF::SHF_MERGE |
-                         MCSectionELF::SHF_STRINGS,
-                         Kind);
-  }
-
-  if (Kind.isMergeableConst()) {
-    if (Kind.isMergeableConst4() && MergeableConst4Section)
-      return MergeableConst4Section;
-    if (Kind.isMergeableConst8() && MergeableConst8Section)
-      return MergeableConst8Section;
-    if (Kind.isMergeableConst16() && MergeableConst16Section)
-      return MergeableConst16Section;
-    return ReadOnlySection;  // .const
-  }
-
-  if (Kind.isReadOnly())             return ReadOnlySection;
-
-  if (Kind.isThreadData())           return TLSDataSection;
-  if (Kind.isThreadBSS())            return TLSBSSSection;
-
-  // Note: we claim that common symbols are put in BSSSection, but they are
-  // really emitted with the magic .comm directive, which creates a symbol table
-  // entry but not a section.
-  if (Kind.isBSS() || Kind.isCommon()) return BSSSection;
-
-  if (Kind.isDataNoRel())            return DataSection;
-  if (Kind.isDataRelLocal())         return DataRelLocalSection;
-  if (Kind.isDataRel())              return DataRelSection;
-  if (Kind.isReadOnlyWithRelLocal()) return DataRelROLocalSection;
-
-  assert(Kind.isReadOnlyWithRel() && "Unknown section kind");
-  return DataRelROSection;
-}
-
-/// getSectionForConstant - Given a mergeable constant with the
-/// specified size and relocation information, return a section that it
-/// should be placed in.
-const MCSection *TargetLoweringObjectFileELF::
-getSectionForConstant(SectionKind Kind) const {
-  if (Kind.isMergeableConst4() && MergeableConst4Section)
-    return MergeableConst4Section;
-  if (Kind.isMergeableConst8() && MergeableConst8Section)
-    return MergeableConst8Section;
-  if (Kind.isMergeableConst16() && MergeableConst16Section)
-    return MergeableConst16Section;
-  if (Kind.isReadOnly())
-    return ReadOnlySection;
-
-  if (Kind.isReadOnlyWithRelLocal()) return DataRelROLocalSection;
-  assert(Kind.isReadOnlyWithRel() && "Unknown section kind");
-  return DataRelROSection;
-}
-
-//===----------------------------------------------------------------------===//
-//                                 MachO
-//===----------------------------------------------------------------------===//
-
-typedef StringMap<const MCSectionMachO*> MachOUniqueMapTy;
-
-TargetLoweringObjectFileMachO::~TargetLoweringObjectFileMachO() {
-  // If we have the MachO uniquing map, free it.
-  delete (MachOUniqueMapTy*)UniquingMap;
-}
-
-
-const MCSectionMachO *TargetLoweringObjectFileMachO::
-getMachOSection(StringRef Segment, StringRef Section,
-                unsigned TypeAndAttributes,
-                unsigned Reserved2, SectionKind Kind) const {
-  // We unique sections by their segment/section pair.  The returned section
-  // may not have the same flags as the requested section, if so this should be
-  // diagnosed by the client as an error.
-
-  // Create the map if it doesn't already exist.
-  if (UniquingMap == 0)
-    UniquingMap = new MachOUniqueMapTy();
-  MachOUniqueMapTy &Map = *(MachOUniqueMapTy*)UniquingMap;
-
-  // Form the name to look up.
-  SmallString<64> Name;
-  Name += Segment;
-  Name.push_back(',');
-  Name += Section;
-
-  // Do the lookup, if we have a hit, return it.
-  const MCSectionMachO *&Entry = Map[Name.str()];
-  if (Entry) return Entry;
-
-  // Otherwise, return a new section.
-  return Entry = MCSectionMachO::Create(Segment, Section, TypeAndAttributes,
-                                        Reserved2, Kind, getContext());
-}
-
-
-void TargetLoweringObjectFileMachO::Initialize(MCContext &Ctx,
-                                               const TargetMachine &TM) {
-  if (UniquingMap != 0)
-    ((MachOUniqueMapTy*)UniquingMap)->clear();
-  TargetLoweringObjectFile::Initialize(Ctx, TM);
-
-  TextSection // .text
-    = getMachOSection("__TEXT", "__text",
-                      MCSectionMachO::S_ATTR_PURE_INSTRUCTIONS,
-                      SectionKind::getText());
-  DataSection // .data
-    = getMachOSection("__DATA", "__data", 0, SectionKind::getDataRel());
-
-  CStringSection // .cstring
-    = getMachOSection("__TEXT", "__cstring", MCSectionMachO::S_CSTRING_LITERALS,
-                      SectionKind::getMergeable1ByteCString());
-  UStringSection
-    = getMachOSection("__TEXT","__ustring", 0,
-                      SectionKind::getMergeable2ByteCString());
-  FourByteConstantSection // .literal4
-    = getMachOSection("__TEXT", "__literal4", MCSectionMachO::S_4BYTE_LITERALS,
-                      SectionKind::getMergeableConst4());
-  EightByteConstantSection // .literal8
-    = getMachOSection("__TEXT", "__literal8", MCSectionMachO::S_8BYTE_LITERALS,
-                      SectionKind::getMergeableConst8());
-
-  // ld_classic doesn't support .literal16 in 32-bit mode, and ld64 falls back
-  // to using it in -static mode.
-  SixteenByteConstantSection = 0;
-  if (TM.getRelocationModel() != Reloc::Static &&
-      TM.getTargetData()->getPointerSize() == 32)
-    SixteenByteConstantSection =   // .literal16
-      getMachOSection("__TEXT", "__literal16",MCSectionMachO::S_16BYTE_LITERALS,
-                      SectionKind::getMergeableConst16());
-
-  ReadOnlySection  // .const
-    = getMachOSection("__TEXT", "__const", 0, SectionKind::getReadOnly());
-
-  TextCoalSection
-    = getMachOSection("__TEXT", "__textcoal_nt",
-                      MCSectionMachO::S_COALESCED |
-                      MCSectionMachO::S_ATTR_PURE_INSTRUCTIONS,
-                      SectionKind::getText());
-  ConstTextCoalSection
-    = getMachOSection("__TEXT", "__const_coal", MCSectionMachO::S_COALESCED,
-                      SectionKind::getText());
-  ConstDataCoalSection
-    = getMachOSection("__DATA","__const_coal", MCSectionMachO::S_COALESCED,
-                      SectionKind::getText());
-  ConstDataSection  // .const_data
-    = getMachOSection("__DATA", "__const", 0,
-                      SectionKind::getReadOnlyWithRel());
-  DataCoalSection
-    = getMachOSection("__DATA","__datacoal_nt", MCSectionMachO::S_COALESCED,
-                      SectionKind::getDataRel());
-  DataCommonSection
-    = getMachOSection("__DATA","__common", MCSectionMachO::S_ZEROFILL,
-                      SectionKind::getBSS());
-  DataBSSSection
-    = getMachOSection("__DATA","__bss", MCSectionMachO::S_ZEROFILL,
-                    SectionKind::getBSS());
-  
-
-  LazySymbolPointerSection
-    = getMachOSection("__DATA", "__la_symbol_ptr",
-                      MCSectionMachO::S_LAZY_SYMBOL_POINTERS,
-                      SectionKind::getMetadata());
-  NonLazySymbolPointerSection
-    = getMachOSection("__DATA", "__nl_symbol_ptr",
-                      MCSectionMachO::S_NON_LAZY_SYMBOL_POINTERS,
-                      SectionKind::getMetadata());
-
-  if (TM.getRelocationModel() == Reloc::Static) {
-    StaticCtorSection
-      = getMachOSection("__TEXT", "__constructor", 0,SectionKind::getDataRel());
-    StaticDtorSection
-      = getMachOSection("__TEXT", "__destructor", 0, SectionKind::getDataRel());
-  } else {
-    StaticCtorSection
-      = getMachOSection("__DATA", "__mod_init_func",
-                        MCSectionMachO::S_MOD_INIT_FUNC_POINTERS,
-                        SectionKind::getDataRel());
-    StaticDtorSection
-      = getMachOSection("__DATA", "__mod_term_func",
-                        MCSectionMachO::S_MOD_TERM_FUNC_POINTERS,
-                        SectionKind::getDataRel());
-  }
-
-  // Exception Handling.
-  LSDASection = getMachOSection("__DATA", "__gcc_except_tab", 0,
-                                SectionKind::getDataRel());
-  EHFrameSection =
-    getMachOSection("__TEXT", "__eh_frame",
-                    MCSectionMachO::S_COALESCED |
-                    MCSectionMachO::S_ATTR_NO_TOC |
-                    MCSectionMachO::S_ATTR_STRIP_STATIC_SYMS |
-                    MCSectionMachO::S_ATTR_LIVE_SUPPORT,
-                    SectionKind::getReadOnly());
-
-  // Debug Information.
-  DwarfAbbrevSection =
-    getMachOSection("__DWARF", "__debug_abbrev", MCSectionMachO::S_ATTR_DEBUG,
-                    SectionKind::getMetadata());
-  DwarfInfoSection =
-    getMachOSection("__DWARF", "__debug_info", MCSectionMachO::S_ATTR_DEBUG,
-                    SectionKind::getMetadata());
-  DwarfLineSection =
-    getMachOSection("__DWARF", "__debug_line", MCSectionMachO::S_ATTR_DEBUG,
-                    SectionKind::getMetadata());
-  DwarfFrameSection =
-    getMachOSection("__DWARF", "__debug_frame", MCSectionMachO::S_ATTR_DEBUG,
-                    SectionKind::getMetadata());
-  DwarfPubNamesSection =
-    getMachOSection("__DWARF", "__debug_pubnames", MCSectionMachO::S_ATTR_DEBUG,
-                    SectionKind::getMetadata());
-  DwarfPubTypesSection =
-    getMachOSection("__DWARF", "__debug_pubtypes", MCSectionMachO::S_ATTR_DEBUG,
-                    SectionKind::getMetadata());
-  DwarfStrSection =
-    getMachOSection("__DWARF", "__debug_str", MCSectionMachO::S_ATTR_DEBUG,
-                    SectionKind::getMetadata());
-  DwarfLocSection =
-    getMachOSection("__DWARF", "__debug_loc", MCSectionMachO::S_ATTR_DEBUG,
-                    SectionKind::getMetadata());
-  DwarfARangesSection =
-    getMachOSection("__DWARF", "__debug_aranges", MCSectionMachO::S_ATTR_DEBUG,
-                    SectionKind::getMetadata());
-  DwarfRangesSection =
-    getMachOSection("__DWARF", "__debug_ranges", MCSectionMachO::S_ATTR_DEBUG,
-                    SectionKind::getMetadata());
-  DwarfMacroInfoSection =
-    getMachOSection("__DWARF", "__debug_macinfo", MCSectionMachO::S_ATTR_DEBUG,
-                    SectionKind::getMetadata());
-  DwarfDebugInlineSection =
-    getMachOSection("__DWARF", "__debug_inlined", MCSectionMachO::S_ATTR_DEBUG,
-                    SectionKind::getMetadata());
-}
-
-const MCSection *TargetLoweringObjectFileMachO::
-getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind,
-                         Mangler *Mang, const TargetMachine &TM) const {
-  // Parse the section specifier and create it if valid.
-  StringRef Segment, Section;
-  unsigned TAA, StubSize;
-  std::string ErrorCode =
-    MCSectionMachO::ParseSectionSpecifier(GV->getSection(), Segment, Section,
-                                          TAA, StubSize);
-  if (!ErrorCode.empty()) {
-    // If invalid, report the error with llvm_report_error.
-    llvm_report_error("Global variable '" + GV->getNameStr() +
-                      "' has an invalid section specifier '" + GV->getSection()+
-                      "': " + ErrorCode + ".");
-    // Fall back to dropping it into the data section.
-    return DataSection;
-  }
-
-  // Get the section.
-  const MCSectionMachO *S =
-    getMachOSection(Segment, Section, TAA, StubSize, Kind);
-
-  // Okay, now that we got the section, verify that the TAA & StubSize agree.
-  // If the user declared multiple globals with different section flags, we need
-  // to reject it here.
-  if (S->getTypeAndAttributes() != TAA || S->getStubSize() != StubSize) {
-    // If invalid, report the error with llvm_report_error.
-    llvm_report_error("Global variable '" + GV->getNameStr() +
-                      "' section type or attributes does not match previous"
-                      " section specifier");
-  }
-
-  return S;
-}
-
-const MCSection *TargetLoweringObjectFileMachO::
-SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
-                       Mangler *Mang, const TargetMachine &TM) const {
-  assert(!Kind.isThreadLocal() && "Darwin doesn't support TLS");
-
-  if (Kind.isText())
-    return GV->isWeakForLinker() ? TextCoalSection : TextSection;
-
-  // If this is weak/linkonce, put this in a coalescable section, either in text
-  // or data depending on if it is writable.
-  if (GV->isWeakForLinker()) {
-    if (Kind.isReadOnly())
-      return ConstTextCoalSection;
-    return DataCoalSection;
-  }
-
-  // FIXME: Alignment check should be handled by section classifier.
-  if (Kind.isMergeable1ByteCString() ||
-      Kind.isMergeable2ByteCString()) {
-    if (TM.getTargetData()->getPreferredAlignment(
-                                              cast<GlobalVariable>(GV)) < 32) {
-      if (Kind.isMergeable1ByteCString())
-        return CStringSection;
-      assert(Kind.isMergeable2ByteCString());
-      return UStringSection;
-    }
-  }
-
-  if (Kind.isMergeableConst()) {
-    if (Kind.isMergeableConst4())
-      return FourByteConstantSection;
-    if (Kind.isMergeableConst8())
-      return EightByteConstantSection;
-    if (Kind.isMergeableConst16() && SixteenByteConstantSection)
-      return SixteenByteConstantSection;
-  }
-
-  // Otherwise, if it is readonly, but not something we can specially optimize,
-  // just drop it in .const.
-  if (Kind.isReadOnly())
-    return ReadOnlySection;
-
-  // If this is marked const, put it into a const section.  But if the dynamic
-  // linker needs to write to it, put it in the data segment.
-  if (Kind.isReadOnlyWithRel())
-    return ConstDataSection;
-
-  // Put zero initialized globals with strong external linkage in the
-  // DATA, __common section with the .zerofill directive.
-  if (Kind.isBSSExtern())
-    return DataCommonSection;
-
-  // Put zero initialized globals with local linkage in __DATA,__bss directive
-  // with the .zerofill directive (aka .lcomm).
-  if (Kind.isBSSLocal())
-    return DataBSSSection;
-  
-  // Otherwise, just drop the variable in the normal data section.
-  return DataSection;
-}
-
-const MCSection *
-TargetLoweringObjectFileMachO::getSectionForConstant(SectionKind Kind) const {
-  // If this constant requires a relocation, we have to put it in the data
-  // segment, not in the text segment.
-  if (Kind.isDataRel() || Kind.isReadOnlyWithRel())
-    return ConstDataSection;
-
-  if (Kind.isMergeableConst4())
-    return FourByteConstantSection;
-  if (Kind.isMergeableConst8())
-    return EightByteConstantSection;
-  if (Kind.isMergeableConst16() && SixteenByteConstantSection)
-    return SixteenByteConstantSection;
-  return ReadOnlySection;  // .const
-}
-
-/// shouldEmitUsedDirectiveFor - This hook allows targets to selectively decide
-/// not to emit the UsedDirective for some symbols in llvm.used.
-// FIXME: REMOVE this (rdar://7071300)
-bool TargetLoweringObjectFileMachO::
-shouldEmitUsedDirectiveFor(const GlobalValue *GV, Mangler *Mang) const {
-  /// On Darwin, internally linked data beginning with "L" or "l" does not have
-  /// the directive emitted (this occurs in ObjC metadata).
-  if (!GV) return false;
-
-  // Check whether the mangled name has the "Private" or "LinkerPrivate" prefix.
-  if (GV->hasLocalLinkage() && !isa<Function>(GV)) {
-    // FIXME: ObjC metadata is currently emitted as internal symbols that have
-    // \1L and \0l prefixes on them.  Fix them to be Private/LinkerPrivate and
-    // this horrible hack can go away.
-    SmallString<64> Name;
-    Mang->getNameWithPrefix(Name, GV, false);
-    if (Name[0] == 'L' || Name[0] == 'l')
-      return false;
+const MCExpr *TargetLoweringObjectFile::
+getSymbolForDwarfReference(const MCSymbol *Sym, MachineModuleInfo *MMI,
+                           unsigned Encoding) const {
+  const MCExpr *Res = MCSymbolRefExpr::Create(Sym, getContext());
+
+  switch (Encoding & 0xF0) {
+  default:
+    llvm_report_error("We do not support this DWARF encoding yet!");
+    break;
+  case dwarf::DW_EH_PE_absptr:
+    // Do nothing special
+    break;
+  case dwarf::DW_EH_PE_pcrel:
+    // FIXME: PCSymbol
+    const MCExpr *PC = MCSymbolRefExpr::Create(".", getContext());
+    Res = MCBinaryExpr::CreateSub(Res, PC, getContext());
+    break;
   }
 
-  return true;
+  return Res;
 }
 
-const MCExpr *TargetLoweringObjectFileMachO::
-getSymbolForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang,
-                                 MachineModuleInfo *MMI,
-                                 bool &IsIndirect, bool &IsPCRel) const {
-  // The mach-o version of this method defaults to returning a stub reference.
-  IsIndirect = true;
-  IsPCRel    = false;
-  
-  SmallString<128> Name;
-  Mang->getNameWithPrefix(Name, GV, true);
-  Name += "$non_lazy_ptr";
-  return MCSymbolRefExpr::Create(Name.str(), getContext());
+unsigned TargetLoweringObjectFile::getPersonalityEncoding() const {
+  return dwarf::DW_EH_PE_absptr;
 }
 
-
-//===----------------------------------------------------------------------===//
-//                                  COFF
-//===----------------------------------------------------------------------===//
-
-typedef StringMap<const MCSectionCOFF*> COFFUniqueMapTy;
-
-TargetLoweringObjectFileCOFF::~TargetLoweringObjectFileCOFF() {
-  delete (COFFUniqueMapTy*)UniquingMap;
+unsigned TargetLoweringObjectFile::getLSDAEncoding() const {
+  return dwarf::DW_EH_PE_absptr;
 }
 
-
-const MCSection *TargetLoweringObjectFileCOFF::
-getCOFFSection(StringRef Name, bool isDirective, SectionKind Kind) const {
-  // Create the map if it doesn't already exist.
-  if (UniquingMap == 0)
-    UniquingMap = new MachOUniqueMapTy();
-  COFFUniqueMapTy &Map = *(COFFUniqueMapTy*)UniquingMap;
-
-  // Do the lookup, if we have a hit, return it.
-  const MCSectionCOFF *&Entry = Map[Name];
-  if (Entry) return Entry;
-
-  return Entry = MCSectionCOFF::Create(Name, isDirective, Kind, getContext());
+unsigned TargetLoweringObjectFile::getFDEEncoding() const {
+  return dwarf::DW_EH_PE_absptr;
 }
 
-void TargetLoweringObjectFileCOFF::Initialize(MCContext &Ctx,
-                                              const TargetMachine &TM) {
-  if (UniquingMap != 0)
-    ((COFFUniqueMapTy*)UniquingMap)->clear();
-  TargetLoweringObjectFile::Initialize(Ctx, TM);
-  TextSection = getCOFFSection("\t.text", true, SectionKind::getText());
-  DataSection = getCOFFSection("\t.data", true, SectionKind::getDataRel());
-  StaticCtorSection =
-    getCOFFSection(".ctors", false, SectionKind::getDataRel());
-  StaticDtorSection =
-    getCOFFSection(".dtors", false, SectionKind::getDataRel());
-
-  // FIXME: We're emitting LSDA info into a readonly section on COFF, even
-  // though it contains relocatable pointers.  In PIC mode, this is probably a
-  // big runtime hit for C++ apps.  Either the contents of the LSDA need to be
-  // adjusted or this should be a data section.
-  LSDASection =
-    getCOFFSection(".gcc_except_table", false, SectionKind::getReadOnly());
-  EHFrameSection =
-    getCOFFSection(".eh_frame", false, SectionKind::getDataRel());
-
-  // Debug info.
-  // FIXME: Don't use 'directive' mode here.
-  DwarfAbbrevSection =
-    getCOFFSection("\t.section\t.debug_abbrev,\"dr\"",
-                   true, SectionKind::getMetadata());
-  DwarfInfoSection =
-    getCOFFSection("\t.section\t.debug_info,\"dr\"",
-                   true, SectionKind::getMetadata());
-  DwarfLineSection =
-    getCOFFSection("\t.section\t.debug_line,\"dr\"",
-                   true, SectionKind::getMetadata());
-  DwarfFrameSection =
-    getCOFFSection("\t.section\t.debug_frame,\"dr\"",
-                   true, SectionKind::getMetadata());
-  DwarfPubNamesSection =
-    getCOFFSection("\t.section\t.debug_pubnames,\"dr\"",
-                   true, SectionKind::getMetadata());
-  DwarfPubTypesSection =
-    getCOFFSection("\t.section\t.debug_pubtypes,\"dr\"",
-                   true, SectionKind::getMetadata());
-  DwarfStrSection =
-    getCOFFSection("\t.section\t.debug_str,\"dr\"",
-                   true, SectionKind::getMetadata());
-  DwarfLocSection =
-    getCOFFSection("\t.section\t.debug_loc,\"dr\"",
-                   true, SectionKind::getMetadata());
-  DwarfARangesSection =
-    getCOFFSection("\t.section\t.debug_aranges,\"dr\"",
-                   true, SectionKind::getMetadata());
-  DwarfRangesSection =
-    getCOFFSection("\t.section\t.debug_ranges,\"dr\"",
-                   true, SectionKind::getMetadata());
-  DwarfMacroInfoSection =
-    getCOFFSection("\t.section\t.debug_macinfo,\"dr\"",
-                   true, SectionKind::getMetadata());
-}
-
-const MCSection *TargetLoweringObjectFileCOFF::
-getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind,
-                         Mangler *Mang, const TargetMachine &TM) const {
-  return getCOFFSection(GV->getSection(), false, Kind);
-}
-
-static const char *getCOFFSectionPrefixForUniqueGlobal(SectionKind Kind) {
-  if (Kind.isText())
-    return ".text$linkonce";
-  if (Kind.isWriteable())
-    return ".data$linkonce";
-  return ".rdata$linkonce";
-}
-
-
-const MCSection *TargetLoweringObjectFileCOFF::
-SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
-                       Mangler *Mang, const TargetMachine &TM) const {
-  assert(!Kind.isThreadLocal() && "Doesn't support TLS");
-
-  // If this global is linkonce/weak and the target handles this by emitting it
-  // into a 'uniqued' section name, create and return the section now.
-  if (GV->isWeakForLinker()) {
-    const char *Prefix = getCOFFSectionPrefixForUniqueGlobal(Kind);
-    SmallString<128> Name(Prefix, Prefix+strlen(Prefix));
-    Mang->getNameWithPrefix(Name, GV, false);
-    return getCOFFSection(Name.str(), false, Kind);
-  }
-
-  if (Kind.isText())
-    return getTextSection();
-
-  return getDataSection();
+unsigned TargetLoweringObjectFile::getTTypeEncoding() const {
+  return dwarf::DW_EH_PE_absptr;
 }
 
diff --git a/libclamav/c++/llvm/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp b/libclamav/c++/llvm/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp
index 1a35a49..734a545 100644
--- a/libclamav/c++/llvm/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp
+++ b/libclamav/c++/llvm/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp
@@ -73,7 +73,7 @@ void X86ATTInstPrinter::printOperand(const MCInst *MI, unsigned OpNo) {
     O << '$' << Op.getImm();
     
     if (CommentStream && (Op.getImm() > 255 || Op.getImm() < -256))
-      *CommentStream << format("imm = 0x%X\n", Op.getImm());
+      *CommentStream << format("imm = 0x%llX\n", (long long)Op.getImm());
     
   } else {
     assert(Op.isExpr() && "unknown operand kind in printOperand");
diff --git a/libclamav/c++/llvm/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp b/libclamav/c++/llvm/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp
index dfcee79..8cab24c 100644
--- a/libclamav/c++/llvm/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp
+++ b/libclamav/c++/llvm/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp
@@ -33,11 +33,11 @@
 #include "llvm/MC/MCSymbol.h"
 #include "llvm/CodeGen/MachineJumpTableInfo.h"
 #include "llvm/CodeGen/MachineModuleInfoImpls.h"
+#include "llvm/CodeGen/TargetLoweringObjectFileImpl.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/FormattedStream.h"
 #include "llvm/MC/MCAsmInfo.h"
 #include "llvm/Target/Mangler.h"
-#include "llvm/Target/TargetLoweringObjectFile.h"
 #include "llvm/Target/TargetOptions.h"
 #include "llvm/Target/TargetRegistry.h"
 #include "llvm/ADT/SmallString.h"
@@ -603,6 +603,28 @@ void X86AsmPrinter::EmitEndOfAsmFile(Module &M) {
       }
     }
   }
+
+  if (Subtarget->isTargetELF()) {
+    TargetLoweringObjectFileELF &TLOFELF =
+      static_cast<TargetLoweringObjectFileELF &>(getObjFileLowering());
+
+    MachineModuleInfoELF &MMIELF = MMI->getObjFileInfo<MachineModuleInfoELF>();
+
+    // Output stubs for external and common global variables.
+    MachineModuleInfoELF::SymbolListTy Stubs = MMIELF.GetGVStubList();
+    if (!Stubs.empty()) {
+      OutStreamer.SwitchSection(TLOFELF.getDataRelSection());
+      const TargetData *TD = TM.getTargetData();
+
+      for (unsigned i = 0, e = Stubs.size(); i != e; ++i)
+        O << *Stubs[i].first << ":\n"
+          << (TD->getPointerSize() == 8 ?
+              MAI->getData64bitsDirective() : MAI->getData32bitsDirective())
+          << *Stubs[i].second << '\n';
+
+      Stubs.clear();
+    }
+  }
 }
 
 
diff --git a/libclamav/c++/llvm/lib/Target/X86/CMakeLists.txt b/libclamav/c++/llvm/lib/Target/X86/CMakeLists.txt
index 61f26a7..eed3b45 100644
--- a/libclamav/c++/llvm/lib/Target/X86/CMakeLists.txt
+++ b/libclamav/c++/llvm/lib/Target/X86/CMakeLists.txt
@@ -15,6 +15,7 @@ tablegen(X86GenCallingConv.inc -gen-callingconv)
 tablegen(X86GenSubtarget.inc -gen-subtarget)
 
 set(sources
+  X86AsmBackend.cpp
   X86CodeEmitter.cpp
   X86COFFMachineModuleInfo.cpp
   X86ELFWriterInfo.cpp
diff --git a/libclamav/c++/llvm/lib/Target/X86/README-SSE.txt b/libclamav/c++/llvm/lib/Target/X86/README-SSE.txt
index 19eb05e..e5f84e8 100644
--- a/libclamav/c++/llvm/lib/Target/X86/README-SSE.txt
+++ b/libclamav/c++/llvm/lib/Target/X86/README-SSE.txt
@@ -67,8 +67,8 @@ no_exit.i7:		; preds = %no_exit.i7, %build_tree.exit
                                    [ %tmp.34.i18, %no_exit.i7 ]
 	%tmp.0.0.0.i10 = phi double [ 0.000000e+00, %build_tree.exit ],
                                     [ %tmp.28.i16, %no_exit.i7 ]
-	%tmp.28.i16 = add double %tmp.0.0.0.i10, 0.000000e+00
-	%tmp.34.i18 = add double %tmp.0.1.0.i9, 0.000000e+00
+	%tmp.28.i16 = fadd double %tmp.0.0.0.i10, 0.000000e+00
+	%tmp.34.i18 = fadd double %tmp.0.1.0.i9, 0.000000e+00
 	br i1 false, label %Compute_Tree.exit23, label %no_exit.i7
 
 Compute_Tree.exit23:		; preds = %no_exit.i7
@@ -97,7 +97,7 @@ pcmp/pand/pandn/por to do a selection instead of a conditional branch:
 
 double %X(double %Y, double %Z, double %A, double %B) {
         %C = setlt double %A, %B
-        %z = add double %Z, 0.0    ;; select operand is not a load
+        %z = fadd double %Z, 0.0    ;; select operand is not a load
         %D = select bool %C, double %Y, double %z
         ret double %D
 }
@@ -545,7 +545,7 @@ eliminates a constant pool load.  For example, consider:
 
 define i64 @ccosf(float %z.0, float %z.1) nounwind readonly  {
 entry:
- %tmp6 = sub float -0.000000e+00, %z.1		; <float> [#uses=1]
+ %tmp6 = fsub float -0.000000e+00, %z.1		; <float> [#uses=1]
  %tmp20 = tail call i64 @ccoshf( float %tmp6, float %z.0 ) nounwind readonly
  ret i64 %tmp20
 }
diff --git a/libclamav/c++/llvm/lib/Target/X86/README.txt b/libclamav/c++/llvm/lib/Target/X86/README.txt
index 3c6138b..d4545a6 100644
--- a/libclamav/c++/llvm/lib/Target/X86/README.txt
+++ b/libclamav/c++/llvm/lib/Target/X86/README.txt
@@ -227,11 +227,6 @@ lambda, siod, optimizer-eval, ackermann, hash2, nestedloop, strcat, and Treesor.
 
 //===---------------------------------------------------------------------===//
 
-Teach the coalescer to coalesce vregs of different register classes. e.g. FR32 /
-FR64 to VR128.
-
-//===---------------------------------------------------------------------===//
-
 Adding to the list of cmp / test poor codegen issues:
 
 int test(__m128 *A, __m128 *B) {
diff --git a/libclamav/c++/llvm/lib/Target/X86/X86.h b/libclamav/c++/llvm/lib/Target/X86/X86.h
index 1a1e447..d76d811 100644
--- a/libclamav/c++/llvm/lib/Target/X86/X86.h
+++ b/libclamav/c++/llvm/lib/Target/X86/X86.h
@@ -19,13 +19,16 @@
 
 namespace llvm {
 
-class X86TargetMachine;
 class FunctionPass;
-class MachineCodeEmitter;
-class MCCodeEmitter;
 class MCContext;
 class JITCodeEmitter;
+class MCAssembler;
+class MCCodeEmitter;
+class MCContext;
+class MachineCodeEmitter;
 class Target;
+class TargetAsmBackend;
+class X86TargetMachine;
 class formatted_raw_ostream;
 
 /// createX86ISelDag - This pass converts a legalized DAG into a 
@@ -55,6 +58,9 @@ MCCodeEmitter *createX86_32MCCodeEmitter(const Target &, TargetMachine &TM,
 MCCodeEmitter *createX86_64MCCodeEmitter(const Target &, TargetMachine &TM,
                                          MCContext &Ctx);
 
+TargetAsmBackend *createX86_32AsmBackend(const Target &, MCAssembler &);
+TargetAsmBackend *createX86_64AsmBackend(const Target &, MCAssembler &);
+
 /// createX86EmitCodeToMemory - Returns a pass that converts a register
 /// allocated function into raw machine code in a dynamically
 /// allocated chunk of memory.
diff --git a/libclamav/c++/llvm/lib/Target/X86/X86AsmBackend.cpp b/libclamav/c++/llvm/lib/Target/X86/X86AsmBackend.cpp
new file mode 100644
index 0000000..e6654ef
--- /dev/null
+++ b/libclamav/c++/llvm/lib/Target/X86/X86AsmBackend.cpp
@@ -0,0 +1,34 @@
+//===-- X86AsmBackend.cpp - X86 Assembler Backend -------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/Target/TargetAsmBackend.h"
+#include "X86.h"
+#include "llvm/Target/TargetRegistry.h"
+#include "llvm/Target/TargetAsmBackend.h"
+using namespace llvm;
+
+namespace {
+
+class X86AsmBackend : public TargetAsmBackend {
+public:
+  X86AsmBackend(const Target &T, MCAssembler &A)
+    : TargetAsmBackend(T) {}
+};
+
+}
+
+TargetAsmBackend *llvm::createX86_32AsmBackend(const Target &T,
+                                               MCAssembler &A) {
+  return new X86AsmBackend(T, A);
+}
+
+TargetAsmBackend *llvm::createX86_64AsmBackend(const Target &T,
+                                               MCAssembler &A) {
+  return new X86AsmBackend(T, A);
+}
diff --git a/libclamav/c++/llvm/lib/Target/X86/X86FastISel.cpp b/libclamav/c++/llvm/lib/Target/X86/X86FastISel.cpp
index 999a80f..98e3f4e 100644
--- a/libclamav/c++/llvm/lib/Target/X86/X86FastISel.cpp
+++ b/libclamav/c++/llvm/lib/Target/X86/X86FastISel.cpp
@@ -388,6 +388,8 @@ bool X86FastISel::X86SelectAddress(Value *V, X86AddressMode &AM) {
   }
 
   case Instruction::GetElementPtr: {
+    X86AddressMode SavedAM = AM;
+
     // Pattern-match simple GEPs.
     uint64_t Disp = (int32_t)AM.Disp;
     unsigned IndexReg = AM.IndexReg;
@@ -428,7 +430,13 @@ bool X86FastISel::X86SelectAddress(Value *V, X86AddressMode &AM) {
     AM.IndexReg = IndexReg;
     AM.Scale = Scale;
     AM.Disp = (uint32_t)Disp;
-    return X86SelectAddress(U->getOperand(0), AM);
+    if (X86SelectAddress(U->getOperand(0), AM))
+      return true;
+    
+    // If we couldn't merge the sub value into this addr mode, revert back to
+    // our address and just match the value instead of completely failing.
+    AM = SavedAM;
+    break;
   unsupported_gep:
     // Ok, the GEP indices weren't all covered.
     break;
@@ -786,8 +794,8 @@ bool X86FastISel::X86SelectCmp(Instruction *I) {
 
 bool X86FastISel::X86SelectZExt(Instruction *I) {
   // Handle zero-extension from i1 to i8, which is common.
-  if (I->getType()->isInteger(8) &&
-      I->getOperand(0)->getType()->isInteger(1)) {
+  if (I->getType()->isIntegerTy(8) &&
+      I->getOperand(0)->getType()->isIntegerTy(1)) {
     unsigned ResultReg = getRegForValue(I->getOperand(0));
     if (ResultReg == 0) return false;
     // Set the high bits to zero.
@@ -949,7 +957,7 @@ bool X86FastISel::X86SelectBranch(Instruction *I) {
 bool X86FastISel::X86SelectShift(Instruction *I) {
   unsigned CReg = 0, OpReg = 0, OpImm = 0;
   const TargetRegisterClass *RC = NULL;
-  if (I->getType()->isInteger(8)) {
+  if (I->getType()->isIntegerTy(8)) {
     CReg = X86::CL;
     RC = &X86::GR8RegClass;
     switch (I->getOpcode()) {
@@ -958,7 +966,7 @@ bool X86FastISel::X86SelectShift(Instruction *I) {
     case Instruction::Shl:  OpReg = X86::SHL8rCL; OpImm = X86::SHL8ri; break;
     default: return false;
     }
-  } else if (I->getType()->isInteger(16)) {
+  } else if (I->getType()->isIntegerTy(16)) {
     CReg = X86::CX;
     RC = &X86::GR16RegClass;
     switch (I->getOpcode()) {
@@ -967,7 +975,7 @@ bool X86FastISel::X86SelectShift(Instruction *I) {
     case Instruction::Shl:  OpReg = X86::SHL16rCL; OpImm = X86::SHL16ri; break;
     default: return false;
     }
-  } else if (I->getType()->isInteger(32)) {
+  } else if (I->getType()->isIntegerTy(32)) {
     CReg = X86::ECX;
     RC = &X86::GR32RegClass;
     switch (I->getOpcode()) {
@@ -976,7 +984,7 @@ bool X86FastISel::X86SelectShift(Instruction *I) {
     case Instruction::Shl:  OpReg = X86::SHL32rCL; OpImm = X86::SHL32ri; break;
     default: return false;
     }
-  } else if (I->getType()->isInteger(64)) {
+  } else if (I->getType()->isIntegerTy(64)) {
     CReg = X86::RCX;
     RC = &X86::GR64RegClass;
     switch (I->getOpcode()) {
@@ -1161,6 +1169,8 @@ bool X86FastISel::X86VisitIntrinsicCall(IntrinsicInst &I) {
     if (!X86SelectAddress(DI->getAddress(), AM))
       return false;
     const TargetInstrDesc &II = TII.get(TargetOpcode::DBG_VALUE);
+    // FIXME may need to add RegState::Debug to any registers produced,
+    // although ESP/EBP should be the only ones at the moment.
     addFullAddress(BuildMI(MBB, DL, II), AM).addImm(0).
                                         addMetadata(DI->getVariable());
     return true;
diff --git a/libclamav/c++/llvm/lib/Target/X86/X86FloatingPointRegKill.cpp b/libclamav/c++/llvm/lib/Target/X86/X86FloatingPointRegKill.cpp
index 34a0045..6a117dd 100644
--- a/libclamav/c++/llvm/lib/Target/X86/X86FloatingPointRegKill.cpp
+++ b/libclamav/c++/llvm/lib/Target/X86/X86FloatingPointRegKill.cpp
@@ -118,7 +118,7 @@ bool FPRegKiller::runOnMachineFunction(MachineFunction &MF) {
         for (BasicBlock::const_iterator II = SI->begin();
              (PN = dyn_cast<PHINode>(II)); ++II) {
           if (PN->getType()==Type::getX86_FP80Ty(LLVMBB->getContext()) ||
-              (!Subtarget.hasSSE1() && PN->getType()->isFloatingPoint()) ||
+              (!Subtarget.hasSSE1() && PN->getType()->isFloatingPointTy()) ||
               (!Subtarget.hasSSE2() &&
                 PN->getType()==Type::getDoubleTy(LLVMBB->getContext()))) {
             ContainsFPCode = true;
diff --git a/libclamav/c++/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp b/libclamav/c++/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
index a23ab91..3fad8ad 100644
--- a/libclamav/c++/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
+++ b/libclamav/c++/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
@@ -12,15 +12,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-// Force NDEBUG on in any optimized build on Darwin.
-//
-// FIXME: This is a huge hack, to work around ridiculously awful compile times
-// on this file with gcc-4.2 on Darwin, in Release mode.
-#if (!defined(__llvm__) && defined(__APPLE__) && \
-     defined(__OPTIMIZE__) && !defined(NDEBUG))
-#define NDEBUG
-#endif
-
 #define DEBUG_TYPE "x86-isel"
 #include "X86.h"
 #include "X86InstrBuilder.h"
@@ -177,14 +168,11 @@ namespace {
       return "X86 DAG->DAG Instruction Selection";
     }
 
-    /// InstructionSelect - This callback is invoked by
-    /// SelectionDAGISel when it has created a SelectionDAG for us to codegen.
-    virtual void InstructionSelect();
-
     virtual void EmitFunctionEntryCode(Function &Fn, MachineFunction &MF);
 
-    virtual
-      bool IsLegalAndProfitableToFold(SDNode *N, SDNode *U, SDNode *Root) const;
+    virtual bool IsProfitableToFold(SDValue N, SDNode *U, SDNode *Root) const;
+
+    virtual void PreprocessISelDAG();
 
 // Include the pieces autogenerated from the target description.
 #include "X86GenDAGISel.inc"
@@ -208,18 +196,17 @@ namespace {
                        SDValue &Scale, SDValue &Index, SDValue &Disp);
     bool SelectTLSADDRAddr(SDNode *Op, SDValue N, SDValue &Base,
                        SDValue &Scale, SDValue &Index, SDValue &Disp);
-    bool SelectScalarSSELoad(SDNode *Op, SDValue Pred,
-                             SDValue N, SDValue &Base, SDValue &Scale,
+    bool SelectScalarSSELoad(SDNode *Root, SDValue N,
+                             SDValue &Base, SDValue &Scale,
                              SDValue &Index, SDValue &Disp,
                              SDValue &Segment,
-                             SDValue &InChain, SDValue &OutChain);
+                             SDValue &NodeWithChain);
+    
     bool TryFoldLoad(SDNode *P, SDValue N,
                      SDValue &Base, SDValue &Scale,
                      SDValue &Index, SDValue &Disp,
                      SDValue &Segment);
-    void PreprocessForRMW();
-    void PreprocessForFPConvert();
-
+    
     /// SelectInlineAsmMemoryOperand - Implement addressing mode selection for
     /// inline asm expressions.
     virtual bool SelectInlineAsmMemoryOperand(const SDValue &Op,
@@ -295,19 +282,22 @@ namespace {
     const X86InstrInfo *getInstrInfo() {
       return getTargetMachine().getInstrInfo();
     }
-
-#ifndef NDEBUG
-    unsigned Indent;
-#endif
   };
 }
 
 
-bool X86DAGToDAGISel::IsLegalAndProfitableToFold(SDNode *N, SDNode *U,
-                                                 SDNode *Root) const {
+bool
+X86DAGToDAGISel::IsProfitableToFold(SDValue N, SDNode *U, SDNode *Root) const {
   if (OptLevel == CodeGenOpt::None) return false;
 
-  if (U == Root)
+  if (!N.hasOneUse())
+    return false;
+
+  if (N.getOpcode() != ISD::LOAD)
+    return true;
+
+  // If N is a load, do additional profitability checks.
+  if (U == Root) {
     switch (U->getOpcode()) {
     default: break;
     case X86ISD::ADD:
@@ -354,60 +344,9 @@ bool X86DAGToDAGISel::IsLegalAndProfitableToFold(SDNode *N, SDNode *U,
       }
     }
     }
-
-  // Proceed to 'generic' cycle finder code
-  return SelectionDAGISel::IsLegalAndProfitableToFold(N, U, Root);
-}
-
-/// MoveBelowTokenFactor - Replace TokenFactor operand with load's chain operand
-/// and move load below the TokenFactor. Replace store's chain operand with
-/// load's chain result.
-static void MoveBelowTokenFactor(SelectionDAG *CurDAG, SDValue Load,
-                                 SDValue Store, SDValue TF) {
-  SmallVector<SDValue, 4> Ops;
-  for (unsigned i = 0, e = TF.getNode()->getNumOperands(); i != e; ++i)
-    if (Load.getNode() == TF.getOperand(i).getNode())
-      Ops.push_back(Load.getOperand(0));
-    else
-      Ops.push_back(TF.getOperand(i));
-  SDValue NewTF = CurDAG->UpdateNodeOperands(TF, &Ops[0], Ops.size());
-  SDValue NewLoad = CurDAG->UpdateNodeOperands(Load, NewTF,
-                                               Load.getOperand(1),
-                                               Load.getOperand(2));
-  CurDAG->UpdateNodeOperands(Store, NewLoad.getValue(1), Store.getOperand(1),
-                             Store.getOperand(2), Store.getOperand(3));
-}
-
-/// isRMWLoad - Return true if N is a load that's part of RMW sub-DAG.  The 
-/// chain produced by the load must only be used by the store's chain operand,
-/// otherwise this may produce a cycle in the DAG.
-/// 
-static bool isRMWLoad(SDValue N, SDValue Chain, SDValue Address,
-                      SDValue &Load) {
-  if (N.getOpcode() == ISD::BIT_CONVERT) {
-    if (!N.hasOneUse())
-      return false;
-    N = N.getOperand(0);
   }
 
-  LoadSDNode *LD = dyn_cast<LoadSDNode>(N);
-  if (!LD || LD->isVolatile())
-    return false;
-  if (LD->getAddressingMode() != ISD::UNINDEXED)
-    return false;
-
-  ISD::LoadExtType ExtType = LD->getExtensionType();
-  if (ExtType != ISD::NON_EXTLOAD && ExtType != ISD::EXTLOAD)
-    return false;
-
-  if (N.hasOneUse() &&
-      LD->hasNUsesOfValue(1, 1) &&
-      N.getOperand(1) == Address &&
-      LD->isOperandOf(Chain.getNode())) {
-    Load = N;
-    return true;
-  }
-  return false;
+  return true;
 }
 
 /// MoveBelowCallSeqStart - Replace CALLSEQ_START operand with load's chain
@@ -473,51 +412,15 @@ static bool isCalleeLoad(SDValue Callee, SDValue &Chain) {
   return false;
 }
 
-
-/// PreprocessForRMW - Preprocess the DAG to make instruction selection better.
-/// This is only run if not in -O0 mode.
-/// This allows the instruction selector to pick more read-modify-write
-/// instructions. This is a common case:
-///
-///     [Load chain]
-///         ^
-///         |
-///       [Load]
-///       ^    ^
-///       |    |
-///      /      \-
-///     /         |
-/// [TokenFactor] [Op]
-///     ^          ^
-///     |          |
-///      \        /
-///       \      /
-///       [Store]
-///
-/// The fact the store's chain operand != load's chain will prevent the
-/// (store (op (load))) instruction from being selected. We can transform it to:
-///
-///     [Load chain]
-///         ^
-///         |
-///    [TokenFactor]
-///         ^
-///         |
-///       [Load]
-///       ^    ^
-///       |    |
-///       |     \- 
-///       |       | 
-///       |     [Op]
-///       |       ^
-///       |       |
-///       \      /
-///        \    /
-///       [Store]
-void X86DAGToDAGISel::PreprocessForRMW() {
+void X86DAGToDAGISel::PreprocessISelDAG() {
+  // OptForSize is used in pattern predicates that isel is matching.
+  OptForSize = MF->getFunction()->hasFnAttr(Attribute::OptimizeForSize);
+  
   for (SelectionDAG::allnodes_iterator I = CurDAG->allnodes_begin(),
-         E = CurDAG->allnodes_end(); I != E; ++I) {
-    if (I->getOpcode() == X86ISD::CALL) {
+       E = CurDAG->allnodes_end(); I != E; ) {
+    SDNode *N = I++;  // Preincrement iterator to avoid invalidation issues.
+
+    if (OptLevel != CodeGenOpt::None && N->getOpcode() == X86ISD::CALL) {
       /// Also try moving call address load from outside callseq_start to just
       /// before the call to allow it to be folded.
       ///
@@ -537,85 +440,23 @@ void X86DAGToDAGISel::PreprocessForRMW() {
       ///      \        /
       ///       \      /
       ///       [CALL]
-      SDValue Chain = I->getOperand(0);
-      SDValue Load  = I->getOperand(1);
+      SDValue Chain = N->getOperand(0);
+      SDValue Load  = N->getOperand(1);
       if (!isCalleeLoad(Load, Chain))
         continue;
-      MoveBelowCallSeqStart(CurDAG, Load, SDValue(I, 0), Chain);
+      MoveBelowCallSeqStart(CurDAG, Load, SDValue(N, 0), Chain);
       ++NumLoadMoved;
       continue;
     }
-
-    if (!ISD::isNON_TRUNCStore(I))
-      continue;
-    SDValue Chain = I->getOperand(0);
-
-    if (Chain.getNode()->getOpcode() != ISD::TokenFactor)
-      continue;
-
-    SDValue N1 = I->getOperand(1);
-    SDValue N2 = I->getOperand(2);
-    if ((N1.getValueType().isFloatingPoint() &&
-         !N1.getValueType().isVector()) ||
-        !N1.hasOneUse())
-      continue;
-
-    bool RModW = false;
-    SDValue Load;
-    unsigned Opcode = N1.getNode()->getOpcode();
-    switch (Opcode) {
-    case ISD::ADD:
-    case ISD::MUL:
-    case ISD::AND:
-    case ISD::OR:
-    case ISD::XOR:
-    case ISD::ADDC:
-    case ISD::ADDE:
-    case ISD::VECTOR_SHUFFLE: {
-      SDValue N10 = N1.getOperand(0);
-      SDValue N11 = N1.getOperand(1);
-      RModW = isRMWLoad(N10, Chain, N2, Load);
-      if (!RModW)
-        RModW = isRMWLoad(N11, Chain, N2, Load);
-      break;
-    }
-    case ISD::SUB:
-    case ISD::SHL:
-    case ISD::SRA:
-    case ISD::SRL:
-    case ISD::ROTL:
-    case ISD::ROTR:
-    case ISD::SUBC:
-    case ISD::SUBE:
-    case X86ISD::SHLD:
-    case X86ISD::SHRD: {
-      SDValue N10 = N1.getOperand(0);
-      RModW = isRMWLoad(N10, Chain, N2, Load);
-      break;
-    }
-    }
-
-    if (RModW) {
-      MoveBelowTokenFactor(CurDAG, Load, SDValue(I, 0), Chain);
-      ++NumLoadMoved;
-      checkForCycles(I);
-    }
-  }
-}
-
-
-/// PreprocessForFPConvert - Walk over the dag lowering fpround and fpextend
-/// nodes that target the FP stack to be store and load to the stack.  This is a
-/// gross hack.  We would like to simply mark these as being illegal, but when
-/// we do that, legalize produces these when it expands calls, then expands
-/// these in the same legalize pass.  We would like dag combine to be able to
-/// hack on these between the call expansion and the node legalization.  As such
-/// this pass basically does "really late" legalization of these inline with the
-/// X86 isel pass.
-void X86DAGToDAGISel::PreprocessForFPConvert() {
-  for (SelectionDAG::allnodes_iterator I = CurDAG->allnodes_begin(),
-       E = CurDAG->allnodes_end(); I != E; ) {
-    SDNode *N = I++;  // Preincrement iterator to avoid invalidation issues.
+    
+    // Lower fpround and fpextend nodes that target the FP stack to be store and
+    // load to the stack.  This is a gross hack.  We would like to simply mark
+    // these as being illegal, but when we do that, legalize produces these when
+    // it expands calls, then expands these in the same legalize pass.  We would
+    // like dag combine to be able to hack on these between the call expansion
+    // and the node legalization.  As such this pass basically does "really
+    // late" legalization of these inline with the X86 isel pass.
+    // FIXME: This should only happen when not compiled with -O0.
     if (N->getOpcode() != ISD::FP_ROUND && N->getOpcode() != ISD::FP_EXTEND)
       continue;
     
@@ -652,9 +493,10 @@ void X86DAGToDAGISel::PreprocessForFPConvert() {
     // FIXME: optimize the case where the src/dest is a load or store?
     SDValue Store = CurDAG->getTruncStore(CurDAG->getEntryNode(), dl,
                                           N->getOperand(0),
-                                          MemTmp, NULL, 0, MemVT);
+                                          MemTmp, NULL, 0, MemVT,
+                                          false, false, 0);
     SDValue Result = CurDAG->getExtLoad(ISD::EXTLOAD, dl, DstVT, Store, MemTmp,
-                                        NULL, 0, MemVT);
+                                        NULL, 0, MemVT, false, false, 0);
 
     // We're about to replace all uses of the FP_ROUND/FP_EXTEND with the
     // extload we created.  This will cause general havok on the dag because
@@ -670,30 +512,6 @@ void X86DAGToDAGISel::PreprocessForFPConvert() {
   }  
 }
 
-/// InstructionSelectBasicBlock - This callback is invoked by SelectionDAGISel
-/// when it has created a SelectionDAG for us to codegen.
-void X86DAGToDAGISel::InstructionSelect() {
-  const Function *F = MF->getFunction();
-  OptForSize = F->hasFnAttr(Attribute::OptimizeForSize);
-
-  if (OptLevel != CodeGenOpt::None)
-    PreprocessForRMW();
-
-  // FIXME: This should only happen when not compiled with -O0.
-  PreprocessForFPConvert();
-
-  // Codegen the basic block.
-#ifndef NDEBUG
-  DEBUG(dbgs() << "===== Instruction selection begins:\n");
-  Indent = 0;
-#endif
-  SelectRoot(*CurDAG);
-#ifndef NDEBUG
-  DEBUG(dbgs() << "===== Instruction selection ends:\n");
-#endif
-
-  CurDAG->RemoveDeadNodes();
-}
 
 /// EmitSpecialCodeForMain - Emit any code that needs to be executed only in
 /// the main function.
@@ -1300,22 +1118,24 @@ bool X86DAGToDAGISel::SelectAddr(SDNode *Op, SDValue N, SDValue &Base,
 /// SelectScalarSSELoad - Match a scalar SSE load.  In particular, we want to
 /// match a load whose top elements are either undef or zeros.  The load flavor
 /// is derived from the type of N, which is either v4f32 or v2f64.
-bool X86DAGToDAGISel::SelectScalarSSELoad(SDNode *Op, SDValue Pred,
+///
+/// We also return:
+///   PatternChainNode: this is the matched node that has a chain input and
+///   output.
+bool X86DAGToDAGISel::SelectScalarSSELoad(SDNode *Root,
                                           SDValue N, SDValue &Base,
                                           SDValue &Scale, SDValue &Index,
                                           SDValue &Disp, SDValue &Segment,
-                                          SDValue &InChain,
-                                          SDValue &OutChain) {
+                                          SDValue &PatternNodeWithChain) {
   if (N.getOpcode() == ISD::SCALAR_TO_VECTOR) {
-    InChain = N.getOperand(0).getValue(1);
-    if (ISD::isNON_EXTLoad(InChain.getNode()) &&
-        InChain.getValue(0).hasOneUse() &&
-        N.hasOneUse() &&
-        IsLegalAndProfitableToFold(N.getNode(), Pred.getNode(), Op)) {
-      LoadSDNode *LD = cast<LoadSDNode>(InChain);
-      if (!SelectAddr(Op, LD->getBasePtr(), Base, Scale, Index, Disp, Segment))
+    PatternNodeWithChain = N.getOperand(0);
+    if (ISD::isNON_EXTLoad(PatternNodeWithChain.getNode()) &&
+        PatternNodeWithChain.hasOneUse() &&
+        IsProfitableToFold(N.getOperand(0), N.getNode(), Root) &&
+        IsLegalToFold(N.getOperand(0), N.getNode(), Root)) {
+      LoadSDNode *LD = cast<LoadSDNode>(PatternNodeWithChain);
+      if (!SelectAddr(Root, LD->getBasePtr(), Base, Scale, Index, Disp,Segment))
         return false;
-      OutChain = LD->getChain();
       return true;
     }
   }
@@ -1327,13 +1147,14 @@ bool X86DAGToDAGISel::SelectScalarSSELoad(SDNode *Op, SDValue Pred,
       N.getOperand(0).getOpcode() == ISD::SCALAR_TO_VECTOR && 
       N.getOperand(0).getNode()->hasOneUse() &&
       ISD::isNON_EXTLoad(N.getOperand(0).getOperand(0).getNode()) &&
-      N.getOperand(0).getOperand(0).hasOneUse()) {
+      N.getOperand(0).getOperand(0).hasOneUse() &&
+      IsProfitableToFold(N.getOperand(0), N.getNode(), Root) &&
+      IsLegalToFold(N.getOperand(0), N.getNode(), Root)) {
     // Okay, this is a zero extending load.  Fold it.
     LoadSDNode *LD = cast<LoadSDNode>(N.getOperand(0).getOperand(0));
-    if (!SelectAddr(Op, LD->getBasePtr(), Base, Scale, Index, Disp, Segment))
+    if (!SelectAddr(Root, LD->getBasePtr(), Base, Scale, Index, Disp, Segment))
       return false;
-    OutChain = LD->getChain();
-    InChain = SDValue(LD, 1);
+    PatternNodeWithChain = SDValue(LD, 0);
     return true;
   }
   return false;
@@ -1407,7 +1228,6 @@ bool X86DAGToDAGISel::SelectLEAAddr(SDNode *Op, SDValue N,
 bool X86DAGToDAGISel::SelectTLSADDRAddr(SDNode *Op, SDValue N, SDValue &Base,
                                         SDValue &Scale, SDValue &Index,
                                         SDValue &Disp) {
-  assert(Op->getOpcode() == X86ISD::TLSADDR);
   assert(N.getOpcode() == ISD::TargetGlobalTLSAddress);
   const GlobalAddressSDNode *GA = cast<GlobalAddressSDNode>(N);
   
@@ -1434,11 +1254,12 @@ bool X86DAGToDAGISel::TryFoldLoad(SDNode *P, SDValue N,
                                   SDValue &Base, SDValue &Scale,
                                   SDValue &Index, SDValue &Disp,
                                   SDValue &Segment) {
-  if (ISD::isNON_EXTLoad(N.getNode()) &&
-      N.hasOneUse() &&
-      IsLegalAndProfitableToFold(N.getNode(), P, P))
-    return SelectAddr(P, N.getOperand(1), Base, Scale, Index, Disp, Segment);
-  return false;
+  if (!ISD::isNON_EXTLoad(N.getNode()) ||
+      !IsProfitableToFold(N, P, P) ||
+      !IsLegalToFold(N, P, P))
+    return false;
+  
+  return SelectAddr(P, N.getOperand(1), Base, Scale, Index, Disp, Segment);
 }
 
 /// getGlobalBaseReg - Return an SDNode that returns the value of
@@ -1541,7 +1362,7 @@ SDNode *X86DAGToDAGISel::SelectAtomicLoadAdd(SDNode *Node, EVT NVT) {
       Opc = X86::LOCK_DEC16m;
     else if (isSub) {
       if (isCN) {
-        if (Predicate_i16immSExt8(Val.getNode()))
+        if (Predicate_immSext8(Val.getNode()))
           Opc = X86::LOCK_SUB16mi8;
         else
           Opc = X86::LOCK_SUB16mi;
@@ -1549,7 +1370,7 @@ SDNode *X86DAGToDAGISel::SelectAtomicLoadAdd(SDNode *Node, EVT NVT) {
         Opc = X86::LOCK_SUB16mr;
     } else {
       if (isCN) {
-        if (Predicate_i16immSExt8(Val.getNode()))
+        if (Predicate_immSext8(Val.getNode()))
           Opc = X86::LOCK_ADD16mi8;
         else
           Opc = X86::LOCK_ADD16mi;
@@ -1564,7 +1385,7 @@ SDNode *X86DAGToDAGISel::SelectAtomicLoadAdd(SDNode *Node, EVT NVT) {
       Opc = X86::LOCK_DEC32m;
     else if (isSub) {
       if (isCN) {
-        if (Predicate_i32immSExt8(Val.getNode()))
+        if (Predicate_immSext8(Val.getNode()))
           Opc = X86::LOCK_SUB32mi8;
         else
           Opc = X86::LOCK_SUB32mi;
@@ -1572,7 +1393,7 @@ SDNode *X86DAGToDAGISel::SelectAtomicLoadAdd(SDNode *Node, EVT NVT) {
         Opc = X86::LOCK_SUB32mr;
     } else {
       if (isCN) {
-        if (Predicate_i32immSExt8(Val.getNode()))
+        if (Predicate_immSext8(Val.getNode()))
           Opc = X86::LOCK_ADD32mi8;
         else
           Opc = X86::LOCK_ADD32mi;
@@ -1588,7 +1409,7 @@ SDNode *X86DAGToDAGISel::SelectAtomicLoadAdd(SDNode *Node, EVT NVT) {
     else if (isSub) {
       Opc = X86::LOCK_SUB64mr;
       if (isCN) {
-        if (Predicate_i64immSExt8(Val.getNode()))
+        if (Predicate_immSext8(Val.getNode()))
           Opc = X86::LOCK_SUB64mi8;
         else if (Predicate_i64immSExt32(Val.getNode()))
           Opc = X86::LOCK_SUB64mi32;
@@ -1596,7 +1417,7 @@ SDNode *X86DAGToDAGISel::SelectAtomicLoadAdd(SDNode *Node, EVT NVT) {
     } else {
       Opc = X86::LOCK_ADD64mr;
       if (isCN) {
-        if (Predicate_i64immSExt8(Val.getNode()))
+        if (Predicate_immSext8(Val.getNode()))
           Opc = X86::LOCK_ADD64mi8;
         else if (Predicate_i64immSExt32(Val.getNode()))
           Opc = X86::LOCK_ADD64mi32;
@@ -1693,24 +1514,10 @@ SDNode *X86DAGToDAGISel::Select(SDNode *Node) {
   unsigned Opcode = Node->getOpcode();
   DebugLoc dl = Node->getDebugLoc();
   
-#ifndef NDEBUG
-  DEBUG({
-      dbgs() << std::string(Indent, ' ') << "Selecting: ";
-      Node->dump(CurDAG);
-      dbgs() << '\n';
-    });
-  Indent += 2;
-#endif
+  DEBUG(dbgs() << "Selecting: "; Node->dump(CurDAG); dbgs() << '\n');
 
   if (Node->isMachineOpcode()) {
-#ifndef NDEBUG
-    DEBUG({
-        dbgs() << std::string(Indent-2, ' ') << "== ";
-        Node->dump(CurDAG);
-        dbgs() << '\n';
-      });
-    Indent -= 2;
-#endif
+    DEBUG(dbgs() << "== ";  Node->dump(CurDAG); dbgs() << '\n');
     return NULL;   // Already selected.
   }
 
@@ -1806,13 +1613,7 @@ SDNode *X86DAGToDAGISel::Select(SDNode *Node) {
                                                 LoReg, NVT, InFlag);
       InFlag = Result.getValue(2);
       ReplaceUses(SDValue(Node, 0), Result);
-#ifndef NDEBUG
-      DEBUG({
-          dbgs() << std::string(Indent-2, ' ') << "=> ";
-          Result.getNode()->dump(CurDAG);
-          dbgs() << '\n';
-        });
-#endif
+      DEBUG(dbgs() << "=> "; Result.getNode()->dump(CurDAG); dbgs() << '\n');
     }
     // Copy the high half of the result, if it is needed.
     if (!SDValue(Node, 1).use_empty()) {
@@ -1835,19 +1636,9 @@ SDNode *X86DAGToDAGISel::Select(SDNode *Node) {
         InFlag = Result.getValue(2);
       }
       ReplaceUses(SDValue(Node, 1), Result);
-#ifndef NDEBUG
-      DEBUG({
-          dbgs() << std::string(Indent-2, ' ') << "=> ";
-          Result.getNode()->dump(CurDAG);
-          dbgs() << '\n';
-        });
-#endif
+      DEBUG(dbgs() << "=> "; Result.getNode()->dump(CurDAG); dbgs() << '\n');
     }
 
-#ifndef NDEBUG
-    Indent -= 2;
-#endif
-
     return NULL;
   }
 
@@ -1962,13 +1753,7 @@ SDNode *X86DAGToDAGISel::Select(SDNode *Node) {
                                                 LoReg, NVT, InFlag);
       InFlag = Result.getValue(2);
       ReplaceUses(SDValue(Node, 0), Result);
-#ifndef NDEBUG
-      DEBUG({
-          dbgs() << std::string(Indent-2, ' ') << "=> ";
-          Result.getNode()->dump(CurDAG);
-          dbgs() << '\n';
-        });
-#endif
+      DEBUG(dbgs() << "=> "; Result.getNode()->dump(CurDAG); dbgs() << '\n');
     }
     // Copy the remainder (high) result, if it is needed.
     if (!SDValue(Node, 1).use_empty()) {
@@ -1992,19 +1777,8 @@ SDNode *X86DAGToDAGISel::Select(SDNode *Node) {
         InFlag = Result.getValue(2);
       }
       ReplaceUses(SDValue(Node, 1), Result);
-#ifndef NDEBUG
-      DEBUG({
-          dbgs() << std::string(Indent-2, ' ') << "=> ";
-          Result.getNode()->dump(CurDAG);
-          dbgs() << '\n';
-        });
-#endif
+      DEBUG(dbgs() << "=> "; Result.getNode()->dump(CurDAG); dbgs() << '\n');
     }
-
-#ifndef NDEBUG
-    Indent -= 2;
-#endif
-
     return NULL;
   }
 
@@ -2117,17 +1891,12 @@ SDNode *X86DAGToDAGISel::Select(SDNode *Node) {
 
   SDNode *ResNode = SelectCode(Node);
 
-#ifndef NDEBUG
-  DEBUG({
-      dbgs() << std::string(Indent-2, ' ') << "=> ";
-      if (ResNode == NULL || ResNode == Node)
-        Node->dump(CurDAG);
-      else
-        ResNode->dump(CurDAG);
-      dbgs() << '\n';
-    });
-  Indent -= 2;
-#endif
+  DEBUG(dbgs() << "=> ";
+        if (ResNode == NULL || ResNode == Node)
+          Node->dump(CurDAG);
+        else
+          ResNode->dump(CurDAG);
+        dbgs() << '\n');
 
   return ResNode;
 }
diff --git a/libclamav/c++/llvm/lib/Target/X86/X86ISelLowering.cpp b/libclamav/c++/llvm/lib/Target/X86/X86ISelLowering.cpp
index a644e5e..8384ab7 100644
--- a/libclamav/c++/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/libclamav/c++/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -73,15 +73,16 @@ static TargetLoweringObjectFile *createTLOF(X86TargetMachine &TM) {
   case X86Subtarget::isDarwin:
     if (TM.getSubtarget<X86Subtarget>().is64Bit())
       return new X8664_MachoTargetObjectFile();
-    return new X8632_MachoTargetObjectFile();
+    return new TargetLoweringObjectFileMachO();
   case X86Subtarget::isELF:
-    return new TargetLoweringObjectFileELF();
+   if (TM.getSubtarget<X86Subtarget>().is64Bit())
+     return new X8664_ELFTargetObjectFile(TM);
+    return new X8632_ELFTargetObjectFile(TM);
   case X86Subtarget::isMingw:
   case X86Subtarget::isCygwin:
   case X86Subtarget::isWindows:
     return new TargetLoweringObjectFileCOFF();
   }
-
 }
 
 X86TargetLowering::X86TargetLowering(X86TargetMachine &TM)
@@ -1451,7 +1452,8 @@ X86TargetLowering::LowerMemArgument(SDValue Chain,
                                     VA.getLocMemOffset(), isImmutable, false);
     SDValue FIN = DAG.getFrameIndex(FI, getPointerTy());
     return DAG.getLoad(ValVT, dl, Chain, FIN,
-                       PseudoSourceValue::getFixedStack(FI), 0);
+                       PseudoSourceValue::getFixedStack(FI), 0,
+                       false, false, 0);
   }
 }
 
@@ -1545,7 +1547,8 @@ X86TargetLowering::LowerFormalArguments(SDValue Chain,
 
     // If value is passed via pointer - do a load.
     if (VA.getLocInfo() == CCValAssign::Indirect)
-      ArgValue = DAG.getLoad(VA.getValVT(), dl, Chain, ArgValue, NULL, 0);
+      ArgValue = DAG.getLoad(VA.getValVT(), dl, Chain, ArgValue, NULL, 0,
+                             false, false, 0);
 
     InVals.push_back(ArgValue);
   }
@@ -1640,7 +1643,7 @@ X86TargetLowering::LowerFormalArguments(SDValue Chain,
         SDValue Store =
           DAG.getStore(Val.getValue(1), dl, Val, FIN,
                        PseudoSourceValue::getFixedStack(RegSaveFrameIndex),
-                       Offset);
+                       Offset, false, false, 0);
         MemOps.push_back(Store);
         Offset += 8;
       }
@@ -1709,7 +1712,8 @@ X86TargetLowering::LowerMemOpCallTo(SDValue Chain,
     return CreateCopyOfByValArgument(Arg, PtrOff, Chain, Flags, DAG, dl);
   }
   return DAG.getStore(Chain, dl, Arg, PtrOff,
-                      PseudoSourceValue::getStack(), LocMemOffset);
+                      PseudoSourceValue::getStack(), LocMemOffset,
+                      false, false, 0);
 }
 
 /// EmitTailCallLoadRetAddr - Emit a load of return address if tail call
@@ -1724,7 +1728,7 @@ X86TargetLowering::EmitTailCallLoadRetAddr(SelectionDAG &DAG,
   OutRetAddr = getReturnAddressFrameIndex(DAG);
 
   // Load the "old" Return address.
-  OutRetAddr = DAG.getLoad(VT, dl, Chain, OutRetAddr, NULL, 0);
+  OutRetAddr = DAG.getLoad(VT, dl, Chain, OutRetAddr, NULL, 0, false, false, 0);
   return SDValue(OutRetAddr.getNode(), 1);
 }
 
@@ -1739,11 +1743,12 @@ EmitTailCallStoreRetAddr(SelectionDAG & DAG, MachineFunction &MF,
   // Calculate the new stack slot for the return address.
   int SlotSize = Is64Bit ? 8 : 4;
   int NewReturnAddrFI =
-    MF.getFrameInfo()->CreateFixedObject(SlotSize, FPDiff-SlotSize, true,false);
+    MF.getFrameInfo()->CreateFixedObject(SlotSize, FPDiff-SlotSize, false, false);
   EVT VT = Is64Bit ? MVT::i64 : MVT::i32;
   SDValue NewRetAddrFrIdx = DAG.getFrameIndex(NewReturnAddrFI, VT);
   Chain = DAG.getStore(Chain, dl, RetAddrFrIdx, NewRetAddrFrIdx,
-                       PseudoSourceValue::getFixedStack(NewReturnAddrFI), 0);
+                       PseudoSourceValue::getFixedStack(NewReturnAddrFI), 0,
+                       false, false, 0);
   return Chain;
 }
 
@@ -1854,7 +1859,8 @@ X86TargetLowering::LowerCall(SDValue Chain, SDValue Callee,
       SDValue SpillSlot = DAG.CreateStackTemporary(VA.getValVT());
       int FI = cast<FrameIndexSDNode>(SpillSlot)->getIndex();
       Chain = DAG.getStore(Chain, dl, Arg, SpillSlot,
-                           PseudoSourceValue::getFixedStack(FI), 0);
+                           PseudoSourceValue::getFixedStack(FI), 0,
+                           false, false, 0);
       Arg = SpillSlot;
       break;
     }
@@ -1985,7 +1991,8 @@ X86TargetLowering::LowerCall(SDValue Chain, SDValue Callee,
           // Store relative to framepointer.
           MemOpChains2.push_back(
             DAG.getStore(ArgChain, dl, Arg, FIN,
-                         PseudoSourceValue::getFixedStack(FI), 0));
+                         PseudoSourceValue::getFixedStack(FI), 0,
+                         false, false, 0));
         }
       }
     }
@@ -2228,7 +2235,8 @@ static
 bool MatchingStackOffset(SDValue Arg, unsigned Offset, ISD::ArgFlagsTy Flags,
                          MachineFrameInfo *MFI, const MachineRegisterInfo *MRI,
                          const X86InstrInfo *TII) {
-  int FI;
+  unsigned Bytes = Arg.getValueType().getSizeInBits() / 8;
+  int FI = INT_MAX;
   if (Arg.getOpcode() == ISD::CopyFromReg) {
     unsigned VR = cast<RegisterSDNode>(Arg.getOperand(1))->getReg();
     if (!VR || TargetRegisterInfo::isPhysicalRegister(VR))
@@ -2244,25 +2252,30 @@ bool MatchingStackOffset(SDValue Arg, unsigned Offset, ISD::ArgFlagsTy Flags,
       if ((Opcode == X86::LEA32r || Opcode == X86::LEA64r) &&
           Def->getOperand(1).isFI()) {
         FI = Def->getOperand(1).getIndex();
-        if (MFI->getObjectSize(FI) != Flags.getByValSize())
-          return false;
+        Bytes = Flags.getByValSize();
       } else
         return false;
     }
-  } else {
-    LoadSDNode *Ld = dyn_cast<LoadSDNode>(Arg);
-    if (!Ld)
+  } else if (LoadSDNode *Ld = dyn_cast<LoadSDNode>(Arg)) {
+    if (Flags.isByVal())
+      // ByVal argument is passed in as a pointer but it's now being
+      // dereferenced. e.g.
+      // define @foo(%struct.X* %A) {
+      //   tail call @bar(%struct.X* byval %A)
+      // }
       return false;
     SDValue Ptr = Ld->getBasePtr();
     FrameIndexSDNode *FINode = dyn_cast<FrameIndexSDNode>(Ptr);
     if (!FINode)
       return false;
     FI = FINode->getIndex();
-  }
+  } else
+    return false;
 
+  assert(FI != INT_MAX);
   if (!MFI->isFixedObjectIndex(FI))
     return false;
-  return Offset == MFI->getObjectOffset(FI);
+  return Offset == MFI->getObjectOffset(FI) && Bytes == MFI->getObjectSize(FI);
 }
 
 /// IsEligibleForTailCallOptimization - Check whether the call is eligible
@@ -2369,7 +2382,7 @@ SDValue X86TargetLowering::getReturnAddressFrameIndex(SelectionDAG &DAG) {
     // Set up a frame object for the return address.
     uint64_t SlotSize = TD->getPointerSize();
     ReturnAddrIndex = MF.getFrameInfo()->CreateFixedObject(SlotSize, -SlotSize,
-                                                           true, false);
+                                                           false, false);
     FuncInfo->setRAIndex(ReturnAddrIndex);
   }
 
@@ -3564,7 +3577,8 @@ X86TargetLowering::LowerAsSplatVectorLoad(SDValue SrcOp, EVT VT, DebugLoc dl,
     int EltNo = (Offset - StartOffset) >> 2;
     int Mask[4] = { EltNo, EltNo, EltNo, EltNo };
     EVT VT = (PVT == MVT::i32) ? MVT::v4i32 : MVT::v4f32;
-    SDValue V1 = DAG.getLoad(VT, dl, Chain, Ptr,LD->getSrcValue(),0);
+    SDValue V1 = DAG.getLoad(VT, dl, Chain, Ptr,LD->getSrcValue(),0,
+                             false, false, 0);
     // Canonicalize it to a v4i32 shuffle.
     V1 = DAG.getNode(ISD::BIT_CONVERT, dl, MVT::v4i32, V1);
     return DAG.getNode(ISD::BIT_CONVERT, dl, VT,
@@ -4808,8 +4822,16 @@ X86TargetLowering::LowerINSERT_VECTOR_ELT_SSE4(SDValue Op, SelectionDAG &DAG){
 
   if ((EltVT.getSizeInBits() == 8 || EltVT.getSizeInBits() == 16) &&
       isa<ConstantSDNode>(N2)) {
-    unsigned Opc = (EltVT.getSizeInBits() == 8) ? X86ISD::PINSRB
-                                                : X86ISD::PINSRW;
+    unsigned Opc;
+    if (VT == MVT::v8i16)
+      Opc = X86ISD::PINSRW;
+    else if (VT == MVT::v4i16)
+      Opc = X86ISD::MMX_PINSRW;
+    else if (VT == MVT::v16i8)
+      Opc = X86ISD::PINSRB;
+    else
+      Opc = X86ISD::PINSRB;
+
     // Transform it so it match pinsr{b,w} which expects a GR32 as its second
     // argument.
     if (N1.getValueType() != MVT::i32)
@@ -4860,7 +4882,8 @@ X86TargetLowering::LowerINSERT_VECTOR_ELT(SDValue Op, SelectionDAG &DAG) {
       N1 = DAG.getNode(ISD::ANY_EXTEND, dl, MVT::i32, N1);
     if (N2.getValueType() != MVT::i32)
       N2 = DAG.getIntPtrConstant(cast<ConstantSDNode>(N2)->getZExtValue());
-    return DAG.getNode(X86ISD::PINSRW, dl, VT, N0, N1, N2);
+    return DAG.getNode(VT == MVT::v8i16 ? X86ISD::PINSRW : X86ISD::MMX_PINSRW,
+                       dl, VT, N0, N1, N2);
   }
   return SDValue();
 }
@@ -5063,7 +5086,7 @@ X86TargetLowering::LowerGlobalAddress(const GlobalValue *GV, DebugLoc dl,
   // load.
   if (isGlobalStubReference(OpFlags))
     Result = DAG.getLoad(getPointerTy(), dl, DAG.getEntryNode(), Result,
-                         PseudoSourceValue::getGOT(), 0);
+                         PseudoSourceValue::getGOT(), 0, false, false, 0);
 
   // If there was a non-zero offset that we didn't fold, create an explicit
   // addition for it.
@@ -5143,7 +5166,7 @@ static SDValue LowerToTLSExecModel(GlobalAddressSDNode *GA, SelectionDAG &DAG,
                                              MVT::i32));
 
   SDValue ThreadPointer = DAG.getLoad(PtrVT, dl, DAG.getEntryNode(), Base,
-                                      NULL, 0);
+                                      NULL, 0, false, false, 0);
 
   unsigned char OperandFlags = 0;
   // Most TLS accesses are not RIP relative, even on x86-64.  One exception is
@@ -5168,7 +5191,7 @@ static SDValue LowerToTLSExecModel(GlobalAddressSDNode *GA, SelectionDAG &DAG,
 
   if (model == TLSModel::InitialExec)
     Offset = DAG.getLoad(PtrVT, dl, DAG.getEntryNode(), Offset,
-                         PseudoSourceValue::getGOT(), 0);
+                         PseudoSourceValue::getGOT(), 0, false, false, 0);
 
   // The address of the thread local variable is the add of the thread
   // pointer with the offset of the variable.
@@ -5236,7 +5259,7 @@ SDValue X86TargetLowering::LowerShift(SDValue Op, SelectionDAG &DAG) {
 
   SDValue AndNode = DAG.getNode(ISD::AND, dl, MVT::i8, ShAmt,
                                 DAG.getConstant(VTBits, MVT::i8));
-  SDValue Cond = DAG.getNode(X86ISD::CMP, dl, VT,
+  SDValue Cond = DAG.getNode(X86ISD::CMP, dl, MVT::i32,
                              AndNode, DAG.getConstant(0, MVT::i8));
 
   SDValue Hi, Lo;
@@ -5285,7 +5308,8 @@ SDValue X86TargetLowering::LowerSINT_TO_FP(SDValue Op, SelectionDAG &DAG) {
   SDValue StackSlot = DAG.getFrameIndex(SSFI, getPointerTy());
   SDValue Chain = DAG.getStore(DAG.getEntryNode(), dl, Op.getOperand(0),
                                StackSlot,
-                               PseudoSourceValue::getFixedStack(SSFI), 0);
+                               PseudoSourceValue::getFixedStack(SSFI), 0,
+                               false, false, 0);
   return BuildFILD(Op, SrcVT, Chain, StackSlot, DAG);
 }
 
@@ -5320,7 +5344,8 @@ SDValue X86TargetLowering::BuildFILD(SDValue Op, EVT SrcVT, SDValue Chain,
     };
     Chain = DAG.getNode(X86ISD::FST, dl, Tys, Ops, array_lengthof(Ops));
     Result = DAG.getLoad(Op.getValueType(), dl, Chain, StackSlot,
-                         PseudoSourceValue::getFixedStack(SSFI), 0);
+                         PseudoSourceValue::getFixedStack(SSFI), 0,
+                         false, false, 0);
   }
 
   return Result;
@@ -5393,12 +5418,12 @@ SDValue X86TargetLowering::LowerUINT_TO_FP_i64(SDValue Op, SelectionDAG &DAG) {
   SDValue Unpck1 = getUnpackl(DAG, dl, MVT::v4i32, XR1, XR2);
   SDValue CLod0 = DAG.getLoad(MVT::v4i32, dl, DAG.getEntryNode(), CPIdx0,
                               PseudoSourceValue::getConstantPool(), 0,
-                              false, 16);
+                              false, false, 16);
   SDValue Unpck2 = getUnpackl(DAG, dl, MVT::v4i32, Unpck1, CLod0);
   SDValue XR2F = DAG.getNode(ISD::BIT_CONVERT, dl, MVT::v2f64, Unpck2);
   SDValue CLod1 = DAG.getLoad(MVT::v2f64, dl, CLod0.getValue(1), CPIdx1,
                               PseudoSourceValue::getConstantPool(), 0,
-                              false, 16);
+                              false, false, 16);
   SDValue Sub = DAG.getNode(ISD::FSUB, dl, MVT::v2f64, XR2F, CLod1);
 
   // Add the halves; easiest way is to swap them into another reg first.
@@ -5485,9 +5510,9 @@ SDValue X86TargetLowering::LowerUINT_TO_FP(SDValue Op, SelectionDAG &DAG) {
   SDValue OffsetSlot = DAG.getNode(ISD::ADD, dl,
                                    getPointerTy(), StackSlot, WordOff);
   SDValue Store1 = DAG.getStore(DAG.getEntryNode(), dl, Op.getOperand(0),
-                                StackSlot, NULL, 0);
+                                StackSlot, NULL, 0, false, false, 0);
   SDValue Store2 = DAG.getStore(Store1, dl, DAG.getConstant(0, MVT::i32),
-                                OffsetSlot, NULL, 0);
+                                OffsetSlot, NULL, 0, false, false, 0);
   return BuildFILD(Op, MVT::i64, Store2, StackSlot, DAG);
 }
 
@@ -5535,7 +5560,8 @@ FP_TO_INTHelper(SDValue Op, SelectionDAG &DAG, bool IsSigned) {
   if (isScalarFPTypeInSSEReg(Op.getOperand(0).getValueType())) {
     assert(DstTy == MVT::i64 && "Invalid FP_TO_SINT to lower!");
     Chain = DAG.getStore(Chain, dl, Value, StackSlot,
-                         PseudoSourceValue::getFixedStack(SSFI), 0);
+                         PseudoSourceValue::getFixedStack(SSFI), 0,
+                         false, false, 0);
     SDVTList Tys = DAG.getVTList(Op.getOperand(0).getValueType(), MVT::Other);
     SDValue Ops[] = {
       Chain, StackSlot, DAG.getValueType(Op.getOperand(0).getValueType())
@@ -5569,7 +5595,7 @@ SDValue X86TargetLowering::LowerFP_TO_SINT(SDValue Op, SelectionDAG &DAG) {
 
   // Load the result.
   return DAG.getLoad(Op.getValueType(), Op.getDebugLoc(),
-                     FIST, StackSlot, NULL, 0);
+                     FIST, StackSlot, NULL, 0, false, false, 0);
 }
 
 SDValue X86TargetLowering::LowerFP_TO_UINT(SDValue Op, SelectionDAG &DAG) {
@@ -5579,7 +5605,7 @@ SDValue X86TargetLowering::LowerFP_TO_UINT(SDValue Op, SelectionDAG &DAG) {
 
   // Load the result.
   return DAG.getLoad(Op.getValueType(), Op.getDebugLoc(),
-                     FIST, StackSlot, NULL, 0);
+                     FIST, StackSlot, NULL, 0, false, false, 0);
 }
 
 SDValue X86TargetLowering::LowerFABS(SDValue Op, SelectionDAG &DAG) {
@@ -5604,8 +5630,8 @@ SDValue X86TargetLowering::LowerFABS(SDValue Op, SelectionDAG &DAG) {
   Constant *C = ConstantVector::get(CV);
   SDValue CPIdx = DAG.getConstantPool(C, getPointerTy(), 16);
   SDValue Mask = DAG.getLoad(VT, dl, DAG.getEntryNode(), CPIdx,
-                               PseudoSourceValue::getConstantPool(), 0,
-                               false, 16);
+                             PseudoSourceValue::getConstantPool(), 0,
+                             false, false, 16);
   return DAG.getNode(X86ISD::FAND, dl, VT, Op.getOperand(0), Mask);
 }
 
@@ -5631,8 +5657,8 @@ SDValue X86TargetLowering::LowerFNEG(SDValue Op, SelectionDAG &DAG) {
   Constant *C = ConstantVector::get(CV);
   SDValue CPIdx = DAG.getConstantPool(C, getPointerTy(), 16);
   SDValue Mask = DAG.getLoad(VT, dl, DAG.getEntryNode(), CPIdx,
-                               PseudoSourceValue::getConstantPool(), 0,
-                               false, 16);
+                             PseudoSourceValue::getConstantPool(), 0,
+                             false, false, 16);
   if (VT.isVector()) {
     return DAG.getNode(ISD::BIT_CONVERT, dl, VT,
                        DAG.getNode(ISD::XOR, dl, MVT::v2i64,
@@ -5680,8 +5706,8 @@ SDValue X86TargetLowering::LowerFCOPYSIGN(SDValue Op, SelectionDAG &DAG) {
   Constant *C = ConstantVector::get(CV);
   SDValue CPIdx = DAG.getConstantPool(C, getPointerTy(), 16);
   SDValue Mask1 = DAG.getLoad(SrcVT, dl, DAG.getEntryNode(), CPIdx,
-                                PseudoSourceValue::getConstantPool(), 0,
-                                false, 16);
+                              PseudoSourceValue::getConstantPool(), 0,
+                              false, false, 16);
   SDValue SignBit = DAG.getNode(X86ISD::FAND, dl, SrcVT, Op1, Mask1);
 
   // Shift sign bit right or left if the two operands have different types.
@@ -5709,8 +5735,8 @@ SDValue X86TargetLowering::LowerFCOPYSIGN(SDValue Op, SelectionDAG &DAG) {
   C = ConstantVector::get(CV);
   CPIdx = DAG.getConstantPool(C, getPointerTy(), 16);
   SDValue Mask2 = DAG.getLoad(VT, dl, DAG.getEntryNode(), CPIdx,
-                                PseudoSourceValue::getConstantPool(), 0,
-                                false, 16);
+                              PseudoSourceValue::getConstantPool(), 0,
+                              false, false, 16);
   SDValue Val = DAG.getNode(X86ISD::FAND, dl, VT, Op0, Mask2);
 
   // Or the value with the sign bit.
@@ -5862,26 +5888,31 @@ SDValue X86TargetLowering::EmitCmp(SDValue Op0, SDValue Op1, unsigned X86CC,
 
 /// LowerToBT - Result of 'and' is compared against zero. Turn it into a BT node
 /// if it's possible.
-static SDValue LowerToBT(SDValue Op0, ISD::CondCode CC,
+static SDValue LowerToBT(SDValue And, ISD::CondCode CC,
                          DebugLoc dl, SelectionDAG &DAG) {
+  SDValue Op0 = And.getOperand(0);
+  SDValue Op1 = And.getOperand(1);
+  if (Op0.getOpcode() == ISD::TRUNCATE)
+    Op0 = Op0.getOperand(0);
+  if (Op1.getOpcode() == ISD::TRUNCATE)
+    Op1 = Op1.getOperand(0);
+
   SDValue LHS, RHS;
-  if (Op0.getOperand(1).getOpcode() == ISD::SHL) {
-    if (ConstantSDNode *Op010C =
-        dyn_cast<ConstantSDNode>(Op0.getOperand(1).getOperand(0)))
-      if (Op010C->getZExtValue() == 1) {
-        LHS = Op0.getOperand(0);
-        RHS = Op0.getOperand(1).getOperand(1);
+  if (Op1.getOpcode() == ISD::SHL) {
+    if (ConstantSDNode *And10C = dyn_cast<ConstantSDNode>(Op1.getOperand(0)))
+      if (And10C->getZExtValue() == 1) {
+        LHS = Op0;
+        RHS = Op1.getOperand(1);
       }
-  } else if (Op0.getOperand(0).getOpcode() == ISD::SHL) {
-    if (ConstantSDNode *Op000C =
-        dyn_cast<ConstantSDNode>(Op0.getOperand(0).getOperand(0)))
-      if (Op000C->getZExtValue() == 1) {
-        LHS = Op0.getOperand(1);
-        RHS = Op0.getOperand(0).getOperand(1);
+  } else if (Op0.getOpcode() == ISD::SHL) {
+    if (ConstantSDNode *And00C = dyn_cast<ConstantSDNode>(Op0.getOperand(0)))
+      if (And00C->getZExtValue() == 1) {
+        LHS = Op1;
+        RHS = Op0.getOperand(1);
       }
-  } else if (Op0.getOperand(1).getOpcode() == ISD::Constant) {
-    ConstantSDNode *AndRHS = cast<ConstantSDNode>(Op0.getOperand(1));
-    SDValue AndLHS = Op0.getOperand(0);
+  } else if (Op1.getOpcode() == ISD::Constant) {
+    ConstantSDNode *AndRHS = cast<ConstantSDNode>(Op1);
+    SDValue AndLHS = Op0;
     if (AndRHS->getZExtValue() == 1 && AndLHS.getOpcode() == ISD::SRL) {
       LHS = AndLHS.getOperand(0);
       RHS = AndLHS.getOperand(1);
@@ -5931,6 +5962,21 @@ SDValue X86TargetLowering::LowerSETCC(SDValue Op, SelectionDAG &DAG) {
       return NewSetCC;
   }
 
+  // Look for "(setcc) == / != 1" to avoid unncessary setcc.
+  if (Op0.getOpcode() == X86ISD::SETCC &&
+      Op1.getOpcode() == ISD::Constant &&
+      (cast<ConstantSDNode>(Op1)->getZExtValue() == 1 ||
+       cast<ConstantSDNode>(Op1)->isNullValue()) &&
+      (CC == ISD::SETEQ || CC == ISD::SETNE)) {
+    X86::CondCode CCode = (X86::CondCode)Op0.getConstantOperandVal(0);
+    bool Invert = (CC == ISD::SETNE) ^
+      cast<ConstantSDNode>(Op1)->isNullValue();
+    if (Invert)
+      CCode = X86::GetOppositeBranchCondition(CCode);
+    return DAG.getNode(X86ISD::SETCC, dl, MVT::i8,
+                       DAG.getConstant(CCode, MVT::i8), Op0.getOperand(1));
+  }
+
   bool isFP = Op.getOperand(1).getValueType().isFloatingPoint();
   unsigned X86CC = TranslateX86CC(CC, isFP, Op0, Op1, DAG);
   if (X86CC == X86::COND_INVALID)
@@ -6433,8 +6479,7 @@ X86TargetLowering::EmitTargetCodeForMemset(SelectionDAG &DAG, DebugLoc dl,
         LowerCallTo(Chain, Type::getVoidTy(*DAG.getContext()),
                     false, false, false, false,
                     0, CallingConv::C, false, /*isReturnValueUsed=*/false,
-                    DAG.getExternalSymbol(bzeroEntry, IntPtr), Args, DAG, dl,
-                    DAG.GetOrdering(Chain.getNode()));
+                    DAG.getExternalSymbol(bzeroEntry, IntPtr), Args, DAG, dl);
       return CallResult.second;
     }
 
@@ -6618,7 +6663,8 @@ SDValue X86TargetLowering::LowerVASTART(SDValue Op, SelectionDAG &DAG) {
     // vastart just stores the address of the VarArgsFrameIndex slot into the
     // memory location argument.
     SDValue FR = DAG.getFrameIndex(VarArgsFrameIndex, getPointerTy());
-    return DAG.getStore(Op.getOperand(0), dl, FR, Op.getOperand(1), SV, 0);
+    return DAG.getStore(Op.getOperand(0), dl, FR, Op.getOperand(1), SV, 0,
+                        false, false, 0);
   }
 
   // __va_list_tag:
@@ -6630,8 +6676,8 @@ SDValue X86TargetLowering::LowerVASTART(SDValue Op, SelectionDAG &DAG) {
   SDValue FIN = Op.getOperand(1);
   // Store gp_offset
   SDValue Store = DAG.getStore(Op.getOperand(0), dl,
-                                 DAG.getConstant(VarArgsGPOffset, MVT::i32),
-                                 FIN, SV, 0);
+                               DAG.getConstant(VarArgsGPOffset, MVT::i32),
+                               FIN, SV, 0, false, false, 0);
   MemOps.push_back(Store);
 
   // Store fp_offset
@@ -6639,21 +6685,23 @@ SDValue X86TargetLowering::LowerVASTART(SDValue Op, SelectionDAG &DAG) {
                     FIN, DAG.getIntPtrConstant(4));
   Store = DAG.getStore(Op.getOperand(0), dl,
                        DAG.getConstant(VarArgsFPOffset, MVT::i32),
-                       FIN, SV, 0);
+                       FIN, SV, 0, false, false, 0);
   MemOps.push_back(Store);
 
   // Store ptr to overflow_arg_area
   FIN = DAG.getNode(ISD::ADD, dl, getPointerTy(),
                     FIN, DAG.getIntPtrConstant(4));
   SDValue OVFIN = DAG.getFrameIndex(VarArgsFrameIndex, getPointerTy());
-  Store = DAG.getStore(Op.getOperand(0), dl, OVFIN, FIN, SV, 0);
+  Store = DAG.getStore(Op.getOperand(0), dl, OVFIN, FIN, SV, 0,
+                       false, false, 0);
   MemOps.push_back(Store);
 
   // Store ptr to reg_save_area.
   FIN = DAG.getNode(ISD::ADD, dl, getPointerTy(),
                     FIN, DAG.getIntPtrConstant(8));
   SDValue RSFIN = DAG.getFrameIndex(RegSaveFrameIndex, getPointerTy());
-  Store = DAG.getStore(Op.getOperand(0), dl, RSFIN, FIN, SV, 0);
+  Store = DAG.getStore(Op.getOperand(0), dl, RSFIN, FIN, SV, 0,
+                       false, false, 0);
   MemOps.push_back(Store);
   return DAG.getNode(ISD::TokenFactor, dl, MVT::Other,
                      &MemOps[0], MemOps.size());
@@ -6939,13 +6987,13 @@ SDValue X86TargetLowering::LowerRETURNADDR(SDValue Op, SelectionDAG &DAG) {
     return DAG.getLoad(getPointerTy(), dl, DAG.getEntryNode(),
                        DAG.getNode(ISD::ADD, dl, getPointerTy(),
                                    FrameAddr, Offset),
-                       NULL, 0);
+                       NULL, 0, false, false, 0);
   }
 
   // Just load the return address.
   SDValue RetAddrFI = getReturnAddressFrameIndex(DAG);
   return DAG.getLoad(getPointerTy(), dl, DAG.getEntryNode(),
-                     RetAddrFI, NULL, 0);
+                     RetAddrFI, NULL, 0, false, false, 0);
 }
 
 SDValue X86TargetLowering::LowerFRAMEADDR(SDValue Op, SelectionDAG &DAG) {
@@ -6957,7 +7005,8 @@ SDValue X86TargetLowering::LowerFRAMEADDR(SDValue Op, SelectionDAG &DAG) {
   unsigned FrameReg = Subtarget->is64Bit() ? X86::RBP : X86::EBP;
   SDValue FrameAddr = DAG.getCopyFromReg(DAG.getEntryNode(), dl, FrameReg, VT);
   while (Depth--)
-    FrameAddr = DAG.getLoad(VT, dl, DAG.getEntryNode(), FrameAddr, NULL, 0);
+    FrameAddr = DAG.getLoad(VT, dl, DAG.getEntryNode(), FrameAddr, NULL, 0,
+                            false, false, 0);
   return FrameAddr;
 }
 
@@ -6981,7 +7030,7 @@ SDValue X86TargetLowering::LowerEH_RETURN(SDValue Op, SelectionDAG &DAG)
   SDValue StoreAddr = DAG.getNode(ISD::SUB, dl, getPointerTy(), Frame,
                                   DAG.getIntPtrConstant(-TD->getPointerSize()));
   StoreAddr = DAG.getNode(ISD::ADD, dl, getPointerTy(), StoreAddr, Offset);
-  Chain = DAG.getStore(Chain, dl, Handler, StoreAddr, NULL, 0);
+  Chain = DAG.getStore(Chain, dl, Handler, StoreAddr, NULL, 0, false, false, 0);
   Chain = DAG.getCopyToReg(Chain, dl, StoreAddrReg, StoreAddr);
   MF.getRegInfo().addLiveOut(StoreAddrReg);
 
@@ -7016,11 +7065,12 @@ SDValue X86TargetLowering::LowerTRAMPOLINE(SDValue Op,
     unsigned OpCode = ((MOV64ri | N86R11) << 8) | REX_WB; // movabsq r11
     SDValue Addr = Trmp;
     OutChains[0] = DAG.getStore(Root, dl, DAG.getConstant(OpCode, MVT::i16),
-                                Addr, TrmpAddr, 0);
+                                Addr, TrmpAddr, 0, false, false, 0);
 
     Addr = DAG.getNode(ISD::ADD, dl, MVT::i64, Trmp,
                        DAG.getConstant(2, MVT::i64));
-    OutChains[1] = DAG.getStore(Root, dl, FPtr, Addr, TrmpAddr, 2, false, 2);
+    OutChains[1] = DAG.getStore(Root, dl, FPtr, Addr, TrmpAddr, 2,
+                                false, false, 2);
 
     // Load the 'nest' parameter value into R10.
     // R10 is specified in X86CallingConv.td
@@ -7028,24 +7078,25 @@ SDValue X86TargetLowering::LowerTRAMPOLINE(SDValue Op,
     Addr = DAG.getNode(ISD::ADD, dl, MVT::i64, Trmp,
                        DAG.getConstant(10, MVT::i64));
     OutChains[2] = DAG.getStore(Root, dl, DAG.getConstant(OpCode, MVT::i16),
-                                Addr, TrmpAddr, 10);
+                                Addr, TrmpAddr, 10, false, false, 0);
 
     Addr = DAG.getNode(ISD::ADD, dl, MVT::i64, Trmp,
                        DAG.getConstant(12, MVT::i64));
-    OutChains[3] = DAG.getStore(Root, dl, Nest, Addr, TrmpAddr, 12, false, 2);
+    OutChains[3] = DAG.getStore(Root, dl, Nest, Addr, TrmpAddr, 12,
+                                false, false, 2);
 
     // Jump to the nested function.
     OpCode = (JMP64r << 8) | REX_WB; // jmpq *...
     Addr = DAG.getNode(ISD::ADD, dl, MVT::i64, Trmp,
                        DAG.getConstant(20, MVT::i64));
     OutChains[4] = DAG.getStore(Root, dl, DAG.getConstant(OpCode, MVT::i16),
-                                Addr, TrmpAddr, 20);
+                                Addr, TrmpAddr, 20, false, false, 0);
 
     unsigned char ModRM = N86R11 | (4 << 3) | (3 << 6); // ...r11
     Addr = DAG.getNode(ISD::ADD, dl, MVT::i64, Trmp,
                        DAG.getConstant(22, MVT::i64));
     OutChains[5] = DAG.getStore(Root, dl, DAG.getConstant(ModRM, MVT::i8), Addr,
-                                TrmpAddr, 22);
+                                TrmpAddr, 22, false, false, 0);
 
     SDValue Ops[] =
       { Trmp, DAG.getNode(ISD::TokenFactor, dl, MVT::Other, OutChains, 6) };
@@ -7105,21 +7156,23 @@ SDValue X86TargetLowering::LowerTRAMPOLINE(SDValue Op,
     const unsigned char N86Reg = RegInfo->getX86RegNum(NestReg);
     OutChains[0] = DAG.getStore(Root, dl,
                                 DAG.getConstant(MOV32ri|N86Reg, MVT::i8),
-                                Trmp, TrmpAddr, 0);
+                                Trmp, TrmpAddr, 0, false, false, 0);
 
     Addr = DAG.getNode(ISD::ADD, dl, MVT::i32, Trmp,
                        DAG.getConstant(1, MVT::i32));
-    OutChains[1] = DAG.getStore(Root, dl, Nest, Addr, TrmpAddr, 1, false, 1);
+    OutChains[1] = DAG.getStore(Root, dl, Nest, Addr, TrmpAddr, 1,
+                                false, false, 1);
 
     const unsigned char JMP = 0xE9; // jmp <32bit dst> opcode.
     Addr = DAG.getNode(ISD::ADD, dl, MVT::i32, Trmp,
                        DAG.getConstant(5, MVT::i32));
     OutChains[2] = DAG.getStore(Root, dl, DAG.getConstant(JMP, MVT::i8), Addr,
-                                TrmpAddr, 5, false, 1);
+                                TrmpAddr, 5, false, false, 1);
 
     Addr = DAG.getNode(ISD::ADD, dl, MVT::i32, Trmp,
                        DAG.getConstant(6, MVT::i32));
-    OutChains[3] = DAG.getStore(Root, dl, Disp, Addr, TrmpAddr, 6, false, 1);
+    OutChains[3] = DAG.getStore(Root, dl, Disp, Addr, TrmpAddr, 6,
+                                false, false, 1);
 
     SDValue Ops[] =
       { Trmp, DAG.getNode(ISD::TokenFactor, dl, MVT::Other, OutChains, 4) };
@@ -7162,7 +7215,8 @@ SDValue X86TargetLowering::LowerFLT_ROUNDS_(SDValue Op, SelectionDAG &DAG) {
                               DAG.getEntryNode(), StackSlot);
 
   // Load FP Control Word from stack slot
-  SDValue CWD = DAG.getLoad(MVT::i16, dl, Chain, StackSlot, NULL, 0);
+  SDValue CWD = DAG.getLoad(MVT::i16, dl, Chain, StackSlot, NULL, 0,
+                            false, false, 0);
 
   // Transform as necessary
   SDValue CWD1 =
@@ -7526,7 +7580,8 @@ void X86TargetLowering::ReplaceNodeResults(SDNode *N,
     if (FIST.getNode() != 0) {
       EVT VT = N->getValueType(0);
       // Return a load from the stack slot.
-      Results.push_back(DAG.getLoad(VT, dl, FIST, StackSlot, NULL, 0));
+      Results.push_back(DAG.getLoad(VT, dl, FIST, StackSlot, NULL, 0,
+                                    false, false, 0));
     }
     return;
   }
@@ -7641,6 +7696,7 @@ const char *X86TargetLowering::getTargetNodeName(unsigned Opcode) const {
   case X86ISD::INSERTPS:           return "X86ISD::INSERTPS";
   case X86ISD::PINSRB:             return "X86ISD::PINSRB";
   case X86ISD::PINSRW:             return "X86ISD::PINSRW";
+  case X86ISD::MMX_PINSRW:         return "X86ISD::MMX_PINSRW";
   case X86ISD::PSHUFB:             return "X86ISD::PSHUFB";
   case X86ISD::FMAX:               return "X86ISD::FMAX";
   case X86ISD::FMIN:               return "X86ISD::FMIN";
@@ -7742,13 +7798,13 @@ bool X86TargetLowering::isLegalAddressingMode(const AddrMode &AM,
 
 
 bool X86TargetLowering::isTruncateFree(const Type *Ty1, const Type *Ty2) const {
-  if (!Ty1->isInteger() || !Ty2->isInteger())
+  if (!Ty1->isIntegerTy() || !Ty2->isIntegerTy())
     return false;
   unsigned NumBits1 = Ty1->getPrimitiveSizeInBits();
   unsigned NumBits2 = Ty2->getPrimitiveSizeInBits();
   if (NumBits1 <= NumBits2)
     return false;
-  return Subtarget->is64Bit() || NumBits1 < 64;
+  return true;
 }
 
 bool X86TargetLowering::isTruncateFree(EVT VT1, EVT VT2) const {
@@ -7758,12 +7814,12 @@ bool X86TargetLowering::isTruncateFree(EVT VT1, EVT VT2) const {
   unsigned NumBits2 = VT2.getSizeInBits();
   if (NumBits1 <= NumBits2)
     return false;
-  return Subtarget->is64Bit() || NumBits1 < 64;
+  return true;
 }
 
 bool X86TargetLowering::isZExtFree(const Type *Ty1, const Type *Ty2) const {
   // x86-64 implicitly zero-extends 32-bit results in 64-bit registers.
-  return Ty1->isInteger(32) && Ty2->isInteger(64) && Subtarget->is64Bit();
+  return Ty1->isIntegerTy(32) && Ty2->isIntegerTy(64) && Subtarget->is64Bit();
 }
 
 bool X86TargetLowering::isZExtFree(EVT VT1, EVT VT2) const {
@@ -8747,10 +8803,11 @@ static SDValue PerformShuffleCombine(SDNode *N, SelectionDAG &DAG,
     if (DAG.InferPtrAlignment(LD->getBasePtr()) >= 16)
       return DAG.getLoad(VT, dl, LD->getChain(), LD->getBasePtr(),
                          LD->getSrcValue(), LD->getSrcValueOffset(),
-                         LD->isVolatile());
+                         LD->isVolatile(), LD->isNonTemporal(), 0);
     return DAG.getLoad(VT, dl, LD->getChain(), LD->getBasePtr(),
                        LD->getSrcValue(), LD->getSrcValueOffset(),
-                       LD->isVolatile(), LD->getAlignment());
+                       LD->isVolatile(), LD->isNonTemporal(),
+                       LD->getAlignment());
   } else if (NumElems == 4 && LastLoadedElt == 1) {
     SDVTList Tys = DAG.getVTList(MVT::v2i64, MVT::Other);
     SDValue Ops[] = { LD->getChain(), LD->getBasePtr() };
@@ -8770,10 +8827,9 @@ static SDValue PerformSELECTCombine(SDNode *N, SelectionDAG &DAG,
   SDValue RHS = N->getOperand(2);
 
   // If we have SSE[12] support, try to form min/max nodes. SSE min/max
-  // instructions have the peculiarity that if either operand is a NaN,
-  // they chose what we call the RHS operand (and as such are not symmetric).
-  // It happens that this matches the semantics of the common C idiom
-  // x<y?x:y and related forms, so we can recognize these cases.
+  // instructions match the semantics of the common C idiom x<y?x:y but not
+  // x<=y?x:y, because of how they handle negative zero (which can be
+  // ignored in unsafe-math mode).
   if (Subtarget->hasSSE2() &&
       (LHS.getValueType() == MVT::f32 || LHS.getValueType() == MVT::f64) &&
       Cond.getOpcode() == ISD::SETCC) {
@@ -8781,36 +8837,34 @@ static SDValue PerformSELECTCombine(SDNode *N, SelectionDAG &DAG,
 
     unsigned Opcode = 0;
     // Check for x CC y ? x : y.
-    if (LHS == Cond.getOperand(0) && RHS == Cond.getOperand(1)) {
+    if (DAG.isEqualTo(LHS, Cond.getOperand(0)) &&
+        DAG.isEqualTo(RHS, Cond.getOperand(1))) {
       switch (CC) {
       default: break;
       case ISD::SETULT:
-        // This can be a min if we can prove that at least one of the operands
-        // is not a nan.
-        if (!FiniteOnlyFPMath()) {
-          if (DAG.isKnownNeverNaN(RHS)) {
-            // Put the potential NaN in the RHS so that SSE will preserve it.
-            std::swap(LHS, RHS);
-          } else if (!DAG.isKnownNeverNaN(LHS))
+        // Converting this to a min would handle NaNs incorrectly, and swapping
+        // the operands would cause it to handle comparisons between positive
+        // and negative zero incorrectly.
+        if (!FiniteOnlyFPMath() &&
+            (!DAG.isKnownNeverNaN(LHS) || !DAG.isKnownNeverNaN(RHS))) {
+          if (!UnsafeFPMath &&
+              !(DAG.isKnownNeverZero(LHS) || DAG.isKnownNeverZero(RHS)))
             break;
+          std::swap(LHS, RHS);
         }
         Opcode = X86ISD::FMIN;
         break;
       case ISD::SETOLE:
-        // This can be a min if we can prove that at least one of the operands
-        // is not a nan.
-        if (!FiniteOnlyFPMath()) {
-          if (DAG.isKnownNeverNaN(LHS)) {
-            // Put the potential NaN in the RHS so that SSE will preserve it.
-            std::swap(LHS, RHS);
-          } else if (!DAG.isKnownNeverNaN(RHS))
-            break;
-        }
+        // Converting this to a min would handle comparisons between positive
+        // and negative zero incorrectly.
+        if (!UnsafeFPMath &&
+            !DAG.isKnownNeverZero(LHS) && !DAG.isKnownNeverZero(RHS))
+          break;
         Opcode = X86ISD::FMIN;
         break;
       case ISD::SETULE:
-        // This can be a min, but if either operand is a NaN we need it to
-        // preserve the original LHS.
+        // Converting this to a min would handle both negative zeros and NaNs
+        // incorrectly, but we can swap the operands to fix both.
         std::swap(LHS, RHS);
       case ISD::SETOLT:
       case ISD::SETLT:
@@ -8819,32 +8873,29 @@ static SDValue PerformSELECTCombine(SDNode *N, SelectionDAG &DAG,
         break;
 
       case ISD::SETOGE:
-        // This can be a max if we can prove that at least one of the operands
-        // is not a nan.
-        if (!FiniteOnlyFPMath()) {
-          if (DAG.isKnownNeverNaN(LHS)) {
-            // Put the potential NaN in the RHS so that SSE will preserve it.
-            std::swap(LHS, RHS);
-          } else if (!DAG.isKnownNeverNaN(RHS))
-            break;
-        }
+        // Converting this to a max would handle comparisons between positive
+        // and negative zero incorrectly.
+        if (!UnsafeFPMath &&
+            !DAG.isKnownNeverZero(LHS) && !DAG.isKnownNeverZero(LHS))
+          break;
         Opcode = X86ISD::FMAX;
         break;
       case ISD::SETUGT:
-        // This can be a max if we can prove that at least one of the operands
-        // is not a nan.
-        if (!FiniteOnlyFPMath()) {
-          if (DAG.isKnownNeverNaN(RHS)) {
-            // Put the potential NaN in the RHS so that SSE will preserve it.
-            std::swap(LHS, RHS);
-          } else if (!DAG.isKnownNeverNaN(LHS))
+        // Converting this to a max would handle NaNs incorrectly, and swapping
+        // the operands would cause it to handle comparisons between positive
+        // and negative zero incorrectly.
+        if (!FiniteOnlyFPMath() &&
+            (!DAG.isKnownNeverNaN(LHS) || !DAG.isKnownNeverNaN(RHS))) {
+          if (!UnsafeFPMath &&
+              !(DAG.isKnownNeverZero(LHS) || DAG.isKnownNeverZero(RHS)))
             break;
+          std::swap(LHS, RHS);
         }
         Opcode = X86ISD::FMAX;
         break;
       case ISD::SETUGE:
-        // This can be a max, but if either operand is a NaN we need it to
-        // preserve the original LHS.
+        // Converting this to a max would handle both negative zeros and NaNs
+        // incorrectly, but we can swap the operands to fix both.
         std::swap(LHS, RHS);
       case ISD::SETOGT:
       case ISD::SETGT:
@@ -8853,36 +8904,33 @@ static SDValue PerformSELECTCombine(SDNode *N, SelectionDAG &DAG,
         break;
       }
     // Check for x CC y ? y : x -- a min/max with reversed arms.
-    } else if (LHS == Cond.getOperand(1) && RHS == Cond.getOperand(0)) {
+    } else if (DAG.isEqualTo(LHS, Cond.getOperand(1)) &&
+               DAG.isEqualTo(RHS, Cond.getOperand(0))) {
       switch (CC) {
       default: break;
       case ISD::SETOGE:
-        // This can be a min if we can prove that at least one of the operands
-        // is not a nan.
-        if (!FiniteOnlyFPMath()) {
-          if (DAG.isKnownNeverNaN(RHS)) {
-            // Put the potential NaN in the RHS so that SSE will preserve it.
-            std::swap(LHS, RHS);
-          } else if (!DAG.isKnownNeverNaN(LHS))
+        // Converting this to a min would handle comparisons between positive
+        // and negative zero incorrectly, and swapping the operands would
+        // cause it to handle NaNs incorrectly.
+        if (!UnsafeFPMath &&
+            !(DAG.isKnownNeverZero(LHS) || DAG.isKnownNeverZero(RHS))) {
+          if (!FiniteOnlyFPMath() &&
+              (!DAG.isKnownNeverNaN(LHS) || !DAG.isKnownNeverNaN(RHS)))
             break;
+          std::swap(LHS, RHS);
         }
         Opcode = X86ISD::FMIN;
         break;
       case ISD::SETUGT:
-        // This can be a min if we can prove that at least one of the operands
-        // is not a nan.
-        if (!FiniteOnlyFPMath()) {
-          if (DAG.isKnownNeverNaN(LHS)) {
-            // Put the potential NaN in the RHS so that SSE will preserve it.
-            std::swap(LHS, RHS);
-          } else if (!DAG.isKnownNeverNaN(RHS))
-            break;
-        }
+        // Converting this to a min would handle NaNs incorrectly.
+        if (!UnsafeFPMath &&
+            (!DAG.isKnownNeverNaN(LHS) || !DAG.isKnownNeverNaN(RHS)))
+          break;
         Opcode = X86ISD::FMIN;
         break;
       case ISD::SETUGE:
-        // This can be a min, but if either operand is a NaN we need it to
-        // preserve the original LHS.
+        // Converting this to a min would handle both negative zeros and NaNs
+        // incorrectly, but we can swap the operands to fix both.
         std::swap(LHS, RHS);
       case ISD::SETOGT:
       case ISD::SETGT:
@@ -8891,32 +8939,28 @@ static SDValue PerformSELECTCombine(SDNode *N, SelectionDAG &DAG,
         break;
 
       case ISD::SETULT:
-        // This can be a max if we can prove that at least one of the operands
-        // is not a nan.
-        if (!FiniteOnlyFPMath()) {
-          if (DAG.isKnownNeverNaN(LHS)) {
-            // Put the potential NaN in the RHS so that SSE will preserve it.
-            std::swap(LHS, RHS);
-          } else if (!DAG.isKnownNeverNaN(RHS))
-            break;
-        }
+        // Converting this to a max would handle NaNs incorrectly.
+        if (!FiniteOnlyFPMath() &&
+            (!DAG.isKnownNeverNaN(LHS) || !DAG.isKnownNeverNaN(RHS)))
+          break;
         Opcode = X86ISD::FMAX;
         break;
       case ISD::SETOLE:
-        // This can be a max if we can prove that at least one of the operands
-        // is not a nan.
-        if (!FiniteOnlyFPMath()) {
-          if (DAG.isKnownNeverNaN(RHS)) {
-            // Put the potential NaN in the RHS so that SSE will preserve it.
-            std::swap(LHS, RHS);
-          } else if (!DAG.isKnownNeverNaN(LHS))
+        // Converting this to a max would handle comparisons between positive
+        // and negative zero incorrectly, and swapping the operands would
+        // cause it to handle NaNs incorrectly.
+        if (!UnsafeFPMath &&
+            !DAG.isKnownNeverZero(LHS) && !DAG.isKnownNeverZero(RHS)) {
+          if (!FiniteOnlyFPMath() &&
+              (!DAG.isKnownNeverNaN(LHS) || !DAG.isKnownNeverNaN(RHS)))
             break;
+          std::swap(LHS, RHS);
         }
         Opcode = X86ISD::FMAX;
         break;
       case ISD::SETULE:
-        // This can be a max, but if either operand is a NaN we need it to
-        // preserve the original LHS.
+        // Converting this to a max would handle both negative zeros and NaNs
+        // incorrectly, but we can swap the operands to fix both.
         std::swap(LHS, RHS);
       case ISD::SETOLT:
       case ISD::SETLT:
@@ -9141,10 +9185,6 @@ static SDValue PerformCMOVCombine(SDNode *N, SelectionDAG &DAG,
 /// LEA + SHL, LEA + LEA.
 static SDValue PerformMulCombine(SDNode *N, SelectionDAG &DAG,
                                  TargetLowering::DAGCombinerInfo &DCI) {
-  if (DAG.getMachineFunction().
-      getFunction()->hasFnAttr(Attribute::OptimizeForSize))
-    return SDValue();
-
   if (DCI.isBeforeLegalize() || DCI.isCalledByLegalizer())
     return SDValue();
 
@@ -9283,7 +9323,7 @@ static SDValue PerformShiftCombine(SDNode* N, SelectionDAG &DAG,
       }
     } else if (InVec.getOpcode() == ISD::INSERT_VECTOR_ELT) {
        if (ConstantSDNode *C = dyn_cast<ConstantSDNode>(InVec.getOperand(2))) {
-         unsigned SplatIdx = cast<ShuffleVectorSDNode>(ShAmtOp)->getSplatIndex();
+         unsigned SplatIdx= cast<ShuffleVectorSDNode>(ShAmtOp)->getSplatIndex();
          if (C->getZExtValue() == SplatIdx)
            BaseShAmt = InVec.getOperand(1);
        }
@@ -9469,7 +9509,7 @@ static SDValue PerformSTORECombine(SDNode *N, SelectionDAG &DAG,
       SDValue NewLd = DAG.getLoad(LdVT, LdDL, Ld->getChain(),
                                   Ld->getBasePtr(), Ld->getSrcValue(),
                                   Ld->getSrcValueOffset(), Ld->isVolatile(),
-                                  Ld->getAlignment());
+                                  Ld->isNonTemporal(), Ld->getAlignment());
       SDValue NewChain = NewLd.getValue(1);
       if (TokenFactorIndex != -1) {
         Ops.push_back(NewChain);
@@ -9478,7 +9518,8 @@ static SDValue PerformSTORECombine(SDNode *N, SelectionDAG &DAG,
       }
       return DAG.getStore(NewChain, StDL, NewLd, St->getBasePtr(),
                           St->getSrcValue(), St->getSrcValueOffset(),
-                          St->isVolatile(), St->getAlignment());
+                          St->isVolatile(), St->isNonTemporal(),
+                          St->getAlignment());
     }
 
     // Otherwise, lower to two pairs of 32-bit loads / stores.
@@ -9488,10 +9529,11 @@ static SDValue PerformSTORECombine(SDNode *N, SelectionDAG &DAG,
 
     SDValue LoLd = DAG.getLoad(MVT::i32, LdDL, Ld->getChain(), LoAddr,
                                Ld->getSrcValue(), Ld->getSrcValueOffset(),
-                               Ld->isVolatile(), Ld->getAlignment());
+                               Ld->isVolatile(), Ld->isNonTemporal(),
+                               Ld->getAlignment());
     SDValue HiLd = DAG.getLoad(MVT::i32, LdDL, Ld->getChain(), HiAddr,
                                Ld->getSrcValue(), Ld->getSrcValueOffset()+4,
-                               Ld->isVolatile(),
+                               Ld->isVolatile(), Ld->isNonTemporal(),
                                MinAlign(Ld->getAlignment(), 4));
 
     SDValue NewChain = LoLd.getValue(1);
@@ -9508,11 +9550,13 @@ static SDValue PerformSTORECombine(SDNode *N, SelectionDAG &DAG,
 
     SDValue LoSt = DAG.getStore(NewChain, StDL, LoLd, LoAddr,
                                 St->getSrcValue(), St->getSrcValueOffset(),
-                                St->isVolatile(), St->getAlignment());
+                                St->isVolatile(), St->isNonTemporal(),
+                                St->getAlignment());
     SDValue HiSt = DAG.getStore(NewChain, StDL, HiLd, HiAddr,
                                 St->getSrcValue(),
                                 St->getSrcValueOffset() + 4,
                                 St->isVolatile(),
+                                St->isNonTemporal(),
                                 MinAlign(St->getAlignment(), 4));
     return DAG.getNode(ISD::TokenFactor, StDL, MVT::Other, LoSt, HiSt);
   }
@@ -9695,7 +9739,7 @@ static bool LowerToBSwap(CallInst *CI) {
   // Verify this is a simple bswap.
   if (CI->getNumOperands() != 2 ||
       CI->getType() != CI->getOperand(1)->getType() ||
-      !CI->getType()->isInteger())
+      !CI->getType()->isIntegerTy())
     return false;
 
   const IntegerType *Ty = dyn_cast<IntegerType>(CI->getType());
@@ -9744,17 +9788,26 @@ bool X86TargetLowering::ExpandInlineAsm(CallInst *CI) const {
       return LowerToBSwap(CI);
     }
     // rorw $$8, ${0:w}  -->  llvm.bswap.i16
-    if (CI->getType()->isInteger(16) &&
+    if (CI->getType()->isIntegerTy(16) &&
         AsmPieces.size() == 3 &&
-        AsmPieces[0] == "rorw" &&
+        (AsmPieces[0] == "rorw" || AsmPieces[0] == "rolw") &&
         AsmPieces[1] == "$$8," &&
         AsmPieces[2] == "${0:w}" &&
-        IA->getConstraintString() == "=r,0,~{dirflag},~{fpsr},~{flags},~{cc}") {
-      return LowerToBSwap(CI);
+        IA->getConstraintString().compare(0, 5, "=r,0,") == 0) {
+      AsmPieces.clear();
+      SplitString(IA->getConstraintString().substr(5), AsmPieces, ",");
+      std::sort(AsmPieces.begin(), AsmPieces.end());
+      if (AsmPieces.size() == 4 &&
+          AsmPieces[0] == "~{cc}" &&
+          AsmPieces[1] == "~{dirflag}" &&
+          AsmPieces[2] == "~{flags}" &&
+          AsmPieces[3] == "~{fpsr}") {
+        return LowerToBSwap(CI);
+      }
     }
     break;
   case 3:
-    if (CI->getType()->isInteger(64) &&
+    if (CI->getType()->isIntegerTy(64) &&
         Constraints.size() >= 2 &&
         Constraints[0].Codes.size() == 1 && Constraints[0].Codes[0] == "A" &&
         Constraints[1].Codes.size() == 1 && Constraints[1].Codes[0] == "0") {
diff --git a/libclamav/c++/llvm/lib/Target/X86/X86ISelLowering.h b/libclamav/c++/llvm/lib/Target/X86/X86ISelLowering.h
index cf0eb40..ffaf1cf 100644
--- a/libclamav/c++/llvm/lib/Target/X86/X86ISelLowering.h
+++ b/libclamav/c++/llvm/lib/Target/X86/X86ISelLowering.h
@@ -180,7 +180,7 @@ namespace llvm {
 
       /// PINSRW - Insert the lower 16-bits of a 32-bit value to a vector,
       /// corresponds to X86::PINSRW.
-      PINSRW,
+      PINSRW, MMX_PINSRW,
 
       /// PSHUFB - Shuffle 16 8-bit values within a vector.
       PSHUFB,
diff --git a/libclamav/c++/llvm/lib/Target/X86/X86Instr64bit.td b/libclamav/c++/llvm/lib/Target/X86/X86Instr64bit.td
index 4ea3739..8462255 100644
--- a/libclamav/c++/llvm/lib/Target/X86/X86Instr64bit.td
+++ b/libclamav/c++/llvm/lib/Target/X86/X86Instr64bit.td
@@ -59,10 +59,11 @@ def tls64addr : ComplexPattern<i64, 4, "SelectTLSADDRAddr",
 // Pattern fragments.
 //
 
-def i64immSExt8  : PatLeaf<(i64 imm), [{
-  // i64immSExt8 predicate - True if the 64-bit immediate fits in a 8-bit
-  // sign extended field.
-  return (int64_t)N->getZExtValue() == (int8_t)N->getZExtValue();
+def i64immSExt8  : PatLeaf<(i64 immSext8)>;
+
+def GetLo32XForm : SDNodeXForm<imm, [{
+  // Transformation function: get the low 32 bits.
+  return getI32Imm((unsigned)N->getZExtValue());
 }]>;
 
 def i64immSExt32  : PatLeaf<(i64 imm), [{
@@ -71,6 +72,7 @@ def i64immSExt32  : PatLeaf<(i64 imm), [{
   return (int64_t)N->getZExtValue() == (int32_t)N->getZExtValue();
 }]>;
 
+
 def i64immZExt32  : PatLeaf<(i64 imm), [{
   // i64immZExt32 predicate - True if the 64-bit immediate fits in a 32-bit
   // unsignedsign extended field.
@@ -325,7 +327,7 @@ def MOV64ri32 : RIi32<0xC7, MRM0r, (outs GR64:$dst), (ins i64i32imm:$src),
 def MOV64rr_REV : RI<0x8B, MRMSrcReg, (outs GR64:$dst), (ins GR64:$src),
                      "mov{q}\t{$src, $dst|$dst, $src}", []>;
 
-let canFoldAsLoad = 1, isReMaterializable = 1, mayHaveSideEffects = 1 in
+let canFoldAsLoad = 1, isReMaterializable = 1 in
 def MOV64rm : RI<0x8B, MRMSrcMem, (outs GR64:$dst), (ins i64mem:$src),
                  "mov{q}\t{$src, $dst|$dst, $src}",
                  [(set GR64:$dst, (load addr:$src))]>;
@@ -556,7 +558,7 @@ def ADC64mi8 : RIi8<0x83, MRM2m, (outs), (ins i64mem:$dst, i64i8imm :$src2),
                   addr:$dst)]>;
 def ADC64mi32 : RIi32<0x81, MRM2m, (outs), (ins i64mem:$dst, i64i32imm:$src2),
                       "adc{q}\t{$src2, $dst|$dst, $src2}",
-                 [(store (adde (load addr:$dst), i64immSExt8:$src2), 
+                 [(store (adde (load addr:$dst), i64immSExt32:$src2), 
                   addr:$dst)]>;
 } // Uses = [EFLAGS]
 
@@ -1981,7 +1983,7 @@ def : Pat<(and GR64:$src, i64immZExt32:$imm),
             (i64 0),
             (AND32ri
               (EXTRACT_SUBREG GR64:$src, x86_subreg_32bit),
-              imm:$imm),
+              (i32 (GetLo32XForm imm:$imm))),
             x86_subreg_32bit)>;
 
 // r & (2^32-1) ==> movz
@@ -2105,34 +2107,34 @@ def : Pat<(store (i8 (trunc_su (srl_su GR16:$src, (i8 8)))), addr:$dst),
 def : Pat<(shl GR64:$src1, (i8 1)), (ADD64rr GR64:$src1, GR64:$src1)>;
 
 // (shl x (and y, 63)) ==> (shl x, y)
-def : Pat<(shl GR64:$src1, (and CL:$amt, 63)),
+def : Pat<(shl GR64:$src1, (and CL, 63)),
           (SHL64rCL GR64:$src1)>;
-def : Pat<(store (shl (loadi64 addr:$dst), (and CL:$amt, 63)), addr:$dst),
+def : Pat<(store (shl (loadi64 addr:$dst), (and CL, 63)), addr:$dst),
           (SHL64mCL addr:$dst)>;
 
-def : Pat<(srl GR64:$src1, (and CL:$amt, 63)),
+def : Pat<(srl GR64:$src1, (and CL, 63)),
           (SHR64rCL GR64:$src1)>;
-def : Pat<(store (srl (loadi64 addr:$dst), (and CL:$amt, 63)), addr:$dst),
+def : Pat<(store (srl (loadi64 addr:$dst), (and CL, 63)), addr:$dst),
           (SHR64mCL addr:$dst)>;
 
-def : Pat<(sra GR64:$src1, (and CL:$amt, 63)),
+def : Pat<(sra GR64:$src1, (and CL, 63)),
           (SAR64rCL GR64:$src1)>;
-def : Pat<(store (sra (loadi64 addr:$dst), (and CL:$amt, 63)), addr:$dst),
+def : Pat<(store (sra (loadi64 addr:$dst), (and CL, 63)), addr:$dst),
           (SAR64mCL addr:$dst)>;
 
 // Double shift patterns
-def : Pat<(shrd GR64:$src1, (i8 imm:$amt1), GR64:$src2, (i8 imm:$amt2)),
+def : Pat<(shrd GR64:$src1, (i8 imm:$amt1), GR64:$src2, (i8 imm)),
           (SHRD64rri8 GR64:$src1, GR64:$src2, (i8 imm:$amt1))>;
 
 def : Pat<(store (shrd (loadi64 addr:$dst), (i8 imm:$amt1),
-                       GR64:$src2, (i8 imm:$amt2)), addr:$dst),
+                       GR64:$src2, (i8 imm)), addr:$dst),
           (SHRD64mri8 addr:$dst, GR64:$src2, (i8 imm:$amt1))>;
 
-def : Pat<(shld GR64:$src1, (i8 imm:$amt1), GR64:$src2, (i8 imm:$amt2)),
+def : Pat<(shld GR64:$src1, (i8 imm:$amt1), GR64:$src2, (i8 imm)),
           (SHLD64rri8 GR64:$src1, GR64:$src2, (i8 imm:$amt1))>;
 
 def : Pat<(store (shld (loadi64 addr:$dst), (i8 imm:$amt1),
-                       GR64:$src2, (i8 imm:$amt2)), addr:$dst),
+                       GR64:$src2, (i8 imm)), addr:$dst),
           (SHLD64mri8 addr:$dst, GR64:$src2, (i8 imm:$amt1))>;
 
 // (or x1, x2) -> (add x1, x2) if two operands are known not to share bits.
diff --git a/libclamav/c++/llvm/lib/Target/X86/X86InstrFPStack.td b/libclamav/c++/llvm/lib/Target/X86/X86InstrFPStack.td
index e22a903..ae24bfb 100644
--- a/libclamav/c++/llvm/lib/Target/X86/X86InstrFPStack.td
+++ b/libclamav/c++/llvm/lib/Target/X86/X86InstrFPStack.td
@@ -397,7 +397,7 @@ def CMOVNP_F : FPI<0xD8, AddRegFrm, (outs RST:$op), (ins),
 let canFoldAsLoad = 1 in {
 def LD_Fp32m   : FpIf32<(outs RFP32:$dst), (ins f32mem:$src), ZeroArgFP,
                   [(set RFP32:$dst, (loadf32 addr:$src))]>;
-let isReMaterializable = 1, mayHaveSideEffects = 1 in
+let isReMaterializable = 1 in
   def LD_Fp64m : FpIf64<(outs RFP64:$dst), (ins f64mem:$src), ZeroArgFP,
                   [(set RFP64:$dst, (loadf64 addr:$src))]>;
 def LD_Fp80m   : FpI_<(outs RFP80:$dst), (ins f80mem:$src), ZeroArgFP,
diff --git a/libclamav/c++/llvm/lib/Target/X86/X86InstrInfo.cpp b/libclamav/c++/llvm/lib/Target/X86/X86InstrInfo.cpp
index a0d0312..39bda04 100644
--- a/libclamav/c++/llvm/lib/Target/X86/X86InstrInfo.cpp
+++ b/libclamav/c++/llvm/lib/Target/X86/X86InstrInfo.cpp
@@ -276,11 +276,8 @@ X86InstrInfo::X86InstrInfo(X86TargetMachine &tm)
     { X86::MOVDQArr,    X86::MOVDQAmr, 0, 16 },
     { X86::MOVPDI2DIrr, X86::MOVPDI2DImr, 0, 0 },
     { X86::MOVPQIto64rr,X86::MOVPQI2QImr, 0, 0 },
-    { X86::MOVPS2SSrr,  X86::MOVPS2SSmr, 0, 0 },
-    { X86::MOVSDrr,     X86::MOVSDmr, 0, 0 },
     { X86::MOVSDto64rr, X86::MOVSDto64mr, 0, 0 },
     { X86::MOVSS2DIrr,  X86::MOVSS2DImr, 0, 0 },
-    { X86::MOVSSrr,     X86::MOVSSmr, 0, 0 },
     { X86::MOVUPDrr,    X86::MOVUPDmr, 0, 0 },
     { X86::MOVUPSrr,    X86::MOVUPSmr, 0, 0 },
     { X86::MUL16r,      X86::MUL16m, 1, 0 },
@@ -389,12 +386,8 @@ X86InstrInfo::X86InstrInfo(X86TargetMachine &tm)
     { X86::MOVDI2PDIrr,     X86::MOVDI2PDIrm, 0 },
     { X86::MOVDI2SSrr,      X86::MOVDI2SSrm, 0 },
     { X86::MOVDQArr,        X86::MOVDQArm, 16 },
-    { X86::MOVSD2PDrr,      X86::MOVSD2PDrm, 0 },
-    { X86::MOVSDrr,         X86::MOVSDrm, 0 },
     { X86::MOVSHDUPrr,      X86::MOVSHDUPrm, 16 },
     { X86::MOVSLDUPrr,      X86::MOVSLDUPrm, 16 },
-    { X86::MOVSS2PSrr,      X86::MOVSS2PSrm, 0 },
-    { X86::MOVSSrr,         X86::MOVSSrm, 0 },
     { X86::MOVSX16rr8,      X86::MOVSX16rm8, 0 },
     { X86::MOVSX32rr16,     X86::MOVSX32rm16, 0 },
     { X86::MOVSX32rr8,      X86::MOVSX32rm8, 0 },
@@ -682,23 +675,20 @@ bool X86InstrInfo::isMoveInstr(const MachineInstr& MI,
   case X86::MOV16rr:
   case X86::MOV32rr: 
   case X86::MOV64rr:
-  case X86::MOVSSrr:
-  case X86::MOVSDrr:
 
   // FP Stack register class copies
   case X86::MOV_Fp3232: case X86::MOV_Fp6464: case X86::MOV_Fp8080:
   case X86::MOV_Fp3264: case X86::MOV_Fp3280:
   case X86::MOV_Fp6432: case X86::MOV_Fp8032:
-      
+
+  // Note that MOVSSrr and MOVSDrr are not considered copies. FR32 and FR64
+  // copies are done with FsMOVAPSrr and FsMOVAPDrr.
+
   case X86::FsMOVAPSrr:
   case X86::FsMOVAPDrr:
   case X86::MOVAPSrr:
   case X86::MOVAPDrr:
   case X86::MOVDQArr:
-  case X86::MOVSS2PSrr:
-  case X86::MOVSD2PDrr:
-  case X86::MOVPS2SSrr:
-  case X86::MOVPD2SDrr:
   case X86::MMX_MOVQ64rr:
     assert(MI.getNumOperands() >= 2 &&
            MI.getOperand(0).isReg() &&
@@ -1083,7 +1073,7 @@ void X86InstrInfo::reMaterialize(MachineBasicBlock &MBB,
       case X86::MOV8r0:  Opc = X86::MOV8ri;  break;
       case X86::MOV16r0: Opc = X86::MOV16ri; break;
       case X86::MOV32r0: Opc = X86::MOV32ri; break;
-      case X86::MOV64r0: Opc = X86::MOV64ri; break;
+      case X86::MOV64r0: Opc = X86::MOV64ri64i32; break;
       }
       Clone = false;
     }
@@ -1860,7 +1850,7 @@ bool X86InstrInfo::copyRegToReg(MachineBasicBlock &MBB,
     CommonRC = SrcRC;
   else if (!DestRC->hasSubClass(SrcRC)) {
     // Neither of GR64_NOREX or GR64_NOSP is a superclass of the other,
-    // but we want to copy then as GR64. Similarly, for GR32_NOREX and
+    // but we want to copy them as GR64. Similarly, for GR32_NOREX and
     // GR32_NOSP, copy as GR32.
     if (SrcRC->hasSuperClass(&X86::GR64RegClass) &&
         DestRC->hasSuperClass(&X86::GR64RegClass))
diff --git a/libclamav/c++/llvm/lib/Target/X86/X86InstrInfo.td b/libclamav/c++/llvm/lib/Target/X86/X86InstrInfo.td
index 25cd297..d46b946 100644
--- a/libclamav/c++/llvm/lib/Target/X86/X86InstrInfo.td
+++ b/libclamav/c++/llvm/lib/Target/X86/X86InstrInfo.td
@@ -343,18 +343,37 @@ def X86_COND_O   : PatLeaf<(i8 13)>;
 def X86_COND_P   : PatLeaf<(i8 14)>; // alt. COND_PE
 def X86_COND_S   : PatLeaf<(i8 15)>;
 
-def i16immSExt8  : PatLeaf<(i16 imm), [{
-  // i16immSExt8 predicate - True if the 16-bit immediate fits in a 8-bit
-  // sign extended field.
-  return (int16_t)N->getZExtValue() == (int8_t)N->getZExtValue();
+def immSext8 : PatLeaf<(imm), [{
+  return N->getSExtValue() == (int8_t)N->getSExtValue();
 }]>;
 
-def i32immSExt8  : PatLeaf<(i32 imm), [{
-  // i32immSExt8 predicate - True if the 32-bit immediate fits in a 8-bit
-  // sign extended field.
-  return (int32_t)N->getZExtValue() == (int8_t)N->getZExtValue();
+def i16immSExt8  : PatLeaf<(i16 immSext8)>;
+def i32immSExt8  : PatLeaf<(i32 immSext8)>;
+
+/// Load patterns: these constraint the match to the right address space.
+def dsload : PatFrag<(ops node:$ptr), (load node:$ptr), [{
+  if (const Value *Src = cast<LoadSDNode>(N)->getSrcValue())
+    if (const PointerType *PT = dyn_cast<PointerType>(Src->getType()))
+      if (PT->getAddressSpace() > 255)
+        return false;
+  return true;
+}]>;
+
+def gsload : PatFrag<(ops node:$ptr), (load node:$ptr), [{
+  if (const Value *Src = cast<LoadSDNode>(N)->getSrcValue())
+    if (const PointerType *PT = dyn_cast<PointerType>(Src->getType()))
+      return PT->getAddressSpace() == 256;
+  return false;
+}]>;
+
+def fsload : PatFrag<(ops node:$ptr), (load node:$ptr), [{
+  if (const Value *Src = cast<LoadSDNode>(N)->getSrcValue())
+    if (const PointerType *PT = dyn_cast<PointerType>(Src->getType()))
+      return PT->getAddressSpace() == 257;
+  return false;
 }]>;
 
+
 // Helper fragments for loads.
 // It's always safe to treat a anyext i16 load as a i32 load if the i16 is
 // known to be 32-bit aligned or better. Ditto for i8 to i16.
@@ -372,8 +391,7 @@ def loadi16 : PatFrag<(ops node:$ptr), (i16 (unindexedload node:$ptr)), [{
   return false;
 }]>;
 
-def loadi16_anyext : PatFrag<(ops node:$ptr), (i32 (unindexedload node:$ptr)),
-[{
+def loadi16_anyext : PatFrag<(ops node:$ptr), (i32 (unindexedload node:$ptr)),[{
   LoadSDNode *LD = cast<LoadSDNode>(N);
   if (const Value *Src = LD->getSrcValue())
     if (const PointerType *PT = dyn_cast<PointerType>(Src->getType()))
@@ -399,72 +417,11 @@ def loadi32 : PatFrag<(ops node:$ptr), (i32 (unindexedload node:$ptr)), [{
   return false;
 }]>;
 
-def nvloadi32 : PatFrag<(ops node:$ptr), (i32 (unindexedload node:$ptr)), [{
-  LoadSDNode *LD = cast<LoadSDNode>(N);
-  if (const Value *Src = LD->getSrcValue())
-    if (const PointerType *PT = dyn_cast<PointerType>(Src->getType()))
-      if (PT->getAddressSpace() > 255)
-        return false;
-  if (LD->isVolatile())
-    return false;
-  ISD::LoadExtType ExtType = LD->getExtensionType();
-  if (ExtType == ISD::NON_EXTLOAD)
-    return true;
-  if (ExtType == ISD::EXTLOAD)
-    return LD->getAlignment() >= 4;
-  return false;
-}]>;
-
-def gsload : PatFrag<(ops node:$ptr), (load node:$ptr), [{
-  if (const Value *Src = cast<LoadSDNode>(N)->getSrcValue())
-    if (const PointerType *PT = dyn_cast<PointerType>(Src->getType()))
-      return PT->getAddressSpace() == 256;
-  return false;
-}]>;
-
-def fsload : PatFrag<(ops node:$ptr), (load node:$ptr), [{
-  if (const Value *Src = cast<LoadSDNode>(N)->getSrcValue())
-    if (const PointerType *PT = dyn_cast<PointerType>(Src->getType()))
-      return PT->getAddressSpace() == 257;
-  return false;
-}]>;
-
-def loadi8  : PatFrag<(ops node:$ptr), (i8  (load node:$ptr)), [{
-  if (const Value *Src = cast<LoadSDNode>(N)->getSrcValue())
-    if (const PointerType *PT = dyn_cast<PointerType>(Src->getType()))
-      if (PT->getAddressSpace() > 255)
-        return false;
-  return true;
-}]>;
-def loadi64 : PatFrag<(ops node:$ptr), (i64 (load node:$ptr)), [{
-  if (const Value *Src = cast<LoadSDNode>(N)->getSrcValue())
-    if (const PointerType *PT = dyn_cast<PointerType>(Src->getType()))
-      if (PT->getAddressSpace() > 255)
-        return false;
-  return true;
-}]>;
-
-def loadf32 : PatFrag<(ops node:$ptr), (f32 (load node:$ptr)), [{
-  if (const Value *Src = cast<LoadSDNode>(N)->getSrcValue())
-    if (const PointerType *PT = dyn_cast<PointerType>(Src->getType()))
-      if (PT->getAddressSpace() > 255)
-        return false;
-  return true;
-}]>;
-def loadf64 : PatFrag<(ops node:$ptr), (f64 (load node:$ptr)), [{
-  if (const Value *Src = cast<LoadSDNode>(N)->getSrcValue())
-    if (const PointerType *PT = dyn_cast<PointerType>(Src->getType()))
-      if (PT->getAddressSpace() > 255)
-        return false;
-  return true;
-}]>;
-def loadf80 : PatFrag<(ops node:$ptr), (f80 (load node:$ptr)), [{
-  if (const Value *Src = cast<LoadSDNode>(N)->getSrcValue())
-    if (const PointerType *PT = dyn_cast<PointerType>(Src->getType()))
-      if (PT->getAddressSpace() > 255)
-        return false;
-  return true;
-}]>;
+def loadi8  : PatFrag<(ops node:$ptr), (i8  (dsload node:$ptr))>;
+def loadi64 : PatFrag<(ops node:$ptr), (i64 (dsload node:$ptr))>;
+def loadf32 : PatFrag<(ops node:$ptr), (f32 (dsload node:$ptr))>;
+def loadf64 : PatFrag<(ops node:$ptr), (f64 (dsload node:$ptr))>;
+def loadf80 : PatFrag<(ops node:$ptr), (f80 (dsload node:$ptr))>;
 
 def sextloadi16i8  : PatFrag<(ops node:$ptr), (i16 (sextloadi8 node:$ptr))>;
 def sextloadi32i8  : PatFrag<(ops node:$ptr), (i32 (sextloadi8 node:$ptr))>;
@@ -1037,7 +994,7 @@ def MOV16rr_REV : I<0x8B, MRMSrcReg, (outs GR16:$dst), (ins GR16:$src),
 def MOV32rr_REV : I<0x8B, MRMSrcReg, (outs GR32:$dst), (ins GR32:$src),
                     "mov{l}\t{$src, $dst|$dst, $src}", []>;
 
-let canFoldAsLoad = 1, isReMaterializable = 1, mayHaveSideEffects = 1 in {
+let canFoldAsLoad = 1, isReMaterializable = 1 in {
 def MOV8rm  : I<0x8A, MRMSrcMem, (outs GR8 :$dst), (ins i8mem :$src),
                 "mov{b}\t{$src, $dst|$dst, $src}",
                 [(set GR8:$dst, (loadi8 addr:$src))]>;
@@ -1071,7 +1028,7 @@ def MOV8mr_NOREX : I<0x88, MRMDestMem,
                      (outs), (ins i8mem_NOREX:$dst, GR8_NOREX:$src),
                      "mov{b}\t{$src, $dst|$dst, $src}  # NOREX", []>;
 let mayLoad = 1,
-    canFoldAsLoad = 1, isReMaterializable = 1, mayHaveSideEffects = 1 in
+    canFoldAsLoad = 1, isReMaterializable = 1 in
 def MOV8rm_NOREX : I<0x8A, MRMSrcMem,
                      (outs GR8_NOREX:$dst), (ins i8mem_NOREX:$src),
                      "mov{b}\t{$src, $dst|$dst, $src}  # NOREX", []>;
@@ -1093,7 +1050,10 @@ def MOV32cr : I<0x22, MRMSrcReg, (outs CONTROL_REG_32:$dst), (ins GR32:$src),
 //
 
 // Extra precision multiplication
-let Defs = [AL,AH,EFLAGS], Uses = [AL] in
+
+// AL is really implied by AX, by the registers in Defs must match the
+// SDNode results (i8, i32).
+let Defs = [AL,EFLAGS,AX], Uses = [AL] in
 def MUL8r  : I<0xF6, MRM4r, (outs),  (ins GR8:$src), "mul{b}\t$src",
                // FIXME: Used for 8-bit mul, ignore result upper 8 bits.
                // This probably ought to be moved to a def : Pat<> if the
@@ -1111,7 +1071,7 @@ def MUL32r : I<0xF7, MRM4r, (outs),  (ins GR32:$src),
                "mul{l}\t$src",
                []>; // EAX,EDX = EAX*GR32
 
-let Defs = [AL,AH,EFLAGS], Uses = [AL] in
+let Defs = [AL,EFLAGS,AX], Uses = [AL] in
 def MUL8m  : I<0xF6, MRM4m, (outs), (ins i8mem :$src),
                "mul{b}\t$src",
                // FIXME: Used for 8-bit mul, ignore result upper 8 bits.
@@ -1133,7 +1093,7 @@ def MUL32m : I<0xF7, MRM4m, (outs), (ins i32mem:$src),
 }
 
 let neverHasSideEffects = 1 in {
-let Defs = [AL,AH,EFLAGS], Uses = [AL] in
+let Defs = [AL,EFLAGS,AX], Uses = [AL] in
 def IMUL8r  : I<0xF6, MRM5r, (outs),  (ins GR8:$src), "imul{b}\t$src", []>;
               // AL,AH = AL*GR8
 let Defs = [AX,DX,EFLAGS], Uses = [AX] in
@@ -1143,7 +1103,7 @@ let Defs = [EAX,EDX,EFLAGS], Uses = [EAX] in
 def IMUL32r : I<0xF7, MRM5r, (outs),  (ins GR32:$src), "imul{l}\t$src", []>;
               // EAX,EDX = EAX*GR32
 let mayLoad = 1 in {
-let Defs = [AL,AH,EFLAGS], Uses = [AL] in
+let Defs = [AL,EFLAGS,AX], Uses = [AL] in
 def IMUL8m  : I<0xF6, MRM5m, (outs), (ins i8mem :$src),
                 "imul{b}\t$src", []>;    // AL,AH = AL*[mem8]
 let Defs = [AX,DX,EFLAGS], Uses = [AX] in
@@ -1156,7 +1116,7 @@ def IMUL32m : I<0xF7, MRM5m, (outs), (ins i32mem:$src),
 } // neverHasSideEffects
 
 // unsigned division/remainder
-let Defs = [AL,AH,EFLAGS], Uses = [AX] in
+let Defs = [AL,EFLAGS,AX], Uses = [AX] in
 def DIV8r  : I<0xF6, MRM6r, (outs),  (ins GR8:$src),    // AX/r8 = AL,AH
                "div{b}\t$src", []>;
 let Defs = [AX,DX,EFLAGS], Uses = [AX,DX] in
@@ -1166,7 +1126,7 @@ let Defs = [EAX,EDX,EFLAGS], Uses = [EAX,EDX] in
 def DIV32r : I<0xF7, MRM6r, (outs),  (ins GR32:$src),   // EDX:EAX/r32 = EAX,EDX
                "div{l}\t$src", []>;
 let mayLoad = 1 in {
-let Defs = [AL,AH,EFLAGS], Uses = [AX] in
+let Defs = [AL,EFLAGS,AX], Uses = [AX] in
 def DIV8m  : I<0xF6, MRM6m, (outs), (ins i8mem:$src),   // AX/[mem8] = AL,AH
                "div{b}\t$src", []>;
 let Defs = [AX,DX,EFLAGS], Uses = [AX,DX] in
@@ -1179,7 +1139,7 @@ def DIV32m : I<0xF7, MRM6m, (outs), (ins i32mem:$src),
 }
 
 // Signed division/remainder.
-let Defs = [AL,AH,EFLAGS], Uses = [AX] in
+let Defs = [AL,EFLAGS,AX], Uses = [AX] in
 def IDIV8r : I<0xF6, MRM7r, (outs),  (ins GR8:$src),    // AX/r8 = AL,AH
                "idiv{b}\t$src", []>;
 let Defs = [AX,DX,EFLAGS], Uses = [AX,DX] in
@@ -1189,7 +1149,7 @@ let Defs = [EAX,EDX,EFLAGS], Uses = [EAX,EDX] in
 def IDIV32r: I<0xF7, MRM7r, (outs),  (ins GR32:$src),   // EDX:EAX/r32 = EAX,EDX
                "idiv{l}\t$src", []>;
 let mayLoad = 1, mayLoad = 1 in {
-let Defs = [AL,AH,EFLAGS], Uses = [AX] in
+let Defs = [AL,EFLAGS,AX], Uses = [AX] in
 def IDIV8m : I<0xF6, MRM7m, (outs), (ins i8mem:$src),   // AX/[mem8] = AL,AH
                "idiv{b}\t$src", []>;
 let Defs = [AX,DX,EFLAGS], Uses = [AX,DX] in
@@ -4442,12 +4402,6 @@ def : Pat<(i16 (anyext GR8 :$src)), (MOVZX16rr8  GR8 :$src)>;
 def : Pat<(i32 (anyext GR8 :$src)), (MOVZX32rr8  GR8 :$src)>;
 def : Pat<(i32 (anyext GR16:$src)), (MOVZX32rr16 GR16:$src)>;
 
-// (and (i32 load), 255) -> (zextload i8)
-def : Pat<(i32 (and (nvloadi32 addr:$src), (i32 255))),
-          (MOVZX32rm8 addr:$src)>;
-def : Pat<(i32 (and (nvloadi32 addr:$src), (i32 65535))),
-          (MOVZX32rm16 addr:$src)>;
-
 //===----------------------------------------------------------------------===//
 // Some peepholes
 //===----------------------------------------------------------------------===//
@@ -4543,43 +4497,43 @@ def : Pat<(shl GR16:$src1, (i8 1)), (ADD16rr GR16:$src1, GR16:$src1)>;
 def : Pat<(shl GR32:$src1, (i8 1)), (ADD32rr GR32:$src1, GR32:$src1)>;
 
 // (shl x (and y, 31)) ==> (shl x, y)
-def : Pat<(shl GR8:$src1, (and CL:$amt, 31)),
+def : Pat<(shl GR8:$src1, (and CL, 31)),
           (SHL8rCL GR8:$src1)>;
-def : Pat<(shl GR16:$src1, (and CL:$amt, 31)),
+def : Pat<(shl GR16:$src1, (and CL, 31)),
           (SHL16rCL GR16:$src1)>;
-def : Pat<(shl GR32:$src1, (and CL:$amt, 31)),
+def : Pat<(shl GR32:$src1, (and CL, 31)),
           (SHL32rCL GR32:$src1)>;
-def : Pat<(store (shl (loadi8 addr:$dst), (and CL:$amt, 31)), addr:$dst),
+def : Pat<(store (shl (loadi8 addr:$dst), (and CL, 31)), addr:$dst),
           (SHL8mCL addr:$dst)>;
-def : Pat<(store (shl (loadi16 addr:$dst), (and CL:$amt, 31)), addr:$dst),
+def : Pat<(store (shl (loadi16 addr:$dst), (and CL, 31)), addr:$dst),
           (SHL16mCL addr:$dst)>;
-def : Pat<(store (shl (loadi32 addr:$dst), (and CL:$amt, 31)), addr:$dst),
+def : Pat<(store (shl (loadi32 addr:$dst), (and CL, 31)), addr:$dst),
           (SHL32mCL addr:$dst)>;
 
-def : Pat<(srl GR8:$src1, (and CL:$amt, 31)),
+def : Pat<(srl GR8:$src1, (and CL, 31)),
           (SHR8rCL GR8:$src1)>;
-def : Pat<(srl GR16:$src1, (and CL:$amt, 31)),
+def : Pat<(srl GR16:$src1, (and CL, 31)),
           (SHR16rCL GR16:$src1)>;
-def : Pat<(srl GR32:$src1, (and CL:$amt, 31)),
+def : Pat<(srl GR32:$src1, (and CL, 31)),
           (SHR32rCL GR32:$src1)>;
-def : Pat<(store (srl (loadi8 addr:$dst), (and CL:$amt, 31)), addr:$dst),
+def : Pat<(store (srl (loadi8 addr:$dst), (and CL, 31)), addr:$dst),
           (SHR8mCL addr:$dst)>;
-def : Pat<(store (srl (loadi16 addr:$dst), (and CL:$amt, 31)), addr:$dst),
+def : Pat<(store (srl (loadi16 addr:$dst), (and CL, 31)), addr:$dst),
           (SHR16mCL addr:$dst)>;
-def : Pat<(store (srl (loadi32 addr:$dst), (and CL:$amt, 31)), addr:$dst),
+def : Pat<(store (srl (loadi32 addr:$dst), (and CL, 31)), addr:$dst),
           (SHR32mCL addr:$dst)>;
 
-def : Pat<(sra GR8:$src1, (and CL:$amt, 31)),
+def : Pat<(sra GR8:$src1, (and CL, 31)),
           (SAR8rCL GR8:$src1)>;
-def : Pat<(sra GR16:$src1, (and CL:$amt, 31)),
+def : Pat<(sra GR16:$src1, (and CL, 31)),
           (SAR16rCL GR16:$src1)>;
-def : Pat<(sra GR32:$src1, (and CL:$amt, 31)),
+def : Pat<(sra GR32:$src1, (and CL, 31)),
           (SAR32rCL GR32:$src1)>;
-def : Pat<(store (sra (loadi8 addr:$dst), (and CL:$amt, 31)), addr:$dst),
+def : Pat<(store (sra (loadi8 addr:$dst), (and CL, 31)), addr:$dst),
           (SAR8mCL addr:$dst)>;
-def : Pat<(store (sra (loadi16 addr:$dst), (and CL:$amt, 31)), addr:$dst),
+def : Pat<(store (sra (loadi16 addr:$dst), (and CL, 31)), addr:$dst),
           (SAR16mCL addr:$dst)>;
-def : Pat<(store (sra (loadi32 addr:$dst), (and CL:$amt, 31)), addr:$dst),
+def : Pat<(store (sra (loadi32 addr:$dst), (and CL, 31)), addr:$dst),
           (SAR32mCL addr:$dst)>;
 
 // (or (x >> c) | (y << (32 - c))) ==> (shrd32 x, y, c)
@@ -4600,11 +4554,11 @@ def : Pat<(store (or (srl (loadi32 addr:$dst), (i8 (trunc ECX:$amt))),
                  addr:$dst),
           (SHRD32mrCL addr:$dst, GR32:$src2)>;
 
-def : Pat<(shrd GR32:$src1, (i8 imm:$amt1), GR32:$src2, (i8 imm:$amt2)),
+def : Pat<(shrd GR32:$src1, (i8 imm:$amt1), GR32:$src2, (i8 imm/*:$amt2*/)),
           (SHRD32rri8 GR32:$src1, GR32:$src2, (i8 imm:$amt1))>;
 
 def : Pat<(store (shrd (loadi32 addr:$dst), (i8 imm:$amt1),
-                       GR32:$src2, (i8 imm:$amt2)), addr:$dst),
+                       GR32:$src2, (i8 imm/*:$amt2*/)), addr:$dst),
           (SHRD32mri8 addr:$dst, GR32:$src2, (i8 imm:$amt1))>;
 
 // (or (x << c) | (y >> (32 - c))) ==> (shld32 x, y, c)
@@ -4625,11 +4579,11 @@ def : Pat<(store (or (shl (loadi32 addr:$dst), (i8 (trunc ECX:$amt))),
                  addr:$dst),
           (SHLD32mrCL addr:$dst, GR32:$src2)>;
 
-def : Pat<(shld GR32:$src1, (i8 imm:$amt1), GR32:$src2, (i8 imm:$amt2)),
+def : Pat<(shld GR32:$src1, (i8 imm:$amt1), GR32:$src2, (i8 imm/*:$amt2*/)),
           (SHLD32rri8 GR32:$src1, GR32:$src2, (i8 imm:$amt1))>;
 
 def : Pat<(store (shld (loadi32 addr:$dst), (i8 imm:$amt1),
-                       GR32:$src2, (i8 imm:$amt2)), addr:$dst),
+                       GR32:$src2, (i8 imm/*:$amt2*/)), addr:$dst),
           (SHLD32mri8 addr:$dst, GR32:$src2, (i8 imm:$amt1))>;
 
 // (or (x >> c) | (y << (16 - c))) ==> (shrd16 x, y, c)
@@ -4650,11 +4604,11 @@ def : Pat<(store (or (srl (loadi16 addr:$dst), (i8 (trunc CX:$amt))),
                  addr:$dst),
           (SHRD16mrCL addr:$dst, GR16:$src2)>;
 
-def : Pat<(shrd GR16:$src1, (i8 imm:$amt1), GR16:$src2, (i8 imm:$amt2)),
+def : Pat<(shrd GR16:$src1, (i8 imm:$amt1), GR16:$src2, (i8 imm/*:$amt2*/)),
           (SHRD16rri8 GR16:$src1, GR16:$src2, (i8 imm:$amt1))>;
 
 def : Pat<(store (shrd (loadi16 addr:$dst), (i8 imm:$amt1),
-                       GR16:$src2, (i8 imm:$amt2)), addr:$dst),
+                       GR16:$src2, (i8 imm/*:$amt2*/)), addr:$dst),
           (SHRD16mri8 addr:$dst, GR16:$src2, (i8 imm:$amt1))>;
 
 // (or (x << c) | (y >> (16 - c))) ==> (shld16 x, y, c)
@@ -4675,11 +4629,11 @@ def : Pat<(store (or (shl (loadi16 addr:$dst), (i8 (trunc CX:$amt))),
                  addr:$dst),
           (SHLD16mrCL addr:$dst, GR16:$src2)>;
 
-def : Pat<(shld GR16:$src1, (i8 imm:$amt1), GR16:$src2, (i8 imm:$amt2)),
+def : Pat<(shld GR16:$src1, (i8 imm:$amt1), GR16:$src2, (i8 imm/*:$amt2*/)),
           (SHLD16rri8 GR16:$src1, GR16:$src2, (i8 imm:$amt1))>;
 
 def : Pat<(store (shld (loadi16 addr:$dst), (i8 imm:$amt1),
-                       GR16:$src2, (i8 imm:$amt2)), addr:$dst),
+                       GR16:$src2, (i8 imm/*:$amt2*/)), addr:$dst),
           (SHLD16mri8 addr:$dst, GR16:$src2, (i8 imm:$amt1))>;
 
 // (anyext (setcc_carry)) -> (setcc_carry)
diff --git a/libclamav/c++/llvm/lib/Target/X86/X86InstrMMX.td b/libclamav/c++/llvm/lib/Target/X86/X86InstrMMX.td
index 89f020c..c8e0723 100644
--- a/libclamav/c++/llvm/lib/Target/X86/X86InstrMMX.td
+++ b/libclamav/c++/llvm/lib/Target/X86/X86InstrMMX.td
@@ -141,7 +141,7 @@ def MMX_MOVD64rrv164 : MMXI<0x6E, MRMSrcReg, (outs VR64:$dst), (ins GR64:$src),
 let neverHasSideEffects = 1 in
 def MMX_MOVQ64rr : MMXI<0x6F, MRMSrcReg, (outs VR64:$dst), (ins VR64:$src),
                         "movq\t{$src, $dst|$dst, $src}", []>;
-let canFoldAsLoad = 1, isReMaterializable = 1, mayHaveSideEffects = 1 in
+let canFoldAsLoad = 1, isReMaterializable = 1 in
 def MMX_MOVQ64rm : MMXI<0x6F, MRMSrcMem, (outs VR64:$dst), (ins i64mem:$src),
                         "movq\t{$src, $dst|$dst, $src}",
                         [(set VR64:$dst, (load_mmx addr:$src))]>;
@@ -426,13 +426,15 @@ def MMX_CVTTPS2PIrm : MMXI<0x2C, MRMSrcMem, (outs VR64:$dst), (ins f64mem:$src),
 
 
 // Extract / Insert
-def MMX_X86pextrw : SDNode<"X86ISD::PEXTRW", SDTypeProfile<1, 2, []>, []>;
-def MMX_X86pinsrw : SDNode<"X86ISD::PINSRW", SDTypeProfile<1, 3, []>, []>;
+def MMX_X86pinsrw : SDNode<"X86ISD::MMX_PINSRW",
+                    SDTypeProfile<1, 3, [SDTCisVT<0, v4i16>, SDTCisSameAs<0,1>,
+                                         SDTCisVT<2, i32>, SDTCisPtrTy<3>]>>;
+
 
 def MMX_PEXTRWri  : MMXIi8<0xC5, MRMSrcReg,
                            (outs GR32:$dst), (ins VR64:$src1, i16i8imm:$src2),
                            "pextrw\t{$src2, $src1, $dst|$dst, $src1, $src2}",
-                           [(set GR32:$dst, (MMX_X86pextrw (v4i16 VR64:$src1),
+                           [(set GR32:$dst, (X86pextrw (v4i16 VR64:$src1),
                                              (iPTR imm:$src2)))]>;
 let Constraints = "$src1 = $dst" in {
   def MMX_PINSRWrri : MMXIi8<0xC4, MRMSrcReg,
@@ -597,13 +599,6 @@ let AddedComplexity = 10 in {
             (MMX_PUNPCKHDQrr VR64:$src, VR64:$src)>;
 }
 
-// Patterns to perform vector shuffling with a zeroed out vector.
-let AddedComplexity = 20 in {
-  def : Pat<(bc_v2i32 (mmx_unpckl immAllZerosV,
-                       (v2i32 (scalar_to_vector (load_mmx addr:$src))))),
-            (MMX_PUNPCKLDQrm VR64:$src, VR64:$src)>;
-}
-
 // Some special case PANDN patterns.
 // FIXME: Get rid of these.
 def : Pat<(v1i64 (and (xor VR64:$src1, (bc_v1i64 (v2i32 immAllOnesV))),
diff --git a/libclamav/c++/llvm/lib/Target/X86/X86InstrSSE.td b/libclamav/c++/llvm/lib/Target/X86/X86InstrSSE.td
index 9b2140f..2743dba 100644
--- a/libclamav/c++/llvm/lib/Target/X86/X86InstrSSE.td
+++ b/libclamav/c++/llvm/lib/Target/X86/X86InstrSSE.td
@@ -160,6 +160,32 @@ def memopv4i16 : PatFrag<(ops node:$ptr), (v4i16 (memop64 node:$ptr))>;
 def memopv8i16 : PatFrag<(ops node:$ptr), (v8i16 (memop64 node:$ptr))>;
 def memopv2i32 : PatFrag<(ops node:$ptr), (v2i32 (memop64 node:$ptr))>;
 
+// MOVNT Support
+// Like 'store', but requires the non-temporal bit to be set
+def nontemporalstore : PatFrag<(ops node:$val, node:$ptr),
+                           (st node:$val, node:$ptr), [{
+  if (StoreSDNode *ST = dyn_cast<StoreSDNode>(N))
+    return ST->isNonTemporal();
+  return false;
+}]>;
+
+def alignednontemporalstore : PatFrag<(ops node:$val, node:$ptr),
+			           (st node:$val, node:$ptr), [{
+  if (StoreSDNode *ST = dyn_cast<StoreSDNode>(N))
+    return ST->isNonTemporal() && !ST->isTruncatingStore() &&
+           ST->getAddressingMode() == ISD::UNINDEXED &&
+           ST->getAlignment() >= 16;
+  return false;
+}]>;
+
+def unalignednontemporalstore : PatFrag<(ops node:$val, node:$ptr),
+			           (st node:$val, node:$ptr), [{
+  if (StoreSDNode *ST = dyn_cast<StoreSDNode>(N))
+    return ST->isNonTemporal() &&
+           ST->getAlignment() < 16;
+  return false;
+}]>;
+
 def bc_v4f32 : PatFrag<(ops node:$in), (v4f32 (bitconvert node:$in))>;
 def bc_v2f64 : PatFrag<(ops node:$in), (v2f64 (bitconvert node:$in))>;
 def bc_v16i8 : PatFrag<(ops node:$in), (v16i8 (bitconvert node:$in))>;
@@ -344,18 +370,56 @@ let Uses = [EFLAGS], usesCustomInserter = 1 in {
 // SSE1 Instructions
 //===----------------------------------------------------------------------===//
 
-// Move Instructions
-let neverHasSideEffects = 1 in
-def MOVSSrr : SSI<0x10, MRMSrcReg, (outs FR32:$dst), (ins FR32:$src),
-                  "movss\t{$src, $dst|$dst, $src}", []>;
-let canFoldAsLoad = 1, isReMaterializable = 1, mayHaveSideEffects = 1 in
+// Move Instructions. Register-to-register movss is not used for FR32
+// register copies because it's a partial register update; FsMOVAPSrr is
+// used instead. Register-to-register movss is not modeled as an INSERT_SUBREG
+// because INSERT_SUBREG requires that the insert be implementable in terms of
+// a copy, and just mentioned, we don't use movss for copies.
+let Constraints = "$src1 = $dst" in
+def MOVSSrr : SSI<0x10, MRMSrcReg,
+                  (outs VR128:$dst), (ins VR128:$src1, FR32:$src2),
+                  "movss\t{$src2, $dst|$dst, $src2}",
+                  [(set VR128:$dst,
+                        (movl VR128:$src1, (scalar_to_vector FR32:$src2)))]>;
+
+// Extract the low 32-bit value from one vector and insert it into another.
+let AddedComplexity = 15 in
+def : Pat<(v4f32 (movl VR128:$src1, VR128:$src2)),
+          (MOVSSrr VR128:$src1,
+                   (EXTRACT_SUBREG (v4f32 VR128:$src2), x86_subreg_ss))>;
+
+// Implicitly promote a 32-bit scalar to a vector.
+def : Pat<(v4f32 (scalar_to_vector FR32:$src)),
+          (INSERT_SUBREG (v4f32 (IMPLICIT_DEF)), FR32:$src, x86_subreg_ss)>;
+
+// Loading from memory automatically zeroing upper bits.
+let canFoldAsLoad = 1, isReMaterializable = 1 in
 def MOVSSrm : SSI<0x10, MRMSrcMem, (outs FR32:$dst), (ins f32mem:$src),
                   "movss\t{$src, $dst|$dst, $src}",
                   [(set FR32:$dst, (loadf32 addr:$src))]>;
+
+// MOVSSrm zeros the high parts of the register; represent this
+// with SUBREG_TO_REG.
+let AddedComplexity = 20 in {
+def : Pat<(v4f32 (X86vzmovl (v4f32 (scalar_to_vector (loadf32 addr:$src))))),
+          (SUBREG_TO_REG (i32 0), (MOVSSrm addr:$src), x86_subreg_ss)>;
+def : Pat<(v4f32 (scalar_to_vector (loadf32 addr:$src))),
+          (SUBREG_TO_REG (i32 0), (MOVSSrm addr:$src), x86_subreg_ss)>;
+def : Pat<(v4f32 (X86vzmovl (loadv4f32 addr:$src))),
+          (SUBREG_TO_REG (i32 0), (MOVSSrm addr:$src), x86_subreg_ss)>;
+}
+
+// Store scalar value to memory.
 def MOVSSmr : SSI<0x11, MRMDestMem, (outs), (ins f32mem:$dst, FR32:$src),
                   "movss\t{$src, $dst|$dst, $src}",
                   [(store FR32:$src, addr:$dst)]>;
 
+// Extract and store.
+def : Pat<(store (f32 (vector_extract (v4f32 VR128:$src), (iPTR 0))),
+                 addr:$dst),
+          (MOVSSmr addr:$dst,
+                   (EXTRACT_SUBREG (v4f32 VR128:$src), x86_subreg_ss))>;
+
 // Conversion instructions
 def CVTTSS2SIrr : SSI<0x2C, MRMSrcReg, (outs GR32:$dst), (ins FR32:$src),
                       "cvttss2si\t{$src, $dst|$dst, $src}",
@@ -518,7 +582,7 @@ def FsMOVAPSrr : PSI<0x28, MRMSrcReg, (outs FR32:$dst), (ins FR32:$src),
 
 // Alias instruction to load FR32 from f128mem using movaps. Upper bits are
 // disregarded.
-let canFoldAsLoad = 1, isReMaterializable = 1, mayHaveSideEffects = 1 in
+let canFoldAsLoad = 1, isReMaterializable = 1 in
 def FsMOVAPSrm : PSI<0x28, MRMSrcMem, (outs FR32:$dst), (ins f128mem:$src),
                      "movaps\t{$src, $dst|$dst, $src}",
                      [(set FR32:$dst, (alignedloadfsf32 addr:$src))]>;
@@ -715,7 +779,7 @@ defm MIN : sse1_fp_binop_rm<0x5D, "min", X86fmin,
 let neverHasSideEffects = 1 in
 def MOVAPSrr : PSI<0x28, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src),
                    "movaps\t{$src, $dst|$dst, $src}", []>;
-let canFoldAsLoad = 1, isReMaterializable = 1, mayHaveSideEffects = 1 in
+let canFoldAsLoad = 1, isReMaterializable = 1 in
 def MOVAPSrm : PSI<0x28, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src),
                    "movaps\t{$src, $dst|$dst, $src}",
                    [(set VR128:$dst, (alignedloadv4f32 addr:$src))]>;
@@ -727,7 +791,7 @@ def MOVAPSmr : PSI<0x29, MRMDestMem, (outs), (ins f128mem:$dst, VR128:$src),
 let neverHasSideEffects = 1 in
 def MOVUPSrr : PSI<0x10, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src),
                    "movups\t{$src, $dst|$dst, $src}", []>;
-let canFoldAsLoad = 1, isReMaterializable = 1, mayHaveSideEffects = 1 in
+let canFoldAsLoad = 1, isReMaterializable = 1 in
 def MOVUPSrm : PSI<0x10, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src),
                    "movups\t{$src, $dst|$dst, $src}",
                    [(set VR128:$dst, (loadv4f32 addr:$src))]>;
@@ -736,7 +800,7 @@ def MOVUPSmr : PSI<0x11, MRMDestMem, (outs), (ins f128mem:$dst, VR128:$src),
                    [(store (v4f32 VR128:$src), addr:$dst)]>;
 
 // Intrinsic forms of MOVUPS load and store
-let canFoldAsLoad = 1, isReMaterializable = 1, mayHaveSideEffects = 1 in
+let canFoldAsLoad = 1, isReMaterializable = 1 in
 def MOVUPSrm_Int : PSI<0x10, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src),
                        "movups\t{$src, $dst|$dst, $src}",
                        [(set VR128:$dst, (int_x86_sse_loadu_ps addr:$src))]>;
@@ -796,9 +860,9 @@ def MOVHLPSrr : PSI<0x12, MRMSrcReg, (outs VR128:$dst),
 
 let AddedComplexity = 20 in {
 def : Pat<(v4f32 (movddup VR128:$src, (undef))),
-          (MOVLHPSrr VR128:$src, VR128:$src)>, Requires<[HasSSE1]>;
+          (MOVLHPSrr VR128:$src, VR128:$src)>;
 def : Pat<(v2i64 (movddup VR128:$src, (undef))),
-          (MOVLHPSrr VR128:$src, VR128:$src)>, Requires<[HasSSE1]>;
+          (MOVLHPSrr VR128:$src, VR128:$src)>;
 }
 
 
@@ -1013,10 +1077,33 @@ def PREFETCHNTA  : PSI<0x18, MRM0m, (outs), (ins i8mem:$src),
     "prefetchnta\t$src", [(prefetch addr:$src, imm, (i32 0))]>;
 
 // Non-temporal stores
-def MOVNTPSmr : PSI<0x2B, MRMDestMem, (outs), (ins i128mem:$dst, VR128:$src),
+def MOVNTPSmr_Int : PSI<0x2B, MRMDestMem, (outs), (ins i128mem:$dst, VR128:$src),
                     "movntps\t{$src, $dst|$dst, $src}",
                     [(int_x86_sse_movnt_ps addr:$dst, VR128:$src)]>;
 
+let AddedComplexity = 400 in { // Prefer non-temporal versions
+def MOVNTPSmr : PSI<0x2B, MRMDestMem, (outs), (ins f128mem:$dst, VR128:$src),
+                    "movntps\t{$src, $dst|$dst, $src}",
+                    [(alignednontemporalstore (v4f32 VR128:$src), addr:$dst)]>;
+
+def MOVNTDQ_64mr : PDI<0xE7, MRMDestMem, (outs), (ins f128mem:$dst, VR128:$src),
+                    "movntdq\t{$src, $dst|$dst, $src}",
+                    [(alignednontemporalstore (v2f64 VR128:$src), addr:$dst)]>;
+
+def : Pat<(alignednontemporalstore (v2i64 VR128:$src), addr:$dst),
+          (MOVNTDQ_64mr VR128:$src, addr:$dst)>;
+
+def MOVNTImr : I<0xC3, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src),
+                 "movnti\t{$src, $dst|$dst, $src}",
+                 [(nontemporalstore (i32 GR32:$src), addr:$dst)]>,
+               TB, Requires<[HasSSE2]>;
+
+def MOVNTI_64mr : RI<0xC3, MRMDestMem, (outs), (ins i64mem:$dst, GR64:$src),
+                     "movnti\t{$src, $dst|$dst, $src}",
+                     [(nontemporalstore (i64 GR64:$src), addr:$dst)]>,
+                  TB, Requires<[HasSSE2]>;
+}
+
 // Load, store, and memory fence
 def SFENCE : PSI<0xAE, MRM7r, (outs), (ins), "sfence", [(int_x86_sse_sfence)]>;
 
@@ -1035,84 +1122,73 @@ let isReMaterializable = 1, isAsCheapAsAMove = 1, canFoldAsLoad = 1,
 def V_SET0 : PSI<0x57, MRMInitReg, (outs VR128:$dst), (ins), "",
                  [(set VR128:$dst, (v4i32 immAllZerosV))]>;
 
-let Predicates = [HasSSE1] in {
-  def : Pat<(v2i64 immAllZerosV), (V_SET0)>;
-  def : Pat<(v8i16 immAllZerosV), (V_SET0)>;
-  def : Pat<(v16i8 immAllZerosV), (V_SET0)>;
-  def : Pat<(v2f64 immAllZerosV), (V_SET0)>;
-  def : Pat<(v4f32 immAllZerosV), (V_SET0)>;
-}
-
-// FR32 to 128-bit vector conversion.
-let isAsCheapAsAMove = 1 in
-def MOVSS2PSrr : SSI<0x10, MRMSrcReg, (outs VR128:$dst), (ins FR32:$src),
-                      "movss\t{$src, $dst|$dst, $src}",
-                      [(set VR128:$dst,
-                        (v4f32 (scalar_to_vector FR32:$src)))]>;
-def MOVSS2PSrm : SSI<0x10, MRMSrcMem, (outs VR128:$dst), (ins f32mem:$src),
-                     "movss\t{$src, $dst|$dst, $src}",
-                     [(set VR128:$dst,
-                       (v4f32 (scalar_to_vector (loadf32 addr:$src))))]>;
-
-// FIXME: may not be able to eliminate this movss with coalescing the src and
-// dest register classes are different. We really want to write this pattern
-// like this:
-// def : Pat<(f32 (vector_extract (v4f32 VR128:$src), (iPTR 0))),
-//           (f32 FR32:$src)>;
-let isAsCheapAsAMove = 1 in
-def MOVPS2SSrr : SSI<0x10, MRMSrcReg, (outs FR32:$dst), (ins VR128:$src),
-                     "movss\t{$src, $dst|$dst, $src}",
-                     [(set FR32:$dst, (vector_extract (v4f32 VR128:$src),
-                                       (iPTR 0)))]>;
-def MOVPS2SSmr : SSI<0x11, MRMDestMem, (outs), (ins f32mem:$dst, VR128:$src),
-                     "movss\t{$src, $dst|$dst, $src}",
-                     [(store (f32 (vector_extract (v4f32 VR128:$src),
-                                   (iPTR 0))), addr:$dst)]>;
-
-
-// Move to lower bits of a VR128, leaving upper bits alone.
-// Three operand (but two address) aliases.
-let Constraints = "$src1 = $dst" in {
-let neverHasSideEffects = 1 in
-  def MOVLSS2PSrr : SSI<0x10, MRMSrcReg,
-                        (outs VR128:$dst), (ins VR128:$src1, FR32:$src2),
-                        "movss\t{$src2, $dst|$dst, $src2}", []>;
-
-  let AddedComplexity = 15 in
-    def MOVLPSrr : SSI<0x10, MRMSrcReg,
-                       (outs VR128:$dst), (ins VR128:$src1, VR128:$src2),
-                       "movss\t{$src2, $dst|$dst, $src2}",
-                       [(set VR128:$dst,
-                         (v4f32 (movl VR128:$src1, VR128:$src2)))]>;
-}
+def : Pat<(v2i64 immAllZerosV), (V_SET0)>;
+def : Pat<(v8i16 immAllZerosV), (V_SET0)>;
+def : Pat<(v16i8 immAllZerosV), (V_SET0)>;
+def : Pat<(v2f64 immAllZerosV), (V_SET0)>;
+def : Pat<(v4f32 immAllZerosV), (V_SET0)>;
 
-// Move to lower bits of a VR128 and zeroing upper bits.
-// Loading from memory automatically zeroing upper bits.
-let AddedComplexity = 20 in
-def MOVZSS2PSrm : SSI<0x10, MRMSrcMem, (outs VR128:$dst), (ins f32mem:$src),
-                      "movss\t{$src, $dst|$dst, $src}",
-                   [(set VR128:$dst, (v4f32 (X86vzmovl (v4f32 (scalar_to_vector
-                                                    (loadf32 addr:$src))))))]>;
-
-def : Pat<(v4f32 (X86vzmovl (loadv4f32 addr:$src))),
-          (MOVZSS2PSrm addr:$src)>;
+def : Pat<(f32 (vector_extract (v4f32 VR128:$src), (iPTR 0))),
+          (f32 (EXTRACT_SUBREG (v4f32 VR128:$src), x86_subreg_ss))>;
 
 //===---------------------------------------------------------------------===//
 // SSE2 Instructions
 //===---------------------------------------------------------------------===//
 
-// Move Instructions
-let neverHasSideEffects = 1 in
-def MOVSDrr : SDI<0x10, MRMSrcReg, (outs FR64:$dst), (ins FR64:$src),
-                  "movsd\t{$src, $dst|$dst, $src}", []>;
-let canFoldAsLoad = 1, isReMaterializable = 1, mayHaveSideEffects = 1 in
+// Move Instructions. Register-to-register movsd is not used for FR64
+// register copies because it's a partial register update; FsMOVAPDrr is
+// used instead. Register-to-register movsd is not modeled as an INSERT_SUBREG
+// because INSERT_SUBREG requires that the insert be implementable in terms of
+// a copy, and just mentioned, we don't use movsd for copies.
+let Constraints = "$src1 = $dst" in
+def MOVSDrr : SDI<0x10, MRMSrcReg,
+                  (outs VR128:$dst), (ins VR128:$src1, FR64:$src2),
+                  "movsd\t{$src2, $dst|$dst, $src2}",
+                  [(set VR128:$dst,
+                        (movl VR128:$src1, (scalar_to_vector FR64:$src2)))]>;
+
+// Extract the low 64-bit value from one vector and insert it into another.
+let AddedComplexity = 15 in
+def : Pat<(v2f64 (movl VR128:$src1, VR128:$src2)),
+          (MOVSDrr VR128:$src1,
+                   (EXTRACT_SUBREG (v2f64 VR128:$src2), x86_subreg_sd))>;
+
+// Implicitly promote a 64-bit scalar to a vector.
+def : Pat<(v2f64 (scalar_to_vector FR64:$src)),
+          (INSERT_SUBREG (v2f64 (IMPLICIT_DEF)), FR64:$src, x86_subreg_sd)>;
+
+// Loading from memory automatically zeroing upper bits.
+let canFoldAsLoad = 1, isReMaterializable = 1, AddedComplexity = 20 in
 def MOVSDrm : SDI<0x10, MRMSrcMem, (outs FR64:$dst), (ins f64mem:$src),
                   "movsd\t{$src, $dst|$dst, $src}",
                   [(set FR64:$dst, (loadf64 addr:$src))]>;
+
+// MOVSDrm zeros the high parts of the register; represent this
+// with SUBREG_TO_REG.
+let AddedComplexity = 20 in {
+def : Pat<(v2f64 (X86vzmovl (v2f64 (scalar_to_vector (loadf64 addr:$src))))),
+          (SUBREG_TO_REG (i64 0), (MOVSDrm addr:$src), x86_subreg_sd)>;
+def : Pat<(v2f64 (scalar_to_vector (loadf64 addr:$src))),
+          (SUBREG_TO_REG (i64 0), (MOVSDrm addr:$src), x86_subreg_sd)>;
+def : Pat<(v2f64 (X86vzmovl (loadv2f64 addr:$src))),
+          (SUBREG_TO_REG (i64 0), (MOVSDrm addr:$src), x86_subreg_sd)>;
+def : Pat<(v2f64 (X86vzmovl (bc_v2f64 (loadv4f32 addr:$src)))),
+          (SUBREG_TO_REG (i64 0), (MOVSDrm addr:$src), x86_subreg_sd)>;
+def : Pat<(v2f64 (X86vzload addr:$src)),
+          (SUBREG_TO_REG (i64 0), (MOVSDrm addr:$src), x86_subreg_sd)>;
+}
+
+// Store scalar value to memory.
 def MOVSDmr : SDI<0x11, MRMDestMem, (outs), (ins f64mem:$dst, FR64:$src),
                   "movsd\t{$src, $dst|$dst, $src}",
                   [(store FR64:$src, addr:$dst)]>;
 
+// Extract and store.
+def : Pat<(store (f64 (vector_extract (v2f64 VR128:$src), (iPTR 0))),
+                 addr:$dst),
+          (MOVSDmr addr:$dst,
+                   (EXTRACT_SUBREG (v2f64 VR128:$src), x86_subreg_sd))>;
+
 // Conversion instructions
 def CVTTSD2SIrr : SDI<0x2C, MRMSrcReg, (outs GR32:$dst), (ins FR64:$src),
                       "cvttsd2si\t{$src, $dst|$dst, $src}",
@@ -1166,7 +1242,8 @@ def CVTSS2SDrm : I<0x5A, MRMSrcMem, (outs FR64:$dst), (ins f32mem:$src),
                  Requires<[HasSSE2, OptForSize]>;
 
 def : Pat<(extloadf32 addr:$src),
-          (CVTSS2SDrr (MOVSSrm addr:$src))>, Requires<[HasSSE2, OptForSpeed]>;
+          (CVTSS2SDrr (MOVSSrm addr:$src))>,
+      Requires<[HasSSE2, OptForSpeed]>;
 
 // Match intrinsics which expect XMM operand(s).
 def Int_CVTSD2SIrr : SDI<0x2D, MRMSrcReg, (outs GR32:$dst), (ins VR128:$src),
@@ -1285,7 +1362,7 @@ def FsMOVAPDrr : PDI<0x28, MRMSrcReg, (outs FR64:$dst), (ins FR64:$src),
 
 // Alias instruction to load FR64 from f128mem using movapd. Upper bits are
 // disregarded.
-let canFoldAsLoad = 1, isReMaterializable = 1, mayHaveSideEffects = 1 in
+let canFoldAsLoad = 1, isReMaterializable = 1 in
 def FsMOVAPDrm : PDI<0x28, MRMSrcMem, (outs FR64:$dst), (ins f128mem:$src),
                      "movapd\t{$src, $dst|$dst, $src}",
                      [(set FR64:$dst, (alignedloadfsf64 addr:$src))]>;
@@ -1483,7 +1560,7 @@ defm MIN : sse2_fp_binop_rm<0x5D, "min", X86fmin,
 let neverHasSideEffects = 1 in
 def MOVAPDrr : PDI<0x28, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src),
                    "movapd\t{$src, $dst|$dst, $src}", []>;
-let canFoldAsLoad = 1, isReMaterializable = 1, mayHaveSideEffects = 1 in
+let canFoldAsLoad = 1, isReMaterializable = 1 in
 def MOVAPDrm : PDI<0x28, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src),
                    "movapd\t{$src, $dst|$dst, $src}",
                    [(set VR128:$dst, (alignedloadv2f64 addr:$src))]>;
@@ -2298,17 +2375,30 @@ def MASKMOVDQU64 : PDI<0xF7, MRMSrcReg, (outs), (ins VR128:$src, VR128:$mask),
                      [(int_x86_sse2_maskmov_dqu VR128:$src, VR128:$mask, RDI)]>;
 
 // Non-temporal stores
-def MOVNTPDmr : PDI<0x2B, MRMDestMem, (outs), (ins i128mem:$dst, VR128:$src),
-                    "movntpd\t{$src, $dst|$dst, $src}",
-                    [(int_x86_sse2_movnt_pd addr:$dst, VR128:$src)]>;
-def MOVNTDQmr : PDI<0xE7, MRMDestMem, (outs), (ins f128mem:$dst, VR128:$src),
-                    "movntdq\t{$src, $dst|$dst, $src}",
-                    [(int_x86_sse2_movnt_dq addr:$dst, VR128:$src)]>;
-def MOVNTImr  :   I<0xC3, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src),
+def MOVNTPDmr_Int : PDI<0x2B, MRMDestMem, (outs), (ins i128mem:$dst, VR128:$src),
+                        "movntpd\t{$src, $dst|$dst, $src}",
+                        [(int_x86_sse2_movnt_pd addr:$dst, VR128:$src)]>;
+def MOVNTDQmr_Int : PDI<0xE7, MRMDestMem, (outs), (ins f128mem:$dst, VR128:$src),
+                        "movntdq\t{$src, $dst|$dst, $src}",
+                        [(int_x86_sse2_movnt_dq addr:$dst, VR128:$src)]>;
+def MOVNTImr_Int  :   I<0xC3, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src),
                     "movnti\t{$src, $dst|$dst, $src}",
                     [(int_x86_sse2_movnt_i addr:$dst, GR32:$src)]>,
                   TB, Requires<[HasSSE2]>;
 
+let AddedComplexity = 400 in { // Prefer non-temporal versions
+def MOVNTPDmr : PDI<0x2B, MRMDestMem, (outs), (ins f128mem:$dst, VR128:$src),
+                    "movntpd\t{$src, $dst|$dst, $src}",
+                    [(alignednontemporalstore(v2f64 VR128:$src), addr:$dst)]>;
+
+def MOVNTDQmr : PDI<0xE7, MRMDestMem, (outs), (ins f128mem:$dst, VR128:$src),
+                    "movntdq\t{$src, $dst|$dst, $src}",
+                    [(alignednontemporalstore (v4f32 VR128:$src), addr:$dst)]>;
+
+def : Pat<(alignednontemporalstore (v4i32 VR128:$src), addr:$dst),
+          (MOVNTDQmr VR128:$src, addr:$dst)>;
+}
+
 // Flush cache
 def CLFLUSH : I<0xAE, MRM7m, (outs), (ins i8mem:$src),
                "clflush\t$src", [(int_x86_sse2_clflush addr:$src)]>,
@@ -2321,11 +2411,11 @@ def MFENCE : I<0xAE, MRM_F0, (outs), (ins),
                "mfence", [(int_x86_sse2_mfence)]>, TB, Requires<[HasSSE2]>;
 
 //TODO: custom lower this so as to never even generate the noop
-def : Pat<(membarrier (i8 imm:$ll), (i8 imm:$ls), (i8 imm:$sl), (i8 imm:$ss),
+def : Pat<(membarrier (i8 imm), (i8 imm), (i8 imm), (i8 imm),
            (i8 0)), (NOOP)>;
 def : Pat<(membarrier (i8 0), (i8 0), (i8 0), (i8 1), (i8 1)), (SFENCE)>;
 def : Pat<(membarrier (i8 1), (i8 0), (i8 0), (i8 0), (i8 1)), (LFENCE)>;
-def : Pat<(membarrier (i8 imm:$ll), (i8 imm:$ls), (i8 imm:$sl), (i8 imm:$ss),
+def : Pat<(membarrier (i8 imm), (i8 imm), (i8 imm), (i8 imm),
            (i8 1)), (MFENCE)>;
 
 // Alias instructions that map zero vector to pxor / xorp* for sse.
@@ -2337,17 +2427,6 @@ let isReMaterializable = 1, isAsCheapAsAMove = 1, canFoldAsLoad = 1,
   def V_SETALLONES : PDI<0x76, MRMInitReg, (outs VR128:$dst), (ins), "",
                          [(set VR128:$dst, (v4i32 immAllOnesV))]>;
 
-// FR64 to 128-bit vector conversion.
-let isAsCheapAsAMove = 1 in
-def MOVSD2PDrr : SDI<0x10, MRMSrcReg, (outs VR128:$dst), (ins FR64:$src),
-                      "movsd\t{$src, $dst|$dst, $src}",
-                      [(set VR128:$dst,
-                        (v2f64 (scalar_to_vector FR64:$src)))]>;
-def MOVSD2PDrm : SDI<0x10, MRMSrcMem, (outs VR128:$dst), (ins f64mem:$src),
-                     "movsd\t{$src, $dst|$dst, $src}",
-                     [(set VR128:$dst,
-                       (v2f64 (scalar_to_vector (loadf64 addr:$src))))]>;
-
 def MOVDI2PDIrr : PDI<0x6E, MRMSrcReg, (outs VR128:$dst), (ins GR32:$src),
                       "movd\t{$src, $dst|$dst, $src}",
                       [(set VR128:$dst,
@@ -2376,20 +2455,9 @@ def MOVPQI2QImr : PDI<0xD6, MRMDestMem, (outs), (ins i64mem:$dst, VR128:$src),
                       [(store (i64 (vector_extract (v2i64 VR128:$src),
                                     (iPTR 0))), addr:$dst)]>;
 
-// FIXME: may not be able to eliminate this movss with coalescing the src and
-// dest register classes are different. We really want to write this pattern
-// like this:
-// def : Pat<(f32 (vector_extract (v4f32 VR128:$src), (iPTR 0))),
-//           (f32 FR32:$src)>;
-let isAsCheapAsAMove = 1 in
-def MOVPD2SDrr : SDI<0x10, MRMSrcReg, (outs FR64:$dst), (ins VR128:$src),
-                     "movsd\t{$src, $dst|$dst, $src}",
-                     [(set FR64:$dst, (vector_extract (v2f64 VR128:$src),
-                                       (iPTR 0)))]>;
-def MOVPD2SDmr : SDI<0x11, MRMDestMem, (outs), (ins f64mem:$dst, VR128:$src),
-                     "movsd\t{$src, $dst|$dst, $src}",
-                     [(store (f64 (vector_extract (v2f64 VR128:$src),
-                                   (iPTR 0))), addr:$dst)]>;
+def : Pat<(f64 (vector_extract (v2f64 VR128:$src), (iPTR 0))),
+          (f64 (EXTRACT_SUBREG (v2f64 VR128:$src), x86_subreg_sd))>;
+
 def MOVPDI2DIrr  : PDI<0x7E, MRMDestReg, (outs GR32:$dst), (ins VR128:$src),
                        "movd\t{$src, $dst|$dst, $src}",
                        [(set GR32:$dst, (vector_extract (v4i32 VR128:$src),
@@ -2406,44 +2474,11 @@ def MOVSS2DImr  : PDI<0x7E, MRMDestMem, (outs), (ins i32mem:$dst, FR32:$src),
                       "movd\t{$src, $dst|$dst, $src}",
                       [(store (i32 (bitconvert FR32:$src)), addr:$dst)]>;
 
-
-// Move to lower bits of a VR128, leaving upper bits alone.
-// Three operand (but two address) aliases.
-let Constraints = "$src1 = $dst" in {
-  let neverHasSideEffects = 1 in
-  def MOVLSD2PDrr : SDI<0x10, MRMSrcReg,
-                        (outs VR128:$dst), (ins VR128:$src1, FR64:$src2),
-                        "movsd\t{$src2, $dst|$dst, $src2}", []>;
-
-  let AddedComplexity = 15 in
-    def MOVLPDrr : SDI<0x10, MRMSrcReg,
-                       (outs VR128:$dst), (ins VR128:$src1, VR128:$src2),
-                       "movsd\t{$src2, $dst|$dst, $src2}",
-                       [(set VR128:$dst,
-                         (v2f64 (movl VR128:$src1, VR128:$src2)))]>;
-}
-
 // Store / copy lower 64-bits of a XMM register.
 def MOVLQ128mr : PDI<0xD6, MRMDestMem, (outs), (ins i64mem:$dst, VR128:$src),
                      "movq\t{$src, $dst|$dst, $src}",
                      [(int_x86_sse2_storel_dq addr:$dst, VR128:$src)]>;
 
-// Move to lower bits of a VR128 and zeroing upper bits.
-// Loading from memory automatically zeroing upper bits.
-let AddedComplexity = 20 in {
-def MOVZSD2PDrm : SDI<0x10, MRMSrcMem, (outs VR128:$dst), (ins f64mem:$src),
-                      "movsd\t{$src, $dst|$dst, $src}",
-                      [(set VR128:$dst,
-                        (v2f64 (X86vzmovl (v2f64 (scalar_to_vector
-                                                 (loadf64 addr:$src))))))]>;
-
-def : Pat<(v2f64 (X86vzmovl (loadv2f64 addr:$src))),
-            (MOVZSD2PDrm addr:$src)>;
-def : Pat<(v2f64 (X86vzmovl (bc_v2f64 (loadv4f32 addr:$src)))),
-            (MOVZSD2PDrm addr:$src)>;
-def : Pat<(v2f64 (X86vzload addr:$src)), (MOVZSD2PDrm addr:$src)>;
-}
-
 // movd / movq to XMM register zero-extends
 let AddedComplexity = 15 in {
 def MOVZDI2PDIrr : PDI<0x6E, MRMSrcReg, (outs VR128:$dst), (ins GR32:$src),
@@ -2989,13 +3024,15 @@ let Predicates = [HasSSE2] in {
 let AddedComplexity = 15 in {
 // Zeroing a VR128 then do a MOVS{S|D} to the lower bits.
 def : Pat<(v2f64 (X86vzmovl (v2f64 (scalar_to_vector FR64:$src)))),
-          (MOVLSD2PDrr (V_SET0), FR64:$src)>, Requires<[HasSSE2]>;
+          (MOVSDrr (v2f64 (V_SET0)), FR64:$src)>;
 def : Pat<(v4f32 (X86vzmovl (v4f32 (scalar_to_vector FR32:$src)))),
-          (MOVLSS2PSrr (V_SET0), FR32:$src)>, Requires<[HasSSE1]>;
+          (MOVSSrr (v4f32 (V_SET0)), FR32:$src)>;
 def : Pat<(v4f32 (X86vzmovl (v4f32 VR128:$src))),
-          (MOVLPSrr (V_SET0), VR128:$src)>, Requires<[HasSSE1]>;
+          (MOVSSrr (v4f32 (V_SET0)),
+                   (f32 (EXTRACT_SUBREG (v4f32 VR128:$src), x86_subreg_ss)))>;
 def : Pat<(v4i32 (X86vzmovl (v4i32 VR128:$src))),
-          (MOVLPSrr (V_SET0), VR128:$src)>, Requires<[HasSSE1]>;
+          (MOVSSrr (v4i32 (V_SET0)),
+                   (EXTRACT_SUBREG (v4i32 VR128:$src), x86_subreg_ss))>;
 }
 
 // Splat v2f64 / v2i64
@@ -3013,8 +3050,7 @@ def : Pat<(unpckh (v2i64 VR128:$src), (undef)),
 // Special unary SHUFPSrri case.
 def : Pat<(v4f32 (pshufd:$src3 VR128:$src1, (undef))),
           (SHUFPSrri VR128:$src1, VR128:$src1,
-                     (SHUFFLE_get_shuf_imm VR128:$src3))>,
-      Requires<[HasSSE1]>;
+                     (SHUFFLE_get_shuf_imm VR128:$src3))>;
 let AddedComplexity = 5 in
 def : Pat<(v4f32 (pshufd:$src2 VR128:$src1, (undef))),
           (PSHUFDri VR128:$src1, (SHUFFLE_get_shuf_imm VR128:$src2))>,
@@ -3060,13 +3096,13 @@ def : Pat<(v4f32 (unpckl_undef:$src2 VR128:$src, (undef))),
 }
 let AddedComplexity = 10 in {
 def : Pat<(v4f32 (unpckl_undef VR128:$src, (undef))),
-          (UNPCKLPSrr VR128:$src, VR128:$src)>, Requires<[HasSSE1]>;
+          (UNPCKLPSrr VR128:$src, VR128:$src)>;
 def : Pat<(v16i8 (unpckl_undef VR128:$src, (undef))),
-          (PUNPCKLBWrr VR128:$src, VR128:$src)>, Requires<[HasSSE2]>;
+          (PUNPCKLBWrr VR128:$src, VR128:$src)>;
 def : Pat<(v8i16 (unpckl_undef VR128:$src, (undef))),
-          (PUNPCKLWDrr VR128:$src, VR128:$src)>, Requires<[HasSSE2]>;
+          (PUNPCKLWDrr VR128:$src, VR128:$src)>;
 def : Pat<(v4i32 (unpckl_undef VR128:$src, (undef))),
-          (PUNPCKLDQrr VR128:$src, VR128:$src)>, Requires<[HasSSE2]>;
+          (PUNPCKLDQrr VR128:$src, VR128:$src)>;
 }
 
 // vector_shuffle v1, <undef>, <2, 2, 3, 3, ...>
@@ -3080,13 +3116,13 @@ def : Pat<(v4f32 (unpckh_undef:$src2 VR128:$src, (undef))),
 }
 let AddedComplexity = 10 in {
 def : Pat<(v4f32 (unpckh_undef VR128:$src, (undef))),
-          (UNPCKHPSrr VR128:$src, VR128:$src)>, Requires<[HasSSE1]>;
+          (UNPCKHPSrr VR128:$src, VR128:$src)>;
 def : Pat<(v16i8 (unpckh_undef VR128:$src, (undef))),
-          (PUNPCKHBWrr VR128:$src, VR128:$src)>, Requires<[HasSSE2]>;
+          (PUNPCKHBWrr VR128:$src, VR128:$src)>;
 def : Pat<(v8i16 (unpckh_undef VR128:$src, (undef))),
-          (PUNPCKHWDrr VR128:$src, VR128:$src)>, Requires<[HasSSE2]>;
+          (PUNPCKHWDrr VR128:$src, VR128:$src)>;
 def : Pat<(v4i32 (unpckh_undef VR128:$src, (undef))),
-          (PUNPCKHDQrr VR128:$src, VR128:$src)>, Requires<[HasSSE2]>;
+          (PUNPCKHDQrr VR128:$src, VR128:$src)>;
 }
 
 let AddedComplexity = 20 in {
@@ -3108,45 +3144,49 @@ def : Pat<(v4i32 (movhlps_undef VR128:$src1, (undef))),
 let AddedComplexity = 20 in {
 // vector_shuffle v1, (load v2) <4, 5, 2, 3> using MOVLPS
 def : Pat<(v4f32 (movlp VR128:$src1, (load addr:$src2))),
-          (MOVLPSrm VR128:$src1, addr:$src2)>, Requires<[HasSSE1]>;
+          (MOVLPSrm VR128:$src1, addr:$src2)>;
 def : Pat<(v2f64 (movlp VR128:$src1, (load addr:$src2))),
-          (MOVLPDrm VR128:$src1, addr:$src2)>, Requires<[HasSSE2]>;
+          (MOVLPDrm VR128:$src1, addr:$src2)>;
 def : Pat<(v4i32 (movlp VR128:$src1, (load addr:$src2))),
-          (MOVLPSrm VR128:$src1, addr:$src2)>, Requires<[HasSSE2]>;
+          (MOVLPSrm VR128:$src1, addr:$src2)>;
 def : Pat<(v2i64 (movlp VR128:$src1, (load addr:$src2))),
-          (MOVLPDrm VR128:$src1, addr:$src2)>, Requires<[HasSSE2]>;
+          (MOVLPDrm VR128:$src1, addr:$src2)>;
 }
 
 // (store (vector_shuffle (load addr), v2, <4, 5, 2, 3>), addr) using MOVLPS
 def : Pat<(store (v4f32 (movlp (load addr:$src1), VR128:$src2)), addr:$src1),
-          (MOVLPSmr addr:$src1, VR128:$src2)>, Requires<[HasSSE1]>;
+          (MOVLPSmr addr:$src1, VR128:$src2)>;
 def : Pat<(store (v2f64 (movlp (load addr:$src1), VR128:$src2)), addr:$src1),
-          (MOVLPDmr addr:$src1, VR128:$src2)>, Requires<[HasSSE2]>;
+          (MOVLPDmr addr:$src1, VR128:$src2)>;
 def : Pat<(store (v4i32 (movlp (bc_v4i32 (loadv2i64 addr:$src1)), VR128:$src2)),
                  addr:$src1),
-          (MOVLPSmr addr:$src1, VR128:$src2)>, Requires<[HasSSE1]>;
+          (MOVLPSmr addr:$src1, VR128:$src2)>;
 def : Pat<(store (v2i64 (movlp (load addr:$src1), VR128:$src2)), addr:$src1),
-          (MOVLPDmr addr:$src1, VR128:$src2)>, Requires<[HasSSE2]>;
+          (MOVLPDmr addr:$src1, VR128:$src2)>;
 
 let AddedComplexity = 15 in {
 // Setting the lowest element in the vector.
 def : Pat<(v4i32 (movl VR128:$src1, VR128:$src2)),
-          (MOVLPSrr VR128:$src1, VR128:$src2)>, Requires<[HasSSE2]>;
+          (MOVSSrr (v4i32 VR128:$src1),
+                   (EXTRACT_SUBREG (v4i32 VR128:$src2), x86_subreg_ss))>;
 def : Pat<(v2i64 (movl VR128:$src1, VR128:$src2)),
-          (MOVLPDrr VR128:$src1, VR128:$src2)>, Requires<[HasSSE2]>;
+          (MOVSDrr (v2i64 VR128:$src1),
+                   (EXTRACT_SUBREG (v2i64 VR128:$src2), x86_subreg_sd))>;
 
-// vector_shuffle v1, v2 <4, 5, 2, 3> using MOVLPDrr (movsd)
+// vector_shuffle v1, v2 <4, 5, 2, 3> using movsd
 def : Pat<(v4f32 (movlp VR128:$src1, VR128:$src2)),
-          (MOVLPDrr VR128:$src1, VR128:$src2)>, Requires<[HasSSE2]>;
+          (MOVSDrr VR128:$src1, (EXTRACT_SUBREG VR128:$src2, x86_subreg_sd))>,
+      Requires<[HasSSE2]>;
 def : Pat<(v4i32 (movlp VR128:$src1, VR128:$src2)),
-          (MOVLPDrr VR128:$src1, VR128:$src2)>, Requires<[HasSSE2]>;
+          (MOVSDrr VR128:$src1, (EXTRACT_SUBREG VR128:$src2, x86_subreg_sd))>,
+      Requires<[HasSSE2]>;
 }
 
 // vector_shuffle v1, v2 <4, 5, 2, 3> using SHUFPSrri (we prefer movsd, but
 // fall back to this for SSE1)
 def : Pat<(v4f32 (movlp:$src3 VR128:$src1, (v4f32 VR128:$src2))),
           (SHUFPSrri VR128:$src2, VR128:$src1,
-                     (SHUFFLE_get_shuf_imm VR128:$src3))>, Requires<[HasSSE1]>;
+                     (SHUFFLE_get_shuf_imm VR128:$src3))>;
 
 // Set lowest element and zero upper elements.
 let AddedComplexity = 15 in
@@ -3188,30 +3228,30 @@ def : Pat<(v2i32 (fp_to_sint (v2f64 VR128:$src))),
 
 // Use movaps / movups for SSE integer load / store (one byte shorter).
 def : Pat<(alignedloadv4i32 addr:$src),
-          (MOVAPSrm addr:$src)>, Requires<[HasSSE1]>;
+          (MOVAPSrm addr:$src)>;
 def : Pat<(loadv4i32 addr:$src),
-          (MOVUPSrm addr:$src)>, Requires<[HasSSE1]>;
+          (MOVUPSrm addr:$src)>;
 def : Pat<(alignedloadv2i64 addr:$src),
-          (MOVAPSrm addr:$src)>, Requires<[HasSSE2]>;
+          (MOVAPSrm addr:$src)>;
 def : Pat<(loadv2i64 addr:$src),
-          (MOVUPSrm addr:$src)>, Requires<[HasSSE2]>;
+          (MOVUPSrm addr:$src)>;
 
 def : Pat<(alignedstore (v2i64 VR128:$src), addr:$dst),
-          (MOVAPSmr addr:$dst, VR128:$src)>, Requires<[HasSSE2]>;
+          (MOVAPSmr addr:$dst, VR128:$src)>;
 def : Pat<(alignedstore (v4i32 VR128:$src), addr:$dst),
-          (MOVAPSmr addr:$dst, VR128:$src)>, Requires<[HasSSE2]>;
+          (MOVAPSmr addr:$dst, VR128:$src)>;
 def : Pat<(alignedstore (v8i16 VR128:$src), addr:$dst),
-          (MOVAPSmr addr:$dst, VR128:$src)>, Requires<[HasSSE2]>;
+          (MOVAPSmr addr:$dst, VR128:$src)>;
 def : Pat<(alignedstore (v16i8 VR128:$src), addr:$dst),
-          (MOVAPSmr addr:$dst, VR128:$src)>, Requires<[HasSSE2]>;
+          (MOVAPSmr addr:$dst, VR128:$src)>;
 def : Pat<(store (v2i64 VR128:$src), addr:$dst),
-          (MOVUPSmr addr:$dst, VR128:$src)>, Requires<[HasSSE2]>;
+          (MOVUPSmr addr:$dst, VR128:$src)>;
 def : Pat<(store (v4i32 VR128:$src), addr:$dst),
-          (MOVUPSmr addr:$dst, VR128:$src)>, Requires<[HasSSE2]>;
+          (MOVUPSmr addr:$dst, VR128:$src)>;
 def : Pat<(store (v8i16 VR128:$src), addr:$dst),
-          (MOVUPSmr addr:$dst, VR128:$src)>, Requires<[HasSSE2]>;
+          (MOVUPSmr addr:$dst, VR128:$src)>;
 def : Pat<(store (v16i8 VR128:$src), addr:$dst),
-          (MOVUPSmr addr:$dst, VR128:$src)>, Requires<[HasSSE2]>;
+          (MOVUPSmr addr:$dst, VR128:$src)>;
 
 //===----------------------------------------------------------------------===//
 // SSE4.1 Instructions
@@ -3400,7 +3440,7 @@ let Constraints = "$src1 = $dst" in {
                    (ins VR128:$src1, i128mem:$src2),
                    !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"),
                    [(set VR128:$dst,
-                     (OpNode VR128:$src1, (memop addr:$src2)))]>, OpSize;
+                     (OpVT (OpNode VR128:$src1, (memop addr:$src2))))]>, OpSize;
     def rm_int : SS48I<opc, MRMSrcMem, (outs VR128:$dst),
                        (ins VR128:$src1, i128mem:$src2),
                        !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"),
diff --git a/libclamav/c++/llvm/lib/Target/X86/X86MCAsmInfo.cpp b/libclamav/c++/llvm/lib/Target/X86/X86MCAsmInfo.cpp
index 91c0fbb..250634f 100644
--- a/libclamav/c++/llvm/lib/Target/X86/X86MCAsmInfo.cpp
+++ b/libclamav/c++/llvm/lib/Target/X86/X86MCAsmInfo.cpp
@@ -55,6 +55,11 @@ X86MCAsmInfoDarwin::X86MCAsmInfoDarwin(const Triple &Triple) {
   if (!is64Bit)
     Data64bitsDirective = 0;       // we can't emit a 64-bit unit
 
+  // Use ## as a comment string so that .s files generated by llvm can go
+  // through the GCC preprocessor without causing an error.  This is needed
+  // because "clang foo.s" runs the C preprocessor, which is usually reserved
+  // for .S files on other systems.  Perhaps this is because the file system
+  // wasn't always case preserving or something.
   CommentString = "##";
   PCSymbol = ".";
 
@@ -70,6 +75,8 @@ X86ELFMCAsmInfo::X86ELFMCAsmInfo(const Triple &Triple) {
   AsmTransCBE = x86_asm_table;
   AssemblerDialect = AsmWriterFlavor;
 
+  TextAlignFillValue = 0x90;
+
   PrivateGlobalPrefix = ".L";
   WeakRefDirective = "\t.weak\t";
   PCSymbol = ".";
@@ -94,4 +101,6 @@ MCSection *X86ELFMCAsmInfo::getNonexecutableStackSection(MCContext &Ctx) const {
 X86MCAsmInfoCOFF::X86MCAsmInfoCOFF(const Triple &Triple) {
   AsmTransCBE = x86_asm_table;
   AssemblerDialect = AsmWriterFlavor;
-}
\ No newline at end of file
+
+  TextAlignFillValue = 0x90;
+}
diff --git a/libclamav/c++/llvm/lib/Target/X86/X86MCCodeEmitter.cpp b/libclamav/c++/llvm/lib/Target/X86/X86MCCodeEmitter.cpp
index d0ec0de..3f18696 100644
--- a/libclamav/c++/llvm/lib/Target/X86/X86MCCodeEmitter.cpp
+++ b/libclamav/c++/llvm/lib/Target/X86/X86MCCodeEmitter.cpp
@@ -153,14 +153,25 @@ EmitImmediate(const MCOperand &DispOp, unsigned Size, MCFixupKind FixupKind,
   // If this is a simple integer displacement that doesn't require a relocation,
   // emit it now.
   if (DispOp.isImm()) {
+    // FIXME: is this right for pc-rel encoding??  Probably need to emit this as
+    // a fixup if so.
     EmitConstant(DispOp.getImm()+ImmOffset, Size, CurByte, OS);
     return;
   }
 
   // If we have an immoffset, add it to the expression.
   const MCExpr *Expr = DispOp.getExpr();
+  
+  // If the fixup is pc-relative, we need to bias the value to be relative to
+  // the start of the field, not the end of the field.
+  if (FixupKind == MCFixupKind(X86::reloc_pcrel_4byte) ||
+      FixupKind == MCFixupKind(X86::reloc_riprel_4byte))
+    ImmOffset -= 4;
+  if (FixupKind == MCFixupKind(X86::reloc_pcrel_1byte))
+    ImmOffset -= 1;
+  
   if (ImmOffset)
-    Expr = MCBinaryExpr::CreateAdd(Expr,MCConstantExpr::Create(ImmOffset, Ctx),
+    Expr = MCBinaryExpr::CreateAdd(Expr, MCConstantExpr::Create(ImmOffset, Ctx),
                                    Ctx);
   
   // Emit a symbolic constant as a fixup and 4 zeros.
@@ -192,6 +203,7 @@ void X86MCCodeEmitter::EmitMemModRMByte(const MCInst &MI, unsigned Op,
     // the size of the immediate field.  If we have this case, add it into the
     // expression to emit.
     int ImmSize = X86II::hasImm(TSFlags) ? X86II::getSizeOfImm(TSFlags) : 0;
+    
     EmitImmediate(Disp, 4, MCFixupKind(X86::reloc_riprel_4byte),
                   CurByte, OS, Fixups, -ImmSize);
     return;
@@ -616,8 +628,6 @@ EncodeInstruction(const MCInst &MI, raw_ostream &OS,
   
   // If there is a remaining operand, it must be a trailing immediate.  Emit it
   // according to the right size for the instruction.
-  // FIXME: This should pass in whether the value is pc relative or not.  This
-  // information should be aquired from TSFlags as well.
   if (CurOp != NumOps)
     EmitImmediate(MI.getOperand(CurOp++),
                   X86II::getSizeOfImm(TSFlags), getImmFixupKind(TSFlags),
diff --git a/libclamav/c++/llvm/lib/Target/X86/X86RegisterInfo.cpp b/libclamav/c++/llvm/lib/Target/X86/X86RegisterInfo.cpp
index 8524236..946d6b2 100644
--- a/libclamav/c++/llvm/lib/Target/X86/X86RegisterInfo.cpp
+++ b/libclamav/c++/llvm/lib/Target/X86/X86RegisterInfo.cpp
@@ -191,6 +191,8 @@ X86RegisterInfo::getMatchingSuperRegClass(const TargetRegisterClass *A,
         return &X86::GR16_NOREXRegClass;
       else if (A == &X86::GR16_ABCDRegClass)
         return &X86::GR16_ABCDRegClass;
+    } else if (B == &X86::FR32RegClass) {
+      return A;
     }
     break;
   case 2:
@@ -207,6 +209,8 @@ X86RegisterInfo::getMatchingSuperRegClass(const TargetRegisterClass *A,
       else if (A == &X86::GR16RegClass || A == &X86::GR16_ABCDRegClass ||
                A == &X86::GR16_NOREXRegClass)
         return &X86::GR16_ABCDRegClass;
+    } else if (B == &X86::FR64RegClass) {
+      return A;
     }
     break;
   case 3:
@@ -234,6 +238,8 @@ X86RegisterInfo::getMatchingSuperRegClass(const TargetRegisterClass *A,
         return &X86::GR32_NOREXRegClass;
       else if (A == &X86::GR32_ABCDRegClass)
         return &X86::GR64_ABCDRegClass;
+    } else if (B == &X86::VR128RegClass) {
+      return A;
     }
     break;
   case 4:
@@ -446,8 +452,10 @@ bool X86RegisterInfo::canRealignStack(const MachineFunction &MF) const {
 
 bool X86RegisterInfo::needsStackRealignment(const MachineFunction &MF) const {
   const MachineFrameInfo *MFI = MF.getFrameInfo();
+  const Function *F = MF.getFunction();
   bool requiresRealignment =
-    RealignStack && (MFI->getMaxAlignment() > StackAlign);
+    RealignStack && ((MFI->getMaxAlignment() > StackAlign) ||
+                     F->hasFnAttr(Attribute::StackAlignment));
 
   // FIXME: Currently we don't support stack realignment for functions with
   //        variable-sized allocas.
diff --git a/libclamav/c++/llvm/lib/Target/X86/X86RegisterInfo.h b/libclamav/c++/llvm/lib/Target/X86/X86RegisterInfo.h
index 8fb5e92..e4bdb4e 100644
--- a/libclamav/c++/llvm/lib/Target/X86/X86RegisterInfo.h
+++ b/libclamav/c++/llvm/lib/Target/X86/X86RegisterInfo.h
@@ -35,7 +35,8 @@ namespace X86 {
   /// these indices must be kept in sync with the class indices in the 
   /// X86RegisterInfo.td file.
   enum SubregIndex {
-    SUBREG_8BIT = 1, SUBREG_8BIT_HI = 2, SUBREG_16BIT = 3, SUBREG_32BIT = 4
+    SUBREG_8BIT = 1, SUBREG_8BIT_HI = 2, SUBREG_16BIT = 3, SUBREG_32BIT = 4,
+    SUBREG_SS = 1, SUBREG_SD = 2, SUBREG_XMM = 3
   };
 }
 
diff --git a/libclamav/c++/llvm/lib/Target/X86/X86RegisterInfo.td b/libclamav/c++/llvm/lib/Target/X86/X86RegisterInfo.td
index 1559bf7..ed2ce6c 100644
--- a/libclamav/c++/llvm/lib/Target/X86/X86RegisterInfo.td
+++ b/libclamav/c++/llvm/lib/Target/X86/X86RegisterInfo.td
@@ -158,22 +158,22 @@ let Namespace = "X86" in {
   def XMM15: Register<"xmm15">, DwarfRegNum<[32, -2, -2]>;
 
   // YMM Registers, used by AVX instructions
-  def YMM0: Register<"ymm0">, DwarfRegNum<[17, 21, 21]>;
-  def YMM1: Register<"ymm1">, DwarfRegNum<[18, 22, 22]>;
-  def YMM2: Register<"ymm2">, DwarfRegNum<[19, 23, 23]>;
-  def YMM3: Register<"ymm3">, DwarfRegNum<[20, 24, 24]>;
-  def YMM4: Register<"ymm4">, DwarfRegNum<[21, 25, 25]>;
-  def YMM5: Register<"ymm5">, DwarfRegNum<[22, 26, 26]>;
-  def YMM6: Register<"ymm6">, DwarfRegNum<[23, 27, 27]>;
-  def YMM7: Register<"ymm7">, DwarfRegNum<[24, 28, 28]>;
-  def YMM8:  Register<"ymm8">,  DwarfRegNum<[25, -2, -2]>;
-  def YMM9:  Register<"ymm9">,  DwarfRegNum<[26, -2, -2]>;
-  def YMM10: Register<"ymm10">, DwarfRegNum<[27, -2, -2]>;
-  def YMM11: Register<"ymm11">, DwarfRegNum<[28, -2, -2]>;
-  def YMM12: Register<"ymm12">, DwarfRegNum<[29, -2, -2]>;
-  def YMM13: Register<"ymm13">, DwarfRegNum<[30, -2, -2]>;
-  def YMM14: Register<"ymm14">, DwarfRegNum<[31, -2, -2]>;
-  def YMM15: Register<"ymm15">, DwarfRegNum<[32, -2, -2]>;
+  def YMM0: RegisterWithSubRegs<"ymm0", [XMM0]>, DwarfRegNum<[17, 21, 21]>;
+  def YMM1: RegisterWithSubRegs<"ymm1", [XMM1]>, DwarfRegNum<[18, 22, 22]>;
+  def YMM2: RegisterWithSubRegs<"ymm2", [XMM2]>, DwarfRegNum<[19, 23, 23]>;
+  def YMM3: RegisterWithSubRegs<"ymm3", [XMM3]>, DwarfRegNum<[20, 24, 24]>;
+  def YMM4: RegisterWithSubRegs<"ymm4", [XMM4]>, DwarfRegNum<[21, 25, 25]>;
+  def YMM5: RegisterWithSubRegs<"ymm5", [XMM5]>, DwarfRegNum<[22, 26, 26]>;
+  def YMM6: RegisterWithSubRegs<"ymm6", [XMM6]>, DwarfRegNum<[23, 27, 27]>;
+  def YMM7: RegisterWithSubRegs<"ymm7", [XMM7]>, DwarfRegNum<[24, 28, 28]>;
+  def YMM8:  RegisterWithSubRegs<"ymm8", [XMM8]>,  DwarfRegNum<[25, -2, -2]>;
+  def YMM9:  RegisterWithSubRegs<"ymm9", [XMM9]>,  DwarfRegNum<[26, -2, -2]>;
+  def YMM10: RegisterWithSubRegs<"ymm10", [XMM10]>, DwarfRegNum<[27, -2, -2]>;
+  def YMM11: RegisterWithSubRegs<"ymm11", [XMM11]>, DwarfRegNum<[28, -2, -2]>;
+  def YMM12: RegisterWithSubRegs<"ymm12", [XMM12]>, DwarfRegNum<[29, -2, -2]>;
+  def YMM13: RegisterWithSubRegs<"ymm13", [XMM13]>, DwarfRegNum<[30, -2, -2]>;
+  def YMM14: RegisterWithSubRegs<"ymm14", [XMM14]>, DwarfRegNum<[31, -2, -2]>;
+  def YMM15: RegisterWithSubRegs<"ymm15", [XMM15]>, DwarfRegNum<[32, -2, -2]>;
 
   // Floating point stack registers
   def ST0 : Register<"st(0)">, DwarfRegNum<[33, 12, 11]>;
@@ -238,6 +238,10 @@ def x86_subreg_8bit_hi : PatLeaf<(i32 2)>;
 def x86_subreg_16bit   : PatLeaf<(i32 3)>;
 def x86_subreg_32bit   : PatLeaf<(i32 4)>;
 
+def x86_subreg_ss   : PatLeaf<(i32 1)>;
+def x86_subreg_sd   : PatLeaf<(i32 2)>;
+def x86_subreg_xmm  : PatLeaf<(i32 3)>;
+
 def : SubRegSet<1, [AX, CX, DX, BX, SP,  BP,  SI,  DI,  
                     R8W, R9W, R10W, R11W, R12W, R13W, R14W, R15W],
                    [AL, CL, DL, BL, SPL, BPL, SIL, DIL, 
@@ -277,11 +281,31 @@ def : SubRegSet<4, [RAX, RCX, RDX, RBX, RSP, RBP, RSI, RDI,
                    [EAX, ECX, EDX, EBX, ESP, EBP, ESI, EDI, 
                     R8D, R9D, R10D, R11D, R12D, R13D, R14D, R15D]>;
 
-def : SubRegSet<1, [YMM0, YMM1, YMM2, YMM3, YMM4, YMM5, YMM6, YMM7,  
+def : SubRegSet<1, [YMM0, YMM1, YMM2, YMM3, YMM4, YMM5, YMM6, YMM7,
+                    YMM8, YMM9, YMM10, YMM11, YMM12, YMM13, YMM14, YMM15],
+                   [XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7,
+                    XMM8, XMM9, XMM10, XMM11, XMM12, XMM13, XMM14, XMM15]>;
+
+def : SubRegSet<2, [YMM0, YMM1, YMM2, YMM3, YMM4, YMM5, YMM6, YMM7,
+                    YMM8, YMM9, YMM10, YMM11, YMM12, YMM13, YMM14, YMM15],
+                   [XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7,
+                    XMM8, XMM9, XMM10, XMM11, XMM12, XMM13, XMM14, XMM15]>;
+
+def : SubRegSet<3, [YMM0, YMM1, YMM2, YMM3, YMM4, YMM5, YMM6, YMM7,  
                     YMM8, YMM9, YMM10, YMM11, YMM12, YMM13, YMM14, YMM15],
                    [XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7, 
                     XMM8, XMM9, XMM10, XMM11, XMM12, XMM13, XMM14, XMM15]>;
 
+def : SubRegSet<1, [XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7,
+                    XMM8, XMM9, XMM10, XMM11, XMM12, XMM13, XMM14, XMM15],
+                   [XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7,
+                    XMM8, XMM9, XMM10, XMM11, XMM12, XMM13, XMM14, XMM15]>;
+
+def : SubRegSet<2, [XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7,
+                    XMM8, XMM9, XMM10, XMM11, XMM12, XMM13, XMM14, XMM15],
+                   [XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7,
+                    XMM8, XMM9, XMM10, XMM11, XMM12, XMM13, XMM14, XMM15]>;
+
 //===----------------------------------------------------------------------===//
 // Register Class Definitions... now that we have all of the pieces, define the
 // top-level register classes.  The order specified in the register list is
@@ -793,6 +817,7 @@ def VR128 : RegisterClass<"X86", [v16i8, v8i16, v4i32, v2i64, v4f32, v2f64],128,
                           [XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7,
                            XMM8, XMM9, XMM10, XMM11,
                            XMM12, XMM13, XMM14, XMM15]> {
+  let SubRegClassList = [FR32, FR64];
   let MethodProtos = [{
     iterator allocation_order_end(const MachineFunction &MF) const;
   }];
@@ -811,7 +836,9 @@ def VR128 : RegisterClass<"X86", [v16i8, v8i16, v4i32, v2i64, v4f32, v2f64],128,
 def VR256 : RegisterClass<"X86", [ v8i32, v4i64, v8f32, v4f64],256,
                           [YMM0, YMM1, YMM2, YMM3, YMM4, YMM5, YMM6, YMM7,
                            YMM8, YMM9, YMM10, YMM11,
-                           YMM12, YMM13, YMM14, YMM15]>;
+                           YMM12, YMM13, YMM14, YMM15]> {
+  let SubRegClassList = [FR32, FR64, VR128];
+}
 
 // Status flags registers.
 def CCR : RegisterClass<"X86", [i32], 32, [EFLAGS]> {
diff --git a/libclamav/c++/llvm/lib/Target/X86/X86Subtarget.h b/libclamav/c++/llvm/lib/Target/X86/X86Subtarget.h
index 5e05c2f..594a470 100644
--- a/libclamav/c++/llvm/lib/Target/X86/X86Subtarget.h
+++ b/libclamav/c++/llvm/lib/Target/X86/X86Subtarget.h
@@ -20,9 +20,9 @@
 namespace llvm {
 class GlobalValue;
 class TargetMachine;
-  
+
 /// PICStyles - The X86 backend supports a number of different styles of PIC.
-/// 
+///
 namespace PICStyles {
 enum Style {
   StubPIC,          // Used on i386-darwin in -fPIC mode.
@@ -46,7 +46,7 @@ protected:
   /// PICStyle - Which PIC style to use
   ///
   PICStyles::Style PICStyle;
-  
+
   /// X86SSELevel - MMX, SSE1, SSE2, SSE3, SSSE3, SSE41, SSE42, or
   /// none supported.
   X86SSEEnum X86SSELevel;
@@ -58,7 +58,7 @@ protected:
   /// HasCMov - True if this processor has conditional move instructions
   /// (generally pentium pro+).
   bool HasCMov;
-  
+
   /// HasX86_64 - True if the processor supports X86-64 instructions.
   ///
   bool HasX86_64;
@@ -78,8 +78,9 @@ protected:
   /// IsBTMemSlow - True if BT (bit test) of memory instructions are slow.
   bool IsBTMemSlow;
 
-  /// HasVectorUAMem - True if SIMD operations can have unaligned memory operands.
-  ///                  This may require setting a feature bit in the processor.
+  /// HasVectorUAMem - True if SIMD operations can have unaligned memory
+  ///                  operands. This may require setting a feature bit in the
+  ///                  processor.
   bool HasVectorUAMem;
 
   /// DarwinVers - Nonzero if this is a darwin platform: the numeric
@@ -150,20 +151,20 @@ public:
 
   bool isTargetDarwin() const { return TargetType == isDarwin; }
   bool isTargetELF() const { return TargetType == isELF; }
-  
+
   bool isTargetWindows() const { return TargetType == isWindows; }
   bool isTargetMingw() const { return TargetType == isMingw; }
   bool isTargetCygwin() const { return TargetType == isCygwin; }
   bool isTargetCygMing() const {
     return TargetType == isMingw || TargetType == isCygwin;
   }
-  
+
   /// isTargetCOFF - Return true if this is any COFF/Windows target variant.
   bool isTargetCOFF() const {
     return TargetType == isMingw || TargetType == isCygwin ||
            TargetType == isWindows;
   }
-  
+
   bool isTargetWin64() const {
     return Is64Bit && (TargetType == isMingw || TargetType == isWindows);
   }
@@ -196,11 +197,11 @@ public:
   bool isPICStyleStubAny() const {
     return PICStyle == PICStyles::StubDynamicNoPIC ||
            PICStyle == PICStyles::StubPIC; }
-  
+
   /// getDarwinVers - Return the darwin version number, 8 = Tiger, 9 = Leopard,
   /// 10 = Snow Leopard, etc.
   unsigned getDarwinVers() const { return DarwinVers; }
-    
+
   /// ClassifyGlobalReference - Classify a global variable reference for the
   /// current subtarget according to how we should reference it in a non-pcrel
   /// context.
diff --git a/libclamav/c++/llvm/lib/Target/X86/X86TargetMachine.cpp b/libclamav/c++/llvm/lib/Target/X86/X86TargetMachine.cpp
index b507871..56ddaf8 100644
--- a/libclamav/c++/llvm/lib/Target/X86/X86TargetMachine.cpp
+++ b/libclamav/c++/llvm/lib/Target/X86/X86TargetMachine.cpp
@@ -51,6 +51,12 @@ extern "C" void LLVMInitializeX86Target() {
                                       createX86_32MCCodeEmitter);
   TargetRegistry::RegisterCodeEmitter(TheX86_64Target,
                                       createX86_64MCCodeEmitter);
+
+  // Register the asm backend.
+  TargetRegistry::RegisterAsmBackend(TheX86_32Target,
+                                     createX86_32AsmBackend);
+  TargetRegistry::RegisterAsmBackend(TheX86_64Target,
+                                     createX86_64AsmBackend);
 }
 
 
@@ -199,32 +205,3 @@ void X86TargetMachine::setCodeModelForJIT() {
   else
     setCodeModel(CodeModel::Small);
 }
-
-/// getLSDAEncoding - Returns the LSDA pointer encoding. The choices are 4-byte,
-/// 8-byte, and target default. The CIE is hard-coded to indicate that the LSDA
-/// pointer in the FDE section is an "sdata4", and should be encoded as a 4-byte
-/// pointer by default. However, some systems may require a different size due
-/// to bugs or other conditions. We will default to a 4-byte encoding unless the
-/// system tells us otherwise.
-///
-/// The issue is when the CIE says their is an LSDA. That mandates that every
-/// FDE have an LSDA slot. But if the function does not need an LSDA. There
-/// needs to be some way to signify there is none. The LSDA is encoded as
-/// pc-rel. But you don't look for some magic value after adding the pc. You
-/// have to look for a zero before adding the pc. The problem is that the size
-/// of the zero to look for depends on the encoding. The unwinder bug in SL is
-/// that it always checks for a pointer-size zero. So on x86_64 it looks for 8
-/// bytes of zero. If you have an LSDA, it works fine since the 8-bytes are
-/// non-zero so it goes ahead and then reads the value based on the encoding.
-/// But if you use sdata4 and there is no LSDA, then the test for zero gives a
-/// false negative and the unwinder thinks there is an LSDA.
-///
-/// FIXME: This call-back isn't good! We should be using the correct encoding
-/// regardless of the system. However, there are some systems which have bugs
-/// that prevent this from occuring.
-DwarfLSDAEncoding::Encoding X86TargetMachine::getLSDAEncoding() const {
-  if (Subtarget.isTargetDarwin() && Subtarget.getDarwinVers() != 10)
-    return DwarfLSDAEncoding::Default;
-
-  return DwarfLSDAEncoding::EightByte;
-}
diff --git a/libclamav/c++/llvm/lib/Target/X86/X86TargetMachine.h b/libclamav/c++/llvm/lib/Target/X86/X86TargetMachine.h
index eee29be..2bb5454 100644
--- a/libclamav/c++/llvm/lib/Target/X86/X86TargetMachine.h
+++ b/libclamav/c++/llvm/lib/Target/X86/X86TargetMachine.h
@@ -62,18 +62,6 @@ public:
     return Subtarget.isTargetELF() ? &ELFWriterInfo : 0;
   }
 
-  /// getLSDAEncoding - Returns the LSDA pointer encoding. The choices are
-  /// 4-byte, 8-byte, and target default. The CIE is hard-coded to indicate that
-  /// the LSDA pointer in the FDE section is an "sdata4", and should be encoded
-  /// as a 4-byte pointer by default. However, some systems may require a
-  /// different size due to bugs or other conditions. We will default to a
-  /// 4-byte encoding unless the system tells us otherwise.
-  ///
-  /// FIXME: This call-back isn't good! We should be using the correct encoding
-  /// regardless of the system. However, there are some systems which have bugs
-  /// that prevent this from occuring.
-  virtual DwarfLSDAEncoding::Encoding getLSDAEncoding() const;
-
   // Set up the pass pipeline.
   virtual bool addInstSelector(PassManagerBase &PM, CodeGenOpt::Level OptLevel);
   virtual bool addPreRegAlloc(PassManagerBase &PM, CodeGenOpt::Level OptLevel);
diff --git a/libclamav/c++/llvm/lib/Target/X86/X86TargetObjectFile.cpp b/libclamav/c++/llvm/lib/Target/X86/X86TargetObjectFile.cpp
index b8cef7d..29a0be5 100644
--- a/libclamav/c++/llvm/lib/Target/X86/X86TargetObjectFile.cpp
+++ b/libclamav/c++/llvm/lib/Target/X86/X86TargetObjectFile.cpp
@@ -7,61 +7,112 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "X86TargetObjectFile.h"
 #include "X86MCTargetExpr.h"
+#include "X86TargetObjectFile.h"
+#include "X86TargetMachine.h"
 #include "llvm/CodeGen/MachineModuleInfoImpls.h"
 #include "llvm/MC/MCContext.h"
 #include "llvm/Target/Mangler.h"
 #include "llvm/ADT/SmallString.h"
+#include "llvm/Support/Dwarf.h"
 using namespace llvm;
+using namespace dwarf;
 
-const MCExpr *X8632_MachoTargetObjectFile::
+const MCExpr *X8664_MachoTargetObjectFile::
 getSymbolForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang,
-                                 MachineModuleInfo *MMI,
-                                 bool &IsIndirect, bool &IsPCRel) const {
-  // The mach-o version of this method defaults to returning a stub reference.
-  IsIndirect = true;
-  IsPCRel    = false;
-  
-  
-  MachineModuleInfoMachO &MachOMMI =
-  MMI->getObjFileInfo<MachineModuleInfoMachO>();
-  
-  // FIXME: Use GetSymbolWithGlobalValueBase.
-  SmallString<128> Name;
-  Mang->getNameWithPrefix(Name, GV, true);
-  Name += "$non_lazy_ptr";
-  
-  // Add information about the stub reference to MachOMMI so that the stub gets
-  // emitted by the asmprinter.
-  MCSymbol *Sym = getContext().GetOrCreateSymbol(Name.str());
-  MCSymbol *&StubSym = MachOMMI.getGVStubEntry(Sym);
-  if (StubSym == 0) {
-    Name.clear();
+                           MachineModuleInfo *MMI, unsigned Encoding) const {
+
+  // On Darwin/X86-64, we can reference dwarf symbols with foo at GOTPCREL+4, which
+  // is an indirect pc-relative reference.
+  if (Encoding & (DW_EH_PE_indirect | DW_EH_PE_pcrel)) {
+    SmallString<128> Name;
     Mang->getNameWithPrefix(Name, GV, false);
-    StubSym = getContext().GetOrCreateSymbol(Name.str());
+    const MCSymbol *Sym = getContext().GetOrCreateSymbol(Name);
+    const MCExpr *Res =
+      X86MCTargetExpr::Create(Sym, X86MCTargetExpr::GOTPCREL, getContext());
+    const MCExpr *Four = MCConstantExpr::Create(4, getContext());
+    return MCBinaryExpr::CreateAdd(Res, Four, getContext());
   }
-  
-  return MCSymbolRefExpr::Create(Sym, getContext());
+
+  return TargetLoweringObjectFileMachO::
+    getSymbolForDwarfGlobalReference(GV, Mang, MMI, Encoding);
 }
 
-const MCExpr *X8664_MachoTargetObjectFile::
-getSymbolForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang,
-                                 MachineModuleInfo *MMI,
-                                 bool &IsIndirect, bool &IsPCRel) const {
-  
-  // On Darwin/X86-64, we can reference dwarf symbols with foo at GOTPCREL+4, which
-  // is an indirect pc-relative reference.
-  IsIndirect = true;
-  IsPCRel    = true;
-  
-  // FIXME: Use GetSymbolWithGlobalValueBase.
-  SmallString<128> Name;
-  Mang->getNameWithPrefix(Name, GV, false);
-  const MCSymbol *Sym = getContext().CreateSymbol(Name);
-  const MCExpr *Res =
-    X86MCTargetExpr::Create(Sym, X86MCTargetExpr::GOTPCREL, getContext());
-  const MCExpr *Four = MCConstantExpr::Create(4, getContext());
-  return MCBinaryExpr::CreateAdd(Res, Four, getContext());
+unsigned X8632_ELFTargetObjectFile::getPersonalityEncoding() const {
+  if (TM.getRelocationModel() == Reloc::PIC_)
+    return DW_EH_PE_indirect | DW_EH_PE_pcrel | DW_EH_PE_sdata4;
+  else
+    return DW_EH_PE_absptr;
+}
+
+unsigned X8632_ELFTargetObjectFile::getLSDAEncoding() const {
+  if (TM.getRelocationModel() == Reloc::PIC_)
+    return DW_EH_PE_pcrel | DW_EH_PE_sdata4;
+  else
+    return DW_EH_PE_absptr;
+}
+
+unsigned X8632_ELFTargetObjectFile::getFDEEncoding() const {
+  if (TM.getRelocationModel() == Reloc::PIC_)
+    return DW_EH_PE_pcrel | DW_EH_PE_sdata4;
+  else
+    return DW_EH_PE_absptr;
+}
+
+unsigned X8632_ELFTargetObjectFile::getTTypeEncoding() const {
+  if (TM.getRelocationModel() == Reloc::PIC_)
+    return DW_EH_PE_indirect | DW_EH_PE_pcrel | DW_EH_PE_sdata4;
+  else
+    return DW_EH_PE_absptr;
+}
+
+unsigned X8664_ELFTargetObjectFile::getPersonalityEncoding() const {
+  CodeModel::Model Model = TM.getCodeModel();
+  if (TM.getRelocationModel() == Reloc::PIC_)
+    return DW_EH_PE_indirect | DW_EH_PE_pcrel | (Model == CodeModel::Small ||
+                                                 Model == CodeModel::Medium ?
+                                            DW_EH_PE_sdata4 : DW_EH_PE_sdata8);
+
+  if (Model == CodeModel::Small || Model == CodeModel::Medium)
+    return DW_EH_PE_udata4;
+
+  return DW_EH_PE_absptr;
+}
+
+unsigned X8664_ELFTargetObjectFile::getLSDAEncoding() const {
+  CodeModel::Model Model = TM.getCodeModel();
+  if (TM.getRelocationModel() == Reloc::PIC_)
+    return DW_EH_PE_pcrel | (Model == CodeModel::Small ?
+                             DW_EH_PE_sdata4 : DW_EH_PE_sdata8);
+
+  if (Model == CodeModel::Small)
+    return DW_EH_PE_udata4;
+
+  return DW_EH_PE_absptr;
+}
+
+unsigned X8664_ELFTargetObjectFile::getFDEEncoding() const {
+  CodeModel::Model Model = TM.getCodeModel();
+  if (TM.getRelocationModel() == Reloc::PIC_)
+    return DW_EH_PE_pcrel | (Model == CodeModel::Small ||
+                             Model == CodeModel::Medium ?
+                             DW_EH_PE_sdata4 : DW_EH_PE_sdata8);
+
+  if (Model == CodeModel::Small || Model == CodeModel::Medium)
+    return DW_EH_PE_udata4;
+
+  return DW_EH_PE_absptr;
 }
 
+unsigned X8664_ELFTargetObjectFile::getTTypeEncoding() const {
+  CodeModel::Model Model = TM.getCodeModel();
+  if (TM.getRelocationModel() == Reloc::PIC_)
+    return DW_EH_PE_indirect | DW_EH_PE_pcrel | (Model == CodeModel::Small ||
+                                                 Model == CodeModel::Medium ?
+                                            DW_EH_PE_sdata4 : DW_EH_PE_sdata8);
+
+  if (Model == CodeModel::Small)
+    return DW_EH_PE_udata4;
+
+  return DW_EH_PE_absptr;
+}
diff --git a/libclamav/c++/llvm/lib/Target/X86/X86TargetObjectFile.h b/libclamav/c++/llvm/lib/Target/X86/X86TargetObjectFile.h
index 377a93b..0444417 100644
--- a/libclamav/c++/llvm/lib/Target/X86/X86TargetObjectFile.h
+++ b/libclamav/c++/llvm/lib/Target/X86/X86TargetObjectFile.h
@@ -10,21 +10,13 @@
 #ifndef LLVM_TARGET_X86_TARGETOBJECTFILE_H
 #define LLVM_TARGET_X86_TARGETOBJECTFILE_H
 
+#include "llvm/CodeGen/TargetLoweringObjectFileImpl.h"
+#include "llvm/Target/TargetMachine.h"
 #include "llvm/Target/TargetLoweringObjectFile.h"
 
 namespace llvm {
-  
-  /// X8632_MachoTargetObjectFile - This TLOF implementation is used for
-  /// Darwin/x86-32.
-  class X8632_MachoTargetObjectFile : public TargetLoweringObjectFileMachO {
-  public:
-    
-    virtual const MCExpr *
-    getSymbolForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang,
-                                     MachineModuleInfo *MMI,
-                                     bool &IsIndirect, bool &IsPCRel) const;
-  };
-  
+  class X86TargetMachine;
+
   /// X8664_MachoTargetObjectFile - This TLOF implementation is used for
   /// Darwin/x86-64.
   class X8664_MachoTargetObjectFile : public TargetLoweringObjectFileMachO {
@@ -32,9 +24,31 @@ namespace llvm {
 
     virtual const MCExpr *
     getSymbolForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang,
-                                     MachineModuleInfo *MMI,
-                                     bool &IsIndirect, bool &IsPCRel) const;
+                              MachineModuleInfo *MMI, unsigned Encoding) const;
+  };
+
+  class X8632_ELFTargetObjectFile : public TargetLoweringObjectFileELF {
+    const X86TargetMachine &TM;
+  public:
+    X8632_ELFTargetObjectFile(const X86TargetMachine &tm)
+      :TM(tm) { }
+    virtual unsigned getPersonalityEncoding() const;
+    virtual unsigned getLSDAEncoding() const;
+    virtual unsigned getFDEEncoding() const;
+    virtual unsigned getTTypeEncoding() const;
+  };
+
+  class X8664_ELFTargetObjectFile : public TargetLoweringObjectFileELF {
+    const X86TargetMachine &TM;
+  public:
+    X8664_ELFTargetObjectFile(const X86TargetMachine &tm)
+      :TM(tm) { }
+    virtual unsigned getPersonalityEncoding() const;
+    virtual unsigned getLSDAEncoding() const;
+    virtual unsigned getFDEEncoding() const;
+    virtual unsigned getTTypeEncoding() const;
   };
+
 } // end namespace llvm
 
 #endif
diff --git a/libclamav/c++/llvm/lib/Transforms/Hello/Hello.cpp b/libclamav/c++/llvm/lib/Transforms/Hello/Hello.cpp
index eac4e17..37d7a00 100644
--- a/libclamav/c++/llvm/lib/Transforms/Hello/Hello.cpp
+++ b/libclamav/c++/llvm/lib/Transforms/Hello/Hello.cpp
@@ -15,7 +15,6 @@
 #define DEBUG_TYPE "hello"
 #include "llvm/Pass.h"
 #include "llvm/Function.h"
-#include "llvm/ADT/StringExtras.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/ADT/Statistic.h"
 using namespace llvm;
diff --git a/libclamav/c++/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp b/libclamav/c++/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
index 325d353..7cb1367 100644
--- a/libclamav/c++/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
+++ b/libclamav/c++/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
@@ -124,7 +124,7 @@ CallGraphNode *ArgPromotion::PromoteArguments(CallGraphNode *CGN) {
   unsigned ArgNo = 0;
   for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end();
        I != E; ++I, ++ArgNo)
-    if (isa<PointerType>(I->getType()))
+    if (I->getType()->isPointerTy())
       PointerArgs.push_back(std::pair<Argument*, unsigned>(I, ArgNo));
   if (PointerArgs.empty()) return 0;
 
@@ -317,7 +317,7 @@ bool ArgPromotion::isSafeToPromoteArgument(Argument *Arg, bool isByVal) const {
   GEPIndicesSet ToPromote;
 
   // If the pointer is always valid, any load with first index 0 is valid.
-  if(isByVal || AllCalleesPassInValidPointerForArgument(Arg))
+  if (isByVal || AllCalleesPassInValidPointerForArgument(Arg))
     SafeToUnconditionallyLoad.insert(IndicesVector(1, 0));
 
   // First, iterate the entry block and mark loads of (geps of) arguments as
@@ -673,7 +673,7 @@ CallGraphNode *ArgPromotion::DoPromotion(Function *F,
                  IE = SI->end(); II != IE; ++II) {
               // Use i32 to index structs, and i64 for others (pointers/arrays).
               // This satisfies GEP constraints.
-              const Type *IdxTy = (isa<StructType>(ElTy) ?
+              const Type *IdxTy = (ElTy->isStructTy() ?
                     Type::getInt32Ty(F->getContext()) : 
                     Type::getInt64Ty(F->getContext()));
               Ops.push_back(ConstantInt::get(IdxTy, *II));
diff --git a/libclamav/c++/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp b/libclamav/c++/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp
index 1749b1e..f386ed7 100644
--- a/libclamav/c++/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp
+++ b/libclamav/c++/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp
@@ -796,7 +796,7 @@ bool DAE::RemoveDeadStuffFromFunction(Function *F) {
         // Replace by null for now.
         Call->replaceAllUsesWith(Constant::getNullValue(Call->getType()));
       } else {
-        assert(isa<StructType>(RetTy) &&
+        assert(RetTy->isStructTy() &&
                "Return type changed, but not into a void. The old return type"
                " must have been a struct!");
         Instruction *InsertPt = Call;
@@ -870,7 +870,7 @@ bool DAE::RemoveDeadStuffFromFunction(Function *F) {
         if (NFTy->getReturnType() == Type::getVoidTy(F->getContext())) {
           RetVal = 0;
         } else {
-          assert (isa<StructType>(RetTy));
+          assert (RetTy->isStructTy());
           // The original return value was a struct, insert
           // extractvalue/insertvalue chains to extract only the values we need
           // to return and insert them into our new result.
diff --git a/libclamav/c++/llvm/lib/Transforms/IPO/DeadTypeElimination.cpp b/libclamav/c++/llvm/lib/Transforms/IPO/DeadTypeElimination.cpp
index 025d77e..662fbb5 100644
--- a/libclamav/c++/llvm/lib/Transforms/IPO/DeadTypeElimination.cpp
+++ b/libclamav/c++/llvm/lib/Transforms/IPO/DeadTypeElimination.cpp
@@ -57,13 +57,13 @@ ModulePass *llvm::createDeadTypeEliminationPass() {
 //
 static inline bool ShouldNukeSymtabEntry(const Type *Ty){
   // Nuke all names for primitive types!
-  if (Ty->isPrimitiveType() || Ty->isInteger()) 
+  if (Ty->isPrimitiveType() || Ty->isIntegerTy()) 
     return true;
 
   // Nuke all pointers to primitive types as well...
   if (const PointerType *PT = dyn_cast<PointerType>(Ty))
     if (PT->getElementType()->isPrimitiveType() ||
-        PT->getElementType()->isInteger()) 
+        PT->getElementType()->isIntegerTy()) 
       return true;
 
   return false;
diff --git a/libclamav/c++/llvm/lib/Transforms/IPO/FunctionAttrs.cpp b/libclamav/c++/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
index 64a6d78..298d5cf 100644
--- a/libclamav/c++/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
+++ b/libclamav/c++/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
@@ -175,7 +175,7 @@ bool FunctionAttrs::AddReadAttrs(const std::vector<CallGraphNode *> &SCC) {
             for (CallSite::arg_iterator CI = CS.arg_begin(), CE = CS.arg_end();
                  CI != CE; ++CI) {
               Value *Arg = *CI;
-              if (isa<PointerType>(Arg->getType()) && !PointsToLocalMemory(Arg))
+              if (Arg->getType()->isPointerTy() && !PointsToLocalMemory(Arg))
                 // Writes memory.  Just give up.
                 return false;
             }
@@ -257,7 +257,7 @@ bool FunctionAttrs::AddNoCaptureAttrs(const std::vector<CallGraphNode *> &SCC) {
       continue;
 
     for (Function::arg_iterator A = F->arg_begin(), E = F->arg_end(); A!=E; ++A)
-      if (isa<PointerType>(A->getType()) && !A->hasNoCaptureAttr() &&
+      if (A->getType()->isPointerTy() && !A->hasNoCaptureAttr() &&
           !PointerMayBeCaptured(A, true, /*StoreCaptures=*/false)) {
         A->addAttr(Attribute::NoCapture);
         ++NumNoCapture;
@@ -362,7 +362,7 @@ bool FunctionAttrs::AddNoAliasAttrs(const std::vector<CallGraphNode *> &SCC) {
 
     // We annotate noalias return values, which are only applicable to 
     // pointer types.
-    if (!isa<PointerType>(F->getReturnType()))
+    if (!F->getReturnType()->isPointerTy())
       continue;
 
     if (!IsFunctionMallocLike(F, SCCNodes))
@@ -372,7 +372,7 @@ bool FunctionAttrs::AddNoAliasAttrs(const std::vector<CallGraphNode *> &SCC) {
   bool MadeChange = false;
   for (unsigned i = 0, e = SCC.size(); i != e; ++i) {
     Function *F = SCC[i]->getFunction();
-    if (F->doesNotAlias(0) || !isa<PointerType>(F->getReturnType()))
+    if (F->doesNotAlias(0) || !F->getReturnType()->isPointerTy())
       continue;
 
     F->setDoesNotAlias(0);
diff --git a/libclamav/c++/llvm/lib/Transforms/IPO/GlobalOpt.cpp b/libclamav/c++/llvm/lib/Transforms/IPO/GlobalOpt.cpp
index ac91631..7b1e9c0 100644
--- a/libclamav/c++/llvm/lib/Transforms/IPO/GlobalOpt.cpp
+++ b/libclamav/c++/llvm/lib/Transforms/IPO/GlobalOpt.cpp
@@ -303,7 +303,7 @@ static bool CleanupConstantGlobalUsers(Value *V, Constant *Init) {
           SubInit = ConstantFoldLoadThroughGEPConstantExpr(Init, CE);
         Changed |= CleanupConstantGlobalUsers(CE, SubInit);
       } else if (CE->getOpcode() == Instruction::BitCast && 
-                 isa<PointerType>(CE->getType())) {
+                 CE->getType()->isPointerTy()) {
         // Pointer cast, delete any stores and memsets to the global.
         Changed |= CleanupConstantGlobalUsers(CE, 0);
       }
@@ -431,7 +431,7 @@ static bool IsUserOfGlobalSafeForSRA(User *U, GlobalValue *GV) {
       else if (const VectorType *SubVectorTy = dyn_cast<VectorType>(*GEPI))
         NumElements = SubVectorTy->getNumElements();
       else {
-        assert(isa<StructType>(*GEPI) &&
+        assert((*GEPI)->isStructTy() &&
                "Indexed GEP type is not array, vector, or struct!");
         continue;
       }
@@ -543,7 +543,7 @@ static GlobalVariable *SRAGlobal(GlobalVariable *GV, const TargetData &TD) {
 
   if (NewGlobals.empty())
     return 0;
-
+  
   DEBUG(dbgs() << "PERFORMING GLOBAL SRA ON: " << *GV);
 
   Constant *NullInt =Constant::getNullValue(Type::getInt32Ty(GV->getContext()));
@@ -642,7 +642,7 @@ static bool AllUsesOfValueWillTrapIfNull(Value *V,
         return false;
     } else if (isa<ICmpInst>(*UI) &&
                isa<ConstantPointerNull>(UI->getOperand(1))) {
-      // Ignore setcc X, null
+      // Ignore icmp X, null
     } else {
       //cerr << "NONTRAPPING USE: " << **UI;
       return false;
@@ -813,57 +813,47 @@ static void ConstantPropUsersOf(Value *V) {
 static GlobalVariable *OptimizeGlobalAddressOfMalloc(GlobalVariable *GV,
                                                      CallInst *CI,
                                                      const Type *AllocTy,
-                                                     Value* NElems,
+                                                     ConstantInt *NElements,
                                                      TargetData* TD) {
-  DEBUG(dbgs() << "PROMOTING GLOBAL: " << *GV << "  CALL = " << *CI << '\n');
-
-  const Type *IntPtrTy = TD->getIntPtrType(GV->getContext());
+  DEBUG(errs() << "PROMOTING GLOBAL: " << *GV << "  CALL = " << *CI << '\n');
   
-  // CI has either 0 or 1 bitcast uses (getMallocType() would otherwise have
-  // returned NULL and we would not be here).
-  BitCastInst *BCI = NULL;
-  for (Value::use_iterator UI = CI->use_begin(), E = CI->use_end(); UI != E; )
-    if ((BCI = dyn_cast<BitCastInst>(cast<Instruction>(*UI++))))
-      break;
-
-  ConstantInt *NElements = cast<ConstantInt>(NElems);
-  if (NElements->getZExtValue() != 1) {
-    // If we have an array allocation, transform it to a single element
-    // allocation to make the code below simpler.
-    Type *NewTy = ArrayType::get(AllocTy, NElements->getZExtValue());
-    unsigned TypeSize = TD->getTypeAllocSize(NewTy);
-    if (const StructType *ST = dyn_cast<StructType>(NewTy))
-      TypeSize = TD->getStructLayout(ST)->getSizeInBytes();
-    Instruction *NewCI = CallInst::CreateMalloc(CI, IntPtrTy, NewTy,
-                                         ConstantInt::get(IntPtrTy, TypeSize));
-    Value* Indices[2];
-    Indices[0] = Indices[1] = Constant::getNullValue(IntPtrTy);
-    Value *NewGEP = GetElementPtrInst::Create(NewCI, Indices, Indices + 2,
-                                              NewCI->getName()+".el0", CI);
-    Value *Cast = new BitCastInst(NewGEP, CI->getType(), "el0", CI);
-    if (BCI) BCI->replaceAllUsesWith(NewGEP);
-    CI->replaceAllUsesWith(Cast);
-    if (BCI) BCI->eraseFromParent();
-    CI->eraseFromParent();
-    BCI = dyn_cast<BitCastInst>(NewCI);
-    CI = BCI ? extractMallocCallFromBitCast(BCI) : cast<CallInst>(NewCI);
-  }
+  const Type *GlobalType;
+  if (NElements->getZExtValue() == 1)
+    GlobalType = AllocTy;
+  else
+    // If we have an array allocation, the global variable is of an array.
+    GlobalType = ArrayType::get(AllocTy, NElements->getZExtValue());
 
   // Create the new global variable.  The contents of the malloc'd memory is
   // undefined, so initialize with an undef value.
-  const Type *MAT = getMallocAllocatedType(CI);
-  Constant *Init = UndefValue::get(MAT);
   GlobalVariable *NewGV = new GlobalVariable(*GV->getParent(), 
-                                             MAT, false,
-                                             GlobalValue::InternalLinkage, Init,
+                                             GlobalType, false,
+                                             GlobalValue::InternalLinkage,
+                                             UndefValue::get(GlobalType),
                                              GV->getName()+".body",
                                              GV,
                                              GV->isThreadLocal());
   
-  // Anything that used the malloc or its bitcast now uses the global directly.
-  if (BCI) BCI->replaceAllUsesWith(NewGV);
-  CI->replaceAllUsesWith(new BitCastInst(NewGV, CI->getType(), "newgv", CI));
-
+  // If there are bitcast users of the malloc (which is typical, usually we have
+  // a malloc + bitcast) then replace them with uses of the new global.  Update
+  // other users to use the global as well.
+  BitCastInst *TheBC = 0;
+  while (!CI->use_empty()) {
+    Instruction *User = cast<Instruction>(CI->use_back());
+    if (BitCastInst *BCI = dyn_cast<BitCastInst>(User)) {
+      if (BCI->getType() == NewGV->getType()) {
+        BCI->replaceAllUsesWith(NewGV);
+        BCI->eraseFromParent();
+      } else {
+        BCI->setOperand(0, NewGV);
+      }
+    } else {
+      if (TheBC == 0)
+        TheBC = new BitCastInst(NewGV, CI->getType(), "newgv", CI);
+      User->replaceUsesOfWith(CI, TheBC);
+    }
+  }
+  
   Constant *RepValue = NewGV;
   if (NewGV->getType() != GV->getType()->getElementType())
     RepValue = ConstantExpr::getBitCast(RepValue, 
@@ -879,60 +869,60 @@ static GlobalVariable *OptimizeGlobalAddressOfMalloc(GlobalVariable *GV,
   bool InitBoolUsed = false;
 
   // Loop over all uses of GV, processing them in turn.
-  std::vector<StoreInst*> Stores;
-  while (!GV->use_empty())
-    if (LoadInst *LI = dyn_cast<LoadInst>(GV->use_back())) {
-      while (!LI->use_empty()) {
-        Use &LoadUse = LI->use_begin().getUse();
-        if (!isa<ICmpInst>(LoadUse.getUser()))
-          LoadUse = RepValue;
-        else {
-          ICmpInst *ICI = cast<ICmpInst>(LoadUse.getUser());
-          // Replace the cmp X, 0 with a use of the bool value.
-          Value *LV = new LoadInst(InitBool, InitBool->getName()+".val", ICI);
-          InitBoolUsed = true;
-          switch (ICI->getPredicate()) {
-          default: llvm_unreachable("Unknown ICmp Predicate!");
-          case ICmpInst::ICMP_ULT:
-          case ICmpInst::ICMP_SLT:   // X < null -> always false
-            LV = ConstantInt::getFalse(GV->getContext());
-            break;
-          case ICmpInst::ICMP_ULE:
-          case ICmpInst::ICMP_SLE:
-          case ICmpInst::ICMP_EQ:
-            LV = BinaryOperator::CreateNot(LV, "notinit", ICI);
-            break;
-          case ICmpInst::ICMP_NE:
-          case ICmpInst::ICMP_UGE:
-          case ICmpInst::ICMP_SGE:
-          case ICmpInst::ICMP_UGT:
-          case ICmpInst::ICMP_SGT:
-            break;  // no change.
-          }
-          ICI->replaceAllUsesWith(LV);
-          ICI->eraseFromParent();
-        }
-      }
-      LI->eraseFromParent();
-    } else {
-      StoreInst *SI = cast<StoreInst>(GV->use_back());
+  while (!GV->use_empty()) {
+    if (StoreInst *SI = dyn_cast<StoreInst>(GV->use_back())) {
       // The global is initialized when the store to it occurs.
       new StoreInst(ConstantInt::getTrue(GV->getContext()), InitBool, SI);
       SI->eraseFromParent();
+      continue;
     }
+    
+    LoadInst *LI = cast<LoadInst>(GV->use_back());
+    while (!LI->use_empty()) {
+      Use &LoadUse = LI->use_begin().getUse();
+      if (!isa<ICmpInst>(LoadUse.getUser())) {
+        LoadUse = RepValue;
+        continue;
+      }
+      
+      ICmpInst *ICI = cast<ICmpInst>(LoadUse.getUser());
+      // Replace the cmp X, 0 with a use of the bool value.
+      Value *LV = new LoadInst(InitBool, InitBool->getName()+".val", ICI);
+      InitBoolUsed = true;
+      switch (ICI->getPredicate()) {
+      default: llvm_unreachable("Unknown ICmp Predicate!");
+      case ICmpInst::ICMP_ULT:
+      case ICmpInst::ICMP_SLT:   // X < null -> always false
+        LV = ConstantInt::getFalse(GV->getContext());
+        break;
+      case ICmpInst::ICMP_ULE:
+      case ICmpInst::ICMP_SLE:
+      case ICmpInst::ICMP_EQ:
+        LV = BinaryOperator::CreateNot(LV, "notinit", ICI);
+        break;
+      case ICmpInst::ICMP_NE:
+      case ICmpInst::ICMP_UGE:
+      case ICmpInst::ICMP_SGE:
+      case ICmpInst::ICMP_UGT:
+      case ICmpInst::ICMP_SGT:
+        break;  // no change.
+      }
+      ICI->replaceAllUsesWith(LV);
+      ICI->eraseFromParent();
+    }
+    LI->eraseFromParent();
+  }
 
   // If the initialization boolean was used, insert it, otherwise delete it.
   if (!InitBoolUsed) {
     while (!InitBool->use_empty())  // Delete initializations
-      cast<Instruction>(InitBool->use_back())->eraseFromParent();
+      cast<StoreInst>(InitBool->use_back())->eraseFromParent();
     delete InitBool;
   } else
     GV->getParent()->getGlobalList().insert(GV, InitBool);
 
-
-  // Now the GV is dead, nuke it and the malloc (both CI and BCI).
+  // Now the GV is dead, nuke it and the malloc..
   GV->eraseFromParent();
-  if (BCI) BCI->eraseFromParent();
   CI->eraseFromParent();
 
   // To further other optimizations, loop over all users of NewGV and try to
@@ -1303,9 +1293,7 @@ static GlobalVariable *PerformHeapAllocSRoA(GlobalVariable *GV, CallInst *CI,
                                         ConstantInt::get(IntPtrTy, TypeSize),
                                         NElems,
                                         CI->getName() + ".f" + Twine(FieldNo));
-    CallInst *NCI = dyn_cast<BitCastInst>(NMI) ?
-                    extractMallocCallFromBitCast(NMI) : cast<CallInst>(NMI);
-    FieldMallocs.push_back(NCI);
+    FieldMallocs.push_back(NMI);
     new StoreInst(NMI, NGV, CI);
   }
   
@@ -1497,7 +1485,7 @@ static bool TryToOptimizeStoreOfMallocToGlobal(GlobalVariable *GV,
       // something.
       if (TD && 
           NElements->getZExtValue() * TD->getTypeAllocSize(AllocTy) < 2048) {
-        GVI = OptimizeGlobalAddressOfMalloc(GV, CI, AllocTy, NElems, TD);
+        GVI = OptimizeGlobalAddressOfMalloc(GV, CI, AllocTy, NElements, TD);
         return true;
       }
   
@@ -1556,7 +1544,7 @@ static bool OptimizeOnceStoredGlobal(GlobalVariable *GV, Value *StoredOnceVal,
   // only has one (non-null) value stored into it, then we can optimize any
   // users of the loaded value (often calls and loads) that would trap if the
   // value was null.
-  if (isa<PointerType>(GV->getInitializer()->getType()) &&
+  if (GV->getInitializer()->getType()->isPointerTy() &&
       GV->getInitializer()->isNullValue()) {
     if (Constant *SOVC = dyn_cast<Constant>(StoredOnceVal)) {
       if (GV->getInitializer()->getType() != SOVC->getType())
@@ -1590,8 +1578,8 @@ static bool TryToShrinkGlobalToBoolean(GlobalVariable *GV, Constant *OtherVal) {
   // simplification.  In these cases, we typically end up with "cond ? v1 : v2"
   // where v1 and v2 both require constant pool loads, a big loss.
   if (GVElType == Type::getInt1Ty(GV->getContext()) ||
-      GVElType->isFloatingPoint() ||
-      isa<PointerType>(GVElType) || isa<VectorType>(GVElType))
+      GVElType->isFloatingPointTy() ||
+      GVElType->isPointerTy() || GVElType->isVectorTy())
     return false;
   
   // Walk the use list of the global seeing if all the uses are load or store.
@@ -1925,7 +1913,7 @@ GlobalVariable *GlobalOpt::FindGlobalCtors(Module &M) {
       if (!ATy) return 0;
       const StructType *STy = dyn_cast<StructType>(ATy->getElementType());
       if (!STy || STy->getNumElements() != 2 ||
-          !STy->getElementType(0)->isInteger(32)) return 0;
+          !STy->getElementType(0)->isIntegerTy(32)) return 0;
       const PointerType *PFTy = dyn_cast<PointerType>(STy->getElementType(1));
       if (!PFTy) return 0;
       const FunctionType *FTy = dyn_cast<FunctionType>(PFTy->getElementType());
@@ -2148,7 +2136,7 @@ static Constant *EvaluateStoreInto(Constant *Init, Constant *Val,
     Elts[CI->getZExtValue()] =
       EvaluateStoreInto(Elts[CI->getZExtValue()], Val, Addr, OpNo+1);
     
-    if (isa<ArrayType>(Init->getType()))
+    if (Init->getType()->isArrayTy())
       return ConstantArray::get(cast<ArrayType>(InitTy), Elts);
     else
       return ConstantVector::get(&Elts[0], Elts.size());
diff --git a/libclamav/c++/llvm/lib/Transforms/InstCombine/InstCombine.h b/libclamav/c++/llvm/lib/Transforms/InstCombine/InstCombine.h
index 09accb6..bd06499 100644
--- a/libclamav/c++/llvm/lib/Transforms/InstCombine/InstCombine.h
+++ b/libclamav/c++/llvm/lib/Transforms/InstCombine/InstCombine.h
@@ -117,11 +117,11 @@ public:
   Instruction *visitUDiv(BinaryOperator &I);
   Instruction *visitSDiv(BinaryOperator &I);
   Instruction *visitFDiv(BinaryOperator &I);
-  Instruction *FoldAndOfICmps(Instruction &I, ICmpInst *LHS, ICmpInst *RHS);
-  Instruction *FoldAndOfFCmps(Instruction &I, FCmpInst *LHS, FCmpInst *RHS);
+  Value *FoldAndOfICmps(ICmpInst *LHS, ICmpInst *RHS);
+  Value *FoldAndOfFCmps(FCmpInst *LHS, FCmpInst *RHS);
   Instruction *visitAnd(BinaryOperator &I);
-  Instruction *FoldOrOfICmps(Instruction &I, ICmpInst *LHS, ICmpInst *RHS);
-  Instruction *FoldOrOfFCmps(Instruction &I, FCmpInst *LHS, FCmpInst *RHS);
+  Value *FoldOrOfICmps(ICmpInst *LHS, ICmpInst *RHS);
+  Value *FoldOrOfFCmps(FCmpInst *LHS, FCmpInst *RHS);
   Instruction *FoldOrWithConstants(BinaryOperator &I, Value *Op,
                                    Value *A, Value *B, Value *C);
   Instruction *visitOr (BinaryOperator &I);
@@ -207,6 +207,7 @@ private:
                           const Type *Ty);
 
   Instruction *visitCallSite(CallSite CS);
+  Instruction *tryOptimizeCall(CallInst *CI, const TargetData *TD);
   bool transformConstExprCastCall(CallSite CS);
   Instruction *transformCallThroughTrampoline(CallSite CS);
   Instruction *transformZExtICmp(ICmpInst *ICI, Instruction &CI,
@@ -327,8 +328,8 @@ private:
   
   Value *FoldLogicalPlusAnd(Value *LHS, Value *RHS, ConstantInt *Mask,
                             bool isSub, Instruction &I);
-  Instruction *InsertRangeTest(Value *V, Constant *Lo, Constant *Hi,
-                               bool isSigned, bool Inside, Instruction &IB);
+  Value *InsertRangeTest(Value *V, Constant *Lo, Constant *Hi,
+                         bool isSigned, bool Inside);
   Instruction *PromoteCastOfAllocation(BitCastInst &CI, AllocaInst &AI);
   Instruction *MatchBSwap(BinaryOperator &I);
   bool SimplifyStoreAtEndOfBlock(StoreInst &SI);
diff --git a/libclamav/c++/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp b/libclamav/c++/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
index c2924ab..4d2c89e 100644
--- a/libclamav/c++/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
+++ b/libclamav/c++/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
@@ -35,7 +35,7 @@ static Constant *SubOne(ConstantInt *C) {
 // Otherwise, return null.
 //
 static inline Value *dyn_castFoldableMul(Value *V, ConstantInt *&CST) {
-  if (!V->hasOneUse() || !V->getType()->isInteger())
+  if (!V->hasOneUse() || !V->getType()->isIntegerTy())
     return 0;
   
   Instruction *I = dyn_cast<Instruction>(V);
@@ -145,10 +145,10 @@ Instruction *InstCombiner::visitAdd(BinaryOperator &I) {
     }
   }
 
-  if (I.getType()->isInteger(1))
+  if (I.getType()->isIntegerTy(1))
     return BinaryOperator::CreateXor(LHS, RHS);
 
-  if (I.getType()->isInteger()) {
+  if (I.getType()->isIntegerTy()) {
     // X + X --> X << 1
     if (LHS == RHS)
       return BinaryOperator::CreateShl(LHS, ConstantInt::get(I.getType(), 1));
@@ -168,7 +168,7 @@ Instruction *InstCombiner::visitAdd(BinaryOperator &I) {
   // -A + B  -->  B - A
   // -A + -B  -->  -(A + B)
   if (Value *LHSV = dyn_castNegVal(LHS)) {
-    if (LHS->getType()->isIntOrIntVector()) {
+    if (LHS->getType()->isIntOrIntVectorTy()) {
       if (Value *RHSV = dyn_castNegVal(RHS)) {
         Value *NewAdd = Builder->CreateAdd(LHSV, RHSV, "sum");
         return BinaryOperator::CreateNeg(NewAdd);
@@ -222,7 +222,7 @@ Instruction *InstCombiner::visitAdd(BinaryOperator &I) {
   }
 
   // W*X + Y*Z --> W * (X+Z)  iff W == Y
-  if (I.getType()->isIntOrIntVector()) {
+  if (I.getType()->isIntOrIntVectorTy()) {
     Value *W, *X, *Y, *Z;
     if (match(LHS, m_Mul(m_Value(W), m_Value(X))) &&
         match(RHS, m_Mul(m_Value(Y), m_Value(Z)))) {
@@ -373,10 +373,10 @@ Instruction *InstCombiner::visitFAdd(BinaryOperator &I) {
     if (CFP->getValueAPF().isPosZero() && CannotBeNegativeZero(LHS))
       return ReplaceInstUsesWith(I, LHS);
 
-  // Check for (add double (sitofp x), y), see if we can merge this into an
+  // Check for (fadd double (sitofp x), y), see if we can merge this into an
   // integer add followed by a promotion.
   if (SIToFPInst *LHSConv = dyn_cast<SIToFPInst>(LHS)) {
-    // (add double (sitofp x), fpcst) --> (sitofp (add int x, intcst))
+    // (fadd double (sitofp x), fpcst) --> (sitofp (add int x, intcst))
     // ... if the constant fits in the integer value.  This is useful for things
     // like (double)(x & 1234) + 4.0 -> (double)((X & 1234)+4) which no longer
     // requires a constant pool load, and generally allows the add to be better
@@ -394,7 +394,7 @@ Instruction *InstCombiner::visitFAdd(BinaryOperator &I) {
       }
     }
     
-    // (add double (sitofp x), (sitofp y)) --> (sitofp (add int x, y))
+    // (fadd double (sitofp x), (sitofp y)) --> (sitofp (add int x, y))
     if (SIToFPInst *RHSConv = dyn_cast<SIToFPInst>(RHS)) {
       // Only do this if x/y have the same type, if at last one of them has a
       // single use (so we don't increase the number of int->fp conversions),
@@ -560,7 +560,7 @@ Instruction *InstCombiner::visitSub(BinaryOperator &I) {
     return ReplaceInstUsesWith(I, Op0);    // undef - X -> undef
   if (isa<UndefValue>(Op1))
     return ReplaceInstUsesWith(I, Op1);    // X - undef -> undef
-  if (I.getType()->isInteger(1))
+  if (I.getType()->isIntegerTy(1))
     return BinaryOperator::CreateXor(Op0, Op1);
   
   if (ConstantInt *C = dyn_cast<ConstantInt>(Op0)) {
diff --git a/libclamav/c++/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp b/libclamav/c++/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
index 515753f..3fb3de7 100644
--- a/libclamav/c++/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
+++ b/libclamav/c++/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
@@ -137,80 +137,44 @@ static unsigned getFCmpCode(FCmpInst::Predicate CC, bool &isOrdered) {
 /// opcode and two operands into either a constant true or false, or a brand 
 /// new ICmp instruction. The sign is passed in to determine which kind
 /// of predicate to use in the new icmp instruction.
-static Value *getICmpValue(bool Sign, unsigned Code, Value *LHS, Value *RHS) {
+static Value *getICmpValue(bool Sign, unsigned Code, Value *LHS, Value *RHS,
+                           InstCombiner::BuilderTy *Builder) {
+  CmpInst::Predicate Pred;
   switch (Code) {
   default: assert(0 && "Illegal ICmp code!");
-  case 0:
-    return ConstantInt::getFalse(LHS->getContext());
-  case 1: 
-    if (Sign)
-      return new ICmpInst(ICmpInst::ICMP_SGT, LHS, RHS);
-    return new ICmpInst(ICmpInst::ICMP_UGT, LHS, RHS);
-  case 2:
-    return new ICmpInst(ICmpInst::ICMP_EQ,  LHS, RHS);
-  case 3: 
-    if (Sign)
-      return new ICmpInst(ICmpInst::ICMP_SGE, LHS, RHS);
-    return new ICmpInst(ICmpInst::ICMP_UGE, LHS, RHS);
-  case 4: 
-    if (Sign)
-      return new ICmpInst(ICmpInst::ICMP_SLT, LHS, RHS);
-    return new ICmpInst(ICmpInst::ICMP_ULT, LHS, RHS);
-  case 5:
-    return new ICmpInst(ICmpInst::ICMP_NE,  LHS, RHS);
-  case 6: 
-    if (Sign)
-      return new ICmpInst(ICmpInst::ICMP_SLE, LHS, RHS);
-    return new ICmpInst(ICmpInst::ICMP_ULE, LHS, RHS);
-  case 7:
-    return ConstantInt::getTrue(LHS->getContext());
+  case 0: // False.
+    return ConstantInt::get(CmpInst::makeCmpResultType(LHS->getType()), 0);
+  case 1: Pred = Sign ? ICmpInst::ICMP_SGT : ICmpInst::ICMP_UGT; break;
+  case 2: Pred = ICmpInst::ICMP_EQ; break;
+  case 3: Pred = Sign ? ICmpInst::ICMP_SGE : ICmpInst::ICMP_UGE; break;
+  case 4: Pred = Sign ? ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT; break;
+  case 5: Pred = ICmpInst::ICMP_NE; break;
+  case 6: Pred = Sign ? ICmpInst::ICMP_SLE : ICmpInst::ICMP_ULE; break;
+  case 7: // True.
+    return ConstantInt::get(CmpInst::makeCmpResultType(LHS->getType()), 1);
   }
+  return Builder->CreateICmp(Pred, LHS, RHS);
 }
 
 /// getFCmpValue - This is the complement of getFCmpCode, which turns an
 /// opcode and two operands into either a FCmp instruction. isordered is passed
 /// in to determine which kind of predicate to use in the new fcmp instruction.
 static Value *getFCmpValue(bool isordered, unsigned code,
-                           Value *LHS, Value *RHS) {
+                           Value *LHS, Value *RHS,
+                           InstCombiner::BuilderTy *Builder) {
+  CmpInst::Predicate Pred;
   switch (code) {
-  default: llvm_unreachable("Illegal FCmp code!");
-  case  0:
-    if (isordered)
-      return new FCmpInst(FCmpInst::FCMP_ORD, LHS, RHS);
-    else
-      return new FCmpInst(FCmpInst::FCMP_UNO, LHS, RHS);
-  case  1: 
-    if (isordered)
-      return new FCmpInst(FCmpInst::FCMP_OGT, LHS, RHS);
-    else
-      return new FCmpInst(FCmpInst::FCMP_UGT, LHS, RHS);
-  case  2: 
-    if (isordered)
-      return new FCmpInst(FCmpInst::FCMP_OEQ, LHS, RHS);
-    else
-      return new FCmpInst(FCmpInst::FCMP_UEQ, LHS, RHS);
-  case  3: 
-    if (isordered)
-      return new FCmpInst(FCmpInst::FCMP_OGE, LHS, RHS);
-    else
-      return new FCmpInst(FCmpInst::FCMP_UGE, LHS, RHS);
-  case  4: 
-    if (isordered)
-      return new FCmpInst(FCmpInst::FCMP_OLT, LHS, RHS);
-    else
-      return new FCmpInst(FCmpInst::FCMP_ULT, LHS, RHS);
-  case  5: 
-    if (isordered)
-      return new FCmpInst(FCmpInst::FCMP_ONE, LHS, RHS);
-    else
-      return new FCmpInst(FCmpInst::FCMP_UNE, LHS, RHS);
-  case  6: 
-    if (isordered)
-      return new FCmpInst(FCmpInst::FCMP_OLE, LHS, RHS);
-    else
-      return new FCmpInst(FCmpInst::FCMP_ULE, LHS, RHS);
-  case  7: return ConstantInt::getTrue(LHS->getContext());
+  default: assert(0 && "Illegal FCmp code!");
+  case 0: Pred = isordered ? FCmpInst::FCMP_ORD : FCmpInst::FCMP_UNO; break;
+  case 1: Pred = isordered ? FCmpInst::FCMP_OGT : FCmpInst::FCMP_UGT; break;
+  case 2: Pred = isordered ? FCmpInst::FCMP_OEQ : FCmpInst::FCMP_UEQ; break;
+  case 3: Pred = isordered ? FCmpInst::FCMP_OGE : FCmpInst::FCMP_UGE; break;
+  case 4: Pred = isordered ? FCmpInst::FCMP_OLT : FCmpInst::FCMP_ULT; break;
+  case 5: Pred = isordered ? FCmpInst::FCMP_ONE : FCmpInst::FCMP_UNE; break;
+  case 6: Pred = isordered ? FCmpInst::FCMP_OLE : FCmpInst::FCMP_ULE; break;
+  case 7: return ConstantInt::getTrue(LHS->getContext());
   }
+  return Builder->CreateFCmp(Pred, LHS, RHS);
 }
 
 /// PredicatesFoldable - Return true if both predicates match sign or if at
@@ -355,40 +319,39 @@ Instruction *InstCombiner::OptAndOp(Instruction *Op,
 /// (V-Lo) <u Hi-Lo.  This method expects that Lo <= Hi. isSigned indicates
 /// whether to treat the V, Lo and HI as signed or not. IB is the location to
 /// insert new instructions.
-Instruction *InstCombiner::InsertRangeTest(Value *V, Constant *Lo, Constant *Hi,
-                                           bool isSigned, bool Inside, 
-                                           Instruction &IB) {
+Value *InstCombiner::InsertRangeTest(Value *V, Constant *Lo, Constant *Hi,
+                                     bool isSigned, bool Inside) {
   assert(cast<ConstantInt>(ConstantExpr::getICmp((isSigned ? 
             ICmpInst::ICMP_SLE:ICmpInst::ICMP_ULE), Lo, Hi))->getZExtValue() &&
          "Lo is not <= Hi in range emission code!");
     
   if (Inside) {
     if (Lo == Hi)  // Trivially false.
-      return new ICmpInst(ICmpInst::ICMP_NE, V, V);
+      return ConstantInt::getFalse(V->getContext());
 
     // V >= Min && V < Hi --> V < Hi
     if (cast<ConstantInt>(Lo)->isMinValue(isSigned)) {
       ICmpInst::Predicate pred = (isSigned ? 
         ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT);
-      return new ICmpInst(pred, V, Hi);
+      return Builder->CreateICmp(pred, V, Hi);
     }
 
     // Emit V-Lo <u Hi-Lo
     Constant *NegLo = ConstantExpr::getNeg(Lo);
     Value *Add = Builder->CreateAdd(V, NegLo, V->getName()+".off");
     Constant *UpperBound = ConstantExpr::getAdd(NegLo, Hi);
-    return new ICmpInst(ICmpInst::ICMP_ULT, Add, UpperBound);
+    return Builder->CreateICmpULT(Add, UpperBound);
   }
 
   if (Lo == Hi)  // Trivially true.
-    return new ICmpInst(ICmpInst::ICMP_EQ, V, V);
+    return ConstantInt::getTrue(V->getContext());
 
   // V < Min || V >= Hi -> V > Hi-1
   Hi = SubOne(cast<ConstantInt>(Hi));
   if (cast<ConstantInt>(Lo)->isMinValue(isSigned)) {
     ICmpInst::Predicate pred = (isSigned ? 
         ICmpInst::ICMP_SGT : ICmpInst::ICMP_UGT);
-    return new ICmpInst(pred, V, Hi);
+    return Builder->CreateICmp(pred, V, Hi);
   }
 
   // Emit V-Lo >u Hi-1-Lo
@@ -396,7 +359,7 @@ Instruction *InstCombiner::InsertRangeTest(Value *V, Constant *Lo, Constant *Hi,
   ConstantInt *NegLo = cast<ConstantInt>(ConstantExpr::getNeg(Lo));
   Value *Add = Builder->CreateAdd(V, NegLo, V->getName()+".off");
   Constant *LowerBound = ConstantExpr::getAdd(NegLo, Hi);
-  return new ICmpInst(ICmpInst::ICMP_UGT, Add, LowerBound);
+  return Builder->CreateICmpUGT(Add, LowerBound);
 }
 
 // isRunOfOnes - Returns true iff Val consists of one contiguous run of 1s with
@@ -472,8 +435,7 @@ Value *InstCombiner::FoldLogicalPlusAnd(Value *LHS, Value *RHS,
 }
 
 /// FoldAndOfICmps - Fold (icmp)&(icmp) if possible.
-Instruction *InstCombiner::FoldAndOfICmps(Instruction &I,
-                                          ICmpInst *LHS, ICmpInst *RHS) {
+Value *InstCombiner::FoldAndOfICmps(ICmpInst *LHS, ICmpInst *RHS) {
   ICmpInst::Predicate LHSCC = LHS->getPredicate(), RHSCC = RHS->getPredicate();
 
   // (icmp1 A, B) & (icmp2 A, B) --> (icmp3 A, B)
@@ -486,11 +448,7 @@ Instruction *InstCombiner::FoldAndOfICmps(Instruction &I,
       Value *Op0 = LHS->getOperand(0), *Op1 = LHS->getOperand(1);
       unsigned Code = getICmpCode(LHS) & getICmpCode(RHS);
       bool isSigned = LHS->isSigned() || RHS->isSigned();
-      Value *RV = getICmpValue(isSigned, Code, Op0, Op1);
-      if (Instruction *I = dyn_cast<Instruction>(RV))
-        return I;
-      // Otherwise, it's a constant boolean value.
-      return ReplaceInstUsesWith(I, RV);
+      return getICmpValue(isSigned, Code, Op0, Op1, Builder);
     }
   }
   
@@ -506,13 +464,13 @@ Instruction *InstCombiner::FoldAndOfICmps(Instruction &I,
     if (LHSCC == ICmpInst::ICMP_ULT &&
         LHSCst->getValue().isPowerOf2()) {
       Value *NewOr = Builder->CreateOr(Val, Val2);
-      return new ICmpInst(LHSCC, NewOr, LHSCst);
+      return Builder->CreateICmp(LHSCC, NewOr, LHSCst);
     }
     
     // (icmp eq A, 0) & (icmp eq B, 0) --> (icmp eq (A|B), 0)
     if (LHSCC == ICmpInst::ICMP_EQ && LHSCst->isZero()) {
       Value *NewOr = Builder->CreateOr(Val, Val2);
-      return new ICmpInst(LHSCC, NewOr, LHSCst);
+      return Builder->CreateICmp(LHSCC, NewOr, LHSCst);
     }
   }
   
@@ -562,33 +520,32 @@ Instruction *InstCombiner::FoldAndOfICmps(Instruction &I,
     case ICmpInst::ICMP_EQ:         // (X == 13 & X == 15) -> false
     case ICmpInst::ICMP_UGT:        // (X == 13 & X >  15) -> false
     case ICmpInst::ICMP_SGT:        // (X == 13 & X >  15) -> false
-      return ReplaceInstUsesWith(I, ConstantInt::getFalse(I.getContext()));
+      return ConstantInt::get(CmpInst::makeCmpResultType(LHS->getType()), 0);
     case ICmpInst::ICMP_NE:         // (X == 13 & X != 15) -> X == 13
     case ICmpInst::ICMP_ULT:        // (X == 13 & X <  15) -> X == 13
     case ICmpInst::ICMP_SLT:        // (X == 13 & X <  15) -> X == 13
-      return ReplaceInstUsesWith(I, LHS);
+      return LHS;
     }
   case ICmpInst::ICMP_NE:
     switch (RHSCC) {
     default: llvm_unreachable("Unknown integer condition code!");
     case ICmpInst::ICMP_ULT:
       if (LHSCst == SubOne(RHSCst)) // (X != 13 & X u< 14) -> X < 13
-        return new ICmpInst(ICmpInst::ICMP_ULT, Val, LHSCst);
+        return Builder->CreateICmpULT(Val, LHSCst);
       break;                        // (X != 13 & X u< 15) -> no change
     case ICmpInst::ICMP_SLT:
       if (LHSCst == SubOne(RHSCst)) // (X != 13 & X s< 14) -> X < 13
-        return new ICmpInst(ICmpInst::ICMP_SLT, Val, LHSCst);
+        return Builder->CreateICmpSLT(Val, LHSCst);
       break;                        // (X != 13 & X s< 15) -> no change
     case ICmpInst::ICMP_EQ:         // (X != 13 & X == 15) -> X == 15
     case ICmpInst::ICMP_UGT:        // (X != 13 & X u> 15) -> X u> 15
     case ICmpInst::ICMP_SGT:        // (X != 13 & X s> 15) -> X s> 15
-      return ReplaceInstUsesWith(I, RHS);
+      return RHS;
     case ICmpInst::ICMP_NE:
       if (LHSCst == SubOne(RHSCst)){// (X != 13 & X != 14) -> X-13 >u 1
         Constant *AddCST = ConstantExpr::getNeg(LHSCst);
         Value *Add = Builder->CreateAdd(Val, AddCST, Val->getName()+".off");
-        return new ICmpInst(ICmpInst::ICMP_UGT, Add,
-                            ConstantInt::get(Add->getType(), 1));
+        return Builder->CreateICmpUGT(Add, ConstantInt::get(Add->getType(), 1));
       }
       break;                        // (X != 13 & X != 15) -> no change
     }
@@ -598,12 +555,12 @@ Instruction *InstCombiner::FoldAndOfICmps(Instruction &I,
     default: llvm_unreachable("Unknown integer condition code!");
     case ICmpInst::ICMP_EQ:         // (X u< 13 & X == 15) -> false
     case ICmpInst::ICMP_UGT:        // (X u< 13 & X u> 15) -> false
-      return ReplaceInstUsesWith(I, ConstantInt::getFalse(I.getContext()));
+      return ConstantInt::get(CmpInst::makeCmpResultType(LHS->getType()), 0);
     case ICmpInst::ICMP_SGT:        // (X u< 13 & X s> 15) -> no change
       break;
     case ICmpInst::ICMP_NE:         // (X u< 13 & X != 15) -> X u< 13
     case ICmpInst::ICMP_ULT:        // (X u< 13 & X u< 15) -> X u< 13
-      return ReplaceInstUsesWith(I, LHS);
+      return LHS;
     case ICmpInst::ICMP_SLT:        // (X u< 13 & X s< 15) -> no change
       break;
     }
@@ -613,12 +570,12 @@ Instruction *InstCombiner::FoldAndOfICmps(Instruction &I,
     default: llvm_unreachable("Unknown integer condition code!");
     case ICmpInst::ICMP_EQ:         // (X s< 13 & X == 15) -> false
     case ICmpInst::ICMP_SGT:        // (X s< 13 & X s> 15) -> false
-      return ReplaceInstUsesWith(I, ConstantInt::getFalse(I.getContext()));
+      return ConstantInt::get(CmpInst::makeCmpResultType(LHS->getType()), 0);
     case ICmpInst::ICMP_UGT:        // (X s< 13 & X u> 15) -> no change
       break;
     case ICmpInst::ICMP_NE:         // (X s< 13 & X != 15) -> X < 13
     case ICmpInst::ICMP_SLT:        // (X s< 13 & X s< 15) -> X < 13
-      return ReplaceInstUsesWith(I, LHS);
+      return LHS;
     case ICmpInst::ICMP_ULT:        // (X s< 13 & X u< 15) -> no change
       break;
     }
@@ -628,16 +585,15 @@ Instruction *InstCombiner::FoldAndOfICmps(Instruction &I,
     default: llvm_unreachable("Unknown integer condition code!");
     case ICmpInst::ICMP_EQ:         // (X u> 13 & X == 15) -> X == 15
     case ICmpInst::ICMP_UGT:        // (X u> 13 & X u> 15) -> X u> 15
-      return ReplaceInstUsesWith(I, RHS);
+      return RHS;
     case ICmpInst::ICMP_SGT:        // (X u> 13 & X s> 15) -> no change
       break;
     case ICmpInst::ICMP_NE:
       if (RHSCst == AddOne(LHSCst)) // (X u> 13 & X != 14) -> X u> 14
-        return new ICmpInst(LHSCC, Val, RHSCst);
+        return Builder->CreateICmp(LHSCC, Val, RHSCst);
       break;                        // (X u> 13 & X != 15) -> no change
     case ICmpInst::ICMP_ULT:        // (X u> 13 & X u< 15) -> (X-14) <u 1
-      return InsertRangeTest(Val, AddOne(LHSCst),
-                             RHSCst, false, true, I);
+      return InsertRangeTest(Val, AddOne(LHSCst), RHSCst, false, true);
     case ICmpInst::ICMP_SLT:        // (X u> 13 & X s< 15) -> no change
       break;
     }
@@ -647,16 +603,15 @@ Instruction *InstCombiner::FoldAndOfICmps(Instruction &I,
     default: llvm_unreachable("Unknown integer condition code!");
     case ICmpInst::ICMP_EQ:         // (X s> 13 & X == 15) -> X == 15
     case ICmpInst::ICMP_SGT:        // (X s> 13 & X s> 15) -> X s> 15
-      return ReplaceInstUsesWith(I, RHS);
+      return RHS;
     case ICmpInst::ICMP_UGT:        // (X s> 13 & X u> 15) -> no change
       break;
     case ICmpInst::ICMP_NE:
       if (RHSCst == AddOne(LHSCst)) // (X s> 13 & X != 14) -> X s> 14
-        return new ICmpInst(LHSCC, Val, RHSCst);
+        return Builder->CreateICmp(LHSCC, Val, RHSCst);
       break;                        // (X s> 13 & X != 15) -> no change
     case ICmpInst::ICMP_SLT:        // (X s> 13 & X s< 15) -> (X-14) s< 1
-      return InsertRangeTest(Val, AddOne(LHSCst),
-                             RHSCst, true, true, I);
+      return InsertRangeTest(Val, AddOne(LHSCst), RHSCst, true, true);
     case ICmpInst::ICMP_ULT:        // (X s> 13 & X u< 15) -> no change
       break;
     }
@@ -666,9 +621,10 @@ Instruction *InstCombiner::FoldAndOfICmps(Instruction &I,
   return 0;
 }
 
-Instruction *InstCombiner::FoldAndOfFCmps(Instruction &I, FCmpInst *LHS,
-                                          FCmpInst *RHS) {
-  
+/// FoldAndOfFCmps - Optimize (fcmp)&(fcmp).  NOTE: Unlike the rest of
+/// instcombine, this returns a Value which should already be inserted into the
+/// function.
+Value *InstCombiner::FoldAndOfFCmps(FCmpInst *LHS, FCmpInst *RHS) {
   if (LHS->getPredicate() == FCmpInst::FCMP_ORD &&
       RHS->getPredicate() == FCmpInst::FCMP_ORD) {
     // (fcmp ord x, c) & (fcmp ord y, c)  -> (fcmp ord x, y)
@@ -677,17 +633,15 @@ Instruction *InstCombiner::FoldAndOfFCmps(Instruction &I, FCmpInst *LHS,
         // If either of the constants are nans, then the whole thing returns
         // false.
         if (LHSC->getValueAPF().isNaN() || RHSC->getValueAPF().isNaN())
-          return ReplaceInstUsesWith(I, ConstantInt::getFalse(I.getContext()));
-        return new FCmpInst(FCmpInst::FCMP_ORD,
-                            LHS->getOperand(0), RHS->getOperand(0));
+          return ConstantInt::getFalse(LHS->getContext());
+        return Builder->CreateFCmpORD(LHS->getOperand(0), RHS->getOperand(0));
       }
     
     // Handle vector zeros.  This occurs because the canonical form of
     // "fcmp ord x,x" is "fcmp ord x, 0".
     if (isa<ConstantAggregateZero>(LHS->getOperand(1)) &&
         isa<ConstantAggregateZero>(RHS->getOperand(1)))
-      return new FCmpInst(FCmpInst::FCMP_ORD,
-                          LHS->getOperand(0), RHS->getOperand(0));
+      return Builder->CreateFCmpORD(LHS->getOperand(0), RHS->getOperand(0));
     return 0;
   }
   
@@ -705,14 +659,13 @@ Instruction *InstCombiner::FoldAndOfFCmps(Instruction &I, FCmpInst *LHS,
   if (Op0LHS == Op1LHS && Op0RHS == Op1RHS) {
     // Simplify (fcmp cc0 x, y) & (fcmp cc1 x, y).
     if (Op0CC == Op1CC)
-      return new FCmpInst((FCmpInst::Predicate)Op0CC, Op0LHS, Op0RHS);
-    
+      return Builder->CreateFCmp((FCmpInst::Predicate)Op0CC, Op0LHS, Op0RHS);
     if (Op0CC == FCmpInst::FCMP_FALSE || Op1CC == FCmpInst::FCMP_FALSE)
-      return ReplaceInstUsesWith(I, ConstantInt::getFalse(I.getContext()));
+      return ConstantInt::get(CmpInst::makeCmpResultType(LHS->getType()), 0);
     if (Op0CC == FCmpInst::FCMP_TRUE)
-      return ReplaceInstUsesWith(I, RHS);
+      return RHS;
     if (Op1CC == FCmpInst::FCMP_TRUE)
-      return ReplaceInstUsesWith(I, LHS);
+      return LHS;
     
     bool Op0Ordered;
     bool Op1Ordered;
@@ -727,14 +680,14 @@ Instruction *InstCombiner::FoldAndOfFCmps(Instruction &I, FCmpInst *LHS,
       // uno && ueq -> uno && (uno || eq) -> ueq
       // ord && olt -> ord && (ord && lt) -> olt
       if (Op0Ordered == Op1Ordered)
-        return ReplaceInstUsesWith(I, RHS);
+        return RHS;
       
       // uno && oeq -> uno && (ord && eq) -> false
       // uno && ord -> false
       if (!Op0Ordered)
-        return ReplaceInstUsesWith(I, ConstantInt::getFalse(I.getContext()));
+        return ConstantInt::get(CmpInst::makeCmpResultType(LHS->getType()), 0);
       // ord && ueq -> ord && (uno || eq) -> oeq
-      return cast<Instruction>(getFCmpValue(true, Op1Pred, Op0LHS, Op0RHS));
+      return getFCmpValue(true, Op1Pred, Op0LHS, Op0RHS, Builder);
     }
   }
 
@@ -930,14 +883,14 @@ Instruction *InstCombiner::visitAnd(BinaryOperator &I) {
   
   if (ICmpInst *RHS = dyn_cast<ICmpInst>(Op1))
     if (ICmpInst *LHS = dyn_cast<ICmpInst>(Op0))
-      if (Instruction *Res = FoldAndOfICmps(I, LHS, RHS))
-        return Res;
+      if (Value *Res = FoldAndOfICmps(LHS, RHS))
+        return ReplaceInstUsesWith(I, Res);
   
   // If and'ing two fcmp, try combine them into one.
   if (FCmpInst *LHS = dyn_cast<FCmpInst>(I.getOperand(0)))
     if (FCmpInst *RHS = dyn_cast<FCmpInst>(I.getOperand(1)))
-      if (Instruction *Res = FoldAndOfFCmps(I, LHS, RHS))
-        return Res;
+      if (Value *Res = FoldAndOfFCmps(LHS, RHS))
+        return ReplaceInstUsesWith(I, Res);
   
   
   // fold (and (cast A), (cast B)) -> (cast (and A, B))
@@ -946,7 +899,7 @@ Instruction *InstCombiner::visitAnd(BinaryOperator &I) {
       const Type *SrcTy = Op0C->getOperand(0)->getType();
       if (Op0C->getOpcode() == Op1C->getOpcode() && // same cast kind ?
           SrcTy == Op1C->getOperand(0)->getType() &&
-          SrcTy->isIntOrIntVector()) {
+          SrcTy->isIntOrIntVectorTy()) {
         Value *Op0COp = Op0C->getOperand(0), *Op1COp = Op1C->getOperand(0);
         
         // Only do this if the casts both really cause code to be generated.
@@ -960,19 +913,15 @@ Instruction *InstCombiner::visitAnd(BinaryOperator &I) {
         // cast is otherwise not optimizable.  This happens for vector sexts.
         if (ICmpInst *RHS = dyn_cast<ICmpInst>(Op1COp))
           if (ICmpInst *LHS = dyn_cast<ICmpInst>(Op0COp))
-            if (Instruction *Res = FoldAndOfICmps(I, LHS, RHS)) {
-              InsertNewInstBefore(Res, I);
+            if (Value *Res = FoldAndOfICmps(LHS, RHS))
               return CastInst::Create(Op0C->getOpcode(), Res, I.getType());
-            }
         
         // If this is and(cast(fcmp), cast(fcmp)), try to fold this even if the
         // cast is otherwise not optimizable.  This happens for vector sexts.
         if (FCmpInst *RHS = dyn_cast<FCmpInst>(Op1COp))
           if (FCmpInst *LHS = dyn_cast<FCmpInst>(Op0COp))
-            if (Instruction *Res = FoldAndOfFCmps(I, LHS, RHS)) {
-              InsertNewInstBefore(Res, I);
+            if (Value *Res = FoldAndOfFCmps(LHS, RHS))
               return CastInst::Create(Op0C->getOpcode(), Res, I.getType());
-            }
       }
     }
     
@@ -1161,7 +1110,7 @@ static Instruction *MatchSelectFromAndOr(Value *A, Value *B,
   // If A is not a select of -1/0, this cannot match.
   Value *Cond = 0;
   if (!match(A, m_SExt(m_Value(Cond))) ||
-      !Cond->getType()->isInteger(1))
+      !Cond->getType()->isIntegerTy(1))
     return 0;
 
   // ((cond?-1:0)&C) | (B&(cond?0:-1)) -> cond ? C : B.
@@ -1179,8 +1128,7 @@ static Instruction *MatchSelectFromAndOr(Value *A, Value *B,
 }
 
 /// FoldOrOfICmps - Fold (icmp)|(icmp) if possible.
-Instruction *InstCombiner::FoldOrOfICmps(Instruction &I,
-                                         ICmpInst *LHS, ICmpInst *RHS) {
+Value *InstCombiner::FoldOrOfICmps(ICmpInst *LHS, ICmpInst *RHS) {
   ICmpInst::Predicate LHSCC = LHS->getPredicate(), RHSCC = RHS->getPredicate();
 
   // (icmp1 A, B) | (icmp2 A, B) --> (icmp3 A, B)
@@ -1193,11 +1141,7 @@ Instruction *InstCombiner::FoldOrOfICmps(Instruction &I,
       Value *Op0 = LHS->getOperand(0), *Op1 = LHS->getOperand(1);
       unsigned Code = getICmpCode(LHS) | getICmpCode(RHS);
       bool isSigned = LHS->isSigned() || RHS->isSigned();
-      Value *RV = getICmpValue(isSigned, Code, Op0, Op1);
-      if (Instruction *I = dyn_cast<Instruction>(RV))
-        return I;
-      // Otherwise, it's a constant boolean value.
-      return ReplaceInstUsesWith(I, RV);
+      return getICmpValue(isSigned, Code, Op0, Op1, Builder);
     }
   }
   
@@ -1211,7 +1155,7 @@ Instruction *InstCombiner::FoldOrOfICmps(Instruction &I,
   if (LHSCst == RHSCst && LHSCC == RHSCC &&
       LHSCC == ICmpInst::ICMP_NE && LHSCst->isZero()) {
     Value *NewOr = Builder->CreateOr(Val, Val2);
-    return new ICmpInst(LHSCC, NewOr, LHSCst);
+    return Builder->CreateICmp(LHSCC, NewOr, LHSCst);
   }
   
   // From here on, we only handle:
@@ -1263,7 +1207,7 @@ Instruction *InstCombiner::FoldOrOfICmps(Instruction &I,
         Constant *AddCST = ConstantExpr::getNeg(LHSCst);
         Value *Add = Builder->CreateAdd(Val, AddCST, Val->getName()+".off");
         AddCST = ConstantExpr::getSub(AddOne(RHSCst), LHSCst);
-        return new ICmpInst(ICmpInst::ICMP_ULT, Add, AddCST);
+        return Builder->CreateICmpULT(Add, AddCST);
       }
       break;                         // (X == 13 | X == 15) -> no change
     case ICmpInst::ICMP_UGT:         // (X == 13 | X u> 14) -> no change
@@ -1272,7 +1216,7 @@ Instruction *InstCombiner::FoldOrOfICmps(Instruction &I,
     case ICmpInst::ICMP_NE:          // (X == 13 | X != 15) -> X != 15
     case ICmpInst::ICMP_ULT:         // (X == 13 | X u< 15) -> X u< 15
     case ICmpInst::ICMP_SLT:         // (X == 13 | X s< 15) -> X s< 15
-      return ReplaceInstUsesWith(I, RHS);
+      return RHS;
     }
     break;
   case ICmpInst::ICMP_NE:
@@ -1281,11 +1225,11 @@ Instruction *InstCombiner::FoldOrOfICmps(Instruction &I,
     case ICmpInst::ICMP_EQ:          // (X != 13 | X == 15) -> X != 13
     case ICmpInst::ICMP_UGT:         // (X != 13 | X u> 15) -> X != 13
     case ICmpInst::ICMP_SGT:         // (X != 13 | X s> 15) -> X != 13
-      return ReplaceInstUsesWith(I, LHS);
+      return LHS;
     case ICmpInst::ICMP_NE:          // (X != 13 | X != 15) -> true
     case ICmpInst::ICMP_ULT:         // (X != 13 | X u< 15) -> true
     case ICmpInst::ICMP_SLT:         // (X != 13 | X s< 15) -> true
-      return ReplaceInstUsesWith(I, ConstantInt::getTrue(I.getContext()));
+      return ConstantInt::getTrue(LHS->getContext());
     }
     break;
   case ICmpInst::ICMP_ULT:
@@ -1297,14 +1241,13 @@ Instruction *InstCombiner::FoldOrOfICmps(Instruction &I,
       // If RHSCst is [us]MAXINT, it is always false.  Not handling
       // this can cause overflow.
       if (RHSCst->isMaxValue(false))
-        return ReplaceInstUsesWith(I, LHS);
-      return InsertRangeTest(Val, LHSCst, AddOne(RHSCst),
-                             false, false, I);
+        return LHS;
+      return InsertRangeTest(Val, LHSCst, AddOne(RHSCst), false, false);
     case ICmpInst::ICMP_SGT:        // (X u< 13 | X s> 15) -> no change
       break;
     case ICmpInst::ICMP_NE:         // (X u< 13 | X != 15) -> X != 15
     case ICmpInst::ICMP_ULT:        // (X u< 13 | X u< 15) -> X u< 15
-      return ReplaceInstUsesWith(I, RHS);
+      return RHS;
     case ICmpInst::ICMP_SLT:        // (X u< 13 | X s< 15) -> no change
       break;
     }
@@ -1318,14 +1261,13 @@ Instruction *InstCombiner::FoldOrOfICmps(Instruction &I,
       // If RHSCst is [us]MAXINT, it is always false.  Not handling
       // this can cause overflow.
       if (RHSCst->isMaxValue(true))
-        return ReplaceInstUsesWith(I, LHS);
-      return InsertRangeTest(Val, LHSCst, AddOne(RHSCst),
-                             true, false, I);
+        return LHS;
+      return InsertRangeTest(Val, LHSCst, AddOne(RHSCst), true, false);
     case ICmpInst::ICMP_UGT:        // (X s< 13 | X u> 15) -> no change
       break;
     case ICmpInst::ICMP_NE:         // (X s< 13 | X != 15) -> X != 15
     case ICmpInst::ICMP_SLT:        // (X s< 13 | X s< 15) -> X s< 15
-      return ReplaceInstUsesWith(I, RHS);
+      return RHS;
     case ICmpInst::ICMP_ULT:        // (X s< 13 | X u< 15) -> no change
       break;
     }
@@ -1335,12 +1277,12 @@ Instruction *InstCombiner::FoldOrOfICmps(Instruction &I,
     default: llvm_unreachable("Unknown integer condition code!");
     case ICmpInst::ICMP_EQ:         // (X u> 13 | X == 15) -> X u> 13
     case ICmpInst::ICMP_UGT:        // (X u> 13 | X u> 15) -> X u> 13
-      return ReplaceInstUsesWith(I, LHS);
+      return LHS;
     case ICmpInst::ICMP_SGT:        // (X u> 13 | X s> 15) -> no change
       break;
     case ICmpInst::ICMP_NE:         // (X u> 13 | X != 15) -> true
     case ICmpInst::ICMP_ULT:        // (X u> 13 | X u< 15) -> true
-      return ReplaceInstUsesWith(I, ConstantInt::getTrue(I.getContext()));
+      return ConstantInt::getTrue(LHS->getContext());
     case ICmpInst::ICMP_SLT:        // (X u> 13 | X s< 15) -> no change
       break;
     }
@@ -1350,12 +1292,12 @@ Instruction *InstCombiner::FoldOrOfICmps(Instruction &I,
     default: llvm_unreachable("Unknown integer condition code!");
     case ICmpInst::ICMP_EQ:         // (X s> 13 | X == 15) -> X > 13
     case ICmpInst::ICMP_SGT:        // (X s> 13 | X s> 15) -> X > 13
-      return ReplaceInstUsesWith(I, LHS);
+      return LHS;
     case ICmpInst::ICMP_UGT:        // (X s> 13 | X u> 15) -> no change
       break;
     case ICmpInst::ICMP_NE:         // (X s> 13 | X != 15) -> true
     case ICmpInst::ICMP_SLT:        // (X s> 13 | X s< 15) -> true
-      return ReplaceInstUsesWith(I, ConstantInt::getTrue(I.getContext()));
+      return ConstantInt::getTrue(LHS->getContext());
     case ICmpInst::ICMP_ULT:        // (X s> 13 | X u< 15) -> no change
       break;
     }
@@ -1364,8 +1306,10 @@ Instruction *InstCombiner::FoldOrOfICmps(Instruction &I,
   return 0;
 }
 
-Instruction *InstCombiner::FoldOrOfFCmps(Instruction &I, FCmpInst *LHS,
-                                         FCmpInst *RHS) {
+/// FoldOrOfFCmps - Optimize (fcmp)|(fcmp).  NOTE: Unlike the rest of
+/// instcombine, this returns a Value which should already be inserted into the
+/// function.
+Value *InstCombiner::FoldOrOfFCmps(FCmpInst *LHS, FCmpInst *RHS) {
   if (LHS->getPredicate() == FCmpInst::FCMP_UNO &&
       RHS->getPredicate() == FCmpInst::FCMP_UNO && 
       LHS->getOperand(0)->getType() == RHS->getOperand(0)->getType()) {
@@ -1374,20 +1318,18 @@ Instruction *InstCombiner::FoldOrOfFCmps(Instruction &I, FCmpInst *LHS,
         // If either of the constants are nans, then the whole thing returns
         // true.
         if (LHSC->getValueAPF().isNaN() || RHSC->getValueAPF().isNaN())
-          return ReplaceInstUsesWith(I, ConstantInt::getTrue(I.getContext()));
+          return ConstantInt::getTrue(LHS->getContext());
         
         // Otherwise, no need to compare the two constants, compare the
         // rest.
-        return new FCmpInst(FCmpInst::FCMP_UNO,
-                            LHS->getOperand(0), RHS->getOperand(0));
+        return Builder->CreateFCmpUNO(LHS->getOperand(0), RHS->getOperand(0));
       }
     
     // Handle vector zeros.  This occurs because the canonical form of
     // "fcmp uno x,x" is "fcmp uno x, 0".
     if (isa<ConstantAggregateZero>(LHS->getOperand(1)) &&
         isa<ConstantAggregateZero>(RHS->getOperand(1)))
-      return new FCmpInst(FCmpInst::FCMP_UNO,
-                          LHS->getOperand(0), RHS->getOperand(0));
+      return Builder->CreateFCmpUNO(LHS->getOperand(0), RHS->getOperand(0));
     
     return 0;
   }
@@ -1404,14 +1346,13 @@ Instruction *InstCombiner::FoldOrOfFCmps(Instruction &I, FCmpInst *LHS,
   if (Op0LHS == Op1LHS && Op0RHS == Op1RHS) {
     // Simplify (fcmp cc0 x, y) | (fcmp cc1 x, y).
     if (Op0CC == Op1CC)
-      return new FCmpInst((FCmpInst::Predicate)Op0CC,
-                          Op0LHS, Op0RHS);
+      return Builder->CreateFCmp((FCmpInst::Predicate)Op0CC, Op0LHS, Op0RHS);
     if (Op0CC == FCmpInst::FCMP_TRUE || Op1CC == FCmpInst::FCMP_TRUE)
-      return ReplaceInstUsesWith(I, ConstantInt::getTrue(I.getContext()));
+      return ConstantInt::get(CmpInst::makeCmpResultType(LHS->getType()), 1);
     if (Op0CC == FCmpInst::FCMP_FALSE)
-      return ReplaceInstUsesWith(I, RHS);
+      return RHS;
     if (Op1CC == FCmpInst::FCMP_FALSE)
-      return ReplaceInstUsesWith(I, LHS);
+      return LHS;
     bool Op0Ordered;
     bool Op1Ordered;
     unsigned Op0Pred = getFCmpCode(Op0CC, Op0Ordered);
@@ -1419,11 +1360,7 @@ Instruction *InstCombiner::FoldOrOfFCmps(Instruction &I, FCmpInst *LHS,
     if (Op0Ordered == Op1Ordered) {
       // If both are ordered or unordered, return a new fcmp with
       // or'ed predicates.
-      Value *RV = getFCmpValue(Op0Ordered, Op0Pred|Op1Pred, Op0LHS, Op0RHS);
-      if (Instruction *I = dyn_cast<Instruction>(RV))
-        return I;
-      // Otherwise, it's a constant boolean value...
-      return ReplaceInstUsesWith(I, RV);
+      return getFCmpValue(Op0Ordered, Op0Pred|Op1Pred, Op0LHS, Op0RHS, Builder);
     }
   }
   return 0;
@@ -1464,8 +1401,7 @@ Instruction *InstCombiner::visitOr(BinaryOperator &I) {
 
   if (Value *V = SimplifyOrInst(Op0, Op1, TD))
     return ReplaceInstUsesWith(I, V);
-  
-  
+
   // See if we can simplify any instructions used by the instruction whose sole 
   // purpose is to compute bits we don't care about.
   if (SimplifyDemandedInstructionBits(I))
@@ -1474,7 +1410,9 @@ Instruction *InstCombiner::visitOr(BinaryOperator &I) {
   if (ConstantInt *RHS = dyn_cast<ConstantInt>(Op1)) {
     ConstantInt *C1 = 0; Value *X = 0;
     // (X & C1) | C2 --> (X | C2) & (C1|C2)
+    // iff (C1 & C2) == 0.
     if (match(Op0, m_And(m_Value(X), m_ConstantInt(C1))) &&
+        (RHS->getValue() & C1->getValue()) != 0 &&
         Op0->hasOneUse()) {
       Value *Or = Builder->CreateOr(X, RHS);
       Or->takeName(Op0);
@@ -1497,6 +1435,7 @@ Instruction *InstCombiner::visitOr(BinaryOperator &I) {
     if (SelectInst *SI = dyn_cast<SelectInst>(Op0))
       if (Instruction *R = FoldOpIntoSelect(I, SI))
         return R;
+
     if (isa<PHINode>(Op0))
       if (Instruction *NV = FoldOpIntoPhi(I))
         return NV;
@@ -1618,7 +1557,7 @@ Instruction *InstCombiner::visitOr(BinaryOperator &I) {
     // (A & (C0?-1:0)) | (B & ~(C0?-1:0)) ->  C0 ? A : B, and commuted variants.
     // Don't do this for vector select idioms, the code generator doesn't handle
     // them well yet.
-    if (!isa<VectorType>(I.getType())) {
+    if (!I.getType()->isVectorTy()) {
       if (Instruction *Match = MatchSelectFromAndOr(A, B, C, D))
         return Match;
       if (Instruction *Match = MatchSelectFromAndOr(B, A, D, C))
@@ -1684,14 +1623,14 @@ Instruction *InstCombiner::visitOr(BinaryOperator &I) {
 
   if (ICmpInst *RHS = dyn_cast<ICmpInst>(I.getOperand(1)))
     if (ICmpInst *LHS = dyn_cast<ICmpInst>(I.getOperand(0)))
-      if (Instruction *Res = FoldOrOfICmps(I, LHS, RHS))
-        return Res;
+      if (Value *Res = FoldOrOfICmps(LHS, RHS))
+        return ReplaceInstUsesWith(I, Res);
     
   // (fcmp uno x, c) | (fcmp uno y, c)  -> (fcmp uno x, y)
   if (FCmpInst *LHS = dyn_cast<FCmpInst>(I.getOperand(0)))
     if (FCmpInst *RHS = dyn_cast<FCmpInst>(I.getOperand(1)))
-      if (Instruction *Res = FoldOrOfFCmps(I, LHS, RHS))
-        return Res;
+      if (Value *Res = FoldOrOfFCmps(LHS, RHS))
+        return ReplaceInstUsesWith(I, Res);
   
   // fold (or (cast A), (cast B)) -> (cast (or A, B))
   if (CastInst *Op0C = dyn_cast<CastInst>(Op0)) {
@@ -1699,7 +1638,7 @@ Instruction *InstCombiner::visitOr(BinaryOperator &I) {
       if (Op0C->getOpcode() == Op1C->getOpcode()) {// same cast kind ?
         const Type *SrcTy = Op0C->getOperand(0)->getType();
         if (SrcTy == Op1C->getOperand(0)->getType() &&
-            SrcTy->isIntOrIntVector()) {
+            SrcTy->isIntOrIntVectorTy()) {
           Value *Op0COp = Op0C->getOperand(0), *Op1COp = Op1C->getOperand(0);
 
           if ((!isa<ICmpInst>(Op0COp) || !isa<ICmpInst>(Op1COp)) &&
@@ -1715,19 +1654,15 @@ Instruction *InstCombiner::visitOr(BinaryOperator &I) {
           // cast is otherwise not optimizable.  This happens for vector sexts.
           if (ICmpInst *RHS = dyn_cast<ICmpInst>(Op1COp))
             if (ICmpInst *LHS = dyn_cast<ICmpInst>(Op0COp))
-              if (Instruction *Res = FoldOrOfICmps(I, LHS, RHS)) {
-                InsertNewInstBefore(Res, I);
+              if (Value *Res = FoldOrOfICmps(LHS, RHS))
                 return CastInst::Create(Op0C->getOpcode(), Res, I.getType());
-              }
           
           // If this is or(cast(fcmp), cast(fcmp)), try to fold this even if the
           // cast is otherwise not optimizable.  This happens for vector sexts.
           if (FCmpInst *RHS = dyn_cast<FCmpInst>(Op1COp))
             if (FCmpInst *LHS = dyn_cast<FCmpInst>(Op0COp))
-              if (Instruction *Res = FoldOrOfFCmps(I, LHS, RHS)) {
-                InsertNewInstBefore(Res, I);
+              if (Value *Res = FoldOrOfFCmps(LHS, RHS))
                 return CastInst::Create(Op0C->getOpcode(), Res, I.getType());
-              }
         }
       }
   }
@@ -1755,7 +1690,7 @@ Instruction *InstCombiner::visitXor(BinaryOperator &I) {
   // purpose is to compute bits we don't care about.
   if (SimplifyDemandedInstructionBits(I))
     return &I;
-  if (isa<VectorType>(I.getType()))
+  if (I.getType()->isVectorTy())
     if (isa<ConstantAggregateZero>(Op1))
       return ReplaceInstUsesWith(I, Op0);  // X ^ <0,0> -> X
 
@@ -2003,11 +1938,8 @@ Instruction *InstCombiner::visitXor(BinaryOperator &I) {
           Value *Op0 = LHS->getOperand(0), *Op1 = LHS->getOperand(1);
           unsigned Code = getICmpCode(LHS) ^ getICmpCode(RHS);
           bool isSigned = LHS->isSigned() || RHS->isSigned();
-          Value *RV = getICmpValue(isSigned, Code, Op0, Op1);
-          if (Instruction *I = dyn_cast<Instruction>(RV))
-            return I;
-          // Otherwise, it's a constant boolean value.
-          return ReplaceInstUsesWith(I, RV);
+          return ReplaceInstUsesWith(I, 
+                               getICmpValue(isSigned, Code, Op0, Op1, Builder));
         }
       }
 
@@ -2016,7 +1948,7 @@ Instruction *InstCombiner::visitXor(BinaryOperator &I) {
     if (CastInst *Op1C = dyn_cast<CastInst>(Op1))
       if (Op0C->getOpcode() == Op1C->getOpcode()) { // same cast kind?
         const Type *SrcTy = Op0C->getOperand(0)->getType();
-        if (SrcTy == Op1C->getOperand(0)->getType() && SrcTy->isInteger() &&
+        if (SrcTy == Op1C->getOperand(0)->getType() && SrcTy->isIntegerTy() &&
             // Only do this if the casts both really cause code to be generated.
             ShouldOptimizeCast(Op0C->getOpcode(), Op0C->getOperand(0), 
                                I.getType()) &&
diff --git a/libclamav/c++/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp b/libclamav/c++/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
index e501ddc..e2b7d3d 100644
--- a/libclamav/c++/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
+++ b/libclamav/c++/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
@@ -16,6 +16,7 @@
 #include "llvm/Support/CallSite.h"
 #include "llvm/Target/TargetData.h"
 #include "llvm/Analysis/MemoryBuiltins.h"
+#include "llvm/Transforms/Utils/BuildLibCalls.h"
 using namespace llvm;
 
 /// getPromotedType - Return the specified type promoted as it would be to pass
@@ -199,7 +200,7 @@ Instruction *InstCombiner::SimplifyMemSet(MemSetInst *MI) {
   // Extract the length and alignment and fill if they are constant.
   ConstantInt *LenC = dyn_cast<ConstantInt>(MI->getLength());
   ConstantInt *FillC = dyn_cast<ConstantInt>(MI->getValue());
-  if (!LenC || !FillC || !FillC->getType()->isInteger(8))
+  if (!LenC || !FillC || !FillC->getType()->isIntegerTy(8))
     return 0;
   uint64_t Len = LenC->getZExtValue();
   Alignment = MI->getAlignment();
@@ -304,29 +305,39 @@ Instruction *InstCombiner::visitCallInst(CallInst &CI) {
   switch (II->getIntrinsicID()) {
   default: break;
   case Intrinsic::objectsize: {
-    const Type *ReturnTy = CI.getType();
-    Value *Op1 = II->getOperand(1);
-    bool Min = (cast<ConstantInt>(II->getOperand(2))->getZExtValue() == 1);
-    
     // We need target data for just about everything so depend on it.
     if (!TD) break;
     
+    const Type *ReturnTy = CI.getType();
+    bool Min = (cast<ConstantInt>(II->getOperand(2))->getZExtValue() == 1);
+
     // Get to the real allocated thing and offset as fast as possible.
-    Op1 = Op1->stripPointerCasts();
+    Value *Op1 = II->getOperand(1)->stripPointerCasts();
     
     // If we've stripped down to a single global variable that we
     // can know the size of then just return that.
     if (GlobalVariable *GV = dyn_cast<GlobalVariable>(Op1)) {
       if (GV->hasDefinitiveInitializer()) {
         Constant *C = GV->getInitializer();
-        size_t globalSize = TD->getTypeAllocSize(C->getType());
-        return ReplaceInstUsesWith(CI, ConstantInt::get(ReturnTy, globalSize));
+        uint64_t GlobalSize = TD->getTypeAllocSize(C->getType());
+        return ReplaceInstUsesWith(CI, ConstantInt::get(ReturnTy, GlobalSize));
       } else {
+        // Can't determine size of the GV.
         Constant *RetVal = ConstantInt::get(ReturnTy, Min ? 0 : -1ULL);
         return ReplaceInstUsesWith(CI, RetVal);
       }
-    } else if (ConstantExpr *CE = dyn_cast<ConstantExpr>(Op1)) {
-      
+    } else if (AllocaInst *AI = dyn_cast<AllocaInst>(Op1)) {
+      // Get alloca size.
+      if (AI->getAllocatedType()->isSized()) {
+        uint64_t AllocaSize = TD->getTypeAllocSize(AI->getAllocatedType());
+        if (AI->isArrayAllocation()) {
+          const ConstantInt *C = dyn_cast<ConstantInt>(AI->getArraySize());
+          if (!C) break;
+          AllocaSize *= C->getZExtValue();
+        }
+        return ReplaceInstUsesWith(CI, ConstantInt::get(ReturnTy, AllocaSize));
+      }
+    } else if (ConstantExpr *CE = dyn_cast<ConstantExpr>(Op1)) {      
       // Only handle constant GEPs here.
       if (CE->getOpcode() != Instruction::GetElementPtr) break;
       GEPOperator *GEP = cast<GEPOperator>(CE);
@@ -337,25 +348,34 @@ Instruction *InstCombiner::visitCallInst(CallInst &CI) {
       Operand = Operand->stripPointerCasts();
       if (GlobalVariable *GV = dyn_cast<GlobalVariable>(Operand))
         if (!GV->hasDefinitiveInitializer()) break;
-      
+        
       // Get what we're pointing to and its size. 
       const PointerType *BaseType = 
         cast<PointerType>(Operand->getType());
-      size_t Size = TD->getTypeAllocSize(BaseType->getElementType());
+      uint64_t Size = TD->getTypeAllocSize(BaseType->getElementType());
       
       // Get the current byte offset into the thing. Use the original
       // operand in case we're looking through a bitcast.
       SmallVector<Value*, 8> Ops(CE->op_begin()+1, CE->op_end());
       const PointerType *OffsetType =
         cast<PointerType>(GEP->getPointerOperand()->getType());
-      size_t Offset = TD->getIndexedOffset(OffsetType, &Ops[0], Ops.size());
+      uint64_t Offset = TD->getIndexedOffset(OffsetType, &Ops[0], Ops.size());
 
-      assert(Size >= Offset);
+      if (Size < Offset) {
+        // Out of bound reference? Negative index normalized to large
+        // index? Just return "I don't know".
+        Constant *RetVal = ConstantInt::get(ReturnTy, Min ? 0 : -1ULL);
+        return ReplaceInstUsesWith(CI, RetVal);
+      }
       
       Constant *RetVal = ConstantInt::get(ReturnTy, Size-Offset);
       return ReplaceInstUsesWith(CI, RetVal);
       
-    }
+    } 
+
+    // Do not return "I don't know" here. Later optimization passes could
+    // make it possible to evaluate objectsize to a constant.
+    break;
   }
   case Intrinsic::bswap:
     // bswap(bswap(x)) -> x
@@ -721,6 +741,122 @@ static bool isSafeToEliminateVarargsCast(const CallSite CS,
   return true;
 }
 
+// Try to fold some different type of calls here.
+// Currently we're only working with the checking functions, memcpy_chk, 
+// mempcpy_chk, memmove_chk, memset_chk, strcpy_chk, stpcpy_chk, strncpy_chk,
+// strcat_chk and strncat_chk.
+Instruction *InstCombiner::tryOptimizeCall(CallInst *CI, const TargetData *TD) {
+  if (CI->getCalledFunction() == 0) return 0;
+  
+  StringRef Name = CI->getCalledFunction()->getName();
+  BasicBlock *BB = CI->getParent();
+  IRBuilder<> B(CI->getParent()->getContext());
+  
+  // Set the builder to the instruction after the call.
+  B.SetInsertPoint(BB, CI);
+
+  if (Name == "__memcpy_chk") {
+    ConstantInt *SizeCI = dyn_cast<ConstantInt>(CI->getOperand(4));
+    if (!SizeCI)
+      return 0;
+    ConstantInt *SizeArg = dyn_cast<ConstantInt>(CI->getOperand(3));
+    if (!SizeArg)
+      return 0;
+    if (SizeCI->isAllOnesValue() ||
+        SizeCI->getZExtValue() <= SizeArg->getZExtValue()) {
+      EmitMemCpy(CI->getOperand(1), CI->getOperand(2), CI->getOperand(3),
+                 1, B, TD);
+      return ReplaceInstUsesWith(*CI, CI->getOperand(1));
+    }
+    return 0;
+  }
+
+  // Should be similar to memcpy.
+  if (Name == "__mempcpy_chk") {
+    return 0;
+  }
+
+  if (Name == "__memmove_chk") {
+    ConstantInt *SizeCI = dyn_cast<ConstantInt>(CI->getOperand(4));
+    if (!SizeCI)
+      return 0;
+    ConstantInt *SizeArg = dyn_cast<ConstantInt>(CI->getOperand(3));
+    if (!SizeArg)
+      return 0;
+    if (SizeCI->isAllOnesValue() ||
+        SizeCI->getZExtValue() <= SizeArg->getZExtValue()) {
+      EmitMemMove(CI->getOperand(1), CI->getOperand(2), CI->getOperand(3),
+                  1, B, TD);
+      return ReplaceInstUsesWith(*CI, CI->getOperand(1));
+    }
+    return 0;
+  }
+
+  if (Name == "__memset_chk") {
+    ConstantInt *SizeCI = dyn_cast<ConstantInt>(CI->getOperand(4));
+    if (!SizeCI)
+      return 0;
+    ConstantInt *SizeArg = dyn_cast<ConstantInt>(CI->getOperand(3));
+    if (!SizeArg)
+      return 0;
+    if (SizeCI->isAllOnesValue() ||
+        SizeCI->getZExtValue() <= SizeArg->getZExtValue()) {
+      Value *Val = B.CreateIntCast(CI->getOperand(2), B.getInt8Ty(),
+                                   false);
+      EmitMemSet(CI->getOperand(1), Val,  CI->getOperand(3), B, TD);
+      return ReplaceInstUsesWith(*CI, CI->getOperand(1));
+    }
+    return 0;
+  }
+
+  if (Name == "__strcpy_chk") {
+    ConstantInt *SizeCI = dyn_cast<ConstantInt>(CI->getOperand(3));
+    if (!SizeCI)
+      return 0;
+    // If a) we don't have any length information, or b) we know this will
+    // fit then just lower to a plain strcpy. Otherwise we'll keep our
+    // strcpy_chk call which may fail at runtime if the size is too long.
+    // TODO: It might be nice to get a maximum length out of the possible
+    // string lengths for varying.
+    if (SizeCI->isAllOnesValue() ||
+      SizeCI->getZExtValue() >= GetStringLength(CI->getOperand(2))) {
+      Value *Ret = EmitStrCpy(CI->getOperand(1), CI->getOperand(2), B, TD);
+      return ReplaceInstUsesWith(*CI, Ret);
+    }
+    return 0;
+  }
+
+  // Should be similar to strcpy.
+  if (Name == "__stpcpy_chk") {
+    return 0;
+  }
+
+  if (Name == "__strncpy_chk") {
+    ConstantInt *SizeCI = dyn_cast<ConstantInt>(CI->getOperand(4));
+    if (!SizeCI)
+      return 0;
+    ConstantInt *SizeArg = dyn_cast<ConstantInt>(CI->getOperand(3));
+    if (!SizeArg)
+      return 0;
+    if (SizeCI->isAllOnesValue() ||
+        SizeCI->getZExtValue() <= SizeArg->getZExtValue()) {
+      Value *Ret = EmitStrCpy(CI->getOperand(1), CI->getOperand(2), B, TD);
+      return ReplaceInstUsesWith(*CI, Ret);
+    }
+    return 0; 
+  }
+
+  if (Name == "__strcat_chk") {
+    return 0;
+  }
+
+  if (Name == "__strncat_chk") {
+    return 0;
+  }
+
+  return 0;
+}
+
 // visitCallSite - Improvements for call and invoke instructions.
 //
 Instruction *InstCombiner::visitCallSite(CallSite CS) {
@@ -807,6 +943,16 @@ Instruction *InstCombiner::visitCallSite(CallSite CS) {
     Changed = true;
   }
 
+  // Try to optimize the call if possible, we require TargetData for most of
+  // this.  None of these calls are seen as possibly dead so go ahead and
+  // delete the instruction now.
+  if (CallInst *CI = dyn_cast<CallInst>(CS.getInstruction())) {
+    Instruction *I = tryOptimizeCall(CI, TD);
+    // If we changed something return the result, etc. Otherwise let
+    // the fallthrough check.
+    if (I) return EraseInstFromFunction(*I);
+  }
+
   return Changed ? CS.getInstruction() : 0;
 }
 
@@ -831,7 +977,7 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) {
   const Type *OldRetTy = Caller->getType();
   const Type *NewRetTy = FT->getReturnType();
 
-  if (isa<StructType>(NewRetTy))
+  if (NewRetTy->isStructTy())
     return false; // TODO: Handle multiple return values.
 
   // Check to see if we are changing the return type...
@@ -839,9 +985,9 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) {
     if (Callee->isDeclaration() &&
         // Conversion is ok if changing from one pointer type to another or from
         // a pointer to an integer of the same size.
-        !((isa<PointerType>(OldRetTy) || !TD ||
+        !((OldRetTy->isPointerTy() || !TD ||
            OldRetTy == TD->getIntPtrType(Caller->getContext())) &&
-          (isa<PointerType>(NewRetTy) || !TD ||
+          (NewRetTy->isPointerTy() || !TD ||
            NewRetTy == TD->getIntPtrType(Caller->getContext()))))
       return false;   // Cannot transform this return value.
 
@@ -888,9 +1034,9 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) {
     // Converting from one pointer type to another or between a pointer and an
     // integer of the same size is safe even if we do not have a body.
     bool isConvertible = ActTy == ParamTy ||
-      (TD && ((isa<PointerType>(ParamTy) ||
+      (TD && ((ParamTy->isPointerTy() ||
       ParamTy == TD->getIntPtrType(Caller->getContext())) &&
-              (isa<PointerType>(ActTy) ||
+              (ActTy->isPointerTy() ||
               ActTy == TD->getIntPtrType(Caller->getContext()))));
     if (Callee->isDeclaration() && !isConvertible) return false;
   }
diff --git a/libclamav/c++/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp b/libclamav/c++/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
index 68e17e5..a68fc6d 100644
--- a/libclamav/c++/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
+++ b/libclamav/c++/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
@@ -23,7 +23,7 @@ using namespace PatternMatch;
 ///
 static Value *DecomposeSimpleLinearExpr(Value *Val, unsigned &Scale,
                                         int &Offset) {
-  assert(Val->getType()->isInteger(32) && "Unexpected allocation size type!");
+  assert(Val->getType()->isIntegerTy(32) && "Unexpected allocation size type!");
   if (ConstantInt *CI = dyn_cast<ConstantInt>(Val)) {
     Offset = CI->getZExtValue();
     Scale  = 0;
@@ -272,7 +272,7 @@ bool InstCombiner::ShouldOptimizeCast(Instruction::CastOps opc, const Value *V,
   
   // If this is a vector sext from a compare, then we don't want to break the
   // idiom where each element of the extended vector is either zero or all ones.
-  if (opc == Instruction::SExt && isa<CmpInst>(V) && isa<VectorType>(Ty))
+  if (opc == Instruction::SExt && isa<CmpInst>(V) && Ty->isVectorTy())
     return false;
   
   return true;
@@ -303,8 +303,8 @@ Instruction *InstCombiner::commonCastTransforms(CastInst &CI) {
   if (isa<PHINode>(Src)) {
     // We don't do this if this would create a PHI node with an illegal type if
     // it is currently legal.
-    if (!isa<IntegerType>(Src->getType()) ||
-        !isa<IntegerType>(CI.getType()) ||
+    if (!Src->getType()->isIntegerTy() ||
+        !CI.getType()->isIntegerTy() ||
         ShouldChangeType(CI.getType(), Src->getType()))
       if (Instruction *NV = FoldOpIntoPhi(CI))
         return NV;
@@ -436,7 +436,7 @@ Instruction *InstCombiner::visitTrunc(TruncInst &CI) {
   // type.   Only do this if the dest type is a simple type, don't convert the
   // expression tree to something weird like i93 unless the source is also
   // strange.
-  if ((isa<VectorType>(DestTy) || ShouldChangeType(SrcTy, DestTy)) &&
+  if ((DestTy->isVectorTy() || ShouldChangeType(SrcTy, DestTy)) &&
       CanEvaluateTruncated(Src, DestTy)) {
       
     // If this cast is a truncate, evaluting in a different type always
@@ -728,7 +728,7 @@ Instruction *InstCombiner::visitZExt(ZExtInst &CI) {
   // expression tree to something weird like i93 unless the source is also
   // strange.
   unsigned BitsToClear;
-  if ((isa<VectorType>(DestTy) || ShouldChangeType(SrcTy, DestTy)) &&
+  if ((DestTy->isVectorTy() || ShouldChangeType(SrcTy, DestTy)) &&
       CanEvaluateZExtd(Src, DestTy, BitsToClear)) { 
     assert(BitsToClear < SrcTy->getScalarSizeInBits() &&
            "Unreasonable BitsToClear");
@@ -837,7 +837,7 @@ Instruction *InstCombiner::visitZExt(ZExtInst &CI) {
 
   // zext (xor i1 X, true) to i32  --> xor (zext i1 X to i32), 1
   Value *X;
-  if (SrcI && SrcI->hasOneUse() && SrcI->getType()->isInteger(1) &&
+  if (SrcI && SrcI->hasOneUse() && SrcI->getType()->isIntegerTy(1) &&
       match(SrcI, m_Not(m_Value(X))) &&
       (!X->hasOneUse() || !isa<CmpInst>(X))) {
     Value *New = Builder->CreateZExt(X, CI.getType());
@@ -936,7 +936,7 @@ Instruction *InstCombiner::visitSExt(SExtInst &CI) {
   // type.   Only do this if the dest type is a simple type, don't convert the
   // expression tree to something weird like i93 unless the source is also
   // strange.
-  if ((isa<VectorType>(DestTy) || ShouldChangeType(SrcTy, DestTy)) &&
+  if ((DestTy->isVectorTy() || ShouldChangeType(SrcTy, DestTy)) &&
       CanEvaluateSExtd(Src, DestTy)) {
     // Okay, we can transform this!  Insert the new expression now.
     DEBUG(dbgs() << "ICE: EvaluateInDifferentType converting expression type"
@@ -1289,7 +1289,7 @@ Instruction *InstCombiner::visitBitCast(BitCastInst &CI) {
       Constant::getNullValue(Type::getInt32Ty(CI.getContext()));
     unsigned NumZeros = 0;
     while (SrcElTy != DstElTy && 
-           isa<CompositeType>(SrcElTy) && !isa<PointerType>(SrcElTy) &&
+           isa<CompositeType>(SrcElTy) && !SrcElTy->isPointerTy() &&
            SrcElTy->getNumContainedTypes() /* not "{}" */) {
       SrcElTy = cast<CompositeType>(SrcElTy)->getTypeAtIndex(ZeroUInt);
       ++NumZeros;
@@ -1304,7 +1304,7 @@ Instruction *InstCombiner::visitBitCast(BitCastInst &CI) {
   }
 
   if (const VectorType *DestVTy = dyn_cast<VectorType>(DestTy)) {
-    if (DestVTy->getNumElements() == 1 && !isa<VectorType>(SrcTy)) {
+    if (DestVTy->getNumElements() == 1 && !SrcTy->isVectorTy()) {
       Value *Elem = Builder->CreateBitCast(Src, DestVTy->getElementType());
       return InsertElementInst::Create(UndefValue::get(DestTy), Elem,
                      Constant::getNullValue(Type::getInt32Ty(CI.getContext())));
@@ -1313,7 +1313,7 @@ Instruction *InstCombiner::visitBitCast(BitCastInst &CI) {
   }
 
   if (const VectorType *SrcVTy = dyn_cast<VectorType>(SrcTy)) {
-    if (SrcVTy->getNumElements() == 1 && !isa<VectorType>(DestTy)) {
+    if (SrcVTy->getNumElements() == 1 && !DestTy->isVectorTy()) {
       Value *Elem = 
         Builder->CreateExtractElement(Src,
                    Constant::getNullValue(Type::getInt32Ty(CI.getContext())));
@@ -1324,7 +1324,7 @@ Instruction *InstCombiner::visitBitCast(BitCastInst &CI) {
   if (ShuffleVectorInst *SVI = dyn_cast<ShuffleVectorInst>(Src)) {
     // Okay, we have (bitcast (shuffle ..)).  Check to see if this is
     // a bitconvert to a vector with the same # elts.
-    if (SVI->hasOneUse() && isa<VectorType>(DestTy) && 
+    if (SVI->hasOneUse() && DestTy->isVectorTy() && 
         cast<VectorType>(DestTy)->getNumElements() ==
               SVI->getType()->getNumElements() &&
         SVI->getType()->getNumElements() ==
@@ -1346,7 +1346,7 @@ Instruction *InstCombiner::visitBitCast(BitCastInst &CI) {
     }
   }
   
-  if (isa<PointerType>(SrcTy))
+  if (SrcTy->isPointerTy())
     return commonPointerCastTransforms(CI);
   return commonCastTransforms(CI);
 }
diff --git a/libclamav/c++/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/libclamav/c++/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
index 7c00c2c..72fd558 100644
--- a/libclamav/c++/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
+++ b/libclamav/c++/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
@@ -877,25 +877,26 @@ Instruction *InstCombiner::FoldICmpDivCst(ICmpInst &ICI, BinaryOperator *DivI,
   case ICmpInst::ICMP_EQ:
     if (LoOverflow && HiOverflow)
       return ReplaceInstUsesWith(ICI, ConstantInt::getFalse(ICI.getContext()));
-    else if (HiOverflow)
+    if (HiOverflow)
       return new ICmpInst(DivIsSigned ? ICmpInst::ICMP_SGE :
                           ICmpInst::ICMP_UGE, X, LoBound);
-    else if (LoOverflow)
+    if (LoOverflow)
       return new ICmpInst(DivIsSigned ? ICmpInst::ICMP_SLT :
                           ICmpInst::ICMP_ULT, X, HiBound);
-    else
-      return InsertRangeTest(X, LoBound, HiBound, DivIsSigned, true, ICI);
+    return ReplaceInstUsesWith(ICI,
+                               InsertRangeTest(X, LoBound, HiBound, DivIsSigned,
+                                               true));
   case ICmpInst::ICMP_NE:
     if (LoOverflow && HiOverflow)
       return ReplaceInstUsesWith(ICI, ConstantInt::getTrue(ICI.getContext()));
-    else if (HiOverflow)
+    if (HiOverflow)
       return new ICmpInst(DivIsSigned ? ICmpInst::ICMP_SLT :
                           ICmpInst::ICMP_ULT, X, LoBound);
-    else if (LoOverflow)
+    if (LoOverflow)
       return new ICmpInst(DivIsSigned ? ICmpInst::ICMP_SGE :
                           ICmpInst::ICMP_UGE, X, HiBound);
-    else
-      return InsertRangeTest(X, LoBound, HiBound, DivIsSigned, false, ICI);
+    return ReplaceInstUsesWith(ICI, InsertRangeTest(X, LoBound, HiBound,
+                                                    DivIsSigned, false));
   case ICmpInst::ICMP_ULT:
   case ICmpInst::ICMP_SLT:
     if (LoOverflow == +1)   // Low bound is greater than input range.
@@ -1606,7 +1607,7 @@ Instruction *InstCombiner::visitICmpInst(ICmpInst &I) {
   const Type *Ty = Op0->getType();
 
   // icmp's with boolean values can always be turned into bitwise operations
-  if (Ty->isInteger(1)) {
+  if (Ty->isIntegerTy(1)) {
     switch (I.getPredicate()) {
     default: llvm_unreachable("Invalid icmp instruction!");
     case ICmpInst::ICMP_EQ: {               // icmp eq i1 A, B -> ~(A^B)
@@ -1650,7 +1651,7 @@ Instruction *InstCombiner::visitICmpInst(ICmpInst &I) {
   unsigned BitWidth = 0;
   if (TD)
     BitWidth = TD->getTypeSizeInBits(Ty->getScalarType());
-  else if (Ty->isIntOrIntVector())
+  else if (Ty->isIntOrIntVectorTy())
     BitWidth = Ty->getScalarSizeInBits();
 
   bool isSignBit = false;
@@ -1988,7 +1989,7 @@ Instruction *InstCombiner::visitICmpInst(ICmpInst &I) {
   // values.  If the ptr->ptr cast can be stripped off both arguments, we do so
   // now.
   if (BitCastInst *CI = dyn_cast<BitCastInst>(Op0)) {
-    if (isa<PointerType>(Op0->getType()) && 
+    if (Op0->getType()->isPointerTy() && 
         (isa<Constant>(Op1) || isa<BitCastInst>(Op1))) { 
       // We keep moving the cast from the left operand over to the right
       // operand, where it can often be eliminated completely.
@@ -2458,17 +2459,17 @@ Instruction *InstCombiner::visitFCmpInst(FCmpInst &I) {
           return SelectInst::Create(LHSI->getOperand(0), Op1, Op2);
         break;
       }
-    case Instruction::Load:
-      if (GetElementPtrInst *GEP =
-          dyn_cast<GetElementPtrInst>(LHSI->getOperand(0))) {
-        if (GlobalVariable *GV = dyn_cast<GlobalVariable>(GEP->getOperand(0)))
-          if (GV->isConstant() && GV->hasDefinitiveInitializer() &&
-              !cast<LoadInst>(LHSI)->isVolatile())
-            if (Instruction *Res = FoldCmpLoadFromIndexedGlobal(GEP, GV, I))
-              return Res;
+      case Instruction::Load:
+        if (GetElementPtrInst *GEP =
+            dyn_cast<GetElementPtrInst>(LHSI->getOperand(0))) {
+          if (GlobalVariable *GV = dyn_cast<GlobalVariable>(GEP->getOperand(0)))
+            if (GV->isConstant() && GV->hasDefinitiveInitializer() &&
+                !cast<LoadInst>(LHSI)->isVolatile())
+              if (Instruction *Res = FoldCmpLoadFromIndexedGlobal(GEP, GV, I))
+                return Res;
+        }
+        break;
       }
-      break;
-    }
   }
 
   return Changed ? &I : 0;
diff --git a/libclamav/c++/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp b/libclamav/c++/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
index 2d13298..0f2a24f 100644
--- a/libclamav/c++/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
+++ b/libclamav/c++/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
@@ -87,8 +87,8 @@ static Instruction *InstCombineLoadCast(InstCombiner &IC, LoadInst &LI,
 
     const Type *SrcPTy = SrcTy->getElementType();
 
-    if (DestPTy->isInteger() || isa<PointerType>(DestPTy) || 
-         isa<VectorType>(DestPTy)) {
+    if (DestPTy->isIntegerTy() || DestPTy->isPointerTy() || 
+         DestPTy->isVectorTy()) {
       // If the source is an array, the code below will not succeed.  Check to
       // see if a trivial 'gep P, 0, 0' will help matters.  Only do this for
       // constants.
@@ -104,11 +104,11 @@ static Instruction *InstCombineLoadCast(InstCombiner &IC, LoadInst &LI,
           }
 
       if (IC.getTargetData() &&
-          (SrcPTy->isInteger() || isa<PointerType>(SrcPTy) || 
-            isa<VectorType>(SrcPTy)) &&
+          (SrcPTy->isIntegerTy() || SrcPTy->isPointerTy() || 
+            SrcPTy->isVectorTy()) &&
           // Do not allow turning this into a load of an integer, which is then
           // casted to a pointer, this pessimizes pointer analysis a lot.
-          (isa<PointerType>(SrcPTy) == isa<PointerType>(LI.getType())) &&
+          (SrcPTy->isPointerTy() == LI.getType()->isPointerTy()) &&
           IC.getTargetData()->getTypeSizeInBits(SrcPTy) ==
                IC.getTargetData()->getTypeSizeInBits(DestPTy)) {
 
@@ -243,7 +243,7 @@ static Instruction *InstCombineStoreToCast(InstCombiner &IC, StoreInst &SI) {
   
   const Type *SrcPTy = SrcTy->getElementType();
 
-  if (!DestPTy->isInteger() && !isa<PointerType>(DestPTy))
+  if (!DestPTy->isIntegerTy() && !DestPTy->isPointerTy())
     return 0;
   
   /// NewGEPIndices - If SrcPTy is an aggregate type, we can emit a "noop gep"
@@ -255,7 +255,7 @@ static Instruction *InstCombineStoreToCast(InstCombiner &IC, StoreInst &SI) {
   // If the source is an array, the code below will not succeed.  Check to
   // see if a trivial 'gep P, 0, 0' will help matters.  Only do this for
   // constants.
-  if (isa<ArrayType>(SrcPTy) || isa<StructType>(SrcPTy)) {
+  if (SrcPTy->isArrayTy() || SrcPTy->isStructTy()) {
     // Index through pointer.
     Constant *Zero = Constant::getNullValue(Type::getInt32Ty(SI.getContext()));
     NewGEPIndices.push_back(Zero);
@@ -277,7 +277,7 @@ static Instruction *InstCombineStoreToCast(InstCombiner &IC, StoreInst &SI) {
     SrcTy = PointerType::get(SrcPTy, SrcTy->getAddressSpace());
   }
 
-  if (!SrcPTy->isInteger() && !isa<PointerType>(SrcPTy))
+  if (!SrcPTy->isIntegerTy() && !SrcPTy->isPointerTy())
     return 0;
   
   // If the pointers point into different address spaces or if they point to
@@ -297,11 +297,11 @@ static Instruction *InstCombineStoreToCast(InstCombiner &IC, StoreInst &SI) {
   Instruction::CastOps opcode = Instruction::BitCast;
   const Type* CastSrcTy = SIOp0->getType();
   const Type* CastDstTy = SrcPTy;
-  if (isa<PointerType>(CastDstTy)) {
-    if (CastSrcTy->isInteger())
+  if (CastDstTy->isPointerTy()) {
+    if (CastSrcTy->isIntegerTy())
       opcode = Instruction::IntToPtr;
-  } else if (isa<IntegerType>(CastDstTy)) {
-    if (isa<PointerType>(SIOp0->getType()))
+  } else if (CastDstTy->isIntegerTy()) {
+    if (SIOp0->getType()->isPointerTy())
       opcode = Instruction::PtrToInt;
   }
   
@@ -413,7 +413,7 @@ Instruction *InstCombiner::visitStoreInst(StoreInst &SI) {
     // Don't count debug info directives, lest they affect codegen,
     // and we skip pointer-to-pointer bitcasts, which are NOPs.
     if (isa<DbgInfoIntrinsic>(BBI) ||
-        (isa<BitCastInst>(BBI) && isa<PointerType>(BBI->getType()))) {
+        (isa<BitCastInst>(BBI) && BBI->getType()->isPointerTy())) {
       ScanInsts++;
       continue;
     }    
@@ -483,7 +483,7 @@ Instruction *InstCombiner::visitStoreInst(StoreInst &SI) {
   do {
     ++BBI;
   } while (isa<DbgInfoIntrinsic>(BBI) ||
-           (isa<BitCastInst>(BBI) && isa<PointerType>(BBI->getType())));
+           (isa<BitCastInst>(BBI) && BBI->getType()->isPointerTy()));
   if (BranchInst *BI = dyn_cast<BranchInst>(BBI))
     if (BI->isUnconditional())
       if (SimplifyStoreAtEndOfBlock(SI))
@@ -544,7 +544,7 @@ bool InstCombiner::SimplifyStoreAtEndOfBlock(StoreInst &SI) {
     --BBI;
     // Skip over debugging info.
     while (isa<DbgInfoIntrinsic>(BBI) ||
-           (isa<BitCastInst>(BBI) && isa<PointerType>(BBI->getType()))) {
+           (isa<BitCastInst>(BBI) && BBI->getType()->isPointerTy())) {
       if (BBI==OtherBB->begin())
         return false;
       --BBI;
diff --git a/libclamav/c++/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp b/libclamav/c++/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
index 2e26a75..b3974e8 100644
--- a/libclamav/c++/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
+++ b/libclamav/c++/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
@@ -76,7 +76,7 @@ Instruction *InstCombiner::visitMul(BinaryOperator &I) {
         return BinaryOperator::CreateShl(Op0,
                  ConstantInt::get(Op0->getType(), Val.logBase2()));
       }
-    } else if (isa<VectorType>(Op1C->getType())) {
+    } else if (Op1C->getType()->isVectorTy()) {
       if (Op1C->isNullValue())
         return ReplaceInstUsesWith(I, Op1C);
 
@@ -157,7 +157,7 @@ Instruction *InstCombiner::visitMul(BinaryOperator &I) {
   }
 
   /// i1 mul -> i1 and.
-  if (I.getType()->isInteger(1))
+  if (I.getType()->isIntegerTy(1))
     return BinaryOperator::CreateAnd(Op0, Op1);
 
   // X*(1 << Y) --> X << Y
@@ -173,7 +173,7 @@ Instruction *InstCombiner::visitMul(BinaryOperator &I) {
   // If one of the operands of the multiply is a cast from a boolean value, then
   // we know the bool is either zero or one, so this is a 'masking' multiply.
   //   X * Y (where Y is 0 or 1) -> X & (0-Y)
-  if (!isa<VectorType>(I.getType())) {
+  if (!I.getType()->isVectorTy()) {
     // -2 is "-1 << 1" so it is all bits set except the low one.
     APInt Negative2(I.getType()->getPrimitiveSizeInBits(), (uint64_t)-2, true);
     
@@ -203,8 +203,8 @@ Instruction *InstCombiner::visitFMul(BinaryOperator &I) {
       // "In IEEE floating point, x*1 is not equivalent to x for nans.  However,
       // ANSI says we can drop signals, so we can do this anyway." (from GCC)
       if (Op1F->isExactlyValue(1.0))
-        return ReplaceInstUsesWith(I, Op0);  // Eliminate 'mul double %X, 1.0'
-    } else if (isa<VectorType>(Op1C->getType())) {
+        return ReplaceInstUsesWith(I, Op0);  // Eliminate 'fmul double %X, 1.0'
+    } else if (Op1C->getType()->isVectorTy()) {
       if (ConstantVector *Op1V = dyn_cast<ConstantVector>(Op1C)) {
         // As above, vector X*splat(1.0) -> X in all defined cases.
         if (Constant *Splat = Op1V->getSplatValue()) {
@@ -314,7 +314,7 @@ Instruction *InstCombiner::commonDivTransforms(BinaryOperator &I) {
   // undef / X -> 0        for integer.
   // undef / X -> undef    for FP (the undef could be a snan).
   if (isa<UndefValue>(Op0)) {
-    if (Op0->getType()->isFPOrFPVector())
+    if (Op0->getType()->isFPOrFPVectorTy())
       return ReplaceInstUsesWith(I, Op0);
     return ReplaceInstUsesWith(I, Constant::getNullValue(I.getType()));
   }
@@ -386,7 +386,7 @@ Instruction *InstCombiner::commonIDivTransforms(BinaryOperator &I) {
       return ReplaceInstUsesWith(I, Constant::getNullValue(I.getType()));
 
   // It can't be division by zero, hence it must be division by one.
-  if (I.getType()->isInteger(1))
+  if (I.getType()->isIntegerTy(1))
     return ReplaceInstUsesWith(I, Op0);
 
   if (ConstantVector *Op1V = dyn_cast<ConstantVector>(Op1)) {
@@ -493,7 +493,7 @@ Instruction *InstCombiner::visitSDiv(BinaryOperator &I) {
 
   // If the sign bits of both operands are zero (i.e. we can prove they are
   // unsigned inputs), turn this into a udiv.
-  if (I.getType()->isInteger()) {
+  if (I.getType()->isIntegerTy()) {
     APInt Mask(APInt::getSignBit(I.getType()->getPrimitiveSizeInBits()));
     if (MaskedValueIsZero(Op0, Mask)) {
       if (MaskedValueIsZero(Op1, Mask)) {
@@ -527,7 +527,7 @@ Instruction *InstCombiner::commonRemTransforms(BinaryOperator &I) {
   Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);
 
   if (isa<UndefValue>(Op0)) {             // undef % X -> 0
-    if (I.getType()->isFPOrFPVector())
+    if (I.getType()->isFPOrFPVectorTy())
       return ReplaceInstUsesWith(I, Op0);  // X % undef -> undef (could be SNaN)
     return ReplaceInstUsesWith(I, Constant::getNullValue(I.getType()));
   }
@@ -648,7 +648,7 @@ Instruction *InstCombiner::visitSRem(BinaryOperator &I) {
 
   // If the sign bits of both operands are zero (i.e. we can prove they are
   // unsigned inputs), turn this into a urem.
-  if (I.getType()->isInteger()) {
+  if (I.getType()->isIntegerTy()) {
     APInt Mask(APInt::getSignBit(I.getType()->getPrimitiveSizeInBits()));
     if (MaskedValueIsZero(Op1, Mask) && MaskedValueIsZero(Op0, Mask)) {
       // X srem Y -> X urem Y, iff X and Y don't have sign bit set
diff --git a/libclamav/c++/llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp b/libclamav/c++/llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp
index bb7632f..65f0393 100644
--- a/libclamav/c++/llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp
+++ b/libclamav/c++/llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp
@@ -266,6 +266,7 @@ Instruction *InstCombiner::FoldPHIArgLoadIntoPHI(PHINode &PN) {
   // and if TD isn't around, we can't handle the mixed case.
   bool isVolatile = FirstLI->isVolatile();
   unsigned LoadAlignment = FirstLI->getAlignment();
+  unsigned LoadAddrSpace = FirstLI->getPointerAddressSpace();
   
   // We can't sink the load if the loaded value could be modified between the
   // load and the PHI.
@@ -290,6 +291,7 @@ Instruction *InstCombiner::FoldPHIArgLoadIntoPHI(PHINode &PN) {
     // the load and the PHI.
     if (LI->isVolatile() != isVolatile ||
         LI->getParent() != PN.getIncomingBlock(i) ||
+        LI->getPointerAddressSpace() != LoadAddrSpace ||
         !isSafeAndProfitableToSinkLoad(LI))
       return 0;
       
@@ -371,7 +373,7 @@ Instruction *InstCombiner::FoldPHIArgOpIntoPHI(PHINode &PN) {
 
     // Be careful about transforming integer PHIs.  We don't want to pessimize
     // the code by turning an i32 into an i1293.
-    if (isa<IntegerType>(PN.getType()) && isa<IntegerType>(CastSrcTy)) {
+    if (PN.getType()->isIntegerTy() && CastSrcTy->isIntegerTy()) {
       if (!ShouldChangeType(PN.getType(), CastSrcTy))
         return 0;
     }
@@ -832,7 +834,7 @@ Instruction *InstCombiner::visitPHINode(PHINode &PN) {
   // it is only used by trunc or trunc(lshr) operations.  If so, we split the
   // PHI into the various pieces being extracted.  This sort of thing is
   // introduced when SROA promotes an aggregate to a single large integer type.
-  if (isa<IntegerType>(PN.getType()) && TD &&
+  if (PN.getType()->isIntegerTy() && TD &&
       !TD->isLegalInteger(PN.getType()->getPrimitiveSizeInBits()))
     if (Instruction *Res = SliceUpIllegalIntegerPHI(PN))
       return Res;
diff --git a/libclamav/c++/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp b/libclamav/c++/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
index 9a02b33..2fc9325 100644
--- a/libclamav/c++/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
+++ b/libclamav/c++/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
@@ -441,7 +441,7 @@ Instruction *InstCombiner::visitSelectInst(SelectInst &SI) {
       return ReplaceInstUsesWith(SI, FalseVal);
   }
 
-  if (SI.getType()->isInteger(1)) {
+  if (SI.getType()->isIntegerTy(1)) {
     if (ConstantInt *C = dyn_cast<ConstantInt>(TrueVal)) {
       if (C->getZExtValue()) {
         // Change: A = select B, true, C --> A = or B, C
@@ -539,9 +539,18 @@ Instruction *InstCombiner::visitSelectInst(SelectInst &SI) {
              !CFPf->getValueAPF().isZero()))
         return ReplaceInstUsesWith(SI, FalseVal);
       }
-      // Transform (X != Y) ? X : Y  -> X
-      if (FCI->getPredicate() == FCmpInst::FCMP_ONE)
+      // Transform (X une Y) ? X : Y  -> X
+      if (FCI->getPredicate() == FCmpInst::FCMP_UNE) {
+        // This is not safe in general for floating point:  
+        // consider X== -0, Y== +0.
+        // It becomes safe if either operand is a nonzero constant.
+        ConstantFP *CFPt, *CFPf;
+        if (((CFPt = dyn_cast<ConstantFP>(TrueVal)) &&
+              !CFPt->getValueAPF().isZero()) ||
+            ((CFPf = dyn_cast<ConstantFP>(FalseVal)) &&
+             !CFPf->getValueAPF().isZero()))
         return ReplaceInstUsesWith(SI, TrueVal);
+      }
       // NOTE: if we wanted to, this is where to detect MIN/MAX
 
     } else if (FCI->getOperand(0) == FalseVal && FCI->getOperand(1) == TrueVal){
@@ -557,9 +566,18 @@ Instruction *InstCombiner::visitSelectInst(SelectInst &SI) {
              !CFPf->getValueAPF().isZero()))
           return ReplaceInstUsesWith(SI, FalseVal);
       }
-      // Transform (X != Y) ? Y : X  -> Y
-      if (FCI->getPredicate() == FCmpInst::FCMP_ONE)
-        return ReplaceInstUsesWith(SI, TrueVal);
+      // Transform (X une Y) ? Y : X  -> Y
+      if (FCI->getPredicate() == FCmpInst::FCMP_UNE) {
+        // This is not safe in general for floating point:  
+        // consider X== -0, Y== +0.
+        // It becomes safe if either operand is a nonzero constant.
+        ConstantFP *CFPt, *CFPf;
+        if (((CFPt = dyn_cast<ConstantFP>(TrueVal)) &&
+              !CFPt->getValueAPF().isZero()) ||
+            ((CFPf = dyn_cast<ConstantFP>(FalseVal)) &&
+             !CFPf->getValueAPF().isZero()))
+          return ReplaceInstUsesWith(SI, TrueVal);
+      }
       // NOTE: if we wanted to, this is where to detect MIN/MAX
     }
     // NOTE: if we wanted to, this is where to detect ABS
@@ -629,7 +647,7 @@ Instruction *InstCombiner::visitSelectInst(SelectInst &SI) {
       }
 
   // See if we can fold the select into one of our operands.
-  if (SI.getType()->isInteger()) {
+  if (SI.getType()->isIntegerTy()) {
     if (Instruction *FoldI = FoldSelectIntoOp(SI, TrueVal, FalseVal))
       return FoldI;
     
diff --git a/libclamav/c++/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp b/libclamav/c++/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
index 53a5684..cd41844 100644
--- a/libclamav/c++/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
+++ b/libclamav/c++/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
@@ -104,10 +104,10 @@ Value *InstCombiner::SimplifyDemandedUseBits(Value *V, APInt DemandedMask,
   assert(Depth <= 6 && "Limit Search Depth");
   uint32_t BitWidth = DemandedMask.getBitWidth();
   const Type *VTy = V->getType();
-  assert((TD || !isa<PointerType>(VTy)) &&
+  assert((TD || !VTy->isPointerTy()) &&
          "SimplifyDemandedBits needs to know bit widths!");
   assert((!TD || TD->getTypeSizeInBits(VTy->getScalarType()) == BitWidth) &&
-         (!VTy->isIntOrIntVector() ||
+         (!VTy->isIntOrIntVectorTy() ||
           VTy->getScalarSizeInBits() == BitWidth) &&
          KnownZero.getBitWidth() == BitWidth &&
          KnownOne.getBitWidth() == BitWidth &&
@@ -401,7 +401,7 @@ Value *InstCombiner::SimplifyDemandedUseBits(Value *V, APInt DemandedMask,
     break;
   }
   case Instruction::BitCast:
-    if (!I->getOperand(0)->getType()->isIntOrIntVector())
+    if (!I->getOperand(0)->getType()->isIntOrIntVectorTy())
       return 0;  // vector->int or fp->int?
 
     if (const VectorType *DstVTy = dyn_cast<VectorType>(I->getType())) {
@@ -413,7 +413,7 @@ Value *InstCombiner::SimplifyDemandedUseBits(Value *V, APInt DemandedMask,
       } else
         // Don't touch a scalar-to-vector bitcast.
         return 0;
-    } else if (isa<VectorType>(I->getOperand(0)->getType()))
+    } else if (I->getOperand(0)->getType()->isVectorTy())
       // Don't touch a vector-to-scalar bitcast.
       return 0;
 
diff --git a/libclamav/c++/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp b/libclamav/c++/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
index 20fda1a..a58124d 100644
--- a/libclamav/c++/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
+++ b/libclamav/c++/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
@@ -78,7 +78,7 @@ static std::vector<unsigned> getShuffleMask(const ShuffleVectorInst *SVI) {
 /// value is already around as a register, for example if it were inserted then
 /// extracted from the vector.
 static Value *FindScalarElement(Value *V, unsigned EltNo) {
-  assert(isa<VectorType>(V->getType()) && "Not looking at a vector?");
+  assert(V->getType()->isVectorTy() && "Not looking at a vector?");
   const VectorType *PTy = cast<VectorType>(V->getType());
   unsigned Width = PTy->getNumElements();
   if (EltNo >= Width)  // Out of range access.
@@ -322,7 +322,7 @@ static bool CollectSingleShuffleElements(Value *V, Value *LHS, Value *RHS,
 /// that computes V and the LHS value of the shuffle.
 static Value *CollectShuffleElements(Value *V, std::vector<Constant*> &Mask,
                                      Value *&RHS) {
-  assert(isa<VectorType>(V->getType()) && 
+  assert(V->getType()->isVectorTy() && 
          (RHS == 0 || V->getType() == RHS->getType()) &&
          "Invalid shuffle!");
   unsigned NumElts = cast<VectorType>(V->getType())->getNumElements();
diff --git a/libclamav/c++/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp b/libclamav/c++/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
index 93b1961..af9ec5c 100644
--- a/libclamav/c++/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
+++ b/libclamav/c++/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
@@ -73,7 +73,7 @@ void InstCombiner::getAnalysisUsage(AnalysisUsage &AU) const {
 /// from 'From' to 'To'.  We don't want to convert from a legal to an illegal
 /// type for example, or from a smaller to a larger illegal type.
 bool InstCombiner::ShouldChangeType(const Type *From, const Type *To) const {
-  assert(isa<IntegerType>(From) && isa<IntegerType>(To));
+  assert(From->isIntegerTy() && To->isIntegerTy());
   
   // If we don't have TD, we don't know if the source/dest are legal.
   if (!TD) return false;
@@ -158,7 +158,7 @@ Value *InstCombiner::dyn_castNegVal(Value *V) const {
     return ConstantExpr::getNeg(C);
 
   if (ConstantVector *C = dyn_cast<ConstantVector>(V))
-    if (C->getType()->getElementType()->isInteger())
+    if (C->getType()->getElementType()->isIntegerTy())
       return ConstantExpr::getNeg(C);
 
   return 0;
@@ -177,7 +177,7 @@ Value *InstCombiner::dyn_castFNegVal(Value *V) const {
     return ConstantExpr::getFNeg(C);
 
   if (ConstantVector *C = dyn_cast<ConstantVector>(V))
-    if (C->getType()->getElementType()->isFloatingPoint())
+    if (C->getType()->getElementType()->isFloatingPointTy())
       return ConstantExpr::getFNeg(C);
 
   return 0;
@@ -226,7 +226,7 @@ Instruction *InstCombiner::FoldOpIntoSelect(Instruction &Op, SelectInst *SI) {
 
   if (isa<Constant>(TV) || isa<Constant>(FV)) {
     // Bool selects with constant operands can be folded to logical ops.
-    if (SI->getType()->isInteger(1)) return 0;
+    if (SI->getType()->isIntegerTy(1)) return 0;
 
     Value *SelectTrueVal = FoldOperationIntoSelectOperand(Op, TV, this);
     Value *SelectFalseVal = FoldOperationIntoSelectOperand(Op, FV, this);
@@ -478,7 +478,7 @@ Instruction *InstCombiner::visitGetElementPtrInst(GetElementPtrInst &GEP) {
     bool EndsWithSequential = false;
     for (gep_type_iterator I = gep_type_begin(*Src), E = gep_type_end(*Src);
          I != E; ++I)
-      EndsWithSequential = !isa<StructType>(*I);
+      EndsWithSequential = !(*I)->isStructTy();
 
     // Can we combine the two pointer arithmetics offsets?
     if (EndsWithSequential) {
@@ -578,7 +578,7 @@ Instruction *InstCombiner::visitGetElementPtrInst(GetElementPtrInst &GEP) {
       // into:  %t1 = getelementptr [2 x i32]* %str, i32 0, i32 %V; bitcast
       const Type *SrcElTy = StrippedPtrTy->getElementType();
       const Type *ResElTy=cast<PointerType>(PtrOp->getType())->getElementType();
-      if (TD && isa<ArrayType>(SrcElTy) &&
+      if (TD && SrcElTy->isArrayTy() &&
           TD->getTypeAllocSize(cast<ArrayType>(SrcElTy)->getElementType()) ==
           TD->getTypeAllocSize(ResElTy)) {
         Value *Idx[2];
@@ -596,7 +596,7 @@ Instruction *InstCombiner::visitGetElementPtrInst(GetElementPtrInst &GEP) {
       //   (where tmp = 8*tmp2) into:
       // getelementptr [100 x double]* %arr, i32 0, i32 %tmp2; bitcast
       
-      if (TD && isa<ArrayType>(SrcElTy) && ResElTy->isInteger(8)) {
+      if (TD && SrcElTy->isArrayTy() && ResElTy->isIntegerTy(8)) {
         uint64_t ArrayEltSize =
             TD->getTypeAllocSize(cast<ArrayType>(SrcElTy)->getElementType());
         
diff --git a/libclamav/c++/llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp b/libclamav/c++/llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp
index 3214c8c..8662a82 100644
--- a/libclamav/c++/llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp
+++ b/libclamav/c++/llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp
@@ -84,7 +84,7 @@ void llvm::InsertProfilingInitCall(Function *MainFn, const char *FnName,
     AI = MainFn->arg_begin();
     // If the program looked at argc, have it look at the return value of the
     // init call instead.
-    if (!AI->getType()->isInteger(32)) {
+    if (!AI->getType()->isIntegerTy(32)) {
       Instruction::CastOps opcode;
       if (!AI->use_empty()) {
         opcode = CastInst::getCastOpcode(InitCall, true, AI->getType(), true);
diff --git a/libclamav/c++/llvm/lib/Transforms/Scalar/ABCD.cpp b/libclamav/c++/llvm/lib/Transforms/Scalar/ABCD.cpp
index cf5e8c0..ea8e5c3 100644
--- a/libclamav/c++/llvm/lib/Transforms/Scalar/ABCD.cpp
+++ b/libclamav/c++/llvm/lib/Transforms/Scalar/ABCD.cpp
@@ -505,7 +505,7 @@ void ABCD::executeABCD(Function &F) {
       continue;
 
     ICmpInst *ICI = dyn_cast<ICmpInst>(TI->getOperand(0));
-    if (!ICI || !isa<IntegerType>(ICI->getOperand(0)->getType()))
+    if (!ICI || !ICI->getOperand(0)->getType()->isIntegerTy())
       continue;
 
     createConstraintCmpInst(ICI, TI);
@@ -713,7 +713,7 @@ void ABCD::createConstraintCmpInst(ICmpInst *ICI, TerminatorInst *TI) {
   Value *V_op1 = ICI->getOperand(0);
   Value *V_op2 = ICI->getOperand(1);
 
-  if (!isa<IntegerType>(V_op1->getType()))
+  if (!V_op1->getType()->isIntegerTy())
     return;
 
   Instruction *I_op1 = dyn_cast<Instruction>(V_op1);
diff --git a/libclamav/c++/llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp b/libclamav/c++/llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp
index 21e6f89..7ceda1f 100644
--- a/libclamav/c++/llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp
+++ b/libclamav/c++/llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp
@@ -612,7 +612,7 @@ bool CodeGenPrepare::OptimizeMemoryInst(Instruction *MemoryInst, Value *Addr,
     // we'd end up sinking both muls.
     if (AddrMode.BaseReg) {
       Value *V = AddrMode.BaseReg;
-      if (isa<PointerType>(V->getType()))
+      if (V->getType()->isPointerTy())
         V = new PtrToIntInst(V, IntPtrTy, "sunkaddr", InsertPt);
       if (V->getType() != IntPtrTy)
         V = CastInst::CreateIntegerCast(V, IntPtrTy, /*isSigned=*/true,
@@ -625,7 +625,7 @@ bool CodeGenPrepare::OptimizeMemoryInst(Instruction *MemoryInst, Value *Addr,
       Value *V = AddrMode.ScaledReg;
       if (V->getType() == IntPtrTy) {
         // done.
-      } else if (isa<PointerType>(V->getType())) {
+      } else if (V->getType()->isPointerTy()) {
         V = new PtrToIntInst(V, IntPtrTy, "sunkaddr", InsertPt);
       } else if (cast<IntegerType>(IntPtrTy)->getBitWidth() <
                  cast<IntegerType>(V->getType())->getBitWidth()) {
diff --git a/libclamav/c++/llvm/lib/Transforms/Scalar/GVN.cpp b/libclamav/c++/llvm/lib/Transforms/Scalar/GVN.cpp
index 3ce7482..fcb802a 100644
--- a/libclamav/c++/llvm/lib/Transforms/Scalar/GVN.cpp
+++ b/libclamav/c++/llvm/lib/Transforms/Scalar/GVN.cpp
@@ -662,11 +662,10 @@ namespace {
     bool runOnFunction(Function &F);
   public:
     static char ID; // Pass identification, replacement for typeid
-    explicit GVN(bool nopre = false, bool noloads = false)
-      : FunctionPass(&ID), NoPRE(nopre), NoLoads(noloads), MD(0) { }
+    explicit GVN(bool noloads = false)
+      : FunctionPass(&ID), NoLoads(noloads), MD(0) { }
 
   private:
-    bool NoPRE;
     bool NoLoads;
     MemoryDependenceAnalysis *MD;
     DominatorTree *DT;
@@ -674,6 +673,9 @@ namespace {
     ValueTable VN;
     DenseMap<BasicBlock*, ValueNumberScope*> localAvail;
 
+    // List of critical edges to be split between iterations.
+    SmallVector<std::pair<TerminatorInst*, unsigned>, 4> toSplit;
+
     // This transformation requires dominator postdominator info
     virtual void getAnalysisUsage(AnalysisUsage &AU) const {
       AU.addRequired<DominatorTree>();
@@ -701,14 +703,15 @@ namespace {
     Value *lookupNumber(BasicBlock *BB, uint32_t num);
     void cleanupGlobalSets();
     void verifyRemoved(const Instruction *I) const;
+    bool splitCriticalEdges();
   };
 
   char GVN::ID = 0;
 }
 
 // createGVNPass - The public interface to this file...
-FunctionPass *llvm::createGVNPass(bool NoPRE, bool NoLoads) {
-  return new GVN(NoPRE, NoLoads);
+FunctionPass *llvm::createGVNPass(bool NoLoads) {
+  return new GVN(NoLoads);
 }
 
 static RegisterPass<GVN> X("gvn",
@@ -836,9 +839,9 @@ static bool CanCoerceMustAliasedValueToLoad(Value *StoredVal,
                                             const TargetData &TD) {
   // If the loaded or stored value is an first class array or struct, don't try
   // to transform them.  We need to be able to bitcast to integer.
-  if (isa<StructType>(LoadTy) || isa<ArrayType>(LoadTy) ||
-      isa<StructType>(StoredVal->getType()) ||
-      isa<ArrayType>(StoredVal->getType()))
+  if (LoadTy->isStructTy() || LoadTy->isArrayTy() ||
+      StoredVal->getType()->isStructTy() ||
+      StoredVal->getType()->isArrayTy())
     return false;
   
   // The store has to be at least as big as the load.
@@ -870,26 +873,26 @@ static Value *CoerceAvailableValueToLoadType(Value *StoredVal,
   
   // If the store and reload are the same size, we can always reuse it.
   if (StoreSize == LoadSize) {
-    if (isa<PointerType>(StoredValTy) && isa<PointerType>(LoadedTy)) {
+    if (StoredValTy->isPointerTy() && LoadedTy->isPointerTy()) {
       // Pointer to Pointer -> use bitcast.
       return new BitCastInst(StoredVal, LoadedTy, "", InsertPt);
     }
     
     // Convert source pointers to integers, which can be bitcast.
-    if (isa<PointerType>(StoredValTy)) {
+    if (StoredValTy->isPointerTy()) {
       StoredValTy = TD.getIntPtrType(StoredValTy->getContext());
       StoredVal = new PtrToIntInst(StoredVal, StoredValTy, "", InsertPt);
     }
     
     const Type *TypeToCastTo = LoadedTy;
-    if (isa<PointerType>(TypeToCastTo))
+    if (TypeToCastTo->isPointerTy())
       TypeToCastTo = TD.getIntPtrType(StoredValTy->getContext());
     
     if (StoredValTy != TypeToCastTo)
       StoredVal = new BitCastInst(StoredVal, TypeToCastTo, "", InsertPt);
     
     // Cast to pointer if the load needs a pointer type.
-    if (isa<PointerType>(LoadedTy))
+    if (LoadedTy->isPointerTy())
       StoredVal = new IntToPtrInst(StoredVal, LoadedTy, "", InsertPt);
     
     return StoredVal;
@@ -901,13 +904,13 @@ static Value *CoerceAvailableValueToLoadType(Value *StoredVal,
   assert(StoreSize >= LoadSize && "CanCoerceMustAliasedValueToLoad fail");
   
   // Convert source pointers to integers, which can be manipulated.
-  if (isa<PointerType>(StoredValTy)) {
+  if (StoredValTy->isPointerTy()) {
     StoredValTy = TD.getIntPtrType(StoredValTy->getContext());
     StoredVal = new PtrToIntInst(StoredVal, StoredValTy, "", InsertPt);
   }
   
   // Convert vectors and fp to integer, which can be manipulated.
-  if (!isa<IntegerType>(StoredValTy)) {
+  if (!StoredValTy->isIntegerTy()) {
     StoredValTy = IntegerType::get(StoredValTy->getContext(), StoreSize);
     StoredVal = new BitCastInst(StoredVal, StoredValTy, "", InsertPt);
   }
@@ -927,7 +930,7 @@ static Value *CoerceAvailableValueToLoadType(Value *StoredVal,
     return StoredVal;
   
   // If the result is a pointer, inttoptr.
-  if (isa<PointerType>(LoadedTy))
+  if (LoadedTy->isPointerTy())
     return new IntToPtrInst(StoredVal, LoadedTy, "inttoptr", InsertPt);
   
   // Otherwise, bitcast.
@@ -989,7 +992,7 @@ static int AnalyzeLoadFromClobberingWrite(const Type *LoadTy, Value *LoadPtr,
                                           const TargetData &TD) {
   // If the loaded or stored value is an first class array or struct, don't try
   // to transform them.  We need to be able to bitcast to integer.
-  if (isa<StructType>(LoadTy) || isa<ArrayType>(LoadTy))
+  if (LoadTy->isStructTy() || LoadTy->isArrayTy())
     return -1;
   
   int64_t StoreOffset = 0, LoadOffset = 0;
@@ -1064,8 +1067,8 @@ static int AnalyzeLoadFromClobberingStore(const Type *LoadTy, Value *LoadPtr,
                                           StoreInst *DepSI,
                                           const TargetData &TD) {
   // Cannot handle reading from store of first-class aggregate yet.
-  if (isa<StructType>(DepSI->getOperand(0)->getType()) ||
-      isa<ArrayType>(DepSI->getOperand(0)->getType()))
+  if (DepSI->getOperand(0)->getType()->isStructTy() ||
+      DepSI->getOperand(0)->getType()->isArrayTy())
     return -1;
 
   Value *StorePtr = DepSI->getPointerOperand();
@@ -1136,9 +1139,9 @@ static Value *GetStoreValueForLoad(Value *SrcVal, unsigned Offset,
   
   // Compute which bits of the stored value are being used by the load.  Convert
   // to an integer type to start with.
-  if (isa<PointerType>(SrcVal->getType()))
+  if (SrcVal->getType()->isPointerTy())
     SrcVal = Builder.CreatePtrToInt(SrcVal, TD.getIntPtrType(Ctx), "tmp");
-  if (!isa<IntegerType>(SrcVal->getType()))
+  if (!SrcVal->getType()->isIntegerTy())
     SrcVal = Builder.CreateBitCast(SrcVal, IntegerType::get(Ctx, StoreSize*8),
                                    "tmp");
   
@@ -1323,7 +1326,7 @@ static Value *ConstructSSAForLoadSet(LoadInst *LI,
   Value *V = SSAUpdate.GetValueInMiddleOfBlock(LI->getParent());
   
   // If new PHI nodes were created, notify alias analysis.
-  if (isa<PointerType>(V->getType()))
+  if (V->getType()->isPointerTy())
     for (unsigned i = 0, e = NewPHIs.size(); i != e; ++i)
       AA->copyValue(LI, NewPHIs[i]);
 
@@ -1491,8 +1494,9 @@ bool GVN::processNonLocalLoad(LoadInst *LI,
 
     if (isa<PHINode>(V))
       V->takeName(LI);
-    if (isa<PointerType>(V->getType()))
+    if (V->getType()->isPointerTy())
       MD->invalidateCachedPointerInfo(V);
+    VN.erase(LI);
     toErase.push_back(LI);
     NumGVNLoad++;
     return true;
@@ -1538,11 +1542,13 @@ bool GVN::processNonLocalLoad(LoadInst *LI,
   // at least one of the values is LI.  Since this means that we won't be able
   // to eliminate LI even if we insert uses in the other predecessors, we will
   // end up increasing code size.  Reject this by scanning for LI.
-  if (!EnableFullLoadPRE) {
-    for (unsigned i = 0, e = ValuesPerBlock.size(); i != e; ++i)
-      if (ValuesPerBlock[i].isSimpleValue() &&
-          ValuesPerBlock[i].getSimpleValue() == LI)
+  for (unsigned i = 0, e = ValuesPerBlock.size(); i != e; ++i) {
+    if (ValuesPerBlock[i].isSimpleValue() &&
+        ValuesPerBlock[i].getSimpleValue() == LI) {
+      // Skip cases where LI is the only definition, even for EnableFullLoadPRE.
+      if (!EnableFullLoadPRE || e == 1)
         return false;
+    }
   }
 
   // FIXME: It is extremely unclear what this loop is doing, other than
@@ -1576,6 +1582,7 @@ bool GVN::processNonLocalLoad(LoadInst *LI,
   for (unsigned i = 0, e = UnavailableBlocks.size(); i != e; ++i)
     FullyAvailableBlocks[UnavailableBlocks[i]] = false;
 
+  bool NeedToSplitEdges = false;
   for (pred_iterator PI = pred_begin(LoadBB), E = pred_end(LoadBB);
        PI != E; ++PI) {
     BasicBlock *Pred = *PI;
@@ -1583,13 +1590,20 @@ bool GVN::processNonLocalLoad(LoadInst *LI,
       continue;
     }
     PredLoads[Pred] = 0;
-    // We don't currently handle critical edges :(
+
     if (Pred->getTerminator()->getNumSuccessors() != 1) {
-      DEBUG(dbgs() << "COULD NOT PRE LOAD BECAUSE OF CRITICAL EDGE '"
-            << Pred->getName() << "': " << *LI << '\n');
-      return false;
+      if (isa<IndirectBrInst>(Pred->getTerminator())) {
+        DEBUG(dbgs() << "COULD NOT PRE LOAD BECAUSE OF INDBR CRITICAL EDGE '"
+              << Pred->getName() << "': " << *LI << '\n');
+        return false;
+      }
+      unsigned SuccNum = GetSuccessorNumber(Pred, LoadBB);
+      toSplit.push_back(std::make_pair(Pred->getTerminator(), SuccNum));
+      NeedToSplitEdges = true;
     }
   }
+  if (NeedToSplitEdges)
+    return false;
 
   // Decide whether PRE is profitable for this load.
   unsigned NumUnavailablePreds = PredLoads.size();
@@ -1623,13 +1637,8 @@ bool GVN::processNonLocalLoad(LoadInst *LI,
       LoadPtr = Address.PHITranslateWithInsertion(LoadBB, UnavailablePred,
                                                   *DT, NewInsts);
     } else {
-      Address.PHITranslateValue(LoadBB, UnavailablePred);
+      Address.PHITranslateValue(LoadBB, UnavailablePred, DT);
       LoadPtr = Address.getAddr();
-    
-      // Make sure the value is live in the predecessor.
-      if (Instruction *Inst = dyn_cast_or_null<Instruction>(LoadPtr))
-        if (!DT->dominates(Inst->getParent(), UnavailablePred))
-          LoadPtr = 0;
     }
 
     // If we couldn't find or insert a computation of this phi translated value,
@@ -1697,6 +1706,8 @@ bool GVN::processNonLocalLoad(LoadInst *LI,
     // Add the newly created load.
     ValuesPerBlock.push_back(AvailableValueInBlock::get(UnavailablePred,
                                                         NewLoad));
+    MD->invalidateCachedPointerInfo(LoadPtr);
+    DEBUG(dbgs() << "GVN INSERTED " << *NewLoad << '\n');
   }
 
   // Perform PHI construction.
@@ -1705,8 +1716,9 @@ bool GVN::processNonLocalLoad(LoadInst *LI,
   LI->replaceAllUsesWith(V);
   if (isa<PHINode>(V))
     V->takeName(LI);
-  if (isa<PointerType>(V->getType()))
+  if (V->getType()->isPointerTy())
     MD->invalidateCachedPointerInfo(V);
+  VN.erase(LI);
   toErase.push_back(LI);
   NumPRELoad++;
   return true;
@@ -1765,8 +1777,9 @@ bool GVN::processLoad(LoadInst *L, SmallVectorImpl<Instruction*> &toErase) {
       
       // Replace the load!
       L->replaceAllUsesWith(AvailVal);
-      if (isa<PointerType>(AvailVal->getType()))
+      if (AvailVal->getType()->isPointerTy())
         MD->invalidateCachedPointerInfo(AvailVal);
+      VN.erase(L);
       toErase.push_back(L);
       NumGVNLoad++;
       return true;
@@ -1810,8 +1823,9 @@ bool GVN::processLoad(LoadInst *L, SmallVectorImpl<Instruction*> &toErase) {
 
     // Remove it!
     L->replaceAllUsesWith(StoredVal);
-    if (isa<PointerType>(StoredVal->getType()))
+    if (StoredVal->getType()->isPointerTy())
       MD->invalidateCachedPointerInfo(StoredVal);
+    VN.erase(L);
     toErase.push_back(L);
     NumGVNLoad++;
     return true;
@@ -1839,8 +1853,9 @@ bool GVN::processLoad(LoadInst *L, SmallVectorImpl<Instruction*> &toErase) {
     
     // Remove it!
     L->replaceAllUsesWith(AvailableVal);
-    if (isa<PointerType>(DepLI->getType()))
+    if (DepLI->getType()->isPointerTy())
       MD->invalidateCachedPointerInfo(DepLI);
+    VN.erase(L);
     toErase.push_back(L);
     NumGVNLoad++;
     return true;
@@ -1851,6 +1866,7 @@ bool GVN::processLoad(LoadInst *L, SmallVectorImpl<Instruction*> &toErase) {
   // intervening stores, for example.
   if (isa<AllocaInst>(DepInst) || isMalloc(DepInst)) {
     L->replaceAllUsesWith(UndefValue::get(L->getType()));
+    VN.erase(L);
     toErase.push_back(L);
     NumGVNLoad++;
     return true;
@@ -1861,6 +1877,7 @@ bool GVN::processLoad(LoadInst *L, SmallVectorImpl<Instruction*> &toErase) {
   if (IntrinsicInst* II = dyn_cast<IntrinsicInst>(DepInst)) {
     if (II->getIntrinsicID() == Intrinsic::lifetime_start) {
       L->replaceAllUsesWith(UndefValue::get(L->getType()));
+      VN.erase(L);
       toErase.push_back(L);
       NumGVNLoad++;
       return true;
@@ -1943,7 +1960,7 @@ bool GVN::processInstruction(Instruction *I,
 
     if (constVal) {
       p->replaceAllUsesWith(constVal);
-      if (MD && isa<PointerType>(constVal->getType()))
+      if (MD && constVal->getType()->isPointerTy())
         MD->invalidateCachedPointerInfo(constVal);
       VN.erase(p);
 
@@ -1964,7 +1981,7 @@ bool GVN::processInstruction(Instruction *I,
     // Remove it!
     VN.erase(I);
     I->replaceAllUsesWith(repl);
-    if (MD && isa<PointerType>(repl->getType()))
+    if (MD && repl->getType()->isPointerTy())
       MD->invalidateCachedPointerInfo(repl);
     toErase.push_back(I);
     return true;
@@ -2004,6 +2021,8 @@ bool GVN::runOnFunction(Function& F) {
   while (ShouldContinue) {
     DEBUG(dbgs() << "GVN iteration: " << Iteration << "\n");
     ShouldContinue = iterateOnFunction(F);
+    if (splitCriticalEdges())
+      ShouldContinue = true;
     Changed |= ShouldContinue;
     ++Iteration;
   }
@@ -2070,7 +2089,6 @@ bool GVN::processBlock(BasicBlock *BB) {
 /// control flow patterns and attempts to perform simple PRE at the join point.
 bool GVN::performPRE(Function &F) {
   bool Changed = false;
-  SmallVector<std::pair<TerminatorInst*, unsigned>, 4> toSplit;
   DenseMap<BasicBlock*, Value*> predMap;
   for (df_iterator<BasicBlock*> DI = df_begin(&F.getEntryBlock()),
        DE = df_end(&F.getEntryBlock()); DI != DE; ++DI) {
@@ -2141,14 +2159,7 @@ bool GVN::performPRE(Function &F) {
       // We can't do PRE safely on a critical edge, so instead we schedule
       // the edge to be split and perform the PRE the next time we iterate
       // on the function.
-      unsigned SuccNum = 0;
-      for (unsigned i = 0, e = PREPred->getTerminator()->getNumSuccessors();
-           i != e; ++i)
-        if (PREPred->getTerminator()->getSuccessor(i) == CurrentBlock) {
-          SuccNum = i;
-          break;
-        }
-
+      unsigned SuccNum = GetSuccessorNumber(PREPred, CurrentBlock);
       if (isCriticalEdge(PREPred->getTerminator(), SuccNum)) {
         toSplit.push_back(std::make_pair(PREPred->getTerminator(), SuccNum));
         continue;
@@ -2204,7 +2215,7 @@ bool GVN::performPRE(Function &F) {
       localAvail[CurrentBlock]->table[ValNo] = Phi;
 
       CurInst->replaceAllUsesWith(Phi);
-      if (MD && isa<PointerType>(Phi->getType()))
+      if (MD && Phi->getType()->isPointerTy())
         MD->invalidateCachedPointerInfo(Phi);
       VN.erase(CurInst);
 
@@ -2216,11 +2227,23 @@ bool GVN::performPRE(Function &F) {
     }
   }
 
-  for (SmallVector<std::pair<TerminatorInst*, unsigned>, 4>::iterator
-       I = toSplit.begin(), E = toSplit.end(); I != E; ++I)
-    SplitCriticalEdge(I->first, I->second, this);
+  if (splitCriticalEdges())
+    Changed = true;
 
-  return Changed || toSplit.size();
+  return Changed;
+}
+
+/// splitCriticalEdges - Split critical edges found during the previous
+/// iteration that may enable further optimization.
+bool GVN::splitCriticalEdges() {
+  if (toSplit.empty())
+    return false;
+  do {
+    std::pair<TerminatorInst*, unsigned> Edge = toSplit.pop_back_val();
+    SplitCriticalEdge(Edge.first, Edge.second, this);
+  } while (!toSplit.empty());
+  if (MD) MD->invalidateCachedPredecessors();
+  return true;
 }
 
 /// iterateOnFunction - Executes one iteration of GVN
diff --git a/libclamav/c++/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp b/libclamav/c++/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
index 5302fdc..cb563c3 100644
--- a/libclamav/c++/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
+++ b/libclamav/c++/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
@@ -103,11 +103,9 @@ namespace {
                                    BasicBlock *ExitingBlock,
                                    BranchInst *BI,
                                    SCEVExpander &Rewriter);
-    void RewriteLoopExitValues(Loop *L, const SCEV *BackedgeTakenCount,
-                               SCEVExpander &Rewriter);
+    void RewriteLoopExitValues(Loop *L, SCEVExpander &Rewriter);
 
-    void RewriteIVExpressions(Loop *L, const Type *LargestType,
-                              SCEVExpander &Rewriter);
+    void RewriteIVExpressions(Loop *L, SCEVExpander &Rewriter);
 
     void SinkUnusedInvariants(Loop *L);
 
@@ -190,7 +188,7 @@ ICmpInst *IndVarSimplify::LinearFunctionTestReplace(Loop *L,
 
   ICmpInst *Cond = new ICmpInst(BI, Opcode, CmpIndVar, ExitCnt, "exitcond");
 
-  Instruction *OrigCond = cast<Instruction>(BI->getCondition());
+  Value *OrigCond = BI->getCondition();
   // It's tempting to use replaceAllUsesWith here to fully replace the old
   // comparison, but that's not immediately safe, since users of the old
   // comparison may not be dominated by the new comparison. Instead, just
@@ -215,7 +213,6 @@ ICmpInst *IndVarSimplify::LinearFunctionTestReplace(Loop *L,
 /// able to brute-force evaluate arbitrary instructions as long as they have
 /// constant operands at the beginning of the loop.
 void IndVarSimplify::RewriteLoopExitValues(Loop *L,
-                                           const SCEV *BackedgeTakenCount,
                                            SCEVExpander &Rewriter) {
   // Verify the input to the pass in already in LCSSA form.
   assert(L->isLCSSAForm());
@@ -241,15 +238,24 @@ void IndVarSimplify::RewriteLoopExitValues(Loop *L,
     while ((PN = dyn_cast<PHINode>(BBI++))) {
       if (PN->use_empty())
         continue; // dead use, don't replace it
+
+      // SCEV only supports integer expressions for now.
+      if (!PN->getType()->isIntegerTy() && !PN->getType()->isPointerTy())
+        continue;
+
+      // It's necessary to tell ScalarEvolution about this explicitly so that
+      // it can walk the def-use list and forget all SCEVs, as it may not be
+      // watching the PHI itself. Once the new exit value is in place, there
+      // may not be a def-use connection between the loop and every instruction
+      // which got a SCEVAddRecExpr for that loop.
+      SE->forgetValue(PN);
+
       // Iterate over all of the values in all the PHI nodes.
       for (unsigned i = 0; i != NumPreds; ++i) {
         // If the value being merged in is not integer or is not defined
         // in the loop, skip it.
         Value *InVal = PN->getIncomingValue(i);
-        if (!isa<Instruction>(InVal) ||
-            // SCEV only supports integer expressions for now.
-            (!isa<IntegerType>(InVal->getType()) &&
-             !isa<PointerType>(InVal->getType())))
+        if (!isa<Instruction>(InVal))
           continue;
 
         // If this pred is for a subloop, not L itself, skip it.
@@ -349,7 +355,7 @@ bool IndVarSimplify::runOnLoop(Loop *L, LPPassManager &LPM) {
   // the current expressions.
   //
   if (!isa<SCEVCouldNotCompute>(BackedgeTakenCount))
-    RewriteLoopExitValues(L, BackedgeTakenCount, Rewriter);
+    RewriteLoopExitValues(L, Rewriter);
 
   // Compute the type of the largest recurrence expression, and decide whether
   // a canonical induction variable should be inserted.
@@ -378,17 +384,18 @@ bool IndVarSimplify::runOnLoop(Loop *L, LPPassManager &LPM) {
   // in this loop, insert a canonical induction variable of the largest size.
   Value *IndVar = 0;
   if (NeedCannIV) {
-    // Check to see if the loop already has a canonical-looking induction
-    // variable. If one is present and it's wider than the planned canonical
-    // induction variable, temporarily remove it, so that the Rewriter
-    // doesn't attempt to reuse it.
-    PHINode *OldCannIV = L->getCanonicalInductionVariable();
-    if (OldCannIV) {
+    // Check to see if the loop already has any canonical-looking induction
+    // variables. If any are present and wider than the planned canonical
+    // induction variable, temporarily remove them, so that the Rewriter
+    // doesn't attempt to reuse them.
+    SmallVector<PHINode *, 2> OldCannIVs;
+    while (PHINode *OldCannIV = L->getCanonicalInductionVariable()) {
       if (SE->getTypeSizeInBits(OldCannIV->getType()) >
           SE->getTypeSizeInBits(LargestType))
         OldCannIV->removeFromParent();
       else
-        OldCannIV = 0;
+        break;
+      OldCannIVs.push_back(OldCannIV);
     }
 
     IndVar = Rewriter.getOrInsertCanonicalInductionVariable(L, LargestType);
@@ -398,17 +405,21 @@ bool IndVarSimplify::runOnLoop(Loop *L, LPPassManager &LPM) {
     DEBUG(dbgs() << "INDVARS: New CanIV: " << *IndVar << '\n');
 
     // Now that the official induction variable is established, reinsert
-    // the old canonical-looking variable after it so that the IR remains
-    // consistent. It will be deleted as part of the dead-PHI deletion at
+    // any old canonical-looking variables after it so that the IR remains
+    // consistent. They will be deleted as part of the dead-PHI deletion at
     // the end of the pass.
-    if (OldCannIV)
-      OldCannIV->insertAfter(cast<Instruction>(IndVar));
+    while (!OldCannIVs.empty()) {
+      PHINode *OldCannIV = OldCannIVs.pop_back_val();
+      OldCannIV->insertBefore(L->getHeader()->getFirstNonPHI());
+    }
   }
 
   // If we have a trip count expression, rewrite the loop's exit condition
   // using it.  We can currently only handle loops with a single exit.
   ICmpInst *NewICmp = 0;
-  if (!isa<SCEVCouldNotCompute>(BackedgeTakenCount) && ExitingBlock) {
+  if (!isa<SCEVCouldNotCompute>(BackedgeTakenCount) &&
+      !BackedgeTakenCount->isZero() &&
+      ExitingBlock) {
     assert(NeedCannIV &&
            "LinearFunctionTestReplace requires a canonical induction variable");
     // Can't rewrite non-branch yet.
@@ -418,7 +429,7 @@ bool IndVarSimplify::runOnLoop(Loop *L, LPPassManager &LPM) {
   }
 
   // Rewrite IV-derived expressions. Clears the rewriter cache.
-  RewriteIVExpressions(L, LargestType, Rewriter);
+  RewriteIVExpressions(L, Rewriter);
 
   // The Rewriter may not be used from this point on.
 
@@ -438,8 +449,7 @@ bool IndVarSimplify::runOnLoop(Loop *L, LPPassManager &LPM) {
   return Changed;
 }
 
-void IndVarSimplify::RewriteIVExpressions(Loop *L, const Type *LargestType,
-                                          SCEVExpander &Rewriter) {
+void IndVarSimplify::RewriteIVExpressions(Loop *L, SCEVExpander &Rewriter) {
   SmallVector<WeakVH, 16> DeadInsts;
 
   // Rewrite all induction variable expressions in terms of the canonical
@@ -584,8 +594,8 @@ void IndVarSimplify::SinkUnusedInvariants(Loop *L) {
   }
 }
 
-/// Return true if it is OK to use SIToFPInst for an inducation variable
-/// with given inital and exit values.
+/// Return true if it is OK to use SIToFPInst for an induction variable
+/// with given initial and exit values.
 static bool useSIToFPInst(ConstantFP &InitV, ConstantFP &ExitV,
                           uint64_t intIV, uint64_t intEV) {
 
@@ -638,7 +648,7 @@ void IndVarSimplify::HandleFloatingPointIV(Loop *L, PHINode *PH) {
   if (!convertToInt(InitValue->getValueAPF(), &newInitValue))
     return;
 
-  // Check IV increment. Reject this PH if increement operation is not
+  // Check IV increment. Reject this PH if increment operation is not
   // an add or increment value can not be represented by an integer.
   BinaryOperator *Incr =
     dyn_cast<BinaryOperator>(PH->getIncomingValue(BackEdge));
@@ -674,7 +684,7 @@ void IndVarSimplify::HandleFloatingPointIV(Loop *L, PHINode *PH) {
     if (BI->getCondition() != EC) return;
   }
 
-  // Find exit value. If exit value can not be represented as an interger then
+  // Find exit value. If exit value can not be represented as an integer then
   // do not handle this floating point PH.
   ConstantFP *EV = NULL;
   unsigned EVIndex = 1;
@@ -736,11 +746,11 @@ void IndVarSimplify::HandleFloatingPointIV(Loop *L, PHINode *PH) {
   ICmpInst *NewEC = new ICmpInst(EC->getParent()->getTerminator(),
                                  NewPred, LHS, RHS, EC->getName());
 
-  // In the following deltions, PH may become dead and may be deleted.
+  // In the following deletions, PH may become dead and may be deleted.
   // Use a WeakVH to observe whether this happens.
   WeakVH WeakPH = PH;
 
-  // Delete old, floating point, exit comparision instruction.
+  // Delete old, floating point, exit comparison instruction.
   NewEC->takeName(EC);
   EC->replaceAllUsesWith(NewEC);
   RecursivelyDeleteTriviallyDeadInstructions(EC);
diff --git a/libclamav/c++/llvm/lib/Transforms/Scalar/JumpThreading.cpp b/libclamav/c++/llvm/lib/Transforms/Scalar/JumpThreading.cpp
index 02346a1..a6489ec 100644
--- a/libclamav/c++/llvm/lib/Transforms/Scalar/JumpThreading.cpp
+++ b/libclamav/c++/llvm/lib/Transforms/Scalar/JumpThreading.cpp
@@ -201,7 +201,7 @@ static unsigned getJumpThreadDuplicationCost(const BasicBlock *BB) {
     if (isa<DbgInfoIntrinsic>(I)) continue;
     
     // If this is a pointer->pointer bitcast, it is free.
-    if (isa<BitCastInst>(I) && isa<PointerType>(I->getType()))
+    if (isa<BitCastInst>(I) && I->getType()->isPointerTy())
       continue;
     
     // All other instructions count for at least one unit.
@@ -214,7 +214,7 @@ static unsigned getJumpThreadDuplicationCost(const BasicBlock *BB) {
     if (const CallInst *CI = dyn_cast<CallInst>(I)) {
       if (!isa<IntrinsicInst>(CI))
         Size += 3;
-      else if (!isa<VectorType>(CI->getType()))
+      else if (!CI->getType()->isVectorTy())
         Size += 1;
     }
   }
@@ -405,7 +405,7 @@ ComputeValueKnownInPredecessors(Value *V, BasicBlock *BB,PredValueInfo &Result){
     // If comparing a live-in value against a constant, see if we know the
     // live-in value on any predecessors.
     if (LVI && isa<Constant>(Cmp->getOperand(1)) &&
-        Cmp->getType()->isInteger() && // Not vector compare.
+        Cmp->getType()->isIntegerTy() && // Not vector compare.
         (!isa<Instruction>(Cmp->getOperand(0)) ||
          cast<Instruction>(Cmp->getOperand(0))->getParent() != BB)) {
       Constant *RHSCst = cast<Constant>(Cmp->getOperand(1));
diff --git a/libclamav/c++/llvm/lib/Transforms/Scalar/LICM.cpp b/libclamav/c++/llvm/lib/Transforms/Scalar/LICM.cpp
index 81f9ae6..d7ace34 100644
--- a/libclamav/c++/llvm/lib/Transforms/Scalar/LICM.cpp
+++ b/libclamav/c++/llvm/lib/Transforms/Scalar/LICM.cpp
@@ -678,7 +678,7 @@ void LICM::PromoteValuesInLoop() {
     // If we are promoting a pointer value, update alias information for the
     // inserted load.
     Value *LoadValue = 0;
-    if (isa<PointerType>(cast<PointerType>(Ptr->getType())->getElementType())) {
+    if (cast<PointerType>(Ptr->getType())->getElementType()->isPointerTy()) {
       // Locate a load or store through the pointer, and assign the same value
       // to LI as we are loading or storing.  Since we know that the value is
       // stored in this loop, this will always succeed.
@@ -751,7 +751,7 @@ void LICM::PromoteValuesInLoop() {
       LoadInst *LI = new LoadInst(PromotedValues[i].first, "", InsertPos);
 
       // If this is a pointer type, update alias info appropriately.
-      if (isa<PointerType>(LI->getType()))
+      if (LI->getType()->isPointerTy())
         CurAST->copyValue(PointerValueNumbers[PVN++], LI);
 
       // Store into the memory we promoted.
diff --git a/libclamav/c++/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/libclamav/c++/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
index 3e03781..f920dca 100644
--- a/libclamav/c++/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
+++ b/libclamav/c++/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
@@ -198,7 +198,7 @@ struct Formula {
 
 }
 
-/// DoInitialMatch - Recurrsion helper for InitialMatch.
+/// DoInitialMatch - Recursion helper for InitialMatch.
 static void DoInitialMatch(const SCEV *S, Loop *L,
                            SmallVectorImpl<const SCEV *> &Good,
                            SmallVectorImpl<const SCEV *> &Bad,
@@ -337,14 +337,42 @@ void Formula::dump() const {
   print(errs()); errs() << '\n';
 }
 
-/// getSDiv - Return an expression for LHS /s RHS, if it can be determined,
-/// or null otherwise. If IgnoreSignificantBits is true, expressions like
-/// (X * Y) /s Y are simplified to Y, ignoring that the multiplication may
-/// overflow, which is useful when the result will be used in a context where
-/// the most significant bits are ignored.
-static const SCEV *getSDiv(const SCEV *LHS, const SCEV *RHS,
-                           ScalarEvolution &SE,
-                           bool IgnoreSignificantBits = false) {
+/// isAddRecSExtable - Return true if the given addrec can be sign-extended
+/// without changing its value.
+static bool isAddRecSExtable(const SCEVAddRecExpr *AR, ScalarEvolution &SE) {
+  const Type *WideTy =
+    IntegerType::get(SE.getContext(),
+                     SE.getTypeSizeInBits(AR->getType()) + 1);
+  return isa<SCEVAddRecExpr>(SE.getSignExtendExpr(AR, WideTy));
+}
+
+/// isAddSExtable - Return true if the given add can be sign-extended
+/// without changing its value.
+static bool isAddSExtable(const SCEVAddExpr *A, ScalarEvolution &SE) {
+  const Type *WideTy =
+    IntegerType::get(SE.getContext(),
+                     SE.getTypeSizeInBits(A->getType()) + 1);
+  return isa<SCEVAddExpr>(SE.getSignExtendExpr(A, WideTy));
+}
+
+/// isMulSExtable - Return true if the given add can be sign-extended
+/// without changing its value.
+static bool isMulSExtable(const SCEVMulExpr *A, ScalarEvolution &SE) {
+  const Type *WideTy =
+    IntegerType::get(SE.getContext(),
+                     SE.getTypeSizeInBits(A->getType()) + 1);
+  return isa<SCEVMulExpr>(SE.getSignExtendExpr(A, WideTy));
+}
+
+/// getExactSDiv - Return an expression for LHS /s RHS, if it can be determined
+/// and if the remainder is known to be zero,  or null otherwise. If
+/// IgnoreSignificantBits is true, expressions like (X * Y) /s Y are simplified
+/// to Y, ignoring that the multiplication may overflow, which is useful when
+/// the result will be used in a context where the most significant bits are
+/// ignored.
+static const SCEV *getExactSDiv(const SCEV *LHS, const SCEV *RHS,
+                                ScalarEvolution &SE,
+                                bool IgnoreSignificantBits = false) {
   // Handle the trivial case, which works for any SCEV type.
   if (LHS == RHS)
     return SE.getIntegerSCEV(1, LHS->getType());
@@ -365,39 +393,44 @@ static const SCEV *getSDiv(const SCEV *LHS, const SCEV *RHS,
                .sdiv(RC->getValue()->getValue()));
   }
 
-  // Distribute the sdiv over addrec operands.
+  // Distribute the sdiv over addrec operands, if the addrec doesn't overflow.
   if (const SCEVAddRecExpr *AR = dyn_cast<SCEVAddRecExpr>(LHS)) {
-    const SCEV *Start = getSDiv(AR->getStart(), RHS, SE,
-                                IgnoreSignificantBits);
-    if (!Start) return 0;
-    const SCEV *Step = getSDiv(AR->getStepRecurrence(SE), RHS, SE,
-                               IgnoreSignificantBits);
-    if (!Step) return 0;
-    return SE.getAddRecExpr(Start, Step, AR->getLoop());
+    if (IgnoreSignificantBits || isAddRecSExtable(AR, SE)) {
+      const SCEV *Start = getExactSDiv(AR->getStart(), RHS, SE,
+                                       IgnoreSignificantBits);
+      if (!Start) return 0;
+      const SCEV *Step = getExactSDiv(AR->getStepRecurrence(SE), RHS, SE,
+                                      IgnoreSignificantBits);
+      if (!Step) return 0;
+      return SE.getAddRecExpr(Start, Step, AR->getLoop());
+    }
   }
 
-  // Distribute the sdiv over add operands.
+  // Distribute the sdiv over add operands, if the add doesn't overflow.
   if (const SCEVAddExpr *Add = dyn_cast<SCEVAddExpr>(LHS)) {
-    SmallVector<const SCEV *, 8> Ops;
-    for (SCEVAddExpr::op_iterator I = Add->op_begin(), E = Add->op_end();
-         I != E; ++I) {
-      const SCEV *Op = getSDiv(*I, RHS, SE,
-                               IgnoreSignificantBits);
-      if (!Op) return 0;
-      Ops.push_back(Op);
+    if (IgnoreSignificantBits || isAddSExtable(Add, SE)) {
+      SmallVector<const SCEV *, 8> Ops;
+      for (SCEVAddExpr::op_iterator I = Add->op_begin(), E = Add->op_end();
+           I != E; ++I) {
+        const SCEV *Op = getExactSDiv(*I, RHS, SE,
+                                      IgnoreSignificantBits);
+        if (!Op) return 0;
+        Ops.push_back(Op);
+      }
+      return SE.getAddExpr(Ops);
     }
-    return SE.getAddExpr(Ops);
   }
 
   // Check for a multiply operand that we can pull RHS out of.
   if (const SCEVMulExpr *Mul = dyn_cast<SCEVMulExpr>(LHS))
-    if (IgnoreSignificantBits || Mul->hasNoSignedWrap()) {
+    if (IgnoreSignificantBits || isMulSExtable(Mul, SE)) {
       SmallVector<const SCEV *, 4> Ops;
       bool Found = false;
       for (SCEVMulExpr::op_iterator I = Mul->op_begin(), E = Mul->op_end();
            I != E; ++I) {
         if (!Found)
-          if (const SCEV *Q = getSDiv(*I, RHS, SE, IgnoreSignificantBits)) {
+          if (const SCEV *Q = getExactSDiv(*I, RHS, SE,
+                                           IgnoreSignificantBits)) {
             Ops.push_back(Q);
             Found = true;
             continue;
@@ -640,9 +673,9 @@ void Cost::RateRegister(const SCEV *Reg,
 /// RatePrimaryRegister - Record this register in the set. If we haven't seen it
 /// before, rate it.
 void Cost::RatePrimaryRegister(const SCEV *Reg,
-                         SmallPtrSet<const SCEV *, 16> &Regs,
-                         const Loop *L,
-                         ScalarEvolution &SE, DominatorTree &DT) {
+                               SmallPtrSet<const SCEV *, 16> &Regs,
+                               const Loop *L,
+                               ScalarEvolution &SE, DominatorTree &DT) {
   if (Regs.insert(Reg))
     RateRegister(Reg, Regs, L, SE, DT);
 }
@@ -879,7 +912,7 @@ public:
                                       MaxOffset(INT64_MIN),
                                       AllFixupsOutsideLoop(true) {}
 
-  bool InsertFormula(size_t LUIdx, const Formula &F);
+  bool InsertFormula(const Formula &F);
 
   void check() const;
 
@@ -889,7 +922,7 @@ public:
 
 /// InsertFormula - If the given formula has not yet been inserted, add it to
 /// the list, and return true. Return false otherwise.
-bool LSRUse::InsertFormula(size_t LUIdx, const Formula &F) {
+bool LSRUse::InsertFormula(const Formula &F) {
   SmallVector<const SCEV *, 2> Key = F.BaseRegs;
   if (F.ScaledReg) Key.push_back(F.ScaledReg);
   // Unstable sort by host order ok, because this is only used for uniquifying.
@@ -925,7 +958,7 @@ void LSRUse::print(raw_ostream &OS) const {
   case ICmpZero: OS << "ICmpZero"; break;
   case Address:
     OS << "Address of ";
-    if (isa<PointerType>(AccessTy))
+    if (AccessTy->isPointerTy())
       OS << "pointer"; // the full pointer type could be really verbose
     else
       OS << *AccessTy;
@@ -1024,8 +1057,7 @@ static bool isAlwaysFoldable(int64_t BaseOffs,
                              GlobalValue *BaseGV,
                              bool HasBaseReg,
                              LSRUse::KindType Kind, const Type *AccessTy,
-                             const TargetLowering *TLI,
-                             ScalarEvolution &SE) {
+                             const TargetLowering *TLI) {
   // Fast-path: zero is always foldable.
   if (BaseOffs == 0 && !BaseGV) return true;
 
@@ -1153,7 +1185,7 @@ class LSRInstance {
                                     const Type *AccessTy);
 
 public:
-  void InsertInitialFormula(const SCEV *S, Loop *L, LSRUse &LU, size_t LUIdx);
+  void InsertInitialFormula(const SCEV *S, LSRUse &LU, size_t LUIdx);
   void InsertSupplementalFormula(const SCEV *S, LSRUse &LU, size_t LUIdx);
   void CountRegisters(const Formula &F, size_t LUIdx);
   bool InsertFormula(LSRUse &LU, unsigned LUIdx, const Formula &F);
@@ -1184,16 +1216,18 @@ public:
 
   Value *Expand(const LSRFixup &LF,
                 const Formula &F,
-                BasicBlock::iterator IP, Loop *L, Instruction *IVIncInsertPos,
+                BasicBlock::iterator IP,
                 SCEVExpander &Rewriter,
-                SmallVectorImpl<WeakVH> &DeadInsts,
-                ScalarEvolution &SE, DominatorTree &DT) const;
+                SmallVectorImpl<WeakVH> &DeadInsts) const;
+  void RewriteForPHI(PHINode *PN, const LSRFixup &LF,
+                     const Formula &F,
+                     SCEVExpander &Rewriter,
+                     SmallVectorImpl<WeakVH> &DeadInsts,
+                     Pass *P) const;
   void Rewrite(const LSRFixup &LF,
                const Formula &F,
-               Loop *L, Instruction *IVIncInsertPos,
                SCEVExpander &Rewriter,
                SmallVectorImpl<WeakVH> &DeadInsts,
-               ScalarEvolution &SE, DominatorTree &DT,
                Pass *P) const;
   void ImplementSolution(const SmallVectorImpl<const Formula *> &Solution,
                          Pass *P);
@@ -1212,7 +1246,7 @@ public:
 }
 
 /// OptimizeShadowIV - If IV is used in a int-to-float cast
-/// inside the loop then try to eliminate the cast opeation.
+/// inside the loop then try to eliminate the cast operation.
 void LSRInstance::OptimizeShadowIV() {
   const SCEV *BackedgeTakenCount = SE.getBackedgeTakenCount(L);
   if (isa<SCEVCouldNotCompute>(BackedgeTakenCount))
@@ -1522,7 +1556,7 @@ LSRInstance::OptimizeLoopTermCond() {
               A = SE.getSignExtendExpr(A, B->getType());
           }
           if (const SCEVConstant *D =
-                dyn_cast_or_null<SCEVConstant>(getSDiv(B, A, SE))) {
+                dyn_cast_or_null<SCEVConstant>(getExactSDiv(B, A, SE))) {
             // Stride of one or negative one can have reuse with non-addresses.
             if (D->getValue()->isOne() ||
                 D->getValue()->isAllOnesValue())
@@ -1615,12 +1649,12 @@ LSRInstance::reconcileNewOffset(LSRUse &LU, int64_t NewOffset,
   // Conservatively assume HasBaseReg is true for now.
   if (NewOffset < LU.MinOffset) {
     if (!isAlwaysFoldable(LU.MaxOffset - NewOffset, 0, /*HasBaseReg=*/true,
-                          Kind, AccessTy, TLI, SE))
+                          Kind, AccessTy, TLI))
       return false;
     NewMinOffset = NewOffset;
   } else if (NewOffset > LU.MaxOffset) {
     if (!isAlwaysFoldable(NewOffset - LU.MinOffset, 0, /*HasBaseReg=*/true,
-                          Kind, AccessTy, TLI, SE))
+                          Kind, AccessTy, TLI))
       return false;
     NewMaxOffset = NewOffset;
   }
@@ -1639,7 +1673,7 @@ LSRInstance::reconcileNewOffset(LSRUse &LU, int64_t NewOffset,
 
 /// getUse - Return an LSRUse index and an offset value for a fixup which
 /// needs the given expression, with the given kind and optional access type.
-/// Either reuse an exisitng use or create a new one, as needed.
+/// Either reuse an existing use or create a new one, as needed.
 std::pair<size_t, int64_t>
 LSRInstance::getUse(const SCEV *&Expr,
                     LSRUse::KindType Kind, const Type *AccessTy) {
@@ -1647,8 +1681,7 @@ LSRInstance::getUse(const SCEV *&Expr,
   int64_t Offset = ExtractImmediate(Expr, SE);
 
   // Basic uses can't accept any offset, for example.
-  if (!isAlwaysFoldable(Offset, 0, /*HasBaseReg=*/true,
-                        Kind, AccessTy, TLI, SE)) {
+  if (!isAlwaysFoldable(Offset, 0, /*HasBaseReg=*/true, Kind, AccessTy, TLI)) {
     Expr = Copy;
     Offset = 0;
   }
@@ -1683,21 +1716,29 @@ LSRInstance::getUse(const SCEV *&Expr,
 void LSRInstance::CollectInterestingTypesAndFactors() {
   SmallSetVector<const SCEV *, 4> Strides;
 
-  // Collect interesting types and factors.
+  // Collect interesting types and strides.
   for (IVUsers::const_iterator UI = IU.begin(), E = IU.end(); UI != E; ++UI) {
     const SCEV *Stride = UI->getStride();
 
     // Collect interesting types.
     Types.insert(SE.getEffectiveSCEVType(Stride->getType()));
 
-    // Collect interesting factors.
+    // Add the stride for this loop.
+    Strides.insert(Stride);
+
+    // Add strides for other mentioned loops.
+    for (const SCEVAddRecExpr *AR = dyn_cast<SCEVAddRecExpr>(UI->getOffset());
+         AR; AR = dyn_cast<SCEVAddRecExpr>(AR->getStart()))
+      Strides.insert(AR->getStepRecurrence(SE));
+  }
+
+  // Compute interesting factors from the set of interesting strides.
+  for (SmallSetVector<const SCEV *, 4>::const_iterator
+       I = Strides.begin(), E = Strides.end(); I != E; ++I)
     for (SmallSetVector<const SCEV *, 4>::const_iterator NewStrideIter =
-         Strides.begin(), SEnd = Strides.end(); NewStrideIter != SEnd;
-         ++NewStrideIter) {
-      const SCEV *OldStride = Stride;
+         next(I); NewStrideIter != E; ++NewStrideIter) {
+      const SCEV *OldStride = *I;
       const SCEV *NewStride = *NewStrideIter;
-      if (OldStride == NewStride)
-        continue;
 
       if (SE.getTypeSizeInBits(OldStride->getType()) !=
           SE.getTypeSizeInBits(NewStride->getType())) {
@@ -1708,19 +1749,18 @@ void LSRInstance::CollectInterestingTypesAndFactors() {
           OldStride = SE.getSignExtendExpr(OldStride, NewStride->getType());
       }
       if (const SCEVConstant *Factor =
-            dyn_cast_or_null<SCEVConstant>(getSDiv(NewStride, OldStride,
-                                                   SE, true))) {
+            dyn_cast_or_null<SCEVConstant>(getExactSDiv(NewStride, OldStride,
+                                                        SE, true))) {
         if (Factor->getValue()->getValue().getMinSignedBits() <= 64)
           Factors.insert(Factor->getValue()->getValue().getSExtValue());
       } else if (const SCEVConstant *Factor =
-                   dyn_cast_or_null<SCEVConstant>(getSDiv(OldStride, NewStride,
-                                                          SE, true))) {
+                   dyn_cast_or_null<SCEVConstant>(getExactSDiv(OldStride,
+                                                               NewStride,
+                                                               SE, true))) {
         if (Factor->getValue()->getValue().getMinSignedBits() <= 64)
           Factors.insert(Factor->getValue()->getValue().getSExtValue());
       }
     }
-    Strides.insert(Stride);
-  }
 
   // If all uses use the same type, don't bother looking for truncation-based
   // reuse.
@@ -1788,7 +1828,7 @@ void LSRInstance::CollectFixupsAndInitialFormulae() {
 
     // If this is the first use of this LSRUse, give it a formula.
     if (LU.Formulae.empty()) {
-      InsertInitialFormula(S, L, LU, LF.LUIdx);
+      InsertInitialFormula(S, LU, LF.LUIdx);
       CountRegisters(LU.Formulae.back(), LF.LUIdx);
     }
   }
@@ -1797,8 +1837,7 @@ void LSRInstance::CollectFixupsAndInitialFormulae() {
 }
 
 void
-LSRInstance::InsertInitialFormula(const SCEV *S, Loop *L,
-                                  LSRUse &LU, size_t LUIdx) {
+LSRInstance::InsertInitialFormula(const SCEV *S, LSRUse &LU, size_t LUIdx) {
   Formula F;
   F.InitialMatch(S, L, SE, DT);
   bool Inserted = InsertFormula(LU, LUIdx, F);
@@ -1828,7 +1867,7 @@ void LSRInstance::CountRegisters(const Formula &F, size_t LUIdx) {
 /// InsertFormula - If the given formula has not yet been inserted, add it to
 /// the list, and return true. Return false otherwise.
 bool LSRInstance::InsertFormula(LSRUse &LU, unsigned LUIdx, const Formula &F) {
-  if (!LU.InsertFormula(LUIdx, F))
+  if (!LU.InsertFormula(F))
     return false;
 
   CountRegisters(F, LUIdx);
@@ -1996,7 +2035,7 @@ void LSRInstance::GenerateReassociations(LSRUse &LU, unsigned LUIdx,
 /// loop-dominating registers added into a single register.
 void LSRInstance::GenerateCombinations(LSRUse &LU, unsigned LUIdx,
                                        Formula Base) {
-  // This method is only intersting on a plurality of registers.
+  // This method is only interesting on a plurality of registers.
   if (Base.BaseRegs.size() <= 1) return;
 
   Formula F = Base;
@@ -2015,7 +2054,7 @@ void LSRInstance::GenerateCombinations(LSRUse &LU, unsigned LUIdx,
     const SCEV *Sum = SE.getAddExpr(Ops);
     // TODO: If Sum is zero, it probably means ScalarEvolution missed an
     // opportunity to fold something. For now, just ignore such cases
-    // rather than procede with zero in a register.
+    // rather than proceed with zero in a register.
     if (!Sum->isZero()) {
       F.BaseRegs.push_back(Sum);
       (void)InsertFormula(LU, LUIdx, F);
@@ -2105,14 +2144,18 @@ void LSRInstance::GenerateICmpZeroScales(LSRUse &LU, unsigned LUIdx,
     Formula F = Base;
 
     // Check that the multiplication doesn't overflow.
+    if (F.AM.BaseOffs == INT64_MIN && Factor == -1)
+      continue;
     F.AM.BaseOffs = (uint64_t)Base.AM.BaseOffs * Factor;
-    if ((int64_t)F.AM.BaseOffs / Factor != Base.AM.BaseOffs)
+    if (F.AM.BaseOffs / Factor != Base.AM.BaseOffs)
       continue;
 
     // Check that multiplying with the use offset doesn't overflow.
     int64_t Offset = LU.MinOffset;
+    if (Offset == INT64_MIN && Factor == -1)
+      continue;
     Offset = (uint64_t)Offset * Factor;
-    if ((int64_t)Offset / Factor != LU.MinOffset)
+    if (Offset / Factor != LU.MinOffset)
       continue;
 
     // Check that this scale is legal.
@@ -2127,14 +2170,14 @@ void LSRInstance::GenerateICmpZeroScales(LSRUse &LU, unsigned LUIdx,
     // Check that multiplying with each base register doesn't overflow.
     for (size_t i = 0, e = F.BaseRegs.size(); i != e; ++i) {
       F.BaseRegs[i] = SE.getMulExpr(F.BaseRegs[i], FactorS);
-      if (getSDiv(F.BaseRegs[i], FactorS, SE) != Base.BaseRegs[i])
+      if (getExactSDiv(F.BaseRegs[i], FactorS, SE) != Base.BaseRegs[i])
         goto next;
     }
 
     // Check that multiplying with the scaled register doesn't overflow.
     if (F.ScaledReg) {
       F.ScaledReg = SE.getMulExpr(F.ScaledReg, FactorS);
-      if (getSDiv(F.ScaledReg, FactorS, SE) != Base.ScaledReg)
+      if (getExactSDiv(F.ScaledReg, FactorS, SE) != Base.ScaledReg)
         continue;
     }
 
@@ -2189,7 +2232,7 @@ void LSRInstance::GenerateScales(LSRUse &LU, unsigned LUIdx,
           continue;
         // Divide out the factor, ignoring high bits, since we'll be
         // scaling the value back up in the end.
-        if (const SCEV *Quotient = getSDiv(AR, FactorS, SE, true)) {
+        if (const SCEV *Quotient = getExactSDiv(AR, FactorS, SE, true)) {
           // TODO: This could be optimized to avoid all the copying.
           Formula F = Base;
           F.ScaledReg = Quotient;
@@ -2358,7 +2401,7 @@ void LSRInstance::GenerateCrossUseConstantOffsets() {
     const SCEV *NegImmS = SE.getSCEV(ConstantInt::get(IntTy, -(uint64_t)Imm));
     unsigned BitWidth = SE.getTypeSizeInBits(IntTy);
 
-    // TODO: Use a more targetted data structure.
+    // TODO: Use a more targeted data structure.
     for (size_t L = 0, LE = LU.Formulae.size(); L != LE; ++L) {
       Formula F = LU.Formulae[L];
       // Use the immediate in the scaled register.
@@ -2427,7 +2470,7 @@ void LSRInstance::GenerateCrossUseConstantOffsets() {
 /// GenerateAllReuseFormulae - Generate formulae for each use.
 void
 LSRInstance::GenerateAllReuseFormulae() {
-  // This is split into two loops so that hasRegsUsedByUsesOtherThan
+  // This is split into multiple loops so that hasRegsUsedByUsesOtherThan
   // queries are more precise.
   for (size_t LUIdx = 0, NumUses = Uses.size(); LUIdx != NumUses; ++LUIdx) {
     LSRUse &LU = Uses[LUIdx];
@@ -2446,6 +2489,9 @@ LSRInstance::GenerateAllReuseFormulae() {
       GenerateICmpZeroScales(LU, LUIdx, LU.Formulae[i]);
     for (size_t i = 0, f = LU.Formulae.size(); i != f; ++i)
       GenerateScales(LU, LUIdx, LU.Formulae[i]);
+  }
+  for (size_t LUIdx = 0, NumUses = Uses.size(); LUIdx != NumUses; ++LUIdx) {
+    LSRUse &LU = Uses[LUIdx];
     for (size_t i = 0, f = LU.Formulae.size(); i != f; ++i)
       GenerateTruncates(LU, LUIdx, LU.Formulae[i]);
   }
@@ -2523,9 +2569,9 @@ void LSRInstance::FilterOutUndesirableDedicatedRegisters() {
         });
 }
 
-/// NarrowSearchSpaceUsingHeuristics - If there are an extrordinary number of
+/// NarrowSearchSpaceUsingHeuristics - If there are an extraordinary number of
 /// formulae to choose from, use some rough heuristics to prune down the number
-/// of formulae. This keeps the main solver from taking an extrordinary amount
+/// of formulae. This keeps the main solver from taking an extraordinary amount
 /// of time in some worst-case scenarios.
 void LSRInstance::NarrowSearchSpaceUsingHeuristics() {
   // This is a rough guess that seems to work fairly well.
@@ -2575,7 +2621,7 @@ void LSRInstance::NarrowSearchSpaceUsingHeuristics() {
     }
 
     DEBUG(dbgs() << "Narrowing the search space by assuming " << *Best
-                 << " will yeild profitable reuse.\n");
+                 << " will yield profitable reuse.\n");
     Taken.insert(Best);
 
     // In any use with formulae which references this register, delete formulae
@@ -2622,7 +2668,7 @@ void LSRInstance::SolveRecurse(SmallVectorImpl<const Formula *> &Solution,
   //    - sort the formula so that the most profitable solutions are found first
   //    - sort the uses too
   //  - search faster:
-  //    - dont compute a cost, and then compare. compare while computing a cost
+  //    - don't compute a cost, and then compare. compare while computing a cost
   //      and bail early.
   //    - track register sets with SmallBitVector
 
@@ -2733,10 +2779,8 @@ static BasicBlock *getImmediateDominator(BasicBlock *BB, DominatorTree &DT) {
 Value *LSRInstance::Expand(const LSRFixup &LF,
                            const Formula &F,
                            BasicBlock::iterator IP,
-                           Loop *L, Instruction *IVIncInsertPos,
                            SCEVExpander &Rewriter,
-                           SmallVectorImpl<WeakVH> &DeadInsts,
-                           ScalarEvolution &SE, DominatorTree &DT) const {
+                           SmallVectorImpl<WeakVH> &DeadInsts) const {
   const LSRUse &LU = Uses[LF.LUIdx];
 
   // Then, collect some instructions which we will remain dominated by when
@@ -2749,8 +2793,12 @@ Value *LSRInstance::Expand(const LSRFixup &LF,
     if (Instruction *I =
           dyn_cast<Instruction>(cast<ICmpInst>(LF.UserInst)->getOperand(1)))
       Inputs.push_back(I);
-  if (LF.PostIncLoop && !L->contains(LF.UserInst))
-    Inputs.push_back(L->getLoopLatch()->getTerminator());
+  if (LF.PostIncLoop) {
+    if (!L->contains(LF.UserInst))
+      Inputs.push_back(L->getLoopLatch()->getTerminator());
+    else
+      Inputs.push_back(IVIncInsertPos);
+  }
 
   // Then, climb up the immediate dominator tree as far as we can go while
   // still being dominated by the input positions.
@@ -2813,8 +2861,10 @@ Value *LSRInstance::Expand(const LSRFixup &LF,
       if (AR->getLoop() == LF.PostIncLoop) {
         Reg = SE.getAddExpr(Reg, AR->getStepRecurrence(SE));
         // If the user is inside the loop, insert the code after the increment
-        // so that it is dominated by its operand.
-        if (L->contains(LF.UserInst))
+        // so that it is dominated by its operand. If the original insert point
+        // was already dominated by the increment, keep it, because there may
+        // be loop-variant operands that need to be respected also.
+        if (L->contains(LF.UserInst) && !DT.dominates(IVIncInsertPos, IP))
           IP = IVIncInsertPos;
         break;
       }
@@ -2824,6 +2874,13 @@ Value *LSRInstance::Expand(const LSRFixup &LF,
     Ops.push_back(SE.getUnknown(Rewriter.expandCodeFor(Reg, 0, IP)));
   }
 
+  // Flush the operand list to suppress SCEVExpander hoisting.
+  if (!Ops.empty()) {
+    Value *FullV = Rewriter.expandCodeFor(SE.getAddExpr(Ops), Ty, IP);
+    Ops.clear();
+    Ops.push_back(SE.getUnknown(FullV));
+  }
+
   // Expand the ScaledReg portion.
   Value *ICmpScaledV = 0;
   if (F.AM.Scale != 0) {
@@ -2850,12 +2907,25 @@ Value *LSRInstance::Expand(const LSRFixup &LF,
                               SE.getIntegerSCEV(F.AM.Scale,
                                                 ScaledS->getType()));
       Ops.push_back(ScaledS);
+
+      // Flush the operand list to suppress SCEVExpander hoisting.
+      Value *FullV = Rewriter.expandCodeFor(SE.getAddExpr(Ops), Ty, IP);
+      Ops.clear();
+      Ops.push_back(SE.getUnknown(FullV));
     }
   }
 
-  // Expand the immediate portions.
-  if (F.AM.BaseGV)
-    Ops.push_back(SE.getSCEV(F.AM.BaseGV));
+  // Expand the GV portion.
+  if (F.AM.BaseGV) {
+    Ops.push_back(SE.getUnknown(F.AM.BaseGV));
+
+    // Flush the operand list to suppress SCEVExpander hoisting.
+    Value *FullV = Rewriter.expandCodeFor(SE.getAddExpr(Ops), Ty, IP);
+    Ops.clear();
+    Ops.push_back(SE.getUnknown(FullV));
+  }
+
+  // Expand the immediate portion.
   int64_t Offset = (uint64_t)F.AM.BaseOffs + LF.Offset;
   if (Offset != 0) {
     if (LU.Kind == LSRUse::ICmpZero) {
@@ -2870,7 +2940,7 @@ Value *LSRInstance::Expand(const LSRFixup &LF,
     } else {
       // Just add the immediate values. These again are expected to be matched
       // as part of the address.
-      Ops.push_back(SE.getIntegerSCEV(Offset, IntTy));
+      Ops.push_back(SE.getUnknown(ConstantInt::getSigned(IntTy, Offset)));
     }
   }
 
@@ -2918,73 +2988,81 @@ Value *LSRInstance::Expand(const LSRFixup &LF,
   return FullV;
 }
 
+/// RewriteForPHI - Helper for Rewrite. PHI nodes are special because the use
+/// of their operands effectively happens in their predecessor blocks, so the
+/// expression may need to be expanded in multiple places.
+void LSRInstance::RewriteForPHI(PHINode *PN,
+                                const LSRFixup &LF,
+                                const Formula &F,
+                                SCEVExpander &Rewriter,
+                                SmallVectorImpl<WeakVH> &DeadInsts,
+                                Pass *P) const {
+  DenseMap<BasicBlock *, Value *> Inserted;
+  for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i)
+    if (PN->getIncomingValue(i) == LF.OperandValToReplace) {
+      BasicBlock *BB = PN->getIncomingBlock(i);
+
+      // If this is a critical edge, split the edge so that we do not insert
+      // the code on all predecessor/successor paths.  We do this unless this
+      // is the canonical backedge for this loop, which complicates post-inc
+      // users.
+      if (e != 1 && BB->getTerminator()->getNumSuccessors() > 1 &&
+          !isa<IndirectBrInst>(BB->getTerminator()) &&
+          (PN->getParent() != L->getHeader() || !L->contains(BB))) {
+        // Split the critical edge.
+        BasicBlock *NewBB = SplitCriticalEdge(BB, PN->getParent(), P);
+
+        // If PN is outside of the loop and BB is in the loop, we want to
+        // move the block to be immediately before the PHI block, not
+        // immediately after BB.
+        if (L->contains(BB) && !L->contains(PN))
+          NewBB->moveBefore(PN->getParent());
+
+        // Splitting the edge can reduce the number of PHI entries we have.
+        e = PN->getNumIncomingValues();
+        BB = NewBB;
+        i = PN->getBasicBlockIndex(BB);
+      }
+
+      std::pair<DenseMap<BasicBlock *, Value *>::iterator, bool> Pair =
+        Inserted.insert(std::make_pair(BB, static_cast<Value *>(0)));
+      if (!Pair.second)
+        PN->setIncomingValue(i, Pair.first->second);
+      else {
+        Value *FullV = Expand(LF, F, BB->getTerminator(), Rewriter, DeadInsts);
+
+        // If this is reuse-by-noop-cast, insert the noop cast.
+        const Type *OpTy = LF.OperandValToReplace->getType();
+        if (FullV->getType() != OpTy)
+          FullV =
+            CastInst::Create(CastInst::getCastOpcode(FullV, false,
+                                                     OpTy, false),
+                             FullV, LF.OperandValToReplace->getType(),
+                             "tmp", BB->getTerminator());
+
+        PN->setIncomingValue(i, FullV);
+        Pair.first->second = FullV;
+      }
+    }
+}
+
 /// Rewrite - Emit instructions for the leading candidate expression for this
 /// LSRUse (this is called "expanding"), and update the UserInst to reference
 /// the newly expanded value.
 void LSRInstance::Rewrite(const LSRFixup &LF,
                           const Formula &F,
-                          Loop *L, Instruction *IVIncInsertPos,
                           SCEVExpander &Rewriter,
                           SmallVectorImpl<WeakVH> &DeadInsts,
-                          ScalarEvolution &SE, DominatorTree &DT,
                           Pass *P) const {
-  const Type *OpTy = LF.OperandValToReplace->getType();
-
   // First, find an insertion point that dominates UserInst. For PHI nodes,
   // find the nearest block which dominates all the relevant uses.
   if (PHINode *PN = dyn_cast<PHINode>(LF.UserInst)) {
-    DenseMap<BasicBlock *, Value *> Inserted;
-    for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i)
-      if (PN->getIncomingValue(i) == LF.OperandValToReplace) {
-        BasicBlock *BB = PN->getIncomingBlock(i);
-
-        // If this is a critical edge, split the edge so that we do not insert
-        // the code on all predecessor/successor paths.  We do this unless this
-        // is the canonical backedge for this loop, which complicates post-inc
-        // users.
-        if (e != 1 && BB->getTerminator()->getNumSuccessors() > 1 &&
-            !isa<IndirectBrInst>(BB->getTerminator()) &&
-            (PN->getParent() != L->getHeader() || !L->contains(BB))) {
-          // Split the critical edge.
-          BasicBlock *NewBB = SplitCriticalEdge(BB, PN->getParent(), P);
-
-          // If PN is outside of the loop and BB is in the loop, we want to
-          // move the block to be immediately before the PHI block, not
-          // immediately after BB.
-          if (L->contains(BB) && !L->contains(PN))
-            NewBB->moveBefore(PN->getParent());
-
-          // Splitting the edge can reduce the number of PHI entries we have.
-          e = PN->getNumIncomingValues();
-          BB = NewBB;
-          i = PN->getBasicBlockIndex(BB);
-        }
-
-        std::pair<DenseMap<BasicBlock *, Value *>::iterator, bool> Pair =
-          Inserted.insert(std::make_pair(BB, static_cast<Value *>(0)));
-        if (!Pair.second)
-          PN->setIncomingValue(i, Pair.first->second);
-        else {
-          Value *FullV = Expand(LF, F, BB->getTerminator(), L, IVIncInsertPos,
-                                Rewriter, DeadInsts, SE, DT);
-
-          // If this is reuse-by-noop-cast, insert the noop cast.
-          if (FullV->getType() != OpTy)
-            FullV =
-              CastInst::Create(CastInst::getCastOpcode(FullV, false,
-                                                       OpTy, false),
-                               FullV, LF.OperandValToReplace->getType(),
-                               "tmp", BB->getTerminator());
-
-          PN->setIncomingValue(i, FullV);
-          Pair.first->second = FullV;
-        }
-      }
+    RewriteForPHI(PN, LF, F, Rewriter, DeadInsts, P);
   } else {
-    Value *FullV = Expand(LF, F, LF.UserInst, L, IVIncInsertPos,
-                          Rewriter, DeadInsts, SE, DT);
+    Value *FullV = Expand(LF, F, LF.UserInst, Rewriter, DeadInsts);
 
     // If this is reuse-by-noop-cast, insert the noop cast.
+    const Type *OpTy = LF.OperandValToReplace->getType();
     if (FullV->getType() != OpTy) {
       Instruction *Cast =
         CastInst::Create(CastInst::getCastOpcode(FullV, false, OpTy, false),
@@ -3021,8 +3099,7 @@ LSRInstance::ImplementSolution(const SmallVectorImpl<const Formula *> &Solution,
   for (size_t i = 0, e = Fixups.size(); i != e; ++i) {
     size_t LUIdx = Fixups[i].LUIdx;
 
-    Rewrite(Fixups[i], *Solution[LUIdx], L, IVIncInsertPos, Rewriter,
-            DeadInsts, SE, DT, P);
+    Rewrite(Fixups[i], *Solution[LUIdx], Rewriter, DeadInsts, P);
 
     Changed = true;
   }
@@ -3051,7 +3128,7 @@ LSRInstance::LSRInstance(const TargetLowering *tli, Loop *l, Pass *P)
         dbgs() << ":\n");
 
   /// OptimizeShadowIV - If IV is used in a int-to-float cast
-  /// inside the loop then try to eliminate the cast opeation.
+  /// inside the loop then try to eliminate the cast operation.
   OptimizeShadowIV();
 
   // Change loop terminating condition to use the postinc iv when possible.
diff --git a/libclamav/c++/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp b/libclamav/c++/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp
index e5fba28..071e9b7 100644
--- a/libclamav/c++/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp
+++ b/libclamav/c++/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp
@@ -170,7 +170,7 @@ Pass *llvm::createLoopUnswitchPass(bool Os) {
 /// Otherwise, return null.
 static Value *FindLIVLoopCondition(Value *Cond, Loop *L, bool &Changed) {
   // We can never unswitch on vector conditions.
-  if (isa<VectorType>(Cond->getType()))
+  if (Cond->getType()->isVectorTy())
     return 0;
 
   // Constants should be folded, not unswitched on!
@@ -871,7 +871,7 @@ void LoopUnswitch::RewriteLoopBodyWithConditionConstant(Loop *L, Value *LIC,
   // If we know that LIC == Val, or that LIC == NotVal, just replace uses of LIC
   // in the loop with the appropriate one directly.
   if (IsEqual || (isa<ConstantInt>(Val) &&
-      Val->getType()->isInteger(1))) {
+      Val->getType()->isIntegerTy(1))) {
     Value *Replacement;
     if (IsEqual)
       Replacement = Val;
@@ -997,10 +997,10 @@ void LoopUnswitch::SimplifyCode(std::vector<Instruction*> &Worklist, Loop *L) {
     case Instruction::And:
       if (isa<ConstantInt>(I->getOperand(0)) && 
           // constant -> RHS
-          I->getOperand(0)->getType()->isInteger(1))
+          I->getOperand(0)->getType()->isIntegerTy(1))
         cast<BinaryOperator>(I)->swapOperands();
       if (ConstantInt *CB = dyn_cast<ConstantInt>(I->getOperand(1))) 
-        if (CB->getType()->isInteger(1)) {
+        if (CB->getType()->isIntegerTy(1)) {
           if (CB->isOne())      // X & 1 -> X
             ReplaceUsesOfWith(I, I->getOperand(0), Worklist, L, LPM);
           else                  // X & 0 -> 0
@@ -1011,10 +1011,10 @@ void LoopUnswitch::SimplifyCode(std::vector<Instruction*> &Worklist, Loop *L) {
     case Instruction::Or:
       if (isa<ConstantInt>(I->getOperand(0)) &&
           // constant -> RHS
-          I->getOperand(0)->getType()->isInteger(1))
+          I->getOperand(0)->getType()->isIntegerTy(1))
         cast<BinaryOperator>(I)->swapOperands();
       if (ConstantInt *CB = dyn_cast<ConstantInt>(I->getOperand(1)))
-        if (CB->getType()->isInteger(1)) {
+        if (CB->getType()->isIntegerTy(1)) {
           if (CB->isOne())   // X | 1 -> 1
             ReplaceUsesOfWith(I, I->getOperand(1), Worklist, L, LPM);
           else                  // X | 0 -> X
diff --git a/libclamav/c++/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp b/libclamav/c++/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp
index e0aa491..62e2977 100644
--- a/libclamav/c++/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp
+++ b/libclamav/c++/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp
@@ -42,7 +42,7 @@ static Value *isBytewiseValue(Value *V) {
   LLVMContext &Context = V->getContext();
   
   // All byte-wide stores are splatable, even of arbitrary variables.
-  if (V->getType()->isInteger(8)) return V;
+  if (V->getType()->isIntegerTy(8)) return V;
   
   // Constant float and double values can be handled as integer values if the
   // corresponding integer value is "byteable".  An important case is 0.0. 
diff --git a/libclamav/c++/llvm/lib/Transforms/Scalar/Reassociate.cpp b/libclamav/c++/llvm/lib/Transforms/Scalar/Reassociate.cpp
index bbd4b45..5aca9cd 100644
--- a/libclamav/c++/llvm/lib/Transforms/Scalar/Reassociate.cpp
+++ b/libclamav/c++/llvm/lib/Transforms/Scalar/Reassociate.cpp
@@ -182,7 +182,7 @@ unsigned Reassociate::getRank(Value *V) {
 
   // If this is a not or neg instruction, do not count it for rank.  This
   // assures us that X and ~X will have the same rank.
-  if (!I->getType()->isInteger() ||
+  if (!I->getType()->isIntegerTy() ||
       (!BinaryOperator::isNot(I) && !BinaryOperator::isNeg(I)))
     ++Rank;
 
@@ -597,19 +597,35 @@ Value *Reassociate::RemoveFactorFromExpression(Value *V, Value *Factor) {
 
 /// FindSingleUseMultiplyFactors - If V is a single-use multiply, recursively
 /// add its operands as factors, otherwise add V to the list of factors.
+///
+/// Ops is the top-level list of add operands we're trying to factor.
 static void FindSingleUseMultiplyFactors(Value *V,
-                                         SmallVectorImpl<Value*> &Factors) {
+                                         SmallVectorImpl<Value*> &Factors,
+                                       const SmallVectorImpl<ValueEntry> &Ops,
+                                         bool IsRoot) {
   BinaryOperator *BO;
-  if ((!V->hasOneUse() && !V->use_empty()) ||
+  if (!(V->hasOneUse() || V->use_empty()) || // More than one use.
       !(BO = dyn_cast<BinaryOperator>(V)) ||
       BO->getOpcode() != Instruction::Mul) {
     Factors.push_back(V);
     return;
   }
   
+  // If this value has a single use because it is another input to the add
+  // tree we're reassociating and we dropped its use, it actually has two
+  // uses and we can't factor it.
+  if (!IsRoot) {
+    for (unsigned i = 0, e = Ops.size(); i != e; ++i)
+      if (Ops[i].Op == V) {
+        Factors.push_back(V);
+        return;
+      }
+  }
+  
+  
   // Otherwise, add the LHS and RHS to the list of factors.
-  FindSingleUseMultiplyFactors(BO->getOperand(1), Factors);
-  FindSingleUseMultiplyFactors(BO->getOperand(0), Factors);
+  FindSingleUseMultiplyFactors(BO->getOperand(1), Factors, Ops, false);
+  FindSingleUseMultiplyFactors(BO->getOperand(0), Factors, Ops, false);
 }
 
 /// OptimizeAndOrXor - Optimize a series of operands to an 'and', 'or', or 'xor'
@@ -753,7 +769,7 @@ Value *Reassociate::OptimizeAdd(Instruction *I,
     
     // Compute all of the factors of this added value.
     SmallVector<Value*, 8> Factors;
-    FindSingleUseMultiplyFactors(BOp, Factors);
+    FindSingleUseMultiplyFactors(BOp, Factors, Ops, true);
     assert(Factors.size() > 1 && "Bad linearize!");
     
     // Add one to FactorOccurrences for each unique factor in this op.
@@ -929,8 +945,8 @@ void Reassociate::ReassociateBB(BasicBlock *BB) {
       }
 
     // Reject cases where it is pointless to do this.
-    if (!isa<BinaryOperator>(BI) || BI->getType()->isFloatingPoint() || 
-        isa<VectorType>(BI->getType()))
+    if (!isa<BinaryOperator>(BI) || BI->getType()->isFloatingPointTy() || 
+        BI->getType()->isVectorTy())
       continue;  // Floating point ops are not associative.
 
     // Do not reassociate boolean (i1) expressions.  We want to preserve the
@@ -939,7 +955,7 @@ void Reassociate::ReassociateBB(BasicBlock *BB) {
     // is not further optimized, it is likely to be transformed back to a
     // short-circuited form for code gen, and the source order may have been
     // optimized for the most likely conditions.
-    if (BI->getType()->isInteger(1))
+    if (BI->getType()->isIntegerTy(1))
       continue;
 
     // If this is a subtract instruction which is not already in negate form,
diff --git a/libclamav/c++/llvm/lib/Transforms/Scalar/SCCP.cpp b/libclamav/c++/llvm/lib/Transforms/Scalar/SCCP.cpp
index 02b45a1..7e37938 100644
--- a/libclamav/c++/llvm/lib/Transforms/Scalar/SCCP.cpp
+++ b/libclamav/c++/llvm/lib/Transforms/Scalar/SCCP.cpp
@@ -295,7 +295,7 @@ public:
   }
 
   void markOverdefined(Value *V) {
-    assert(!isa<StructType>(V->getType()) && "Should use other method");
+    assert(!V->getType()->isStructTy() && "Should use other method");
     markOverdefined(ValueState[V], V);
   }
 
@@ -321,12 +321,12 @@ private:
   }
   
   void markConstant(Value *V, Constant *C) {
-    assert(!isa<StructType>(V->getType()) && "Should use other method");
+    assert(!V->getType()->isStructTy() && "Should use other method");
     markConstant(ValueState[V], V, C);
   }
 
   void markForcedConstant(Value *V, Constant *C) {
-    assert(!isa<StructType>(V->getType()) && "Should use other method");
+    assert(!V->getType()->isStructTy() && "Should use other method");
     ValueState[V].markForcedConstant(C);
     DEBUG(dbgs() << "markForcedConstant: " << *C << ": " << *V << '\n');
     InstWorkList.push_back(V);
@@ -360,7 +360,7 @@ private:
   }
   
   void mergeInValue(Value *V, LatticeVal MergeWithV) {
-    assert(!isa<StructType>(V->getType()) && "Should use other method");
+    assert(!V->getType()->isStructTy() && "Should use other method");
     mergeInValue(ValueState[V], V, MergeWithV);
   }
 
@@ -369,7 +369,7 @@ private:
   /// value.  This function handles the case when the value hasn't been seen yet
   /// by properly seeding constants etc.
   LatticeVal &getValueState(Value *V) {
-    assert(!isa<StructType>(V->getType()) && "Should use getStructValueState");
+    assert(!V->getType()->isStructTy() && "Should use getStructValueState");
 
     std::pair<DenseMap<Value*, LatticeVal>::iterator, bool> I =
       ValueState.insert(std::make_pair(V, LatticeVal()));
@@ -392,7 +392,7 @@ private:
   /// value/field pair.  This function handles the case when the value hasn't
   /// been seen yet by properly seeding constants etc.
   LatticeVal &getStructValueState(Value *V, unsigned i) {
-    assert(isa<StructType>(V->getType()) && "Should use getValueState");
+    assert(V->getType()->isStructTy() && "Should use getValueState");
     assert(i < cast<StructType>(V->getType())->getNumElements() &&
            "Invalid element #");
 
@@ -666,7 +666,7 @@ bool SCCPSolver::isEdgeFeasible(BasicBlock *From, BasicBlock *To) {
 void SCCPSolver::visitPHINode(PHINode &PN) {
   // If this PN returns a struct, just mark the result overdefined.
   // TODO: We could do a lot better than this if code actually uses this.
-  if (isa<StructType>(PN.getType()))
+  if (PN.getType()->isStructTy())
     return markAnythingOverdefined(&PN);
   
   if (getValueState(&PN).isOverdefined()) {
@@ -742,7 +742,7 @@ void SCCPSolver::visitReturnInst(ReturnInst &I) {
   Value *ResultOp = I.getOperand(0);
   
   // If we are tracking the return value of this function, merge it in.
-  if (!TrackedRetVals.empty() && !isa<StructType>(ResultOp->getType())) {
+  if (!TrackedRetVals.empty() && !ResultOp->getType()->isStructTy()) {
     DenseMap<Function*, LatticeVal>::iterator TFRVI =
       TrackedRetVals.find(F);
     if (TFRVI != TrackedRetVals.end()) {
@@ -787,7 +787,7 @@ void SCCPSolver::visitCastInst(CastInst &I) {
 void SCCPSolver::visitExtractValueInst(ExtractValueInst &EVI) {
   // If this returns a struct, mark all elements over defined, we don't track
   // structs in structs.
-  if (isa<StructType>(EVI.getType()))
+  if (EVI.getType()->isStructTy())
     return markAnythingOverdefined(&EVI);
     
   // If this is extracting from more than one level of struct, we don't know.
@@ -795,7 +795,7 @@ void SCCPSolver::visitExtractValueInst(ExtractValueInst &EVI) {
     return markOverdefined(&EVI);
 
   Value *AggVal = EVI.getAggregateOperand();
-  if (isa<StructType>(AggVal->getType())) {
+  if (AggVal->getType()->isStructTy()) {
     unsigned i = *EVI.idx_begin();
     LatticeVal EltVal = getStructValueState(AggVal, i);
     mergeInValue(getValueState(&EVI), &EVI, EltVal);
@@ -828,7 +828,7 @@ void SCCPSolver::visitInsertValueInst(InsertValueInst &IVI) {
     }
     
     Value *Val = IVI.getInsertedValueOperand();
-    if (isa<StructType>(Val->getType()))
+    if (Val->getType()->isStructTy())
       // We don't track structs in structs.
       markOverdefined(getStructValueState(&IVI, i), &IVI);
     else {
@@ -841,7 +841,7 @@ void SCCPSolver::visitInsertValueInst(InsertValueInst &IVI) {
 void SCCPSolver::visitSelectInst(SelectInst &I) {
   // If this select returns a struct, just mark the result overdefined.
   // TODO: We could do a lot better than this if code actually uses this.
-  if (isa<StructType>(I.getType()))
+  if (I.getType()->isStructTy())
     return markAnythingOverdefined(&I);
   
   LatticeVal CondValue = getValueState(I.getCondition());
@@ -1166,7 +1166,7 @@ void SCCPSolver::visitGetElementPtrInst(GetElementPtrInst &I) {
 
 void SCCPSolver::visitStoreInst(StoreInst &SI) {
   // If this store is of a struct, ignore it.
-  if (isa<StructType>(SI.getOperand(0)->getType()))
+  if (SI.getOperand(0)->getType()->isStructTy())
     return;
   
   if (TrackedGlobals.empty() || !isa<GlobalVariable>(SI.getOperand(1)))
@@ -1187,7 +1187,7 @@ void SCCPSolver::visitStoreInst(StoreInst &SI) {
 // global, we can replace the load with the loaded constant value!
 void SCCPSolver::visitLoadInst(LoadInst &I) {
   // If this load is of a struct, just mark the result overdefined.
-  if (isa<StructType>(I.getType()))
+  if (I.getType()->isStructTy())
     return markAnythingOverdefined(&I);
   
   LatticeVal PtrVal = getValueState(I.getOperand(0));
@@ -1241,7 +1241,7 @@ CallOverdefined:
     
     // Otherwise, if we have a single return value case, and if the function is
     // a declaration, maybe we can constant fold it.
-    if (F && F->isDeclaration() && !isa<StructType>(I->getType()) &&
+    if (F && F->isDeclaration() && !I->getType()->isStructTy() &&
         canConstantFoldCallTo(F)) {
       
       SmallVector<Constant*, 8> Operands;
@@ -1352,7 +1352,7 @@ void SCCPSolver::Solve() {
       // since all of its users will have already been marked as overdefined.
       // Update all of the users of this instruction's value.
       //
-      if (isa<StructType>(I->getType()) || !getValueState(I).isOverdefined())
+      if (I->getType()->isStructTy() || !getValueState(I).isOverdefined())
         for (Value::use_iterator UI = I->use_begin(), E = I->use_end();
              UI != E; ++UI)
           if (Instruction *I = dyn_cast<Instruction>(*UI))
@@ -1418,7 +1418,7 @@ bool SCCPSolver::ResolvedUndefsIn(Function &F) {
       if (!LV.isUndefined()) continue;
 
       // No instructions using structs need disambiguation.
-      if (isa<StructType>(I->getOperand(0)->getType()))
+      if (I->getOperand(0)->getType()->isStructTy())
         continue;
 
       // Get the lattice values of the first two operands for use below.
@@ -1426,7 +1426,7 @@ bool SCCPSolver::ResolvedUndefsIn(Function &F) {
       LatticeVal Op1LV;
       if (I->getNumOperands() == 2) {
         // No instructions using structs need disambiguation.
-        if (isa<StructType>(I->getOperand(1)->getType()))
+        if (I->getOperand(1)->getType()->isStructTy())
           continue;
         
         // If this is a two-operand instruction, and if both operands are
@@ -1656,7 +1656,7 @@ bool SCCP::runOnFunction(Function &F) {
         continue;
       
       // TODO: Reconstruct structs from their elements.
-      if (isa<StructType>(Inst->getType()))
+      if (Inst->getType()->isStructTy())
         continue;
       
       LatticeVal IV = Solver.getLatticeValueFor(Inst);
@@ -1792,7 +1792,7 @@ bool IPSCCP::runOnModule(Module &M) {
     if (Solver.isBlockExecutable(F->begin())) {
       for (Function::arg_iterator AI = F->arg_begin(), E = F->arg_end();
            AI != E; ++AI) {
-        if (AI->use_empty() || isa<StructType>(AI->getType())) continue;
+        if (AI->use_empty() || AI->getType()->isStructTy()) continue;
         
         // TODO: Could use getStructLatticeValueFor to find out if the entire
         // result is a constant and replace it entirely if so.
@@ -1835,7 +1835,7 @@ bool IPSCCP::runOnModule(Module &M) {
       
       for (BasicBlock::iterator BI = BB->begin(), E = BB->end(); BI != E; ) {
         Instruction *Inst = BI++;
-        if (Inst->getType()->isVoidTy() || isa<StructType>(Inst->getType()))
+        if (Inst->getType()->isVoidTy() || Inst->getType()->isStructTy())
           continue;
         
         // TODO: Could use getStructLatticeValueFor to find out if the entire
@@ -1918,6 +1918,14 @@ bool IPSCCP::runOnModule(Module &M) {
   // all call uses with the inferred value.  This means we don't need to bother
   // actually returning anything from the function.  Replace all return
   // instructions with return undef.
+  //
+  // Do this in two stages: first identify the functions we should process, then
+  // actually zap their returns.  This is important because we can only do this
+  // if the address of the function isn't taken.  In cases where a return is the
+  // last use of a function, the order of processing functions would affect
+  // whether other functions are optimizable.
+  SmallVector<ReturnInst*, 8> ReturnsToZap;
+  
   // TODO: Process multiple value ret instructions also.
   const DenseMap<Function*, LatticeVal> &RV = Solver.getTrackedRetVals();
   for (DenseMap<Function*, LatticeVal>::const_iterator I = RV.begin(),
@@ -1933,7 +1941,13 @@ bool IPSCCP::runOnModule(Module &M) {
     for (Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB)
       if (ReturnInst *RI = dyn_cast<ReturnInst>(BB->getTerminator()))
         if (!isa<UndefValue>(RI->getOperand(0)))
-          RI->setOperand(0, UndefValue::get(F->getReturnType()));
+          ReturnsToZap.push_back(RI);
+  }
+
+  // Zap all returns which we've identified as zap to change.
+  for (unsigned i = 0, e = ReturnsToZap.size(); i != e; ++i) {
+    Function *F = ReturnsToZap[i]->getParent()->getParent();
+    ReturnsToZap[i]->setOperand(0, UndefValue::get(F->getReturnType()));
   }
     
   // If we infered constant or undef values for globals variables, we can delete
diff --git a/libclamav/c++/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp b/libclamav/c++/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp
index 900d119..bbe6270 100644
--- a/libclamav/c++/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp
+++ b/libclamav/c++/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp
@@ -302,7 +302,7 @@ bool SROA::performScalarRepl(Function &F) {
       // random stuff that doesn't use vectors (e.g. <9 x double>) because then
       // we just get a lot of insert/extracts.  If at least one vector is
       // involved, then we probably really do have a union of vector/array.
-      if (VectorTy && isa<VectorType>(VectorTy) && HadAVector) {
+      if (VectorTy && VectorTy->isVectorTy() && HadAVector) {
         DEBUG(dbgs() << "CONVERT TO VECTOR: " << *AI << "\n  TYPE = "
                      << *VectorTy << '\n');
         
@@ -449,7 +449,7 @@ void SROA::isSafeGEP(GetElementPtrInst *GEPI, AllocaInst *AI,
   // into.
   for (; GEPIt != E; ++GEPIt) {
     // Ignore struct elements, no extra checking needed for these.
-    if (isa<StructType>(*GEPIt))
+    if ((*GEPIt)->isStructTy())
       continue;
 
     ConstantInt *IdxVal = dyn_cast<ConstantInt>(GEPIt.getOperand());
@@ -480,7 +480,7 @@ void SROA::isSafeMemAccess(AllocaInst *AI, uint64_t Offset, uint64_t MemSize,
     // (which are essentially the same as the MemIntrinsics, especially with
     // regard to copying padding between elements), or references using the
     // aggregate type of the alloca.
-    if (!MemOpType || isa<IntegerType>(MemOpType) || UsesAggregateType) {
+    if (!MemOpType || MemOpType->isIntegerTy() || UsesAggregateType) {
       if (!UsesAggregateType) {
         if (isStore)
           Info.isMemCpyDst = true;
@@ -565,7 +565,7 @@ void SROA::RewriteForScalarRepl(Instruction *I, AllocaInst *AI, uint64_t Offset,
         }
         LI->replaceAllUsesWith(Insert);
         DeadInsts.push_back(LI);
-      } else if (isa<IntegerType>(LIType) &&
+      } else if (LIType->isIntegerTy() &&
                  TD->getTypeAllocSize(LIType) ==
                  TD->getTypeAllocSize(AI->getAllocatedType())) {
         // If this is a load of the entire alloca to an integer, rewrite it.
@@ -588,7 +588,7 @@ void SROA::RewriteForScalarRepl(Instruction *I, AllocaInst *AI, uint64_t Offset,
           new StoreInst(Extract, NewElts[i], SI);
         }
         DeadInsts.push_back(SI);
-      } else if (isa<IntegerType>(SIType) &&
+      } else if (SIType->isIntegerTy() &&
                  TD->getTypeAllocSize(SIType) ==
                  TD->getTypeAllocSize(AI->getAllocatedType())) {
         // If this is a store of the entire alloca from an integer, rewrite it.
@@ -833,9 +833,9 @@ void SROA::RewriteMemIntrinUserOfAlloca(MemIntrinsic *MI, Instruction *Inst,
           
           // Convert the integer value to the appropriate type.
           StoreVal = ConstantInt::get(Context, TotalVal);
-          if (isa<PointerType>(ValTy))
+          if (ValTy->isPointerTy())
             StoreVal = ConstantExpr::getIntToPtr(StoreVal, ValTy);
-          else if (ValTy->isFloatingPoint())
+          else if (ValTy->isFloatingPointTy())
             StoreVal = ConstantExpr::getBitCast(StoreVal, ValTy);
           assert(StoreVal->getType() == ValTy && "Type mismatch!");
           
@@ -939,7 +939,7 @@ void SROA::RewriteStoreUserOfWholeAlloca(StoreInst *SI, AllocaInst *AI,
       Value *DestField = NewElts[i];
       if (EltVal->getType() == FieldTy) {
         // Storing to an integer field of this size, just do it.
-      } else if (FieldTy->isFloatingPoint() || isa<VectorType>(FieldTy)) {
+      } else if (FieldTy->isFloatingPointTy() || FieldTy->isVectorTy()) {
         // Bitcast to the right element type (for fp/vector values).
         EltVal = new BitCastInst(EltVal, FieldTy, "", SI);
       } else {
@@ -983,7 +983,8 @@ void SROA::RewriteStoreUserOfWholeAlloca(StoreInst *SI, AllocaInst *AI,
       Value *DestField = NewElts[i];
       if (EltVal->getType() == ArrayEltTy) {
         // Storing to an integer field of this size, just do it.
-      } else if (ArrayEltTy->isFloatingPoint() || isa<VectorType>(ArrayEltTy)) {
+      } else if (ArrayEltTy->isFloatingPointTy() ||
+                 ArrayEltTy->isVectorTy()) {
         // Bitcast to the right element type (for fp/vector values).
         EltVal = new BitCastInst(EltVal, ArrayEltTy, "", SI);
       } else {
@@ -1043,8 +1044,8 @@ void SROA::RewriteLoadUserOfWholeAlloca(LoadInst *LI, AllocaInst *AI,
     
     const IntegerType *FieldIntTy = IntegerType::get(LI->getContext(), 
                                                      FieldSizeBits);
-    if (!isa<IntegerType>(FieldTy) && !FieldTy->isFloatingPoint() &&
-        !isa<VectorType>(FieldTy))
+    if (!FieldTy->isIntegerTy() && !FieldTy->isFloatingPointTy() &&
+        !FieldTy->isVectorTy())
       SrcField = new BitCastInst(SrcField,
                                  PointerType::getUnqual(FieldIntTy),
                                  "", LI);
@@ -1182,7 +1183,7 @@ static void MergeInType(const Type *In, uint64_t Offset, const Type *&VecTy,
         return;
       }
     } else if (In->isFloatTy() || In->isDoubleTy() ||
-               (isa<IntegerType>(In) && In->getPrimitiveSizeInBits() >= 8 &&
+               (In->isIntegerTy() && In->getPrimitiveSizeInBits() >= 8 &&
                 isPowerOf2_32(In->getPrimitiveSizeInBits()))) {
       // If we're accessing something that could be an element of a vector, see
       // if the implied vector agrees with what we already have and if Offset is
@@ -1226,7 +1227,7 @@ bool SROA::CanConvertToScalar(Value *V, bool &IsNotTrivial, const Type *&VecTy,
         return false;
       MergeInType(LI->getType(), Offset, VecTy,
                   AllocaSize, *TD, V->getContext());
-      SawVec |= isa<VectorType>(LI->getType());
+      SawVec |= LI->getType()->isVectorTy();
       continue;
     }
     
@@ -1235,7 +1236,7 @@ bool SROA::CanConvertToScalar(Value *V, bool &IsNotTrivial, const Type *&VecTy,
       if (SI->getOperand(0) == V || SI->isVolatile()) return 0;
       MergeInType(SI->getOperand(0)->getType(), Offset,
                   VecTy, AllocaSize, *TD, V->getContext());
-      SawVec |= isa<VectorType>(SI->getOperand(0)->getType());
+      SawVec |= SI->getOperand(0)->getType()->isVectorTy();
       continue;
     }
     
@@ -1437,7 +1438,7 @@ Value *SROA::ConvertScalar_ExtractValue(Value *FromVal, const Type *ToType,
   // If the result alloca is a vector type, this is either an element
   // access or a bitcast to another vector type of the same size.
   if (const VectorType *VTy = dyn_cast<VectorType>(FromVal->getType())) {
-    if (isa<VectorType>(ToType))
+    if (ToType->isVectorTy())
       return Builder.CreateBitCast(FromVal, ToType, "tmp");
 
     // Otherwise it must be an element access.
@@ -1520,9 +1521,9 @@ Value *SROA::ConvertScalar_ExtractValue(Value *FromVal, const Type *ToType,
                                                     LIBitWidth), "tmp");
 
   // If the result is an integer, this is a trunc or bitcast.
-  if (isa<IntegerType>(ToType)) {
+  if (ToType->isIntegerTy()) {
     // Should be done.
-  } else if (ToType->isFloatingPoint() || isa<VectorType>(ToType)) {
+  } else if (ToType->isFloatingPointTy() || ToType->isVectorTy()) {
     // Just do a bitcast, we know the sizes match up.
     FromVal = Builder.CreateBitCast(FromVal, ToType, "tmp");
   } else {
@@ -1600,10 +1601,10 @@ Value *SROA::ConvertScalar_InsertValue(Value *SV, Value *Old,
   unsigned DestWidth = TD->getTypeSizeInBits(AllocaType);
   unsigned SrcStoreWidth = TD->getTypeStoreSizeInBits(SV->getType());
   unsigned DestStoreWidth = TD->getTypeStoreSizeInBits(AllocaType);
-  if (SV->getType()->isFloatingPoint() || isa<VectorType>(SV->getType()))
+  if (SV->getType()->isFloatingPointTy() || SV->getType()->isVectorTy())
     SV = Builder.CreateBitCast(SV,
                             IntegerType::get(SV->getContext(),SrcWidth), "tmp");
-  else if (isa<PointerType>(SV->getType()))
+  else if (SV->getType()->isPointerTy())
     SV = Builder.CreatePtrToInt(SV, TD->getIntPtrType(SV->getContext()), "tmp");
 
   // Zero extend or truncate the value if needed.
diff --git a/libclamav/c++/llvm/lib/Transforms/Scalar/SimplifyLibCalls.cpp b/libclamav/c++/llvm/lib/Transforms/Scalar/SimplifyLibCalls.cpp
index 4216e8f..05027ae 100644
--- a/libclamav/c++/llvm/lib/Transforms/Scalar/SimplifyLibCalls.cpp
+++ b/libclamav/c++/llvm/lib/Transforms/Scalar/SimplifyLibCalls.cpp
@@ -17,6 +17,7 @@
 
 #define DEBUG_TYPE "simplify-libcalls"
 #include "llvm/Transforms/Scalar.h"
+#include "llvm/Transforms/Utils/BuildLibCalls.h"
 #include "llvm/Intrinsics.h"
 #include "llvm/LLVMContext.h"
 #include "llvm/Module.h"
@@ -67,496 +68,14 @@ public:
       Context = &CI->getCalledFunction()->getContext();
     return CallOptimizer(CI->getCalledFunction(), CI, B);
   }
-
-  /// CastToCStr - Return V if it is an i8*, otherwise cast it to i8*.
-  Value *CastToCStr(Value *V, IRBuilder<> &B);
-
-  /// EmitStrLen - Emit a call to the strlen function to the builder, for the
-  /// specified pointer.  Ptr is required to be some pointer type, and the
-  /// return value has 'intptr_t' type.
-  Value *EmitStrLen(Value *Ptr, IRBuilder<> &B);
-
-  /// EmitStrChr - Emit a call to the strchr function to the builder, for the
-  /// specified pointer and character.  Ptr is required to be some pointer type,
-  /// and the return value has 'i8*' type.
-  Value *EmitStrChr(Value *Ptr, char C, IRBuilder<> &B);
-
-  /// EmitStrCpy - Emit a call to the strcpy function to the builder, for the
-  /// specified pointer arguments.
-  Value *EmitStrCpy(Value *Dst, Value *Src, IRBuilder<> &B);
-  
-  /// EmitMemCpy - Emit a call to the memcpy function to the builder.  This
-  /// always expects that the size has type 'intptr_t' and Dst/Src are pointers.
-  Value *EmitMemCpy(Value *Dst, Value *Src, Value *Len,
-                    unsigned Align, IRBuilder<> &B);
-
-  /// EmitMemMove - Emit a call to the memmove function to the builder.  This
-  /// always expects that the size has type 'intptr_t' and Dst/Src are pointers.
-  Value *EmitMemMove(Value *Dst, Value *Src, Value *Len,
-		     unsigned Align, IRBuilder<> &B);
-
-  /// EmitMemChr - Emit a call to the memchr function.  This assumes that Ptr is
-  /// a pointer, Val is an i32 value, and Len is an 'intptr_t' value.
-  Value *EmitMemChr(Value *Ptr, Value *Val, Value *Len, IRBuilder<> &B);
-
-  /// EmitMemCmp - Emit a call to the memcmp function.
-  Value *EmitMemCmp(Value *Ptr1, Value *Ptr2, Value *Len, IRBuilder<> &B);
-
-  /// EmitMemSet - Emit a call to the memset function
-  Value *EmitMemSet(Value *Dst, Value *Val, Value *Len, IRBuilder<> &B);
-
-  /// EmitUnaryFloatFnCall - Emit a call to the unary function named 'Name'
-  /// (e.g.  'floor').  This function is known to take a single of type matching
-  /// 'Op' and returns one value with the same type.  If 'Op' is a long double,
-  /// 'l' is added as the suffix of name, if 'Op' is a float, we add a 'f'
-  /// suffix.
-  Value *EmitUnaryFloatFnCall(Value *Op, const char *Name, IRBuilder<> &B,
-                              const AttrListPtr &Attrs);
-
-  /// EmitPutChar - Emit a call to the putchar function.  This assumes that Char
-  /// is an integer.
-  Value *EmitPutChar(Value *Char, IRBuilder<> &B);
-
-  /// EmitPutS - Emit a call to the puts function.  This assumes that Str is
-  /// some pointer.
-  void EmitPutS(Value *Str, IRBuilder<> &B);
-
-  /// EmitFPutC - Emit a call to the fputc function.  This assumes that Char is
-  /// an i32, and File is a pointer to FILE.
-  void EmitFPutC(Value *Char, Value *File, IRBuilder<> &B);
-
-  /// EmitFPutS - Emit a call to the puts function.  Str is required to be a
-  /// pointer and File is a pointer to FILE.
-  void EmitFPutS(Value *Str, Value *File, IRBuilder<> &B);
-
-  /// EmitFWrite - Emit a call to the fwrite function.  This assumes that Ptr is
-  /// a pointer, Size is an 'intptr_t', and File is a pointer to FILE.
-  void EmitFWrite(Value *Ptr, Value *Size, Value *File, IRBuilder<> &B);
-
 };
 } // End anonymous namespace.
 
-/// CastToCStr - Return V if it is an i8*, otherwise cast it to i8*.
-Value *LibCallOptimization::CastToCStr(Value *V, IRBuilder<> &B) {
-  return B.CreateBitCast(V, Type::getInt8PtrTy(*Context), "cstr");
-}
-
-/// EmitStrLen - Emit a call to the strlen function to the builder, for the
-/// specified pointer.  This always returns an integer value of size intptr_t.
-Value *LibCallOptimization::EmitStrLen(Value *Ptr, IRBuilder<> &B) {
-  Module *M = Caller->getParent();
-  AttributeWithIndex AWI[2];
-  AWI[0] = AttributeWithIndex::get(1, Attribute::NoCapture);
-  AWI[1] = AttributeWithIndex::get(~0u, Attribute::ReadOnly |
-                                   Attribute::NoUnwind);
-
-  Constant *StrLen =M->getOrInsertFunction("strlen", AttrListPtr::get(AWI, 2),
-                                           TD->getIntPtrType(*Context),
-                                           Type::getInt8PtrTy(*Context),
-                                           NULL);
-  CallInst *CI = B.CreateCall(StrLen, CastToCStr(Ptr, B), "strlen");
-  if (const Function *F = dyn_cast<Function>(StrLen->stripPointerCasts()))
-    CI->setCallingConv(F->getCallingConv());
-
-  return CI;
-}
-
-/// EmitStrChr - Emit a call to the strchr function to the builder, for the
-/// specified pointer and character.  Ptr is required to be some pointer type,
-/// and the return value has 'i8*' type.
-Value *LibCallOptimization::EmitStrChr(Value *Ptr, char C, IRBuilder<> &B) {
-  Module *M = Caller->getParent();
-  AttributeWithIndex AWI =
-    AttributeWithIndex::get(~0u, Attribute::ReadOnly | Attribute::NoUnwind);
-
-  const Type *I8Ptr = Type::getInt8PtrTy(*Context);
-  const Type *I32Ty = Type::getInt32Ty(*Context);
-  Constant *StrChr = M->getOrInsertFunction("strchr", AttrListPtr::get(&AWI, 1),
-                                            I8Ptr, I8Ptr, I32Ty, NULL);
-  CallInst *CI = B.CreateCall2(StrChr, CastToCStr(Ptr, B),
-                               ConstantInt::get(I32Ty, C), "strchr");
-  if (const Function *F = dyn_cast<Function>(StrChr->stripPointerCasts()))
-    CI->setCallingConv(F->getCallingConv());
-  return CI;
-}
-
-/// EmitStrCpy - Emit a call to the strcpy function to the builder, for the
-/// specified pointer arguments.
-Value *LibCallOptimization::EmitStrCpy(Value *Dst, Value *Src, IRBuilder<> &B) {
-  Module *M = Caller->getParent();
-  AttributeWithIndex AWI[2];
-  AWI[0] = AttributeWithIndex::get(2, Attribute::NoCapture);
-  AWI[1] = AttributeWithIndex::get(~0u, Attribute::NoUnwind);
-  const Type *I8Ptr = Type::getInt8PtrTy(*Context);
-  Value *StrCpy = M->getOrInsertFunction("strcpy", AttrListPtr::get(AWI, 2),
-                                         I8Ptr, I8Ptr, I8Ptr, NULL);
-  CallInst *CI = B.CreateCall2(StrCpy, CastToCStr(Dst, B), CastToCStr(Src, B),
-                               "strcpy");
-  if (const Function *F = dyn_cast<Function>(StrCpy->stripPointerCasts()))
-    CI->setCallingConv(F->getCallingConv());
-  return CI;
-}
-
-/// EmitMemCpy - Emit a call to the memcpy function to the builder.  This always
-/// expects that the size has type 'intptr_t' and Dst/Src are pointers.
-Value *LibCallOptimization::EmitMemCpy(Value *Dst, Value *Src, Value *Len,
-                                       unsigned Align, IRBuilder<> &B) {
-  Module *M = Caller->getParent();
-  const Type *Ty = Len->getType();
-  Value *MemCpy = Intrinsic::getDeclaration(M, Intrinsic::memcpy, &Ty, 1);
-  Dst = CastToCStr(Dst, B);
-  Src = CastToCStr(Src, B);
-  return B.CreateCall4(MemCpy, Dst, Src, Len,
-                       ConstantInt::get(Type::getInt32Ty(*Context), Align));
-}
-
-/// EmitMemMove - Emit a call to the memmove function to the builder.  This
-/// always expects that the size has type 'intptr_t' and Dst/Src are pointers.
-Value *LibCallOptimization::EmitMemMove(Value *Dst, Value *Src, Value *Len,
-					unsigned Align, IRBuilder<> &B) {
-  Module *M = Caller->getParent();
-  const Type *Ty = TD->getIntPtrType(*Context);
-  Value *MemMove = Intrinsic::getDeclaration(M, Intrinsic::memmove, &Ty, 1);
-  Dst = CastToCStr(Dst, B);
-  Src = CastToCStr(Src, B);
-  Value *A = ConstantInt::get(Type::getInt32Ty(*Context), Align);
-  return B.CreateCall4(MemMove, Dst, Src, Len, A);
-}
-
-/// EmitMemChr - Emit a call to the memchr function.  This assumes that Ptr is
-/// a pointer, Val is an i32 value, and Len is an 'intptr_t' value.
-Value *LibCallOptimization::EmitMemChr(Value *Ptr, Value *Val,
-                                       Value *Len, IRBuilder<> &B) {
-  Module *M = Caller->getParent();
-  AttributeWithIndex AWI;
-  AWI = AttributeWithIndex::get(~0u, Attribute::ReadOnly | Attribute::NoUnwind);
-
-  Value *MemChr = M->getOrInsertFunction("memchr", AttrListPtr::get(&AWI, 1),
-                                         Type::getInt8PtrTy(*Context),
-                                         Type::getInt8PtrTy(*Context),
-                                         Type::getInt32Ty(*Context),
-                                         TD->getIntPtrType(*Context),
-                                         NULL);
-  CallInst *CI = B.CreateCall3(MemChr, CastToCStr(Ptr, B), Val, Len, "memchr");
-
-  if (const Function *F = dyn_cast<Function>(MemChr->stripPointerCasts()))
-    CI->setCallingConv(F->getCallingConv());
-
-  return CI;
-}
-
-/// EmitMemCmp - Emit a call to the memcmp function.
-Value *LibCallOptimization::EmitMemCmp(Value *Ptr1, Value *Ptr2,
-                                       Value *Len, IRBuilder<> &B) {
-  Module *M = Caller->getParent();
-  AttributeWithIndex AWI[3];
-  AWI[0] = AttributeWithIndex::get(1, Attribute::NoCapture);
-  AWI[1] = AttributeWithIndex::get(2, Attribute::NoCapture);
-  AWI[2] = AttributeWithIndex::get(~0u, Attribute::ReadOnly |
-                                   Attribute::NoUnwind);
-
-  Value *MemCmp = M->getOrInsertFunction("memcmp", AttrListPtr::get(AWI, 3),
-                                         Type::getInt32Ty(*Context),
-                                         Type::getInt8PtrTy(*Context),
-                                         Type::getInt8PtrTy(*Context),
-                                         TD->getIntPtrType(*Context), NULL);
-  CallInst *CI = B.CreateCall3(MemCmp, CastToCStr(Ptr1, B), CastToCStr(Ptr2, B),
-                               Len, "memcmp");
-
-  if (const Function *F = dyn_cast<Function>(MemCmp->stripPointerCasts()))
-    CI->setCallingConv(F->getCallingConv());
-
-  return CI;
-}
-
-/// EmitMemSet - Emit a call to the memset function
-Value *LibCallOptimization::EmitMemSet(Value *Dst, Value *Val,
-                                       Value *Len, IRBuilder<> &B) {
- Module *M = Caller->getParent();
- Intrinsic::ID IID = Intrinsic::memset;
- const Type *Tys[1];
- Tys[0] = Len->getType();
- Value *MemSet = Intrinsic::getDeclaration(M, IID, Tys, 1);
- Value *Align = ConstantInt::get(Type::getInt32Ty(*Context), 1);
- return B.CreateCall4(MemSet, CastToCStr(Dst, B), Val, Len, Align);
-}
-
-/// EmitUnaryFloatFnCall - Emit a call to the unary function named 'Name' (e.g.
-/// 'floor').  This function is known to take a single of type matching 'Op' and
-/// returns one value with the same type.  If 'Op' is a long double, 'l' is
-/// added as the suffix of name, if 'Op' is a float, we add a 'f' suffix.
-Value *LibCallOptimization::EmitUnaryFloatFnCall(Value *Op, const char *Name,
-                                                 IRBuilder<> &B,
-                                                 const AttrListPtr &Attrs) {
-  char NameBuffer[20];
-  if (!Op->getType()->isDoubleTy()) {
-    // If we need to add a suffix, copy into NameBuffer.
-    unsigned NameLen = strlen(Name);
-    assert(NameLen < sizeof(NameBuffer)-2);
-    memcpy(NameBuffer, Name, NameLen);
-    if (Op->getType()->isFloatTy())
-      NameBuffer[NameLen] = 'f';  // floorf
-    else
-      NameBuffer[NameLen] = 'l';  // floorl
-    NameBuffer[NameLen+1] = 0;
-    Name = NameBuffer;
-  }
-
-  Module *M = Caller->getParent();
-  Value *Callee = M->getOrInsertFunction(Name, Op->getType(),
-                                         Op->getType(), NULL);
-  CallInst *CI = B.CreateCall(Callee, Op, Name);
-  CI->setAttributes(Attrs);
-  if (const Function *F = dyn_cast<Function>(Callee->stripPointerCasts()))
-    CI->setCallingConv(F->getCallingConv());
-
-  return CI;
-}
-
-/// EmitPutChar - Emit a call to the putchar function.  This assumes that Char
-/// is an integer.
-Value *LibCallOptimization::EmitPutChar(Value *Char, IRBuilder<> &B) {
-  Module *M = Caller->getParent();
-  Value *PutChar = M->getOrInsertFunction("putchar", Type::getInt32Ty(*Context),
-                                          Type::getInt32Ty(*Context), NULL);
-  CallInst *CI = B.CreateCall(PutChar,
-                              B.CreateIntCast(Char,
-                              Type::getInt32Ty(*Context),
-                              /*isSigned*/true,
-                              "chari"),
-                              "putchar");
-
-  if (const Function *F = dyn_cast<Function>(PutChar->stripPointerCasts()))
-    CI->setCallingConv(F->getCallingConv());
-  return CI;
-}
-
-/// EmitPutS - Emit a call to the puts function.  This assumes that Str is
-/// some pointer.
-void LibCallOptimization::EmitPutS(Value *Str, IRBuilder<> &B) {
-  Module *M = Caller->getParent();
-  AttributeWithIndex AWI[2];
-  AWI[0] = AttributeWithIndex::get(1, Attribute::NoCapture);
-  AWI[1] = AttributeWithIndex::get(~0u, Attribute::NoUnwind);
-
-  Value *PutS = M->getOrInsertFunction("puts", AttrListPtr::get(AWI, 2),
-                                       Type::getInt32Ty(*Context),
-                                       Type::getInt8PtrTy(*Context),
-                                       NULL);
-  CallInst *CI = B.CreateCall(PutS, CastToCStr(Str, B), "puts");
-  if (const Function *F = dyn_cast<Function>(PutS->stripPointerCasts()))
-    CI->setCallingConv(F->getCallingConv());
-
-}
-
-/// EmitFPutC - Emit a call to the fputc function.  This assumes that Char is
-/// an integer and File is a pointer to FILE.
-void LibCallOptimization::EmitFPutC(Value *Char, Value *File, IRBuilder<> &B) {
-  Module *M = Caller->getParent();
-  AttributeWithIndex AWI[2];
-  AWI[0] = AttributeWithIndex::get(2, Attribute::NoCapture);
-  AWI[1] = AttributeWithIndex::get(~0u, Attribute::NoUnwind);
-  Constant *F;
-  if (isa<PointerType>(File->getType()))
-    F = M->getOrInsertFunction("fputc", AttrListPtr::get(AWI, 2),
-                               Type::getInt32Ty(*Context),
-                               Type::getInt32Ty(*Context), File->getType(),
-                               NULL);
-  else
-    F = M->getOrInsertFunction("fputc",
-                               Type::getInt32Ty(*Context),
-                               Type::getInt32Ty(*Context),
-                               File->getType(), NULL);
-  Char = B.CreateIntCast(Char, Type::getInt32Ty(*Context), /*isSigned*/true,
-                         "chari");
-  CallInst *CI = B.CreateCall2(F, Char, File, "fputc");
-
-  if (const Function *Fn = dyn_cast<Function>(F->stripPointerCasts()))
-    CI->setCallingConv(Fn->getCallingConv());
-}
-
-/// EmitFPutS - Emit a call to the puts function.  Str is required to be a
-/// pointer and File is a pointer to FILE.
-void LibCallOptimization::EmitFPutS(Value *Str, Value *File, IRBuilder<> &B) {
-  Module *M = Caller->getParent();
-  AttributeWithIndex AWI[3];
-  AWI[0] = AttributeWithIndex::get(1, Attribute::NoCapture);
-  AWI[1] = AttributeWithIndex::get(2, Attribute::NoCapture);
-  AWI[2] = AttributeWithIndex::get(~0u, Attribute::NoUnwind);
-  Constant *F;
-  if (isa<PointerType>(File->getType()))
-    F = M->getOrInsertFunction("fputs", AttrListPtr::get(AWI, 3),
-                               Type::getInt32Ty(*Context),
-                               Type::getInt8PtrTy(*Context),
-                               File->getType(), NULL);
-  else
-    F = M->getOrInsertFunction("fputs", Type::getInt32Ty(*Context),
-                               Type::getInt8PtrTy(*Context),
-                               File->getType(), NULL);
-  CallInst *CI = B.CreateCall2(F, CastToCStr(Str, B), File, "fputs");
-
-  if (const Function *Fn = dyn_cast<Function>(F->stripPointerCasts()))
-    CI->setCallingConv(Fn->getCallingConv());
-}
-
-/// EmitFWrite - Emit a call to the fwrite function.  This assumes that Ptr is
-/// a pointer, Size is an 'intptr_t', and File is a pointer to FILE.
-void LibCallOptimization::EmitFWrite(Value *Ptr, Value *Size, Value *File,
-                                     IRBuilder<> &B) {
-  Module *M = Caller->getParent();
-  AttributeWithIndex AWI[3];
-  AWI[0] = AttributeWithIndex::get(1, Attribute::NoCapture);
-  AWI[1] = AttributeWithIndex::get(4, Attribute::NoCapture);
-  AWI[2] = AttributeWithIndex::get(~0u, Attribute::NoUnwind);
-  Constant *F;
-  if (isa<PointerType>(File->getType()))
-    F = M->getOrInsertFunction("fwrite", AttrListPtr::get(AWI, 3),
-                               TD->getIntPtrType(*Context),
-                               Type::getInt8PtrTy(*Context),
-                               TD->getIntPtrType(*Context),
-                               TD->getIntPtrType(*Context),
-                               File->getType(), NULL);
-  else
-    F = M->getOrInsertFunction("fwrite", TD->getIntPtrType(*Context),
-                               Type::getInt8PtrTy(*Context),
-                               TD->getIntPtrType(*Context),
-                               TD->getIntPtrType(*Context),
-                               File->getType(), NULL);
-  CallInst *CI = B.CreateCall4(F, CastToCStr(Ptr, B), Size,
-                        ConstantInt::get(TD->getIntPtrType(*Context), 1), File);
-
-  if (const Function *Fn = dyn_cast<Function>(F->stripPointerCasts()))
-    CI->setCallingConv(Fn->getCallingConv());
-}
 
 //===----------------------------------------------------------------------===//
 // Helper Functions
 //===----------------------------------------------------------------------===//
 
-/// GetStringLengthH - If we can compute the length of the string pointed to by
-/// the specified pointer, return 'len+1'.  If we can't, return 0.
-static uint64_t GetStringLengthH(Value *V, SmallPtrSet<PHINode*, 32> &PHIs) {
-  // Look through noop bitcast instructions.
-  if (BitCastInst *BCI = dyn_cast<BitCastInst>(V))
-    return GetStringLengthH(BCI->getOperand(0), PHIs);
-
-  // If this is a PHI node, there are two cases: either we have already seen it
-  // or we haven't.
-  if (PHINode *PN = dyn_cast<PHINode>(V)) {
-    if (!PHIs.insert(PN))
-      return ~0ULL;  // already in the set.
-
-    // If it was new, see if all the input strings are the same length.
-    uint64_t LenSoFar = ~0ULL;
-    for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i) {
-      uint64_t Len = GetStringLengthH(PN->getIncomingValue(i), PHIs);
-      if (Len == 0) return 0; // Unknown length -> unknown.
-
-      if (Len == ~0ULL) continue;
-
-      if (Len != LenSoFar && LenSoFar != ~0ULL)
-        return 0;    // Disagree -> unknown.
-      LenSoFar = Len;
-    }
-
-    // Success, all agree.
-    return LenSoFar;
-  }
-
-  // strlen(select(c,x,y)) -> strlen(x) ^ strlen(y)
-  if (SelectInst *SI = dyn_cast<SelectInst>(V)) {
-    uint64_t Len1 = GetStringLengthH(SI->getTrueValue(), PHIs);
-    if (Len1 == 0) return 0;
-    uint64_t Len2 = GetStringLengthH(SI->getFalseValue(), PHIs);
-    if (Len2 == 0) return 0;
-    if (Len1 == ~0ULL) return Len2;
-    if (Len2 == ~0ULL) return Len1;
-    if (Len1 != Len2) return 0;
-    return Len1;
-  }
-
-  // If the value is not a GEP instruction nor a constant expression with a
-  // GEP instruction, then return unknown.
-  User *GEP = 0;
-  if (GetElementPtrInst *GEPI = dyn_cast<GetElementPtrInst>(V)) {
-    GEP = GEPI;
-  } else if (ConstantExpr *CE = dyn_cast<ConstantExpr>(V)) {
-    if (CE->getOpcode() != Instruction::GetElementPtr)
-      return 0;
-    GEP = CE;
-  } else {
-    return 0;
-  }
-
-  // Make sure the GEP has exactly three arguments.
-  if (GEP->getNumOperands() != 3)
-    return 0;
-
-  // Check to make sure that the first operand of the GEP is an integer and
-  // has value 0 so that we are sure we're indexing into the initializer.
-  if (ConstantInt *Idx = dyn_cast<ConstantInt>(GEP->getOperand(1))) {
-    if (!Idx->isZero())
-      return 0;
-  } else
-    return 0;
-
-  // If the second index isn't a ConstantInt, then this is a variable index
-  // into the array.  If this occurs, we can't say anything meaningful about
-  // the string.
-  uint64_t StartIdx = 0;
-  if (ConstantInt *CI = dyn_cast<ConstantInt>(GEP->getOperand(2)))
-    StartIdx = CI->getZExtValue();
-  else
-    return 0;
-
-  // The GEP instruction, constant or instruction, must reference a global
-  // variable that is a constant and is initialized. The referenced constant
-  // initializer is the array that we'll use for optimization.
-  GlobalVariable* GV = dyn_cast<GlobalVariable>(GEP->getOperand(0));
-  if (!GV || !GV->isConstant() || !GV->hasInitializer() ||
-      GV->mayBeOverridden())
-    return 0;
-  Constant *GlobalInit = GV->getInitializer();
-
-  // Handle the ConstantAggregateZero case, which is a degenerate case. The
-  // initializer is constant zero so the length of the string must be zero.
-  if (isa<ConstantAggregateZero>(GlobalInit))
-    return 1;  // Len = 0 offset by 1.
-
-  // Must be a Constant Array
-  ConstantArray *Array = dyn_cast<ConstantArray>(GlobalInit);
-  if (!Array || !Array->getType()->getElementType()->isInteger(8))
-    return false;
-
-  // Get the number of elements in the array
-  uint64_t NumElts = Array->getType()->getNumElements();
-
-  // Traverse the constant array from StartIdx (derived above) which is
-  // the place the GEP refers to in the array.
-  for (unsigned i = StartIdx; i != NumElts; ++i) {
-    Constant *Elt = Array->getOperand(i);
-    ConstantInt *CI = dyn_cast<ConstantInt>(Elt);
-    if (!CI) // This array isn't suitable, non-int initializer.
-      return 0;
-    if (CI->isZero())
-      return i-StartIdx+1; // We found end of string, success!
-  }
-
-  return 0; // The array isn't null terminated, conservatively return 'unknown'.
-}
-
-/// GetStringLength - If we can compute the length of the string pointed to by
-/// the specified pointer, return 'len+1'.  If we can't, return 0.
-static uint64_t GetStringLength(Value *V) {
-  if (!isa<PointerType>(V->getType())) return 0;
-
-  SmallPtrSet<PHINode*, 32> PHIs;
-  uint64_t Len = GetStringLengthH(V, PHIs);
-  // If Len is ~0ULL, we had an infinite phi cycle: this is dead code, so return
-  // an empty string as a length.
-  return Len == ~0ULL ? 1 : Len;
-}
-
 /// IsOnlyUsedInZeroEqualityComparison - Return true if it only matters that the
 /// value is equal or not-equal to zero.
 static bool IsOnlyUsedInZeroEqualityComparison(Value *V) {
@@ -613,7 +132,7 @@ struct StrCatOpt : public LibCallOptimization {
   void EmitStrLenMemCpy(Value *Src, Value *Dst, uint64_t Len, IRBuilder<> &B) {
     // We need to find the end of the destination string.  That's where the
     // memory is to be moved to. We just generate a call to strlen.
-    Value *DstLen = EmitStrLen(Dst, B);
+    Value *DstLen = EmitStrLen(Dst, B, TD);
 
     // Now that we have the destination's length, we must index into the
     // destination's pointer to get the actual memcpy destination (end of
@@ -623,7 +142,7 @@ struct StrCatOpt : public LibCallOptimization {
     // We have enough information to now generate the memcpy call to do the
     // concatenation for us.  Make a memcpy to copy the nul byte with align = 1.
     EmitMemCpy(CpyDst, Src,
-               ConstantInt::get(TD->getIntPtrType(*Context), Len+1), 1, B);
+               ConstantInt::get(TD->getIntPtrType(*Context), Len+1), 1, B, TD);
   }
 };
 
@@ -638,7 +157,7 @@ struct StrNCatOpt : public StrCatOpt {
         FT->getReturnType() != Type::getInt8PtrTy(*Context) ||
         FT->getParamType(0) != FT->getReturnType() ||
         FT->getParamType(1) != FT->getReturnType() ||
-        !isa<IntegerType>(FT->getParamType(2)))
+        !FT->getParamType(2)->isIntegerTy())
       return 0;
 
     // Extract some information from the instruction
@@ -697,11 +216,12 @@ struct StrChrOpt : public LibCallOptimization {
       if (!TD) return 0;
 
       uint64_t Len = GetStringLength(SrcStr);
-      if (Len == 0 || !FT->getParamType(1)->isInteger(32)) // memchr needs i32.
+      if (Len == 0 || !FT->getParamType(1)->isIntegerTy(32))// memchr needs i32.
         return 0;
 
       return EmitMemChr(SrcStr, CI->getOperand(2), // include nul.
-                        ConstantInt::get(TD->getIntPtrType(*Context), Len), B);
+                        ConstantInt::get(TD->getIntPtrType(*Context), Len),
+                        B, TD);
     }
 
     // Otherwise, the character is a constant, see if the first argument is
@@ -739,7 +259,7 @@ struct StrCmpOpt : public LibCallOptimization {
     // Verify the "strcmp" function prototype.
     const FunctionType *FT = Callee->getFunctionType();
     if (FT->getNumParams() != 2 ||
-	!FT->getReturnType()->isInteger(32) ||
+	!FT->getReturnType()->isIntegerTy(32) ||
         FT->getParamType(0) != FT->getParamType(1) ||
         FT->getParamType(0) != Type::getInt8PtrTy(*Context))
       return 0;
@@ -772,7 +292,7 @@ struct StrCmpOpt : public LibCallOptimization {
 
       return EmitMemCmp(Str1P, Str2P,
                         ConstantInt::get(TD->getIntPtrType(*Context),
-                        std::min(Len1, Len2)), B);
+                        std::min(Len1, Len2)), B, TD);
     }
 
     return 0;
@@ -787,10 +307,10 @@ struct StrNCmpOpt : public LibCallOptimization {
     // Verify the "strncmp" function prototype.
     const FunctionType *FT = Callee->getFunctionType();
     if (FT->getNumParams() != 3 ||
-	!FT->getReturnType()->isInteger(32) ||
+	!FT->getReturnType()->isIntegerTy(32) ||
         FT->getParamType(0) != FT->getParamType(1) ||
         FT->getParamType(0) != Type::getInt8PtrTy(*Context) ||
-        !isa<IntegerType>(FT->getParamType(2)))
+        !FT->getParamType(2)->isIntegerTy())
       return 0;
 
     Value *Str1P = CI->getOperand(1), *Str2P = CI->getOperand(2);
@@ -852,7 +372,7 @@ struct StrCpyOpt : public LibCallOptimization {
     // We have enough information to now generate the memcpy call to do the
     // concatenation for us.  Make a memcpy to copy the nul byte with align = 1.
     EmitMemCpy(Dst, Src,
-               ConstantInt::get(TD->getIntPtrType(*Context), Len), 1, B);
+               ConstantInt::get(TD->getIntPtrType(*Context), Len), 1, B, TD);
     return Dst;
   }
 };
@@ -866,7 +386,7 @@ struct StrNCpyOpt : public LibCallOptimization {
     if (FT->getNumParams() != 3 || FT->getReturnType() != FT->getParamType(0) ||
         FT->getParamType(0) != FT->getParamType(1) ||
         FT->getParamType(0) != Type::getInt8PtrTy(*Context) ||
-        !isa<IntegerType>(FT->getParamType(2)))
+        !FT->getParamType(2)->isIntegerTy())
       return 0;
 
     Value *Dst = CI->getOperand(1);
@@ -881,7 +401,7 @@ struct StrNCpyOpt : public LibCallOptimization {
     if (SrcLen == 0) {
       // strncpy(x, "", y) -> memset(x, '\0', y, 1)
       EmitMemSet(Dst, ConstantInt::get(Type::getInt8Ty(*Context), '\0'), LenOp,
-		 B);
+		             B, TD);
       return Dst;
     }
 
@@ -901,7 +421,7 @@ struct StrNCpyOpt : public LibCallOptimization {
 
     // strncpy(x, s, c) -> memcpy(x, s, c, 1) [s and c are constant]
     EmitMemCpy(Dst, Src,
-               ConstantInt::get(TD->getIntPtrType(*Context), Len), 1, B);
+               ConstantInt::get(TD->getIntPtrType(*Context), Len), 1, B, TD);
 
     return Dst;
   }
@@ -915,7 +435,7 @@ struct StrLenOpt : public LibCallOptimization {
     const FunctionType *FT = Callee->getFunctionType();
     if (FT->getNumParams() != 1 ||
         FT->getParamType(0) != Type::getInt8PtrTy(*Context) ||
-        !isa<IntegerType>(FT->getReturnType()))
+        !FT->getReturnType()->isIntegerTy())
       return 0;
 
     Value *Src = CI->getOperand(1);
@@ -939,8 +459,8 @@ struct StrToOpt : public LibCallOptimization {
   virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) {
     const FunctionType *FT = Callee->getFunctionType();
     if ((FT->getNumParams() != 2 && FT->getNumParams() != 3) ||
-        !isa<PointerType>(FT->getParamType(0)) ||
-        !isa<PointerType>(FT->getParamType(1)))
+        !FT->getParamType(0)->isPointerTy() ||
+        !FT->getParamType(1)->isPointerTy())
       return 0;
 
     Value *EndPtr = CI->getOperand(2);
@@ -960,9 +480,9 @@ struct StrStrOpt : public LibCallOptimization {
   virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) {
     const FunctionType *FT = Callee->getFunctionType();
     if (FT->getNumParams() != 2 ||
-        !isa<PointerType>(FT->getParamType(0)) ||
-        !isa<PointerType>(FT->getParamType(1)) ||
-        !isa<PointerType>(FT->getReturnType()))
+        !FT->getParamType(0)->isPointerTy() ||
+        !FT->getParamType(1)->isPointerTy() ||
+        !FT->getReturnType()->isPointerTy())
       return 0;
 
     // fold strstr(x, x) -> x.
@@ -993,7 +513,7 @@ struct StrStrOpt : public LibCallOptimization {
 
     // fold strstr(x, "y") -> strchr(x, 'y').
     if (HasStr2 && ToFindStr.size() == 1)
-      return B.CreateBitCast(EmitStrChr(CI->getOperand(1), ToFindStr[0], B),
+      return B.CreateBitCast(EmitStrChr(CI->getOperand(1), ToFindStr[0], B, TD),
                              CI->getType());
     return 0;
   }
@@ -1006,9 +526,9 @@ struct StrStrOpt : public LibCallOptimization {
 struct MemCmpOpt : public LibCallOptimization {
   virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) {
     const FunctionType *FT = Callee->getFunctionType();
-    if (FT->getNumParams() != 3 || !isa<PointerType>(FT->getParamType(0)) ||
-        !isa<PointerType>(FT->getParamType(1)) ||
-        !FT->getReturnType()->isInteger(32))
+    if (FT->getNumParams() != 3 || !FT->getParamType(0)->isPointerTy() ||
+        !FT->getParamType(1)->isPointerTy() ||
+        !FT->getReturnType()->isIntegerTy(32))
       return 0;
 
     Value *LHS = CI->getOperand(1), *RHS = CI->getOperand(2);
@@ -1055,13 +575,14 @@ struct MemCpyOpt : public LibCallOptimization {
 
     const FunctionType *FT = Callee->getFunctionType();
     if (FT->getNumParams() != 3 || FT->getReturnType() != FT->getParamType(0) ||
-        !isa<PointerType>(FT->getParamType(0)) ||
-        !isa<PointerType>(FT->getParamType(1)) ||
+        !FT->getParamType(0)->isPointerTy() ||
+        !FT->getParamType(1)->isPointerTy() ||
         FT->getParamType(2) != TD->getIntPtrType(*Context))
       return 0;
 
     // memcpy(x, y, n) -> llvm.memcpy(x, y, n, 1)
-    EmitMemCpy(CI->getOperand(1), CI->getOperand(2), CI->getOperand(3), 1, B);
+    EmitMemCpy(CI->getOperand(1), CI->getOperand(2),
+               CI->getOperand(3), 1, B, TD);
     return CI->getOperand(1);
   }
 };
@@ -1076,13 +597,14 @@ struct MemMoveOpt : public LibCallOptimization {
 
     const FunctionType *FT = Callee->getFunctionType();
     if (FT->getNumParams() != 3 || FT->getReturnType() != FT->getParamType(0) ||
-        !isa<PointerType>(FT->getParamType(0)) ||
-        !isa<PointerType>(FT->getParamType(1)) ||
+        !FT->getParamType(0)->isPointerTy() ||
+        !FT->getParamType(1)->isPointerTy() ||
         FT->getParamType(2) != TD->getIntPtrType(*Context))
       return 0;
 
     // memmove(x, y, n) -> llvm.memmove(x, y, n, 1)
-    EmitMemMove(CI->getOperand(1), CI->getOperand(2), CI->getOperand(3), 1, B);
+    EmitMemMove(CI->getOperand(1), CI->getOperand(2),
+                CI->getOperand(3), 1, B, TD);
     return CI->getOperand(1);
   }
 };
@@ -1097,137 +619,20 @@ struct MemSetOpt : public LibCallOptimization {
 
     const FunctionType *FT = Callee->getFunctionType();
     if (FT->getNumParams() != 3 || FT->getReturnType() != FT->getParamType(0) ||
-        !isa<PointerType>(FT->getParamType(0)) ||
-        !isa<IntegerType>(FT->getParamType(1)) ||
+        !FT->getParamType(0)->isPointerTy() ||
+        !FT->getParamType(1)->isIntegerTy() ||
         FT->getParamType(2) != TD->getIntPtrType(*Context))
       return 0;
 
     // memset(p, v, n) -> llvm.memset(p, v, n, 1)
     Value *Val = B.CreateIntCast(CI->getOperand(2), Type::getInt8Ty(*Context),
 				 false);
-    EmitMemSet(CI->getOperand(1), Val,  CI->getOperand(3), B);
+    EmitMemSet(CI->getOperand(1), Val,  CI->getOperand(3), B, TD);
     return CI->getOperand(1);
   }
 };
 
 //===----------------------------------------------------------------------===//
-// Object Size Checking Optimizations
-//===----------------------------------------------------------------------===//
-
-//===---------------------------------------===//
-// 'memcpy_chk' Optimizations
-
-struct MemCpyChkOpt : public LibCallOptimization {
-  virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) {
-    // These optimizations require TargetData.
-    if (!TD) return 0;
-
-    const FunctionType *FT = Callee->getFunctionType();
-    if (FT->getNumParams() != 4 || FT->getReturnType() != FT->getParamType(0) ||
-        !isa<PointerType>(FT->getParamType(0)) ||
-        !isa<PointerType>(FT->getParamType(1)) ||
-        !isa<IntegerType>(FT->getParamType(3)) ||
-        FT->getParamType(2) != TD->getIntPtrType(*Context))
-      return 0;
-
-    ConstantInt *SizeCI = dyn_cast<ConstantInt>(CI->getOperand(4));
-    if (!SizeCI)
-      return 0;
-    if (SizeCI->isAllOnesValue()) {
-      EmitMemCpy(CI->getOperand(1), CI->getOperand(2), CI->getOperand(3), 1, B);
-      return CI->getOperand(1);
-    }
-
-    return 0;
-  }
-};
-
-//===---------------------------------------===//
-// 'memset_chk' Optimizations
-
-struct MemSetChkOpt : public LibCallOptimization {
-  virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) {
-    // These optimizations require TargetData.
-    if (!TD) return 0;
-
-    const FunctionType *FT = Callee->getFunctionType();
-    if (FT->getNumParams() != 4 || FT->getReturnType() != FT->getParamType(0) ||
-        !isa<PointerType>(FT->getParamType(0)) ||
-        !isa<IntegerType>(FT->getParamType(1)) ||
-        !isa<IntegerType>(FT->getParamType(3)) ||
-        FT->getParamType(2) != TD->getIntPtrType(*Context))
-      return 0;
-
-    ConstantInt *SizeCI = dyn_cast<ConstantInt>(CI->getOperand(4));
-    if (!SizeCI)
-      return 0;
-    if (SizeCI->isAllOnesValue()) {
-      Value *Val = B.CreateIntCast(CI->getOperand(2), Type::getInt8Ty(*Context),
-				   false);
-      EmitMemSet(CI->getOperand(1), Val,  CI->getOperand(3), B);
-      return CI->getOperand(1);
-    }
-
-    return 0;
-  }
-};
-
-//===---------------------------------------===//
-// 'memmove_chk' Optimizations
-
-struct MemMoveChkOpt : public LibCallOptimization {
-  virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) {
-    // These optimizations require TargetData.
-    if (!TD) return 0;
-
-    const FunctionType *FT = Callee->getFunctionType();
-    if (FT->getNumParams() != 4 || FT->getReturnType() != FT->getParamType(0) ||
-        !isa<PointerType>(FT->getParamType(0)) ||
-        !isa<PointerType>(FT->getParamType(1)) ||
-        !isa<IntegerType>(FT->getParamType(3)) ||
-        FT->getParamType(2) != TD->getIntPtrType(*Context))
-      return 0;
-
-    ConstantInt *SizeCI = dyn_cast<ConstantInt>(CI->getOperand(4));
-    if (!SizeCI)
-      return 0;
-    if (SizeCI->isAllOnesValue()) {
-      EmitMemMove(CI->getOperand(1), CI->getOperand(2), CI->getOperand(3),
-		  1, B);
-      return CI->getOperand(1);
-    }
-
-    return 0;
-  }
-};
-
-struct StrCpyChkOpt : public LibCallOptimization {
-  virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) {
-    const FunctionType *FT = Callee->getFunctionType();
-    if (FT->getNumParams() != 3 || FT->getReturnType() != FT->getParamType(0) ||
-        !isa<PointerType>(FT->getParamType(0)) ||
-        !isa<PointerType>(FT->getParamType(1)))
-      return 0;
-
-    ConstantInt *SizeCI = dyn_cast<ConstantInt>(CI->getOperand(3));
-    if (!SizeCI)
-      return 0;
-    
-    // If a) we don't have any length information, or b) we know this will
-    // fit then just lower to a plain strcpy. Otherwise we'll keep our
-    // strcpy_chk call which may fail at runtime if the size is too long.
-    // TODO: It might be nice to get a maximum length out of the possible
-    // string lengths for varying.
-    if (SizeCI->isAllOnesValue() ||
-        SizeCI->getZExtValue() >= GetStringLength(CI->getOperand(2)))
-      return EmitStrCpy(CI->getOperand(1), CI->getOperand(2), B);
-
-    return 0;
-  }
-};
-
-  
-//===----------------------------------------------------------------------===//
 // Math Library Optimizations
 //===----------------------------------------------------------------------===//
 
@@ -1241,7 +646,7 @@ struct PowOpt : public LibCallOptimization {
     // result type.
     if (FT->getNumParams() != 2 || FT->getReturnType() != FT->getParamType(0) ||
         FT->getParamType(0) != FT->getParamType(1) ||
-        !FT->getParamType(0)->isFloatingPoint())
+        !FT->getParamType(0)->isFloatingPointTy())
       return 0;
 
     Value *Op1 = CI->getOperand(1), *Op2 = CI->getOperand(2);
@@ -1295,7 +700,7 @@ struct Exp2Opt : public LibCallOptimization {
     // Just make sure this has 1 argument of FP type, which matches the
     // result type.
     if (FT->getNumParams() != 1 || FT->getReturnType() != FT->getParamType(0) ||
-        !FT->getParamType(0)->isFloatingPoint())
+        !FT->getParamType(0)->isFloatingPointTy())
       return 0;
 
     Value *Op = CI->getOperand(1);
@@ -1375,8 +780,8 @@ struct FFSOpt : public LibCallOptimization {
     // Just make sure this has 2 arguments of the same FP type, which match the
     // result type.
     if (FT->getNumParams() != 1 ||
-	!FT->getReturnType()->isInteger(32) ||
-        !isa<IntegerType>(FT->getParamType(0)))
+	!FT->getReturnType()->isIntegerTy(32) ||
+        !FT->getParamType(0)->isIntegerTy())
       return 0;
 
     Value *Op = CI->getOperand(1);
@@ -1410,8 +815,8 @@ struct IsDigitOpt : public LibCallOptimization {
   virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) {
     const FunctionType *FT = Callee->getFunctionType();
     // We require integer(i32)
-    if (FT->getNumParams() != 1 || !isa<IntegerType>(FT->getReturnType()) ||
-        !FT->getParamType(0)->isInteger(32))
+    if (FT->getNumParams() != 1 || !FT->getReturnType()->isIntegerTy() ||
+        !FT->getParamType(0)->isIntegerTy(32))
       return 0;
 
     // isdigit(c) -> (c-'0') <u 10
@@ -1431,8 +836,8 @@ struct IsAsciiOpt : public LibCallOptimization {
   virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) {
     const FunctionType *FT = Callee->getFunctionType();
     // We require integer(i32)
-    if (FT->getNumParams() != 1 || !isa<IntegerType>(FT->getReturnType()) ||
-        !FT->getParamType(0)->isInteger(32))
+    if (FT->getNumParams() != 1 || !FT->getReturnType()->isIntegerTy() ||
+        !FT->getParamType(0)->isIntegerTy(32))
       return 0;
 
     // isascii(c) -> c <u 128
@@ -1450,7 +855,7 @@ struct AbsOpt : public LibCallOptimization {
   virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) {
     const FunctionType *FT = Callee->getFunctionType();
     // We require integer(integer) where the types agree.
-    if (FT->getNumParams() != 1 || !isa<IntegerType>(FT->getReturnType()) ||
+    if (FT->getNumParams() != 1 || !FT->getReturnType()->isIntegerTy() ||
         FT->getParamType(0) != FT->getReturnType())
       return 0;
 
@@ -1473,7 +878,7 @@ struct ToAsciiOpt : public LibCallOptimization {
     const FunctionType *FT = Callee->getFunctionType();
     // We require i32(i32)
     if (FT->getNumParams() != 1 || FT->getReturnType() != FT->getParamType(0) ||
-        !FT->getParamType(0)->isInteger(32))
+        !FT->getParamType(0)->isIntegerTy(32))
       return 0;
 
     // isascii(c) -> c & 0x7f
@@ -1493,8 +898,8 @@ struct PrintFOpt : public LibCallOptimization {
   virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) {
     // Require one fixed pointer argument and an integer/void result.
     const FunctionType *FT = Callee->getFunctionType();
-    if (FT->getNumParams() < 1 || !isa<PointerType>(FT->getParamType(0)) ||
-        !(isa<IntegerType>(FT->getReturnType()) ||
+    if (FT->getNumParams() < 1 || !FT->getParamType(0)->isPointerTy() ||
+        !(FT->getReturnType()->isIntegerTy() ||
           FT->getReturnType()->isVoidTy()))
       return 0;
 
@@ -1512,7 +917,7 @@ struct PrintFOpt : public LibCallOptimization {
     // in case there is an error writing to stdout.
     if (FormatStr.size() == 1) {
       Value *Res = EmitPutChar(ConstantInt::get(Type::getInt32Ty(*Context),
-                                                FormatStr[0]), B);
+                                                FormatStr[0]), B, TD);
       if (CI->use_empty()) return CI;
       return B.CreateIntCast(Res, CI->getType(), true);
     }
@@ -1526,7 +931,7 @@ struct PrintFOpt : public LibCallOptimization {
       Constant *C = ConstantArray::get(*Context, FormatStr, true);
       C = new GlobalVariable(*Callee->getParent(), C->getType(), true,
                              GlobalVariable::InternalLinkage, C, "str");
-      EmitPutS(C, B);
+      EmitPutS(C, B, TD);
       return CI->use_empty() ? (Value*)CI :
                     ConstantInt::get(CI->getType(), FormatStr.size()+1);
     }
@@ -1534,8 +939,8 @@ struct PrintFOpt : public LibCallOptimization {
     // Optimize specific format strings.
     // printf("%c", chr) --> putchar(*(i8*)dst)
     if (FormatStr == "%c" && CI->getNumOperands() > 2 &&
-        isa<IntegerType>(CI->getOperand(2)->getType())) {
-      Value *Res = EmitPutChar(CI->getOperand(2), B);
+        CI->getOperand(2)->getType()->isIntegerTy()) {
+      Value *Res = EmitPutChar(CI->getOperand(2), B, TD);
 
       if (CI->use_empty()) return CI;
       return B.CreateIntCast(Res, CI->getType(), true);
@@ -1543,9 +948,9 @@ struct PrintFOpt : public LibCallOptimization {
 
     // printf("%s\n", str) --> puts(str)
     if (FormatStr == "%s\n" && CI->getNumOperands() > 2 &&
-        isa<PointerType>(CI->getOperand(2)->getType()) &&
+        CI->getOperand(2)->getType()->isPointerTy() &&
         CI->use_empty()) {
-      EmitPutS(CI->getOperand(2), B);
+      EmitPutS(CI->getOperand(2), B, TD);
       return CI;
     }
     return 0;
@@ -1559,9 +964,9 @@ struct SPrintFOpt : public LibCallOptimization {
   virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) {
     // Require two fixed pointer arguments and an integer result.
     const FunctionType *FT = Callee->getFunctionType();
-    if (FT->getNumParams() != 2 || !isa<PointerType>(FT->getParamType(0)) ||
-        !isa<PointerType>(FT->getParamType(1)) ||
-        !isa<IntegerType>(FT->getReturnType()))
+    if (FT->getNumParams() != 2 || !FT->getParamType(0)->isPointerTy() ||
+        !FT->getParamType(1)->isPointerTy() ||
+        !FT->getReturnType()->isIntegerTy())
       return 0;
 
     // Check for a fixed format string.
@@ -1582,8 +987,8 @@ struct SPrintFOpt : public LibCallOptimization {
 
       // sprintf(str, fmt) -> llvm.memcpy(str, fmt, strlen(fmt)+1, 1)
       EmitMemCpy(CI->getOperand(1), CI->getOperand(2), // Copy the nul byte.
-          ConstantInt::get
-                 (TD->getIntPtrType(*Context), FormatStr.size()+1),1,B);
+                 ConstantInt::get(TD->getIntPtrType(*Context),
+                 FormatStr.size()+1), 1, B, TD);
       return ConstantInt::get(CI->getType(), FormatStr.size());
     }
 
@@ -1595,7 +1000,7 @@ struct SPrintFOpt : public LibCallOptimization {
     // Decode the second character of the format string.
     if (FormatStr[1] == 'c') {
       // sprintf(dst, "%c", chr) --> *(i8*)dst = chr; *((i8*)dst+1) = 0
-      if (!isa<IntegerType>(CI->getOperand(3)->getType())) return 0;
+      if (!CI->getOperand(3)->getType()->isIntegerTy()) return 0;
       Value *V = B.CreateTrunc(CI->getOperand(3),
 			       Type::getInt8Ty(*Context), "char");
       Value *Ptr = CastToCStr(CI->getOperand(1), B);
@@ -1612,13 +1017,13 @@ struct SPrintFOpt : public LibCallOptimization {
       if (!TD) return 0;
 
       // sprintf(dest, "%s", str) -> llvm.memcpy(dest, str, strlen(str)+1, 1)
-      if (!isa<PointerType>(CI->getOperand(3)->getType())) return 0;
+      if (!CI->getOperand(3)->getType()->isPointerTy()) return 0;
 
-      Value *Len = EmitStrLen(CI->getOperand(3), B);
+      Value *Len = EmitStrLen(CI->getOperand(3), B, TD);
       Value *IncLen = B.CreateAdd(Len,
                                   ConstantInt::get(Len->getType(), 1),
                                   "leninc");
-      EmitMemCpy(CI->getOperand(1), CI->getOperand(3), IncLen, 1, B);
+      EmitMemCpy(CI->getOperand(1), CI->getOperand(3), IncLen, 1, B, TD);
 
       // The sprintf result is the unincremented number of bytes in the string.
       return B.CreateIntCast(Len, CI->getType(), false);
@@ -1634,11 +1039,11 @@ struct FWriteOpt : public LibCallOptimization {
   virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) {
     // Require a pointer, an integer, an integer, a pointer, returning integer.
     const FunctionType *FT = Callee->getFunctionType();
-    if (FT->getNumParams() != 4 || !isa<PointerType>(FT->getParamType(0)) ||
-        !isa<IntegerType>(FT->getParamType(1)) ||
-        !isa<IntegerType>(FT->getParamType(2)) ||
-        !isa<PointerType>(FT->getParamType(3)) ||
-        !isa<IntegerType>(FT->getReturnType()))
+    if (FT->getNumParams() != 4 || !FT->getParamType(0)->isPointerTy() ||
+        !FT->getParamType(1)->isIntegerTy() ||
+        !FT->getParamType(2)->isIntegerTy() ||
+        !FT->getParamType(3)->isPointerTy() ||
+        !FT->getReturnType()->isIntegerTy())
       return 0;
 
     // Get the element size and count.
@@ -1654,7 +1059,7 @@ struct FWriteOpt : public LibCallOptimization {
     // If this is writing one byte, turn it into fputc.
     if (Bytes == 1) {  // fwrite(S,1,1,F) -> fputc(S[0],F)
       Value *Char = B.CreateLoad(CastToCStr(CI->getOperand(1), B), "char");
-      EmitFPutC(Char, CI->getOperand(4), B);
+      EmitFPutC(Char, CI->getOperand(4), B, TD);
       return ConstantInt::get(CI->getType(), 1);
     }
 
@@ -1672,8 +1077,8 @@ struct FPutsOpt : public LibCallOptimization {
 
     // Require two pointers.  Also, we can't optimize if return value is used.
     const FunctionType *FT = Callee->getFunctionType();
-    if (FT->getNumParams() != 2 || !isa<PointerType>(FT->getParamType(0)) ||
-        !isa<PointerType>(FT->getParamType(1)) ||
+    if (FT->getNumParams() != 2 || !FT->getParamType(0)->isPointerTy() ||
+        !FT->getParamType(1)->isPointerTy() ||
         !CI->use_empty())
       return 0;
 
@@ -1682,7 +1087,7 @@ struct FPutsOpt : public LibCallOptimization {
     if (!Len) return 0;
     EmitFWrite(CI->getOperand(1),
                ConstantInt::get(TD->getIntPtrType(*Context), Len-1),
-               CI->getOperand(2), B);
+               CI->getOperand(2), B, TD);
     return CI;  // Known to have no uses (see above).
   }
 };
@@ -1694,9 +1099,9 @@ struct FPrintFOpt : public LibCallOptimization {
   virtual Value *CallOptimizer(Function *Callee, CallInst *CI, IRBuilder<> &B) {
     // Require two fixed paramters as pointers and integer result.
     const FunctionType *FT = Callee->getFunctionType();
-    if (FT->getNumParams() != 2 || !isa<PointerType>(FT->getParamType(0)) ||
-        !isa<PointerType>(FT->getParamType(1)) ||
-        !isa<IntegerType>(FT->getReturnType()))
+    if (FT->getNumParams() != 2 || !FT->getParamType(0)->isPointerTy() ||
+        !FT->getParamType(1)->isPointerTy() ||
+        !FT->getReturnType()->isIntegerTy())
       return 0;
 
     // All the optimizations depend on the format string.
@@ -1716,7 +1121,7 @@ struct FPrintFOpt : public LibCallOptimization {
       EmitFWrite(CI->getOperand(2),
                  ConstantInt::get(TD->getIntPtrType(*Context),
                                   FormatStr.size()),
-                 CI->getOperand(1), B);
+                 CI->getOperand(1), B, TD);
       return ConstantInt::get(CI->getType(), FormatStr.size());
     }
 
@@ -1728,16 +1133,16 @@ struct FPrintFOpt : public LibCallOptimization {
     // Decode the second character of the format string.
     if (FormatStr[1] == 'c') {
       // fprintf(F, "%c", chr) --> *(i8*)dst = chr
-      if (!isa<IntegerType>(CI->getOperand(3)->getType())) return 0;
-      EmitFPutC(CI->getOperand(3), CI->getOperand(1), B);
+      if (!CI->getOperand(3)->getType()->isIntegerTy()) return 0;
+      EmitFPutC(CI->getOperand(3), CI->getOperand(1), B, TD);
       return ConstantInt::get(CI->getType(), 1);
     }
 
     if (FormatStr[1] == 's') {
       // fprintf(F, "%s", str) -> fputs(str, F)
-      if (!isa<PointerType>(CI->getOperand(3)->getType()) || !CI->use_empty())
+      if (!CI->getOperand(3)->getType()->isPointerTy() || !CI->use_empty())
         return 0;
-      EmitFPutS(CI->getOperand(3), CI->getOperand(1), B);
+      EmitFPutS(CI->getOperand(3), CI->getOperand(1), B, TD);
       return CI;
     }
     return 0;
@@ -1769,10 +1174,6 @@ namespace {
     SPrintFOpt SPrintF; PrintFOpt PrintF;
     FWriteOpt FWrite; FPutsOpt FPuts; FPrintFOpt FPrintF;
 
-    // Object Size Checking
-    MemCpyChkOpt MemCpyChk; MemSetChkOpt MemSetChk; MemMoveChkOpt MemMoveChk;
-    StrCpyChkOpt StrCpyChk;
-
     bool Modified;  // This is only used by doInitialization.
   public:
     static char ID; // Pass identification
@@ -1878,12 +1279,6 @@ void SimplifyLibCalls::InitOptimizations() {
   Optimizations["fwrite"] = &FWrite;
   Optimizations["fputs"] = &FPuts;
   Optimizations["fprintf"] = &FPrintF;
-
-  // Object Size Checking
-  Optimizations["__memcpy_chk"] = &MemCpyChk;
-  Optimizations["__memset_chk"] = &MemSetChk;
-  Optimizations["__memmove_chk"] = &MemMoveChk;
-  Optimizations["__strcpy_chk"] = &StrCpyChk;
 }
 
 
@@ -2000,7 +1395,7 @@ bool SimplifyLibCalls::doInitialization(Module &M) {
       case 's':
         if (Name == "strlen") {
           if (FTy->getNumParams() != 1 ||
-              !isa<PointerType>(FTy->getParamType(0)))
+              !FTy->getParamType(0)->isPointerTy())
             continue;
           setOnlyReadsMemory(F);
           setDoesNotThrow(F);
@@ -2018,14 +1413,14 @@ bool SimplifyLibCalls::doInitialization(Module &M) {
                    Name == "strncpy" ||
                    Name == "strtoull") {
           if (FTy->getNumParams() < 2 ||
-              !isa<PointerType>(FTy->getParamType(1)))
+              !FTy->getParamType(1)->isPointerTy())
             continue;
           setDoesNotThrow(F);
           setDoesNotCapture(F, 2);
         } else if (Name == "strxfrm") {
           if (FTy->getNumParams() != 3 ||
-              !isa<PointerType>(FTy->getParamType(0)) ||
-              !isa<PointerType>(FTy->getParamType(1)))
+              !FTy->getParamType(0)->isPointerTy() ||
+              !FTy->getParamType(1)->isPointerTy())
             continue;
           setDoesNotThrow(F);
           setDoesNotCapture(F, 1);
@@ -2038,8 +1433,8 @@ bool SimplifyLibCalls::doInitialization(Module &M) {
                    Name == "strcasecmp" ||
                    Name == "strncasecmp") {
           if (FTy->getNumParams() < 2 ||
-              !isa<PointerType>(FTy->getParamType(0)) ||
-              !isa<PointerType>(FTy->getParamType(1)))
+              !FTy->getParamType(0)->isPointerTy() ||
+              !FTy->getParamType(1)->isPointerTy())
             continue;
           setOnlyReadsMemory(F);
           setDoesNotThrow(F);
@@ -2048,7 +1443,7 @@ bool SimplifyLibCalls::doInitialization(Module &M) {
         } else if (Name == "strstr" ||
                    Name == "strpbrk") {
           if (FTy->getNumParams() != 2 ||
-              !isa<PointerType>(FTy->getParamType(1)))
+              !FTy->getParamType(1)->isPointerTy())
             continue;
           setOnlyReadsMemory(F);
           setDoesNotThrow(F);
@@ -2056,7 +1451,7 @@ bool SimplifyLibCalls::doInitialization(Module &M) {
         } else if (Name == "strtok" ||
                    Name == "strtok_r") {
           if (FTy->getNumParams() < 2 ||
-              !isa<PointerType>(FTy->getParamType(1)))
+              !FTy->getParamType(1)->isPointerTy())
             continue;
           setDoesNotThrow(F);
           setDoesNotCapture(F, 2);
@@ -2064,15 +1459,15 @@ bool SimplifyLibCalls::doInitialization(Module &M) {
                    Name == "setbuf" ||
                    Name == "setvbuf") {
           if (FTy->getNumParams() < 1 ||
-              !isa<PointerType>(FTy->getParamType(0)))
+              !FTy->getParamType(0)->isPointerTy())
             continue;
           setDoesNotThrow(F);
           setDoesNotCapture(F, 1);
         } else if (Name == "strdup" ||
                    Name == "strndup") {
           if (FTy->getNumParams() < 1 ||
-              !isa<PointerType>(FTy->getReturnType()) ||
-              !isa<PointerType>(FTy->getParamType(0)))
+              !FTy->getReturnType()->isPointerTy() ||
+              !FTy->getParamType(0)->isPointerTy())
             continue;
           setDoesNotThrow(F);
           setDoesNotAlias(F, 0);
@@ -2082,31 +1477,31 @@ bool SimplifyLibCalls::doInitialization(Module &M) {
                    Name == "sprintf" ||
                    Name == "statvfs") {
           if (FTy->getNumParams() < 2 ||
-              !isa<PointerType>(FTy->getParamType(0)) ||
-              !isa<PointerType>(FTy->getParamType(1)))
+              !FTy->getParamType(0)->isPointerTy() ||
+              !FTy->getParamType(1)->isPointerTy())
             continue;
           setDoesNotThrow(F);
           setDoesNotCapture(F, 1);
           setDoesNotCapture(F, 2);
         } else if (Name == "snprintf") {
           if (FTy->getNumParams() != 3 ||
-              !isa<PointerType>(FTy->getParamType(0)) ||
-              !isa<PointerType>(FTy->getParamType(2)))
+              !FTy->getParamType(0)->isPointerTy() ||
+              !FTy->getParamType(2)->isPointerTy())
             continue;
           setDoesNotThrow(F);
           setDoesNotCapture(F, 1);
           setDoesNotCapture(F, 3);
         } else if (Name == "setitimer") {
           if (FTy->getNumParams() != 3 ||
-              !isa<PointerType>(FTy->getParamType(1)) ||
-              !isa<PointerType>(FTy->getParamType(2)))
+              !FTy->getParamType(1)->isPointerTy() ||
+              !FTy->getParamType(2)->isPointerTy())
             continue;
           setDoesNotThrow(F);
           setDoesNotCapture(F, 2);
           setDoesNotCapture(F, 3);
         } else if (Name == "system") {
           if (FTy->getNumParams() != 1 ||
-              !isa<PointerType>(FTy->getParamType(0)))
+              !FTy->getParamType(0)->isPointerTy())
             continue;
           // May throw; "system" is a valid pthread cancellation point.
           setDoesNotCapture(F, 1);
@@ -2115,14 +1510,14 @@ bool SimplifyLibCalls::doInitialization(Module &M) {
       case 'm':
         if (Name == "malloc") {
           if (FTy->getNumParams() != 1 ||
-              !isa<PointerType>(FTy->getReturnType()))
+              !FTy->getReturnType()->isPointerTy())
             continue;
           setDoesNotThrow(F);
           setDoesNotAlias(F, 0);
         } else if (Name == "memcmp") {
           if (FTy->getNumParams() != 3 ||
-              !isa<PointerType>(FTy->getParamType(0)) ||
-              !isa<PointerType>(FTy->getParamType(1)))
+              !FTy->getParamType(0)->isPointerTy() ||
+              !FTy->getParamType(1)->isPointerTy())
             continue;
           setOnlyReadsMemory(F);
           setDoesNotThrow(F);
@@ -2141,18 +1536,18 @@ bool SimplifyLibCalls::doInitialization(Module &M) {
                    Name == "memccpy" ||
                    Name == "memmove") {
           if (FTy->getNumParams() < 2 ||
-              !isa<PointerType>(FTy->getParamType(1)))
+              !FTy->getParamType(1)->isPointerTy())
             continue;
           setDoesNotThrow(F);
           setDoesNotCapture(F, 2);
         } else if (Name == "memalign") {
-          if (!isa<PointerType>(FTy->getReturnType()))
+          if (!FTy->getReturnType()->isPointerTy())
             continue;
           setDoesNotAlias(F, 0);
         } else if (Name == "mkdir" ||
                    Name == "mktime") {
           if (FTy->getNumParams() == 0 ||
-              !isa<PointerType>(FTy->getParamType(0)))
+              !FTy->getParamType(0)->isPointerTy())
             continue;
           setDoesNotThrow(F);
           setDoesNotCapture(F, 1);
@@ -2161,15 +1556,15 @@ bool SimplifyLibCalls::doInitialization(Module &M) {
       case 'r':
         if (Name == "realloc") {
           if (FTy->getNumParams() != 2 ||
-              !isa<PointerType>(FTy->getParamType(0)) ||
-              !isa<PointerType>(FTy->getReturnType()))
+              !FTy->getParamType(0)->isPointerTy() ||
+              !FTy->getReturnType()->isPointerTy())
             continue;
           setDoesNotThrow(F);
           setDoesNotAlias(F, 0);
           setDoesNotCapture(F, 1);
         } else if (Name == "read") {
           if (FTy->getNumParams() != 3 ||
-              !isa<PointerType>(FTy->getParamType(1)))
+              !FTy->getParamType(1)->isPointerTy())
             continue;
           // May throw; "read" is a valid pthread cancellation point.
           setDoesNotCapture(F, 2);
@@ -2178,15 +1573,15 @@ bool SimplifyLibCalls::doInitialization(Module &M) {
                    Name == "remove" ||
                    Name == "realpath") {
           if (FTy->getNumParams() < 1 ||
-              !isa<PointerType>(FTy->getParamType(0)))
+              !FTy->getParamType(0)->isPointerTy())
             continue;
           setDoesNotThrow(F);
           setDoesNotCapture(F, 1);
         } else if (Name == "rename" ||
                    Name == "readlink") {
           if (FTy->getNumParams() < 2 ||
-              !isa<PointerType>(FTy->getParamType(0)) ||
-              !isa<PointerType>(FTy->getParamType(1)))
+              !FTy->getParamType(0)->isPointerTy() ||
+              !FTy->getParamType(1)->isPointerTy())
             continue;
           setDoesNotThrow(F);
           setDoesNotCapture(F, 1);
@@ -2196,7 +1591,7 @@ bool SimplifyLibCalls::doInitialization(Module &M) {
       case 'w':
         if (Name == "write") {
           if (FTy->getNumParams() != 3 ||
-              !isa<PointerType>(FTy->getParamType(1)))
+              !FTy->getParamType(1)->isPointerTy())
             continue;
           // May throw; "write" is a valid pthread cancellation point.
           setDoesNotCapture(F, 2);
@@ -2205,16 +1600,16 @@ bool SimplifyLibCalls::doInitialization(Module &M) {
       case 'b':
         if (Name == "bcopy") {
           if (FTy->getNumParams() != 3 ||
-              !isa<PointerType>(FTy->getParamType(0)) ||
-              !isa<PointerType>(FTy->getParamType(1)))
+              !FTy->getParamType(0)->isPointerTy() ||
+              !FTy->getParamType(1)->isPointerTy())
             continue;
           setDoesNotThrow(F);
           setDoesNotCapture(F, 1);
           setDoesNotCapture(F, 2);
         } else if (Name == "bcmp") {
           if (FTy->getNumParams() != 3 ||
-              !isa<PointerType>(FTy->getParamType(0)) ||
-              !isa<PointerType>(FTy->getParamType(1)))
+              !FTy->getParamType(0)->isPointerTy() ||
+              !FTy->getParamType(1)->isPointerTy())
             continue;
           setDoesNotThrow(F);
           setOnlyReadsMemory(F);
@@ -2222,7 +1617,7 @@ bool SimplifyLibCalls::doInitialization(Module &M) {
           setDoesNotCapture(F, 2);
         } else if (Name == "bzero") {
           if (FTy->getNumParams() != 2 ||
-              !isa<PointerType>(FTy->getParamType(0)))
+              !FTy->getParamType(0)->isPointerTy())
             continue;
           setDoesNotThrow(F);
           setDoesNotCapture(F, 1);
@@ -2231,7 +1626,7 @@ bool SimplifyLibCalls::doInitialization(Module &M) {
       case 'c':
         if (Name == "calloc") {
           if (FTy->getNumParams() != 2 ||
-              !isa<PointerType>(FTy->getReturnType()))
+              !FTy->getReturnType()->isPointerTy())
             continue;
           setDoesNotThrow(F);
           setDoesNotAlias(F, 0);
@@ -2241,7 +1636,7 @@ bool SimplifyLibCalls::doInitialization(Module &M) {
                    Name == "clearerr" ||
                    Name == "closedir") {
           if (FTy->getNumParams() == 0 ||
-              !isa<PointerType>(FTy->getParamType(0)))
+              !FTy->getParamType(0)->isPointerTy())
             continue;
           setDoesNotThrow(F);
           setDoesNotCapture(F, 1);
@@ -2253,14 +1648,14 @@ bool SimplifyLibCalls::doInitialization(Module &M) {
             Name == "atof" ||
             Name == "atoll") {
           if (FTy->getNumParams() != 1 ||
-              !isa<PointerType>(FTy->getParamType(0)))
+              !FTy->getParamType(0)->isPointerTy())
             continue;
           setDoesNotThrow(F);
           setOnlyReadsMemory(F);
           setDoesNotCapture(F, 1);
         } else if (Name == "access") {
           if (FTy->getNumParams() != 2 ||
-              !isa<PointerType>(FTy->getParamType(0)))
+              !FTy->getParamType(0)->isPointerTy())
             continue;
           setDoesNotThrow(F);
           setDoesNotCapture(F, 1);
@@ -2269,9 +1664,9 @@ bool SimplifyLibCalls::doInitialization(Module &M) {
       case 'f':
         if (Name == "fopen") {
           if (FTy->getNumParams() != 2 ||
-              !isa<PointerType>(FTy->getReturnType()) ||
-              !isa<PointerType>(FTy->getParamType(0)) ||
-              !isa<PointerType>(FTy->getParamType(1)))
+              !FTy->getReturnType()->isPointerTy() ||
+              !FTy->getParamType(0)->isPointerTy() ||
+              !FTy->getParamType(1)->isPointerTy())
             continue;
           setDoesNotThrow(F);
           setDoesNotAlias(F, 0);
@@ -2279,8 +1674,8 @@ bool SimplifyLibCalls::doInitialization(Module &M) {
           setDoesNotCapture(F, 2);
         } else if (Name == "fdopen") {
           if (FTy->getNumParams() != 2 ||
-              !isa<PointerType>(FTy->getReturnType()) ||
-              !isa<PointerType>(FTy->getParamType(1)))
+              !FTy->getReturnType()->isPointerTy() ||
+              !FTy->getParamType(1)->isPointerTy())
             continue;
           setDoesNotThrow(F);
           setDoesNotAlias(F, 0);
@@ -2300,13 +1695,13 @@ bool SimplifyLibCalls::doInitialization(Module &M) {
                    Name == "funlockfile" ||
                    Name == "ftrylockfile") {
           if (FTy->getNumParams() == 0 ||
-              !isa<PointerType>(FTy->getParamType(0)))
+              !FTy->getParamType(0)->isPointerTy())
             continue;
           setDoesNotThrow(F);
           setDoesNotCapture(F, 1);
         } else if (Name == "ferror") {
           if (FTy->getNumParams() != 1 ||
-              !isa<PointerType>(FTy->getParamType(0)))
+              !FTy->getParamType(0)->isPointerTy())
             continue;
           setDoesNotThrow(F);
           setDoesNotCapture(F, 1);
@@ -2318,22 +1713,22 @@ bool SimplifyLibCalls::doInitialization(Module &M) {
                    Name == "frexpl" ||
                    Name == "fstatvfs") {
           if (FTy->getNumParams() != 2 ||
-              !isa<PointerType>(FTy->getParamType(1)))
+              !FTy->getParamType(1)->isPointerTy())
             continue;
           setDoesNotThrow(F);
           setDoesNotCapture(F, 2);
         } else if (Name == "fgets") {
           if (FTy->getNumParams() != 3 ||
-              !isa<PointerType>(FTy->getParamType(0)) ||
-              !isa<PointerType>(FTy->getParamType(2)))
+              !FTy->getParamType(0)->isPointerTy() ||
+              !FTy->getParamType(2)->isPointerTy())
             continue;
           setDoesNotThrow(F);
           setDoesNotCapture(F, 3);
         } else if (Name == "fread" ||
                    Name == "fwrite") {
           if (FTy->getNumParams() != 4 ||
-              !isa<PointerType>(FTy->getParamType(0)) ||
-              !isa<PointerType>(FTy->getParamType(3)))
+              !FTy->getParamType(0)->isPointerTy() ||
+              !FTy->getParamType(3)->isPointerTy())
             continue;
           setDoesNotThrow(F);
           setDoesNotCapture(F, 1);
@@ -2343,8 +1738,8 @@ bool SimplifyLibCalls::doInitialization(Module &M) {
                    Name == "fprintf" ||
                    Name == "fgetpos") {
           if (FTy->getNumParams() < 2 ||
-              !isa<PointerType>(FTy->getParamType(0)) ||
-              !isa<PointerType>(FTy->getParamType(1)))
+              !FTy->getParamType(0)->isPointerTy() ||
+              !FTy->getParamType(1)->isPointerTy())
             continue;
           setDoesNotThrow(F);
           setDoesNotCapture(F, 1);
@@ -2356,13 +1751,13 @@ bool SimplifyLibCalls::doInitialization(Module &M) {
             Name == "getlogin_r" ||
             Name == "getc_unlocked") {
           if (FTy->getNumParams() == 0 ||
-              !isa<PointerType>(FTy->getParamType(0)))
+              !FTy->getParamType(0)->isPointerTy())
             continue;
           setDoesNotThrow(F);
           setDoesNotCapture(F, 1);
         } else if (Name == "getenv") {
           if (FTy->getNumParams() != 1 ||
-              !isa<PointerType>(FTy->getParamType(0)))
+              !FTy->getParamType(0)->isPointerTy())
             continue;
           setDoesNotThrow(F);
           setOnlyReadsMemory(F);
@@ -2372,13 +1767,13 @@ bool SimplifyLibCalls::doInitialization(Module &M) {
           setDoesNotThrow(F);
         } else if (Name == "getitimer") {
           if (FTy->getNumParams() != 2 ||
-              !isa<PointerType>(FTy->getParamType(1)))
+              !FTy->getParamType(1)->isPointerTy())
             continue;
           setDoesNotThrow(F);
           setDoesNotCapture(F, 2);
         } else if (Name == "getpwnam") {
           if (FTy->getNumParams() != 1 ||
-              !isa<PointerType>(FTy->getParamType(0)))
+              !FTy->getParamType(0)->isPointerTy())
             continue;
           setDoesNotThrow(F);
           setDoesNotCapture(F, 1);
@@ -2387,7 +1782,7 @@ bool SimplifyLibCalls::doInitialization(Module &M) {
       case 'u':
         if (Name == "ungetc") {
           if (FTy->getNumParams() != 2 ||
-              !isa<PointerType>(FTy->getParamType(1)))
+              !FTy->getParamType(1)->isPointerTy())
             continue;
           setDoesNotThrow(F);
           setDoesNotCapture(F, 2);
@@ -2395,15 +1790,15 @@ bool SimplifyLibCalls::doInitialization(Module &M) {
                    Name == "unlink" ||
                    Name == "unsetenv") {
           if (FTy->getNumParams() != 1 ||
-              !isa<PointerType>(FTy->getParamType(0)))
+              !FTy->getParamType(0)->isPointerTy())
             continue;
           setDoesNotThrow(F);
           setDoesNotCapture(F, 1);
         } else if (Name == "utime" ||
                    Name == "utimes") {
           if (FTy->getNumParams() != 2 ||
-              !isa<PointerType>(FTy->getParamType(0)) ||
-              !isa<PointerType>(FTy->getParamType(1)))
+              !FTy->getParamType(0)->isPointerTy() ||
+              !FTy->getParamType(1)->isPointerTy())
             continue;
           setDoesNotThrow(F);
           setDoesNotCapture(F, 1);
@@ -2413,7 +1808,7 @@ bool SimplifyLibCalls::doInitialization(Module &M) {
       case 'p':
         if (Name == "putc") {
           if (FTy->getNumParams() != 2 ||
-              !isa<PointerType>(FTy->getParamType(1)))
+              !FTy->getParamType(1)->isPointerTy())
             continue;
           setDoesNotThrow(F);
           setDoesNotCapture(F, 2);
@@ -2421,14 +1816,14 @@ bool SimplifyLibCalls::doInitialization(Module &M) {
                    Name == "printf" ||
                    Name == "perror") {
           if (FTy->getNumParams() != 1 ||
-              !isa<PointerType>(FTy->getParamType(0)))
+              !FTy->getParamType(0)->isPointerTy())
             continue;
           setDoesNotThrow(F);
           setDoesNotCapture(F, 1);
         } else if (Name == "pread" ||
                    Name == "pwrite") {
           if (FTy->getNumParams() != 4 ||
-              !isa<PointerType>(FTy->getParamType(1)))
+              !FTy->getParamType(1)->isPointerTy())
             continue;
           // May throw; these are valid pthread cancellation points.
           setDoesNotCapture(F, 2);
@@ -2436,9 +1831,9 @@ bool SimplifyLibCalls::doInitialization(Module &M) {
           setDoesNotThrow(F);
         } else if (Name == "popen") {
           if (FTy->getNumParams() != 2 ||
-              !isa<PointerType>(FTy->getReturnType()) ||
-              !isa<PointerType>(FTy->getParamType(0)) ||
-              !isa<PointerType>(FTy->getParamType(1)))
+              !FTy->getReturnType()->isPointerTy() ||
+              !FTy->getParamType(0)->isPointerTy() ||
+              !FTy->getParamType(1)->isPointerTy())
             continue;
           setDoesNotThrow(F);
           setDoesNotAlias(F, 0);
@@ -2446,7 +1841,7 @@ bool SimplifyLibCalls::doInitialization(Module &M) {
           setDoesNotCapture(F, 2);
         } else if (Name == "pclose") {
           if (FTy->getNumParams() != 1 ||
-              !isa<PointerType>(FTy->getParamType(0)))
+              !FTy->getParamType(0)->isPointerTy())
             continue;
           setDoesNotThrow(F);
           setDoesNotCapture(F, 1);
@@ -2455,43 +1850,43 @@ bool SimplifyLibCalls::doInitialization(Module &M) {
       case 'v':
         if (Name == "vscanf") {
           if (FTy->getNumParams() != 2 ||
-              !isa<PointerType>(FTy->getParamType(1)))
+              !FTy->getParamType(1)->isPointerTy())
             continue;
           setDoesNotThrow(F);
           setDoesNotCapture(F, 1);
         } else if (Name == "vsscanf" ||
                    Name == "vfscanf") {
           if (FTy->getNumParams() != 3 ||
-              !isa<PointerType>(FTy->getParamType(1)) ||
-              !isa<PointerType>(FTy->getParamType(2)))
+              !FTy->getParamType(1)->isPointerTy() ||
+              !FTy->getParamType(2)->isPointerTy())
             continue;
           setDoesNotThrow(F);
           setDoesNotCapture(F, 1);
           setDoesNotCapture(F, 2);
         } else if (Name == "valloc") {
-          if (!isa<PointerType>(FTy->getReturnType()))
+          if (!FTy->getReturnType()->isPointerTy())
             continue;
           setDoesNotThrow(F);
           setDoesNotAlias(F, 0);
         } else if (Name == "vprintf") {
           if (FTy->getNumParams() != 2 ||
-              !isa<PointerType>(FTy->getParamType(0)))
+              !FTy->getParamType(0)->isPointerTy())
             continue;
           setDoesNotThrow(F);
           setDoesNotCapture(F, 1);
         } else if (Name == "vfprintf" ||
                    Name == "vsprintf") {
           if (FTy->getNumParams() != 3 ||
-              !isa<PointerType>(FTy->getParamType(0)) ||
-              !isa<PointerType>(FTy->getParamType(1)))
+              !FTy->getParamType(0)->isPointerTy() ||
+              !FTy->getParamType(1)->isPointerTy())
             continue;
           setDoesNotThrow(F);
           setDoesNotCapture(F, 1);
           setDoesNotCapture(F, 2);
         } else if (Name == "vsnprintf") {
           if (FTy->getNumParams() != 4 ||
-              !isa<PointerType>(FTy->getParamType(0)) ||
-              !isa<PointerType>(FTy->getParamType(2)))
+              !FTy->getParamType(0)->isPointerTy() ||
+              !FTy->getParamType(2)->isPointerTy())
             continue;
           setDoesNotThrow(F);
           setDoesNotCapture(F, 1);
@@ -2501,14 +1896,14 @@ bool SimplifyLibCalls::doInitialization(Module &M) {
       case 'o':
         if (Name == "open") {
           if (FTy->getNumParams() < 2 ||
-              !isa<PointerType>(FTy->getParamType(0)))
+              !FTy->getParamType(0)->isPointerTy())
             continue;
           // May throw; "open" is a valid pthread cancellation point.
           setDoesNotCapture(F, 1);
         } else if (Name == "opendir") {
           if (FTy->getNumParams() != 1 ||
-              !isa<PointerType>(FTy->getReturnType()) ||
-              !isa<PointerType>(FTy->getParamType(0)))
+              !FTy->getReturnType()->isPointerTy() ||
+              !FTy->getParamType(0)->isPointerTy())
             continue;
           setDoesNotThrow(F);
           setDoesNotAlias(F, 0);
@@ -2517,13 +1912,13 @@ bool SimplifyLibCalls::doInitialization(Module &M) {
         break;
       case 't':
         if (Name == "tmpfile") {
-          if (!isa<PointerType>(FTy->getReturnType()))
+          if (!FTy->getReturnType()->isPointerTy())
             continue;
           setDoesNotThrow(F);
           setDoesNotAlias(F, 0);
         } else if (Name == "times") {
           if (FTy->getNumParams() != 1 ||
-              !isa<PointerType>(FTy->getParamType(0)))
+              !FTy->getParamType(0)->isPointerTy())
             continue;
           setDoesNotThrow(F);
           setDoesNotCapture(F, 1);
@@ -2546,15 +1941,15 @@ bool SimplifyLibCalls::doInitialization(Module &M) {
       case 'l':
         if (Name == "lstat") {
           if (FTy->getNumParams() != 2 ||
-              !isa<PointerType>(FTy->getParamType(0)) ||
-              !isa<PointerType>(FTy->getParamType(1)))
+              !FTy->getParamType(0)->isPointerTy() ||
+              !FTy->getParamType(1)->isPointerTy())
             continue;
           setDoesNotThrow(F);
           setDoesNotCapture(F, 1);
           setDoesNotCapture(F, 2);
         } else if (Name == "lchown") {
           if (FTy->getNumParams() != 3 ||
-              !isa<PointerType>(FTy->getParamType(0)))
+              !FTy->getParamType(0)->isPointerTy())
             continue;
           setDoesNotThrow(F);
           setDoesNotCapture(F, 1);
@@ -2563,7 +1958,7 @@ bool SimplifyLibCalls::doInitialization(Module &M) {
       case 'q':
         if (Name == "qsort") {
           if (FTy->getNumParams() != 4 ||
-              !isa<PointerType>(FTy->getParamType(3)))
+              !FTy->getParamType(3)->isPointerTy())
             continue;
           // May throw; places call through function pointer.
           setDoesNotCapture(F, 4);
@@ -2573,27 +1968,27 @@ bool SimplifyLibCalls::doInitialization(Module &M) {
         if (Name == "__strdup" ||
             Name == "__strndup") {
           if (FTy->getNumParams() < 1 ||
-              !isa<PointerType>(FTy->getReturnType()) ||
-              !isa<PointerType>(FTy->getParamType(0)))
+              !FTy->getReturnType()->isPointerTy() ||
+              !FTy->getParamType(0)->isPointerTy())
             continue;
           setDoesNotThrow(F);
           setDoesNotAlias(F, 0);
           setDoesNotCapture(F, 1);
         } else if (Name == "__strtok_r") {
           if (FTy->getNumParams() != 3 ||
-              !isa<PointerType>(FTy->getParamType(1)))
+              !FTy->getParamType(1)->isPointerTy())
             continue;
           setDoesNotThrow(F);
           setDoesNotCapture(F, 2);
         } else if (Name == "_IO_getc") {
           if (FTy->getNumParams() != 1 ||
-              !isa<PointerType>(FTy->getParamType(0)))
+              !FTy->getParamType(0)->isPointerTy())
             continue;
           setDoesNotThrow(F);
           setDoesNotCapture(F, 1);
         } else if (Name == "_IO_putc") {
           if (FTy->getNumParams() != 2 ||
-              !isa<PointerType>(FTy->getParamType(1)))
+              !FTy->getParamType(1)->isPointerTy())
             continue;
           setDoesNotThrow(F);
           setDoesNotCapture(F, 2);
@@ -2602,7 +1997,7 @@ bool SimplifyLibCalls::doInitialization(Module &M) {
       case 1:
         if (Name == "\1__isoc99_scanf") {
           if (FTy->getNumParams() < 1 ||
-              !isa<PointerType>(FTy->getParamType(0)))
+              !FTy->getParamType(0)->isPointerTy())
             continue;
           setDoesNotThrow(F);
           setDoesNotCapture(F, 1);
@@ -2611,17 +2006,17 @@ bool SimplifyLibCalls::doInitialization(Module &M) {
                    Name == "\1statvfs64" ||
                    Name == "\1__isoc99_sscanf") {
           if (FTy->getNumParams() < 1 ||
-              !isa<PointerType>(FTy->getParamType(0)) ||
-              !isa<PointerType>(FTy->getParamType(1)))
+              !FTy->getParamType(0)->isPointerTy() ||
+              !FTy->getParamType(1)->isPointerTy())
             continue;
           setDoesNotThrow(F);
           setDoesNotCapture(F, 1);
           setDoesNotCapture(F, 2);
         } else if (Name == "\1fopen64") {
           if (FTy->getNumParams() != 2 ||
-              !isa<PointerType>(FTy->getReturnType()) ||
-              !isa<PointerType>(FTy->getParamType(0)) ||
-              !isa<PointerType>(FTy->getParamType(1)))
+              !FTy->getReturnType()->isPointerTy() ||
+              !FTy->getParamType(0)->isPointerTy() ||
+              !FTy->getParamType(1)->isPointerTy())
             continue;
           setDoesNotThrow(F);
           setDoesNotAlias(F, 0);
@@ -2630,25 +2025,25 @@ bool SimplifyLibCalls::doInitialization(Module &M) {
         } else if (Name == "\1fseeko64" ||
                    Name == "\1ftello64") {
           if (FTy->getNumParams() == 0 ||
-              !isa<PointerType>(FTy->getParamType(0)))
+              !FTy->getParamType(0)->isPointerTy())
             continue;
           setDoesNotThrow(F);
           setDoesNotCapture(F, 1);
         } else if (Name == "\1tmpfile64") {
-          if (!isa<PointerType>(FTy->getReturnType()))
+          if (!FTy->getReturnType()->isPointerTy())
             continue;
           setDoesNotThrow(F);
           setDoesNotAlias(F, 0);
         } else if (Name == "\1fstat64" ||
                    Name == "\1fstatvfs64") {
           if (FTy->getNumParams() != 2 ||
-              !isa<PointerType>(FTy->getParamType(1)))
+              !FTy->getParamType(1)->isPointerTy())
             continue;
           setDoesNotThrow(F);
           setDoesNotCapture(F, 2);
         } else if (Name == "\1open64") {
           if (FTy->getNumParams() < 2 ||
-              !isa<PointerType>(FTy->getParamType(0)))
+              !FTy->getParamType(0)->isPointerTy())
             continue;
           // May throw; "open" is a valid pthread cancellation point.
           setDoesNotCapture(F, 1);
diff --git a/libclamav/c++/llvm/lib/Transforms/Utils/AddrModeMatcher.cpp b/libclamav/c++/llvm/lib/Transforms/Utils/AddrModeMatcher.cpp
index 8c4aa59..be6b383 100644
--- a/libclamav/c++/llvm/lib/Transforms/Utils/AddrModeMatcher.cpp
+++ b/libclamav/c++/llvm/lib/Transforms/Utils/AddrModeMatcher.cpp
@@ -125,7 +125,7 @@ static bool MightBeFoldableInst(Instruction *I) {
     // Don't touch identity bitcasts.
     if (I->getType() == I->getOperand(0)->getType())
       return false;
-    return isa<PointerType>(I->getType()) || isa<IntegerType>(I->getType());
+    return I->getType()->isPointerTy() || I->getType()->isIntegerTy();
   case Instruction::PtrToInt:
     // PtrToInt is always a noop, as we know that the int type is pointer sized.
     return true;
@@ -167,8 +167,8 @@ bool AddressingModeMatcher::MatchOperationAddr(User *AddrInst, unsigned Opcode,
   case Instruction::BitCast:
     // BitCast is always a noop, and we can handle it as long as it is
     // int->int or pointer->pointer (we don't want int<->fp or something).
-    if ((isa<PointerType>(AddrInst->getOperand(0)->getType()) ||
-         isa<IntegerType>(AddrInst->getOperand(0)->getType())) &&
+    if ((AddrInst->getOperand(0)->getType()->isPointerTy() ||
+         AddrInst->getOperand(0)->getType()->isIntegerTy()) &&
         // Don't touch identity bitcasts.  These were probably put here by LSR,
         // and we don't want to mess around with them.  Assume it knows what it
         // is doing.
@@ -569,7 +569,7 @@ IsProfitableToFoldIntoAddressingMode(Instruction *I, ExtAddrMode &AMBefore,
     // Get the access type of this use.  If the use isn't a pointer, we don't
     // know what it accesses.
     Value *Address = User->getOperand(OpNo);
-    if (!isa<PointerType>(Address->getType()))
+    if (!Address->getType()->isPointerTy())
       return false;
     const Type *AddressAccessTy =
       cast<PointerType>(Address->getType())->getElementType();
diff --git a/libclamav/c++/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp b/libclamav/c++/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
index 7bc4fcd..1f62dab 100644
--- a/libclamav/c++/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
+++ b/libclamav/c++/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
@@ -274,24 +274,31 @@ void llvm::RemoveSuccessor(TerminatorInst *TI, unsigned SuccNum) {
     ReplaceInstWithInst(TI, NewTI);
 }
 
-/// SplitEdge -  Split the edge connecting specified block. Pass P must 
-/// not be NULL. 
-BasicBlock *llvm::SplitEdge(BasicBlock *BB, BasicBlock *Succ, Pass *P) {
-  TerminatorInst *LatchTerm = BB->getTerminator();
-  unsigned SuccNum = 0;
+/// GetSuccessorNumber - Search for the specified successor of basic block BB
+/// and return its position in the terminator instruction's list of
+/// successors.  It is an error to call this with a block that is not a
+/// successor.
+unsigned llvm::GetSuccessorNumber(BasicBlock *BB, BasicBlock *Succ) {
+  TerminatorInst *Term = BB->getTerminator();
 #ifndef NDEBUG
-  unsigned e = LatchTerm->getNumSuccessors();
+  unsigned e = Term->getNumSuccessors();
 #endif
   for (unsigned i = 0; ; ++i) {
     assert(i != e && "Didn't find edge?");
-    if (LatchTerm->getSuccessor(i) == Succ) {
-      SuccNum = i;
-      break;
-    }
+    if (Term->getSuccessor(i) == Succ)
+      return i;
   }
+  return 0;
+}
+
+/// SplitEdge -  Split the edge connecting specified block. Pass P must 
+/// not be NULL. 
+BasicBlock *llvm::SplitEdge(BasicBlock *BB, BasicBlock *Succ, Pass *P) {
+  unsigned SuccNum = GetSuccessorNumber(BB, Succ);
   
   // If this is a critical edge, let SplitCriticalEdge do it.
-  if (SplitCriticalEdge(BB->getTerminator(), SuccNum, P))
+  TerminatorInst *LatchTerm = BB->getTerminator();
+  if (SplitCriticalEdge(LatchTerm, SuccNum, P))
     return LatchTerm->getSuccessor(SuccNum);
 
   // If the edge isn't critical, then BB has a single successor or Succ has a
diff --git a/libclamav/c++/llvm/lib/Transforms/Utils/BuildLibCalls.cpp b/libclamav/c++/llvm/lib/Transforms/Utils/BuildLibCalls.cpp
new file mode 100644
index 0000000..2ea4bb6
--- /dev/null
+++ b/libclamav/c++/llvm/lib/Transforms/Utils/BuildLibCalls.cpp
@@ -0,0 +1,324 @@
+//===- BuildLibCalls.cpp - Utility builder for libcalls -------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file implements some functions that will create standard C libcalls.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/Transforms/Utils/BuildLibCalls.h"
+#include "llvm/Type.h"
+#include "llvm/Constants.h"
+#include "llvm/Function.h"
+#include "llvm/Module.h"
+#include "llvm/Support/IRBuilder.h"
+#include "llvm/Target/TargetData.h"
+#include "llvm/LLVMContext.h"
+#include "llvm/Intrinsics.h"
+
+using namespace llvm;
+
+/// CastToCStr - Return V if it is an i8*, otherwise cast it to i8*.
+Value *llvm::CastToCStr(Value *V, IRBuilder<> &B) {
+  return B.CreateBitCast(V, B.getInt8PtrTy(), "cstr");
+}
+
+/// EmitStrLen - Emit a call to the strlen function to the builder, for the
+/// specified pointer.  This always returns an integer value of size intptr_t.
+Value *llvm::EmitStrLen(Value *Ptr, IRBuilder<> &B, const TargetData *TD) {
+  Module *M = B.GetInsertBlock()->getParent()->getParent();
+  AttributeWithIndex AWI[2];
+  AWI[0] = AttributeWithIndex::get(1, Attribute::NoCapture);
+  AWI[1] = AttributeWithIndex::get(~0u, Attribute::ReadOnly |
+                                   Attribute::NoUnwind);
+
+  LLVMContext &Context = B.GetInsertBlock()->getContext();
+  Constant *StrLen = M->getOrInsertFunction("strlen", AttrListPtr::get(AWI, 2),
+                                            TD->getIntPtrType(Context),
+                                            B.getInt8PtrTy(),
+                                            NULL);
+  CallInst *CI = B.CreateCall(StrLen, CastToCStr(Ptr, B), "strlen");
+  if (const Function *F = dyn_cast<Function>(StrLen->stripPointerCasts()))
+    CI->setCallingConv(F->getCallingConv());
+
+  return CI;
+}
+
+/// EmitStrChr - Emit a call to the strchr function to the builder, for the
+/// specified pointer and character.  Ptr is required to be some pointer type,
+/// and the return value has 'i8*' type.
+Value *llvm::EmitStrChr(Value *Ptr, char C, IRBuilder<> &B,
+                        const TargetData *TD) {
+  Module *M = B.GetInsertBlock()->getParent()->getParent();
+  AttributeWithIndex AWI =
+    AttributeWithIndex::get(~0u, Attribute::ReadOnly | Attribute::NoUnwind);
+
+  const Type *I8Ptr = B.getInt8PtrTy();
+  const Type *I32Ty = B.getInt32Ty();
+  Constant *StrChr = M->getOrInsertFunction("strchr", AttrListPtr::get(&AWI, 1),
+                                            I8Ptr, I8Ptr, I32Ty, NULL);
+  CallInst *CI = B.CreateCall2(StrChr, CastToCStr(Ptr, B),
+                               ConstantInt::get(I32Ty, C), "strchr");
+  if (const Function *F = dyn_cast<Function>(StrChr->stripPointerCasts()))
+    CI->setCallingConv(F->getCallingConv());
+  return CI;
+}
+
+/// EmitStrCpy - Emit a call to the strcpy function to the builder, for the
+/// specified pointer arguments.
+Value *llvm::EmitStrCpy(Value *Dst, Value *Src, IRBuilder<> &B,
+                        const TargetData *TD) {
+  Module *M = B.GetInsertBlock()->getParent()->getParent();
+  AttributeWithIndex AWI[2];
+  AWI[0] = AttributeWithIndex::get(2, Attribute::NoCapture);
+  AWI[1] = AttributeWithIndex::get(~0u, Attribute::NoUnwind);
+  const Type *I8Ptr = B.getInt8PtrTy();
+  Value *StrCpy = M->getOrInsertFunction("strcpy", AttrListPtr::get(AWI, 2),
+                                         I8Ptr, I8Ptr, I8Ptr, NULL);
+  CallInst *CI = B.CreateCall2(StrCpy, CastToCStr(Dst, B), CastToCStr(Src, B),
+                               "strcpy");
+  if (const Function *F = dyn_cast<Function>(StrCpy->stripPointerCasts()))
+    CI->setCallingConv(F->getCallingConv());
+  return CI;
+}
+
+/// EmitMemCpy - Emit a call to the memcpy function to the builder.  This always
+/// expects that the size has type 'intptr_t' and Dst/Src are pointers.
+Value *llvm::EmitMemCpy(Value *Dst, Value *Src, Value *Len,
+                        unsigned Align, IRBuilder<> &B, const TargetData *TD) {
+  Module *M = B.GetInsertBlock()->getParent()->getParent();
+  const Type *Ty = Len->getType();
+  Value *MemCpy = Intrinsic::getDeclaration(M, Intrinsic::memcpy, &Ty, 1);
+  Dst = CastToCStr(Dst, B);
+  Src = CastToCStr(Src, B);
+  return B.CreateCall4(MemCpy, Dst, Src, Len,
+                       ConstantInt::get(B.getInt32Ty(), Align));
+}
+
+/// EmitMemMove - Emit a call to the memmove function to the builder.  This
+/// always expects that the size has type 'intptr_t' and Dst/Src are pointers.
+Value *llvm::EmitMemMove(Value *Dst, Value *Src, Value *Len,
+					               unsigned Align, IRBuilder<> &B, const TargetData *TD) {
+  Module *M = B.GetInsertBlock()->getParent()->getParent();
+  LLVMContext &Context = B.GetInsertBlock()->getContext();
+  const Type *Ty = TD->getIntPtrType(Context);
+  Value *MemMove = Intrinsic::getDeclaration(M, Intrinsic::memmove, &Ty, 1);
+  Dst = CastToCStr(Dst, B);
+  Src = CastToCStr(Src, B);
+  Value *A = ConstantInt::get(B.getInt32Ty(), Align);
+  return B.CreateCall4(MemMove, Dst, Src, Len, A);
+}
+
+/// EmitMemChr - Emit a call to the memchr function.  This assumes that Ptr is
+/// a pointer, Val is an i32 value, and Len is an 'intptr_t' value.
+Value *llvm::EmitMemChr(Value *Ptr, Value *Val,
+                        Value *Len, IRBuilder<> &B, const TargetData *TD) {
+  Module *M = B.GetInsertBlock()->getParent()->getParent();
+  AttributeWithIndex AWI;
+  AWI = AttributeWithIndex::get(~0u, Attribute::ReadOnly | Attribute::NoUnwind);
+  LLVMContext &Context = B.GetInsertBlock()->getContext();
+  Value *MemChr = M->getOrInsertFunction("memchr", AttrListPtr::get(&AWI, 1),
+                                         B.getInt8PtrTy(),
+                                         B.getInt8PtrTy(),
+                                         B.getInt32Ty(),
+                                         TD->getIntPtrType(Context),
+                                         NULL);
+  CallInst *CI = B.CreateCall3(MemChr, CastToCStr(Ptr, B), Val, Len, "memchr");
+
+  if (const Function *F = dyn_cast<Function>(MemChr->stripPointerCasts()))
+    CI->setCallingConv(F->getCallingConv());
+
+  return CI;
+}
+
+/// EmitMemCmp - Emit a call to the memcmp function.
+Value *llvm::EmitMemCmp(Value *Ptr1, Value *Ptr2,
+                        Value *Len, IRBuilder<> &B, const TargetData *TD) {
+  Module *M = B.GetInsertBlock()->getParent()->getParent();
+  AttributeWithIndex AWI[3];
+  AWI[0] = AttributeWithIndex::get(1, Attribute::NoCapture);
+  AWI[1] = AttributeWithIndex::get(2, Attribute::NoCapture);
+  AWI[2] = AttributeWithIndex::get(~0u, Attribute::ReadOnly |
+                                   Attribute::NoUnwind);
+
+  LLVMContext &Context = B.GetInsertBlock()->getContext();
+  Value *MemCmp = M->getOrInsertFunction("memcmp", AttrListPtr::get(AWI, 3),
+                                         B.getInt32Ty(),
+                                         B.getInt8PtrTy(),
+                                         B.getInt8PtrTy(),
+                                         TD->getIntPtrType(Context), NULL);
+  CallInst *CI = B.CreateCall3(MemCmp, CastToCStr(Ptr1, B), CastToCStr(Ptr2, B),
+                               Len, "memcmp");
+
+  if (const Function *F = dyn_cast<Function>(MemCmp->stripPointerCasts()))
+    CI->setCallingConv(F->getCallingConv());
+
+  return CI;
+}
+
+/// EmitMemSet - Emit a call to the memset function
+Value *llvm::EmitMemSet(Value *Dst, Value *Val,
+                        Value *Len, IRBuilder<> &B, const TargetData *TD) {
+ Module *M = B.GetInsertBlock()->getParent()->getParent();
+ Intrinsic::ID IID = Intrinsic::memset;
+ const Type *Tys[1];
+ Tys[0] = Len->getType();
+ Value *MemSet = Intrinsic::getDeclaration(M, IID, Tys, 1);
+ Value *Align = ConstantInt::get(B.getInt32Ty(), 1);
+ return B.CreateCall4(MemSet, CastToCStr(Dst, B), Val, Len, Align);
+}
+
+/// EmitUnaryFloatFnCall - Emit a call to the unary function named 'Name' (e.g.
+/// 'floor').  This function is known to take a single of type matching 'Op' and
+/// returns one value with the same type.  If 'Op' is a long double, 'l' is
+/// added as the suffix of name, if 'Op' is a float, we add a 'f' suffix.
+Value *llvm::EmitUnaryFloatFnCall(Value *Op, const char *Name,
+                                  IRBuilder<> &B, const AttrListPtr &Attrs) {
+  char NameBuffer[20];
+  if (!Op->getType()->isDoubleTy()) {
+    // If we need to add a suffix, copy into NameBuffer.
+    unsigned NameLen = strlen(Name);
+    assert(NameLen < sizeof(NameBuffer)-2);
+    memcpy(NameBuffer, Name, NameLen);
+    if (Op->getType()->isFloatTy())
+      NameBuffer[NameLen] = 'f';  // floorf
+    else
+      NameBuffer[NameLen] = 'l';  // floorl
+    NameBuffer[NameLen+1] = 0;
+    Name = NameBuffer;
+  }
+
+  Module *M = B.GetInsertBlock()->getParent()->getParent();
+  Value *Callee = M->getOrInsertFunction(Name, Op->getType(),
+                                         Op->getType(), NULL);
+  CallInst *CI = B.CreateCall(Callee, Op, Name);
+  CI->setAttributes(Attrs);
+  if (const Function *F = dyn_cast<Function>(Callee->stripPointerCasts()))
+    CI->setCallingConv(F->getCallingConv());
+
+  return CI;
+}
+
+/// EmitPutChar - Emit a call to the putchar function.  This assumes that Char
+/// is an integer.
+Value *llvm::EmitPutChar(Value *Char, IRBuilder<> &B, const TargetData *TD) {
+  Module *M = B.GetInsertBlock()->getParent()->getParent();
+  Value *PutChar = M->getOrInsertFunction("putchar", B.getInt32Ty(),
+                                          B.getInt32Ty(), NULL);
+  CallInst *CI = B.CreateCall(PutChar,
+                              B.CreateIntCast(Char,
+                              B.getInt32Ty(),
+                              /*isSigned*/true,
+                              "chari"),
+                              "putchar");
+
+  if (const Function *F = dyn_cast<Function>(PutChar->stripPointerCasts()))
+    CI->setCallingConv(F->getCallingConv());
+  return CI;
+}
+
+/// EmitPutS - Emit a call to the puts function.  This assumes that Str is
+/// some pointer.
+void llvm::EmitPutS(Value *Str, IRBuilder<> &B, const TargetData *TD) {
+  Module *M = B.GetInsertBlock()->getParent()->getParent();
+  AttributeWithIndex AWI[2];
+  AWI[0] = AttributeWithIndex::get(1, Attribute::NoCapture);
+  AWI[1] = AttributeWithIndex::get(~0u, Attribute::NoUnwind);
+
+  Value *PutS = M->getOrInsertFunction("puts", AttrListPtr::get(AWI, 2),
+                                       B.getInt32Ty(),
+                                       B.getInt8PtrTy(),
+                                       NULL);
+  CallInst *CI = B.CreateCall(PutS, CastToCStr(Str, B), "puts");
+  if (const Function *F = dyn_cast<Function>(PutS->stripPointerCasts()))
+    CI->setCallingConv(F->getCallingConv());
+
+}
+
+/// EmitFPutC - Emit a call to the fputc function.  This assumes that Char is
+/// an integer and File is a pointer to FILE.
+void llvm::EmitFPutC(Value *Char, Value *File, IRBuilder<> &B,
+                     const TargetData *TD) {
+  Module *M = B.GetInsertBlock()->getParent()->getParent();
+  AttributeWithIndex AWI[2];
+  AWI[0] = AttributeWithIndex::get(2, Attribute::NoCapture);
+  AWI[1] = AttributeWithIndex::get(~0u, Attribute::NoUnwind);
+  Constant *F;
+  if (File->getType()->isPointerTy())
+    F = M->getOrInsertFunction("fputc", AttrListPtr::get(AWI, 2),
+                               B.getInt32Ty(),
+                               B.getInt32Ty(), File->getType(),
+                               NULL);
+  else
+    F = M->getOrInsertFunction("fputc",
+                               B.getInt32Ty(),
+                               B.getInt32Ty(),
+                               File->getType(), NULL);
+  Char = B.CreateIntCast(Char, B.getInt32Ty(), /*isSigned*/true,
+                         "chari");
+  CallInst *CI = B.CreateCall2(F, Char, File, "fputc");
+
+  if (const Function *Fn = dyn_cast<Function>(F->stripPointerCasts()))
+    CI->setCallingConv(Fn->getCallingConv());
+}
+
+/// EmitFPutS - Emit a call to the puts function.  Str is required to be a
+/// pointer and File is a pointer to FILE.
+void llvm::EmitFPutS(Value *Str, Value *File, IRBuilder<> &B,
+                     const TargetData *TD) {
+  Module *M = B.GetInsertBlock()->getParent()->getParent();
+  AttributeWithIndex AWI[3];
+  AWI[0] = AttributeWithIndex::get(1, Attribute::NoCapture);
+  AWI[1] = AttributeWithIndex::get(2, Attribute::NoCapture);
+  AWI[2] = AttributeWithIndex::get(~0u, Attribute::NoUnwind);
+  Constant *F;
+  if (File->getType()->isPointerTy())
+    F = M->getOrInsertFunction("fputs", AttrListPtr::get(AWI, 3),
+                               B.getInt32Ty(),
+                               B.getInt8PtrTy(),
+                               File->getType(), NULL);
+  else
+    F = M->getOrInsertFunction("fputs", B.getInt32Ty(),
+                               B.getInt8PtrTy(),
+                               File->getType(), NULL);
+  CallInst *CI = B.CreateCall2(F, CastToCStr(Str, B), File, "fputs");
+
+  if (const Function *Fn = dyn_cast<Function>(F->stripPointerCasts()))
+    CI->setCallingConv(Fn->getCallingConv());
+}
+
+/// EmitFWrite - Emit a call to the fwrite function.  This assumes that Ptr is
+/// a pointer, Size is an 'intptr_t', and File is a pointer to FILE.
+void llvm::EmitFWrite(Value *Ptr, Value *Size, Value *File,
+                      IRBuilder<> &B, const TargetData *TD) {
+  Module *M = B.GetInsertBlock()->getParent()->getParent();
+  AttributeWithIndex AWI[3];
+  AWI[0] = AttributeWithIndex::get(1, Attribute::NoCapture);
+  AWI[1] = AttributeWithIndex::get(4, Attribute::NoCapture);
+  AWI[2] = AttributeWithIndex::get(~0u, Attribute::NoUnwind);
+  LLVMContext &Context = B.GetInsertBlock()->getContext();
+  Constant *F;
+  if (File->getType()->isPointerTy())
+    F = M->getOrInsertFunction("fwrite", AttrListPtr::get(AWI, 3),
+                               TD->getIntPtrType(Context),
+                               B.getInt8PtrTy(),
+                               TD->getIntPtrType(Context),
+                               TD->getIntPtrType(Context),
+                               File->getType(), NULL);
+  else
+    F = M->getOrInsertFunction("fwrite", TD->getIntPtrType(Context),
+                               B.getInt8PtrTy(),
+                               TD->getIntPtrType(Context),
+                               TD->getIntPtrType(Context),
+                               File->getType(), NULL);
+  CallInst *CI = B.CreateCall4(F, CastToCStr(Ptr, B), Size,
+                        ConstantInt::get(TD->getIntPtrType(Context), 1), File);
+
+  if (const Function *Fn = dyn_cast<Function>(F->stripPointerCasts()))
+    CI->setCallingConv(Fn->getCallingConv());
+}
diff --git a/libclamav/c++/llvm/lib/Transforms/Utils/CMakeLists.txt b/libclamav/c++/llvm/lib/Transforms/Utils/CMakeLists.txt
index 93577b4..dec227a 100644
--- a/libclamav/c++/llvm/lib/Transforms/Utils/CMakeLists.txt
+++ b/libclamav/c++/llvm/lib/Transforms/Utils/CMakeLists.txt
@@ -3,6 +3,7 @@ add_llvm_library(LLVMTransformUtils
   BasicBlockUtils.cpp
   BasicInliner.cpp
   BreakCriticalEdges.cpp
+  BuildLibCalls.cpp
   CloneFunction.cpp
   CloneLoop.cpp
   CloneModule.cpp
diff --git a/libclamav/c++/llvm/lib/Transforms/Utils/Local.cpp b/libclamav/c++/llvm/lib/Transforms/Utils/Local.cpp
index 7e7973a..d03f7a6 100644
--- a/libclamav/c++/llvm/lib/Transforms/Utils/Local.cpp
+++ b/libclamav/c++/llvm/lib/Transforms/Utils/Local.cpp
@@ -46,7 +46,7 @@ using namespace llvm;
 static Value *getUnderlyingObjectWithOffset(Value *V, const TargetData *TD,
                                             uint64_t &ByteOffset,
                                             unsigned MaxLookup = 6) {
-  if (!isa<PointerType>(V->getType()))
+  if (!V->getType()->isPointerTy())
     return V;
   for (unsigned Count = 0; MaxLookup == 0 || Count < MaxLookup; ++Count) {
     if (GEPOperator *GEP = dyn_cast<GEPOperator>(V)) {
@@ -65,7 +65,7 @@ static Value *getUnderlyingObjectWithOffset(Value *V, const TargetData *TD,
     } else {
       return V;
     }
-    assert(isa<PointerType>(V->getType()) && "Unexpected operand type!");
+    assert(V->getType()->isPointerTy() && "Unexpected operand type!");
   }
   return V;
 }
@@ -490,6 +490,17 @@ void llvm::MergeBasicBlockIntoOnlyPred(BasicBlock *DestBB, Pass *P) {
   // Splice all the instructions from PredBB to DestBB.
   PredBB->getTerminator()->eraseFromParent();
   DestBB->getInstList().splice(DestBB->begin(), PredBB->getInstList());
+
+  // Zap anything that took the address of DestBB.  Not doing this will give the
+  // address an invalid value.
+  if (DestBB->hasAddressTaken()) {
+    BlockAddress *BA = BlockAddress::get(DestBB);
+    Constant *Replacement =
+      ConstantInt::get(llvm::Type::getInt32Ty(BA->getContext()), 1);
+    BA->replaceAllUsesWith(ConstantExpr::getIntToPtr(Replacement,
+                                                     BA->getType()));
+    BA->destroyConstant();
+  }
   
   // Anything that branched to PredBB now branches to DestBB.
   PredBB->replaceAllUsesWith(DestBB);
diff --git a/libclamav/c++/llvm/lib/Transforms/Utils/LoopSimplify.cpp b/libclamav/c++/llvm/lib/Transforms/Utils/LoopSimplify.cpp
index 57bab60..924b744 100644
--- a/libclamav/c++/llvm/lib/Transforms/Utils/LoopSimplify.cpp
+++ b/libclamav/c++/llvm/lib/Transforms/Utils/LoopSimplify.cpp
@@ -51,6 +51,7 @@
 #include "llvm/Transforms/Utils/BasicBlockUtils.h"
 #include "llvm/Transforms/Utils/Local.h"
 #include "llvm/Support/CFG.h"
+#include "llvm/Support/Debug.h"
 #include "llvm/ADT/SetOperations.h"
 #include "llvm/ADT/SetVector.h"
 #include "llvm/ADT/Statistic.h"
@@ -147,6 +148,11 @@ ReprocessLoop:
     // Delete each unique out-of-loop (and thus dead) predecessor.
     for (SmallPtrSet<BasicBlock *, 4>::iterator I = BadPreds.begin(),
          E = BadPreds.end(); I != E; ++I) {
+
+      DEBUG(dbgs() << "LoopSimplify: Deleting edge from dead predecessor ";
+            WriteAsOperand(dbgs(), *I, false);
+            dbgs() << "\n");
+
       // Inform each successor of each dead pred.
       for (succ_iterator SI = succ_begin(*I), SE = succ_end(*I); SI != SE; ++SI)
         (*SI)->removePredecessor(*I);
@@ -159,6 +165,27 @@ ReprocessLoop:
     }
   }
 
+  // If there are exiting blocks with branches on undef, resolve the undef in
+  // the direction which will exit the loop. This will help simplify loop
+  // trip count computations.
+  SmallVector<BasicBlock*, 8> ExitingBlocks;
+  L->getExitingBlocks(ExitingBlocks);
+  for (SmallVectorImpl<BasicBlock *>::iterator I = ExitingBlocks.begin(),
+       E = ExitingBlocks.end(); I != E; ++I)
+    if (BranchInst *BI = dyn_cast<BranchInst>((*I)->getTerminator()))
+      if (BI->isConditional()) {
+        if (UndefValue *Cond = dyn_cast<UndefValue>(BI->getCondition())) {
+
+          DEBUG(dbgs() << "LoopSimplify: Resolving \"br i1 undef\" to exit in ";
+                WriteAsOperand(dbgs(), *I, false);
+                dbgs() << "\n");
+
+          BI->setCondition(ConstantInt::get(Cond->getType(),
+                                            !L->contains(BI->getSuccessor(0))));
+          Changed = true;
+        }
+      }
+
   // Does the loop already have a preheader?  If so, don't insert one.
   BasicBlock *Preheader = L->getLoopPreheader();
   if (!Preheader) {
@@ -250,8 +277,6 @@ ReprocessLoop:
         break;
       }
   if (UniqueExit) {
-    SmallVector<BasicBlock*, 8> ExitingBlocks;
-    L->getExitingBlocks(ExitingBlocks);
     for (unsigned i = 0, e = ExitingBlocks.size(); i != e; ++i) {
       BasicBlock *ExitingBlock = ExitingBlocks[i];
       if (!ExitingBlock->getSinglePredecessor()) continue;
@@ -282,6 +307,11 @@ ReprocessLoop:
 
       // Success. The block is now dead, so remove it from the loop,
       // update the dominator tree and dominance frontier, and delete it.
+
+      DEBUG(dbgs() << "LoopSimplify: Eliminating exiting block ";
+            WriteAsOperand(dbgs(), ExitingBlock, false);
+            dbgs() << "\n");
+
       assert(pred_begin(ExitingBlock) == pred_end(ExitingBlock));
       Changed = true;
       LI->removeBlock(ExitingBlock);
@@ -335,6 +365,10 @@ BasicBlock *LoopSimplify::InsertPreheaderForLoop(Loop *L) {
     SplitBlockPredecessors(Header, &OutsideBlocks[0], OutsideBlocks.size(),
                            ".preheader", this);
 
+  DEBUG(dbgs() << "LoopSimplify: Creating pre-header ";
+        WriteAsOperand(dbgs(), NewBB, false);
+        dbgs() << "\n");
+
   // Make sure that NewBB is put someplace intelligent, which doesn't mess up
   // code layout too horribly.
   PlaceSplitBlockCarefully(NewBB, OutsideBlocks, L);
@@ -360,6 +394,10 @@ BasicBlock *LoopSimplify::RewriteLoopExitBlock(Loop *L, BasicBlock *Exit) {
                                              LoopBlocks.size(), ".loopexit",
                                              this);
 
+  DEBUG(dbgs() << "LoopSimplify: Creating dedicated exit block ";
+        WriteAsOperand(dbgs(), NewBB, false);
+        dbgs() << "\n");
+
   return NewBB;
 }
 
@@ -480,6 +518,8 @@ Loop *LoopSimplify::SeparateNestedLoop(Loop *L, LPPassManager &LPM) {
       OuterLoopPreds.push_back(PN->getIncomingBlock(i));
     }
 
+  DEBUG(dbgs() << "LoopSimplify: Splitting out a new outer loop\n");
+
   BasicBlock *Header = L->getHeader();
   BasicBlock *NewBB = SplitBlockPredecessors(Header, &OuterLoopPreds[0],
                                              OuterLoopPreds.size(),
@@ -574,6 +614,10 @@ LoopSimplify::InsertUniqueBackedgeBlock(Loop *L, BasicBlock *Preheader) {
                                            Header->getName()+".backedge", F);
   BranchInst *BETerminator = BranchInst::Create(Header, BEBlock);
 
+  DEBUG(dbgs() << "LoopSimplify: Inserting unique backedge block ";
+        WriteAsOperand(dbgs(), BEBlock, false);
+        dbgs() << "\n");
+
   // Move the new backedge block to right after the last backedge block.
   Function::iterator InsertPos = BackedgeBlocks.back(); ++InsertPos;
   F->getBasicBlockList().splice(InsertPos, F->getBasicBlockList(), BEBlock);
diff --git a/libclamav/c++/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp b/libclamav/c++/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
index 544e20b..4f5a70b 100644
--- a/libclamav/c++/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
+++ b/libclamav/c++/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
@@ -518,7 +518,7 @@ void PromoteMem2Reg::run() {
       
       // If this PHI node merges one value and/or undefs, get the value.
       if (Value *V = PN->hasConstantValue(&DT)) {
-        if (AST && isa<PointerType>(PN->getType()))
+        if (AST && PN->getType()->isPointerTy())
           AST->deleteValue(PN);
         PN->replaceAllUsesWith(V);
         PN->eraseFromParent();
@@ -780,7 +780,7 @@ void PromoteMem2Reg::RewriteSingleStoreAlloca(AllocaInst *AI,
     if (ReplVal == LI)
       ReplVal = UndefValue::get(LI->getType());
     LI->replaceAllUsesWith(ReplVal);
-    if (AST && isa<PointerType>(LI->getType()))
+    if (AST && LI->getType()->isPointerTy())
       AST->deleteValue(LI);
     LI->eraseFromParent();
     LBI.deleteValue(LI);
@@ -838,7 +838,7 @@ void PromoteMem2Reg::PromoteSingleBlockAlloca(AllocaInst *AI, AllocaInfo &Info,
     for (Value::use_iterator UI = AI->use_begin(), E = AI->use_end(); UI != E;) 
       if (LoadInst *LI = dyn_cast<LoadInst>(*UI++)) {
         LI->replaceAllUsesWith(UndefValue::get(LI->getType()));
-        if (AST && isa<PointerType>(LI->getType()))
+        if (AST && LI->getType()->isPointerTy())
           AST->deleteValue(LI);
         LBI.deleteValue(LI);
         LI->eraseFromParent();
@@ -874,7 +874,7 @@ void PromoteMem2Reg::PromoteSingleBlockAlloca(AllocaInst *AI, AllocaInfo &Info,
     // Otherwise, there was a store before this load, the load takes its value.
     --I;
     LI->replaceAllUsesWith(I->second->getOperand(0));
-    if (AST && isa<PointerType>(LI->getType()))
+    if (AST && LI->getType()->isPointerTy())
       AST->deleteValue(LI);
     LI->eraseFromParent();
     LBI.deleteValue(LI);
@@ -922,7 +922,7 @@ bool PromoteMem2Reg::QueuePhiNode(BasicBlock *BB, unsigned AllocaNo,
   
   InsertedPHINodes.insert(PN);
 
-  if (AST && isa<PointerType>(PN->getType()))
+  if (AST && PN->getType()->isPointerTy())
     AST->copyValue(PointerAllocaValues[AllocaNo], PN);
 
   return true;
@@ -996,7 +996,7 @@ NextIteration:
 
       // Anything using the load now uses the current value.
       LI->replaceAllUsesWith(V);
-      if (AST && isa<PointerType>(LI->getType()))
+      if (AST && LI->getType()->isPointerTy())
         AST->deleteValue(LI);
       BB->getInstList().erase(LI);
     } else if (StoreInst *SI = dyn_cast<StoreInst>(I)) {
diff --git a/libclamav/c++/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/libclamav/c++/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
index 795b6bf..f343c38 100644
--- a/libclamav/c++/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/libclamav/c++/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -271,7 +271,7 @@ static bool DominatesMergePoint(Value *V, BasicBlock *BB,
 ConstantInt *SimplifyCFGOpt::GetConstantInt(Value *V) {
   // Normal constant int.
   ConstantInt *CI = dyn_cast<ConstantInt>(V);
-  if (CI || !TD || !isa<Constant>(V) || !isa<PointerType>(V->getType()))
+  if (CI || !TD || !isa<Constant>(V) || !V->getType()->isPointerTy())
     return CI;
 
   // This is some kind of pointer constant. Turn it into a pointer-sized
@@ -701,7 +701,7 @@ bool SimplifyCFGOpt::FoldValueComparisonIntoPredecessors(TerminatorInst *TI) {
         AddPredecessorToBlock(NewSuccessors[i], Pred, BB);
 
       // Convert pointer to int before we switch.
-      if (isa<PointerType>(CV->getType())) {
+      if (CV->getType()->isPointerTy()) {
         assert(TD && "Cannot switch on pointer without TargetData");
         CV = new PtrToIntInst(CV, TD->getIntPtrType(CV->getContext()),
                               "magicptr", PTI);
@@ -915,7 +915,7 @@ static bool SpeculativelyExecuteBB(BranchInst *BI, BasicBlock *BB1) {
   case Instruction::Add:
   case Instruction::Sub:
     // Not worth doing for vector ops.
-    if (isa<VectorType>(HInst->getType()))
+    if (HInst->getType()->isVectorTy())
       return false;
     break;
   case Instruction::And:
@@ -925,7 +925,7 @@ static bool SpeculativelyExecuteBB(BranchInst *BI, BasicBlock *BB1) {
   case Instruction::LShr:
   case Instruction::AShr:
     // Don't mess with vector operations.
-    if (isa<VectorType>(HInst->getType()))
+    if (HInst->getType()->isVectorTy())
       return false;
     break;   // These are all cheap and non-trapping instructions.
   }
@@ -1077,7 +1077,7 @@ static bool FoldCondBranchOnPHI(BranchInst *BI) {
   for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i) {
     ConstantInt *CB;
     if ((CB = dyn_cast<ConstantInt>(PN->getIncomingValue(i))) &&
-        CB->getType()->isInteger(1)) {
+        CB->getType()->isIntegerTy(1)) {
       // Okay, we now know that all edges from PredBB should be revectored to
       // branch to RealDest.
       BasicBlock *PredBB = PN->getIncomingBlock(i);
@@ -2068,7 +2068,7 @@ bool SimplifyCFGOpt::run(BasicBlock *BB) {
           if (!TrueWhenEqual) std::swap(DefaultBB, EdgeBB);
 
           // Convert pointer to int before we switch.
-          if (isa<PointerType>(CompVal->getType())) {
+          if (CompVal->getType()->isPointerTy()) {
             assert(TD && "Cannot switch on pointer without TargetData");
             CompVal = new PtrToIntInst(CompVal,
                                        TD->getIntPtrType(CompVal->getContext()),
diff --git a/libclamav/c++/llvm/lib/VMCore/AsmWriter.cpp b/libclamav/c++/llvm/lib/VMCore/AsmWriter.cpp
index 4fe1eee..fd74241 100644
--- a/libclamav/c++/llvm/lib/VMCore/AsmWriter.cpp
+++ b/libclamav/c++/llvm/lib/VMCore/AsmWriter.cpp
@@ -17,6 +17,7 @@
 #include "llvm/Assembly/Writer.h"
 #include "llvm/Assembly/PrintModulePass.h"
 #include "llvm/Assembly/AsmAnnotationWriter.h"
+#include "llvm/LLVMContext.h"
 #include "llvm/CallingConv.h"
 #include "llvm/Constants.h"
 #include "llvm/DerivedTypes.h"
@@ -376,8 +377,8 @@ namespace {
         return;
 
       // If this is a structure or opaque type, add a name for the type.
-      if (((isa<StructType>(Ty) && cast<StructType>(Ty)->getNumElements())
-            || isa<OpaqueType>(Ty)) && !TP.hasTypeName(Ty)) {
+      if (((Ty->isStructTy() && cast<StructType>(Ty)->getNumElements())
+            || Ty->isOpaqueTy()) && !TP.hasTypeName(Ty)) {
         TP.addTypeName(Ty, "%"+utostr(unsigned(NumberedTypes.size())));
         NumberedTypes.push_back(Ty);
       }
@@ -431,13 +432,13 @@ static void AddModuleTypesToPrinter(TypePrinting &TP,
     // they are used too often to have a single useful name.
     if (const PointerType *PTy = dyn_cast<PointerType>(Ty)) {
       const Type *PETy = PTy->getElementType();
-      if ((PETy->isPrimitiveType() || PETy->isInteger()) &&
-          !isa<OpaqueType>(PETy))
+      if ((PETy->isPrimitiveType() || PETy->isIntegerTy()) &&
+          !PETy->isOpaqueTy())
         continue;
     }
 
     // Likewise don't insert primitives either.
-    if (Ty->isInteger() || Ty->isPrimitiveType())
+    if (Ty->isIntegerTy() || Ty->isPrimitiveType())
       continue;
 
     // Get the name as a string and insert it into TypeNames.
@@ -849,7 +850,7 @@ static void WriteOptimizationInfo(raw_ostream &Out, const User *U) {
 static void WriteConstantInt(raw_ostream &Out, const Constant *CV,
                              TypePrinting &TypePrinter, SlotTracker *Machine) {
   if (const ConstantInt *CI = dyn_cast<ConstantInt>(CV)) {
-    if (CI->getType()->isInteger(1)) {
+    if (CI->getType()->isIntegerTy(1)) {
       Out << (CI->getZExtValue() ? "true" : "false");
       return;
     }
@@ -1236,7 +1237,6 @@ class AssemblyWriter {
   TypePrinting TypePrinter;
   AssemblyAnnotationWriter *AnnotationWriter;
   std::vector<const Type*> NumberedTypes;
-  SmallVector<StringRef, 8> MDNames;
   
 public:
   inline AssemblyWriter(formatted_raw_ostream &o, SlotTracker &Mac,
@@ -1244,8 +1244,6 @@ public:
                         AssemblyAnnotationWriter *AAW)
     : Out(o), Machine(Mac), TheModule(M), AnnotationWriter(AAW) {
     AddModuleTypesToPrinter(TypePrinter, NumberedTypes, M);
-    if (M)
-      M->getMDKindNames(MDNames);
   }
 
   void printMDNodeBody(const MDNode *MD);
@@ -1850,8 +1848,8 @@ void AssemblyWriter::printInstruction(const Instruction &I) {
     //
     Out << ' ';
     if (!FTy->isVarArg() &&
-        (!isa<PointerType>(RetTy) ||
-         !isa<FunctionType>(cast<PointerType>(RetTy)->getElementType()))) {
+        (!RetTy->isPointerTy() ||
+         !cast<PointerType>(RetTy)->getElementType()->isFunctionTy())) {
       TypePrinter.print(RetTy, Out);
       Out << ' ';
       writeOperand(Operand, false);
@@ -1896,8 +1894,8 @@ void AssemblyWriter::printInstruction(const Instruction &I) {
     //
     Out << ' ';
     if (!FTy->isVarArg() &&
-        (!isa<PointerType>(RetTy) ||
-         !isa<FunctionType>(cast<PointerType>(RetTy)->getElementType()))) {
+        (!RetTy->isPointerTy() ||
+         !cast<PointerType>(RetTy)->getElementType()->isFunctionTy())) {
       TypePrinter.print(RetTy, Out);
       Out << ' ';
       writeOperand(Operand, false);
@@ -1988,12 +1986,20 @@ void AssemblyWriter::printInstruction(const Instruction &I) {
   }
 
   // Print Metadata info.
-  if (!MDNames.empty()) {
-    SmallVector<std::pair<unsigned, MDNode*>, 4> InstMD;
-    I.getAllMetadata(InstMD);
-    for (unsigned i = 0, e = InstMD.size(); i != e; ++i)
-      Out << ", !" << MDNames[InstMD[i].first]
-          << " !" << Machine.getMetadataSlot(InstMD[i].second);
+  SmallVector<std::pair<unsigned, MDNode*>, 4> InstMD;
+  I.getAllMetadata(InstMD);
+  if (!InstMD.empty()) {
+    SmallVector<StringRef, 8> MDNames;
+    I.getType()->getContext().getMDKindNames(MDNames);
+    for (unsigned i = 0, e = InstMD.size(); i != e; ++i) {
+      unsigned Kind = InstMD[i].first;
+       if (Kind < MDNames.size()) {
+         Out << ", !" << MDNames[Kind];
+      } else {
+        Out << ", !<unknown kind #" << Kind << ">";
+      }
+      Out << " !" << Machine.getMetadataSlot(InstMD[i].second);
+    }
   }
   printInfoComment(I);
 }
diff --git a/libclamav/c++/llvm/lib/VMCore/Attributes.cpp b/libclamav/c++/llvm/lib/VMCore/Attributes.cpp
index 6fa597e..a000aee 100644
--- a/libclamav/c++/llvm/lib/VMCore/Attributes.cpp
+++ b/libclamav/c++/llvm/lib/VMCore/Attributes.cpp
@@ -89,11 +89,11 @@ std::string Attribute::getAsString(Attributes Attrs) {
 Attributes Attribute::typeIncompatible(const Type *Ty) {
   Attributes Incompatible = None;
   
-  if (!Ty->isInteger())
+  if (!Ty->isIntegerTy())
     // Attributes that only apply to integers.
     Incompatible |= SExt | ZExt;
   
-  if (!isa<PointerType>(Ty))
+  if (!Ty->isPointerTy())
     // Attributes that only apply to pointers.
     Incompatible |= ByVal | Nest | NoAlias | StructRet | NoCapture;
   
diff --git a/libclamav/c++/llvm/lib/VMCore/ConstantFold.cpp b/libclamav/c++/llvm/lib/VMCore/ConstantFold.cpp
index 4a245d2..549977c 100644
--- a/libclamav/c++/llvm/lib/VMCore/ConstantFold.cpp
+++ b/libclamav/c++/llvm/lib/VMCore/ConstantFold.cpp
@@ -112,7 +112,7 @@ static Constant *FoldBitCast(Constant *V, const Type *DestTy) {
             IdxList.push_back(Zero);
           } else if (const SequentialType *STy = 
                      dyn_cast<SequentialType>(ElTy)) {
-            if (isa<PointerType>(ElTy)) break;  // Can't index into pointers!
+            if (ElTy->isPointerTy()) break;  // Can't index into pointers!
             ElTy = STy->getElementType();
             IdxList.push_back(Zero);
           } else {
@@ -155,12 +155,12 @@ static Constant *FoldBitCast(Constant *V, const Type *DestTy) {
 
   // Handle integral constant input.
   if (ConstantInt *CI = dyn_cast<ConstantInt>(V)) {
-    if (DestTy->isInteger())
+    if (DestTy->isIntegerTy())
       // Integral -> Integral. This is a no-op because the bit widths must
       // be the same. Consequently, we just fold to V.
       return V;
 
-    if (DestTy->isFloatingPoint())
+    if (DestTy->isFloatingPointTy())
       return ConstantFP::get(DestTy->getContext(),
                              APFloat(CI->getValue(),
                                      !DestTy->isPPC_FP128Ty()));
@@ -189,7 +189,7 @@ static Constant *FoldBitCast(Constant *V, const Type *DestTy) {
 /// 
 static Constant *ExtractConstantBytes(Constant *C, unsigned ByteStart,
                                       unsigned ByteSize) {
-  assert(isa<IntegerType>(C->getType()) &&
+  assert(C->getType()->isIntegerTy() &&
          (cast<IntegerType>(C->getType())->getBitWidth() & 7) == 0 &&
          "Non-byte sized integer input");
   unsigned CSize = cast<IntegerType>(C->getType())->getBitWidth()/8;
@@ -334,11 +334,7 @@ static Constant *getFoldedSizeOf(const Type *Ty, const Type *DestTy,
     Constant *E = getFoldedSizeOf(ATy->getElementType(), DestTy, true);
     return ConstantExpr::getNUWMul(E, N);
   }
-  if (const VectorType *VTy = dyn_cast<VectorType>(Ty)) {
-    Constant *N = ConstantInt::get(DestTy, VTy->getNumElements());
-    Constant *E = getFoldedSizeOf(VTy->getElementType(), DestTy, true);
-    return ConstantExpr::getNUWMul(E, N);
-  }
+
   if (const StructType *STy = dyn_cast<StructType>(Ty))
     if (!STy->isPacked()) {
       unsigned NumElems = STy->getNumElements();
@@ -361,10 +357,26 @@ static Constant *getFoldedSizeOf(const Type *Ty, const Type *DestTy,
       }
     }
 
+  if (const UnionType *UTy = dyn_cast<UnionType>(Ty)) {
+    unsigned NumElems = UTy->getNumElements();
+    // Check for a union with all members having the same size.
+    Constant *MemberSize =
+      getFoldedSizeOf(UTy->getElementType(0), DestTy, true);
+    bool AllSame = true;
+    for (unsigned i = 1; i != NumElems; ++i)
+      if (MemberSize !=
+          getFoldedSizeOf(UTy->getElementType(i), DestTy, true)) {
+        AllSame = false;
+        break;
+      }
+    if (AllSame)
+      return MemberSize;
+  }
+
   // Pointer size doesn't depend on the pointee type, so canonicalize them
   // to an arbitrary pointee.
   if (const PointerType *PTy = dyn_cast<PointerType>(Ty))
-    if (!PTy->getElementType()->isInteger(1))
+    if (!PTy->getElementType()->isIntegerTy(1))
       return
         getFoldedSizeOf(PointerType::get(IntegerType::get(PTy->getContext(), 1),
                                          PTy->getAddressSpace()),
@@ -426,10 +438,28 @@ static Constant *getFoldedAlignOf(const Type *Ty, const Type *DestTy,
       return MemberAlign;
   }
 
+  if (const UnionType *UTy = dyn_cast<UnionType>(Ty)) {
+    // Union alignment is the maximum alignment of any member.
+    // Without target data, we can't compare much, but we can check to see
+    // if all the members have the same alignment.
+    unsigned NumElems = UTy->getNumElements();
+    // Check for a union with all members having the same alignment.
+    Constant *MemberAlign =
+      getFoldedAlignOf(UTy->getElementType(0), DestTy, true);
+    bool AllSame = true;
+    for (unsigned i = 1; i != NumElems; ++i)
+      if (MemberAlign != getFoldedAlignOf(UTy->getElementType(i), DestTy, true)) {
+        AllSame = false;
+        break;
+      }
+    if (AllSame)
+      return MemberAlign;
+  }
+
   // Pointer alignment doesn't depend on the pointee type, so canonicalize them
   // to an arbitrary pointee.
   if (const PointerType *PTy = dyn_cast<PointerType>(Ty))
-    if (!PTy->getElementType()->isInteger(1))
+    if (!PTy->getElementType()->isIntegerTy(1))
       return
         getFoldedAlignOf(PointerType::get(IntegerType::get(PTy->getContext(),
                                                            1),
@@ -464,13 +494,7 @@ static Constant *getFoldedOffsetOf(const Type *Ty, Constant *FieldNo,
     Constant *E = getFoldedSizeOf(ATy->getElementType(), DestTy, true);
     return ConstantExpr::getNUWMul(E, N);
   }
-  if (const VectorType *VTy = dyn_cast<VectorType>(Ty)) {
-    Constant *N = ConstantExpr::getCast(CastInst::getCastOpcode(FieldNo, false,
-                                                                DestTy, false),
-                                        FieldNo, DestTy);
-    Constant *E = getFoldedSizeOf(VTy->getElementType(), DestTy, true);
-    return ConstantExpr::getNUWMul(E, N);
-  }
+
   if (const StructType *STy = dyn_cast<StructType>(Ty))
     if (!STy->isPacked()) {
       unsigned NumElems = STy->getNumElements();
@@ -551,7 +575,7 @@ Constant *llvm::ConstantFoldCastInstruction(unsigned opc, Constant *V,
   // operating on each element. In the cast of bitcasts, the element
   // count may be mismatched; don't attempt to handle that here.
   if (ConstantVector *CV = dyn_cast<ConstantVector>(V))
-    if (isa<VectorType>(DestTy) &&
+    if (DestTy->isVectorTy() &&
         cast<VectorType>(DestTy)->getNumElements() ==
         CV->getType()->getNumElements()) {
       std::vector<Constant*> res;
@@ -629,12 +653,12 @@ Constant *llvm::ConstantFoldCastInstruction(unsigned opc, Constant *V,
               ConstantInt *CI = cast<ConstantInt>(CE->getOperand(2));
               if (CI->isOne() &&
                   STy->getNumElements() == 2 &&
-                  STy->getElementType(0)->isInteger(1)) {
+                  STy->getElementType(0)->isIntegerTy(1)) {
                 return getFoldedAlignOf(STy->getElementType(1), DestTy, false);
               }
             }
           // Handle an offsetof-like expression.
-          if (isa<StructType>(Ty) || isa<ArrayType>(Ty) || isa<VectorType>(Ty)){
+          if (Ty->isStructTy() || Ty->isArrayTy() || Ty->isVectorTy()){
             if (Constant *C = getFoldedOffsetOf(Ty, CE->getOperand(2),
                                                 DestTy, false))
               return C;
@@ -885,7 +909,7 @@ Constant *llvm::ConstantFoldInsertValueInstruction(Constant *Agg,
     unsigned numOps;
     if (const ArrayType *AR = dyn_cast<ArrayType>(AggTy))
       numOps = AR->getNumElements();
-    else if (isa<UnionType>(AggTy))
+    else if (AggTy->isUnionTy())
       numOps = 1;
     else
       numOps = cast<StructType>(AggTy)->getNumElements();
@@ -1105,6 +1129,10 @@ Constant *llvm::ConstantFoldBinaryInstruction(unsigned Opcode,
           return ConstantExpr::getLShr(C1, C2);
       break;
     }
+  } else if (isa<ConstantInt>(C1)) {
+    // If C1 is a ConstantInt and C2 is not, swap the operands.
+    if (Instruction::isCommutative(Opcode))
+      return ConstantExpr::get(Opcode, C2, C1);
   }
 
   // At this point we know neither constant is an UndefValue.
@@ -1364,35 +1392,12 @@ Constant *llvm::ConstantFoldBinaryInstruction(unsigned Opcode,
   } else if (isa<ConstantExpr>(C2)) {
     // If C2 is a constant expr and C1 isn't, flop them around and fold the
     // other way if possible.
-    switch (Opcode) {
-    case Instruction::Add:
-    case Instruction::FAdd:
-    case Instruction::Mul:
-    case Instruction::FMul:
-    case Instruction::And:
-    case Instruction::Or:
-    case Instruction::Xor:
-      // No change of opcode required.
+    if (Instruction::isCommutative(Opcode))
       return ConstantFoldBinaryInstruction(Opcode, C2, C1);
-
-    case Instruction::Shl:
-    case Instruction::LShr:
-    case Instruction::AShr:
-    case Instruction::Sub:
-    case Instruction::FSub:
-    case Instruction::SDiv:
-    case Instruction::UDiv:
-    case Instruction::FDiv:
-    case Instruction::URem:
-    case Instruction::SRem:
-    case Instruction::FRem:
-    default:  // These instructions cannot be flopped around.
-      break;
-    }
   }
 
   // i1 can be simplified in many cases.
-  if (C1->getType()->isInteger(1)) {
+  if (C1->getType()->isIntegerTy(1)) {
     switch (Opcode) {
     case Instruction::Add:
     case Instruction::Sub:
@@ -1427,7 +1432,7 @@ Constant *llvm::ConstantFoldBinaryInstruction(unsigned Opcode,
 /// isZeroSizedType - This type is zero sized if its an array or structure of
 /// zero sized types.  The only leaf zero sized type is an empty structure.
 static bool isMaybeZeroSizedType(const Type *Ty) {
-  if (isa<OpaqueType>(Ty)) return true;  // Can't say.
+  if (Ty->isOpaqueTy()) return true;  // Can't say.
   if (const StructType *STy = dyn_cast<StructType>(Ty)) {
 
     // If all of elements have zero size, this does too.
@@ -1458,10 +1463,10 @@ static int IdxCompare(Constant *C1, Constant *C2,  const Type *ElTy) {
 
   // Ok, we have two differing integer indices.  Sign extend them to be the same
   // type.  Long is always big enough, so we use it.
-  if (!C1->getType()->isInteger(64))
+  if (!C1->getType()->isIntegerTy(64))
     C1 = ConstantExpr::getSExt(C1, Type::getInt64Ty(C1->getContext()));
 
-  if (!C2->getType()->isInteger(64))
+  if (!C2->getType()->isIntegerTy(64))
     C2 = ConstantExpr::getSExt(C2, Type::getInt64Ty(C1->getContext()));
 
   if (C1 == C2) return 0;  // They are equal
@@ -1667,7 +1672,7 @@ static ICmpInst::Predicate evaluateICmpRelation(Constant *V1, Constant *V2,
       // If the cast is not actually changing bits, and the second operand is a
       // null pointer, do the comparison with the pre-casted value.
       if (V2->isNullValue() &&
-          (isa<PointerType>(CE1->getType()) || CE1->getType()->isInteger())) {
+          (CE1->getType()->isPointerTy() || CE1->getType()->isIntegerTy())) {
         if (CE1->getOpcode() == Instruction::ZExt) isSigned = false;
         if (CE1->getOpcode() == Instruction::SExt) isSigned = true;
         return evaluateICmpRelation(CE1Op0,
@@ -1813,7 +1818,7 @@ Constant *llvm::ConstantFoldCompareInstruction(unsigned short pred,
 
   // Handle some degenerate cases first
   if (isa<UndefValue>(C1) || isa<UndefValue>(C2))
-    return UndefValue::get(ResultTy);
+    return ConstantInt::get(ResultTy, CmpInst::isTrueWhenEqual(pred));
 
   // No compile-time operations on this type yet.
   if (C1->getType()->isPPC_FP128Ty())
@@ -1842,7 +1847,7 @@ Constant *llvm::ConstantFoldCompareInstruction(unsigned short pred,
   }
 
   // If the comparison is a comparison between two i1's, simplify it.
-  if (C1->getType()->isInteger(1)) {
+  if (C1->getType()->isIntegerTy(1)) {
     switch(pred) {
     case ICmpInst::ICMP_EQ:
       if (isa<ConstantInt>(C2))
@@ -1914,7 +1919,7 @@ Constant *llvm::ConstantFoldCompareInstruction(unsigned short pred,
       return ConstantInt::get(ResultTy, R==APFloat::cmpGreaterThan ||
                                         R==APFloat::cmpEqual);
     }
-  } else if (isa<VectorType>(C1->getType())) {
+  } else if (C1->getType()->isVectorTy()) {
     SmallVector<Constant*, 16> C1Elts, C2Elts;
     C1->getVectorElements(C1Elts);
     C2->getVectorElements(C2Elts);
@@ -1931,7 +1936,7 @@ Constant *llvm::ConstantFoldCompareInstruction(unsigned short pred,
     return ConstantVector::get(&ResElts[0], ResElts.size());
   }
 
-  if (C1->getType()->isFloatingPoint()) {
+  if (C1->getType()->isFloatingPointTy()) {
     int Result = -1;  // -1 = unknown, 0 = known false, 1 = known true.
     switch (evaluateFCmpRelation(C1, C2)) {
     default: llvm_unreachable("Unknown relation!");
@@ -2065,7 +2070,7 @@ Constant *llvm::ConstantFoldCompareInstruction(unsigned short pred,
     if (ConstantExpr *CE2 = dyn_cast<ConstantExpr>(C2)) {
       Constant *CE2Op0 = CE2->getOperand(0);
       if (CE2->getOpcode() == Instruction::BitCast &&
-          isa<VectorType>(CE2->getType())==isa<VectorType>(CE2Op0->getType())) {
+          CE2->getType()->isVectorTy() == CE2Op0->getType()->isVectorTy()) {
         Constant *Inverse = ConstantExpr::getBitCast(C1, CE2Op0->getType());
         return ConstantExpr::getICmp(pred, Inverse, CE2Op0);
       }
@@ -2073,8 +2078,8 @@ Constant *llvm::ConstantFoldCompareInstruction(unsigned short pred,
 
     // If the left hand side is an extension, try eliminating it.
     if (ConstantExpr *CE1 = dyn_cast<ConstantExpr>(C1)) {
-      if (CE1->getOpcode() == Instruction::SExt ||
-          CE1->getOpcode() == Instruction::ZExt) {
+      if ((CE1->getOpcode() == Instruction::SExt && ICmpInst::isSigned(pred)) ||
+          (CE1->getOpcode() == Instruction::ZExt && !ICmpInst::isSigned(pred))){
         Constant *CE1Op0 = CE1->getOperand(0);
         Constant *CE1Inverse = ConstantExpr::getTrunc(CE1, CE1Op0->getType());
         if (CE1Inverse == CE1Op0) {
@@ -2092,27 +2097,8 @@ Constant *llvm::ConstantFoldCompareInstruction(unsigned short pred,
       // If C2 is a constant expr and C1 isn't, flip them around and fold the
       // other way if possible.
       // Also, if C1 is null and C2 isn't, flip them around.
-      switch (pred) {
-      case ICmpInst::ICMP_EQ:
-      case ICmpInst::ICMP_NE:
-        // No change of predicate required.
-        return ConstantExpr::getICmp(pred, C2, C1);
-
-      case ICmpInst::ICMP_ULT:
-      case ICmpInst::ICMP_SLT:
-      case ICmpInst::ICMP_UGT:
-      case ICmpInst::ICMP_SGT:
-      case ICmpInst::ICMP_ULE:
-      case ICmpInst::ICMP_SLE:
-      case ICmpInst::ICMP_UGE:
-      case ICmpInst::ICMP_SGE:
-        // Change the predicate as necessary to swap the operands.
-        pred = ICmpInst::getSwappedPredicate((ICmpInst::Predicate)pred);
-        return ConstantExpr::getICmp(pred, C2, C1);
-
-      default:  // These predicates cannot be flopped around.
-        break;
-      }
+      pred = ICmpInst::getSwappedPredicate((ICmpInst::Predicate)pred);
+      return ConstantExpr::getICmp(pred, C2, C1);
     }
   }
   return 0;
@@ -2184,7 +2170,7 @@ Constant *llvm::ConstantFoldGetElementPtr(Constant *C,
            I != E; ++I)
         LastTy = *I;
 
-      if ((LastTy && isa<ArrayType>(LastTy)) || Idx0->isNullValue()) {
+      if ((LastTy && LastTy->isArrayTy()) || Idx0->isNullValue()) {
         SmallVector<Value*, 16> NewIndices;
         NewIndices.reserve(NumIdx + CE->getNumOperands());
         for (unsigned i = 1, e = CE->getNumOperands()-1; i != e; ++i)
@@ -2266,10 +2252,10 @@ Constant *llvm::ConstantFoldGetElementPtr(Constant *C,
 
             // Before adding, extend both operands to i64 to avoid
             // overflow trouble.
-            if (!PrevIdx->getType()->isInteger(64))
+            if (!PrevIdx->getType()->isIntegerTy(64))
               PrevIdx = ConstantExpr::getSExt(PrevIdx,
                                            Type::getInt64Ty(Div->getContext()));
-            if (!Div->getType()->isInteger(64))
+            if (!Div->getType()->isIntegerTy(64))
               Div = ConstantExpr::getSExt(Div,
                                           Type::getInt64Ty(Div->getContext()));
 
diff --git a/libclamav/c++/llvm/lib/VMCore/Constants.cpp b/libclamav/c++/llvm/lib/VMCore/Constants.cpp
index 8cc6e94..10f8879 100644
--- a/libclamav/c++/llvm/lib/VMCore/Constants.cpp
+++ b/libclamav/c++/llvm/lib/VMCore/Constants.cpp
@@ -229,7 +229,7 @@ Constant::PossibleRelocationsTy Constant::getRelocationInfo() const {
 /// This handles breaking down a vector undef into undef elements, etc.  For
 /// constant exprs and other cases we can't handle, we return an empty vector.
 void Constant::getVectorElements(SmallVectorImpl<Constant*> &Elts) const {
-  assert(isa<VectorType>(getType()) && "Not a vector constant!");
+  assert(getType()->isVectorTy() && "Not a vector constant!");
   
   if (const ConstantVector *CV = dyn_cast<ConstantVector>(this)) {
     for (unsigned i = 0, e = CV->getNumOperands(); i != e; ++i)
@@ -404,13 +404,13 @@ ConstantFP* ConstantFP::getNegativeZero(const Type* Ty) {
 
 Constant* ConstantFP::getZeroValueForNegation(const Type* Ty) {
   if (const VectorType *PTy = dyn_cast<VectorType>(Ty))
-    if (PTy->getElementType()->isFloatingPoint()) {
+    if (PTy->getElementType()->isFloatingPointTy()) {
       std::vector<Constant*> zeros(PTy->getNumElements(),
                            getNegativeZero(PTy->getElementType()));
       return ConstantVector::get(PTy, zeros);
     }
 
-  if (Ty->isFloatingPoint()) 
+  if (Ty->isFloatingPointTy()) 
     return getNegativeZero(Ty);
 
   return Constant::getNullValue(Ty);
@@ -661,13 +661,13 @@ Constant* ConstantVector::get(Constant* const* Vals, unsigned NumVals) {
 }
 
 Constant* ConstantExpr::getNSWNeg(Constant* C) {
-  assert(C->getType()->isIntOrIntVector() &&
+  assert(C->getType()->isIntOrIntVectorTy() &&
          "Cannot NEG a nonintegral value!");
   return getNSWSub(ConstantFP::getZeroValueForNegation(C->getType()), C);
 }
 
 Constant* ConstantExpr::getNUWNeg(Constant* C) {
-  assert(C->getType()->isIntOrIntVector() &&
+  assert(C->getType()->isIntOrIntVectorTy() &&
          "Cannot NEG a nonintegral value!");
   return getNUWSub(ConstantFP::getZeroValueForNegation(C->getType()), C);
 }
@@ -944,7 +944,7 @@ bool ConstantFP::isValueValidForType(const Type *Ty, const APFloat& Val) {
 //                      Factory Function Implementation
 
 ConstantAggregateZero* ConstantAggregateZero::get(const Type* Ty) {
-  assert((isa<StructType>(Ty) || isa<ArrayType>(Ty) || isa<VectorType>(Ty)) &&
+  assert((Ty->isStructTy() || Ty->isArrayTy() || Ty->isVectorTy()) &&
          "Cannot create an aggregate zero of non-aggregate type!");
   
   LLVMContextImpl *pImpl = Ty->getContext().pImpl;
@@ -969,7 +969,7 @@ void ConstantArray::destroyConstant() {
 /// if the elements of the array are all ConstantInt's.
 bool ConstantArray::isString() const {
   // Check the element type for i8...
-  if (!getType()->getElementType()->isInteger(8))
+  if (!getType()->getElementType()->isIntegerTy(8))
     return false;
   // Check the elements to make sure they are all integers, not constant
   // expressions.
@@ -984,7 +984,7 @@ bool ConstantArray::isString() const {
 /// null bytes except its terminator.
 bool ConstantArray::isCString() const {
   // Check the element type for i8...
-  if (!getType()->getElementType()->isInteger(8))
+  if (!getType()->getElementType()->isIntegerTy(8))
     return false;
 
   // Last element must be a null.
@@ -1239,18 +1239,18 @@ Constant *ConstantExpr::getTruncOrBitCast(Constant *C, const Type *Ty) {
 }
 
 Constant *ConstantExpr::getPointerCast(Constant *S, const Type *Ty) {
-  assert(isa<PointerType>(S->getType()) && "Invalid cast");
-  assert((Ty->isInteger() || isa<PointerType>(Ty)) && "Invalid cast");
+  assert(S->getType()->isPointerTy() && "Invalid cast");
+  assert((Ty->isIntegerTy() || Ty->isPointerTy()) && "Invalid cast");
 
-  if (Ty->isInteger())
+  if (Ty->isIntegerTy())
     return getCast(Instruction::PtrToInt, S, Ty);
   return getCast(Instruction::BitCast, S, Ty);
 }
 
 Constant *ConstantExpr::getIntegerCast(Constant *C, const Type *Ty, 
                                        bool isSigned) {
-  assert(C->getType()->isIntOrIntVector() &&
-         Ty->isIntOrIntVector() && "Invalid cast");
+  assert(C->getType()->isIntOrIntVectorTy() &&
+         Ty->isIntOrIntVectorTy() && "Invalid cast");
   unsigned SrcBits = C->getType()->getScalarSizeInBits();
   unsigned DstBits = Ty->getScalarSizeInBits();
   Instruction::CastOps opcode =
@@ -1261,7 +1261,7 @@ Constant *ConstantExpr::getIntegerCast(Constant *C, const Type *Ty,
 }
 
 Constant *ConstantExpr::getFPCast(Constant *C, const Type *Ty) {
-  assert(C->getType()->isFPOrFPVector() && Ty->isFPOrFPVector() &&
+  assert(C->getType()->isFPOrFPVectorTy() && Ty->isFPOrFPVectorTy() &&
          "Invalid cast");
   unsigned SrcBits = C->getType()->getScalarSizeInBits();
   unsigned DstBits = Ty->getScalarSizeInBits();
@@ -1278,8 +1278,8 @@ Constant *ConstantExpr::getTrunc(Constant *C, const Type *Ty) {
   bool toVec = Ty->getTypeID() == Type::VectorTyID;
 #endif
   assert((fromVec == toVec) && "Cannot convert from scalar to/from vector");
-  assert(C->getType()->isIntOrIntVector() && "Trunc operand must be integer");
-  assert(Ty->isIntOrIntVector() && "Trunc produces only integral");
+  assert(C->getType()->isIntOrIntVectorTy() && "Trunc operand must be integer");
+  assert(Ty->isIntOrIntVectorTy() && "Trunc produces only integral");
   assert(C->getType()->getScalarSizeInBits() > Ty->getScalarSizeInBits()&&
          "SrcTy must be larger than DestTy for Trunc!");
 
@@ -1292,8 +1292,8 @@ Constant *ConstantExpr::getSExt(Constant *C, const Type *Ty) {
   bool toVec = Ty->getTypeID() == Type::VectorTyID;
 #endif
   assert((fromVec == toVec) && "Cannot convert from scalar to/from vector");
-  assert(C->getType()->isIntOrIntVector() && "SExt operand must be integral");
-  assert(Ty->isIntOrIntVector() && "SExt produces only integer");
+  assert(C->getType()->isIntOrIntVectorTy() && "SExt operand must be integral");
+  assert(Ty->isIntOrIntVectorTy() && "SExt produces only integer");
   assert(C->getType()->getScalarSizeInBits() < Ty->getScalarSizeInBits()&&
          "SrcTy must be smaller than DestTy for SExt!");
 
@@ -1306,8 +1306,8 @@ Constant *ConstantExpr::getZExt(Constant *C, const Type *Ty) {
   bool toVec = Ty->getTypeID() == Type::VectorTyID;
 #endif
   assert((fromVec == toVec) && "Cannot convert from scalar to/from vector");
-  assert(C->getType()->isIntOrIntVector() && "ZEXt operand must be integral");
-  assert(Ty->isIntOrIntVector() && "ZExt produces only integer");
+  assert(C->getType()->isIntOrIntVectorTy() && "ZEXt operand must be integral");
+  assert(Ty->isIntOrIntVectorTy() && "ZExt produces only integer");
   assert(C->getType()->getScalarSizeInBits() < Ty->getScalarSizeInBits()&&
          "SrcTy must be smaller than DestTy for ZExt!");
 
@@ -1320,7 +1320,7 @@ Constant *ConstantExpr::getFPTrunc(Constant *C, const Type *Ty) {
   bool toVec = Ty->getTypeID() == Type::VectorTyID;
 #endif
   assert((fromVec == toVec) && "Cannot convert from scalar to/from vector");
-  assert(C->getType()->isFPOrFPVector() && Ty->isFPOrFPVector() &&
+  assert(C->getType()->isFPOrFPVectorTy() && Ty->isFPOrFPVectorTy() &&
          C->getType()->getScalarSizeInBits() > Ty->getScalarSizeInBits()&&
          "This is an illegal floating point truncation!");
   return getFoldedCast(Instruction::FPTrunc, C, Ty);
@@ -1332,7 +1332,7 @@ Constant *ConstantExpr::getFPExtend(Constant *C, const Type *Ty) {
   bool toVec = Ty->getTypeID() == Type::VectorTyID;
 #endif
   assert((fromVec == toVec) && "Cannot convert from scalar to/from vector");
-  assert(C->getType()->isFPOrFPVector() && Ty->isFPOrFPVector() &&
+  assert(C->getType()->isFPOrFPVectorTy() && Ty->isFPOrFPVectorTy() &&
          C->getType()->getScalarSizeInBits() < Ty->getScalarSizeInBits()&&
          "This is an illegal floating point extension!");
   return getFoldedCast(Instruction::FPExt, C, Ty);
@@ -1344,7 +1344,7 @@ Constant *ConstantExpr::getUIToFP(Constant *C, const Type *Ty) {
   bool toVec = Ty->getTypeID() == Type::VectorTyID;
 #endif
   assert((fromVec == toVec) && "Cannot convert from scalar to/from vector");
-  assert(C->getType()->isIntOrIntVector() && Ty->isFPOrFPVector() &&
+  assert(C->getType()->isIntOrIntVectorTy() && Ty->isFPOrFPVectorTy() &&
          "This is an illegal uint to floating point cast!");
   return getFoldedCast(Instruction::UIToFP, C, Ty);
 }
@@ -1355,7 +1355,7 @@ Constant *ConstantExpr::getSIToFP(Constant *C, const Type *Ty) {
   bool toVec = Ty->getTypeID() == Type::VectorTyID;
 #endif
   assert((fromVec == toVec) && "Cannot convert from scalar to/from vector");
-  assert(C->getType()->isIntOrIntVector() && Ty->isFPOrFPVector() &&
+  assert(C->getType()->isIntOrIntVectorTy() && Ty->isFPOrFPVectorTy() &&
          "This is an illegal sint to floating point cast!");
   return getFoldedCast(Instruction::SIToFP, C, Ty);
 }
@@ -1366,7 +1366,7 @@ Constant *ConstantExpr::getFPToUI(Constant *C, const Type *Ty) {
   bool toVec = Ty->getTypeID() == Type::VectorTyID;
 #endif
   assert((fromVec == toVec) && "Cannot convert from scalar to/from vector");
-  assert(C->getType()->isFPOrFPVector() && Ty->isIntOrIntVector() &&
+  assert(C->getType()->isFPOrFPVectorTy() && Ty->isIntOrIntVectorTy() &&
          "This is an illegal floating point to uint cast!");
   return getFoldedCast(Instruction::FPToUI, C, Ty);
 }
@@ -1377,20 +1377,20 @@ Constant *ConstantExpr::getFPToSI(Constant *C, const Type *Ty) {
   bool toVec = Ty->getTypeID() == Type::VectorTyID;
 #endif
   assert((fromVec == toVec) && "Cannot convert from scalar to/from vector");
-  assert(C->getType()->isFPOrFPVector() && Ty->isIntOrIntVector() &&
+  assert(C->getType()->isFPOrFPVectorTy() && Ty->isIntOrIntVectorTy() &&
          "This is an illegal floating point to sint cast!");
   return getFoldedCast(Instruction::FPToSI, C, Ty);
 }
 
 Constant *ConstantExpr::getPtrToInt(Constant *C, const Type *DstTy) {
-  assert(isa<PointerType>(C->getType()) && "PtrToInt source must be pointer");
-  assert(DstTy->isInteger() && "PtrToInt destination must be integral");
+  assert(C->getType()->isPointerTy() && "PtrToInt source must be pointer");
+  assert(DstTy->isIntegerTy() && "PtrToInt destination must be integral");
   return getFoldedCast(Instruction::PtrToInt, C, DstTy);
 }
 
 Constant *ConstantExpr::getIntToPtr(Constant *C, const Type *DstTy) {
-  assert(C->getType()->isInteger() && "IntToPtr source must be integral");
-  assert(isa<PointerType>(DstTy) && "IntToPtr destination must be a pointer");
+  assert(C->getType()->isIntegerTy() && "IntToPtr source must be integral");
+  assert(DstTy->isPointerTy() && "IntToPtr destination must be a pointer");
   return getFoldedCast(Instruction::IntToPtr, C, DstTy);
 }
 
@@ -1449,7 +1449,7 @@ Constant *ConstantExpr::getCompareTy(unsigned short predicate,
 Constant *ConstantExpr::get(unsigned Opcode, Constant *C1, Constant *C2,
                             unsigned Flags) {
   // API compatibility: Adjust integer opcodes to floating-point opcodes.
-  if (C1->getType()->isFPOrFPVector()) {
+  if (C1->getType()->isFPOrFPVectorTy()) {
     if (Opcode == Instruction::Add) Opcode = Instruction::FAdd;
     else if (Opcode == Instruction::Sub) Opcode = Instruction::FSub;
     else if (Opcode == Instruction::Mul) Opcode = Instruction::FMul;
@@ -1460,51 +1460,51 @@ Constant *ConstantExpr::get(unsigned Opcode, Constant *C1, Constant *C2,
   case Instruction::Sub:
   case Instruction::Mul:
     assert(C1->getType() == C2->getType() && "Op types should be identical!");
-    assert(C1->getType()->isIntOrIntVector() &&
+    assert(C1->getType()->isIntOrIntVectorTy() &&
            "Tried to create an integer operation on a non-integer type!");
     break;
   case Instruction::FAdd:
   case Instruction::FSub:
   case Instruction::FMul:
     assert(C1->getType() == C2->getType() && "Op types should be identical!");
-    assert(C1->getType()->isFPOrFPVector() &&
+    assert(C1->getType()->isFPOrFPVectorTy() &&
            "Tried to create a floating-point operation on a "
            "non-floating-point type!");
     break;
   case Instruction::UDiv: 
   case Instruction::SDiv: 
     assert(C1->getType() == C2->getType() && "Op types should be identical!");
-    assert(C1->getType()->isIntOrIntVector() &&
+    assert(C1->getType()->isIntOrIntVectorTy() &&
            "Tried to create an arithmetic operation on a non-arithmetic type!");
     break;
   case Instruction::FDiv:
     assert(C1->getType() == C2->getType() && "Op types should be identical!");
-    assert(C1->getType()->isFPOrFPVector() &&
+    assert(C1->getType()->isFPOrFPVectorTy() &&
            "Tried to create an arithmetic operation on a non-arithmetic type!");
     break;
   case Instruction::URem: 
   case Instruction::SRem: 
     assert(C1->getType() == C2->getType() && "Op types should be identical!");
-    assert(C1->getType()->isIntOrIntVector() &&
+    assert(C1->getType()->isIntOrIntVectorTy() &&
            "Tried to create an arithmetic operation on a non-arithmetic type!");
     break;
   case Instruction::FRem:
     assert(C1->getType() == C2->getType() && "Op types should be identical!");
-    assert(C1->getType()->isFPOrFPVector() &&
+    assert(C1->getType()->isFPOrFPVectorTy() &&
            "Tried to create an arithmetic operation on a non-arithmetic type!");
     break;
   case Instruction::And:
   case Instruction::Or:
   case Instruction::Xor:
     assert(C1->getType() == C2->getType() && "Op types should be identical!");
-    assert(C1->getType()->isIntOrIntVector() &&
+    assert(C1->getType()->isIntOrIntVectorTy() &&
            "Tried to create a logical operation on a non-integral type!");
     break;
   case Instruction::Shl:
   case Instruction::LShr:
   case Instruction::AShr:
     assert(C1->getType() == C2->getType() && "Op types should be identical!");
-    assert(C1->getType()->isIntOrIntVector() &&
+    assert(C1->getType()->isIntOrIntVectorTy() &&
            "Tried to create a shift operation on a non-integer type!");
     break;
   default:
@@ -1592,7 +1592,7 @@ Constant *ConstantExpr::getGetElementPtrTy(const Type *ReqTy, Constant *C,
                                                (Constant**)Idxs, NumIdx))
     return FC;          // Fold a few common cases...
 
-  assert(isa<PointerType>(C->getType()) &&
+  assert(C->getType()->isPointerTy() &&
          "Non-pointer type for constant GetElementPtr expression");
   // Look up the constant in the table first to ensure uniqueness
   std::vector<Constant*> ArgVec;
@@ -1619,7 +1619,7 @@ Constant *ConstantExpr::getInBoundsGetElementPtrTy(const Type *ReqTy,
                                                (Constant**)Idxs, NumIdx))
     return FC;          // Fold a few common cases...
 
-  assert(isa<PointerType>(C->getType()) &&
+  assert(C->getType()->isPointerTy() &&
          "Non-pointer type for constant GetElementPtr expression");
   // Look up the constant in the table first to ensure uniqueness
   std::vector<Constant*> ArgVec;
@@ -1727,9 +1727,9 @@ Constant *ConstantExpr::getExtractElementTy(const Type *ReqTy, Constant *Val,
 }
 
 Constant *ConstantExpr::getExtractElement(Constant *Val, Constant *Idx) {
-  assert(isa<VectorType>(Val->getType()) &&
+  assert(Val->getType()->isVectorTy() &&
          "Tried to create extractelement operation on non-vector type!");
-  assert(Idx->getType()->isInteger(32) &&
+  assert(Idx->getType()->isIntegerTy(32) &&
          "Extractelement index must be i32 type!");
   return getExtractElementTy(cast<VectorType>(Val->getType())->getElementType(),
                              Val, Idx);
@@ -1751,11 +1751,11 @@ Constant *ConstantExpr::getInsertElementTy(const Type *ReqTy, Constant *Val,
 
 Constant *ConstantExpr::getInsertElement(Constant *Val, Constant *Elt, 
                                          Constant *Idx) {
-  assert(isa<VectorType>(Val->getType()) &&
+  assert(Val->getType()->isVectorTy() &&
          "Tried to create insertelement operation on non-vector type!");
   assert(Elt->getType() == cast<VectorType>(Val->getType())->getElementType()
          && "Insertelement types must match!");
-  assert(Idx->getType()->isInteger(32) &&
+  assert(Idx->getType()->isIntegerTy(32) &&
          "Insertelement index must be i32 type!");
   return getInsertElementTy(Val->getType(), Val, Elt, Idx);
 }
@@ -1839,9 +1839,9 @@ Constant *ConstantExpr::getExtractValue(Constant *Agg,
 
 Constant* ConstantExpr::getNeg(Constant* C) {
   // API compatibility: Adjust integer opcodes to floating-point opcodes.
-  if (C->getType()->isFPOrFPVector())
+  if (C->getType()->isFPOrFPVectorTy())
     return getFNeg(C);
-  assert(C->getType()->isIntOrIntVector() &&
+  assert(C->getType()->isIntOrIntVectorTy() &&
          "Cannot NEG a nonintegral value!");
   return get(Instruction::Sub,
              ConstantFP::getZeroValueForNegation(C->getType()),
@@ -1849,7 +1849,7 @@ Constant* ConstantExpr::getNeg(Constant* C) {
 }
 
 Constant* ConstantExpr::getFNeg(Constant* C) {
-  assert(C->getType()->isFPOrFPVector() &&
+  assert(C->getType()->isFPOrFPVectorTy() &&
          "Cannot FNEG a non-floating-point value!");
   return get(Instruction::FSub,
              ConstantFP::getZeroValueForNegation(C->getType()),
@@ -1857,7 +1857,7 @@ Constant* ConstantExpr::getFNeg(Constant* C) {
 }
 
 Constant* ConstantExpr::getNot(Constant* C) {
-  assert(C->getType()->isIntOrIntVector() &&
+  assert(C->getType()->isIntOrIntVectorTy() &&
          "Cannot NOT a nonintegral value!");
   return get(Instruction::Xor, C, Constant::getAllOnesValue(C->getType()));
 }
@@ -2113,7 +2113,52 @@ void ConstantStruct::replaceUsesOfWithOnConstant(Value *From, Value *To,
 
 void ConstantUnion::replaceUsesOfWithOnConstant(Value *From, Value *To,
                                                  Use *U) {
-  assert(false && "Implement replaceUsesOfWithOnConstant for unions");
+  assert(isa<Constant>(To) && "Cannot make Constant refer to non-constant!");
+  Constant *ToC = cast<Constant>(To);
+
+  assert(U == OperandList && "Union constants can only have one use!");
+  assert(getNumOperands() == 1 && "Union constants can only have one use!");
+  assert(getOperand(0) == From && "ReplaceAllUsesWith broken!");
+
+  std::pair<LLVMContextImpl::UnionConstantsTy::MapKey, ConstantUnion*> Lookup;
+  Lookup.first.first = getType();
+  Lookup.second = this;
+  Lookup.first.second = ToC;
+
+  LLVMContext &Context = getType()->getContext();
+  LLVMContextImpl *pImpl = Context.pImpl;
+
+  Constant *Replacement = 0;
+  if (ToC->isNullValue()) {
+    Replacement = ConstantAggregateZero::get(getType());
+  } else {
+    // Check to see if we have this union type already.
+    bool Exists;
+    LLVMContextImpl::UnionConstantsTy::MapTy::iterator I =
+      pImpl->UnionConstants.InsertOrGetItem(Lookup, Exists);
+    
+    if (Exists) {
+      Replacement = I->second;
+    } else {
+      // Okay, the new shape doesn't exist in the system yet.  Instead of
+      // creating a new constant union, inserting it, replaceallusesof'ing the
+      // old with the new, then deleting the old... just update the current one
+      // in place!
+      pImpl->UnionConstants.MoveConstantToNewSlot(this, I);
+      
+      // Update to the new value.
+      setOperand(0, ToC);
+      return;
+    }
+  }
+  
+  assert(Replacement != this && "I didn't contain From!");
+  
+  // Everyone using this now uses the replacement.
+  uncheckedReplaceAllUsesWith(Replacement);
+  
+  // Delete the old constant!
+  destroyConstant();
 }
 
 void ConstantVector::replaceUsesOfWithOnConstant(Value *From, Value *To,
diff --git a/libclamav/c++/llvm/lib/VMCore/Core.cpp b/libclamav/c++/llvm/lib/VMCore/Core.cpp
index a044fc5..f4f65c5 100644
--- a/libclamav/c++/llvm/lib/VMCore/Core.cpp
+++ b/libclamav/c++/llvm/lib/VMCore/Core.cpp
@@ -55,6 +55,15 @@ void LLVMContextDispose(LLVMContextRef C) {
   delete unwrap(C);
 }
 
+unsigned LLVMGetMDKindIDInContext(LLVMContextRef C, const char* Name,
+                                  unsigned SLen) {
+  return unwrap(C)->getMDKindID(StringRef(Name, SLen));
+}
+
+unsigned LLVMGetMDKindID(const char* Name, unsigned SLen) {
+  return LLVMGetMDKindIDInContext(LLVMGetGlobalContext(), Name, SLen);
+}
+
 
 /*===-- Operations on modules ---------------------------------------------===*/
 
@@ -425,6 +434,18 @@ void LLVMReplaceAllUsesWith(LLVMValueRef OldVal, LLVMValueRef NewVal) {
   unwrap(OldVal)->replaceAllUsesWith(unwrap(NewVal));
 }
 
+int LLVMHasMetadata(LLVMValueRef Inst) {
+  return unwrap<Instruction>(Inst)->hasMetadata();
+}
+
+LLVMValueRef LLVMGetMetadata(LLVMValueRef Inst, unsigned KindID) {
+  return wrap(unwrap<Instruction>(Inst)->getMetadata(KindID));
+}
+
+void LLVMSetMetadata(LLVMValueRef Inst, unsigned KindID, LLVMValueRef MD) {
+  unwrap<Instruction>(Inst)->setMetadata(KindID, MD? unwrap<MDNode>(MD) : NULL);
+}
+
 /*--.. Conversion functions ................................................--*/
 
 #define LLVM_DEFINE_VALUE_CAST(name)                                       \
@@ -435,7 +456,7 @@ void LLVMReplaceAllUsesWith(LLVMValueRef OldVal, LLVMValueRef NewVal) {
 LLVM_FOR_EACH_VALUE_SUBCLASS(LLVM_DEFINE_VALUE_CAST)
 
 /*--.. Operations on Uses ..................................................--*/
-LLVMUseIteratorRef LLVMGetFirstUse(LLVMValueRef Val) {
+LLVMUseRef LLVMGetFirstUse(LLVMValueRef Val) {
   Value *V = unwrap(Val);
   Value::use_iterator I = V->use_begin();
   if (I == V->use_end())
@@ -443,16 +464,19 @@ LLVMUseIteratorRef LLVMGetFirstUse(LLVMValueRef Val) {
   return wrap(&(I.getUse()));
 }
 
-LLVMUseIteratorRef LLVMGetNextUse(LLVMUseIteratorRef UR) {
-  return wrap(unwrap(UR)->getNext());
+LLVMUseRef LLVMGetNextUse(LLVMUseRef U) {
+  Use *Next = unwrap(U)->getNext();
+  if (Next)
+    return wrap(Next);
+  return 0;
 }
 
-LLVMValueRef LLVMGetUser(LLVMUseIteratorRef UR) {
-  return wrap(unwrap(UR)->getUser());
+LLVMValueRef LLVMGetUser(LLVMUseRef U) {
+  return wrap(unwrap(U)->getUser());
 }
 
-LLVMValueRef LLVMGetUsedValue(LLVMUseIteratorRef UR) {
-  return wrap(unwrap(UR)->get());
+LLVMValueRef LLVMGetUsedValue(LLVMUseRef U) {
+  return wrap(unwrap(U)->get());
 }
 
 /*--.. Operations on Users .................................................--*/
@@ -493,6 +517,26 @@ LLVMValueRef LLVMConstPointerNull(LLVMTypeRef Ty) {
       wrap(ConstantPointerNull::get(unwrap<PointerType>(Ty)));
 }
 
+/*--.. Operations on metadata nodes ........................................--*/
+
+LLVMValueRef LLVMMDStringInContext(LLVMContextRef C, const char *Str,
+                                   unsigned SLen) {
+  return wrap(MDString::get(*unwrap(C), StringRef(Str, SLen)));
+}
+
+LLVMValueRef LLVMMDString(const char *Str, unsigned SLen) {
+  return LLVMMDStringInContext(LLVMGetGlobalContext(), Str, SLen);
+}
+
+LLVMValueRef LLVMMDNodeInContext(LLVMContextRef C, LLVMValueRef *Vals,
+                                 unsigned Count) {
+  return wrap(MDNode::get(*unwrap(C), unwrap<Value>(Vals, Count), Count));
+}
+
+LLVMValueRef LLVMMDNode(LLVMValueRef *Vals, unsigned Count) {
+  return LLVMMDNodeInContext(LLVMGetGlobalContext(), Vals, Count);
+}
+
 /*--.. Operations on scalar constants ......................................--*/
 
 LLVMValueRef LLVMConstInt(LLVMTypeRef IntTy, unsigned long long N,
@@ -567,11 +611,13 @@ LLVMValueRef LLVMConstStruct(LLVMValueRef *ConstantVals, unsigned Count,
   return LLVMConstStructInContext(LLVMGetGlobalContext(), ConstantVals, Count,
                                   Packed);
 }
-
 LLVMValueRef LLVMConstVector(LLVMValueRef *ScalarConstantVals, unsigned Size) {
   return wrap(ConstantVector::get(
                             unwrap<Constant>(ScalarConstantVals, Size), Size));
 }
+LLVMValueRef LLVMConstUnion(LLVMTypeRef Ty, LLVMValueRef Val) {
+  return wrap(ConstantUnion::get(unwrap<UnionType>(Ty), unwrap<Constant>(Val)));
+}
 
 /*--.. Constant expressions ................................................--*/
 
@@ -592,6 +638,17 @@ LLVMValueRef LLVMConstNeg(LLVMValueRef ConstantVal) {
                                    unwrap<Constant>(ConstantVal)));
 }
 
+LLVMValueRef LLVMConstNSWNeg(LLVMValueRef ConstantVal) {
+  return wrap(ConstantExpr::getNSWNeg(
+                                      unwrap<Constant>(ConstantVal)));
+}
+
+LLVMValueRef LLVMConstNUWNeg(LLVMValueRef ConstantVal) {
+  return wrap(ConstantExpr::getNUWNeg(
+                                      unwrap<Constant>(ConstantVal)));
+}
+
+
 LLVMValueRef LLVMConstFNeg(LLVMValueRef ConstantVal) {
   return wrap(ConstantExpr::getFNeg(
                                     unwrap<Constant>(ConstantVal)));
@@ -615,6 +672,13 @@ LLVMValueRef LLVMConstNSWAdd(LLVMValueRef LHSConstant,
                                       unwrap<Constant>(RHSConstant)));
 }
 
+LLVMValueRef LLVMConstNUWAdd(LLVMValueRef LHSConstant,
+                             LLVMValueRef RHSConstant) {
+  return wrap(ConstantExpr::getNUWAdd(
+                                      unwrap<Constant>(LHSConstant),
+                                      unwrap<Constant>(RHSConstant)));
+}
+
 LLVMValueRef LLVMConstFAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) {
   return wrap(ConstantExpr::getFAdd(
                                     unwrap<Constant>(LHSConstant),
@@ -627,6 +691,20 @@ LLVMValueRef LLVMConstSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) {
                                    unwrap<Constant>(RHSConstant)));
 }
 
+LLVMValueRef LLVMConstNSWSub(LLVMValueRef LHSConstant,
+                             LLVMValueRef RHSConstant) {
+  return wrap(ConstantExpr::getNSWSub(
+                                      unwrap<Constant>(LHSConstant),
+                                      unwrap<Constant>(RHSConstant)));
+}
+
+LLVMValueRef LLVMConstNUWSub(LLVMValueRef LHSConstant,
+                             LLVMValueRef RHSConstant) {
+  return wrap(ConstantExpr::getNUWSub(
+                                      unwrap<Constant>(LHSConstant),
+                                      unwrap<Constant>(RHSConstant)));
+}
+
 LLVMValueRef LLVMConstFSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) {
   return wrap(ConstantExpr::getFSub(unwrap<Constant>(LHSConstant),
                                     unwrap<Constant>(RHSConstant)));
@@ -638,6 +716,20 @@ LLVMValueRef LLVMConstMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) {
                                    unwrap<Constant>(RHSConstant)));
 }
 
+LLVMValueRef LLVMConstNSWMul(LLVMValueRef LHSConstant,
+                             LLVMValueRef RHSConstant) {
+  return wrap(ConstantExpr::getNSWMul(
+                                      unwrap<Constant>(LHSConstant),
+                                      unwrap<Constant>(RHSConstant)));
+}
+
+LLVMValueRef LLVMConstNUWMul(LLVMValueRef LHSConstant,
+                             LLVMValueRef RHSConstant) {
+  return wrap(ConstantExpr::getNUWMul(
+                                      unwrap<Constant>(LHSConstant),
+                                      unwrap<Constant>(RHSConstant)));
+}
+
 LLVMValueRef LLVMConstFMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant) {
   return wrap(ConstantExpr::getFMul(
                                     unwrap<Constant>(LHSConstant),
@@ -924,6 +1016,10 @@ LLVMValueRef LLVMConstInlineAsm(LLVMTypeRef Ty, const char *AsmString,
                              Constraints, HasSideEffects, IsAlignStack));
 }
 
+LLVMValueRef LLVMBlockAddress(LLVMValueRef F, LLVMBasicBlockRef BB) {
+  return wrap(BlockAddress::get(unwrap<Function>(F), unwrap(BB)));
+}
+
 /*--.. Operations on global variables, functions, and aliases (globals) ....--*/
 
 LLVMModuleRef LLVMGetGlobalParent(LLVMValueRef Global) {
@@ -1060,6 +1156,14 @@ LLVMValueRef LLVMAddGlobal(LLVMModuleRef M, LLVMTypeRef Ty, const char *Name) {
                                  GlobalValue::ExternalLinkage, 0, Name));
 }
 
+LLVMValueRef LLVMAddGlobalInAddressSpace(LLVMModuleRef M, LLVMTypeRef Ty,
+                                         const char *Name,
+                                         unsigned AddressSpace) {
+  return wrap(new GlobalVariable(*unwrap(M), unwrap(Ty), false,
+                                 GlobalValue::ExternalLinkage, 0, Name, 0,
+                                 false, AddressSpace));
+}
+
 LLVMValueRef LLVMGetNamedGlobal(LLVMModuleRef M, const char *Name) {
   return wrap(unwrap(M)->getNamedGlobal(Name));
 }
@@ -1215,14 +1319,14 @@ void LLVMSetGC(LLVMValueRef Fn, const char *GC) {
 void LLVMAddFunctionAttr(LLVMValueRef Fn, LLVMAttribute PA) {
   Function *Func = unwrap<Function>(Fn);
   const AttrListPtr PAL = Func->getAttributes();
-  const AttrListPtr PALnew = PAL.addAttr(0, PA);
+  const AttrListPtr PALnew = PAL.addAttr(~0U, PA);
   Func->setAttributes(PALnew);
 }
 
 void LLVMRemoveFunctionAttr(LLVMValueRef Fn, LLVMAttribute PA) {
   Function *Func = unwrap<Function>(Fn);
   const AttrListPtr PAL = Func->getAttributes();
-  const AttrListPtr PALnew = PAL.removeAttr(0, PA);
+  const AttrListPtr PALnew = PAL.removeAttr(~0U, PA);
   Func->setAttributes(PALnew);
 }
 
@@ -1563,6 +1667,21 @@ void LLVMDisposeBuilder(LLVMBuilderRef Builder) {
   delete unwrap(Builder);
 }
 
+/*--.. Metadata builders ...................................................--*/
+
+void LLVMSetCurrentDebugLocation(LLVMBuilderRef Builder, LLVMValueRef L) {
+  unwrap(Builder)->SetCurrentDebugLocation(L? unwrap<MDNode>(L) : NULL);
+}
+
+LLVMValueRef LLVMGetCurrentDebugLocation(LLVMBuilderRef Builder) {
+  return wrap(unwrap(Builder)->getCurrentDebugLocation());
+}
+
+void LLVMSetInstDebugLocation(LLVMBuilderRef Builder, LLVMValueRef Inst) {
+  unwrap(Builder)->SetInstDebugLocation(unwrap<Instruction>(Inst));
+}
+
+
 /*--.. Instruction builders ................................................--*/
 
 LLVMValueRef LLVMBuildRetVoid(LLVMBuilderRef B) {
@@ -1592,6 +1711,11 @@ LLVMValueRef LLVMBuildSwitch(LLVMBuilderRef B, LLVMValueRef V,
   return wrap(unwrap(B)->CreateSwitch(unwrap(V), unwrap(Else), NumCases));
 }
 
+LLVMValueRef LLVMBuildIndirectBr(LLVMBuilderRef B, LLVMValueRef Addr,
+                                 unsigned NumDests) {
+  return wrap(unwrap(B)->CreateIndirectBr(unwrap(Addr), NumDests));
+}
+
 LLVMValueRef LLVMBuildInvoke(LLVMBuilderRef B, LLVMValueRef Fn,
                              LLVMValueRef *Args, unsigned NumArgs,
                              LLVMBasicBlockRef Then, LLVMBasicBlockRef Catch,
@@ -1614,6 +1738,10 @@ void LLVMAddCase(LLVMValueRef Switch, LLVMValueRef OnVal,
   unwrap<SwitchInst>(Switch)->addCase(unwrap<ConstantInt>(OnVal), unwrap(Dest));
 }
 
+void LLVMAddDestination(LLVMValueRef IndirectBr, LLVMBasicBlockRef Dest) {
+  unwrap<IndirectBrInst>(IndirectBr)->addDestination(unwrap(Dest));
+}
+
 /*--.. Arithmetic ..........................................................--*/
 
 LLVMValueRef LLVMBuildAdd(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS,
@@ -1626,6 +1754,11 @@ LLVMValueRef LLVMBuildNSWAdd(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RH
   return wrap(unwrap(B)->CreateNSWAdd(unwrap(LHS), unwrap(RHS), Name));
 }
 
+LLVMValueRef LLVMBuildNUWAdd(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS,
+                          const char *Name) {
+  return wrap(unwrap(B)->CreateNUWAdd(unwrap(LHS), unwrap(RHS), Name));
+}
+
 LLVMValueRef LLVMBuildFAdd(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS,
                           const char *Name) {
   return wrap(unwrap(B)->CreateFAdd(unwrap(LHS), unwrap(RHS), Name));
@@ -1636,6 +1769,16 @@ LLVMValueRef LLVMBuildSub(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS,
   return wrap(unwrap(B)->CreateSub(unwrap(LHS), unwrap(RHS), Name));
 }
 
+LLVMValueRef LLVMBuildNSWSub(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS,
+                          const char *Name) {
+  return wrap(unwrap(B)->CreateNSWSub(unwrap(LHS), unwrap(RHS), Name));
+}
+
+LLVMValueRef LLVMBuildNUWSub(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS,
+                          const char *Name) {
+  return wrap(unwrap(B)->CreateNUWSub(unwrap(LHS), unwrap(RHS), Name));
+}
+
 LLVMValueRef LLVMBuildFSub(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS,
                           const char *Name) {
   return wrap(unwrap(B)->CreateFSub(unwrap(LHS), unwrap(RHS), Name));
@@ -1646,6 +1789,16 @@ LLVMValueRef LLVMBuildMul(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS,
   return wrap(unwrap(B)->CreateMul(unwrap(LHS), unwrap(RHS), Name));
 }
 
+LLVMValueRef LLVMBuildNSWMul(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS,
+                          const char *Name) {
+  return wrap(unwrap(B)->CreateNSWMul(unwrap(LHS), unwrap(RHS), Name));
+}
+
+LLVMValueRef LLVMBuildNUWMul(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS,
+                          const char *Name) {
+  return wrap(unwrap(B)->CreateNUWMul(unwrap(LHS), unwrap(RHS), Name));
+}
+
 LLVMValueRef LLVMBuildFMul(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS,
                           const char *Name) {
   return wrap(unwrap(B)->CreateFMul(unwrap(LHS), unwrap(RHS), Name));
@@ -1716,10 +1869,27 @@ LLVMValueRef LLVMBuildXor(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS,
   return wrap(unwrap(B)->CreateXor(unwrap(LHS), unwrap(RHS), Name));
 }
 
+LLVMValueRef LLVMBuildBinOp(LLVMBuilderRef B, LLVMOpcode Op,
+                            LLVMValueRef LHS, LLVMValueRef RHS,
+                            const char *Name) {
+  return wrap(unwrap(B)->CreateBinOp(Instruction::BinaryOps(Op), unwrap(LHS),
+                                     unwrap(RHS), Name));
+}
+
 LLVMValueRef LLVMBuildNeg(LLVMBuilderRef B, LLVMValueRef V, const char *Name) {
   return wrap(unwrap(B)->CreateNeg(unwrap(V), Name));
 }
 
+LLVMValueRef LLVMBuildNSWNeg(LLVMBuilderRef B, LLVMValueRef V,
+                             const char *Name) {
+  return wrap(unwrap(B)->CreateNSWNeg(unwrap(V), Name));
+}
+
+LLVMValueRef LLVMBuildNUWNeg(LLVMBuilderRef B, LLVMValueRef V,
+                             const char *Name) {
+  return wrap(unwrap(B)->CreateNUWNeg(unwrap(V), Name));
+}
+
 LLVMValueRef LLVMBuildFNeg(LLVMBuilderRef B, LLVMValueRef V, const char *Name) {
   return wrap(unwrap(B)->CreateFNeg(unwrap(V), Name));
 }
@@ -1887,6 +2057,12 @@ LLVMValueRef LLVMBuildTruncOrBitCast(LLVMBuilderRef B, LLVMValueRef Val,
                                               Name));
 }
 
+LLVMValueRef LLVMBuildCast(LLVMBuilderRef B, LLVMOpcode Op, LLVMValueRef Val,
+                           LLVMTypeRef DestTy, const char *Name) {
+  return wrap(unwrap(B)->CreateCast(Instruction::CastOps(Op), unwrap(Val),
+                                    unwrap(DestTy), Name));
+}
+
 LLVMValueRef LLVMBuildPointerCast(LLVMBuilderRef B, LLVMValueRef Val,
                                   LLVMTypeRef DestTy, const char *Name) {
   return wrap(unwrap(B)->CreatePointerCast(unwrap(Val), unwrap(DestTy), Name));
diff --git a/libclamav/c++/llvm/lib/VMCore/Function.cpp b/libclamav/c++/llvm/lib/VMCore/Function.cpp
index f00f6ee..dbc283e 100644
--- a/libclamav/c++/llvm/lib/VMCore/Function.cpp
+++ b/libclamav/c++/llvm/lib/VMCore/Function.cpp
@@ -73,35 +73,35 @@ unsigned Argument::getArgNo() const {
 /// hasByValAttr - Return true if this argument has the byval attribute on it
 /// in its containing function.
 bool Argument::hasByValAttr() const {
-  if (!isa<PointerType>(getType())) return false;
+  if (!getType()->isPointerTy()) return false;
   return getParent()->paramHasAttr(getArgNo()+1, Attribute::ByVal);
 }
 
 /// hasNestAttr - Return true if this argument has the nest attribute on
 /// it in its containing function.
 bool Argument::hasNestAttr() const {
-  if (!isa<PointerType>(getType())) return false;
+  if (!getType()->isPointerTy()) return false;
   return getParent()->paramHasAttr(getArgNo()+1, Attribute::Nest);
 }
 
 /// hasNoAliasAttr - Return true if this argument has the noalias attribute on
 /// it in its containing function.
 bool Argument::hasNoAliasAttr() const {
-  if (!isa<PointerType>(getType())) return false;
+  if (!getType()->isPointerTy()) return false;
   return getParent()->paramHasAttr(getArgNo()+1, Attribute::NoAlias);
 }
 
 /// hasNoCaptureAttr - Return true if this argument has the nocapture attribute
 /// on it in its containing function.
 bool Argument::hasNoCaptureAttr() const {
-  if (!isa<PointerType>(getType())) return false;
+  if (!getType()->isPointerTy()) return false;
   return getParent()->paramHasAttr(getArgNo()+1, Attribute::NoCapture);
 }
 
 /// hasSRetAttr - Return true if this argument has the sret attribute on
 /// it in its containing function.
 bool Argument::hasStructRetAttr() const {
-  if (!isa<PointerType>(getType())) return false;
+  if (!getType()->isPointerTy()) return false;
   if (this != getParent()->arg_begin())
     return false; // StructRet param must be first param
   return getParent()->paramHasAttr(1, Attribute::StructRet);
@@ -155,7 +155,7 @@ Function::Function(const FunctionType *Ty, LinkageTypes Linkage,
   : GlobalValue(PointerType::getUnqual(Ty), 
                 Value::FunctionVal, 0, 0, Linkage, name) {
   assert(FunctionType::isValidReturnType(getReturnType()) &&
-         !isa<OpaqueType>(getReturnType()) && "invalid return type");
+         !getReturnType()->isOpaqueTy() && "invalid return type");
   SymTab = new ValueSymbolTable();
 
   // If the function has arguments, mark them as lazily built.
diff --git a/libclamav/c++/llvm/lib/VMCore/Globals.cpp b/libclamav/c++/llvm/lib/VMCore/Globals.cpp
index f149c44..489ec65 100644
--- a/libclamav/c++/llvm/lib/VMCore/Globals.cpp
+++ b/libclamav/c++/llvm/lib/VMCore/Globals.cpp
@@ -44,10 +44,10 @@ static bool removeDeadUsersOfConstant(const Constant *C) {
 }
 
 bool GlobalValue::isMaterializable() const {
-  return getParent()->isMaterializable(this);
+  return getParent() && getParent()->isMaterializable(this);
 }
 bool GlobalValue::isDematerializable() const {
-  return getParent()->isDematerializable(this);
+  return getParent() && getParent()->isDematerializable(this);
 }
 bool GlobalValue::Materialize(std::string *ErrInfo) {
   return getParent()->Materialize(this, ErrInfo);
diff --git a/libclamav/c++/llvm/lib/VMCore/InlineAsm.cpp b/libclamav/c++/llvm/lib/VMCore/InlineAsm.cpp
index ec21773..6355834 100644
--- a/libclamav/c++/llvm/lib/VMCore/InlineAsm.cpp
+++ b/libclamav/c++/llvm/lib/VMCore/InlineAsm.cpp
@@ -220,7 +220,7 @@ bool InlineAsm::Verify(const FunctionType *Ty, StringRef ConstStr) {
     if (!Ty->getReturnType()->isVoidTy()) return false;
     break;
   case 1:
-    if (isa<StructType>(Ty->getReturnType())) return false;
+    if (Ty->getReturnType()->isStructTy()) return false;
     break;
   default:
     const StructType *STy = dyn_cast<StructType>(Ty->getReturnType());
diff --git a/libclamav/c++/llvm/lib/VMCore/Instructions.cpp b/libclamav/c++/llvm/lib/VMCore/Instructions.cpp
index 4ec8295..8f4763f 100644
--- a/libclamav/c++/llvm/lib/VMCore/Instructions.cpp
+++ b/libclamav/c++/llvm/lib/VMCore/Instructions.cpp
@@ -562,7 +562,7 @@ static Instruction* createFree(Value* Source, Instruction *InsertBefore,
                                BasicBlock *InsertAtEnd) {
   assert(((!InsertBefore && InsertAtEnd) || (InsertBefore && !InsertAtEnd)) &&
          "createFree needs either InsertBefore or InsertAtEnd");
-  assert(isa<PointerType>(Source->getType()) &&
+  assert(Source->getType()->isPointerTy() &&
          "Can not free something of nonpointer type!");
 
   BasicBlock* BB = InsertBefore ? InsertBefore->getParent() : InsertAtEnd;
@@ -787,7 +787,7 @@ BasicBlock *UnreachableInst::getSuccessorV(unsigned idx) const {
 
 void BranchInst::AssertOK() {
   if (isConditional())
-    assert(getCondition()->getType()->isInteger(1) &&
+    assert(getCondition()->getType()->isIntegerTy(1) &&
            "May only branch on boolean predicates!");
 }
 
@@ -892,7 +892,7 @@ static Value *getAISize(LLVMContext &Context, Value *Amt) {
   else {
     assert(!isa<BasicBlock>(Amt) &&
            "Passed basic block into allocation size parameter! Use other ctor");
-    assert(Amt->getType()->isInteger(32) &&
+    assert(Amt->getType()->isIntegerTy(32) &&
            "Allocation array size is not a 32-bit integer!");
   }
   return Amt;
@@ -989,7 +989,7 @@ bool AllocaInst::isStaticAlloca() const {
 //===----------------------------------------------------------------------===//
 
 void LoadInst::AssertOK() {
-  assert(isa<PointerType>(getOperand(0)->getType()) &&
+  assert(getOperand(0)->getType()->isPointerTy() &&
          "Ptr must have pointer type.");
 }
 
@@ -1103,7 +1103,7 @@ void LoadInst::setAlignment(unsigned Align) {
 
 void StoreInst::AssertOK() {
   assert(getOperand(0) && getOperand(1) && "Both operands must be non-null!");
-  assert(isa<PointerType>(getOperand(1)->getType()) &&
+  assert(getOperand(1)->getType()->isPointerTy() &&
          "Ptr must have pointer type!");
   assert(getOperand(0)->getType() ==
                  cast<PointerType>(getOperand(1)->getType())->getElementType()
@@ -1285,7 +1285,7 @@ static const Type* getIndexedTypeInternal(const Type *Ptr, IndexTy const *Idxs,
   unsigned CurIdx = 1;
   for (; CurIdx != NumIdx; ++CurIdx) {
     const CompositeType *CT = dyn_cast<CompositeType>(Agg);
-    if (!CT || isa<PointerType>(CT)) return 0;
+    if (!CT || CT->isPointerTy()) return 0;
     IndexTy Index = Idxs[CurIdx];
     if (!CT->indexValid(Index)) return 0;
     Agg = CT->getTypeAtIndex(Index);
@@ -1391,7 +1391,7 @@ ExtractElementInst::ExtractElementInst(Value *Val, Value *Index,
 
 
 bool ExtractElementInst::isValidOperands(const Value *Val, const Value *Index) {
-  if (!isa<VectorType>(Val->getType()) || !Index->getType()->isInteger(32))
+  if (!Val->getType()->isVectorTy() || !Index->getType()->isIntegerTy(32))
     return false;
   return true;
 }
@@ -1432,13 +1432,13 @@ InsertElementInst::InsertElementInst(Value *Vec, Value *Elt, Value *Index,
 
 bool InsertElementInst::isValidOperands(const Value *Vec, const Value *Elt, 
                                         const Value *Index) {
-  if (!isa<VectorType>(Vec->getType()))
+  if (!Vec->getType()->isVectorTy())
     return false;   // First operand of insertelement must be vector type.
   
   if (Elt->getType() != cast<VectorType>(Vec->getType())->getElementType())
     return false;// Second operand of insertelement must be vector element type.
     
-  if (!Index->getType()->isInteger(32))
+  if (!Index->getType()->isIntegerTy(32))
     return false;  // Third operand of insertelement must be i32.
   return true;
 }
@@ -1485,12 +1485,12 @@ ShuffleVectorInst::ShuffleVectorInst(Value *V1, Value *V2, Value *Mask,
 
 bool ShuffleVectorInst::isValidOperands(const Value *V1, const Value *V2,
                                         const Value *Mask) {
-  if (!isa<VectorType>(V1->getType()) || V1->getType() != V2->getType())
+  if (!V1->getType()->isVectorTy() || V1->getType() != V2->getType())
     return false;
   
   const VectorType *MaskTy = dyn_cast<VectorType>(Mask->getType());
   if (!isa<Constant>(Mask) || MaskTy == 0 ||
-      !MaskTy->getElementType()->isInteger(32))
+      !MaskTy->getElementType()->isIntegerTy(32))
     return false;
   return true;
 }
@@ -1602,7 +1602,7 @@ const Type* ExtractValueInst::getIndexedType(const Type *Agg,
   unsigned CurIdx = 0;
   for (; CurIdx != NumIdx; ++CurIdx) {
     const CompositeType *CT = dyn_cast<CompositeType>(Agg);
-    if (!CT || isa<PointerType>(CT) || isa<VectorType>(CT)) return 0;
+    if (!CT || CT->isPointerTy() || CT->isVectorTy()) return 0;
     unsigned Index = Idxs[CurIdx];
     if (!CT->indexValid(Index)) return 0;
     Agg = CT->getTypeAtIndex(Index);
@@ -1632,7 +1632,7 @@ const Type* ExtractValueInst::getIndexedType(const Type *Agg,
 static BinaryOperator::BinaryOps AdjustIType(BinaryOperator::BinaryOps iType,
                                              const Type *Ty) {
   // API compatibility: Adjust integer opcodes to floating-point opcodes.
-  if (Ty->isFPOrFPVector()) {
+  if (Ty->isFPOrFPVectorTy()) {
     if (iType == BinaryOperator::Add) iType = BinaryOperator::FAdd;
     else if (iType == BinaryOperator::Sub) iType = BinaryOperator::FSub;
     else if (iType == BinaryOperator::Mul) iType = BinaryOperator::FMul;
@@ -1678,14 +1678,14 @@ void BinaryOperator::init(BinaryOps iType) {
   case Mul:
     assert(getType() == LHS->getType() &&
            "Arithmetic operation should return same type as operands!");
-    assert(getType()->isIntOrIntVector() &&
+    assert(getType()->isIntOrIntVectorTy() &&
            "Tried to create an integer operation on a non-integer type!");
     break;
   case FAdd: case FSub:
   case FMul:
     assert(getType() == LHS->getType() &&
            "Arithmetic operation should return same type as operands!");
-    assert(getType()->isFPOrFPVector() &&
+    assert(getType()->isFPOrFPVectorTy() &&
            "Tried to create a floating-point operation on a "
            "non-floating-point type!");
     break;
@@ -1693,28 +1693,28 @@ void BinaryOperator::init(BinaryOps iType) {
   case SDiv: 
     assert(getType() == LHS->getType() &&
            "Arithmetic operation should return same type as operands!");
-    assert((getType()->isInteger() || (isa<VectorType>(getType()) && 
-            cast<VectorType>(getType())->getElementType()->isInteger())) &&
+    assert((getType()->isIntegerTy() || (getType()->isVectorTy() && 
+            cast<VectorType>(getType())->getElementType()->isIntegerTy())) &&
            "Incorrect operand type (not integer) for S/UDIV");
     break;
   case FDiv:
     assert(getType() == LHS->getType() &&
            "Arithmetic operation should return same type as operands!");
-    assert(getType()->isFPOrFPVector() &&
+    assert(getType()->isFPOrFPVectorTy() &&
            "Incorrect operand type (not floating point) for FDIV");
     break;
   case URem: 
   case SRem: 
     assert(getType() == LHS->getType() &&
            "Arithmetic operation should return same type as operands!");
-    assert((getType()->isInteger() || (isa<VectorType>(getType()) && 
-            cast<VectorType>(getType())->getElementType()->isInteger())) &&
+    assert((getType()->isIntegerTy() || (getType()->isVectorTy() && 
+            cast<VectorType>(getType())->getElementType()->isIntegerTy())) &&
            "Incorrect operand type (not integer) for S/UREM");
     break;
   case FRem:
     assert(getType() == LHS->getType() &&
            "Arithmetic operation should return same type as operands!");
-    assert(getType()->isFPOrFPVector() &&
+    assert(getType()->isFPOrFPVectorTy() &&
            "Incorrect operand type (not floating point) for FREM");
     break;
   case Shl:
@@ -1722,18 +1722,18 @@ void BinaryOperator::init(BinaryOps iType) {
   case AShr:
     assert(getType() == LHS->getType() &&
            "Shift operation should return same type as operands!");
-    assert((getType()->isInteger() ||
-            (isa<VectorType>(getType()) && 
-             cast<VectorType>(getType())->getElementType()->isInteger())) &&
+    assert((getType()->isIntegerTy() ||
+            (getType()->isVectorTy() && 
+             cast<VectorType>(getType())->getElementType()->isIntegerTy())) &&
            "Tried to create a shift operation on a non-integral type!");
     break;
   case And: case Or:
   case Xor:
     assert(getType() == LHS->getType() &&
            "Logical operation should return same type as operands!");
-    assert((getType()->isInteger() ||
-            (isa<VectorType>(getType()) && 
-             cast<VectorType>(getType())->getElementType()->isInteger())) &&
+    assert((getType()->isIntegerTy() ||
+            (getType()->isVectorTy() && 
+             cast<VectorType>(getType())->getElementType()->isIntegerTy())) &&
            "Tried to create a logical operation on a non-integral type!");
     break;
   default:
@@ -1960,7 +1960,8 @@ bool CastInst::isIntegerCast() const {
     case Instruction::Trunc:
       return true;
     case Instruction::BitCast:
-      return getOperand(0)->getType()->isInteger() && getType()->isInteger();
+      return getOperand(0)->getType()->isIntegerTy() &&
+        getType()->isIntegerTy();
   }
 }
 
@@ -1976,8 +1977,8 @@ bool CastInst::isLosslessCast() const {
     return true;
   
   // Pointer to pointer is always lossless.
-  if (isa<PointerType>(SrcTy))
-    return isa<PointerType>(DstTy);
+  if (SrcTy->isPointerTy())
+    return DstTy->isPointerTy();
   return false;  // Other types have no identity values
 }
 
@@ -2093,25 +2094,25 @@ unsigned CastInst::isEliminableCastPair(
       // no-op cast in second op implies firstOp as long as the DestTy 
       // is integer and we are not converting between a vector and a
       // non vector type.
-      if (!isa<VectorType>(SrcTy) && DstTy->isInteger())
+      if (!SrcTy->isVectorTy() && DstTy->isIntegerTy())
         return firstOp;
       return 0;
     case 4:
       // no-op cast in second op implies firstOp as long as the DestTy
       // is floating point.
-      if (DstTy->isFloatingPoint())
+      if (DstTy->isFloatingPointTy())
         return firstOp;
       return 0;
     case 5: 
       // no-op cast in first op implies secondOp as long as the SrcTy
       // is an integer.
-      if (SrcTy->isInteger())
+      if (SrcTy->isIntegerTy())
         return secondOp;
       return 0;
     case 6:
       // no-op cast in first op implies secondOp as long as the SrcTy
       // is a floating point.
-      if (SrcTy->isFloatingPoint())
+      if (SrcTy->isFloatingPointTy())
         return secondOp;
       return 0;
     case 7: { 
@@ -2147,12 +2148,12 @@ unsigned CastInst::isEliminableCastPair(
     case 11:
       // bitcast followed by ptrtoint is allowed as long as the bitcast
       // is a pointer to pointer cast.
-      if (isa<PointerType>(SrcTy) && isa<PointerType>(MidTy))
+      if (SrcTy->isPointerTy() && MidTy->isPointerTy())
         return secondOp;
       return 0;
     case 12:
       // inttoptr, bitcast -> intptr  if bitcast is a ptr to ptr cast
-      if (isa<PointerType>(MidTy) && isa<PointerType>(DstTy))
+      if (MidTy->isPointerTy() && DstTy->isPointerTy())
         return firstOp;
       return 0;
     case 13: {
@@ -2273,11 +2274,11 @@ CastInst *CastInst::CreateTruncOrBitCast(Value *S, const Type *Ty,
 CastInst *CastInst::CreatePointerCast(Value *S, const Type *Ty,
                                       const Twine &Name,
                                       BasicBlock *InsertAtEnd) {
-  assert(isa<PointerType>(S->getType()) && "Invalid cast");
-  assert((Ty->isInteger() || isa<PointerType>(Ty)) &&
+  assert(S->getType()->isPointerTy() && "Invalid cast");
+  assert((Ty->isIntegerTy() || Ty->isPointerTy()) &&
          "Invalid cast");
 
-  if (Ty->isInteger())
+  if (Ty->isIntegerTy())
     return Create(Instruction::PtrToInt, S, Ty, Name, InsertAtEnd);
   return Create(Instruction::BitCast, S, Ty, Name, InsertAtEnd);
 }
@@ -2286,11 +2287,11 @@ CastInst *CastInst::CreatePointerCast(Value *S, const Type *Ty,
 CastInst *CastInst::CreatePointerCast(Value *S, const Type *Ty, 
                                       const Twine &Name, 
                                       Instruction *InsertBefore) {
-  assert(isa<PointerType>(S->getType()) && "Invalid cast");
-  assert((Ty->isInteger() || isa<PointerType>(Ty)) &&
+  assert(S->getType()->isPointerTy() && "Invalid cast");
+  assert((Ty->isIntegerTy() || Ty->isPointerTy()) &&
          "Invalid cast");
 
-  if (Ty->isInteger())
+  if (Ty->isIntegerTy())
     return Create(Instruction::PtrToInt, S, Ty, Name, InsertBefore);
   return Create(Instruction::BitCast, S, Ty, Name, InsertBefore);
 }
@@ -2298,7 +2299,7 @@ CastInst *CastInst::CreatePointerCast(Value *S, const Type *Ty,
 CastInst *CastInst::CreateIntegerCast(Value *C, const Type *Ty, 
                                       bool isSigned, const Twine &Name,
                                       Instruction *InsertBefore) {
-  assert(C->getType()->isIntOrIntVector() && Ty->isIntOrIntVector() &&
+  assert(C->getType()->isIntOrIntVectorTy() && Ty->isIntOrIntVectorTy() &&
          "Invalid integer cast");
   unsigned SrcBits = C->getType()->getScalarSizeInBits();
   unsigned DstBits = Ty->getScalarSizeInBits();
@@ -2312,7 +2313,7 @@ CastInst *CastInst::CreateIntegerCast(Value *C, const Type *Ty,
 CastInst *CastInst::CreateIntegerCast(Value *C, const Type *Ty, 
                                       bool isSigned, const Twine &Name,
                                       BasicBlock *InsertAtEnd) {
-  assert(C->getType()->isIntOrIntVector() && Ty->isIntOrIntVector() &&
+  assert(C->getType()->isIntOrIntVectorTy() && Ty->isIntOrIntVectorTy() &&
          "Invalid cast");
   unsigned SrcBits = C->getType()->getScalarSizeInBits();
   unsigned DstBits = Ty->getScalarSizeInBits();
@@ -2326,7 +2327,7 @@ CastInst *CastInst::CreateIntegerCast(Value *C, const Type *Ty,
 CastInst *CastInst::CreateFPCast(Value *C, const Type *Ty, 
                                  const Twine &Name, 
                                  Instruction *InsertBefore) {
-  assert(C->getType()->isFPOrFPVector() && Ty->isFPOrFPVector() &&
+  assert(C->getType()->isFPOrFPVectorTy() && Ty->isFPOrFPVectorTy() &&
          "Invalid cast");
   unsigned SrcBits = C->getType()->getScalarSizeInBits();
   unsigned DstBits = Ty->getScalarSizeInBits();
@@ -2339,7 +2340,7 @@ CastInst *CastInst::CreateFPCast(Value *C, const Type *Ty,
 CastInst *CastInst::CreateFPCast(Value *C, const Type *Ty, 
                                  const Twine &Name, 
                                  BasicBlock *InsertAtEnd) {
-  assert(C->getType()->isFPOrFPVector() && Ty->isFPOrFPVector() &&
+  assert(C->getType()->isFPOrFPVectorTy() && Ty->isFPOrFPVectorTy() &&
          "Invalid cast");
   unsigned SrcBits = C->getType()->getScalarSizeInBits();
   unsigned DstBits = Ty->getScalarSizeInBits();
@@ -2363,21 +2364,21 @@ bool CastInst::isCastable(const Type *SrcTy, const Type *DestTy) {
   unsigned DestBits = DestTy->getScalarSizeInBits(); // 0 for ptr
 
   // Run through the possibilities ...
-  if (DestTy->isInteger()) {                   // Casting to integral
-    if (SrcTy->isInteger()) {                  // Casting from integral
+  if (DestTy->isIntegerTy()) {                   // Casting to integral
+    if (SrcTy->isIntegerTy()) {                  // Casting from integral
         return true;
-    } else if (SrcTy->isFloatingPoint()) {     // Casting from floating pt
+    } else if (SrcTy->isFloatingPointTy()) {     // Casting from floating pt
       return true;
     } else if (const VectorType *PTy = dyn_cast<VectorType>(SrcTy)) {
                                                // Casting from vector
       return DestBits == PTy->getBitWidth();
     } else {                                   // Casting from something else
-      return isa<PointerType>(SrcTy);
+      return SrcTy->isPointerTy();
     }
-  } else if (DestTy->isFloatingPoint()) {      // Casting to floating pt
-    if (SrcTy->isInteger()) {                  // Casting from integral
+  } else if (DestTy->isFloatingPointTy()) {      // Casting to floating pt
+    if (SrcTy->isIntegerTy()) {                  // Casting from integral
       return true;
-    } else if (SrcTy->isFloatingPoint()) {     // Casting from floating pt
+    } else if (SrcTy->isFloatingPointTy()) {     // Casting from floating pt
       return true;
     } else if (const VectorType *PTy = dyn_cast<VectorType>(SrcTy)) {
                                                // Casting from vector
@@ -2393,10 +2394,10 @@ bool CastInst::isCastable(const Type *SrcTy, const Type *DestTy) {
     } else {                                    // Casting from something else
       return DestPTy->getBitWidth() == SrcBits;
     }
-  } else if (isa<PointerType>(DestTy)) {        // Casting to pointer
-    if (isa<PointerType>(SrcTy)) {              // Casting from pointer
+  } else if (DestTy->isPointerTy()) {        // Casting to pointer
+    if (SrcTy->isPointerTy()) {              // Casting from pointer
       return true;
-    } else if (SrcTy->isInteger()) {            // Casting from integral
+    } else if (SrcTy->isIntegerTy()) {            // Casting from integral
       return true;
     } else {                                    // Casting from something else
       return false;
@@ -2425,8 +2426,8 @@ CastInst::getCastOpcode(
          "Only first class types are castable!");
 
   // Run through the possibilities ...
-  if (DestTy->isInteger()) {                       // Casting to integral
-    if (SrcTy->isInteger()) {                      // Casting from integral
+  if (DestTy->isIntegerTy()) {                      // Casting to integral
+    if (SrcTy->isIntegerTy()) {                     // Casting from integral
       if (DestBits < SrcBits)
         return Trunc;                               // int -> smaller int
       else if (DestBits > SrcBits) {                // its an extension
@@ -2437,7 +2438,7 @@ CastInst::getCastOpcode(
       } else {
         return BitCast;                             // Same size, No-op cast
       }
-    } else if (SrcTy->isFloatingPoint()) {          // Casting from floating pt
+    } else if (SrcTy->isFloatingPointTy()) {        // Casting from floating pt
       if (DestIsSigned) 
         return FPToSI;                              // FP -> sint
       else
@@ -2448,17 +2449,17 @@ CastInst::getCastOpcode(
       PTy = NULL;
       return BitCast;                             // Same size, no-op cast
     } else {
-      assert(isa<PointerType>(SrcTy) &&
+      assert(SrcTy->isPointerTy() &&
              "Casting from a value that is not first-class type");
       return PtrToInt;                              // ptr -> int
     }
-  } else if (DestTy->isFloatingPoint()) {           // Casting to floating pt
-    if (SrcTy->isInteger()) {                      // Casting from integral
+  } else if (DestTy->isFloatingPointTy()) {         // Casting to floating pt
+    if (SrcTy->isIntegerTy()) {                     // Casting from integral
       if (SrcIsSigned)
         return SIToFP;                              // sint -> FP
       else
         return UIToFP;                              // uint -> FP
-    } else if (SrcTy->isFloatingPoint()) {          // Casting from floating pt
+    } else if (SrcTy->isFloatingPointTy()) {        // Casting from floating pt
       if (DestBits < SrcBits) {
         return FPTrunc;                             // FP -> smaller FP
       } else if (DestBits > SrcBits) {
@@ -2485,10 +2486,10 @@ CastInst::getCastOpcode(
     } else {
       assert(!"Illegal cast to vector (wrong type or size)");
     }
-  } else if (isa<PointerType>(DestTy)) {
-    if (isa<PointerType>(SrcTy)) {
+  } else if (DestTy->isPointerTy()) {
+    if (SrcTy->isPointerTy()) {
       return BitCast;                               // ptr -> ptr
-    } else if (SrcTy->isInteger()) {
+    } else if (SrcTy->isIntegerTy()) {
       return IntToPtr;                              // int -> ptr
     } else {
       assert(!"Casting pointer to other than pointer or int");
@@ -2528,50 +2529,50 @@ CastInst::castIsValid(Instruction::CastOps op, Value *S, const Type *DstTy) {
   switch (op) {
   default: return false; // This is an input error
   case Instruction::Trunc:
-    return SrcTy->isIntOrIntVector() &&
-           DstTy->isIntOrIntVector()&& SrcBitSize > DstBitSize;
+    return SrcTy->isIntOrIntVectorTy() &&
+           DstTy->isIntOrIntVectorTy()&& SrcBitSize > DstBitSize;
   case Instruction::ZExt:
-    return SrcTy->isIntOrIntVector() &&
-           DstTy->isIntOrIntVector()&& SrcBitSize < DstBitSize;
+    return SrcTy->isIntOrIntVectorTy() &&
+           DstTy->isIntOrIntVectorTy()&& SrcBitSize < DstBitSize;
   case Instruction::SExt: 
-    return SrcTy->isIntOrIntVector() &&
-           DstTy->isIntOrIntVector()&& SrcBitSize < DstBitSize;
+    return SrcTy->isIntOrIntVectorTy() &&
+           DstTy->isIntOrIntVectorTy()&& SrcBitSize < DstBitSize;
   case Instruction::FPTrunc:
-    return SrcTy->isFPOrFPVector() &&
-           DstTy->isFPOrFPVector() && 
+    return SrcTy->isFPOrFPVectorTy() &&
+           DstTy->isFPOrFPVectorTy() && 
            SrcBitSize > DstBitSize;
   case Instruction::FPExt:
-    return SrcTy->isFPOrFPVector() &&
-           DstTy->isFPOrFPVector() && 
+    return SrcTy->isFPOrFPVectorTy() &&
+           DstTy->isFPOrFPVectorTy() && 
            SrcBitSize < DstBitSize;
   case Instruction::UIToFP:
   case Instruction::SIToFP:
     if (const VectorType *SVTy = dyn_cast<VectorType>(SrcTy)) {
       if (const VectorType *DVTy = dyn_cast<VectorType>(DstTy)) {
-        return SVTy->getElementType()->isIntOrIntVector() &&
-               DVTy->getElementType()->isFPOrFPVector() &&
+        return SVTy->getElementType()->isIntOrIntVectorTy() &&
+               DVTy->getElementType()->isFPOrFPVectorTy() &&
                SVTy->getNumElements() == DVTy->getNumElements();
       }
     }
-    return SrcTy->isIntOrIntVector() && DstTy->isFPOrFPVector();
+    return SrcTy->isIntOrIntVectorTy() && DstTy->isFPOrFPVectorTy();
   case Instruction::FPToUI:
   case Instruction::FPToSI:
     if (const VectorType *SVTy = dyn_cast<VectorType>(SrcTy)) {
       if (const VectorType *DVTy = dyn_cast<VectorType>(DstTy)) {
-        return SVTy->getElementType()->isFPOrFPVector() &&
-               DVTy->getElementType()->isIntOrIntVector() &&
+        return SVTy->getElementType()->isFPOrFPVectorTy() &&
+               DVTy->getElementType()->isIntOrIntVectorTy() &&
                SVTy->getNumElements() == DVTy->getNumElements();
       }
     }
-    return SrcTy->isFPOrFPVector() && DstTy->isIntOrIntVector();
+    return SrcTy->isFPOrFPVectorTy() && DstTy->isIntOrIntVectorTy();
   case Instruction::PtrToInt:
-    return isa<PointerType>(SrcTy) && DstTy->isInteger();
+    return SrcTy->isPointerTy() && DstTy->isIntegerTy();
   case Instruction::IntToPtr:
-    return SrcTy->isInteger() && isa<PointerType>(DstTy);
+    return SrcTy->isIntegerTy() && DstTy->isPointerTy();
   case Instruction::BitCast:
     // BitCast implies a no-op cast of type only. No bits change.
     // However, you can't cast pointers to anything but pointers.
-    if (isa<PointerType>(SrcTy) != isa<PointerType>(DstTy))
+    if (SrcTy->isPointerTy() != DstTy->isPointerTy())
       return false;
 
     // Now we know we're not dealing with a pointer/non-pointer mismatch. In all
@@ -3149,7 +3150,7 @@ void SwitchInst::setSuccessorV(unsigned idx, BasicBlock *B) {
 //===----------------------------------------------------------------------===//
 
 void IndirectBrInst::init(Value *Address, unsigned NumDests) {
-  assert(Address && isa<PointerType>(Address->getType()) &&
+  assert(Address && Address->getType()->isPointerTy() &&
          "Address of indirectbr must be a pointer");
   ReservedSpace = 1+NumDests;
   NumOperands = 1;
diff --git a/libclamav/c++/llvm/lib/VMCore/LLVMContextImpl.h b/libclamav/c++/llvm/lib/VMCore/LLVMContextImpl.h
index 62491d8..19b8a08 100644
--- a/libclamav/c++/llvm/lib/VMCore/LLVMContextImpl.h
+++ b/libclamav/c++/llvm/lib/VMCore/LLVMContextImpl.h
@@ -229,13 +229,29 @@ public:
       if (I->second->use_empty())
         delete I->second;
     }
-    MDNodeSet.clear();
+    AlwaysOpaqueTy->dropRef();
     AlwaysOpaqueTy->dropRef();
     for (OpaqueTypesTy::iterator I = OpaqueTypes.begin(), E = OpaqueTypes.end();
         I != E; ++I) {
       (*I)->AbstractTypeUsers.clear();
       delete *I;
     }
+    // Destroy MDNode operands first.
+    for (FoldingSetIterator<MDNode> I = MDNodeSet.begin(), E = MDNodeSet.end();
+         I != E;) {
+      MDNode *N = &(*I);
+      ++I;
+      N->replaceAllOperandsWithNull();
+    }
+    while (!MDNodeSet.empty()) {
+      MDNode *N = &(*MDNodeSet.begin());
+      N->destroy();
+    }
+    // Destroy MDStrings.
+    for (StringMap<MDString*>::iterator I = MDStringCache.begin(),
+           E = MDStringCache.end(); I != E; ++I) {
+      delete I->second;
+    }
   }
 };
 
diff --git a/libclamav/c++/llvm/lib/VMCore/Makefile b/libclamav/c++/llvm/lib/VMCore/Makefile
index bc5e77d..4395ecf 100644
--- a/libclamav/c++/llvm/lib/VMCore/Makefile
+++ b/libclamav/c++/llvm/lib/VMCore/Makefile
@@ -30,5 +30,5 @@ $(GENFILE): $(ObjDir)/Intrinsics.gen.tmp
 	    changed significantly. )
 
 install-local:: $(GENFILE)
-	$(Echo) Installing $(PROJ_includedir)/llvm/Intrinsics.gen
-	$(Verb) $(DataInstall) $(GENFILE) $(PROJ_includedir)/llvm/Intrinsics.gen
+	$(Echo) Installing $(DESTDIR)$(PROJ_includedir)/llvm/Intrinsics.gen
+	$(Verb) $(DataInstall) $(GENFILE) $(DESTDIR)$(PROJ_includedir)/llvm/Intrinsics.gen
diff --git a/libclamav/c++/llvm/lib/VMCore/Metadata.cpp b/libclamav/c++/llvm/lib/VMCore/Metadata.cpp
index 07a5f3c..a08c454 100644
--- a/libclamav/c++/llvm/lib/VMCore/Metadata.cpp
+++ b/libclamav/c++/llvm/lib/VMCore/Metadata.cpp
@@ -257,6 +257,13 @@ void MDNode::Profile(FoldingSetNodeID &ID) const {
     ID.AddPointer(getOperand(i));
 }
 
+// replaceAllOperandsWithNull - This is used while destroying llvm context to 
+// gracefully delete all nodes. This method replaces all operands with null.
+void MDNode::replaceAllOperandsWithNull() {
+  for (MDNodeOperand *Op = getOperandPtr(this, 0), *E = Op+NumOperands;
+       Op != E; ++Op)
+    replaceOperand(Op, 0);
+}
 
 // Replace value from this node's operand list.
 void MDNode::replaceOperand(MDNodeOperand *Op, Value *To) {
diff --git a/libclamav/c++/llvm/lib/VMCore/PassManager.cpp b/libclamav/c++/llvm/lib/VMCore/PassManager.cpp
index a1d554e..c4dfe14 100644
--- a/libclamav/c++/llvm/lib/VMCore/PassManager.cpp
+++ b/libclamav/c++/llvm/lib/VMCore/PassManager.cpp
@@ -1118,6 +1118,7 @@ bool BBPassManager::runOnFunction(Function &F) {
   for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I)
     for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {
       BasicBlockPass *BP = getContainedPass(Index);
+      bool LocalChanged = false;
 
       dumpPassInfo(BP, EXECUTION_MSG, ON_BASICBLOCK_MSG, I->getName());
       dumpRequiredSet(BP);
@@ -1129,11 +1130,12 @@ bool BBPassManager::runOnFunction(Function &F) {
         PassManagerPrettyStackEntry X(BP, *I);
       
         Timer *T = StartPassTimer(BP);
-        Changed |= BP->runOnBasicBlock(*I);
+        LocalChanged |= BP->runOnBasicBlock(*I);
         StopPassTimer(BP, T);
       }
 
-      if (Changed) 
+      Changed |= LocalChanged;
+      if (LocalChanged) 
         dumpPassInfo(BP, MODIFICATION_MSG, ON_BASICBLOCK_MSG,
                      I->getName());
       dumpPreservedSet(BP);
@@ -1220,9 +1222,11 @@ void FunctionPassManager::add(Pass *P) {
 /// so, return true.
 ///
 bool FunctionPassManager::run(Function &F) {
-  std::string errstr;
-  if (F.Materialize(&errstr)) {
-    llvm_report_error("Error reading bitcode file: " + errstr);
+  if (F.isMaterializable()) {
+    std::string errstr;
+    if (F.Materialize(&errstr)) {
+      llvm_report_error("Error reading bitcode file: " + errstr);
+    }
   }
   return FPM->run(F);
 }
@@ -1332,6 +1336,7 @@ bool FPPassManager::runOnFunction(Function &F) {
 
   for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {
     FunctionPass *FP = getContainedPass(Index);
+    bool LocalChanged = false;
 
     dumpPassInfo(FP, EXECUTION_MSG, ON_FUNCTION_MSG, F.getName());
     dumpRequiredSet(FP);
@@ -1342,11 +1347,12 @@ bool FPPassManager::runOnFunction(Function &F) {
       PassManagerPrettyStackEntry X(FP, F);
 
       Timer *T = StartPassTimer(FP);
-      Changed |= FP->runOnFunction(F);
+      LocalChanged |= FP->runOnFunction(F);
       StopPassTimer(FP, T);
     }
 
-    if (Changed) 
+    Changed |= LocalChanged;
+    if (LocalChanged)
       dumpPassInfo(FP, MODIFICATION_MSG, ON_FUNCTION_MSG, F.getName());
     dumpPreservedSet(FP);
 
@@ -1405,6 +1411,7 @@ MPPassManager::runOnModule(Module &M) {
 
   for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {
     ModulePass *MP = getContainedPass(Index);
+    bool LocalChanged = false;
 
     dumpPassInfo(MP, EXECUTION_MSG, ON_MODULE_MSG, M.getModuleIdentifier());
     dumpRequiredSet(MP);
@@ -1414,11 +1421,12 @@ MPPassManager::runOnModule(Module &M) {
     {
       PassManagerPrettyStackEntry X(MP, M);
       Timer *T = StartPassTimer(MP);
-      Changed |= MP->runOnModule(M);
+      LocalChanged |= MP->runOnModule(M);
       StopPassTimer(MP, T);
     }
 
-    if (Changed) 
+    Changed |= LocalChanged;
+    if (LocalChanged)
       dumpPassInfo(MP, MODIFICATION_MSG, ON_MODULE_MSG,
                    M.getModuleIdentifier());
     dumpPreservedSet(MP);
@@ -1704,8 +1712,13 @@ LLVMPassManagerRef LLVMCreatePassManager() {
   return wrap(new PassManager());
 }
 
+LLVMPassManagerRef LLVMCreateFunctionPassManagerForModule(LLVMModuleRef M) {
+  return wrap(new FunctionPassManager(unwrap(M)));
+}
+
 LLVMPassManagerRef LLVMCreateFunctionPassManager(LLVMModuleProviderRef P) {
-  return wrap(new FunctionPassManager(unwrap(P)));
+  return LLVMCreateFunctionPassManagerForModule(
+                                            reinterpret_cast<LLVMModuleRef>(P));
 }
 
 LLVMBool LLVMRunPassManager(LLVMPassManagerRef PM, LLVMModuleRef M) {
diff --git a/libclamav/c++/llvm/lib/VMCore/Type.cpp b/libclamav/c++/llvm/lib/VMCore/Type.cpp
index b1cdad5..9b2c2ca 100644
--- a/libclamav/c++/llvm/lib/VMCore/Type.cpp
+++ b/libclamav/c++/llvm/lib/VMCore/Type.cpp
@@ -61,8 +61,8 @@ void Type::destroy() const {
   // Structures and Functions allocate their contained types past the end of
   // the type object itself. These need to be destroyed differently than the
   // other types.
-  if (isa<FunctionType>(this) || isa<StructType>(this) ||
-      isa<UnionType>(this)) {
+  if (this->isFunctionTy() || this->isStructTy() ||
+      this->isUnionTy()) {
     // First, make sure we destruct any PATypeHandles allocated by these
     // subclasses.  They must be manually destructed. 
     for (unsigned i = 0; i < NumContainedTys; ++i)
@@ -70,9 +70,9 @@ void Type::destroy() const {
 
     // Now call the destructor for the subclass directly because we're going
     // to delete this as an array of char.
-    if (isa<FunctionType>(this))
+    if (this->isFunctionTy())
       static_cast<const FunctionType*>(this)->FunctionType::~FunctionType();
-    else if (isa<StructType>(this))
+    else if (this->isStructTy())
       static_cast<const StructType*>(this)->StructType::~StructType();
     else
       static_cast<const UnionType*>(this)->UnionType::~UnionType();
@@ -127,32 +127,32 @@ const Type *Type::getScalarType() const {
   return this;
 }
 
-/// isInteger - Return true if this is an IntegerType of the specified width.
-bool Type::isInteger(unsigned Bitwidth) const {
-  return isInteger() && cast<IntegerType>(this)->getBitWidth() == Bitwidth;
+/// isIntegerTy - Return true if this is an IntegerType of the specified width.
+bool Type::isIntegerTy(unsigned Bitwidth) const {
+  return isIntegerTy() && cast<IntegerType>(this)->getBitWidth() == Bitwidth;
 }
 
-/// isIntOrIntVector - Return true if this is an integer type or a vector of
+/// isIntOrIntVectorTy - Return true if this is an integer type or a vector of
 /// integer types.
 ///
-bool Type::isIntOrIntVector() const {
-  if (isInteger())
+bool Type::isIntOrIntVectorTy() const {
+  if (isIntegerTy())
     return true;
   if (ID != Type::VectorTyID) return false;
   
-  return cast<VectorType>(this)->getElementType()->isInteger();
+  return cast<VectorType>(this)->getElementType()->isIntegerTy();
 }
 
-/// isFPOrFPVector - Return true if this is a FP type or a vector of FP types.
+/// isFPOrFPVectorTy - Return true if this is a FP type or a vector of FP types.
 ///
-bool Type::isFPOrFPVector() const {
+bool Type::isFPOrFPVectorTy() const {
   if (ID == Type::FloatTyID || ID == Type::DoubleTyID || 
       ID == Type::FP128TyID || ID == Type::X86_FP80TyID || 
       ID == Type::PPC_FP128TyID)
     return true;
   if (ID != Type::VectorTyID) return false;
   
-  return cast<VectorType>(this)->getElementType()->isFloatingPoint();
+  return cast<VectorType>(this)->getElementType()->isFloatingPointTy();
 }
 
 // canLosslesslyBitCastTo - Return true if this type can be converted to
@@ -176,8 +176,8 @@ bool Type::canLosslesslyBitCastTo(const Type *Ty) const {
   // At this point we have only various mismatches of the first class types
   // remaining and ptr->ptr. Just select the lossless conversions. Everything
   // else is not lossless.
-  if (isa<PointerType>(this))
-    return isa<PointerType>(Ty);
+  if (this->isPointerTy())
+    return Ty->isPointerTy();
   return false;  // Other types have no identity values
 }
 
@@ -207,7 +207,7 @@ unsigned Type::getScalarSizeInBits() const {
 int Type::getFPMantissaWidth() const {
   if (const VectorType *VTy = dyn_cast<VectorType>(this))
     return VTy->getElementType()->getFPMantissaWidth();
-  assert(isFloatingPoint() && "Not a floating point type!");
+  assert(isFloatingPointTy() && "Not a floating point type!");
   if (ID == FloatTyID) return 24;
   if (ID == DoubleTyID) return 53;
   if (ID == X86_FP80TyID) return 64;
@@ -220,7 +220,7 @@ int Type::getFPMantissaWidth() const {
 /// iff all of the members of the type are sized as well.  Since asking for
 /// their size is relatively uncommon, move this operation out of line.
 bool Type::isSizedDerivedType() const {
-  if (isa<IntegerType>(this))
+  if (this->isIntegerTy())
     return true;
 
   if (const ArrayType *ATy = dyn_cast<ArrayType>(this))
@@ -229,7 +229,7 @@ bool Type::isSizedDerivedType() const {
   if (const VectorType *PTy = dyn_cast<VectorType>(this))
     return PTy->getElementType()->isSized();
 
-  if (!isa<StructType>(this) && !isa<UnionType>(this)) 
+  if (!this->isStructTy() && !this->isUnionTy()) 
     return false;
 
   // Okay, our struct is sized if all of the elements are...
@@ -288,7 +288,7 @@ std::string Type::getDescription() const {
 
 bool StructType::indexValid(const Value *V) const {
   // Structure indexes require 32-bit integer constants.
-  if (V->getType()->isInteger(32))
+  if (V->getType()->isIntegerTy(32))
     if (const ConstantInt *CU = dyn_cast<ConstantInt>(V))
       return indexValid(CU->getZExtValue());
   return false;
@@ -314,7 +314,7 @@ const Type *StructType::getTypeAtIndex(unsigned Idx) const {
 
 bool UnionType::indexValid(const Value *V) const {
   // Union indexes require 32-bit integer constants.
-  if (V->getType()->isInteger(32))
+  if (V->getType()->isIntegerTy(32))
     if (const ConstantInt *CU = dyn_cast<ConstantInt>(V))
       return indexValid(CU->getZExtValue());
   return false;
@@ -447,7 +447,7 @@ bool FunctionType::isValidReturnType(const Type *RetTy) {
 /// isValidArgumentType - Return true if the specified type is valid as an
 /// argument type.
 bool FunctionType::isValidArgumentType(const Type *ArgTy) {
-  return ArgTy->isFirstClassType() || isa<OpaqueType>(ArgTy);
+  return ArgTy->isFirstClassType() || ArgTy->isOpaqueTy();
 }
 
 FunctionType::FunctionType(const Type *Result,
@@ -613,7 +613,7 @@ void Type::PromoteAbstractToConcrete() {
     // Concrete types are leaves in the tree.  Since an SCC will either be all
     // abstract or all concrete, we only need to check one type.
     if (SCC[0]->isAbstract()) {
-      if (isa<OpaqueType>(SCC[0]))
+      if (SCC[0]->isOpaqueTy())
         return;     // Not going to be concrete, sorry.
 
       // If all of the children of all of the types in this SCC are concrete,
@@ -660,7 +660,7 @@ static bool TypesEqual(const Type *Ty, const Type *Ty2,
                        std::map<const Type *, const Type *> &EqTypes) {
   if (Ty == Ty2) return true;
   if (Ty->getTypeID() != Ty2->getTypeID()) return false;
-  if (isa<OpaqueType>(Ty))
+  if (Ty->isOpaqueTy())
     return false;  // Two unequal opaque types are never equal
 
   std::map<const Type*, const Type*>::iterator It = EqTypes.find(Ty);
@@ -888,7 +888,7 @@ ArrayType *ArrayType::get(const Type *ElementType, uint64_t NumElements) {
 
 bool ArrayType::isValidElementType(const Type *ElemTy) {
   return ElemTy->getTypeID() != VoidTyID && ElemTy->getTypeID() != LabelTyID &&
-         ElemTy->getTypeID() != MetadataTyID && !isa<FunctionType>(ElemTy);
+         ElemTy->getTypeID() != MetadataTyID && !ElemTy->isFunctionTy();
 }
 
 VectorType *VectorType::get(const Type *ElementType, unsigned NumElements) {
@@ -911,8 +911,8 @@ VectorType *VectorType::get(const Type *ElementType, unsigned NumElements) {
 }
 
 bool VectorType::isValidElementType(const Type *ElemTy) {
-  return ElemTy->isInteger() || ElemTy->isFloatingPoint() ||
-         isa<OpaqueType>(ElemTy);
+  return ElemTy->isIntegerTy() || ElemTy->isFloatingPointTy() ||
+         ElemTy->isOpaqueTy();
 }
 
 //===----------------------------------------------------------------------===//
@@ -955,7 +955,7 @@ StructType *StructType::get(LLVMContext &Context, const Type *type, ...) {
 
 bool StructType::isValidElementType(const Type *ElemTy) {
   return !ElemTy->isVoidTy() && !ElemTy->isLabelTy() &&
-         !ElemTy->isMetadataTy() && !isa<FunctionType>(ElemTy);
+         !ElemTy->isMetadataTy() && !ElemTy->isFunctionTy();
 }
 
 
@@ -1000,7 +1000,7 @@ UnionType *UnionType::get(const Type *type, ...) {
 
 bool UnionType::isValidElementType(const Type *ElemTy) {
   return !ElemTy->isVoidTy() && !ElemTy->isLabelTy() &&
-         !ElemTy->isMetadataTy() && !ElemTy->isFunction();
+         !ElemTy->isMetadataTy() && !ElemTy->isFunctionTy();
 }
 
 int UnionType::getElementTypeIndex(const Type *ElemTy) const {
@@ -1303,7 +1303,7 @@ void PointerType::typeBecameConcrete(const DerivedType *AbsTy) {
 }
 
 bool SequentialType::indexValid(const Value *V) const {
-  if (isa<IntegerType>(V->getType())) 
+  if (V->getType()->isIntegerTy()) 
     return true;
   return false;
 }
diff --git a/libclamav/c++/llvm/lib/VMCore/Value.cpp b/libclamav/c++/llvm/lib/VMCore/Value.cpp
index 3759b8a..a36d262 100644
--- a/libclamav/c++/llvm/lib/VMCore/Value.cpp
+++ b/libclamav/c++/llvm/lib/VMCore/Value.cpp
@@ -45,11 +45,11 @@ Value::Value(const Type *ty, unsigned scid)
     UseList(0), Name(0) {
   if (isa<CallInst>(this) || isa<InvokeInst>(this))
     assert((VTy->isFirstClassType() || VTy->isVoidTy() ||
-            isa<OpaqueType>(ty) || VTy->getTypeID() == Type::StructTyID) &&
+            ty->isOpaqueTy() || VTy->isStructTy()) &&
            "invalid CallInst  type!");
   else if (!isa<Constant>(this) && !isa<BasicBlock>(this))
     assert((VTy->isFirstClassType() || VTy->isVoidTy() ||
-            isa<OpaqueType>(ty)) &&
+            ty->isOpaqueTy()) &&
            "Cannot create non-first-class values except for constants!");
 }
 
@@ -320,7 +320,7 @@ void Value::replaceAllUsesWith(Value *New) {
 }
 
 Value *Value::stripPointerCasts() {
-  if (!isa<PointerType>(getType()))
+  if (!getType()->isPointerTy())
     return this;
   Value *V = this;
   do {
@@ -337,12 +337,12 @@ Value *Value::stripPointerCasts() {
     } else {
       return V;
     }
-    assert(isa<PointerType>(V->getType()) && "Unexpected operand type!");
+    assert(V->getType()->isPointerTy() && "Unexpected operand type!");
   } while (1);
 }
 
 Value *Value::getUnderlyingObject(unsigned MaxLookup) {
-  if (!isa<PointerType>(getType()))
+  if (!getType()->isPointerTy())
     return this;
   Value *V = this;
   for (unsigned Count = 0; MaxLookup == 0 || Count < MaxLookup; ++Count) {
@@ -357,7 +357,7 @@ Value *Value::getUnderlyingObject(unsigned MaxLookup) {
     } else {
       return V;
     }
-    assert(isa<PointerType>(V->getType()) && "Unexpected operand type!");
+    assert(V->getType()->isPointerTy() && "Unexpected operand type!");
   }
   return V;
 }
diff --git a/libclamav/c++/llvm/lib/VMCore/ValueTypes.cpp b/libclamav/c++/llvm/lib/VMCore/ValueTypes.cpp
index 7f9a6cd..a092cd1 100644
--- a/libclamav/c++/llvm/lib/VMCore/ValueTypes.cpp
+++ b/libclamav/c++/llvm/lib/VMCore/ValueTypes.cpp
@@ -36,17 +36,17 @@ EVT EVT::getExtendedVectorVT(LLVMContext &Context, EVT VT,
 
 bool EVT::isExtendedFloatingPoint() const {
   assert(isExtended() && "Type is not extended!");
-  return LLVMTy->isFPOrFPVector();
+  return LLVMTy->isFPOrFPVectorTy();
 }
 
 bool EVT::isExtendedInteger() const {
   assert(isExtended() && "Type is not extended!");
-  return LLVMTy->isIntOrIntVector();
+  return LLVMTy->isIntOrIntVectorTy();
 }
 
 bool EVT::isExtendedVector() const {
   assert(isExtended() && "Type is not extended!");
-  return isa<VectorType>(LLVMTy);
+  return LLVMTy->isVectorTy();
 }
 
 bool EVT::isExtended64BitVector() const {
@@ -126,6 +126,7 @@ std::string EVT::getEVTString() const {
   case MVT::v8f32:   return "v8f32";
   case MVT::v2f64:   return "v2f64";
   case MVT::v4f64:   return "v4f64";
+  case MVT::Metadata:return "Metadata";
   }
 }
 
diff --git a/libclamav/c++/llvm/lib/VMCore/Verifier.cpp b/libclamav/c++/llvm/lib/VMCore/Verifier.cpp
index d0e8d30..35625a5 100644
--- a/libclamav/c++/llvm/lib/VMCore/Verifier.cpp
+++ b/libclamav/c++/llvm/lib/VMCore/Verifier.cpp
@@ -161,7 +161,8 @@ namespace {
     VerifierFailureAction action;
                           // What to do if verification fails.
     Module *Mod;          // Module we are verifying right now
-    DominatorTree *DT; // Dominator Tree, caution can be null!
+    LLVMContext *Context; // Context within which we are verifying
+    DominatorTree *DT;    // Dominator Tree, caution can be null!
 
     std::string Messages;
     raw_string_ostream MessagesStr;
@@ -178,24 +179,25 @@ namespace {
     Verifier()
       : FunctionPass(&ID), 
       Broken(false), RealPass(true), action(AbortProcessAction),
-      DT(0), MessagesStr(Messages) {}
+      Mod(0), Context(0), DT(0), MessagesStr(Messages) {}
     explicit Verifier(VerifierFailureAction ctn)
       : FunctionPass(&ID), 
-      Broken(false), RealPass(true), action(ctn), DT(0),
+      Broken(false), RealPass(true), action(ctn), Mod(0), Context(0), DT(0),
       MessagesStr(Messages) {}
     explicit Verifier(bool AB)
       : FunctionPass(&ID), 
       Broken(false), RealPass(true),
-      action( AB ? AbortProcessAction : PrintMessageAction), DT(0),
-      MessagesStr(Messages) {}
+      action( AB ? AbortProcessAction : PrintMessageAction), Mod(0),
+      Context(0), DT(0), MessagesStr(Messages) {}
     explicit Verifier(DominatorTree &dt)
       : FunctionPass(&ID), 
-      Broken(false), RealPass(false), action(PrintMessageAction),
-      DT(&dt), MessagesStr(Messages) {}
+      Broken(false), RealPass(false), action(PrintMessageAction), Mod(0),
+      Context(0), DT(&dt), MessagesStr(Messages) {}
 
 
     bool doInitialization(Module &M) {
       Mod = &M;
+      Context = &M.getContext();
       verifyTypeSymbolTable(M.getTypeSymbolTable());
 
       // If this is a real pass, in a pass manager, we must abort before
@@ -211,6 +213,7 @@ namespace {
       if (RealPass) DT = &getAnalysis<DominatorTree>();
 
       Mod = F.getParent();
+      if (!Context) Context = &F.getContext();
 
       visit(F);
       InstsInThisBlock.clear();
@@ -314,6 +317,7 @@ namespace {
     void visitStoreInst(StoreInst &SI);
     void visitInstruction(Instruction &I);
     void visitTerminatorInst(TerminatorInst &I);
+    void visitBranchInst(BranchInst &BI);
     void visitReturnInst(ReturnInst &RI);
     void visitSwitchInst(SwitchInst &SI);
     void visitSelectInst(SelectInst &SI);
@@ -429,7 +433,7 @@ void Verifier::visitGlobalValue(GlobalValue &GV) {
 
   if (GV.hasAppendingLinkage()) {
     GlobalVariable *GVar = dyn_cast<GlobalVariable>(&GV);
-    Assert1(GVar && isa<ArrayType>(GVar->getType()->getElementType()),
+    Assert1(GVar && GVar->getType()->getElementType()->isArrayTy(),
             "Only global arrays can have appending linkage!", GVar);
   }
 }
@@ -596,13 +600,16 @@ void Verifier::visitFunction(Function &F) {
   const FunctionType *FT = F.getFunctionType();
   unsigned NumArgs = F.arg_size();
 
+  Assert1(Context == &F.getContext(),
+          "Function context does not match Module context!", &F);
+
   Assert1(!F.hasCommonLinkage(), "Functions may not have common linkage", &F);
   Assert2(FT->getNumParams() == NumArgs,
           "# formal arguments must match # of arguments for function type!",
           &F, FT);
   Assert1(F.getReturnType()->isFirstClassType() ||
           F.getReturnType()->isVoidTy() || 
-          isa<StructType>(F.getReturnType()),
+          F.getReturnType()->isStructTy(),
           "Functions cannot return aggregate values!", &F);
 
   Assert1(!F.hasStructRetAttr() || F.getReturnType()->isVoidTy(),
@@ -743,6 +750,14 @@ void Verifier::visitTerminatorInst(TerminatorInst &I) {
   visitInstruction(I);
 }
 
+void Verifier::visitBranchInst(BranchInst &BI) {
+  if (BI.isConditional()) {
+    Assert2(BI.getCondition()->getType()->isIntegerTy(1),
+            "Branch condition is not 'i1' type!", &BI, BI.getCondition());
+  }
+  visitTerminatorInst(BI);
+}
+
 void Verifier::visitReturnInst(ReturnInst &RI) {
   Function *F = RI.getParent()->getParent();
   unsigned N = RI.getNumOperands();
@@ -821,9 +836,9 @@ void Verifier::visitTruncInst(TruncInst &I) {
   unsigned SrcBitSize = SrcTy->getScalarSizeInBits();
   unsigned DestBitSize = DestTy->getScalarSizeInBits();
 
-  Assert1(SrcTy->isIntOrIntVector(), "Trunc only operates on integer", &I);
-  Assert1(DestTy->isIntOrIntVector(), "Trunc only produces integer", &I);
-  Assert1(isa<VectorType>(SrcTy) == isa<VectorType>(DestTy),
+  Assert1(SrcTy->isIntOrIntVectorTy(), "Trunc only operates on integer", &I);
+  Assert1(DestTy->isIntOrIntVectorTy(), "Trunc only produces integer", &I);
+  Assert1(SrcTy->isVectorTy() == DestTy->isVectorTy(),
           "trunc source and destination must both be a vector or neither", &I);
   Assert1(SrcBitSize > DestBitSize,"DestTy too big for Trunc", &I);
 
@@ -836,9 +851,9 @@ void Verifier::visitZExtInst(ZExtInst &I) {
   const Type *DestTy = I.getType();
 
   // Get the size of the types in bits, we'll need this later
-  Assert1(SrcTy->isIntOrIntVector(), "ZExt only operates on integer", &I);
-  Assert1(DestTy->isIntOrIntVector(), "ZExt only produces an integer", &I);
-  Assert1(isa<VectorType>(SrcTy) == isa<VectorType>(DestTy),
+  Assert1(SrcTy->isIntOrIntVectorTy(), "ZExt only operates on integer", &I);
+  Assert1(DestTy->isIntOrIntVectorTy(), "ZExt only produces an integer", &I);
+  Assert1(SrcTy->isVectorTy() == DestTy->isVectorTy(),
           "zext source and destination must both be a vector or neither", &I);
   unsigned SrcBitSize = SrcTy->getScalarSizeInBits();
   unsigned DestBitSize = DestTy->getScalarSizeInBits();
@@ -857,9 +872,9 @@ void Verifier::visitSExtInst(SExtInst &I) {
   unsigned SrcBitSize = SrcTy->getScalarSizeInBits();
   unsigned DestBitSize = DestTy->getScalarSizeInBits();
 
-  Assert1(SrcTy->isIntOrIntVector(), "SExt only operates on integer", &I);
-  Assert1(DestTy->isIntOrIntVector(), "SExt only produces an integer", &I);
-  Assert1(isa<VectorType>(SrcTy) == isa<VectorType>(DestTy),
+  Assert1(SrcTy->isIntOrIntVectorTy(), "SExt only operates on integer", &I);
+  Assert1(DestTy->isIntOrIntVectorTy(), "SExt only produces an integer", &I);
+  Assert1(SrcTy->isVectorTy() == DestTy->isVectorTy(),
           "sext source and destination must both be a vector or neither", &I);
   Assert1(SrcBitSize < DestBitSize,"Type too small for SExt", &I);
 
@@ -874,9 +889,9 @@ void Verifier::visitFPTruncInst(FPTruncInst &I) {
   unsigned SrcBitSize = SrcTy->getScalarSizeInBits();
   unsigned DestBitSize = DestTy->getScalarSizeInBits();
 
-  Assert1(SrcTy->isFPOrFPVector(),"FPTrunc only operates on FP", &I);
-  Assert1(DestTy->isFPOrFPVector(),"FPTrunc only produces an FP", &I);
-  Assert1(isa<VectorType>(SrcTy) == isa<VectorType>(DestTy),
+  Assert1(SrcTy->isFPOrFPVectorTy(),"FPTrunc only operates on FP", &I);
+  Assert1(DestTy->isFPOrFPVectorTy(),"FPTrunc only produces an FP", &I);
+  Assert1(SrcTy->isVectorTy() == DestTy->isVectorTy(),
           "fptrunc source and destination must both be a vector or neither",&I);
   Assert1(SrcBitSize > DestBitSize,"DestTy too big for FPTrunc", &I);
 
@@ -892,9 +907,9 @@ void Verifier::visitFPExtInst(FPExtInst &I) {
   unsigned SrcBitSize = SrcTy->getScalarSizeInBits();
   unsigned DestBitSize = DestTy->getScalarSizeInBits();
 
-  Assert1(SrcTy->isFPOrFPVector(),"FPExt only operates on FP", &I);
-  Assert1(DestTy->isFPOrFPVector(),"FPExt only produces an FP", &I);
-  Assert1(isa<VectorType>(SrcTy) == isa<VectorType>(DestTy),
+  Assert1(SrcTy->isFPOrFPVectorTy(),"FPExt only operates on FP", &I);
+  Assert1(DestTy->isFPOrFPVectorTy(),"FPExt only produces an FP", &I);
+  Assert1(SrcTy->isVectorTy() == DestTy->isVectorTy(),
           "fpext source and destination must both be a vector or neither", &I);
   Assert1(SrcBitSize < DestBitSize,"DestTy too small for FPExt", &I);
 
@@ -906,14 +921,14 @@ void Verifier::visitUIToFPInst(UIToFPInst &I) {
   const Type *SrcTy = I.getOperand(0)->getType();
   const Type *DestTy = I.getType();
 
-  bool SrcVec = isa<VectorType>(SrcTy);
-  bool DstVec = isa<VectorType>(DestTy);
+  bool SrcVec = SrcTy->isVectorTy();
+  bool DstVec = DestTy->isVectorTy();
 
   Assert1(SrcVec == DstVec,
           "UIToFP source and dest must both be vector or scalar", &I);
-  Assert1(SrcTy->isIntOrIntVector(),
+  Assert1(SrcTy->isIntOrIntVectorTy(),
           "UIToFP source must be integer or integer vector", &I);
-  Assert1(DestTy->isFPOrFPVector(),
+  Assert1(DestTy->isFPOrFPVectorTy(),
           "UIToFP result must be FP or FP vector", &I);
 
   if (SrcVec && DstVec)
@@ -929,14 +944,14 @@ void Verifier::visitSIToFPInst(SIToFPInst &I) {
   const Type *SrcTy = I.getOperand(0)->getType();
   const Type *DestTy = I.getType();
 
-  bool SrcVec = isa<VectorType>(SrcTy);
-  bool DstVec = isa<VectorType>(DestTy);
+  bool SrcVec = SrcTy->isVectorTy();
+  bool DstVec = DestTy->isVectorTy();
 
   Assert1(SrcVec == DstVec,
           "SIToFP source and dest must both be vector or scalar", &I);
-  Assert1(SrcTy->isIntOrIntVector(),
+  Assert1(SrcTy->isIntOrIntVectorTy(),
           "SIToFP source must be integer or integer vector", &I);
-  Assert1(DestTy->isFPOrFPVector(),
+  Assert1(DestTy->isFPOrFPVectorTy(),
           "SIToFP result must be FP or FP vector", &I);
 
   if (SrcVec && DstVec)
@@ -952,13 +967,14 @@ void Verifier::visitFPToUIInst(FPToUIInst &I) {
   const Type *SrcTy = I.getOperand(0)->getType();
   const Type *DestTy = I.getType();
 
-  bool SrcVec = isa<VectorType>(SrcTy);
-  bool DstVec = isa<VectorType>(DestTy);
+  bool SrcVec = SrcTy->isVectorTy();
+  bool DstVec = DestTy->isVectorTy();
 
   Assert1(SrcVec == DstVec,
           "FPToUI source and dest must both be vector or scalar", &I);
-  Assert1(SrcTy->isFPOrFPVector(), "FPToUI source must be FP or FP vector", &I);
-  Assert1(DestTy->isIntOrIntVector(),
+  Assert1(SrcTy->isFPOrFPVectorTy(), "FPToUI source must be FP or FP vector",
+          &I);
+  Assert1(DestTy->isIntOrIntVectorTy(),
           "FPToUI result must be integer or integer vector", &I);
 
   if (SrcVec && DstVec)
@@ -974,14 +990,14 @@ void Verifier::visitFPToSIInst(FPToSIInst &I) {
   const Type *SrcTy = I.getOperand(0)->getType();
   const Type *DestTy = I.getType();
 
-  bool SrcVec = isa<VectorType>(SrcTy);
-  bool DstVec = isa<VectorType>(DestTy);
+  bool SrcVec = SrcTy->isVectorTy();
+  bool DstVec = DestTy->isVectorTy();
 
   Assert1(SrcVec == DstVec,
           "FPToSI source and dest must both be vector or scalar", &I);
-  Assert1(SrcTy->isFPOrFPVector(),
+  Assert1(SrcTy->isFPOrFPVectorTy(),
           "FPToSI source must be FP or FP vector", &I);
-  Assert1(DestTy->isIntOrIntVector(),
+  Assert1(DestTy->isIntOrIntVectorTy(),
           "FPToSI result must be integer or integer vector", &I);
 
   if (SrcVec && DstVec)
@@ -997,8 +1013,8 @@ void Verifier::visitPtrToIntInst(PtrToIntInst &I) {
   const Type *SrcTy = I.getOperand(0)->getType();
   const Type *DestTy = I.getType();
 
-  Assert1(isa<PointerType>(SrcTy), "PtrToInt source must be pointer", &I);
-  Assert1(DestTy->isInteger(), "PtrToInt result must be integral", &I);
+  Assert1(SrcTy->isPointerTy(), "PtrToInt source must be pointer", &I);
+  Assert1(DestTy->isIntegerTy(), "PtrToInt result must be integral", &I);
 
   visitInstruction(I);
 }
@@ -1008,8 +1024,8 @@ void Verifier::visitIntToPtrInst(IntToPtrInst &I) {
   const Type *SrcTy = I.getOperand(0)->getType();
   const Type *DestTy = I.getType();
 
-  Assert1(SrcTy->isInteger(), "IntToPtr source must be an integral", &I);
-  Assert1(isa<PointerType>(DestTy), "IntToPtr result must be a pointer",&I);
+  Assert1(SrcTy->isIntegerTy(), "IntToPtr source must be an integral", &I);
+  Assert1(DestTy->isPointerTy(), "IntToPtr result must be a pointer",&I);
 
   visitInstruction(I);
 }
@@ -1025,7 +1041,7 @@ void Verifier::visitBitCastInst(BitCastInst &I) {
 
   // BitCast implies a no-op cast of type only. No bits change.
   // However, you can't cast pointers to anything but pointers.
-  Assert1(isa<PointerType>(DestTy) == isa<PointerType>(DestTy),
+  Assert1(DestTy->isPointerTy() == DestTy->isPointerTy(),
           "Bitcast requires both operands to be pointer or neither", &I);
   Assert1(SrcBitSize == DestBitSize, "Bitcast requires types of same width",&I);
 
@@ -1068,11 +1084,11 @@ void Verifier::visitPHINode(PHINode &PN) {
 void Verifier::VerifyCallSite(CallSite CS) {
   Instruction *I = CS.getInstruction();
 
-  Assert1(isa<PointerType>(CS.getCalledValue()->getType()),
+  Assert1(CS.getCalledValue()->getType()->isPointerTy(),
           "Called function must be a pointer!", I);
   const PointerType *FPTy = cast<PointerType>(CS.getCalledValue()->getType());
 
-  Assert1(isa<FunctionType>(FPTy->getElementType()),
+  Assert1(FPTy->getElementType()->isFunctionTy(),
           "Called function is not pointer to function type!", I);
   const FunctionType *FTy = cast<FunctionType>(FPTy->getElementType());
 
@@ -1151,7 +1167,7 @@ void Verifier::visitBinaryOperator(BinaryOperator &B) {
   case Instruction::UDiv:
   case Instruction::SRem:
   case Instruction::URem:
-    Assert1(B.getType()->isIntOrIntVector(),
+    Assert1(B.getType()->isIntOrIntVectorTy(),
             "Integer arithmetic operators only work with integral types!", &B);
     Assert1(B.getType() == B.getOperand(0)->getType(),
             "Integer arithmetic operators must have same type "
@@ -1164,7 +1180,7 @@ void Verifier::visitBinaryOperator(BinaryOperator &B) {
   case Instruction::FMul:
   case Instruction::FDiv:
   case Instruction::FRem:
-    Assert1(B.getType()->isFPOrFPVector(),
+    Assert1(B.getType()->isFPOrFPVectorTy(),
             "Floating-point arithmetic operators only work with "
             "floating-point types!", &B);
     Assert1(B.getType() == B.getOperand(0)->getType(),
@@ -1175,7 +1191,7 @@ void Verifier::visitBinaryOperator(BinaryOperator &B) {
   case Instruction::And:
   case Instruction::Or:
   case Instruction::Xor:
-    Assert1(B.getType()->isIntOrIntVector(),
+    Assert1(B.getType()->isIntOrIntVectorTy(),
             "Logical operators only work with integral types!", &B);
     Assert1(B.getType() == B.getOperand(0)->getType(),
             "Logical operators must have same type for operands and result!",
@@ -1184,7 +1200,7 @@ void Verifier::visitBinaryOperator(BinaryOperator &B) {
   case Instruction::Shl:
   case Instruction::LShr:
   case Instruction::AShr:
-    Assert1(B.getType()->isIntOrIntVector(),
+    Assert1(B.getType()->isIntOrIntVectorTy(),
             "Shifts only work with integral types!", &B);
     Assert1(B.getType() == B.getOperand(0)->getType(),
             "Shift return type must be same as operands!", &B);
@@ -1203,7 +1219,7 @@ void Verifier::visitICmpInst(ICmpInst& IC) {
   Assert1(Op0Ty == Op1Ty,
           "Both operands to ICmp instruction are not of the same type!", &IC);
   // Check that the operands are the right type
-  Assert1(Op0Ty->isIntOrIntVector() || isa<PointerType>(Op0Ty),
+  Assert1(Op0Ty->isIntOrIntVectorTy() || Op0Ty->isPointerTy(),
           "Invalid operand types for ICmp instruction", &IC);
 
   visitInstruction(IC);
@@ -1216,7 +1232,7 @@ void Verifier::visitFCmpInst(FCmpInst& FC) {
   Assert1(Op0Ty == Op1Ty,
           "Both operands to FCmp instruction are not of the same type!", &FC);
   // Check that the operands are the right type
-  Assert1(Op0Ty->isFPOrFPVector(),
+  Assert1(Op0Ty->isFPOrFPVectorTy(),
           "Invalid operand types for FCmp instruction", &FC);
   visitInstruction(FC);
 }
@@ -1270,7 +1286,7 @@ void Verifier::visitGetElementPtrInst(GetElementPtrInst &GEP) {
     GetElementPtrInst::getIndexedType(GEP.getOperand(0)->getType(),
                                       Idxs.begin(), Idxs.end());
   Assert1(ElTy, "Invalid indices for GEP pointer type!", &GEP);
-  Assert2(isa<PointerType>(GEP.getType()) &&
+  Assert2(GEP.getType()->isPointerTy() &&
           cast<PointerType>(GEP.getType())->getElementType() == ElTy,
           "GEP is not of right type for indices!", &GEP, ElTy);
   visitInstruction(GEP);
@@ -1302,7 +1318,7 @@ void Verifier::visitAllocaInst(AllocaInst &AI) {
           &AI);
   Assert1(PTy->getElementType()->isSized(), "Cannot allocate unsized type",
           &AI);
-  Assert1(AI.getArraySize()->getType()->isInteger(32),
+  Assert1(AI.getArraySize()->getType()->isIntegerTy(32),
           "Alloca array size must be i32", &AI);
   visitInstruction(AI);
 }
@@ -1481,7 +1497,7 @@ void Verifier::visitInstruction(Instruction &I) {
 void Verifier::VerifyType(const Type *Ty) {
   if (!Types.insert(Ty)) return;
 
-  Assert1(&Mod->getContext() == &Ty->getContext(),
+  Assert1(Context == &Ty->getContext(),
           "Type context does not match Module context!", Ty);
 
   switch (Ty->getTypeID()) {
@@ -1616,7 +1632,7 @@ void Verifier::visitIntrinsicFunctionCall(Intrinsic::ID ID, CallInst &CI) {
     if (ID == Intrinsic::gcroot) {
       AllocaInst *AI =
         dyn_cast<AllocaInst>(CI.getOperand(1)->stripPointerCasts());
-      Assert1(AI && isa<PointerType>(AI->getType()->getElementType()),
+      Assert1(AI && AI->getType()->getElementType()->isPointerTy(),
               "llvm.gcroot parameter #1 must be a pointer alloca.", &CI);
       Assert1(isa<Constant>(CI.getOperand(2)),
               "llvm.gcroot parameter #2 must be a constant.", &CI);
@@ -1734,7 +1750,7 @@ bool Verifier::PerformTypeCheck(Intrinsic::ID ID, Function *F, const Type *Ty,
       }
     }
   } else if (VT == MVT::iAny) {
-    if (!EltTy->isInteger()) {
+    if (!EltTy->isIntegerTy()) {
       CheckFailed(IntrinsicParam(ArgNo, NumRets) + " is not "
                   "an integer type.", F);
       return false;
@@ -1759,7 +1775,7 @@ bool Verifier::PerformTypeCheck(Intrinsic::ID ID, Function *F, const Type *Ty,
       break;
     }
   } else if (VT == MVT::fAny) {
-    if (!EltTy->isFloatingPoint()) {
+    if (!EltTy->isFloatingPointTy()) {
       CheckFailed(IntrinsicParam(ArgNo, NumRets) + " is not "
                   "a floating-point type.", F);
       return false;
@@ -1778,7 +1794,7 @@ bool Verifier::PerformTypeCheck(Intrinsic::ID ID, Function *F, const Type *Ty,
     }
     Suffix += ".v" + utostr(NumElts) + EVT::getEVT(EltTy).getEVTString();
   } else if (VT == MVT::iPTR) {
-    if (!isa<PointerType>(Ty)) {
+    if (!Ty->isPointerTy()) {
       CheckFailed(IntrinsicParam(ArgNo, NumRets) + " is not a "
                   "pointer and a pointer is required.", F);
       return false;
diff --git a/libclamav/c++/llvm/test/Analysis/Andersens/2007-11-19-InlineAsm.ll b/libclamav/c++/llvm/test/Analysis/Andersens/2007-11-19-InlineAsm.ll
deleted file mode 100644
index 5ba3499..0000000
--- a/libclamav/c++/llvm/test/Analysis/Andersens/2007-11-19-InlineAsm.ll
+++ /dev/null
@@ -1,8 +0,0 @@
-; RUN: opt < %s -anders-aa -disable-output
-
-define void @x(i16 %Y) {
-entry:
-  %tmp = call i16 asm "bswap $0", "=r,r"(i16 %Y)
-  ret void
-}
-
diff --git a/libclamav/c++/llvm/test/Analysis/Andersens/2008-03-19-External.ll b/libclamav/c++/llvm/test/Analysis/Andersens/2008-03-19-External.ll
deleted file mode 100644
index a973103..0000000
--- a/libclamav/c++/llvm/test/Analysis/Andersens/2008-03-19-External.ll
+++ /dev/null
@@ -1,12 +0,0 @@
-; RUN: opt < %s -anders-aa -gvn -S | not grep undef
-; PR2160
-
-declare void @f(i32*)
-
-define i32 @g() {
-entry:
-        %tmp = alloca i32               ; <i32*> [#uses=2]
-        call void @f( i32* %tmp )
-        %tmp2 = load i32* %tmp          ; <i32> [#uses=1]
-        ret i32 %tmp2
-}
diff --git a/libclamav/c++/llvm/test/Analysis/Andersens/2008-04-07-Memcpy.ll b/libclamav/c++/llvm/test/Analysis/Andersens/2008-04-07-Memcpy.ll
deleted file mode 100644
index 5a50dd5..0000000
--- a/libclamav/c++/llvm/test/Analysis/Andersens/2008-04-07-Memcpy.ll
+++ /dev/null
@@ -1,14 +0,0 @@
-; RUN: opt < %s -anders-aa -gvn -S | not grep undef
-; PR2169
-
-declare void @llvm.memcpy.i32(i8*, i8*, i32, i32) nounwind
-declare void @use(i8)
-
-define void @f(i8* %x) {
-entry:
-        %copy = alloca i8               ; <i8*> [#uses=6]
-        call void @llvm.memcpy.i32( i8* %copy, i8* %x, i32 1, i32 4 )
-        %tmp = load i8* %copy           ; <i8> [#uses=1]
-        call void @use(i8 %tmp)
-        ret void
-}
diff --git a/libclamav/c++/llvm/test/Analysis/Andersens/2008-12-27-BuiltinWrongType.ll b/libclamav/c++/llvm/test/Analysis/Andersens/2008-12-27-BuiltinWrongType.ll
deleted file mode 100644
index da67511..0000000
--- a/libclamav/c++/llvm/test/Analysis/Andersens/2008-12-27-BuiltinWrongType.ll
+++ /dev/null
@@ -1,19 +0,0 @@
-; RUN: opt < %s -anders-aa
-; PR3262
-
- at .str15 = external global [3 x i8]              ; <[3 x i8]*> [#uses=1]
-
-declare i8* @strtok(...)
-declare i8* @memmove(...)
-
-define void @test1(i8* %want1) nounwind {
-entry:
-        %0 = call i8* (...)* @strtok(i32 0, i8* getelementptr ([3 x i8]* @.str15, i32 0, i32 0)) nounwind               ; <i8*> [#uses=0]
-        unreachable
-}
-
-define void @test2() nounwind {
-entry:
-        %0 = call i8* (...)* @memmove()
-        unreachable
-}
diff --git a/libclamav/c++/llvm/test/Analysis/Andersens/basictest.ll b/libclamav/c++/llvm/test/Analysis/Andersens/basictest.ll
deleted file mode 100644
index 47226dd..0000000
--- a/libclamav/c++/llvm/test/Analysis/Andersens/basictest.ll
+++ /dev/null
@@ -1,28 +0,0 @@
-; RUN: opt < %s -anders-aa -aa-eval 2>/dev/null
-
-define void @test1() {
-	%X = malloc i32*
-	%Y = malloc i32
-	%Z = ptrtoint i32* %Y to i32
-	%W = inttoptr i32 %Z to i32*
-	store i32* %W, i32** %X
-	ret void
-}
-
-define void @test2(i32* %P) {
-	%X = malloc i32*
-	%Y = malloc i32
-	store i32* %P, i32** %X
-	ret void
-}
-
-define internal i32 *@test3(i32* %P) {
-	ret i32* %P
-}
-
-define void @test4() {
-	%X = malloc i32
-	%Y = call i32* @test3(i32* %X)
-	%ZZ = getelementptr i32* null, i32 17
-	ret void
-}
diff --git a/libclamav/c++/llvm/test/Analysis/Andersens/dg.exp b/libclamav/c++/llvm/test/Analysis/Andersens/dg.exp
deleted file mode 100644
index 1eb4755..0000000
--- a/libclamav/c++/llvm/test/Analysis/Andersens/dg.exp
+++ /dev/null
@@ -1,4 +0,0 @@
-load_lib llvm.exp
-
-RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]
-
diff --git a/libclamav/c++/llvm/test/Analysis/Andersens/external.ll b/libclamav/c++/llvm/test/Analysis/Andersens/external.ll
deleted file mode 100644
index 13c12dc..0000000
--- a/libclamav/c++/llvm/test/Analysis/Andersens/external.ll
+++ /dev/null
@@ -1,20 +0,0 @@
-; RUN: opt < %s -anders-aa -gvn -deadargelim -S | grep store | not grep null
-
-; Because the 'internal' function is passed to an external function, we don't
-; know what the incoming values will alias.  As such, we cannot do the 
-; optimization checked by the 'arg-must-alias.ll' test.
-
-declare void @external(i32(i32*)*)
- at G = internal constant i32* null
-
-define internal i32 @internal(i32* %ARG) {
-	;;; We *DON'T* know that ARG always points to null!
-	store i32* %ARG, i32** @G
-	ret i32 0
-}
-
-define i32 @foo() {
-	call void @external(i32(i32*)* @internal)
-	%V = call i32 @internal(i32* null)
-	ret i32 %V
-}
diff --git a/libclamav/c++/llvm/test/Analysis/Andersens/modreftest.ll b/libclamav/c++/llvm/test/Analysis/Andersens/modreftest.ll
deleted file mode 100644
index e0c2edc..0000000
--- a/libclamav/c++/llvm/test/Analysis/Andersens/modreftest.ll
+++ /dev/null
@@ -1,15 +0,0 @@
-; RUN: opt < %s -anders-aa -gvn -instcombine -S \
-; RUN: | grep {ret i1 true}
-
- at G = internal global i32* null
-declare i32 *@ext()
-
-define i1 @bar() {
-  %V1 = load i32** @G
-  %X2 = call i32 *@ext()
-  %V2 = load i32** @G
-  store i32* %X2, i32** @G
-
-  %C = icmp eq i32* %V1, %V2
-  ret i1 %C
-}
diff --git a/libclamav/c++/llvm/test/Analysis/Andersens/modreftest2.ll b/libclamav/c++/llvm/test/Analysis/Andersens/modreftest2.ll
deleted file mode 100644
index 562c961..0000000
--- a/libclamav/c++/llvm/test/Analysis/Andersens/modreftest2.ll
+++ /dev/null
@@ -1,14 +0,0 @@
-; RUN: opt < %s -anders-aa -gvn -S \
-; RUN: | not grep {ret i32 undef}
-
-;; From PR 2160
-declare void @f(i32*)
-
-define i32 @g() {
-entry:
-      %tmp = alloca i32               ; <i32*> [#uses=2]
-	call void @f( i32* %tmp )
-	%tmp2 = load i32* %tmp          ; <i32> [#uses=1]
-	ret i32 %tmp2
-}
-
diff --git a/libclamav/c++/llvm/test/Analysis/Andersens/trivialtest.ll b/libclamav/c++/llvm/test/Analysis/Andersens/trivialtest.ll
deleted file mode 100644
index f9f938f..0000000
--- a/libclamav/c++/llvm/test/Analysis/Andersens/trivialtest.ll
+++ /dev/null
@@ -1,3 +0,0 @@
-; RUN: opt < %s -anders-aa -disable-output
-
-define void @foo() { ret void }
diff --git a/libclamav/c++/llvm/test/Analysis/ScalarEvolution/trip-count10.ll b/libclamav/c++/llvm/test/Analysis/ScalarEvolution/trip-count10.ll
new file mode 100644
index 0000000..0a992f9
--- /dev/null
+++ b/libclamav/c++/llvm/test/Analysis/ScalarEvolution/trip-count10.ll
@@ -0,0 +1,76 @@
+; RUN: opt < %s -analyze -scalar-evolution | FileCheck %s
+
+; Trip counts with trivial exit conditions.
+
+; CHECK: Determining loop execution counts for: @a
+; CHECK: Loop %loop: Unpredictable backedge-taken count. 
+; CHECK: Loop %loop: Unpredictable max backedge-taken count.
+
+; CHECK: Determining loop execution counts for: @b
+; CHECK: Loop %loop: backedge-taken count is false
+; CHECK: Loop %loop: max backedge-taken count is false
+
+; CHECK: Determining loop execution counts for: @c
+; CHECK: Loop %loop: backedge-taken count is false
+; CHECK: Loop %loop: max backedge-taken count is false
+
+; CHECK: Determining loop execution counts for: @d
+; CHECK: Loop %loop: Unpredictable backedge-taken count. 
+; CHECK: Loop %loop: Unpredictable max backedge-taken count. 
+
+define void @a(i64 %n) nounwind {
+entry:
+  %t0 = icmp sgt i64 %n, 0
+  br i1 %t0, label %loop, label %return
+
+loop:
+  %i = phi i64 [ %i.next, %loop ], [ 0, %entry ]
+  %i.next = add nsw i64 %i, 1
+  %exitcond = icmp eq i64 %i.next, %n
+  br i1 false, label %return, label %loop
+
+return:
+  ret void
+}
+define void @b(i64 %n) nounwind {
+entry:
+  %t0 = icmp sgt i64 %n, 0
+  br i1 %t0, label %loop, label %return
+
+loop:
+  %i = phi i64 [ %i.next, %loop ], [ 0, %entry ]
+  %i.next = add nsw i64 %i, 1
+  %exitcond = icmp eq i64 %i.next, %n
+  br i1 true, label %return, label %loop
+
+return:
+  ret void
+}
+define void @c(i64 %n) nounwind {
+entry:
+  %t0 = icmp sgt i64 %n, 0
+  br i1 %t0, label %loop, label %return
+
+loop:
+  %i = phi i64 [ %i.next, %loop ], [ 0, %entry ]
+  %i.next = add nsw i64 %i, 1
+  %exitcond = icmp eq i64 %i.next, %n
+  br i1 false, label %loop, label %return
+
+return:
+  ret void
+}
+define void @d(i64 %n) nounwind {
+entry:
+  %t0 = icmp sgt i64 %n, 0
+  br i1 %t0, label %loop, label %return
+
+loop:
+  %i = phi i64 [ %i.next, %loop ], [ 0, %entry ]
+  %i.next = add nsw i64 %i, 1
+  %exitcond = icmp eq i64 %i.next, %n
+  br i1 true, label %loop, label %return
+
+return:
+  ret void
+}
diff --git a/libclamav/c++/llvm/test/CodeGen/ARM/2010-03-04-eabi-fp-spill.ll b/libclamav/c++/llvm/test/CodeGen/ARM/2010-03-04-eabi-fp-spill.ll
new file mode 100644
index 0000000..f7adf73
--- /dev/null
+++ b/libclamav/c++/llvm/test/CodeGen/ARM/2010-03-04-eabi-fp-spill.ll
@@ -0,0 +1,65 @@
+; RUN: llc < %s -mtriple=arm-unknown-linux-gnueabi
+
+define void @"java.lang.String::getChars"([84 x i8]* %method, i32 %base_pc, [788 x i8]* %thread) {
+  %1 = load i32* undef                            ; <i32> [#uses=1]
+  %2 = sub i32 %1, 48                             ; <i32> [#uses=1]
+  br i1 undef, label %stack_overflow, label %no_overflow
+
+stack_overflow:                                   ; preds = %0
+  unreachable
+
+no_overflow:                                      ; preds = %0
+  %frame = inttoptr i32 %2 to [17 x i32]*         ; <[17 x i32]*> [#uses=4]
+  %3 = load i32* undef                            ; <i32> [#uses=1]
+  %4 = load i32* null                             ; <i32> [#uses=1]
+  %5 = getelementptr inbounds [17 x i32]* %frame, i32 0, i32 13 ; <i32*> [#uses=1]
+  %6 = bitcast i32* %5 to [8 x i8]**              ; <[8 x i8]**> [#uses=1]
+  %7 = load [8 x i8]** %6                         ; <[8 x i8]*> [#uses=1]
+  %8 = getelementptr inbounds [17 x i32]* %frame, i32 0, i32 12 ; <i32*> [#uses=1]
+  %9 = load i32* %8                               ; <i32> [#uses=1]
+  br i1 undef, label %bci_13, label %bci_4
+
+bci_13:                                           ; preds = %no_overflow
+  br i1 undef, label %bci_30, label %bci_21
+
+bci_30:                                           ; preds = %bci_13
+  br i1 undef, label %bci_46, label %bci_35
+
+bci_46:                                           ; preds = %bci_30
+  %10 = sub i32 %4, %3                            ; <i32> [#uses=1]
+  %11 = load [8 x i8]** null                      ; <[8 x i8]*> [#uses=1]
+  %callee = bitcast [8 x i8]* %11 to [84 x i8]*   ; <[84 x i8]*> [#uses=1]
+  %12 = bitcast i8* undef to i32*                 ; <i32*> [#uses=1]
+  %base_pc7 = load i32* %12                       ; <i32> [#uses=2]
+  %13 = add i32 %base_pc7, 0                      ; <i32> [#uses=1]
+  %14 = inttoptr i32 %13 to void ([84 x i8]*, i32, [788 x i8]*)** ; <void ([84 x i8]*, i32, [788 x i8]*)**> [#uses=1]
+  %entry_point = load void ([84 x i8]*, i32, [788 x i8]*)** %14 ; <void ([84 x i8]*, i32, [788 x i8]*)*> [#uses=1]
+  %15 = getelementptr inbounds [17 x i32]* %frame, i32 0, i32 1 ; <i32*> [#uses=1]
+  %16 = ptrtoint i32* %15 to i32                  ; <i32> [#uses=1]
+  %stack_pointer_addr9 = bitcast i8* undef to i32* ; <i32*> [#uses=1]
+  store i32 %16, i32* %stack_pointer_addr9
+  %17 = getelementptr inbounds [17 x i32]* %frame, i32 0, i32 2 ; <i32*> [#uses=1]
+  store i32 %9, i32* %17
+  store i32 %10, i32* undef
+  store [84 x i8]* %method, [84 x i8]** undef
+  %18 = add i32 %base_pc, 20                      ; <i32> [#uses=1]
+  store i32 %18, i32* undef
+  store [8 x i8]* %7, [8 x i8]** undef
+  call void %entry_point([84 x i8]* %callee, i32 %base_pc7, [788 x i8]* %thread)
+  br i1 undef, label %no_exception, label %exception
+
+exception:                                        ; preds = %bci_46
+  ret void
+
+no_exception:                                     ; preds = %bci_46
+  ret void
+
+bci_35:                                           ; preds = %bci_30
+  ret void
+
+bci_21:                                           ; preds = %bci_13
+  ret void
+
+bci_4:                                            ; preds = %no_overflow
+  ret void
+}
diff --git a/libclamav/c++/llvm/test/CodeGen/ARM/2010-03-04-stm-undef-addr.ll b/libclamav/c++/llvm/test/CodeGen/ARM/2010-03-04-stm-undef-addr.ll
new file mode 100644
index 0000000..b0b4cb3
--- /dev/null
+++ b/libclamav/c++/llvm/test/CodeGen/ARM/2010-03-04-stm-undef-addr.ll
@@ -0,0 +1,54 @@
+; RUN: llc < %s -march=arm
+
+define void @"java.lang.String::getChars"([84 x i8]* %method, i32 %base_pc, [788 x i8]* %thread) {
+  %1 = sub i32 undef, 48                          ; <i32> [#uses=1]
+  br i1 undef, label %stack_overflow, label %no_overflow
+
+stack_overflow:                                   ; preds = %0
+  unreachable
+
+no_overflow:                                      ; preds = %0
+  %frame = inttoptr i32 %1 to [17 x i32]*         ; <[17 x i32]*> [#uses=4]
+  %2 = load i32* null                             ; <i32> [#uses=2]
+  %3 = getelementptr inbounds [17 x i32]* %frame, i32 0, i32 14 ; <i32*> [#uses=1]
+  %4 = load i32* %3                               ; <i32> [#uses=2]
+  %5 = load [8 x i8]** undef                      ; <[8 x i8]*> [#uses=2]
+  br i1 undef, label %bci_13, label %bci_4
+
+bci_13:                                           ; preds = %no_overflow
+  br i1 undef, label %bci_30, label %bci_21
+
+bci_30:                                           ; preds = %bci_13
+  %6 = icmp sle i32 %2, %4                        ; <i1> [#uses=1]
+  br i1 %6, label %bci_46, label %bci_35
+
+bci_46:                                           ; preds = %bci_30
+  store [84 x i8]* %method, [84 x i8]** undef
+  br i1 false, label %no_exception, label %exception
+
+exception:                                        ; preds = %bci_46
+  ret void
+
+no_exception:                                     ; preds = %bci_46
+  ret void
+
+bci_35:                                           ; preds = %bci_30
+  %7 = getelementptr inbounds [17 x i32]* %frame, i32 0, i32 15 ; <i32*> [#uses=1]
+  store i32 %2, i32* %7
+  %8 = getelementptr inbounds [17 x i32]* %frame, i32 0, i32 14 ; <i32*> [#uses=1]
+  store i32 %4, i32* %8
+  %9 = getelementptr inbounds [17 x i32]* %frame, i32 0, i32 13 ; <i32*> [#uses=1]
+  %10 = bitcast i32* %9 to [8 x i8]**             ; <[8 x i8]**> [#uses=1]
+  store [8 x i8]* %5, [8 x i8]** %10
+  call void inttoptr (i32 13839116 to void ([788 x i8]*, i32)*)([788 x i8]* %thread, i32 7)
+  ret void
+
+bci_21:                                           ; preds = %bci_13
+  ret void
+
+bci_4:                                            ; preds = %no_overflow
+  store [8 x i8]* %5, [8 x i8]** undef
+  store i32 undef, i32* undef
+  call void inttoptr (i32 13839116 to void ([788 x i8]*, i32)*)([788 x i8]* %thread, i32 7)
+  ret void
+}
diff --git a/libclamav/c++/llvm/test/CodeGen/ARM/call.ll b/libclamav/c++/llvm/test/CodeGen/ARM/call.ll
index 3dd66ae..c60b75b 100644
--- a/libclamav/c++/llvm/test/CodeGen/ARM/call.ll
+++ b/libclamav/c++/llvm/test/CodeGen/ARM/call.ll
@@ -20,3 +20,17 @@ define void @g.upgrd.1() {
         %tmp.upgrd.2 = tail call i32 %tmp( )            ; <i32> [#uses=0]
         ret void
 }
+
+define i32* @m_231b(i32, i32, i32*, i32*, i32*) nounwind {
+; CHECKV4: m_231b
+; CHECKV4: bx r{{.*}}
+BB0:
+  %5 = inttoptr i32 %0 to i32*                    ; <i32*> [#uses=1]
+  %t35 = volatile load i32* %5                    ; <i32> [#uses=1]
+  %6 = inttoptr i32 %t35 to i32**                 ; <i32**> [#uses=1]
+  %7 = getelementptr i32** %6, i32 86             ; <i32**> [#uses=1]
+  %8 = load i32** %7                              ; <i32*> [#uses=1]
+  %9 = bitcast i32* %8 to i32* (i32, i32*, i32, i32*, i32*, i32*)* ; <i32* (i32, i32*, i32, i32*, i32*, i32*)*> [#uses=1]
+  %10 = call i32* %9(i32 %0, i32* null, i32 %1, i32* %2, i32* %3, i32* %4) ; <i32*> [#uses=1]
+  ret i32* %10
+}
diff --git a/libclamav/c++/llvm/test/CodeGen/ARM/neon_minmax.ll b/libclamav/c++/llvm/test/CodeGen/ARM/neon_minmax.ll
new file mode 100644
index 0000000..d301c6a
--- /dev/null
+++ b/libclamav/c++/llvm/test/CodeGen/ARM/neon_minmax.ll
@@ -0,0 +1,81 @@
+; RUN: llc < %s -march=arm -mcpu=cortex-a8 | FileCheck %s
+
+define float @fmin_ole(float %x) nounwind {
+;CHECK: fmin_ole:
+;CHECK: vmin.f32
+  %cond = fcmp ole float 1.0, %x
+  %min1 = select i1 %cond, float 1.0, float %x
+  ret float %min1
+}
+
+define float @fmin_ole_zero(float %x) nounwind {
+;CHECK: fmin_ole_zero:
+;CHECK-NOT: vmin.f32
+  %cond = fcmp ole float 0.0, %x
+  %min1 = select i1 %cond, float 0.0, float %x
+  ret float %min1
+}
+
+define float @fmin_ult(float %x) nounwind {
+;CHECK: fmin_ult:
+;CHECK: vmin.f32
+  %cond = fcmp ult float %x, 1.0
+  %min1 = select i1 %cond, float %x, float 1.0
+  ret float %min1
+}
+
+define float @fmax_ogt(float %x) nounwind {
+;CHECK: fmax_ogt:
+;CHECK: vmax.f32
+  %cond = fcmp ogt float 1.0, %x
+  %max1 = select i1 %cond, float 1.0, float %x
+  ret float %max1
+}
+
+define float @fmax_uge(float %x) nounwind {
+;CHECK: fmax_uge:
+;CHECK: vmax.f32
+  %cond = fcmp uge float %x, 1.0
+  %max1 = select i1 %cond, float %x, float 1.0
+  ret float %max1
+}
+
+define float @fmax_uge_zero(float %x) nounwind {
+;CHECK: fmax_uge_zero:
+;CHECK-NOT: vmax.f32
+  %cond = fcmp uge float %x, 0.0
+  %max1 = select i1 %cond, float %x, float 0.0
+  ret float %max1
+}
+
+define float @fmax_olt_reverse(float %x) nounwind {
+;CHECK: fmax_olt_reverse:
+;CHECK: vmax.f32
+  %cond = fcmp olt float %x, 1.0
+  %max1 = select i1 %cond, float 1.0, float %x
+  ret float %max1
+}
+
+define float @fmax_ule_reverse(float %x) nounwind {
+;CHECK: fmax_ule_reverse:
+;CHECK: vmax.f32
+  %cond = fcmp ult float 1.0, %x
+  %max1 = select i1 %cond, float %x, float 1.0
+  ret float %max1
+}
+
+define float @fmin_oge_reverse(float %x) nounwind {
+;CHECK: fmin_oge_reverse:
+;CHECK: vmin.f32
+  %cond = fcmp oge float %x, 1.0
+  %min1 = select i1 %cond, float 1.0, float %x
+  ret float %min1
+}
+
+define float @fmin_ugt_reverse(float %x) nounwind {
+;CHECK: fmin_ugt_reverse:
+;CHECK: vmin.f32
+  %cond = fcmp ugt float 1.0, %x
+  %min1 = select i1 %cond, float %x, float 1.0
+  ret float %min1
+}
diff --git a/libclamav/c++/llvm/test/CodeGen/Generic/2007-05-05-Personality.ll b/libclamav/c++/llvm/test/CodeGen/Generic/2007-05-05-Personality.ll
index 2749326..c92783e 100644
--- a/libclamav/c++/llvm/test/CodeGen/Generic/2007-05-05-Personality.ll
+++ b/libclamav/c++/llvm/test/CodeGen/Generic/2007-05-05-Personality.ll
@@ -1,4 +1,4 @@
-; RUN: llc < %s -mtriple=i686-pc-linux-gnu -enable-eh -o - | grep zPLR
+; RUN: llc < %s -mtriple=i686-pc-linux-gnu -enable-eh -o - | grep zPL
 
 @error = external global i8		; <i8*> [#uses=2]
 
diff --git a/libclamav/c++/llvm/test/CodeGen/Generic/GC/argpromotion.ll b/libclamav/c++/llvm/test/CodeGen/Generic/GC/argpromotion.ll
index 88fe6dd..18f6155 100644
--- a/libclamav/c++/llvm/test/CodeGen/Generic/GC/argpromotion.ll
+++ b/libclamav/c++/llvm/test/CodeGen/Generic/GC/argpromotion.ll
@@ -1,4 +1,4 @@
-; RUN: opt < %s -anders-aa -argpromotion
+; RUN: opt < %s -argpromotion
 ; XFAIL: *
 
 declare void @llvm.gcroot(i8**, i8*)
diff --git a/libclamav/c++/llvm/test/CodeGen/Generic/debug-info.ll b/libclamav/c++/llvm/test/CodeGen/Generic/debug-info.ll
deleted file mode 100644
index 20d9f91..0000000
--- a/libclamav/c++/llvm/test/CodeGen/Generic/debug-info.ll
+++ /dev/null
@@ -1,19 +0,0 @@
-; RUN: llc < %s
-
-        %lldb.compile_unit = type { i32, i16, i16, i8*, i8*, i8*, {  }* }
- at d.compile_unit7 = external global %lldb.compile_unit           ; <%lldb.compile_unit*> [#uses=1]
-
-declare void @llvm.dbg.stoppoint(i32, i32, %lldb.compile_unit*)
-
-define void @rb_raise(i32, ...) {
-entry:
-        br i1 false, label %strlen.exit, label %no_exit.i
-
-no_exit.i:              ; preds = %entry
-        ret void
-
-strlen.exit:            ; preds = %entry
-        call void @llvm.dbg.stoppoint( i32 4358, i32 0, %lldb.compile_unit* @d.compile_unit7 )
-        unreachable
-}
-
diff --git a/libclamav/c++/llvm/test/CodeGen/MBlaze/brind.ll b/libclamav/c++/llvm/test/CodeGen/MBlaze/brind.ll
new file mode 100644
index 0000000..7798e0f
--- /dev/null
+++ b/libclamav/c++/llvm/test/CodeGen/MBlaze/brind.ll
@@ -0,0 +1,73 @@
+; Ensure that the select instruction is supported and is lowered to 
+; some sort of branch instruction.
+;
+; RUN: llc < %s -march=mblaze -mattr=+mul,+fpu,+barrel | FileCheck %s
+
+declare i32 @printf(i8*, ...)
+ at MSG = internal constant [13 x i8] c"Message: %d\0A\00"
+
+ at BLKS = private constant [5 x i8*]
+    [ i8* blockaddress(@brind, %L1),
+      i8* blockaddress(@brind, %L2),
+      i8* blockaddress(@brind, %L3),
+      i8* blockaddress(@brind, %L4),
+      i8* blockaddress(@brind, %L5) ]
+
+define i32 @brind(i32 %a, i32 %b)
+{
+    ; CHECK:        brind:
+entry:
+    br label %loop
+
+loop:
+    %tmp.0 = phi i32 [ 0, %entry ], [ %tmp.8, %finish ]
+    %dst.0 = getelementptr [5 x i8*]* @BLKS, i32 0, i32 %tmp.0
+    %dst.1 = load i8** %dst.0
+    indirectbr i8* %dst.1, [ label %L1,
+                             label %L2,
+                             label %L3,
+                             label %L4,
+                             label %L5 ]
+    ; CHECK:        br {{r[0-9]*}}
+
+L1:
+    %tmp.1 = add i32 %a, %b
+    br label %finish
+    ; CHECK:        br
+
+L2:
+    %tmp.2 = sub i32 %a, %b
+    br label %finish
+    ; CHECK:        br
+
+L3:
+    %tmp.3 = mul i32 %a, %b
+    br label %finish
+    ; CHECK:        br
+
+L4:
+    %tmp.4 = sdiv i32 %a, %b
+    br label %finish
+    ; CHECK:        br
+
+L5:
+    %tmp.5 = srem i32 %a, %b
+    br label %finish
+    ; CHECK:        br
+
+finish:
+    %tmp.6 = phi i32 [ %tmp.1, %L1 ],
+                     [ %tmp.2, %L2 ],
+                     [ %tmp.3, %L3 ],
+                     [ %tmp.4, %L4 ],
+                     [ %tmp.5, %L5 ]
+
+    call i32 (i8*,...)* @printf( i8* getelementptr([13 x i8]* @MSG,i32 0,i32 0),
+                                 i32 %tmp.6)
+
+    %tmp.7 = add i32 %tmp.0, 1
+    %tmp.8 = urem i32 %tmp.7, 5
+
+    br label %loop
+    ; CHECK:        br
+}
diff --git a/libclamav/c++/llvm/test/CodeGen/MBlaze/callind.ll b/libclamav/c++/llvm/test/CodeGen/MBlaze/callind.ll
new file mode 100644
index 0000000..bfc8d00
--- /dev/null
+++ b/libclamav/c++/llvm/test/CodeGen/MBlaze/callind.ll
@@ -0,0 +1,80 @@
+; Ensure that indirect calls work and that they are lowered to some
+; sort of branch and link instruction.
+;
+; RUN: llc < %s -march=mblaze -mattr=+mul,+fpu,+barrel | FileCheck %s
+
+declare i32 @printf(i8*, ...)
+ at MSG = internal constant [13 x i8] c"Message: %d\0A\00"
+
+ at FUNS = private constant [5 x i32 (i32,i32)*]
+    [ i32 (i32,i32)* @doadd,
+      i32 (i32,i32)* @dosub,
+      i32 (i32,i32)* @domul,
+      i32 (i32,i32)* @dodiv,
+      i32 (i32,i32)* @dorem ]
+
+define i32 @doadd(i32 %a, i32 %b)
+{
+    ; CHECK:        doadd:
+    %tmp.0 = add i32 %a, %b
+    ret i32 %tmp.0
+    ; CHECK:        rtsd
+}
+
+define i32 @dosub(i32 %a, i32 %b)
+{
+    ; CHECK:        dosub:
+    %tmp.0 = sub i32 %a, %b
+    ret i32 %tmp.0
+    ; CHECK:        rtsd
+}
+
+define i32 @domul(i32 %a, i32 %b)
+{
+    ; CHECK:        domul:
+    %tmp.0 = mul i32 %a, %b
+    ret i32 %tmp.0
+    ; CHECK:        rtsd
+}
+
+define i32 @dodiv(i32 %a, i32 %b)
+{
+    ; CHECK:        dodiv:
+    %tmp.0 = sdiv i32 %a, %b
+    ret i32 %tmp.0
+    ; CHECK:        rtsd
+}
+
+define i32 @dorem(i32 %a, i32 %b)
+{
+    ; CHECK:        dorem:
+    %tmp.0 = srem i32 %a, %b
+    ret i32 %tmp.0
+    ; CHECK:        rtsd
+}
+
+define i32 @callind(i32 %a, i32 %b)
+{
+    ; CHECK:        callind:
+entry:
+    br label %loop
+
+loop:
+    %tmp.0 = phi i32 [ 0, %entry ], [ %tmp.3, %loop ]
+    %dst.0 = getelementptr [5 x i32 (i32,i32)*]* @FUNS, i32 0, i32 %tmp.0
+    %dst.1 = load i32 (i32,i32)** %dst.0
+    %tmp.1 = call i32 %dst.1(i32 %a, i32 %b)
+    ; CHECK-NOT:    brli
+    ; CHECK-NOT:    brlai
+    ; CHECK:        brl
+
+    call i32 (i8*,...)* @printf( i8* getelementptr([13 x i8]* @MSG,i32 0,i32 0),
+                                 i32 %tmp.1)
+    ; CHECK:        brl
+
+    %tmp.2 = add i32 %tmp.0, 1
+    %tmp.3 = urem i32 %tmp.2, 5
+
+    br label %loop
+    ; CHECK:        br
+}
diff --git a/libclamav/c++/llvm/test/CodeGen/MBlaze/cc.ll b/libclamav/c++/llvm/test/CodeGen/MBlaze/cc.ll
new file mode 100644
index 0000000..de55728
--- /dev/null
+++ b/libclamav/c++/llvm/test/CodeGen/MBlaze/cc.ll
@@ -0,0 +1,315 @@
+; Test some of the calling convention lowering done by the MBlaze backend.
+; We test that integer values are passed in the correct registers and
+; returned in the correct registers. Additionally, we test that the stack
+; is used as appropriate for passing arguments that cannot be placed into
+; registers.
+;
+; RUN: llc < %s -march=mblaze | FileCheck %s
+
+declare i32 @printf(i8*, ...)
+ at MSG = internal constant [13 x i8] c"Message: %d\0A\00"
+
+define void @params0_noret() {
+    ; CHECK:        params0_noret:
+    ret void
+    ; CHECK-NOT:    {{.* r3, r0, 1}}
+    ; CHECK-NOT:    {{.* r4, .*, .*}}
+    ; CHECK:        rtsd
+}
+
+define i8 @params0_8bitret() {
+    ; CHECK:        params0_8bitret:
+    ret i8 1
+    ; CHECK:        {{.* r3, r0, 1}}
+    ; CHECK-NOT:    {{.* r4, .*, .*}}
+    ; CHECK:        rtsd
+}
+
+define i16 @params0_16bitret() {
+    ; CHECK:        params0_16bitret:
+    ret i16 1
+    ; CHECK:        {{.* r3, r0, 1}}
+    ; CHECK-NOT:    {{.* r4, .*, .*}}
+    ; CHECK:        rtsd
+}
+
+define i32 @params0_32bitret() {
+    ; CHECK:        params0_32bitret:
+    ret i32 1
+    ; CHECK:        {{.* r3, r0, 1}}
+    ; CHECK-NOT:    {{.* r4, .*, .*}}
+    ; CHECK:        rtsd
+}
+
+define i64 @params0_64bitret() {
+    ; CHECK:        params0_64bitret:
+    ret i64 1
+    ; CHECK:        {{.* r3, r0, .*}}
+    ; CHECK:        {{.* r4, r0, 1}}
+    ; CHECK:        rtsd
+}
+
+define i32 @params1_32bitret(i32 %a) {
+    ; CHECK:        params1_32bitret:
+    ret i32 %a
+    ; CHECK:        {{.* r3, r5, r0}}
+    ; CHECK-NOT:    {{.* r4, .*, .*}}
+    ; CHECK:        rtsd
+}
+
+define i32 @params2_32bitret(i32 %a, i32 %b) {
+    ; CHECK:        params2_32bitret:
+    ret i32 %b
+    ; CHECK:        {{.* r3, r6, r0}}
+    ; CHECK-NOT:    {{.* r4, .*, .*}}
+    ; CHECK:        rtsd
+}
+
+define i32 @params3_32bitret(i32 %a, i32 %b, i32 %c) {
+    ; CHECK:        params3_32bitret:
+    ret i32 %c
+    ; CHECK:        {{.* r3, r7, r0}}
+    ; CHECK-NOT:    {{.* r4, .*, .*}}
+    ; CHECK:        rtsd
+}
+
+define i32 @params4_32bitret(i32 %a, i32 %b, i32 %c, i32 %d) {
+    ; CHECK:        params4_32bitret:
+    ret i32 %d
+    ; CHECK:        {{.* r3, r8, r0}}
+    ; CHECK-NOT:    {{.* r4, .*, .*}}
+    ; CHECK:        rtsd
+}
+
+define i32 @params5_32bitret(i32 %a, i32 %b, i32 %c, i32 %d, i32 %e) {
+    ; CHECK:        params5_32bitret:
+    ret i32 %e
+    ; CHECK:        {{.* r3, r9, r0}}
+    ; CHECK-NOT:    {{.* r4, .*, .*}}
+    ; CHECK:        rtsd
+}
+
+define i32 @params6_32bitret(i32 %a, i32 %b, i32 %c, i32 %d, i32 %e, i32 %f) {
+    ; CHECK:        params6_32bitret:
+    ret i32 %f
+    ; CHECK:        {{.* r3, r10, r0}}
+    ; CHECK-NOT:    {{.* r4, .*, .*}}
+    ; CHECK:        rtsd
+}
+
+define i32 @params7_32bitret(i32 %a, i32 %b, i32 %c, i32 %d, i32 %e, i32 %f,
+                             i32 %g) {
+    ; CHECK:        params7_32bitret:
+    ret i32 %g
+    ; CHECK:        {{lwi? r3, r1, 8}}
+    ; CHECK-NOT:    {{.* r4, .*, .*}}
+    ; CHECK:        rtsd
+}
+
+define i32 @params8_32bitret(i32 %a, i32 %b, i32 %c, i32 %d, i32 %e, i32 %f,
+                             i32 %g, i32 %h) {
+    ; CHECK:        params8_32bitret:
+    ret i32 %h
+    ; CHECK:        {{lwi? r3, r1, 12}}
+    ; CHECK-NOT:    {{.* r4, .*, .*}}
+    ; CHECK:        rtsd
+}
+
+define i32 @params9_32bitret(i32 %a, i32 %b, i32 %c, i32 %d, i32 %e, i32 %f,
+                             i32 %g, i32 %h, i32 %i) {
+    ; CHECK:        params9_32bitret:
+    ret i32 %i
+    ; CHECK:        {{lwi? r3, r1, 16}}
+    ; CHECK-NOT:    {{.* r4, .*, .*}}
+    ; CHECK:        rtsd
+}
+
+define i32 @params10_32bitret(i32 %a, i32 %b, i32 %c, i32 %d, i32 %e, i32 %f,
+                              i32 %g, i32 %h, i32 %i, i32 %j) {
+    ; CHECK:        params10_32bitret:
+    ret i32 %j
+    ; CHECK:        {{lwi? r3, r1, 20}}
+    ; CHECK-NOT:    {{.* r4, .*, .*}}
+    ; CHECK:        rtsd
+}
+
+define void @testing() {
+    %MSG.1 = getelementptr [13 x i8]* @MSG, i32 0, i32 0
+
+    call void @params0_noret()
+    ; CHECK:        brlid
+
+    %tmp.1 = call i8 @params0_8bitret()
+    ; CHECK:        brlid
+    call i32 (i8*,...)* @printf(i8* %MSG.1, i8 %tmp.1)
+    ; CHECK:        {{.* r5, .*, .*}}
+    ; CHECK:        {{.* r6, r3, r0}}
+    ; CHECK-NOT:    {{.* r7, .*, .*}}
+    ; CHECK:        brlid
+
+    %tmp.2 = call i16 @params0_16bitret()
+    ; CHECK:        brlid
+    call i32 (i8*,...)* @printf(i8* %MSG.1, i16 %tmp.2)
+    ; CHECK:        {{.* r5, .*, .*}}
+    ; CHECK:        {{.* r6, r3, r0}}
+    ; CHECK-NOT:    {{.* r7, .*, .*}}
+    ; CHECK:        brlid
+
+    %tmp.3 = call i32 @params0_32bitret()
+    ; CHECK:        brlid
+    call i32 (i8*,...)* @printf(i8* %MSG.1, i32 %tmp.3)
+    ; CHECK:        {{.* r5, .*, .*}}
+    ; CHECK:        {{.* r6, r3, r0}}
+    ; CHECK-NOT:    {{.* r7, .*, .*}}
+    ; CHECK:        brlid
+
+    %tmp.4 = call i64 @params0_64bitret()
+    ; CHECK:        brlid
+    call i32 (i8*,...)* @printf(i8* %MSG.1, i64 %tmp.4)
+    ; CHECK:        {{.* r5, .*, .*}}
+    ; CHECK:        {{.* r6, r3, r0}}
+    ; CHECK:        {{.* r7, r4, r0}}
+    ; CHECK:        brlid
+
+    %tmp.5 = call i32 @params1_32bitret(i32 1)
+    ; CHECK:        {{.* r5, .*, .*}}
+    ; CHECK:        brlid
+    call i32 (i8*,...)* @printf(i8* %MSG.1, i32 %tmp.5)
+    ; CHECK:        {{.* r5, .*, .*}}
+    ; CHECK:        {{.* r6, r3, r0}}
+    ; CHECK-NOT:    {{.* r7, .*, .*}}
+    ; CHECK:        brlid
+
+    %tmp.6 = call i32 @params2_32bitret(i32 1, i32 2)
+    ; CHECK:        {{.* r5, .*, .*}}
+    ; CHECK:        {{.* r6, .*, .*}}
+    ; CHECK:        brlid
+    call i32 (i8*,...)* @printf(i8* %MSG.1, i32 %tmp.6)
+    ; CHECK:        {{.* r5, .*, .*}}
+    ; CHECK:        {{.* r6, r3, r0}}
+    ; CHECK-NOT:    {{.* r7, .*, .*}}
+    ; CHECK:        brlid
+
+    %tmp.7 = call i32 @params3_32bitret(i32 1, i32 2, i32 3)
+    ; CHECK:        {{.* r5, .*, .*}}
+    ; CHECK:        {{.* r6, .*, .*}}
+    ; CHECK:        {{.* r7, .*, .*}}
+    ; CHECK:        brlid
+    call i32 (i8*,...)* @printf(i8* %MSG.1, i32 %tmp.7)
+    ; CHECK:        {{.* r5, .*, .*}}
+    ; CHECK:        {{.* r6, r3, r0}}
+    ; CHECK-NOT:    {{.* r7, .*, .*}}
+    ; CHECK:        brlid
+
+    %tmp.8 = call i32 @params4_32bitret(i32 1, i32 2, i32 3, i32 4)
+    ; CHECK:        {{.* r5, .*, .*}}
+    ; CHECK:        {{.* r6, .*, .*}}
+    ; CHECK:        {{.* r7, .*, .*}}
+    ; CHECK:        {{.* r8, .*, .*}}
+    ; CHECK:        brlid
+    call i32 (i8*,...)* @printf(i8* %MSG.1, i32 %tmp.8)
+    ; CHECK:        {{.* r5, .*, .*}}
+    ; CHECK:        {{.* r6, r3, r0}}
+    ; CHECK-NOT:    {{.* r7, .*, .*}}
+    ; CHECK:        brlid
+
+    %tmp.9 = call i32 @params5_32bitret(i32 1, i32 2, i32 3, i32 4, i32 5)
+    ; CHECK:        {{.* r5, .*, .*}}
+    ; CHECK:        {{.* r6, .*, .*}}
+    ; CHECK:        {{.* r7, .*, .*}}
+    ; CHECK:        {{.* r8, .*, .*}}
+    ; CHECK:        {{.* r9, .*, .*}}
+    ; CHECK:        brlid
+    call i32 (i8*,...)* @printf(i8* %MSG.1, i32 %tmp.9)
+    ; CHECK:        {{.* r5, .*, .*}}
+    ; CHECK:        {{.* r6, r3, r0}}
+    ; CHECK-NOT:    {{.* r7, .*, .*}}
+    ; CHECK:        brlid
+
+    %tmp.10 = call i32 @params6_32bitret(i32 1, i32 2, i32 3, i32 4, i32 5,
+                                         i32 6)
+    ; CHECK:        {{.* r5, .*, .*}}
+    ; CHECK:        {{.* r6, .*, .*}}
+    ; CHECK:        {{.* r7, .*, .*}}
+    ; CHECK:        {{.* r8, .*, .*}}
+    ; CHECK:        {{.* r9, .*, .*}}
+    ; CHECK:        {{.* r10, .*, .*}}
+    ; CHECK:        brlid
+    call i32 (i8*,...)* @printf(i8* %MSG.1, i32 %tmp.10)
+    ; CHECK:        {{.* r5, .*, .*}}
+    ; CHECK:        {{.* r6, r3, r0}}
+    ; CHECK-NOT:    {{.* r7, .*, .*}}
+    ; CHECK:        brlid
+
+    %tmp.11 = call i32 @params7_32bitret(i32 1, i32 2, i32 3, i32 4, i32 5,
+                                         i32 6, i32 7)
+    ; CHECK:        {{swi? .*, r1, 4}}
+    ; CHECK:        {{.* r5, .*, .*}}
+    ; CHECK:        {{.* r6, .*, .*}}
+    ; CHECK:        {{.* r7, .*, .*}}
+    ; CHECK:        {{.* r8, .*, .*}}
+    ; CHECK:        {{.* r9, .*, .*}}
+    ; CHECK:        {{.* r10, .*, .*}}
+    ; CHECK:        brlid
+    call i32 (i8*,...)* @printf(i8* %MSG.1, i32 %tmp.11)
+    ; CHECK:        {{.* r5, .*, .*}}
+    ; CHECK:        {{.* r6, r3, r0}}
+    ; CHECK-NOT:    {{.* r7, .*, .*}}
+    ; CHECK:        brlid
+
+    %tmp.12 = call i32 @params8_32bitret(i32 1, i32 2, i32 3, i32 4, i32 5,
+                                         i32 6, i32 7, i32 8)
+    ; CHECK:        {{swi? .*, r1, 4}}
+    ; CHECK:        {{swi? .*, r1, 8}}
+    ; CHECK:        {{.* r5, .*, .*}}
+    ; CHECK:        {{.* r6, .*, .*}}
+    ; CHECK:        {{.* r7, .*, .*}}
+    ; CHECK:        {{.* r8, .*, .*}}
+    ; CHECK:        {{.* r9, .*, .*}}
+    ; CHECK:        {{.* r10, .*, .*}}
+    ; CHECK:        brlid
+    call i32 (i8*,...)* @printf(i8* %MSG.1, i32 %tmp.12)
+    ; CHECK:        {{.* r5, .*, .*}}
+    ; CHECK:        {{.* r6, r3, r0}}
+    ; CHECK-NOT:    {{.* r7, .*, .*}}
+    ; CHECK:        brlid
+
+    %tmp.13 = call i32 @params9_32bitret(i32 1, i32 2, i32 3, i32 4, i32 5,
+                                         i32 6, i32 7, i32 8, i32 9)
+    ; CHECK:        {{swi? .*, r1, 4}}
+    ; CHECK:        {{swi? .*, r1, 8}}
+    ; CHECK:        {{swi? .*, r1, 12}}
+    ; CHECK:        {{.* r5, .*, .*}}
+    ; CHECK:        {{.* r6, .*, .*}}
+    ; CHECK:        {{.* r7, .*, .*}}
+    ; CHECK:        {{.* r8, .*, .*}}
+    ; CHECK:        {{.* r9, .*, .*}}
+    ; CHECK:        {{.* r10, .*, .*}}
+    ; CHECK:        brlid
+    call i32 (i8*,...)* @printf(i8* %MSG.1, i32 %tmp.13)
+    ; CHECK:        {{.* r5, .*, .*}}
+    ; CHECK:        {{.* r6, r3, r0}}
+    ; CHECK-NOT:    {{.* r7, .*, .*}}
+    ; CHECK:        brlid
+
+    %tmp.14 = call i32 @params10_32bitret(i32 1, i32 2, i32 3, i32 4, i32 5,
+                                          i32 6, i32 7, i32 8, i32 9, i32 10)
+    ; CHECK:        {{swi? .*, r1, 4}}
+    ; CHECK:        {{swi? .*, r1, 8}}
+    ; CHECK:        {{swi? .*, r1, 12}}
+    ; CHECK:        {{swi? .*, r1, 16}}
+    ; CHECK:        {{.* r5, .*, .*}}
+    ; CHECK:        {{.* r6, .*, .*}}
+    ; CHECK:        {{.* r7, .*, .*}}
+    ; CHECK:        {{.* r8, .*, .*}}
+    ; CHECK:        {{.* r9, .*, .*}}
+    ; CHECK:        {{.* r10, .*, .*}}
+    ; CHECK:        brlid
+    call i32 (i8*,...)* @printf(i8* %MSG.1, i32 %tmp.14)
+    ; CHECK:        {{.* r5, .*, .*}}
+    ; CHECK:        {{.* r6, r3, r0}}
+    ; CHECK-NOT:    {{.* r7, .*, .*}}
+    ; CHECK:        brlid
+
+    ret void
+}
diff --git a/libclamav/c++/llvm/test/CodeGen/MBlaze/dg.exp b/libclamav/c++/llvm/test/CodeGen/MBlaze/dg.exp
new file mode 100644
index 0000000..bfd5e47
--- /dev/null
+++ b/libclamav/c++/llvm/test/CodeGen/MBlaze/dg.exp
@@ -0,0 +1,5 @@
+load_lib llvm.exp
+
+if { [llvm_supports_target MBlaze] } {
+  RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]
+}
diff --git a/libclamav/c++/llvm/test/CodeGen/MBlaze/div.ll b/libclamav/c++/llvm/test/CodeGen/MBlaze/div.ll
new file mode 100644
index 0000000..fae9830
--- /dev/null
+++ b/libclamav/c++/llvm/test/CodeGen/MBlaze/div.ll
@@ -0,0 +1,75 @@
+; Ensure that multiplication is lowered to function calls when the multiplier
+; unit is not available in the hardware and that function calls are not used
+; when the multiplier unit is available in the hardware.
+;
+; RUN: llc < %s -march=mblaze | FileCheck -check-prefix=FUN %s
+; RUN: llc < %s -march=mblaze -mattr=+div | FileCheck -check-prefix=DIV %s
+
+define i8 @test_i8(i8 %a, i8 %b) {
+    ; FUN:        test_i8:
+    ; DIV:        test_i8:
+
+    %tmp.1 = udiv i8 %a, %b
+    ; FUN-NOT:    idiv
+    ; FUN:        brlid
+    ; DIV-NOT:    brlid
+    ; DIV:        idivu
+
+    %tmp.2 = sdiv i8 %a, %b
+    ; FUN-NOT:    idiv
+    ; FUN:        brlid
+    ; DIV-NOT:    brlid
+    ; DIV-NOT:    idivu
+    ; DIV:        idiv
+
+    %tmp.3 = add i8 %tmp.1, %tmp.2
+    ret i8 %tmp.3
+    ; FUN:        rtsd
+    ; DIV:        rtsd
+}
+
+define i16 @test_i16(i16 %a, i16 %b) {
+    ; FUN:        test_i16:
+    ; DIV:        test_i16:
+
+    %tmp.1 = udiv i16 %a, %b
+    ; FUN-NOT:    idiv
+    ; FUN:        brlid
+    ; DIV-NOT:    brlid
+    ; DIV:        idivu
+
+    %tmp.2 = sdiv i16 %a, %b
+    ; FUN-NOT:    idiv
+    ; FUN:        brlid
+    ; DIV-NOT:    brlid
+    ; DIV-NOT:    idivu
+    ; DIV:        idiv
+
+    %tmp.3 = add i16 %tmp.1, %tmp.2
+    ret i16 %tmp.3
+    ; FUN:        rtsd
+    ; DIV:        rtsd
+}
+
+define i32 @test_i32(i32 %a, i32 %b) {
+    ; FUN:        test_i32:
+    ; DIV:        test_i32:
+
+    %tmp.1 = udiv i32 %a, %b
+    ; FUN-NOT:    idiv
+    ; FUN:        brlid
+    ; DIV-NOT:    brlid
+    ; DIV:        idivu
+
+    %tmp.2 = sdiv i32 %a, %b
+    ; FUN-NOT:    idiv
+    ; FUN:        brlid
+    ; DIV-NOT:    brlid
+    ; DIV-NOT:    idivu
+    ; DIV:        idiv
+
+    %tmp.3 = add i32 %tmp.1, %tmp.2
+    ret i32 %tmp.3
+    ; FUN:        rtsd
+    ; DIV:        rtsd
+}
diff --git a/libclamav/c++/llvm/test/CodeGen/MBlaze/fpu.ll b/libclamav/c++/llvm/test/CodeGen/MBlaze/fpu.ll
new file mode 100644
index 0000000..83f4d83
--- /dev/null
+++ b/libclamav/c++/llvm/test/CodeGen/MBlaze/fpu.ll
@@ -0,0 +1,66 @@
+; Ensure that floating point operations are lowered to function calls when the
+; FPU is not available in the hardware and that function calls are not used
+; when the FPU is available in the hardware.
+;
+; RUN: llc < %s -march=mblaze | FileCheck -check-prefix=FUN %s
+; RUN: llc < %s -march=mblaze -mattr=+fpu | FileCheck -check-prefix=FPU %s
+
+define float @test_add(float %a, float %b) {
+    ; FUN:        test_add:
+    ; FPU:        test_add:
+
+    %tmp.1 = fadd float %a, %b
+    ; FUN-NOT:    fadd
+    ; FUN:        brlid
+    ; FPU-NOT:    brlid
+    ; FPU:        fadd
+
+    ret float %tmp.1
+    ; FUN:        rtsd
+    ; FPU:        rtsd
+}
+
+define float @test_sub(float %a, float %b) {
+    ; FUN:        test_sub:
+    ; FPU:        test_sub:
+
+    %tmp.1 = fsub float %a, %b
+    ; FUN-NOT:    frsub
+    ; FUN:        brlid
+    ; FPU-NOT:    brlid
+    ; FPU:        frsub
+
+    ret float %tmp.1
+    ; FUN:        rtsd
+    ; FPU:        rtsd
+}
+
+define float @test_mul(float %a, float %b) {
+    ; FUN:        test_mul:
+    ; FPU:        test_mul:
+
+    %tmp.1 = fmul float %a, %b
+    ; FUN-NOT:    fmul
+    ; FUN:        brlid
+    ; FPU-NOT:    brlid
+    ; FPU:        fmul
+
+    ret float %tmp.1
+    ; FUN:        rtsd
+    ; FPU:        rtsd
+}
+
+define float @test_div(float %a, float %b) {
+    ; FUN:        test_div:
+    ; FPU:        test_div:
+
+    %tmp.1 = fdiv float %a, %b
+    ; FUN-NOT:    fdiv
+    ; FUN:        brlid
+    ; FPU-NOT:    brlid
+    ; FPU:        fdiv
+
+    ret float %tmp.1
+    ; FUN:        rtsd
+    ; FPU:        rtsd
+}
diff --git a/libclamav/c++/llvm/test/CodeGen/MBlaze/fsl.ll b/libclamav/c++/llvm/test/CodeGen/MBlaze/fsl.ll
new file mode 100644
index 0000000..f9c6205
--- /dev/null
+++ b/libclamav/c++/llvm/test/CodeGen/MBlaze/fsl.ll
@@ -0,0 +1,323 @@
+; Ensure that the FSL instrinsic instruction generate single FSL instructions
+; at the machine level. Additionally, ensure that dynamic values use the
+; dynamic version of the instructions and that constant values use the
+; constant version of the instructions.
+;
+; RUN: llc < %s -march=mblaze | FileCheck %s
+
+declare i32 @llvm.mblaze.fsl.get(i32 %port)
+declare i32 @llvm.mblaze.fsl.aget(i32 %port)
+declare i32 @llvm.mblaze.fsl.cget(i32 %port)
+declare i32 @llvm.mblaze.fsl.caget(i32 %port)
+declare i32 @llvm.mblaze.fsl.eget(i32 %port)
+declare i32 @llvm.mblaze.fsl.eaget(i32 %port)
+declare i32 @llvm.mblaze.fsl.ecget(i32 %port)
+declare i32 @llvm.mblaze.fsl.ecaget(i32 %port)
+declare i32 @llvm.mblaze.fsl.nget(i32 %port)
+declare i32 @llvm.mblaze.fsl.naget(i32 %port)
+declare i32 @llvm.mblaze.fsl.ncget(i32 %port)
+declare i32 @llvm.mblaze.fsl.ncaget(i32 %port)
+declare i32 @llvm.mblaze.fsl.neget(i32 %port)
+declare i32 @llvm.mblaze.fsl.neaget(i32 %port)
+declare i32 @llvm.mblaze.fsl.necget(i32 %port)
+declare i32 @llvm.mblaze.fsl.necaget(i32 %port)
+declare i32 @llvm.mblaze.fsl.tget(i32 %port)
+declare i32 @llvm.mblaze.fsl.taget(i32 %port)
+declare i32 @llvm.mblaze.fsl.tcget(i32 %port)
+declare i32 @llvm.mblaze.fsl.tcaget(i32 %port)
+declare i32 @llvm.mblaze.fsl.teget(i32 %port)
+declare i32 @llvm.mblaze.fsl.teaget(i32 %port)
+declare i32 @llvm.mblaze.fsl.tecget(i32 %port)
+declare i32 @llvm.mblaze.fsl.tecaget(i32 %port)
+declare i32 @llvm.mblaze.fsl.tnget(i32 %port)
+declare i32 @llvm.mblaze.fsl.tnaget(i32 %port)
+declare i32 @llvm.mblaze.fsl.tncget(i32 %port)
+declare i32 @llvm.mblaze.fsl.tncaget(i32 %port)
+declare i32 @llvm.mblaze.fsl.tneget(i32 %port)
+declare i32 @llvm.mblaze.fsl.tneaget(i32 %port)
+declare i32 @llvm.mblaze.fsl.tnecget(i32 %port)
+declare i32 @llvm.mblaze.fsl.tnecaget(i32 %port)
+
+declare void @llvm.mblaze.fsl.put(i32 %value, i32 %port)
+declare void @llvm.mblaze.fsl.aput(i32 %value, i32 %port)
+declare void @llvm.mblaze.fsl.cput(i32 %value, i32 %port)
+declare void @llvm.mblaze.fsl.caput(i32 %value, i32 %port)
+declare void @llvm.mblaze.fsl.nput(i32 %value, i32 %port)
+declare void @llvm.mblaze.fsl.naput(i32 %value, i32 %port)
+declare void @llvm.mblaze.fsl.ncput(i32 %value, i32 %port)
+declare void @llvm.mblaze.fsl.ncaput(i32 %value, i32 %port)
+declare void @llvm.mblaze.fsl.tput(i32 %port)
+declare void @llvm.mblaze.fsl.taput(i32 %port)
+declare void @llvm.mblaze.fsl.tcput(i32 %port)
+declare void @llvm.mblaze.fsl.tcaput(i32 %port)
+declare void @llvm.mblaze.fsl.tnput(i32 %port)
+declare void @llvm.mblaze.fsl.tnaput(i32 %port)
+declare void @llvm.mblaze.fsl.tncput(i32 %port)
+declare void @llvm.mblaze.fsl.tncaput(i32 %port)
+
+define i32 @fsl_get(i32 %port)
+{
+    ; CHECK:        fsl_get:
+    %v0  = call i32 @llvm.mblaze.fsl.get(i32 %port)
+    ; CHECK:        getd
+    %v1  = call i32 @llvm.mblaze.fsl.aget(i32 %port)
+    ; CHECK-NEXT:   agetd
+    %v2  = call i32 @llvm.mblaze.fsl.cget(i32 %port)
+    ; CHECK-NEXT:   cgetd
+    %v3  = call i32 @llvm.mblaze.fsl.caget(i32 %port)
+    ; CHECK-NEXT:   cagetd
+    %v4  = call i32 @llvm.mblaze.fsl.eget(i32 %port)
+    ; CHECK-NEXT:   egetd
+    %v5  = call i32 @llvm.mblaze.fsl.eaget(i32 %port)
+    ; CHECK-NEXT:   eagetd
+    %v6  = call i32 @llvm.mblaze.fsl.ecget(i32 %port)
+    ; CHECK-NEXT:   ecgetd
+    %v7  = call i32 @llvm.mblaze.fsl.ecaget(i32 %port)
+    ; CHECK-NEXT:   ecagetd
+    %v8  = call i32 @llvm.mblaze.fsl.nget(i32 %port)
+    ; CHECK-NEXT:   ngetd
+    %v9  = call i32 @llvm.mblaze.fsl.naget(i32 %port)
+    ; CHECK-NEXT:   nagetd
+    %v10 = call i32 @llvm.mblaze.fsl.ncget(i32 %port)
+    ; CHECK-NEXT:   ncgetd
+    %v11 = call i32 @llvm.mblaze.fsl.ncaget(i32 %port)
+    ; CHECK-NEXT:   ncagetd
+    %v12 = call i32 @llvm.mblaze.fsl.neget(i32 %port)
+    ; CHECK-NEXT:   negetd
+    %v13 = call i32 @llvm.mblaze.fsl.neaget(i32 %port)
+    ; CHECK-NEXT:   neagetd
+    %v14 = call i32 @llvm.mblaze.fsl.necget(i32 %port)
+    ; CHECK-NEXT:   necgetd
+    %v15 = call i32 @llvm.mblaze.fsl.necaget(i32 %port)
+    ; CHECK-NEXT:   necagetd
+    %v16 = call i32 @llvm.mblaze.fsl.tget(i32 %port)
+    ; CHECK-NEXT:   tgetd
+    %v17 = call i32 @llvm.mblaze.fsl.taget(i32 %port)
+    ; CHECK-NEXT:   tagetd
+    %v18 = call i32 @llvm.mblaze.fsl.tcget(i32 %port)
+    ; CHECK-NEXT:   tcgetd
+    %v19 = call i32 @llvm.mblaze.fsl.tcaget(i32 %port)
+    ; CHECK-NEXT:   tcagetd
+    %v20 = call i32 @llvm.mblaze.fsl.teget(i32 %port)
+    ; CHECK-NEXT:   tegetd
+    %v21 = call i32 @llvm.mblaze.fsl.teaget(i32 %port)
+    ; CHECK-NEXT:   teagetd
+    %v22 = call i32 @llvm.mblaze.fsl.tecget(i32 %port)
+    ; CHECK-NEXT:   tecgetd
+    %v23 = call i32 @llvm.mblaze.fsl.tecaget(i32 %port)
+    ; CHECK-NEXT:   tecagetd
+    %v24 = call i32 @llvm.mblaze.fsl.tnget(i32 %port)
+    ; CHECK-NEXT:   tngetd
+    %v25 = call i32 @llvm.mblaze.fsl.tnaget(i32 %port)
+    ; CHECK-NEXT:   tnagetd
+    %v26 = call i32 @llvm.mblaze.fsl.tncget(i32 %port)
+    ; CHECK-NEXT:   tncgetd
+    %v27 = call i32 @llvm.mblaze.fsl.tncaget(i32 %port)
+    ; CHECK-NEXT:   tncagetd
+    %v28 = call i32 @llvm.mblaze.fsl.tneget(i32 %port)
+    ; CHECK-NEXT:   tnegetd
+    %v29 = call i32 @llvm.mblaze.fsl.tneaget(i32 %port)
+    ; CHECK-NEXT:   tneagetd
+    %v30 = call i32 @llvm.mblaze.fsl.tnecget(i32 %port)
+    ; CHECK-NEXT:   tnecgetd
+    %v31 = call i32 @llvm.mblaze.fsl.tnecaget(i32 %port)
+    ; CHECK-NEXT:   tnecagetd
+    ret i32 1
+    ; CHECK:        rtsd
+}
+
+define i32 @fslc_get()
+{
+    ; CHECK:        fslc_get:
+    %v0  = call i32 @llvm.mblaze.fsl.get(i32 1)
+    ; CHECK:        get
+    %v1  = call i32 @llvm.mblaze.fsl.aget(i32 1)
+    ; CHECK-NOT:    agetd
+    ; CHECK:        aget
+    %v2  = call i32 @llvm.mblaze.fsl.cget(i32 1)
+    ; CHECK-NOT:    cgetd
+    ; CHECK:        cget
+    %v3  = call i32 @llvm.mblaze.fsl.caget(i32 1)
+    ; CHECK-NOT:    cagetd
+    ; CHECK:        caget
+    %v4  = call i32 @llvm.mblaze.fsl.eget(i32 1)
+    ; CHECK-NOT:    egetd
+    ; CHECK:        eget
+    %v5  = call i32 @llvm.mblaze.fsl.eaget(i32 1)
+    ; CHECK-NOT:    eagetd
+    ; CHECK:        eaget
+    %v6  = call i32 @llvm.mblaze.fsl.ecget(i32 1)
+    ; CHECK-NOT:    ecgetd
+    ; CHECK:        ecget
+    %v7  = call i32 @llvm.mblaze.fsl.ecaget(i32 1)
+    ; CHECK-NOT:    ecagetd
+    ; CHECK:        ecaget
+    %v8  = call i32 @llvm.mblaze.fsl.nget(i32 1)
+    ; CHECK-NOT:    ngetd
+    ; CHECK:        nget
+    %v9  = call i32 @llvm.mblaze.fsl.naget(i32 1)
+    ; CHECK-NOT:    nagetd
+    ; CHECK:        naget
+    %v10 = call i32 @llvm.mblaze.fsl.ncget(i32 1)
+    ; CHECK-NOT:    ncgetd
+    ; CHECK:        ncget
+    %v11 = call i32 @llvm.mblaze.fsl.ncaget(i32 1)
+    ; CHECK-NOT:    ncagetd
+    ; CHECK:        ncaget
+    %v12 = call i32 @llvm.mblaze.fsl.neget(i32 1)
+    ; CHECK-NOT:    negetd
+    ; CHECK:        neget
+    %v13 = call i32 @llvm.mblaze.fsl.neaget(i32 1)
+    ; CHECK-NOT:    neagetd
+    ; CHECK:        neaget
+    %v14 = call i32 @llvm.mblaze.fsl.necget(i32 1)
+    ; CHECK-NOT:    necgetd
+    ; CHECK:        necget
+    %v15 = call i32 @llvm.mblaze.fsl.necaget(i32 1)
+    ; CHECK-NOT:    necagetd
+    ; CHECK:        necaget
+    %v16 = call i32 @llvm.mblaze.fsl.tget(i32 1)
+    ; CHECK-NOT:    tgetd
+    ; CHECK:        tget
+    %v17 = call i32 @llvm.mblaze.fsl.taget(i32 1)
+    ; CHECK-NOT:    tagetd
+    ; CHECK:        taget
+    %v18 = call i32 @llvm.mblaze.fsl.tcget(i32 1)
+    ; CHECK-NOT:    tcgetd
+    ; CHECK:        tcget
+    %v19 = call i32 @llvm.mblaze.fsl.tcaget(i32 1)
+    ; CHECK-NOT:    tcagetd
+    ; CHECK:        tcaget
+    %v20 = call i32 @llvm.mblaze.fsl.teget(i32 1)
+    ; CHECK-NOT:    tegetd
+    ; CHECK:        teget
+    %v21 = call i32 @llvm.mblaze.fsl.teaget(i32 1)
+    ; CHECK-NOT:    teagetd
+    ; CHECK:        teaget
+    %v22 = call i32 @llvm.mblaze.fsl.tecget(i32 1)
+    ; CHECK-NOT:    tecgetd
+    ; CHECK:        tecget
+    %v23 = call i32 @llvm.mblaze.fsl.tecaget(i32 1)
+    ; CHECK-NOT:    tecagetd
+    ; CHECK:        tecaget
+    %v24 = call i32 @llvm.mblaze.fsl.tnget(i32 1)
+    ; CHECK-NOT:    tngetd
+    ; CHECK:        tnget
+    %v25 = call i32 @llvm.mblaze.fsl.tnaget(i32 1)
+    ; CHECK-NOT:    tnagetd
+    ; CHECK:        tnaget
+    %v26 = call i32 @llvm.mblaze.fsl.tncget(i32 1)
+    ; CHECK-NOT:    tncgetd
+    ; CHECK:        tncget
+    %v27 = call i32 @llvm.mblaze.fsl.tncaget(i32 1)
+    ; CHECK-NOT:    tncagetd
+    ; CHECK:        tncaget
+    %v28 = call i32 @llvm.mblaze.fsl.tneget(i32 1)
+    ; CHECK-NOT:    tnegetd
+    ; CHECK:        tneget
+    %v29 = call i32 @llvm.mblaze.fsl.tneaget(i32 1)
+    ; CHECK-NOT:    tneagetd
+    ; CHECK:        tneaget
+    %v30 = call i32 @llvm.mblaze.fsl.tnecget(i32 1)
+    ; CHECK-NOT:    tnecgetd
+    ; CHECK:        tnecget
+    %v31 = call i32 @llvm.mblaze.fsl.tnecaget(i32 1)
+    ; CHECK-NOT:    tnecagetd
+    ; CHECK:        tnecaget
+    ret i32 1
+    ; CHECK:        rtsd
+}
+
+define void @putfsl(i32 %value, i32 %port)
+{
+    ; CHECK:        putfsl:
+    call void @llvm.mblaze.fsl.put(i32 %value, i32 %port)
+    ; CHECK:        putd
+    call void @llvm.mblaze.fsl.aput(i32 %value, i32 %port)
+    ; CHECK-NEXT:   aputd
+    call void @llvm.mblaze.fsl.cput(i32 %value, i32 %port)
+    ; CHECK-NEXT:   cputd
+    call void @llvm.mblaze.fsl.caput(i32 %value, i32 %port)
+    ; CHECK-NEXT:   caputd
+    call void @llvm.mblaze.fsl.nput(i32 %value, i32 %port)
+    ; CHECK-NEXT:   nputd
+    call void @llvm.mblaze.fsl.naput(i32 %value, i32 %port)
+    ; CHECK-NEXT:   naputd
+    call void @llvm.mblaze.fsl.ncput(i32 %value, i32 %port)
+    ; CHECK-NEXT:   ncputd
+    call void @llvm.mblaze.fsl.ncaput(i32 %value, i32 %port)
+    ; CHECK-NEXT:   ncaputd
+    call void @llvm.mblaze.fsl.tput(i32 %port)
+    ; CHECK-NEXT:   tputd
+    call void @llvm.mblaze.fsl.taput(i32 %port)
+    ; CHECK-NEXT:   taputd
+    call void @llvm.mblaze.fsl.tcput(i32 %port)
+    ; CHECK-NEXT:   tcputd
+    call void @llvm.mblaze.fsl.tcaput(i32 %port)
+    ; CHECK-NEXT:   tcaputd
+    call void @llvm.mblaze.fsl.tnput(i32 %port)
+    ; CHECK-NEXT:   tnputd
+    call void @llvm.mblaze.fsl.tnaput(i32 %port)
+    ; CHECK-NEXT:   tnaputd
+    call void @llvm.mblaze.fsl.tncput(i32 %port)
+    ; CHECK-NEXT:   tncputd
+    call void @llvm.mblaze.fsl.tncaput(i32 %port)
+    ; CHECK-NEXT:   tncaputd
+    ret void
+    ; CHECK:        rtsd
+}
+
+define void @putfsl_const(i32 %value)
+{
+    ; CHECK:        putfsl_const:
+    call void @llvm.mblaze.fsl.put(i32 %value, i32 1)
+    ; CHECK-NOT:    putd
+    ; CHECK:        put
+    call void @llvm.mblaze.fsl.aput(i32 %value, i32 1)
+    ; CHECK-NOT:    aputd
+    ; CHECK:        aput
+    call void @llvm.mblaze.fsl.cput(i32 %value, i32 1)
+    ; CHECK-NOT:    cputd
+    ; CHECK:        cput
+    call void @llvm.mblaze.fsl.caput(i32 %value, i32 1)
+    ; CHECK-NOT:    caputd
+    ; CHECK:        caput
+    call void @llvm.mblaze.fsl.nput(i32 %value, i32 1)
+    ; CHECK-NOT:    nputd
+    ; CHECK:        nput
+    call void @llvm.mblaze.fsl.naput(i32 %value, i32 1)
+    ; CHECK-NOT:    naputd
+    ; CHECK:        naput
+    call void @llvm.mblaze.fsl.ncput(i32 %value, i32 1)
+    ; CHECK-NOT:    ncputd
+    ; CHECK:        ncput
+    call void @llvm.mblaze.fsl.ncaput(i32 %value, i32 1)
+    ; CHECK-NOT:    ncaputd
+    ; CHECK:        ncaput
+    call void @llvm.mblaze.fsl.tput(i32 1)
+    ; CHECK-NOT:    tputd
+    ; CHECK:        tput
+    call void @llvm.mblaze.fsl.taput(i32 1)
+    ; CHECK-NOT:    taputd
+    ; CHECK:        taput
+    call void @llvm.mblaze.fsl.tcput(i32 1)
+    ; CHECK-NOT:    tcputd
+    ; CHECK:        tcput
+    call void @llvm.mblaze.fsl.tcaput(i32 1)
+    ; CHECK-NOT:    tcaputd
+    ; CHECK:        tcaput
+    call void @llvm.mblaze.fsl.tnput(i32 1)
+    ; CHECK-NOT:    tnputd
+    ; CHECK:        tnput
+    call void @llvm.mblaze.fsl.tnaput(i32 1)
+    ; CHECK-NOT:    tnaputd
+    ; CHECK:        tnaput
+    call void @llvm.mblaze.fsl.tncput(i32 1)
+    ; CHECK-NOT:    tncputd
+    ; CHECK:        tncput
+    call void @llvm.mblaze.fsl.tncaput(i32 1)
+    ; CHECK-NOT:    tncaputd
+    ; CHECK:        tncaput
+    ret void
+    ; CHECK:        rtsd
+}
diff --git a/libclamav/c++/llvm/test/CodeGen/MBlaze/imm.ll b/libclamav/c++/llvm/test/CodeGen/MBlaze/imm.ll
new file mode 100644
index 0000000..85fad17
--- /dev/null
+++ b/libclamav/c++/llvm/test/CodeGen/MBlaze/imm.ll
@@ -0,0 +1,70 @@
+; Ensure that all immediate values that are 32-bits or less can be loaded 
+; using a single instruction and that immediate values 64-bits or less can
+; be loaded using two instructions.
+;
+; RUN: llc < %s -march=mblaze | FileCheck %s
+; RUN: llc < %s -march=mblaze -mattr=+fpu | FileCheck -check-prefix=FPU %s
+
+define i8 @retimm_i8() {
+    ; CHECK:        retimm_i8:
+    ; CHECK:        add
+    ; CHECK-NEXT:   rtsd
+    ; FPU:          retimm_i8:
+    ; FPU:          add
+    ; FPU-NEXT:     rtsd
+    ret i8 123
+}
+
+define i16 @retimm_i16() {
+    ; CHECK:        retimm_i16:
+    ; CHECK:        add
+    ; CHECK-NEXT:   rtsd
+    ; FPU:          retimm_i16:
+    ; FPU:          add
+    ; FPU-NEXT:     rtsd
+    ret i16 38212
+}
+
+define i32 @retimm_i32() {
+    ; CHECK:        retimm_i32:
+    ; CHECK:        add
+    ; CHECK-NEXT:   rtsd
+    ; FPU:          retimm_i32:
+    ; FPU:          add
+    ; FPU-NEXT:     rtsd
+    ret i32 2938128
+}
+
+define i64 @retimm_i64() {
+    ; CHECK:        retimm_i64:
+    ; CHECK:        add
+    ; CHECK-NEXT:   add
+    ; CHECK-NEXT:   rtsd
+    ; FPU:          retimm_i64:
+    ; FPU:          add
+    ; FPU-NEXT:     add
+    ; FPU-NEXT:     rtsd
+    ret i64 94581823
+}
+
+define float @retimm_float() {
+    ; CHECK:        retimm_float:
+    ; CHECK:        add
+    ; CHECK-NEXT:   rtsd
+    ; FPU:          retimm_float:
+    ; FPU:          or
+    ; FPU:          rtsd
+    ret float 12.0
+}
+
+define double @retimm_double() {
+    ; CHECK:        retimm_double:
+    ; CHECK:        add
+    ; CHECK-NEXT:   add
+    ; CHECK-NEXT:   rtsd
+    ; FPU:          retimm_double:
+    ; FPU:          add
+    ; FPU-NEXT:     add
+    ; FPU-NEXT:     rtsd
+    ret double 598382.39283873
+}
diff --git a/libclamav/c++/llvm/test/CodeGen/MBlaze/jumptable.ll b/libclamav/c++/llvm/test/CodeGen/MBlaze/jumptable.ll
new file mode 100644
index 0000000..3f27c12
--- /dev/null
+++ b/libclamav/c++/llvm/test/CodeGen/MBlaze/jumptable.ll
@@ -0,0 +1,79 @@
+; Ensure that jump tables can be handled by the mblaze backend. The
+; jump table should be lowered to a "br" instruction using one of the
+; available registers.
+;
+; RUN: llc < %s -march=mblaze | FileCheck %s
+
+define i32 @jmptable(i32 %arg)
+{
+    ; CHECK:        jmptable:
+    switch i32 %arg, label %DEFAULT [ i32 0, label %L0
+                                      i32 1, label %L1
+                                      i32 2, label %L2
+                                      i32 3, label %L3
+                                      i32 4, label %L4
+                                      i32 5, label %L5
+                                      i32 6, label %L6
+                                      i32 7, label %L7
+                                      i32 8, label %L8
+                                      i32 9, label %L9 ]
+
+    ; CHECK:        lw [[REG:r[0-9]*]]
+    ; CHECK:        br [[REG]]
+L0:
+    %var0 = add i32 %arg, 0
+    br label %DONE
+
+L1:
+    %var1 = add i32 %arg, 1
+    br label %DONE
+
+L2:
+    %var2 = add i32 %arg, 2
+    br label %DONE
+
+L3:
+    %var3 = add i32 %arg, 3
+    br label %DONE
+
+L4:
+    %var4 = add i32 %arg, 4
+    br label %DONE
+
+L5:
+    %var5 = add i32 %arg, 5
+    br label %DONE
+
+L6:
+    %var6 = add i32 %arg, 6
+    br label %DONE
+
+L7:
+    %var7 = add i32 %arg, 7
+    br label %DONE
+
+L8:
+    %var8 = add i32 %arg, 8
+    br label %DONE
+
+L9:
+    %var9 = add i32 %arg, 9
+    br label %DONE
+
+DEFAULT:
+    unreachable
+
+DONE:
+    %rval = phi i32 [ %var0, %L0 ],
+                    [ %var1, %L1 ],
+                    [ %var2, %L2 ],
+                    [ %var3, %L3 ],
+                    [ %var4, %L4 ],
+                    [ %var5, %L5 ],
+                    [ %var6, %L6 ],
+                    [ %var7, %L7 ],
+                    [ %var8, %L8 ],
+                    [ %var9, %L9 ]
+    ret i32 %rval
+    ; CHECK:        rtsd
+}
diff --git a/libclamav/c++/llvm/test/CodeGen/MBlaze/loop.ll b/libclamav/c++/llvm/test/CodeGen/MBlaze/loop.ll
new file mode 100644
index 0000000..b473020
--- /dev/null
+++ b/libclamav/c++/llvm/test/CodeGen/MBlaze/loop.ll
@@ -0,0 +1,47 @@
+; Test some complicated looping constructs to ensure that they
+; compile successfully and that some sort of branching is used
+; in the resulting code.
+;
+; RUN: llc < %s -march=mblaze -mattr=+mul,+fpu,+barrel | FileCheck %s
+
+declare i32 @printf(i8*, ...)
+ at MSG = internal constant [19 x i8] c"Message: %d %d %d\0A\00"
+
+define i32 @loop(i32 %a, i32 %b)
+{
+    ; CHECK:        loop:
+entry:
+    br label %loop_outer
+
+loop_outer:
+    %outer.0 = phi i32 [ 0, %entry ], [ %outer.2, %loop_outer_finish ]
+    br label %loop_inner
+
+loop_inner:
+    %inner.0 = phi i32 [ %a, %loop_outer ], [ %inner.3, %loop_inner_finish ]
+    %inner.1 = phi i32 [ %b, %loop_outer ], [ %inner.4, %loop_inner_finish ]
+    %inner.2 = phi i32 [  0, %loop_outer ], [ %inner.5, %loop_inner_finish ]
+    %inner.3 = add i32 %inner.0, %inner.1
+    %inner.4 = mul i32 %inner.2, 11
+    br label %loop_inner_finish
+
+loop_inner_finish:
+    %inner.5 = add i32 %inner.2, 1
+    ; CHECK:        addi {{.*, 1}}
+
+    call i32 (i8*,...)* @printf( i8* getelementptr([19 x i8]* @MSG,i32 0,i32 0),
+                                 i32 %inner.0, i32 %inner.1, i32 %inner.2 )
+    ; CHECK:        brlid
+
+    %inner.6 = icmp eq i32 %inner.5, 100
+    ; CHECK:        cmp
+
+    br i1 %inner.6, label %loop_inner, label %loop_outer_finish
+    ; CHECK:        {{beq|bne}}
+
+loop_outer_finish:
+    %outer.1 = add i32 %outer.0, 1
+    %outer.2 = urem i32 %outer.1, 1500
+    br label %loop_outer
+    ; CHECK:        br
+}
diff --git a/libclamav/c++/llvm/test/CodeGen/MBlaze/mul.ll b/libclamav/c++/llvm/test/CodeGen/MBlaze/mul.ll
new file mode 100644
index 0000000..65d3e22
--- /dev/null
+++ b/libclamav/c++/llvm/test/CodeGen/MBlaze/mul.ll
@@ -0,0 +1,51 @@
+; Ensure that multiplication is lowered to function calls when the multiplier
+; unit is not available in the hardware and that function calls are not used
+; when the multiplier unit is available in the hardware.
+;
+; RUN: llc < %s -march=mblaze | FileCheck -check-prefix=FUN %s
+; RUN: llc < %s -march=mblaze -mattr=+mul | FileCheck -check-prefix=MUL %s
+
+define i8 @test_i8(i8 %a, i8 %b) {
+    ; FUN:        test_i8:
+    ; MUL:        test_i8:
+
+    %tmp.1 = mul i8 %a, %b
+    ; FUN-NOT:    mul
+    ; FUN:        brlid
+    ; MUL-NOT:    brlid
+    ; MUL:        mul
+
+    ret i8 %tmp.1
+    ; FUN:        rtsd
+    ; MUL:        rtsd
+}
+
+define i16 @test_i16(i16 %a, i16 %b) {
+    ; FUN:        test_i16:
+    ; MUL:        test_i16:
+
+    %tmp.1 = mul i16 %a, %b
+    ; FUN-NOT:    mul
+    ; FUN:        brlid
+    ; MUL-NOT:    brlid
+    ; MUL:        mul
+
+    ret i16 %tmp.1
+    ; FUN:        rtsd
+    ; MUL:        rtsd
+}
+
+define i32 @test_i32(i32 %a, i32 %b) {
+    ; FUN:        test_i32:
+    ; MUL:        test_i32:
+
+    %tmp.1 = mul i32 %a, %b
+    ; FUN-NOT:    mul
+    ; FUN:        brlid
+    ; MUL-NOT:    brlid
+    ; MUL:        mul
+
+    ret i32 %tmp.1
+    ; FUN:        rtsd
+    ; MUL:        rtsd
+}
diff --git a/libclamav/c++/llvm/test/CodeGen/MBlaze/mul64.ll b/libclamav/c++/llvm/test/CodeGen/MBlaze/mul64.ll
new file mode 100644
index 0000000..e0ef413
--- /dev/null
+++ b/libclamav/c++/llvm/test/CodeGen/MBlaze/mul64.ll
@@ -0,0 +1,23 @@
+; Ensure that multiplication is lowered to function calls when the 64-bit
+; multiplier unit is not available in the hardware and that function calls
+; are not used when the 64-bit multiplier unit is available in the hardware.
+;
+; RUN: llc < %s -march=mblaze | FileCheck -check-prefix=FUN %s
+; RUN: llc < %s -march=mblaze -mattr=+mul,+mul64 | \
+; RUN:      FileCheck -check-prefix=MUL %s
+
+define i64 @test_i64(i64 %a, i64 %b) {
+    ; FUN:        test_i64:
+    ; MUL:        test_i64:
+
+    %tmp.1 = mul i64 %a, %b
+    ; FUN-NOT:    mul
+    ; FUN:        brlid
+    ; MUL-NOT:    brlid
+    ; MUL:        mulh
+    ; MUL:        mul
+
+    ret i64 %tmp.1
+    ; FUN:        rtsd
+    ; MUL:        rtsd
+}
diff --git a/libclamav/c++/llvm/test/CodeGen/MBlaze/select.ll b/libclamav/c++/llvm/test/CodeGen/MBlaze/select.ll
new file mode 100644
index 0000000..47a88a1
--- /dev/null
+++ b/libclamav/c++/llvm/test/CodeGen/MBlaze/select.ll
@@ -0,0 +1,15 @@
+; Ensure that the select instruction is supported and is lowered to 
+; some sort of branch instruction.
+;
+; RUN: llc < %s -march=mblaze | FileCheck %s
+
+define i32 @testsel(i32 %a, i32 %b)
+{
+    ; CHECK:        testsel:
+    %tmp.1 = icmp eq i32 %a, %b
+    ; CHECK:        cmp
+    %tmp.2 = select i1 %tmp.1, i32 %a, i32 %b
+    ; CHECK:        {{bne|beq}}
+    ret i32 %tmp.2
+    ; CHECK:        rtsd
+}
diff --git a/libclamav/c++/llvm/test/CodeGen/MBlaze/shift.ll b/libclamav/c++/llvm/test/CodeGen/MBlaze/shift.ll
new file mode 100644
index 0000000..186115e
--- /dev/null
+++ b/libclamav/c++/llvm/test/CodeGen/MBlaze/shift.ll
@@ -0,0 +1,117 @@
+; Ensure that shifts are lowered to loops when the barrel shifter unit is
+; not available in the hardware and that loops are not used when the
+; barrel shifter unit is available in the hardware.
+;
+; RUN: llc < %s -march=mblaze | FileCheck -check-prefix=FUN %s
+; RUN: llc < %s -march=mblaze -mattr=+barrel | FileCheck -check-prefix=SHT %s
+
+define i8 @test_i8(i8 %a, i8 %b) {
+    ; FUN:        test_i8:
+    ; SHT:        test_i8:
+
+    %tmp.1 = shl i8 %a, %b
+    ; FUN-NOT:    bsll
+    ; FUN:        andi
+    ; FUN:        add
+    ; FUN:        bnei
+    ; SHT-NOT:    andi
+    ; SHT-NOT:    bnei
+    ; SHT:        bsll
+
+    ret i8 %tmp.1
+    ; FUN:        rtsd
+    ; SHT:        rtsd
+}
+
+define i8 @testc_i8(i8 %a, i8 %b) {
+    ; FUN:        testc_i8:
+    ; SHT:        testc_i8:
+
+    %tmp.1 = shl i8 %a, 5
+    ; FUN-NOT:    bsll
+    ; FUN:        andi
+    ; FUN:        add
+    ; FUN:        bnei
+    ; SHT-NOT:    andi
+    ; SHT-NOT:    add
+    ; SHT-NOT:    bnei
+    ; SHT:        bslli
+
+    ret i8 %tmp.1
+    ; FUN:        rtsd
+    ; SHT:        rtsd
+}
+
+define i16 @test_i16(i16 %a, i16 %b) {
+    ; FUN:        test_i16:
+    ; SHT:        test_i16:
+
+    %tmp.1 = shl i16 %a, %b
+    ; FUN-NOT:    bsll
+    ; FUN:        andi
+    ; FUN:        add
+    ; FUN:        bnei
+    ; SHT-NOT:    andi
+    ; SHT-NOT:    bnei
+    ; SHT:        bsll
+
+    ret i16 %tmp.1
+    ; FUN:        rtsd
+    ; SHT:        rtsd
+}
+
+define i16 @testc_i16(i16 %a, i16 %b) {
+    ; FUN:        testc_i16:
+    ; SHT:        testc_i16:
+
+    %tmp.1 = shl i16 %a, 5
+    ; FUN-NOT:    bsll
+    ; FUN:        andi
+    ; FUN:        add
+    ; FUN:        bnei
+    ; SHT-NOT:    andi
+    ; SHT-NOT:    add
+    ; SHT-NOT:    bnei
+    ; SHT:        bslli
+
+    ret i16 %tmp.1
+    ; FUN:        rtsd
+    ; SHT:        rtsd
+}
+
+define i32 @test_i32(i32 %a, i32 %b) {
+    ; FUN:        test_i32:
+    ; SHT:        test_i32:
+
+    %tmp.1 = shl i32 %a, %b
+    ; FUN-NOT:    bsll
+    ; FUN:        andi
+    ; FUN:        add
+    ; FUN:        bnei
+    ; SHT-NOT:    andi
+    ; SHT-NOT:    bnei
+    ; SHT:        bsll
+
+    ret i32 %tmp.1
+    ; FUN:        rtsd
+    ; SHT:        rtsd
+}
+
+define i32 @testc_i32(i32 %a, i32 %b) {
+    ; FUN:        testc_i32:
+    ; SHT:        testc_i32:
+
+    %tmp.1 = shl i32 %a, 5
+    ; FUN-NOT:    bsll
+    ; FUN:        andi
+    ; FUN:        add
+    ; FUN:        bnei
+    ; SHT-NOT:    andi
+    ; SHT-NOT:    add
+    ; SHT-NOT:    bnei
+    ; SHT:        bslli
+
+    ret i32 %tmp.1
+    ; FUN:        rtsd
+    ; SHT:        rtsd
+}
diff --git a/libclamav/c++/llvm/test/CodeGen/PowerPC/2007-04-30-InlineAsmEarlyClobber.ll b/libclamav/c++/llvm/test/CodeGen/PowerPC/2007-04-30-InlineAsmEarlyClobber.ll
index d1d28ae..be28a9a 100644
--- a/libclamav/c++/llvm/test/CodeGen/PowerPC/2007-04-30-InlineAsmEarlyClobber.ll
+++ b/libclamav/c++/llvm/test/CodeGen/PowerPC/2007-04-30-InlineAsmEarlyClobber.ll
@@ -1,6 +1,6 @@
 ; RUN: llc < %s | grep {subfc r3,r5,r4}
-; RUN: llc < %s | grep {subfze r4,r2}
-; RUN: llc < %s -regalloc=local | grep {subfc r2,r5,r4}
+; RUN: llc < %s | grep {subfze r4,r6}
+; RUN: llc < %s -regalloc=local | grep {subfc r6,r5,r4}
 ; RUN: llc < %s -regalloc=local | grep {subfze r3,r3}
 ; The first argument of subfc must not be the same as any other register.
 
diff --git a/libclamav/c++/llvm/test/CodeGen/PowerPC/2009-08-17-inline-asm-addr-mode-breakage.ll b/libclamav/c++/llvm/test/CodeGen/PowerPC/2009-08-17-inline-asm-addr-mode-breakage.ll
index 5d09696..50a0278 100644
--- a/libclamav/c++/llvm/test/CodeGen/PowerPC/2009-08-17-inline-asm-addr-mode-breakage.ll
+++ b/libclamav/c++/llvm/test/CodeGen/PowerPC/2009-08-17-inline-asm-addr-mode-breakage.ll
@@ -1,4 +1,4 @@
-; RUN: llc < %s -march=ppc32 | FileCheck %s
+; RUN: llc < %s -march=ppc32 -mtriple=powerpc-apple-darwin10 -mcpu=g5 | FileCheck %s
 ; ModuleID = '<stdin>'
 target datalayout = "E-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f128:64:128"
 target triple = "powerpc-apple-darwin10.0"
@@ -10,8 +10,8 @@ target triple = "powerpc-apple-darwin10.0"
 define void @foo(i32 %y) nounwind ssp {
 entry:
 ; CHECK: foo
-; CHECK: add r2
-; CHECK: 0(r2)
+; CHECK: add r4
+; CHECK: 0(r4)
   %y_addr = alloca i32                            ; <i32*> [#uses=2]
   %"alloca point" = bitcast i32 0 to i32          ; <i32> [#uses=0]
   store i32 %y, i32* %y_addr
diff --git a/libclamav/c++/llvm/test/CodeGen/PowerPC/2010-02-26-FoldFloats.ll b/libclamav/c++/llvm/test/CodeGen/PowerPC/2010-02-26-FoldFloats.ll
new file mode 100644
index 0000000..f43f5ca
--- /dev/null
+++ b/libclamav/c++/llvm/test/CodeGen/PowerPC/2010-02-26-FoldFloats.ll
@@ -0,0 +1,433 @@
+; RUN: llc < %s -O3 | FileCheck %s
+target datalayout = "E-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f128:64:128-n32"
+target triple = "powerpc-apple-darwin9.6"
+
+; There should be no stfs spills
+; CHECK: main:
+; CHECK-NOT: stfs
+; CHECK: .section
+
+ at .str66 = external constant [3 x i8], align 4     ; <[3 x i8]*> [#uses=1]
+ at .str31 = external constant [6 x i8], align 4     ; <[6 x i8]*> [#uses=1]
+ at .str61 = external constant [21 x i8], align 4    ; <[21 x i8]*> [#uses=1]
+ at .str101 = external constant [61 x i8], align 4   ; <[61 x i8]*> [#uses=1]
+ at .str104 = external constant [31 x i8], align 4   ; <[31 x i8]*> [#uses=1]
+ at .str105 = external constant [45 x i8], align 4   ; <[45 x i8]*> [#uses=1]
+ at .str112 = external constant [38 x i8], align 4   ; <[38 x i8]*> [#uses=1]
+ at .str121 = external constant [36 x i8], align 4   ; <[36 x i8]*> [#uses=1]
+ at .str12293 = external constant [67 x i8], align 4 ; <[67 x i8]*> [#uses=1]
+ at .str123 = external constant [68 x i8], align 4   ; <[68 x i8]*> [#uses=1]
+ at .str124 = external constant [52 x i8], align 4   ; <[52 x i8]*> [#uses=1]
+ at .str125 = external constant [51 x i8], align 4   ; <[51 x i8]*> [#uses=1]
+
+define i32 @main(i32 %argc, i8** %argv) noreturn nounwind {
+entry:
+  br i1 undef, label %bb4.i1, label %my_fopen.exit
+
+bb4.i1:                                           ; preds = %entry
+  unreachable
+
+my_fopen.exit:                                    ; preds = %entry
+  br i1 undef, label %bb.i, label %bb1.i
+
+bb.i:                                             ; preds = %my_fopen.exit
+  unreachable
+
+bb1.i:                                            ; preds = %my_fopen.exit
+  br label %bb134.i
+
+bb2.i:                                            ; preds = %bb134.i
+  %0 = icmp eq i32 undef, 0                       ; <i1> [#uses=1]
+  br i1 %0, label %bb20.i, label %bb21.i
+
+bb20.i:                                           ; preds = %bb2.i
+  br label %bb134.i
+
+bb21.i:                                           ; preds = %bb2.i
+  %1 = call i32 @strcmp(i8* undef, i8* getelementptr inbounds ([6 x i8]* @.str31, i32 0, i32 0)) nounwind readonly ; <i32> [#uses=0]
+  br i1 undef, label %bb30.i, label %bb31.i
+
+bb30.i:                                           ; preds = %bb21.i
+  br label %bb134.i
+
+bb31.i:                                           ; preds = %bb21.i
+  br i1 undef, label %bb41.i, label %bb44.i
+
+bb41.i:                                           ; preds = %bb31.i
+  %2 = icmp slt i32 undef, %argc                  ; <i1> [#uses=1]
+  br i1 %2, label %bb1.i77.i, label %bb2.i78.i
+
+bb1.i77.i:                                        ; preds = %bb41.i
+  %3 = load float* undef, align 4                 ; <float> [#uses=2]
+  %4 = fcmp ugt float %3, 0.000000e+00            ; <i1> [#uses=1]
+  br i1 %4, label %bb43.i, label %bb42.i
+
+bb2.i78.i:                                        ; preds = %bb41.i
+  unreachable
+
+bb42.i:                                           ; preds = %bb1.i77.i
+  unreachable
+
+bb43.i:                                           ; preds = %bb1.i77.i
+  br label %bb134.i
+
+bb44.i:                                           ; preds = %bb31.i
+  br i1 undef, label %bb45.i, label %bb49.i
+
+bb45.i:                                           ; preds = %bb44.i
+  %5 = icmp slt i32 undef, %argc                  ; <i1> [#uses=1]
+  br i1 %5, label %bb1.i72.i, label %bb2.i73.i
+
+bb1.i72.i:                                        ; preds = %bb45.i
+  %6 = load float* undef, align 4                 ; <float> [#uses=3]
+  %7 = fcmp ult float %6, 1.000000e+00            ; <i1> [#uses=1]
+  %or.cond.i = and i1 undef, %7                   ; <i1> [#uses=1]
+  br i1 %or.cond.i, label %bb48.i, label %bb47.i
+
+bb2.i73.i:                                        ; preds = %bb45.i
+  unreachable
+
+bb47.i:                                           ; preds = %bb1.i72.i
+  unreachable
+
+bb48.i:                                           ; preds = %bb1.i72.i
+  br label %bb134.i
+
+bb49.i:                                           ; preds = %bb44.i
+  br i1 undef, label %bb50.i, label %bb53.i
+
+bb50.i:                                           ; preds = %bb49.i
+  br i1 false, label %bb1.i67.i, label %bb2.i68.i
+
+bb1.i67.i:                                        ; preds = %bb50.i
+  br i1 false, label %read_float_option.exit69.i, label %bb1.i67.bb2.i68_crit_edge.i
+
+bb1.i67.bb2.i68_crit_edge.i:                      ; preds = %bb1.i67.i
+  br label %bb2.i68.i
+
+bb2.i68.i:                                        ; preds = %bb1.i67.bb2.i68_crit_edge.i, %bb50.i
+  unreachable
+
+read_float_option.exit69.i:                       ; preds = %bb1.i67.i
+  br i1 undef, label %bb52.i, label %bb51.i
+
+bb51.i:                                           ; preds = %read_float_option.exit69.i
+  unreachable
+
+bb52.i:                                           ; preds = %read_float_option.exit69.i
+  br label %bb134.i
+
+bb53.i:                                           ; preds = %bb49.i
+  %8 = call i32 @strcmp(i8* undef, i8* getelementptr inbounds ([21 x i8]* @.str61, i32 0, i32 0)) nounwind readonly ; <i32> [#uses=0]
+  br i1 false, label %bb89.i, label %bb92.i
+
+bb89.i:                                           ; preds = %bb53.i
+  br i1 undef, label %bb1.i27.i, label %bb2.i28.i
+
+bb1.i27.i:                                        ; preds = %bb89.i
+  unreachable
+
+bb2.i28.i:                                        ; preds = %bb89.i
+  unreachable
+
+bb92.i:                                           ; preds = %bb53.i
+  br i1 undef, label %bb93.i, label %bb96.i
+
+bb93.i:                                           ; preds = %bb92.i
+  br i1 undef, label %bb1.i22.i, label %bb2.i23.i
+
+bb1.i22.i:                                        ; preds = %bb93.i
+  br i1 undef, label %bb95.i, label %bb94.i
+
+bb2.i23.i:                                        ; preds = %bb93.i
+  unreachable
+
+bb94.i:                                           ; preds = %bb1.i22.i
+  unreachable
+
+bb95.i:                                           ; preds = %bb1.i22.i
+  br label %bb134.i
+
+bb96.i:                                           ; preds = %bb92.i
+  br i1 undef, label %bb97.i, label %bb100.i
+
+bb97.i:                                           ; preds = %bb96.i
+  %9 = icmp slt i32 undef, %argc                  ; <i1> [#uses=1]
+  br i1 %9, label %bb1.i17.i, label %bb2.i18.i
+
+bb1.i17.i:                                        ; preds = %bb97.i
+  %10 = call i32 (i8*, i8*, ...)* @"\01_sscanf$LDBL128"(i8* undef, i8* getelementptr inbounds ([3 x i8]* @.str66, i32 0, i32 0), float* undef) nounwind ; <i32> [#uses=1]
+  %phitmp.i16.i = icmp eq i32 %10, 1              ; <i1> [#uses=1]
+  br i1 %phitmp.i16.i, label %read_float_option.exit19.i, label %bb1.i17.bb2.i18_crit_edge.i
+
+bb1.i17.bb2.i18_crit_edge.i:                      ; preds = %bb1.i17.i
+  br label %bb2.i18.i
+
+bb2.i18.i:                                        ; preds = %bb1.i17.bb2.i18_crit_edge.i, %bb97.i
+  unreachable
+
+read_float_option.exit19.i:                       ; preds = %bb1.i17.i
+  br i1 false, label %bb99.i, label %bb98.i
+
+bb98.i:                                           ; preds = %read_float_option.exit19.i
+  unreachable
+
+bb99.i:                                           ; preds = %read_float_option.exit19.i
+  br label %bb134.i
+
+bb100.i:                                          ; preds = %bb96.i
+  br i1 false, label %bb101.i, label %bb104.i
+
+bb101.i:                                          ; preds = %bb100.i
+  br i1 false, label %bb1.i12.i, label %bb2.i13.i
+
+bb1.i12.i:                                        ; preds = %bb101.i
+  br i1 undef, label %bb102.i, label %bb103.i
+
+bb2.i13.i:                                        ; preds = %bb101.i
+  unreachable
+
+bb102.i:                                          ; preds = %bb1.i12.i
+  unreachable
+
+bb103.i:                                          ; preds = %bb1.i12.i
+  br label %bb134.i
+
+bb104.i:                                          ; preds = %bb100.i
+  unreachable
+
+bb134.i:                                          ; preds = %bb103.i, %bb99.i, %bb95.i, %bb52.i, %bb48.i, %bb43.i, %bb30.i, %bb20.i, %bb1.i
+  %annealing_sched.1.0 = phi float [ 1.000000e+01, %bb1.i ], [ %annealing_sched.1.0, %bb20.i ], [ 1.000000e+00, %bb30.i ], [ %annealing_sched.1.0, %bb43.i ], [ %annealing_sched.1.0, %bb48.i ], [ %annealing_sched.1.0, %bb52.i ], [ %annealing_sched.1.0, %bb95.i ], [ %annealing_sched.1.0, %bb99.i ], [ %annealing_sched.1.0, %bb103.i ] ; <float> [#uses=8]
+  %annealing_sched.2.0 = phi float [ 1.000000e+02, %bb1.i ], [ %annealing_sched.2.0, %bb20.i ], [ %annealing_sched.2.0, %bb30.i ], [ %3, %bb43.i ], [ %annealing_sched.2.0, %bb48.i ], [ %annealing_sched.2.0, %bb52.i ], [ %annealing_sched.2.0, %bb95.i ], [ %annealing_sched.2.0, %bb99.i ], [ %annealing_sched.2.0, %bb103.i ] ; <float> [#uses=8]
+  %annealing_sched.3.0 = phi float [ 0x3FE99999A0000000, %bb1.i ], [ %annealing_sched.3.0, %bb20.i ], [ %annealing_sched.3.0, %bb30.i ], [ %annealing_sched.3.0, %bb43.i ], [ %6, %bb48.i ], [ %annealing_sched.3.0, %bb52.i ], [ %annealing_sched.3.0, %bb95.i ], [ %annealing_sched.3.0, %bb99.i ], [ %annealing_sched.3.0, %bb103.i ] ; <float> [#uses=8]
+  %annealing_sched.4.0 = phi float [ 0x3F847AE140000000, %bb1.i ], [ %annealing_sched.4.0, %bb20.i ], [ %annealing_sched.4.0, %bb30.i ], [ %annealing_sched.4.0, %bb43.i ], [ %annealing_sched.4.0, %bb48.i ], [ 0.000000e+00, %bb52.i ], [ %annealing_sched.4.0, %bb95.i ], [ %annealing_sched.4.0, %bb99.i ], [ %annealing_sched.4.0, %bb103.i ] ; <float> [#uses=8]
+  %router_opts.0.0 = phi float [ 0.000000e+00, %bb1.i ], [ %router_opts.0.0, %bb20.i ], [ 1.000000e+04, %bb30.i ], [ %router_opts.0.0, %bb43.i ], [ %router_opts.0.0, %bb48.i ], [ %router_opts.0.0, %bb52.i ], [ %router_opts.0.0, %bb95.i ], [ %router_opts.0.0, %bb99.i ], [ %router_opts.0.0, %bb103.i ] ; <float> [#uses=8]
+  %router_opts.1.0 = phi float [ 5.000000e-01, %bb1.i ], [ %router_opts.1.0, %bb20.i ], [ 1.000000e+04, %bb30.i ], [ %router_opts.1.0, %bb43.i ], [ %router_opts.1.0, %bb48.i ], [ %router_opts.1.0, %bb52.i ], [ undef, %bb95.i ], [ %router_opts.1.0, %bb99.i ], [ %router_opts.1.0, %bb103.i ] ; <float> [#uses=7]
+  %router_opts.2.0 = phi float [ 1.500000e+00, %bb1.i ], [ %router_opts.2.0, %bb20.i ], [ %router_opts.2.0, %bb30.i ], [ %router_opts.2.0, %bb43.i ], [ %router_opts.2.0, %bb48.i ], [ %router_opts.2.0, %bb52.i ], [ %router_opts.2.0, %bb95.i ], [ undef, %bb99.i ], [ %router_opts.2.0, %bb103.i ] ; <float> [#uses=8]
+  %router_opts.3.0 = phi float [ 0x3FC99999A0000000, %bb1.i ], [ %router_opts.3.0, %bb20.i ], [ %router_opts.3.0, %bb30.i ], [ %router_opts.3.0, %bb43.i ], [ %router_opts.3.0, %bb48.i ], [ %router_opts.3.0, %bb52.i ], [ %router_opts.3.0, %bb95.i ], [ %router_opts.3.0, %bb99.i ], [ 0.000000e+00, %bb103.i ] ; <float> [#uses=8]
+  %11 = phi float [ 0x3FC99999A0000000, %bb1.i ], [ %11, %bb20.i ], [ %11, %bb30.i ], [ %11, %bb43.i ], [ %11, %bb48.i ], [ %11, %bb52.i ], [ %11, %bb95.i ], [ %11, %bb99.i ], [ 0.000000e+00, %bb103.i ] ; <float> [#uses=8]
+  %12 = phi float [ 1.500000e+00, %bb1.i ], [ %12, %bb20.i ], [ %12, %bb30.i ], [ %12, %bb43.i ], [ %12, %bb48.i ], [ %12, %bb52.i ], [ %12, %bb95.i ], [ undef, %bb99.i ], [ %12, %bb103.i ] ; <float> [#uses=8]
+  %13 = phi float [ 5.000000e-01, %bb1.i ], [ %13, %bb20.i ], [ 1.000000e+04, %bb30.i ], [ %13, %bb43.i ], [ %13, %bb48.i ], [ %13, %bb52.i ], [ undef, %bb95.i ], [ %13, %bb99.i ], [ %13, %bb103.i ] ; <float> [#uses=7]
+  %14 = phi float [ 0.000000e+00, %bb1.i ], [ %14, %bb20.i ], [ 1.000000e+04, %bb30.i ], [ %14, %bb43.i ], [ %14, %bb48.i ], [ %14, %bb52.i ], [ %14, %bb95.i ], [ %14, %bb99.i ], [ %14, %bb103.i ] ; <float> [#uses=8]
+  %15 = phi float [ 0x3FE99999A0000000, %bb1.i ], [ %15, %bb20.i ], [ %15, %bb30.i ], [ %15, %bb43.i ], [ %6, %bb48.i ], [ %15, %bb52.i ], [ %15, %bb95.i ], [ %15, %bb99.i ], [ %15, %bb103.i ] ; <float> [#uses=8]
+  %16 = phi float [ 0x3F847AE140000000, %bb1.i ], [ %16, %bb20.i ], [ %16, %bb30.i ], [ %16, %bb43.i ], [ %16, %bb48.i ], [ 0.000000e+00, %bb52.i ], [ %16, %bb95.i ], [ %16, %bb99.i ], [ %16, %bb103.i ] ; <float> [#uses=8]
+  %17 = phi float [ 1.000000e+01, %bb1.i ], [ %17, %bb20.i ], [ 1.000000e+00, %bb30.i ], [ %17, %bb43.i ], [ %17, %bb48.i ], [ %17, %bb52.i ], [ %17, %bb95.i ], [ %17, %bb99.i ], [ %17, %bb103.i ] ; <float> [#uses=8]
+  %18 = icmp slt i32 undef, %argc                 ; <i1> [#uses=1]
+  br i1 %18, label %bb2.i, label %bb135.i
+
+bb135.i:                                          ; preds = %bb134.i
+  br i1 undef, label %bb141.i, label %bb142.i
+
+bb141.i:                                          ; preds = %bb135.i
+  unreachable
+
+bb142.i:                                          ; preds = %bb135.i
+  br i1 undef, label %bb145.i, label %bb144.i
+
+bb144.i:                                          ; preds = %bb142.i
+  unreachable
+
+bb145.i:                                          ; preds = %bb142.i
+  br i1 undef, label %bb146.i, label %bb147.i
+
+bb146.i:                                          ; preds = %bb145.i
+  unreachable
+
+bb147.i:                                          ; preds = %bb145.i
+  br i1 undef, label %bb148.i, label %bb155.i
+
+bb148.i:                                          ; preds = %bb147.i
+  br label %bb155.i
+
+bb155.i:                                          ; preds = %bb148.i, %bb147.i
+  br i1 undef, label %bb156.i, label %bb161.i
+
+bb156.i:                                          ; preds = %bb155.i
+  unreachable
+
+bb161.i:                                          ; preds = %bb155.i
+  br i1 undef, label %bb162.i, label %bb163.i
+
+bb162.i:                                          ; preds = %bb161.i
+  %19 = fpext float %17 to double                 ; <double> [#uses=1]
+  %20 = call i32 (i8*, ...)* @"\01_printf$LDBL128"(i8* getelementptr inbounds ([61 x i8]* @.str101, i32 0, i32 0), double %19) nounwind ; <i32> [#uses=0]
+  unreachable
+
+bb163.i:                                          ; preds = %bb161.i
+  %21 = fpext float %16 to double                 ; <double> [#uses=1]
+  %22 = call i32 (i8*, ...)* @"\01_printf$LDBL128"(i8* getelementptr inbounds ([31 x i8]* @.str104, i32 0, i32 0), double %21) nounwind ; <i32> [#uses=0]
+  %23 = fpext float %15 to double                 ; <double> [#uses=1]
+  %24 = call i32 (i8*, ...)* @"\01_printf$LDBL128"(i8* getelementptr inbounds ([45 x i8]* @.str105, i32 0, i32 0), double %23) nounwind ; <i32> [#uses=0]
+  %25 = call i32 (i8*, ...)* @"\01_printf$LDBL128"(i8* getelementptr inbounds ([38 x i8]* @.str112, i32 0, i32 0), double undef) nounwind ; <i32> [#uses=0]
+  br i1 undef, label %parse_command.exit, label %bb176.i
+
+bb176.i:                                          ; preds = %bb163.i
+  br i1 undef, label %bb177.i, label %bb178.i
+
+bb177.i:                                          ; preds = %bb176.i
+  unreachable
+
+bb178.i:                                          ; preds = %bb176.i
+  %26 = call i32 (i8*, ...)* @"\01_printf$LDBL128"(i8* getelementptr inbounds ([36 x i8]* @.str121, i32 0, i32 0), double undef) nounwind ; <i32> [#uses=0]
+  %27 = fpext float %14 to double                 ; <double> [#uses=1]
+  %28 = call i32 (i8*, ...)* @"\01_printf$LDBL128"(i8* getelementptr inbounds ([67 x i8]* @.str12293, i32 0, i32 0), double %27) nounwind ; <i32> [#uses=0]
+  %29 = fpext float %13 to double                 ; <double> [#uses=1]
+  %30 = call i32 (i8*, ...)* @"\01_printf$LDBL128"(i8* getelementptr inbounds ([68 x i8]* @.str123, i32 0, i32 0), double %29) nounwind ; <i32> [#uses=0]
+  %31 = fpext float %12 to double                 ; <double> [#uses=1]
+  %32 = call i32 (i8*, ...)* @"\01_printf$LDBL128"(i8* getelementptr inbounds ([52 x i8]* @.str124, i32 0, i32 0), double %31) nounwind ; <i32> [#uses=0]
+  %33 = fpext float %11 to double                 ; <double> [#uses=1]
+  %34 = call i32 (i8*, ...)* @"\01_printf$LDBL128"(i8* getelementptr inbounds ([51 x i8]* @.str125, i32 0, i32 0), double %33) nounwind ; <i32> [#uses=0]
+  unreachable
+
+parse_command.exit:                               ; preds = %bb163.i
+  br i1 undef, label %bb4.i152.i, label %my_fopen.exit.i
+
+bb4.i152.i:                                       ; preds = %parse_command.exit
+  unreachable
+
+my_fopen.exit.i:                                  ; preds = %parse_command.exit
+  br i1 undef, label %bb.i6.i99, label %bb49.preheader.i.i
+
+bb.i6.i99:                                        ; preds = %my_fopen.exit.i
+  br i1 undef, label %bb3.i.i100, label %bb1.i8.i
+
+bb1.i8.i:                                         ; preds = %bb.i6.i99
+  unreachable
+
+bb3.i.i100:                                       ; preds = %bb.i6.i99
+  unreachable
+
+bb49.preheader.i.i:                               ; preds = %my_fopen.exit.i
+  br i1 undef, label %bb7.i11.i, label %bb50.i.i
+
+bb7.i11.i:                                        ; preds = %bb49.preheader.i.i
+  unreachable
+
+bb50.i.i:                                         ; preds = %bb49.preheader.i.i
+  br i1 undef, label %bb.i.i.i20.i, label %my_calloc.exit.i.i.i
+
+bb.i.i.i20.i:                                     ; preds = %bb50.i.i
+  unreachable
+
+my_calloc.exit.i.i.i:                             ; preds = %bb50.i.i
+  br i1 undef, label %bb.i.i37.i.i, label %alloc_hash_table.exit.i21.i
+
+bb.i.i37.i.i:                                     ; preds = %my_calloc.exit.i.i.i
+  unreachable
+
+alloc_hash_table.exit.i21.i:                      ; preds = %my_calloc.exit.i.i.i
+  br i1 undef, label %bb51.i.i, label %bb3.i23.i.i
+
+bb51.i.i:                                         ; preds = %alloc_hash_table.exit.i21.i
+  unreachable
+
+bb3.i23.i.i:                                      ; preds = %alloc_hash_table.exit.i21.i
+  br i1 undef, label %bb.i8.i.i, label %bb.nph.i.i
+
+bb.nph.i.i:                                       ; preds = %bb3.i23.i.i
+  unreachable
+
+bb.i8.i.i:                                        ; preds = %bb3.i.i34.i, %bb3.i23.i.i
+  br i1 undef, label %bb3.i.i34.i, label %bb1.i.i32.i
+
+bb1.i.i32.i:                                      ; preds = %bb.i8.i.i
+  unreachable
+
+bb3.i.i34.i:                                      ; preds = %bb.i8.i.i
+  br i1 undef, label %free_hash_table.exit.i.i, label %bb.i8.i.i
+
+free_hash_table.exit.i.i:                         ; preds = %bb3.i.i34.i
+  br i1 undef, label %check_netlist.exit.i, label %bb59.i.i
+
+bb59.i.i:                                         ; preds = %free_hash_table.exit.i.i
+  unreachable
+
+check_netlist.exit.i:                             ; preds = %free_hash_table.exit.i.i
+  br label %bb.i.i3.i
+
+bb.i.i3.i:                                        ; preds = %bb3.i.i4.i, %check_netlist.exit.i
+  br i1 false, label %bb3.i.i4.i, label %bb1.i.i.i122
+
+bb1.i.i.i122:                                     ; preds = %bb1.i.i.i122, %bb.i.i3.i
+  br i1 false, label %bb3.i.i4.i, label %bb1.i.i.i122
+
+bb3.i.i4.i:                                       ; preds = %bb1.i.i.i122, %bb.i.i3.i
+  br i1 undef, label %read_net.exit, label %bb.i.i3.i
+
+read_net.exit:                                    ; preds = %bb3.i.i4.i
+  br i1 undef, label %bb.i44, label %bb3.i47
+
+bb.i44:                                           ; preds = %read_net.exit
+  unreachable
+
+bb3.i47:                                          ; preds = %read_net.exit
+  br i1 false, label %bb9.i50, label %bb8.i49
+
+bb8.i49:                                          ; preds = %bb3.i47
+  unreachable
+
+bb9.i50:                                          ; preds = %bb3.i47
+  br i1 undef, label %bb11.i51, label %bb12.i52
+
+bb11.i51:                                         ; preds = %bb9.i50
+  unreachable
+
+bb12.i52:                                         ; preds = %bb9.i50
+  br i1 undef, label %bb.i.i53, label %my_malloc.exit.i54
+
+bb.i.i53:                                         ; preds = %bb12.i52
+  unreachable
+
+my_malloc.exit.i54:                               ; preds = %bb12.i52
+  br i1 undef, label %bb.i2.i55, label %my_malloc.exit3.i56
+
+bb.i2.i55:                                        ; preds = %my_malloc.exit.i54
+  unreachable
+
+my_malloc.exit3.i56:                              ; preds = %my_malloc.exit.i54
+  br i1 undef, label %bb.i.i.i57, label %my_malloc.exit.i.i
+
+bb.i.i.i57:                                       ; preds = %my_malloc.exit3.i56
+  unreachable
+
+my_malloc.exit.i.i:                               ; preds = %my_malloc.exit3.i56
+  br i1 undef, label %bb, label %bb10
+
+bb:                                               ; preds = %my_malloc.exit.i.i
+  unreachable
+
+bb10:                                             ; preds = %my_malloc.exit.i.i
+  br i1 false, label %bb12, label %bb11
+
+bb11:                                             ; preds = %bb10
+  unreachable
+
+bb12:                                             ; preds = %bb10
+  store float %annealing_sched.1.0, float* null, align 4
+  store float %annealing_sched.2.0, float* undef, align 8
+  store float %annealing_sched.3.0, float* undef, align 4
+  store float %annealing_sched.4.0, float* undef, align 8
+  store float %router_opts.0.0, float* undef, align 8
+  store float %router_opts.1.0, float* undef, align 4
+  store float %router_opts.2.0, float* null, align 8
+  store float %router_opts.3.0, float* undef, align 4
+  br i1 undef, label %place_and_route.exit, label %bb7.i22
+
+bb7.i22:                                          ; preds = %bb12
+  br i1 false, label %bb8.i23, label %bb9.i26
+
+bb8.i23:                                          ; preds = %bb7.i22
+  unreachable
+
+bb9.i26:                                          ; preds = %bb7.i22
+  unreachable
+
+place_and_route.exit:                             ; preds = %bb12
+  unreachable
+}
+
+declare i32 @"\01_printf$LDBL128"(i8*, ...) nounwind
+
+declare i32 @strcmp(i8* nocapture, i8* nocapture) nounwind readonly
+
+declare i32 @"\01_sscanf$LDBL128"(i8*, i8*, ...) nounwind
diff --git a/libclamav/c++/llvm/test/CodeGen/PowerPC/Frames-alloca.ll b/libclamav/c++/llvm/test/CodeGen/PowerPC/Frames-alloca.ll
index aed4fdb..466ae80 100644
--- a/libclamav/c++/llvm/test/CodeGen/PowerPC/Frames-alloca.ll
+++ b/libclamav/c++/llvm/test/CodeGen/PowerPC/Frames-alloca.ll
@@ -24,7 +24,7 @@
 ; CHECK-PPC64-NOFP: ld r1, 0(r1)
 ; CHECK-PPC64-NOFP: ld r31, -8(r1)
 
-define i32* @f1(i32 %n) {
+define i32* @f1(i32 %n) nounwind {
 	%tmp = alloca i32, i32 %n		; <i32*> [#uses=1]
 	ret i32* %tmp
 }
diff --git a/libclamav/c++/llvm/test/CodeGen/PowerPC/LargeAbsoluteAddr.ll b/libclamav/c++/llvm/test/CodeGen/PowerPC/LargeAbsoluteAddr.ll
index 0f7acac..b10a996 100644
--- a/libclamav/c++/llvm/test/CodeGen/PowerPC/LargeAbsoluteAddr.ll
+++ b/libclamav/c++/llvm/test/CodeGen/PowerPC/LargeAbsoluteAddr.ll
@@ -3,14 +3,14 @@
 ; RUN: llc < %s -march=ppc64 -mtriple=powerpc-apple-darwin | \
 ; RUN:   grep {stw r3, 32751}
 ; RUN: llc < %s -march=ppc64 -mtriple=powerpc-apple-darwin | \
-; RUN:   grep {std r2, 9024}
+; RUN:   grep {std r3, 9024}
 
-define void @test() {
+define void @test() nounwind {
 	store i32 0, i32* inttoptr (i64 48725999 to i32*)
 	ret void
 }
 
-define void @test2() {
+define void @test2() nounwind {
 	store i64 0, i64* inttoptr (i64 74560 to i64*)
 	ret void
 }
diff --git a/libclamav/c++/llvm/test/CodeGen/PowerPC/addc.ll b/libclamav/c++/llvm/test/CodeGen/PowerPC/addc.ll
index 09a7fbd..8c928ce 100644
--- a/libclamav/c++/llvm/test/CodeGen/PowerPC/addc.ll
+++ b/libclamav/c++/llvm/test/CodeGen/PowerPC/addc.ll
@@ -1,26 +1,33 @@
 ; All of these should be codegen'd without loading immediates
-; RUN: llc < %s -march=ppc32 -o %t
-; RUN: grep addc %t | count 1
-; RUN: grep adde %t | count 1
-; RUN: grep addze %t | count 1
-; RUN: grep addme %t | count 1
-; RUN: grep addic %t | count 2
+; RUN: llc < %s -mtriple=powerpc-apple-darwin | FileCheck %s
 
-define i64 @add_ll(i64 %a, i64 %b) {
+define i64 @add_ll(i64 %a, i64 %b) nounwind {
 entry:
         %tmp.2 = add i64 %b, %a         ; <i64> [#uses=1]
         ret i64 %tmp.2
+; CHECK: add_ll:
+; CHECK: addc r4, r6, r4
+; CHECK: adde r3, r5, r3
+; CHECK: blr
 }
 
-define i64 @add_l_5(i64 %a) {
+define i64 @add_l_5(i64 %a) nounwind {
 entry:
         %tmp.1 = add i64 %a, 5          ; <i64> [#uses=1]
         ret i64 %tmp.1
+; CHECK: add_l_5:
+; CHECK: addic r4, r4, 5
+; CHECK: addze r3, r3
+; CHECK: blr
 }
 
-define i64 @add_l_m5(i64 %a) {
+define i64 @add_l_m5(i64 %a) nounwind {
 entry:
         %tmp.1 = add i64 %a, -5         ; <i64> [#uses=1]
         ret i64 %tmp.1
+; CHECK: add_l_m5:
+; CHECK: addic r4, r4, -5
+; CHECK: addme r3, r3
+; CHECK: blr
 }
 
diff --git a/libclamav/c++/llvm/test/CodeGen/PowerPC/indirectbr.ll b/libclamav/c++/llvm/test/CodeGen/PowerPC/indirectbr.ll
index fbc7bd2..2094e10 100644
--- a/libclamav/c++/llvm/test/CodeGen/PowerPC/indirectbr.ll
+++ b/libclamav/c++/llvm/test/CodeGen/PowerPC/indirectbr.ll
@@ -43,13 +43,13 @@ L2:                                               ; preds = %L3, %bb2
 
 L1:                                               ; preds = %L2, %bb2
   %res.3 = phi i32 [ %phitmp, %L2 ], [ 2, %bb2 ]  ; <i32> [#uses=1]
-; PIC: addis r4, r2, ha16(L_BA4__foo_L5-"L1$pb")
-; PIC: li r5, lo16(L_BA4__foo_L5-"L1$pb")
-; PIC: add r4, r4, r5
-; PIC: stw r4
-; STATIC: li r2, lo16(L_BA4__foo_L5)
-; STATIC: addis r2, r2, ha16(L_BA4__foo_L5)
-; STATIC: stw r2
+; PIC: addis r5, r4, ha16(L_BA4__foo_L5-"L1$pb")
+; PIC: li r6, lo16(L_BA4__foo_L5-"L1$pb")
+; PIC: add r5, r5, r6
+; PIC: stw r5
+; STATIC: li r4, lo16(L_BA4__foo_L5)
+; STATIC: addis r4, r4, ha16(L_BA4__foo_L5)
+; STATIC: stw r4
   store i8* blockaddress(@foo, %L5), i8** @nextaddr, align 4
   ret i32 %res.3
 }
diff --git a/libclamav/c++/llvm/test/CodeGen/PowerPC/lsr-postinc-pos.ll b/libclamav/c++/llvm/test/CodeGen/PowerPC/lsr-postinc-pos.ll
new file mode 100644
index 0000000..f441e42
--- /dev/null
+++ b/libclamav/c++/llvm/test/CodeGen/PowerPC/lsr-postinc-pos.ll
@@ -0,0 +1,32 @@
+; RUN: llc < %s -print-lsr-output |& FileCheck %s
+
+; The icmp is a post-inc use, and the increment is in %bb11, but the
+; scevgep needs to be inserted in %bb so that it is dominated by %t.
+
+; CHECK: %t = load i8** undef
+; CHECK: %scevgep = getelementptr i8* %t, i32 %lsr.iv.next
+; CHECK: %c1 = icmp ult i8* %scevgep, undef
+
+target datalayout = "E-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f128:64:128-n32"
+target triple = "powerpc-apple-darwin9"
+
+define void @foo() nounwind {
+entry:
+  br label %bb11
+
+bb11:
+  %i = phi i32 [ 0, %entry ], [ %i.next, %bb ] ; <i32> [#uses=3]
+  %ii = shl i32 %i, 2                       ; <i32> [#uses=1]
+  %c0 = icmp eq i32 %i, undef                ; <i1> [#uses=1]
+  br i1 %c0, label %bb13, label %bb
+
+bb:
+  %t = load i8** undef, align 16                ; <i8*> [#uses=1]
+  %p = getelementptr i8* %t, i32 %ii ; <i8*> [#uses=1]
+  %c1 = icmp ult i8* %p, undef          ; <i1> [#uses=1]
+  %i.next = add i32 %i, 1                        ; <i32> [#uses=1]
+  br i1 %c1, label %bb11, label %bb13
+
+bb13:
+  unreachable
+}
diff --git a/libclamav/c++/llvm/test/CodeGen/PowerPC/mem_update.ll b/libclamav/c++/llvm/test/CodeGen/PowerPC/mem_update.ll
index b267719..17e7e28 100644
--- a/libclamav/c++/llvm/test/CodeGen/PowerPC/mem_update.ll
+++ b/libclamav/c++/llvm/test/CodeGen/PowerPC/mem_update.ll
@@ -3,66 +3,66 @@
 ; RUN: llc < %s -march=ppc64 -enable-ppc-preinc | \
 ; RUN:   not grep addi
 
- at Glob = global i64 4		; <i64*> [#uses=2]
+ at Glob = global i64 4
 
-define i32* @test0(i32* %X, i32* %dest) {
-	%Y = getelementptr i32* %X, i32 4		; <i32*> [#uses=2]
-	%A = load i32* %Y		; <i32> [#uses=1]
+define i32* @test0(i32* %X, i32* %dest) nounwind {
+	%Y = getelementptr i32* %X, i32 4
+	%A = load i32* %Y
 	store i32 %A, i32* %dest
 	ret i32* %Y
 }
 
-define i32* @test1(i32* %X, i32* %dest) {
-	%Y = getelementptr i32* %X, i32 4		; <i32*> [#uses=2]
-	%A = load i32* %Y		; <i32> [#uses=1]
+define i32* @test1(i32* %X, i32* %dest) nounwind {
+	%Y = getelementptr i32* %X, i32 4
+	%A = load i32* %Y
 	store i32 %A, i32* %dest
 	ret i32* %Y
 }
 
-define i16* @test2(i16* %X, i32* %dest) {
-	%Y = getelementptr i16* %X, i32 4		; <i16*> [#uses=2]
-	%A = load i16* %Y		; <i16> [#uses=1]
-	%B = sext i16 %A to i32		; <i32> [#uses=1]
+define i16* @test2(i16* %X, i32* %dest) nounwind {
+	%Y = getelementptr i16* %X, i32 4
+	%A = load i16* %Y
+	%B = sext i16 %A to i32
 	store i32 %B, i32* %dest
 	ret i16* %Y
 }
 
-define i16* @test3(i16* %X, i32* %dest) {
-	%Y = getelementptr i16* %X, i32 4		; <i16*> [#uses=2]
-	%A = load i16* %Y		; <i16> [#uses=1]
-	%B = zext i16 %A to i32		; <i32> [#uses=1]
+define i16* @test3(i16* %X, i32* %dest) nounwind {
+	%Y = getelementptr i16* %X, i32 4
+	%A = load i16* %Y
+	%B = zext i16 %A to i32
 	store i32 %B, i32* %dest
 	ret i16* %Y
 }
 
-define i16* @test3a(i16* %X, i64* %dest) {
-	%Y = getelementptr i16* %X, i32 4		; <i16*> [#uses=2]
-	%A = load i16* %Y		; <i16> [#uses=1]
-	%B = sext i16 %A to i64		; <i64> [#uses=1]
+define i16* @test3a(i16* %X, i64* %dest) nounwind {
+	%Y = getelementptr i16* %X, i32 4
+	%A = load i16* %Y
+	%B = sext i16 %A to i64
 	store i64 %B, i64* %dest
 	ret i16* %Y
 }
 
-define i64* @test4(i64* %X, i64* %dest) {
-	%Y = getelementptr i64* %X, i32 4		; <i64*> [#uses=2]
-	%A = load i64* %Y		; <i64> [#uses=1]
+define i64* @test4(i64* %X, i64* %dest) nounwind {
+	%Y = getelementptr i64* %X, i32 4
+	%A = load i64* %Y
 	store i64 %A, i64* %dest
 	ret i64* %Y
 }
 
-define i16* @test5(i16* %X) {
-	%Y = getelementptr i16* %X, i32 4		; <i16*> [#uses=2]
+define i16* @test5(i16* %X) nounwind {
+	%Y = getelementptr i16* %X, i32 4
 	store i16 7, i16* %Y
 	ret i16* %Y
 }
 
-define i64* @test6(i64* %X, i64 %A) {
-	%Y = getelementptr i64* %X, i32 4		; <i64*> [#uses=2]
+define i64* @test6(i64* %X, i64 %A) nounwind {
+	%Y = getelementptr i64* %X, i32 4
 	store i64 %A, i64* %Y
 	ret i64* %Y
 }
 
-define i64* @test7(i64* %X, i64 %A) {
+define i64* @test7(i64* %X, i64 %A) nounwind {
 	store i64 %A, i64* @Glob
 	ret i64* @Glob
 }
diff --git a/libclamav/c++/llvm/test/CodeGen/PowerPC/retaddr.ll b/libclamav/c++/llvm/test/CodeGen/PowerPC/retaddr.ll
index 9f8647d..cf16b4c 100644
--- a/libclamav/c++/llvm/test/CodeGen/PowerPC/retaddr.ll
+++ b/libclamav/c++/llvm/test/CodeGen/PowerPC/retaddr.ll
@@ -4,7 +4,7 @@
 
 target triple = "powerpc-apple-darwin8"
 
-define void @foo(i8** %X) {
+define void @foo(i8** %X) nounwind {
 entry:
 	%tmp = tail call i8* @llvm.returnaddress( i32 0 )		; <i8*> [#uses=1]
 	store i8* %tmp, i8** %X, align 4
diff --git a/libclamav/c++/llvm/test/CodeGen/Thumb2/2010-02-11-phi-cycle.ll b/libclamav/c++/llvm/test/CodeGen/Thumb2/2010-02-11-phi-cycle.ll
index 0f23ee7..363f571 100644
--- a/libclamav/c++/llvm/test/CodeGen/Thumb2/2010-02-11-phi-cycle.ll
+++ b/libclamav/c++/llvm/test/CodeGen/Thumb2/2010-02-11-phi-cycle.ll
@@ -58,6 +58,10 @@ bb1:                                              ; preds = %bb
   br label %bb2
 
 bb2:                                              ; preds = %bb1, %bb
+; also check for duplicate induction variables (radar 7645034)
+; CHECK: subs r{{.*}}, #1
+; CHECK-NOT: subs r{{.*}}, #1
+; CHECK: pop
   %u.0 = phi i64 [ %ins, %bb1 ], [ %u.17, %bb ]   ; <i64> [#uses=2]
   %indvar.next = add i32 %indvar, 1               ; <i32> [#uses=2]
   %exitcond = icmp eq i32 %indvar.next, %tmp      ; <i1> [#uses=1]
diff --git a/libclamav/c++/llvm/test/CodeGen/Thumb2/2010-02-24-BigStack.ll b/libclamav/c++/llvm/test/CodeGen/Thumb2/2010-02-24-BigStack.ll
new file mode 100644
index 0000000..533546b
--- /dev/null
+++ b/libclamav/c++/llvm/test/CodeGen/Thumb2/2010-02-24-BigStack.ll
@@ -0,0 +1,15 @@
+; RUN: llc < %s -O0 -relocation-model=pic -disable-fp-elim -mcpu=cortex-a8 -mattr=+vfp2
+; This test creates a big stack frame without spilling any callee-saved registers.
+; Make sure the whole stack frame is addrerssable wiothout scavenger crashes.
+target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:32-f32:32:32-f64:32:32-v64:64:64-v128:128:128-a0:0:32-n32"
+target triple = "thumbv7-apple-darwin3.0.0-iphoneos"
+
+define arm_apcscc void @FindMin(double* %panelTDEL, i8* %dclOfRow, i32 %numRows, i32 %numCols, double* %retMin_RES_TDEL) {
+entry:
+  %panelTDEL.addr = alloca double*, align 4       ; <double**> [#uses=1]
+  %panelResTDEL = alloca [2560 x double], align 4 ; <[2560 x double]*> [#uses=0]
+  store double* %panelTDEL, double** %panelTDEL.addr
+  store double* %retMin_RES_TDEL, double** undef
+  store i32 0, i32* undef
+  unreachable
+}
diff --git a/libclamav/c++/llvm/test/CodeGen/Thumb2/ldr-str-imm12.ll b/libclamav/c++/llvm/test/CodeGen/Thumb2/ldr-str-imm12.ll
index 47d85b1..f007b5c 100644
--- a/libclamav/c++/llvm/test/CodeGen/Thumb2/ldr-str-imm12.ll
+++ b/libclamav/c++/llvm/test/CodeGen/Thumb2/ldr-str-imm12.ll
@@ -52,7 +52,7 @@ bb420:                                            ; preds = %bb20, %bb20
 ; CHECK: str r{{[0-7]}}, [sp]
 ; CHECK: str r{{[0-7]}}, [sp, #+4]
 ; CHECK: str r{{[0-7]}}, [sp, #+8]
-; CHECK: str r{{[0-7]}}, [sp, #+24]
+; CHECK: str{{(.w)?}} r{{[0-9]+}}, [sp, #+24]
   store %union.rec* null, %union.rec** @zz_hold, align 4
   store %union.rec* null, %union.rec** @zz_res, align 4
   store %union.rec* %x, %union.rec** @zz_hold, align 4
diff --git a/libclamav/c++/llvm/test/CodeGen/Thumb2/thumb2-uxtb.ll b/libclamav/c++/llvm/test/CodeGen/Thumb2/thumb2-uxtb.ll
index 4e23f53..91598cd 100644
--- a/libclamav/c++/llvm/test/CodeGen/Thumb2/thumb2-uxtb.ll
+++ b/libclamav/c++/llvm/test/CodeGen/Thumb2/thumb2-uxtb.ll
@@ -2,14 +2,14 @@
 
 define i32 @test1(i32 %x) {
 ; CHECK: test1
-; CHECK: uxtb16.w  r0, r0
+; CHECK: uxtb16  r0, r0
 	%tmp1 = and i32 %x, 16711935		; <i32> [#uses=1]
 	ret i32 %tmp1
 }
 
 define i32 @test2(i32 %x) {
 ; CHECK: test2
-; CHECK: uxtb16.w  r0, r0, ror #8
+; CHECK: uxtb16  r0, r0, ror #8
 	%tmp1 = lshr i32 %x, 8		; <i32> [#uses=1]
 	%tmp2 = and i32 %tmp1, 16711935		; <i32> [#uses=1]
 	ret i32 %tmp2
@@ -17,7 +17,7 @@ define i32 @test2(i32 %x) {
 
 define i32 @test3(i32 %x) {
 ; CHECK: test3
-; CHECK: uxtb16.w  r0, r0, ror #8
+; CHECK: uxtb16  r0, r0, ror #8
 	%tmp1 = lshr i32 %x, 8		; <i32> [#uses=1]
 	%tmp2 = and i32 %tmp1, 16711935		; <i32> [#uses=1]
 	ret i32 %tmp2
@@ -25,7 +25,7 @@ define i32 @test3(i32 %x) {
 
 define i32 @test4(i32 %x) {
 ; CHECK: test4
-; CHECK: uxtb16.w  r0, r0, ror #8
+; CHECK: uxtb16  r0, r0, ror #8
 	%tmp1 = lshr i32 %x, 8		; <i32> [#uses=1]
 	%tmp6 = and i32 %tmp1, 16711935		; <i32> [#uses=1]
 	ret i32 %tmp6
@@ -33,7 +33,7 @@ define i32 @test4(i32 %x) {
 
 define i32 @test5(i32 %x) {
 ; CHECK: test5
-; CHECK: uxtb16.w  r0, r0, ror #8
+; CHECK: uxtb16  r0, r0, ror #8
 	%tmp1 = lshr i32 %x, 8		; <i32> [#uses=1]
 	%tmp2 = and i32 %tmp1, 16711935		; <i32> [#uses=1]
 	ret i32 %tmp2
@@ -41,7 +41,7 @@ define i32 @test5(i32 %x) {
 
 define i32 @test6(i32 %x) {
 ; CHECK: test6
-; CHECK: uxtb16.w  r0, r0, ror #16
+; CHECK: uxtb16  r0, r0, ror #16
 	%tmp1 = lshr i32 %x, 16		; <i32> [#uses=1]
 	%tmp2 = and i32 %tmp1, 255		; <i32> [#uses=1]
 	%tmp4 = shl i32 %x, 16		; <i32> [#uses=1]
@@ -52,7 +52,7 @@ define i32 @test6(i32 %x) {
 
 define i32 @test7(i32 %x) {
 ; CHECK: test7
-; CHECK: uxtb16.w  r0, r0, ror #16
+; CHECK: uxtb16  r0, r0, ror #16
 	%tmp1 = lshr i32 %x, 16		; <i32> [#uses=1]
 	%tmp2 = and i32 %tmp1, 255		; <i32> [#uses=1]
 	%tmp4 = shl i32 %x, 16		; <i32> [#uses=1]
@@ -63,7 +63,7 @@ define i32 @test7(i32 %x) {
 
 define i32 @test8(i32 %x) {
 ; CHECK: test8
-; CHECK: uxtb16.w  r0, r0, ror #24
+; CHECK: uxtb16  r0, r0, ror #24
 	%tmp1 = shl i32 %x, 8		; <i32> [#uses=1]
 	%tmp2 = and i32 %tmp1, 16711680		; <i32> [#uses=1]
 	%tmp5 = lshr i32 %x, 24		; <i32> [#uses=1]
@@ -73,7 +73,7 @@ define i32 @test8(i32 %x) {
 
 define i32 @test9(i32 %x) {
 ; CHECK: test9
-; CHECK: uxtb16.w  r0, r0, ror #24
+; CHECK: uxtb16  r0, r0, ror #24
 	%tmp1 = lshr i32 %x, 24		; <i32> [#uses=1]
 	%tmp4 = shl i32 %x, 8		; <i32> [#uses=1]
 	%tmp5 = and i32 %tmp4, 16711680		; <i32> [#uses=1]
@@ -86,7 +86,7 @@ define i32 @test10(i32 %p0) {
 ; CHECK: mov.w r1, #16253176
 ; CHECK: and.w r0, r1, r0, lsr #7
 ; CHECK: lsrs  r1, r0, #5
-; CHECK: uxtb16.w  r1, r1
+; CHECK: uxtb16  r1, r1
 ; CHECK: orr.w r0, r1, r0
 
 	%tmp1 = lshr i32 %p0, 7		; <i32> [#uses=1]
diff --git a/libclamav/c++/llvm/test/CodeGen/X86/2005-01-17-CycleInDAG.ll b/libclamav/c++/llvm/test/CodeGen/X86/2005-01-17-CycleInDAG.ll
index 32fafc6..fe6674d 100644
--- a/libclamav/c++/llvm/test/CodeGen/X86/2005-01-17-CycleInDAG.ll
+++ b/libclamav/c++/llvm/test/CodeGen/X86/2005-01-17-CycleInDAG.ll
@@ -7,7 +7,7 @@
 
 @GLOBAL = external global i32           ; <i32*> [#uses=1]
 
-define i32 @test(i32* %P1, i32* %P2, i32* %P3) {
+define i32 @test(i32* %P1, i32* %P2, i32* %P3) nounwind {
         %L = load i32* @GLOBAL          ; <i32> [#uses=1]
         store i32 12, i32* %P2
         %Y = load i32* %P3              ; <i32> [#uses=1]
diff --git a/libclamav/c++/llvm/test/CodeGen/X86/2006-10-07-ScalarSSEMiscompile.ll b/libclamav/c++/llvm/test/CodeGen/X86/2006-10-07-ScalarSSEMiscompile.ll
index bf9fa57..d09d061 100644
--- a/libclamav/c++/llvm/test/CodeGen/X86/2006-10-07-ScalarSSEMiscompile.ll
+++ b/libclamav/c++/llvm/test/CodeGen/X86/2006-10-07-ScalarSSEMiscompile.ll
@@ -5,7 +5,7 @@
 target datalayout = "e-p:32:32"
 target triple = "i686-apple-darwin8.7.2"
 
-define <4 x float> @test(<4 x float> %A, <4 x float>* %B) {
+define <4 x float> @test(<4 x float> %A, <4 x float>* %B) nounwind {
         %BV = load <4 x float>* %B              ; <<4 x float>> [#uses=1]
         %tmp28 = tail call <4 x float> @llvm.x86.sse.sub.ss( <4 x float> %A, <4 x float> %BV )       ; <<4 x float>> [#uses=1]
         ret <4 x float> %tmp28
diff --git a/libclamav/c++/llvm/test/CodeGen/X86/2008-02-22-ReMatBug.ll b/libclamav/c++/llvm/test/CodeGen/X86/2008-02-22-ReMatBug.ll
index 8d6bb0d..a91ac27 100644
--- a/libclamav/c++/llvm/test/CodeGen/X86/2008-02-22-ReMatBug.ll
+++ b/libclamav/c++/llvm/test/CodeGen/X86/2008-02-22-ReMatBug.ll
@@ -1,4 +1,4 @@
-; RUN: llc < %s -march=x86 -stats |& grep {Number of re-materialization} | grep 3
+; RUN: llc < %s -march=x86 -stats |& grep {Number of re-materialization} | grep 2
 ; rdar://5761454
 
 	%struct.quad_struct = type { i32, i32, %struct.quad_struct*, %struct.quad_struct*, %struct.quad_struct*, %struct.quad_struct*, %struct.quad_struct* }
diff --git a/libclamav/c++/llvm/test/CodeGen/X86/2008-08-05-SpillerBug.ll b/libclamav/c++/llvm/test/CodeGen/X86/2008-08-05-SpillerBug.ll
index 67e14ff..4c64934 100644
--- a/libclamav/c++/llvm/test/CodeGen/X86/2008-08-05-SpillerBug.ll
+++ b/libclamav/c++/llvm/test/CodeGen/X86/2008-08-05-SpillerBug.ll
@@ -1,4 +1,4 @@
-; RUN: llc < %s -mtriple=i386-apple-darwin -disable-fp-elim -stats |& grep asm-printer | grep 58
+; RUN: llc < %s -mtriple=i386-apple-darwin -disable-fp-elim -stats |& grep asm-printer | grep 55
 ; PR2568
 
 @g_3 = external global i16		; <i16*> [#uses=1]
diff --git a/libclamav/c++/llvm/test/CodeGen/X86/2009-02-12-DebugInfoVLA.ll b/libclamav/c++/llvm/test/CodeGen/X86/2009-02-12-DebugInfoVLA.ll
index 72c7ee9..0dca14d 100644
--- a/libclamav/c++/llvm/test/CodeGen/X86/2009-02-12-DebugInfoVLA.ll
+++ b/libclamav/c++/llvm/test/CodeGen/X86/2009-02-12-DebugInfoVLA.ll
@@ -3,74 +3,83 @@
 ; PR3538
 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
 target triple = "i386-apple-darwin9"
-	%llvm.dbg.anchor.type = type { i32, i32 }
-	%llvm.dbg.basictype.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, i32 }
-	%llvm.dbg.block.type = type { i32, { }* }
-	%llvm.dbg.compile_unit.type = type { i32, { }*, i32, i8*, i8*, i8*, i1, i1, i8* }
-	%llvm.dbg.composite.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, { }*, { }* }
-	%llvm.dbg.subprogram.type = type { i32, { }*, { }*, i8*, i8*, i8*, { }*, i32, { }*, i1, i1 }
-	%llvm.dbg.subrange.type = type { i32, i64, i64 }
-	%llvm.dbg.variable.type = type { i32, { }*, i8*, { }*, i32, { }* }
- at llvm.dbg.compile_units = linkonce constant %llvm.dbg.anchor.type { i32 458752, i32 17 }, section "llvm.metadata"		; <%llvm.dbg.anchor.type*> [#uses=1]
- at .str = internal constant [4 x i8] c"t.c\00", section "llvm.metadata"		; <[4 x i8]*> [#uses=1]
- at .str1 = internal constant [2 x i8] c".\00", section "llvm.metadata"		; <[2 x i8]*> [#uses=1]
- at .str2 = internal constant [6 x i8] c"clang\00", section "llvm.metadata"		; <[6 x i8]*> [#uses=1]
- at llvm.dbg.compile_unit = internal constant %llvm.dbg.compile_unit.type { i32 458769, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to { }*), i32 1, i8* getelementptr ([4 x i8]* @.str, i32 0, i32 0), i8* getelementptr ([2 x i8]* @.str1, i32 0, i32 0), i8* getelementptr ([6 x i8]* @.str2, i32 0, i32 0), i1 false, i1 false, i8* null }, section "llvm.metadata"		; <%llvm.dbg.compile_unit.type*> [#uses=1]
- at .str3 = internal constant [4 x i8] c"int\00", section "llvm.metadata"		; <[4 x i8]*> [#uses=1]
- at llvm.dbg.basictype = internal constant %llvm.dbg.basictype.type { i32 458788, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([4 x i8]* @.str3, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 32, i64 32, i64 0, i32 0, i32 5 }, section "llvm.metadata"		; <%llvm.dbg.basictype.type*> [#uses=1]
- at llvm.dbg.subprograms = linkonce constant %llvm.dbg.anchor.type { i32 458752, i32 46 }, section "llvm.metadata"		; <%llvm.dbg.anchor.type*> [#uses=1]
- at .str4 = internal constant [5 x i8] c"test\00", section "llvm.metadata"		; <[5 x i8]*> [#uses=1]
- at llvm.dbg.subprogram = internal constant %llvm.dbg.subprogram.type { i32 458798, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to { }*), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([5 x i8]* @.str4, i32 0, i32 0), i8* getelementptr ([5 x i8]* @.str4, i32 0, i32 0), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 3, { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*), i1 false, i1 true }, section "llvm.metadata"		; <%llvm.dbg.subprogram.type*> [#uses=1]
- at .str5 = internal constant [2 x i8] c"X\00", section "llvm.metadata"		; <[2 x i8]*> [#uses=1]
- at llvm.dbg.variable = internal constant %llvm.dbg.variable.type { i32 459009, { }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*), i8* getelementptr ([2 x i8]* @.str5, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 3, { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*) }, section "llvm.metadata"		; <%llvm.dbg.variable.type*> [#uses=1]
- at llvm.dbg.block = internal constant %llvm.dbg.block.type { i32 458763, { }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*) }, section "llvm.metadata"		; <%llvm.dbg.block.type*> [#uses=1]
- at llvm.dbg.subrange = internal constant %llvm.dbg.subrange.type { i32 458785, i64 0, i64 0 }, section "llvm.metadata"		; <%llvm.dbg.subrange.type*> [#uses=1]
- at llvm.dbg.array = internal constant [1 x { }*] [{ }* bitcast (%llvm.dbg.subrange.type* @llvm.dbg.subrange to { }*)], section "llvm.metadata"		; <[1 x { }*]*> [#uses=1]
- at llvm.dbg.composite = internal constant %llvm.dbg.composite.type { i32 458753, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* null, i32 0, i64 0, i64 32, i64 0, i32 0, { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*), { }* bitcast ([1 x { }*]* @llvm.dbg.array to { }*) }, section "llvm.metadata"		; <%llvm.dbg.composite.type*> [#uses=1]
- at .str6 = internal constant [2 x i8] c"Y\00", section "llvm.metadata"		; <[2 x i8]*> [#uses=1]
- at llvm.dbg.variable7 = internal constant %llvm.dbg.variable.type { i32 459008, { }* bitcast (%llvm.dbg.block.type* @llvm.dbg.block to { }*), i8* getelementptr ([2 x i8]* @.str6, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 4, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite to { }*) }, section "llvm.metadata"		; <%llvm.dbg.variable.type*> [#uses=1]
-
-define i32 @test(i32 %X) nounwind {
+define signext i8 @foo(i8* %s1) nounwind ssp {
 entry:
-	%retval = alloca i32		; <i32*> [#uses=1]
-	%X.addr = alloca i32		; <i32*> [#uses=3]
-	%saved_stack = alloca i8*		; <i8**> [#uses=2]
-	call void @llvm.dbg.func.start({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*))
-	store i32 %X, i32* %X.addr
-	%0 = bitcast i32* %X.addr to { }*		; <{ }*> [#uses=1]
-	call void @llvm.dbg.declare({ }* %0, { }* bitcast (%llvm.dbg.variable.type* @llvm.dbg.variable to { }*))
-	call void @llvm.dbg.region.start({ }* bitcast (%llvm.dbg.block.type* @llvm.dbg.block to { }*))
-	call void @llvm.dbg.stoppoint(i32 4, i32 3, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
-	%1 = call i8* @llvm.stacksave()		; <i8*> [#uses=1]
-	store i8* %1, i8** %saved_stack
-	%tmp = load i32* %X.addr		; <i32> [#uses=1]
-	%2 = mul i32 4, %tmp		; <i32> [#uses=1]
-	%vla = alloca i8, i32 %2		; <i8*> [#uses=1]
-	%tmp1 = bitcast i8* %vla to i32*		; <i32*> [#uses=1]
-	%3 = bitcast i32* %tmp1 to { }*		; <{ }*> [#uses=1]
-	call void @llvm.dbg.declare({ }* %3, { }* bitcast (%llvm.dbg.variable.type* @llvm.dbg.variable7 to { }*))
-	call void @llvm.dbg.stoppoint(i32 5, i32 1, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
-	call void @llvm.dbg.region.end({ }* bitcast (%llvm.dbg.block.type* @llvm.dbg.block to { }*))
-	br label %cleanup
+  %s1_addr = alloca i8*                           ; <i8**> [#uses=2]
+  %retval = alloca i32                            ; <i32*> [#uses=2]
+  %saved_stack.1 = alloca i8*                     ; <i8**> [#uses=2]
+  %0 = alloca i32                                 ; <i32*> [#uses=2]
+  %str.0 = alloca [0 x i8]*                       ; <[0 x i8]**> [#uses=3]
+  %1 = alloca i64                                 ; <i64*> [#uses=2]
+  %2 = alloca i64                                 ; <i64*> [#uses=1]
+  %3 = alloca i64                                 ; <i64*> [#uses=6]
+  %"alloca point" = bitcast i32 0 to i32          ; <i32> [#uses=0]
+  call void @llvm.dbg.declare(metadata !{i8** %s1_addr}, metadata !0), !dbg !7
+  store i8* %s1, i8** %s1_addr
+  call void @llvm.dbg.declare(metadata !{[0 x i8]** %str.0}, metadata !8), !dbg !7
+  %4 = call i8* @llvm.stacksave(), !dbg !7        ; <i8*> [#uses=1]
+  store i8* %4, i8** %saved_stack.1, align 8, !dbg !7
+  %5 = load i8** %s1_addr, align 8, !dbg !13      ; <i8*> [#uses=1]
+  %6 = call i64 @strlen(i8* %5) nounwind readonly, !dbg !13 ; <i64> [#uses=1]
+  %7 = add i64 %6, 1, !dbg !13                    ; <i64> [#uses=1]
+  store i64 %7, i64* %3, align 8, !dbg !13
+  %8 = load i64* %3, align 8, !dbg !13            ; <i64> [#uses=1]
+  %9 = sub nsw i64 %8, 1, !dbg !13                ; <i64> [#uses=0]
+  %10 = load i64* %3, align 8, !dbg !13           ; <i64> [#uses=1]
+  %11 = mul i64 %10, 8, !dbg !13                  ; <i64> [#uses=0]
+  %12 = load i64* %3, align 8, !dbg !13           ; <i64> [#uses=1]
+  store i64 %12, i64* %2, align 8, !dbg !13
+  %13 = load i64* %3, align 8, !dbg !13           ; <i64> [#uses=1]
+  %14 = mul i64 %13, 8, !dbg !13                  ; <i64> [#uses=0]
+  %15 = load i64* %3, align 8, !dbg !13           ; <i64> [#uses=1]
+  store i64 %15, i64* %1, align 8, !dbg !13
+  %16 = load i64* %1, align 8, !dbg !13           ; <i64> [#uses=1]
+  %17 = trunc i64 %16 to i32, !dbg !13            ; <i32> [#uses=1]
+  %18 = alloca i8, i32 %17, !dbg !13              ; <i8*> [#uses=1]
+  %19 = bitcast i8* %18 to [0 x i8]*, !dbg !13    ; <[0 x i8]*> [#uses=1]
+  store [0 x i8]* %19, [0 x i8]** %str.0, align 8, !dbg !13
+  %20 = load [0 x i8]** %str.0, align 8, !dbg !15 ; <[0 x i8]*> [#uses=1]
+  %21 = getelementptr inbounds [0 x i8]* %20, i64 0, i64 0, !dbg !15 ; <i8*> [#uses=1]
+  store i8 0, i8* %21, align 1, !dbg !15
+  %22 = load [0 x i8]** %str.0, align 8, !dbg !16 ; <[0 x i8]*> [#uses=1]
+  %23 = getelementptr inbounds [0 x i8]* %22, i64 0, i64 0, !dbg !16 ; <i8*> [#uses=1]
+  %24 = load i8* %23, align 1, !dbg !16           ; <i8> [#uses=1]
+  %25 = sext i8 %24 to i32, !dbg !16              ; <i32> [#uses=1]
+  store i32 %25, i32* %0, align 4, !dbg !16
+  %26 = load i8** %saved_stack.1, align 8, !dbg !16 ; <i8*> [#uses=1]
+  call void @llvm.stackrestore(i8* %26), !dbg !16
+  %27 = load i32* %0, align 4, !dbg !16           ; <i32> [#uses=1]
+  store i32 %27, i32* %retval, align 4, !dbg !16
+  br label %return, !dbg !16
 
-cleanup:		; preds = %entry
-	%tmp2 = load i8** %saved_stack		; <i8*> [#uses=1]
-	call void @llvm.stackrestore(i8* %tmp2)
-	call void @llvm.dbg.region.end({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*))
-	%4 = load i32* %retval		; <i32> [#uses=1]
-	ret i32 %4
+return:                                           ; preds = %entry
+  %retval1 = load i32* %retval, !dbg !16          ; <i32> [#uses=1]
+  %retval12 = trunc i32 %retval1 to i8, !dbg !16  ; <i8> [#uses=1]
+  ret i8 %retval12, !dbg !16
 }
 
-declare void @llvm.dbg.func.start({ }*) nounwind
-
-declare void @llvm.dbg.declare({ }*, { }*) nounwind
-
-declare void @llvm.dbg.region.start({ }*) nounwind
-
-declare void @llvm.dbg.stoppoint(i32, i32, { }*) nounwind
+declare void @llvm.dbg.declare(metadata, metadata) nounwind readnone
 
 declare i8* @llvm.stacksave() nounwind
 
+declare i64 @strlen(i8*) nounwind readonly
+
 declare void @llvm.stackrestore(i8*) nounwind
 
-declare void @llvm.dbg.region.end({ }*) nounwind
+!0 = metadata !{i32 459009, metadata !1, metadata !"s1", metadata !2, i32 2, metadata !6} ; [ DW_TAG_arg_variable ]
+!1 = metadata !{i32 458798, i32 0, metadata !2, metadata !"foo", metadata !"foo", metadata !"foo", metadata !2, i32 2, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i1 false} ; [ DW_TAG_subprogram ]
+!2 = metadata !{i32 458769, i32 0, i32 1, metadata !"vla.c", metadata !"/tmp/", metadata !"4.2.1 (Based on Apple Inc. build 5658) (LLVM build)", i1 true, i1 false, metadata !"", i32 0} ; [ DW_TAG_compile_unit ]
+!3 = metadata !{i32 458773, metadata !2, metadata !"", metadata !2, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !4, i32 0, null} ; [ DW_TAG_subroutine_type ]
+!4 = metadata !{metadata !5, metadata !6}
+!5 = metadata !{i32 458788, metadata !2, metadata !"char", metadata !2, i32 0, i64 8, i64 8, i64 0, i32 0, i32 6} ; [ DW_TAG_base_type ]
+!6 = metadata !{i32 458767, metadata !2, metadata !"", metadata !2, i32 0, i64 64, i64 64, i64 0, i32 0, metadata !5} ; [ DW_TAG_pointer_type ]
+!7 = metadata !{i32 2, i32 0, metadata !1, null}
+!8 = metadata !{i32 459008, metadata !1, metadata !"str.0", metadata !2, i32 3, metadata !9} ; [ DW_TAG_auto_variable ]
+!9 = metadata !{i32 458767, metadata !2, metadata !"", metadata !2, i32 0, i64 64, i64 64, i64 0, i32 64, metadata !10} ; [ DW_TAG_pointer_type ]
+!10 = metadata !{i32 458753, metadata !2, metadata !"", metadata !2, i32 0, i64 8, i64 8, i64 0, i32 0, metadata !5, metadata !11, i32 0, null} ; [ DW_TAG_array_type ]
+!11 = metadata !{metadata !12}
+!12 = metadata !{i32 458785, i64 0, i64 0}        ; [ DW_TAG_subrange_type ]
+!13 = metadata !{i32 3, i32 0, metadata !14, null}
+!14 = metadata !{i32 458763, metadata !1, i32 0, i32 0} ; [ DW_TAG_lexical_block ]
+!15 = metadata !{i32 4, i32 0, metadata !14, null}
+!16 = metadata !{i32 5, i32 0, metadata !14, null}
diff --git a/libclamav/c++/llvm/test/CodeGen/X86/2009-07-16-LoadFoldingBug.ll b/libclamav/c++/llvm/test/CodeGen/X86/2009-07-16-LoadFoldingBug.ll
deleted file mode 100644
index e21c892..0000000
--- a/libclamav/c++/llvm/test/CodeGen/X86/2009-07-16-LoadFoldingBug.ll
+++ /dev/null
@@ -1,102 +0,0 @@
-; RUN: llc < %s -mtriple=x86_64-apple-darwin10 | FileCheck %s
-
-; CHECK: _foo:
-; CHECK: pavgw LCPI1_4(%rip)
-
-; rdar://7057804
-
-define void @foo(i16* %out8x8, i16* %in8x8, i32 %lastrow) optsize ssp {
-entry:
-	%0 = call <8 x i16> @llvm.x86.sse2.pmulh.w(<8 x i16> <i16 6518, i16 6518, i16 6518, i16 6518, i16 6518, i16 6518, i16 6518, i16 6518>, <8 x i16> undef) nounwind readnone		; <<8 x i16>> [#uses=2]
-	%1 = call <8 x i16> @llvm.x86.sse2.pcmpeq.w(<8 x i16> %0, <8 x i16> <i16 16384, i16 16384, i16 16384, i16 16384, i16 16384, i16 16384, i16 16384, i16 16384>) nounwind readnone		; <<8 x i16>> [#uses=1]
-	%2 = call <8 x i16> @llvm.x86.sse2.psrli.w(<8 x i16> zeroinitializer, i32 14) nounwind readnone		; <<8 x i16>> [#uses=1]
-	%3 = call <8 x i16> @llvm.x86.sse2.pavg.w(<8 x i16> %2, <8 x i16> zeroinitializer) nounwind readnone		; <<8 x i16>> [#uses=1]
-	%tmp.i.i10 = add <8 x i16> %0, %3		; <<8 x i16>> [#uses=1]
-	%4 = call <8 x i16> @llvm.x86.sse2.psubs.w(<8 x i16> zeroinitializer, <8 x i16> %1) nounwind readnone		; <<8 x i16>> [#uses=1]
-	%5 = call <8 x i16> @llvm.x86.sse2.padds.w(<8 x i16> %tmp.i.i10, <8 x i16> %4) nounwind readnone		; <<8 x i16>> [#uses=3]
-	%6 = call <8 x i16> @llvm.x86.sse2.psubs.w(<8 x i16> %5, <8 x i16> undef) nounwind readnone		; <<8 x i16>> [#uses=1]
-	%7 = call <8 x i16> @llvm.x86.sse2.pmulh.w(<8 x i16> <i16 6518, i16 6518, i16 6518, i16 6518, i16 6518, i16 6518, i16 6518, i16 6518>, <8 x i16> undef) nounwind readnone		; <<8 x i16>> [#uses=2]
-	%8 = call <8 x i16> @llvm.x86.sse2.pcmpeq.w(<8 x i16> %7, <8 x i16> <i16 16384, i16 16384, i16 16384, i16 16384, i16 16384, i16 16384, i16 16384, i16 16384>) nounwind readnone		; <<8 x i16>> [#uses=1]
-	%9 = call <8 x i16> @llvm.x86.sse2.psrli.w(<8 x i16> zeroinitializer, i32 14) nounwind readnone		; <<8 x i16>> [#uses=1]
-	%10 = call <8 x i16> @llvm.x86.sse2.pavg.w(<8 x i16> %9, <8 x i16> zeroinitializer) nounwind readnone		; <<8 x i16>> [#uses=1]
-	%tmp.i.i8 = add <8 x i16> %7, %10		; <<8 x i16>> [#uses=1]
-	%11 = call <8 x i16> @llvm.x86.sse2.psubs.w(<8 x i16> undef, <8 x i16> %8) nounwind readnone		; <<8 x i16>> [#uses=1]
-	%12 = call <8 x i16> @llvm.x86.sse2.padds.w(<8 x i16> %tmp.i.i8, <8 x i16> %11) nounwind readnone		; <<8 x i16>> [#uses=1]
-	%13 = call <8 x i16> @llvm.x86.sse2.padds.w(<8 x i16> undef, <8 x i16> undef) nounwind readnone		; <<8 x i16>> [#uses=1]
-	%14 = call <8 x i16> @llvm.x86.sse2.psubs.w(<8 x i16> %5, <8 x i16> undef) nounwind readnone		; <<8 x i16>> [#uses=1]
-	%15 = call <8 x i16> @llvm.x86.sse2.padds.w(<8 x i16> %5, <8 x i16> undef) nounwind readnone		; <<8 x i16>> [#uses=1]
-	%16 = call <8 x i16> @llvm.x86.sse2.padds.w(<8 x i16> %6, <8 x i16> undef) nounwind readnone		; <<8 x i16>> [#uses=1]
-	%17 = call <8 x i16> @llvm.x86.sse2.padds.w(<8 x i16> %12, <8 x i16> undef) nounwind readnone		; <<8 x i16>> [#uses=1]
-	%18 = call <8 x i16> @llvm.x86.sse2.psubs.w(<8 x i16> %13, <8 x i16> %15) nounwind readnone		; <<8 x i16>> [#uses=1]
-	%19 = call <8 x i16> @llvm.x86.sse2.psubs.w(<8 x i16> undef, <8 x i16> %14) nounwind readnone		; <<8 x i16>> [#uses=2]
-	%20 = call <8 x i16> @llvm.x86.sse2.psubs.w(<8 x i16> undef, <8 x i16> undef) nounwind readnone		; <<8 x i16>> [#uses=4]
-	%21 = call <8 x i16> @llvm.x86.sse2.psubs.w(<8 x i16> undef, <8 x i16> %17) nounwind readnone		; <<8 x i16>> [#uses=1]
-	%22 = bitcast <8 x i16> %21 to <2 x i64>		; <<2 x i64>> [#uses=1]
-	%23 = call <8 x i16> @llvm.x86.sse2.pmulh.w(<8 x i16> <i16 23170, i16 23170, i16 23170, i16 23170, i16 23170, i16 23170, i16 23170, i16 23170>, <8 x i16> undef) nounwind readnone		; <<8 x i16>> [#uses=2]
-	%24 = call <8 x i16> @llvm.x86.sse2.pcmpeq.w(<8 x i16> %23, <8 x i16> <i16 16384, i16 16384, i16 16384, i16 16384, i16 16384, i16 16384, i16 16384, i16 16384>) nounwind readnone		; <<8 x i16>> [#uses=1]
-	%25 = call <8 x i16> @llvm.x86.sse2.psrli.w(<8 x i16> zeroinitializer, i32 14) nounwind readnone		; <<8 x i16>> [#uses=1]
-	%26 = call <8 x i16> @llvm.x86.sse2.pavg.w(<8 x i16> %25, <8 x i16> zeroinitializer) nounwind readnone		; <<8 x i16>> [#uses=1]
-	%tmp.i.i6 = add <8 x i16> %23, %26		; <<8 x i16>> [#uses=1]
-	%27 = call <8 x i16> @llvm.x86.sse2.psubs.w(<8 x i16> undef, <8 x i16> %24) nounwind readnone		; <<8 x i16>> [#uses=1]
-	%28 = call <8 x i16> @llvm.x86.sse2.padds.w(<8 x i16> %tmp.i.i6, <8 x i16> %27) nounwind readnone		; <<8 x i16>> [#uses=1]
-	%29 = call <8 x i16> @llvm.x86.sse2.pmulh.w(<8 x i16> <i16 -23170, i16 -23170, i16 -23170, i16 -23170, i16 -23170, i16 -23170, i16 -23170, i16 -23170>, <8 x i16> undef) nounwind readnone		; <<8 x i16>> [#uses=2]
-	%30 = call <8 x i16> @llvm.x86.sse2.pcmpeq.w(<8 x i16> %29, <8 x i16> <i16 16384, i16 16384, i16 16384, i16 16384, i16 16384, i16 16384, i16 16384, i16 16384>) nounwind readnone		; <<8 x i16>> [#uses=1]
-	%31 = call <8 x i16> @llvm.x86.sse2.psrli.w(<8 x i16> zeroinitializer, i32 14) nounwind readnone		; <<8 x i16>> [#uses=1]
-	%32 = call <8 x i16> @llvm.x86.sse2.pavg.w(<8 x i16> %31, <8 x i16> zeroinitializer) nounwind readnone		; <<8 x i16>> [#uses=1]
-	%tmp.i.i4 = add <8 x i16> %29, %32		; <<8 x i16>> [#uses=1]
-	%33 = call <8 x i16> @llvm.x86.sse2.psubs.w(<8 x i16> undef, <8 x i16> %30) nounwind readnone		; <<8 x i16>> [#uses=1]
-	%34 = call <8 x i16> @llvm.x86.sse2.padds.w(<8 x i16> %tmp.i.i4, <8 x i16> %33) nounwind readnone		; <<8 x i16>> [#uses=1]
-	%35 = call <8 x i16> @llvm.x86.sse2.pmulh.w(<8 x i16> <i16 23170, i16 23170, i16 23170, i16 23170, i16 23170, i16 23170, i16 23170, i16 23170>, <8 x i16> %20) nounwind readnone		; <<8 x i16>> [#uses=2]
-	%tmp.i2.i1 = mul <8 x i16> %20, <i16 23170, i16 23170, i16 23170, i16 23170, i16 23170, i16 23170, i16 23170, i16 23170>		; <<8 x i16>> [#uses=1]
-	%36 = call <8 x i16> @llvm.x86.sse2.pcmpeq.w(<8 x i16> %35, <8 x i16> <i16 16384, i16 16384, i16 16384, i16 16384, i16 16384, i16 16384, i16 16384, i16 16384>) nounwind readnone		; <<8 x i16>> [#uses=1]
-	%37 = call <8 x i16> @llvm.x86.sse2.psrli.w(<8 x i16> %tmp.i2.i1, i32 14) nounwind readnone		; <<8 x i16>> [#uses=1]
-	%38 = call <8 x i16> @llvm.x86.sse2.pavg.w(<8 x i16> %37, <8 x i16> zeroinitializer) nounwind readnone		; <<8 x i16>> [#uses=1]
-	%tmp.i.i2 = add <8 x i16> %35, %38		; <<8 x i16>> [#uses=1]
-	%39 = call <8 x i16> @llvm.x86.sse2.psubs.w(<8 x i16> %19, <8 x i16> %36) nounwind readnone		; <<8 x i16>> [#uses=1]
-	%40 = call <8 x i16> @llvm.x86.sse2.padds.w(<8 x i16> %tmp.i.i2, <8 x i16> %39) nounwind readnone		; <<8 x i16>> [#uses=1]
-	%41 = call <8 x i16> @llvm.x86.sse2.pmulh.w(<8 x i16> <i16 -23170, i16 -23170, i16 -23170, i16 -23170, i16 -23170, i16 -23170, i16 -23170, i16 -23170>, <8 x i16> %20) nounwind readnone		; <<8 x i16>> [#uses=2]
-	%tmp.i2.i = mul <8 x i16> %20, <i16 -23170, i16 -23170, i16 -23170, i16 -23170, i16 -23170, i16 -23170, i16 -23170, i16 -23170>		; <<8 x i16>> [#uses=1]
-	%42 = call <8 x i16> @llvm.x86.sse2.pcmpeq.w(<8 x i16> %41, <8 x i16> <i16 16384, i16 16384, i16 16384, i16 16384, i16 16384, i16 16384, i16 16384, i16 16384>) nounwind readnone		; <<8 x i16>> [#uses=1]
-	%43 = call <8 x i16> @llvm.x86.sse2.psrli.w(<8 x i16> %tmp.i2.i, i32 14) nounwind readnone		; <<8 x i16>> [#uses=1]
-	%44 = call <8 x i16> @llvm.x86.sse2.pavg.w(<8 x i16> %43, <8 x i16> zeroinitializer) nounwind readnone		; <<8 x i16>> [#uses=1]
-	%tmp.i.i = add <8 x i16> %41, %44		; <<8 x i16>> [#uses=1]
-	%45 = call <8 x i16> @llvm.x86.sse2.psubs.w(<8 x i16> %19, <8 x i16> %42) nounwind readnone		; <<8 x i16>> [#uses=1]
-	%46 = call <8 x i16> @llvm.x86.sse2.padds.w(<8 x i16> %tmp.i.i, <8 x i16> %45) nounwind readnone		; <<8 x i16>> [#uses=1]
-	%47 = call <8 x i16> @llvm.x86.sse2.padds.w(<8 x i16> %18, <8 x i16> %16) nounwind readnone		; <<8 x i16>> [#uses=1]
-	%48 = bitcast <8 x i16> %47 to <2 x i64>		; <<2 x i64>> [#uses=1]
-	%49 = bitcast <8 x i16> %28 to <2 x i64>		; <<2 x i64>> [#uses=1]
-	%50 = getelementptr i16* %out8x8, i64 8		; <i16*> [#uses=1]
-	%51 = bitcast i16* %50 to <2 x i64>*		; <<2 x i64>*> [#uses=1]
-	store <2 x i64> %49, <2 x i64>* %51, align 16
-	%52 = bitcast <8 x i16> %40 to <2 x i64>		; <<2 x i64>> [#uses=1]
-	%53 = getelementptr i16* %out8x8, i64 16		; <i16*> [#uses=1]
-	%54 = bitcast i16* %53 to <2 x i64>*		; <<2 x i64>*> [#uses=1]
-	store <2 x i64> %52, <2 x i64>* %54, align 16
-	%55 = getelementptr i16* %out8x8, i64 24		; <i16*> [#uses=1]
-	%56 = bitcast i16* %55 to <2 x i64>*		; <<2 x i64>*> [#uses=1]
-	store <2 x i64> %48, <2 x i64>* %56, align 16
-	%57 = bitcast <8 x i16> %46 to <2 x i64>		; <<2 x i64>> [#uses=1]
-	%58 = getelementptr i16* %out8x8, i64 40		; <i16*> [#uses=1]
-	%59 = bitcast i16* %58 to <2 x i64>*		; <<2 x i64>*> [#uses=1]
-	store <2 x i64> %57, <2 x i64>* %59, align 16
-	%60 = bitcast <8 x i16> %34 to <2 x i64>		; <<2 x i64>> [#uses=1]
-	%61 = getelementptr i16* %out8x8, i64 48		; <i16*> [#uses=1]
-	%62 = bitcast i16* %61 to <2 x i64>*		; <<2 x i64>*> [#uses=1]
-	store <2 x i64> %60, <2 x i64>* %62, align 16
-	%63 = getelementptr i16* %out8x8, i64 56		; <i16*> [#uses=1]
-	%64 = bitcast i16* %63 to <2 x i64>*		; <<2 x i64>*> [#uses=1]
-	store <2 x i64> %22, <2 x i64>* %64, align 16
-	ret void
-}
-
-declare <8 x i16> @llvm.x86.sse2.psubs.w(<8 x i16>, <8 x i16>) nounwind readnone
-
-declare <8 x i16> @llvm.x86.sse2.pmulh.w(<8 x i16>, <8 x i16>) nounwind readnone
-
-declare <8 x i16> @llvm.x86.sse2.pcmpeq.w(<8 x i16>, <8 x i16>) nounwind readnone
-
-declare <8 x i16> @llvm.x86.sse2.pavg.w(<8 x i16>, <8 x i16>) nounwind readnone
-
-declare <8 x i16> @llvm.x86.sse2.padds.w(<8 x i16>, <8 x i16>) nounwind readnone
-
-declare <8 x i16> @llvm.x86.sse2.psrli.w(<8 x i16>, i32) nounwind readnone
diff --git a/libclamav/c++/llvm/test/CodeGen/X86/2010-02-11-NonTemporal.ll b/libclamav/c++/llvm/test/CodeGen/X86/2010-02-11-NonTemporal.ll
new file mode 100644
index 0000000..5789a0b
--- /dev/null
+++ b/libclamav/c++/llvm/test/CodeGen/X86/2010-02-11-NonTemporal.ll
@@ -0,0 +1,22 @@
+; RUN: llc < %s -march=x86-64 | FileCheck %s
+; CHECK: movnt
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
+target triple = "x86_64-unknown-linux-gnu"
+
+!0 = metadata !{ i32 1 }
+
+define void @sub_(i32* noalias %n) {
+"file movnt.f90, line 2, bb1":
+	%n1 = alloca i32*, align 8
+	%i = alloca i32, align 4
+	%"$LCS_0" = alloca i64, align 8
+	%"$LCS_S2" = alloca <2 x double>, align 16
+	%r9 = load <2 x double>* %"$LCS_S2", align 8
+	%r10 = load i64* %"$LCS_0", align 8
+	%r11 = inttoptr i64 %r10 to <2 x double>*
+	store <2 x double> %r9, <2 x double>* %r11, align 16, !nontemporal !0
+	br label %"file movnt.f90, line 18, bb5"
+
+"file movnt.f90, line 18, bb5":	
+	ret void
+}
diff --git a/libclamav/c++/llvm/test/CodeGen/X86/2010-02-15-ImplicitDefBug.ll b/libclamav/c++/llvm/test/CodeGen/X86/2010-02-15-ImplicitDefBug.ll
new file mode 100644
index 0000000..c429172
--- /dev/null
+++ b/libclamav/c++/llvm/test/CodeGen/X86/2010-02-15-ImplicitDefBug.ll
@@ -0,0 +1,80 @@
+; RUN: llc < %s > %t
+; PR6300
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32"
+target triple = "i386-pc-linux-gnu"
+
+; When the "154" loops back onto itself, it defines a register after using it.
+; The first value of the register is implicit-def.
+
+%"struct location_chain_def" = type { %"struct location_chain_def"*, %"struct rtx_def"*, %"struct rtx_def"*, i32 }
+%"struct real_value" = type { i32, [5 x i32] }
+%"struct rtx_def" = type { i16, i8, i8, %"union u" }
+%"union u" = type { %"struct real_value" }
+
+define i32 @variable_union(i8** nocapture %slot, i8* nocapture %data) nounwind {
+entry:
+  br i1 undef, label %"4.thread", label %"3"
+
+"4.thread":                                       ; preds = %entry
+  unreachable
+
+"3":                                              ; preds = %entry
+  br i1 undef, label %"19", label %"20"
+
+"19":                                             ; preds = %"3"
+  unreachable
+
+"20":                                             ; preds = %"3"
+  br i1 undef, label %"56.preheader", label %dv_onepart_p.exit
+
+dv_onepart_p.exit:                                ; preds = %"20"
+  unreachable
+
+"56.preheader":                                   ; preds = %"20"
+  br label %"56"
+
+"50":                                             ; preds = %"57"
+  br label %"56"
+
+"56":                                             ; preds = %"50", %"56.preheader"
+  br i1 undef, label %"57", label %"58"
+
+"57":                                             ; preds = %"56"
+  br i1 undef, label %"50", label %"58"
+
+"58":                                             ; preds = %"57", %"56"
+  br i1 undef, label %"62", label %"63"
+
+"62":                                             ; preds = %"58"
+  unreachable
+
+"63":                                             ; preds = %"58"
+  br i1 undef, label %"67", label %"66"
+
+"66":                                             ; preds = %"63"
+  br label %"67"
+
+"67":                                             ; preds = %"66", %"63"
+  br label %"68"
+
+"68":                                             ; preds = %"161", %"67"
+  br i1 undef, label %"153", label %"161"
+
+"153":                                            ; preds = %"68"
+  br i1 undef, label %"160", label %bb.nph46
+
+bb.nph46:                                         ; preds = %"153"
+  br label %"154"
+
+"154":                                            ; preds = %"154", %bb.nph46
+  %0 = phi %"struct location_chain_def"** [ undef, %bb.nph46 ], [ %1, %"154" ] ; <%"struct location_chain_def"**> [#uses=1]
+  %1 = bitcast i8* undef to %"struct location_chain_def"** ; <%"struct location_chain_def"**> [#uses=1]
+  store %"struct location_chain_def"* undef, %"struct location_chain_def"** %0, align 4
+  br i1 undef, label %"160", label %"154"
+
+"160":                                            ; preds = %"154", %"153"
+  br label %"161"
+
+"161":                                            ; preds = %"160", %"68"
+  br label %"68"
+}
diff --git a/libclamav/c++/llvm/test/CodeGen/X86/2010-02-19-TailCallRetAddrBug.ll b/libclamav/c++/llvm/test/CodeGen/X86/2010-02-19-TailCallRetAddrBug.ll
new file mode 100644
index 0000000..eb21dc2
--- /dev/null
+++ b/libclamav/c++/llvm/test/CodeGen/X86/2010-02-19-TailCallRetAddrBug.ll
@@ -0,0 +1,55 @@
+; RUN: llc -mtriple=i386-apple-darwin -tailcallopt < %s | FileCheck %s
+; Check that lowered argumens do not overwrite the return address before it is moved.
+; Bug 6225
+;
+; If a call is a fastcc tail call and tail call optimization is enabled, the
+; caller frame is replaced by the callee frame. This can require that arguments are 
+; placed on the former return address stack slot. Special care needs to be taken
+; taken that the return address is moved / or stored in a register before
+; lowering of arguments potentially overwrites the value.
+;
+; Move return address (76(%esp)) to a temporary register (%ebp)
+; CHECK: movl 76(%esp), %ebp
+; Overwrite return addresss
+; CHECK: movl %ecx, 76(%esp)
+; Move return address from temporary register (%ebp) to new stack location (60(%esp))
+; CHECK: movl %ebp, 60(%esp)
+
+%tupl_p = type [9 x i32]*
+
+declare fastcc void @l297(i32 %r10, i32 %r9, i32 %r8, i32 %r7, i32 %r6, i32 %r5, i32 %r3, i32 %r2) noreturn nounwind
+declare fastcc void @l298(i32 %r10, i32 %r9, i32 %r4) noreturn nounwind
+
+define fastcc void @l186(%tupl_p %r1) noreturn nounwind {
+entry:
+  %ptr1 = getelementptr %tupl_p %r1, i32 0, i32 0
+  %r2 = load i32* %ptr1
+  %ptr3 = getelementptr %tupl_p %r1, i32 0, i32 1
+  %r3 = load i32* %ptr3
+  %ptr5 = getelementptr %tupl_p %r1, i32 0, i32 2
+  %r4 = load i32* %ptr5
+  %ptr7 = getelementptr %tupl_p %r1, i32 0, i32 3
+  %r5 = load i32* %ptr7
+  %ptr9 = getelementptr %tupl_p %r1, i32 0, i32 4
+  %r6 = load i32* %ptr9
+  %ptr11 = getelementptr %tupl_p %r1, i32 0, i32 5
+  %r7 = load i32* %ptr11
+  %ptr13 = getelementptr %tupl_p %r1, i32 0, i32 6
+  %r8 = load i32* %ptr13
+  %ptr15 = getelementptr %tupl_p %r1, i32 0, i32 7
+  %r9 = load i32* %ptr15
+  %ptr17 = getelementptr %tupl_p %r1, i32 0, i32 8
+  %r10 = load i32* %ptr17
+  %cond = icmp eq i32 %r10, 3
+  br i1 %cond, label %true, label %false
+
+true:
+  tail call fastcc void @l297(i32 %r10, i32 %r9, i32 %r8, i32 %r7, i32 %r6, i32 %r5, i32 %r3, i32 %r2) noreturn nounwind
+  ret void
+
+false:
+  tail call fastcc void @l298(i32 %r10, i32 %r9, i32 %r4) noreturn nounwind
+  ret void
+}
+
+
diff --git a/libclamav/c++/llvm/test/CodeGen/X86/2010-02-23-DAGCombineBug.ll b/libclamav/c++/llvm/test/CodeGen/X86/2010-02-23-DAGCombineBug.ll
new file mode 100644
index 0000000..6a58e9e
--- /dev/null
+++ b/libclamav/c++/llvm/test/CodeGen/X86/2010-02-23-DAGCombineBug.ll
@@ -0,0 +1,18 @@
+; RUN: llc < %s -march=x86 | FileCheck %s
+
+define i32* @t() nounwind optsize ssp {
+entry:
+; CHECK: t:
+; CHECK: testl %eax, %eax
+; CHECK: js
+  %cmp = icmp slt i32 undef, 0                    ; <i1> [#uses=1]
+  %outsearch.0 = select i1 %cmp, i1 false, i1 true ; <i1> [#uses=1]
+  br i1 %outsearch.0, label %if.then27, label %if.else29
+
+if.then27:                                        ; preds = %entry
+  ret i32* undef
+
+if.else29:                                        ; preds = %entry
+  unreachable
+}
+
diff --git a/libclamav/c++/llvm/test/CodeGen/X86/2010-02-23-DIV8rDefinesAX.ll b/libclamav/c++/llvm/test/CodeGen/X86/2010-02-23-DIV8rDefinesAX.ll
new file mode 100644
index 0000000..8543c80
--- /dev/null
+++ b/libclamav/c++/llvm/test/CodeGen/X86/2010-02-23-DIV8rDefinesAX.ll
@@ -0,0 +1,20 @@
+; RUN: llc < %s
+; PR6374
+;
+; This test produces a DIV8r instruction and uses %AX instead of %AH and %AL.
+; The DIV8r must have the right imp-defs for that to work.
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
+target triple = "x86_64-apple-darwin10.0.0"
+
+%struct._i386_state = type { %union.anon }
+%union.anon = type { [0 x i8] }
+
+define void @i386_aam(%struct._i386_state* nocapture %cpustate) nounwind ssp {
+entry:
+  %call = tail call fastcc signext i8 @FETCH()    ; <i8> [#uses=1]
+  %rem = urem i8 0, %call                         ; <i8> [#uses=1]
+  store i8 %rem, i8* undef
+  ret void
+}
+
+declare fastcc signext i8 @FETCH() nounwind readnone ssp
diff --git a/libclamav/c++/llvm/test/CodeGen/X86/2010-02-23-RematImplicitSubreg.ll b/libclamav/c++/llvm/test/CodeGen/X86/2010-02-23-RematImplicitSubreg.ll
new file mode 100644
index 0000000..4a26ba0
--- /dev/null
+++ b/libclamav/c++/llvm/test/CodeGen/X86/2010-02-23-RematImplicitSubreg.ll
@@ -0,0 +1,49 @@
+; RUN: llc < %s
+; PR6372
+;
+; This test produces a move instruction with an implicitly defined super-register:
+;
+;   %DL<def> = MOV8rr %reg1038<kill>, %RDX<imp-def>
+;
+; When %DL is rematerialized, we must remember to update live intervals for
+; sub-registers %DX and %EDX.
+
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
+target triple = "x86_64-apple-darwin10.0.0"
+
+define noalias i8* @foo() nounwind ssp {
+entry:
+  br i1 undef, label %for.end, label %for.body
+
+for.body:                                         ; preds = %if.end40, %entry
+  %tmp6 = load i8* undef, align 2                 ; <i8> [#uses=3]
+  %conv11 = sext i8 %tmp6 to i64                  ; <i64> [#uses=1]
+  %cmp15 = icmp slt i64 %conv11, undef            ; <i1> [#uses=1]
+  br i1 %cmp15, label %if.end, label %if.then
+
+if.then:                                          ; preds = %for.body
+  %conv18 = sext i8 %tmp6 to i32                  ; <i32> [#uses=1]
+  %call = tail call i32 (...)* @invalid(i32 0, i32 0, i32 %conv18) nounwind ; <i32> [#uses=0]
+  br label %if.end
+
+if.end:                                           ; preds = %if.then, %for.body
+  %index.0 = phi i8 [ 0, %if.then ], [ %tmp6, %for.body ] ; <i8> [#uses=1]
+  store i8 %index.0, i8* undef
+  %tmp24 = load i8* undef                         ; <i8> [#uses=2]
+  br i1 undef, label %if.end40, label %if.then36
+
+if.then36:                                        ; preds = %if.end
+  %conv38 = sext i8 %tmp24 to i32                 ; <i32> [#uses=1]
+  %call39 = tail call i32 (...)* @invalid(i32 0, i32 0, i32 %conv38) nounwind ; <i32> [#uses=0]
+  br label %if.end40
+
+if.end40:                                         ; preds = %if.then36, %if.end
+  %index.1 = phi i8 [ 0, %if.then36 ], [ %tmp24, %if.end ] ; <i8> [#uses=1]
+  store i8 %index.1, i8* undef
+  br i1 false, label %for.body, label %for.end
+
+for.end:                                          ; preds = %if.end40, %entry
+  ret i8* undef
+}
+
+declare i32 @invalid(...)
diff --git a/libclamav/c++/llvm/test/CodeGen/X86/2010-02-23-SingleDefPhiJoin.ll b/libclamav/c++/llvm/test/CodeGen/X86/2010-02-23-SingleDefPhiJoin.ll
new file mode 100644
index 0000000..aeed401
--- /dev/null
+++ b/libclamav/c++/llvm/test/CodeGen/X86/2010-02-23-SingleDefPhiJoin.ll
@@ -0,0 +1,146 @@
+; RUN: llc < %s
+; PR6363
+;
+; This test case creates a phi join register with a single definition. The other
+; predecessor blocks are implicit-def.
+;
+; If LiveIntervalAnalysis fails to recognize this as a phi join, the coalescer
+; will detect an infinity valno loop.
+;
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
+target triple = "x86_64-unknown-linux-gnu"
+
+define i32 @decode(i8* nocapture %input, i32 %offset, i8* nocapture %output) nounwind {
+entry:
+  br i1 undef, label %meshBB86, label %meshBB102
+
+bb:                                               ; preds = %meshBB106, %meshBB102
+  br i1 false, label %bb9, label %meshBB90
+
+bb.nph:                                           ; preds = %meshBB90
+  br label %meshBB114
+
+bb.nph.fragment:                                  ; preds = %meshBB114
+  br label %meshBB118
+
+bb1.fragment:                                     ; preds = %meshBB118
+  br i1 false, label %bb2, label %bb3
+
+bb2:                                              ; preds = %bb1.fragment
+  br label %meshBB74
+
+bb2.fragment15:                                   ; preds = %meshBB74
+  br label %meshBB98
+
+bb3:                                              ; preds = %bb1.fragment
+  br i1 undef, label %meshBB, label %meshBB102
+
+bb4:                                              ; preds = %meshBB
+  br label %meshBB118
+
+bb4.fragment:                                     ; preds = %meshBB118
+  br label %meshBB82
+
+bb5:                                              ; preds = %meshBB102, %meshBB82
+  br i1 false, label %bb6, label %bb7
+
+bb6:                                              ; preds = %bb5
+  br label %bb7
+
+bb7:                                              ; preds = %meshBB98, %bb6, %bb5
+  br label %meshBB114
+
+bb7.fragment:                                     ; preds = %meshBB114
+  br i1 undef, label %meshBB74, label %bb9
+
+bb9:                                              ; preds = %bb7.fragment, %bb
+  br label %bb1.i23
+
+bb1.i23:                                          ; preds = %meshBB110, %bb9
+  br i1 undef, label %meshBB106, label %meshBB110
+
+skip_to_newline.exit26:                           ; preds = %meshBB106
+  br label %meshBB86
+
+skip_to_newline.exit26.fragment:                  ; preds = %meshBB86
+  br i1 false, label %meshBB90, label %meshBB106
+
+bb11.fragment:                                    ; preds = %meshBB90, %meshBB86
+  br label %meshBB122
+
+bb1.i:                                            ; preds = %meshBB122, %meshBB
+  %ooffset.2.lcssa.phi.SV.phi203 = phi i32 [ 0, %meshBB122 ], [ %ooffset.2.lcssa.phi.SV.phi233, %meshBB ] ; <i32> [#uses=1]
+  br label %meshBB98
+
+bb1.i.fragment:                                   ; preds = %meshBB98
+  br i1 undef, label %meshBB78, label %meshBB
+
+skip_to_newline.exit:                             ; preds = %meshBB78
+  br i1 undef, label %bb12, label %meshBB110
+
+bb12:                                             ; preds = %skip_to_newline.exit
+  br label %meshBB94
+
+bb12.fragment:                                    ; preds = %meshBB94
+  br i1 false, label %bb13, label %meshBB78
+
+bb13:                                             ; preds = %bb12.fragment
+  br label %meshBB82
+
+bb13.fragment:                                    ; preds = %meshBB82
+  br i1 undef, label %meshBB94, label %meshBB122
+
+bb14:                                             ; preds = %meshBB94
+  ret i32 %ooffset.2.lcssa.phi.SV.phi250
+
+bb15:                                             ; preds = %meshBB122, %meshBB110, %meshBB78
+  unreachable
+
+meshBB:                                           ; preds = %bb1.i.fragment, %bb3
+  %ooffset.2.lcssa.phi.SV.phi233 = phi i32 [ undef, %bb3 ], [ %ooffset.2.lcssa.phi.SV.phi209, %bb1.i.fragment ] ; <i32> [#uses=1]
+  br i1 undef, label %bb1.i, label %bb4
+
+meshBB74:                                         ; preds = %bb7.fragment, %bb2
+  br i1 false, label %meshBB118, label %bb2.fragment15
+
+meshBB78:                                         ; preds = %bb12.fragment, %bb1.i.fragment
+  %ooffset.2.lcssa.phi.SV.phi239 = phi i32 [ %ooffset.2.lcssa.phi.SV.phi209, %bb1.i.fragment ], [ %ooffset.2.lcssa.phi.SV.phi250, %bb12.fragment ] ; <i32> [#uses=1]
+  br i1 false, label %bb15, label %skip_to_newline.exit
+
+meshBB82:                                         ; preds = %bb13, %bb4.fragment
+  br i1 false, label %bb5, label %bb13.fragment
+
+meshBB86:                                         ; preds = %skip_to_newline.exit26, %entry
+  br i1 undef, label %skip_to_newline.exit26.fragment, label %bb11.fragment
+
+meshBB90:                                         ; preds = %skip_to_newline.exit26.fragment, %bb
+  br i1 false, label %bb11.fragment, label %bb.nph
+
+meshBB94:                                         ; preds = %bb13.fragment, %bb12
+  %ooffset.2.lcssa.phi.SV.phi250 = phi i32 [ 0, %bb13.fragment ], [ %ooffset.2.lcssa.phi.SV.phi239, %bb12 ] ; <i32> [#uses=2]
+  br i1 false, label %bb12.fragment, label %bb14
+
+meshBB98:                                         ; preds = %bb1.i, %bb2.fragment15
+  %ooffset.2.lcssa.phi.SV.phi209 = phi i32 [ undef, %bb2.fragment15 ], [ %ooffset.2.lcssa.phi.SV.phi203, %bb1.i ] ; <i32> [#uses=2]
+  br i1 undef, label %bb1.i.fragment, label %bb7
+
+meshBB102:                                        ; preds = %bb3, %entry
+  br i1 undef, label %bb5, label %bb
+
+meshBB106:                                        ; preds = %skip_to_newline.exit26.fragment, %bb1.i23
+  br i1 undef, label %bb, label %skip_to_newline.exit26
+
+meshBB110:                                        ; preds = %skip_to_newline.exit, %bb1.i23
+  br i1 false, label %bb15, label %bb1.i23
+
+meshBB114:                                        ; preds = %bb7, %bb.nph
+  %meshStackVariable115.phi = phi i32 [ 19, %bb7 ], [ 8, %bb.nph ] ; <i32> [#uses=0]
+  br i1 undef, label %bb.nph.fragment, label %bb7.fragment
+
+meshBB118:                                        ; preds = %meshBB74, %bb4, %bb.nph.fragment
+  %meshCmp121 = icmp eq i32 undef, 10             ; <i1> [#uses=1]
+  br i1 %meshCmp121, label %bb4.fragment, label %bb1.fragment
+
+meshBB122:                                        ; preds = %bb13.fragment, %bb11.fragment
+  br i1 false, label %bb1.i, label %bb15
+}
diff --git a/libclamav/c++/llvm/test/CodeGen/X86/2010-03-04-Mul8Bug.ll b/libclamav/c++/llvm/test/CodeGen/X86/2010-03-04-Mul8Bug.ll
new file mode 100644
index 0000000..48e75e9
--- /dev/null
+++ b/libclamav/c++/llvm/test/CodeGen/X86/2010-03-04-Mul8Bug.ll
@@ -0,0 +1,25 @@
+; RUN: llc < %s
+; PR6489
+;
+; This test case produces a MUL8 instruction and then tries to read the result
+; from the AX register instead of AH/AL. That confuses live interval analysis.
+;
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
+target triple = "x86_64-apple-darwin10.0.0"
+
+define void @func_56(i64 %p_57, i32*** %p_58) nounwind ssp {
+for.end:
+  %conv49 = trunc i32 undef to i8                 ; <i8> [#uses=1]
+  %div.i = udiv i8 %conv49, 5                     ; <i8> [#uses=1]
+  %conv51 = zext i8 %div.i to i32                 ; <i32> [#uses=1]
+  %call55 = call i32 @qux(i32 undef, i32 -2) nounwind ; <i32> [#uses=1]
+  %rem.i = urem i32 %call55, -1                   ; <i32> [#uses=1]
+  %cmp57 = icmp uge i32 %conv51, %rem.i           ; <i1> [#uses=1]
+  %conv58 = zext i1 %cmp57 to i32                 ; <i32> [#uses=1]
+  %call85 = call i32 @func_35(i32*** undef, i32 undef, i32 %conv58, i32 1247, i32 0) nounwind ; <i32> [#uses=0]
+  ret void
+}
+
+declare i32 @func_35(i32***, i32, i32, i32, i32)
+
+declare i32 @qux(i32, i32)
diff --git a/libclamav/c++/llvm/test/CodeGen/X86/2010-03-05-ConstantFoldCFG.ll b/libclamav/c++/llvm/test/CodeGen/X86/2010-03-05-ConstantFoldCFG.ll
new file mode 100644
index 0000000..5de1966
--- /dev/null
+++ b/libclamav/c++/llvm/test/CodeGen/X86/2010-03-05-ConstantFoldCFG.ll
@@ -0,0 +1,42 @@
+; RUN: llc < %s -verify-machineinstrs
+;
+; When BRCOND is constant-folded to BR, make sure that PHI nodes don't get
+; spurious operands when the CFG is trimmed.
+;
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
+target triple = "x86_64-apple-darwin10.2"
+
+define fastcc void @_ZSt16__introsort_loopIPdl17less_than_functorEvT_S2_T0_T1_(double* %__first, double* %__last, i64 %__depth_limit) nounwind ssp {
+entry:
+  br i1 undef, label %bb1, label %bb2
+
+bb1:                                              ; preds = %entry
+  ret void
+
+bb2:                                              ; preds = %entry
+  br label %bb2.outer.i
+
+bb2.outer.i:                                      ; preds = %bb9.i, %bb2
+  br i1 undef, label %bb1.i, label %bb5.preheader.i
+
+bb1.i:                                            ; preds = %bb1.i, %bb2.outer.i
+  %indvar5.i = phi i64 [ %tmp, %bb1.i ], [ 0, %bb2.outer.i ] ; <i64> [#uses=1]
+  %tmp = add i64 %indvar5.i, 1                    ; <i64> [#uses=2]
+  %scevgep.i = getelementptr double* undef, i64 %tmp ; <double*> [#uses=0]
+  br i1 undef, label %bb1.i, label %bb5.preheader.i
+
+bb5.preheader.i:                                  ; preds = %bb1.i, %bb2.outer.i
+  br label %bb5.i
+
+bb5.i:                                            ; preds = %bb5.i, %bb5.preheader.i
+  br i1 undef, label %bb5.i, label %bb7.i6
+
+bb7.i6:                                           ; preds = %bb5.i
+  br i1 undef, label %bb9.i, label %_ZSt21__unguarded_partitionIPdd17less_than_functorET_S2_S2_T0_T1_.exit
+
+bb9.i:                                            ; preds = %bb7.i6
+  br label %bb2.outer.i
+
+_ZSt21__unguarded_partitionIPdd17less_than_functorET_S2_S2_T0_T1_.exit: ; preds = %bb7.i6
+  unreachable
+}
diff --git a/libclamav/c++/llvm/test/CodeGen/X86/2010-03-05-EFLAGS-Redef.ll b/libclamav/c++/llvm/test/CodeGen/X86/2010-03-05-EFLAGS-Redef.ll
new file mode 100644
index 0000000..3cca10e
--- /dev/null
+++ b/libclamav/c++/llvm/test/CodeGen/X86/2010-03-05-EFLAGS-Redef.ll
@@ -0,0 +1,49 @@
+; RUN: llc < %s -verify-machineinstrs
+;
+; This test case is transformed into a single basic block by the machine
+; branch folding pass. That makes a complete mess of the %EFLAGS liveness, but
+; we don't care about liveness this late anyway.
+
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
+target triple = "x86_64-apple-darwin10.2"
+
+define i32 @main(i32 %argc, i8** nocapture %argv) ssp {
+entry:
+  br i1 undef, label %bb, label %bb2
+
+bb:                                               ; preds = %entry
+  br label %bb2
+
+bb2:                                              ; preds = %bb, %entry
+  br i1 undef, label %bb3, label %bb5
+
+bb3:                                              ; preds = %bb2
+  br label %bb5
+
+bb5:                                              ; preds = %bb3, %bb2
+  br i1 undef, label %bb.nph239, label %bb8
+
+bb.nph239:                                        ; preds = %bb5
+  unreachable
+
+bb8:                                              ; preds = %bb5
+  br i1 undef, label %bb.nph237, label %bb47
+
+bb.nph237:                                        ; preds = %bb8
+  unreachable
+
+bb47:                                             ; preds = %bb8
+  br i1 undef, label %bb49, label %bb48
+
+bb48:                                             ; preds = %bb47
+  unreachable
+
+bb49:                                             ; preds = %bb47
+  br i1 undef, label %bb51, label %bb50
+
+bb50:                                             ; preds = %bb49
+  ret i32 0
+
+bb51:                                             ; preds = %bb49
+  ret i32 0
+}
diff --git a/libclamav/c++/llvm/test/CodeGen/X86/addr-label-difference.ll b/libclamav/c++/llvm/test/CodeGen/X86/addr-label-difference.ll
index 547d6b5..be0908a 100644
--- a/libclamav/c++/llvm/test/CodeGen/X86/addr-label-difference.ll
+++ b/libclamav/c++/llvm/test/CodeGen/X86/addr-label-difference.ll
@@ -9,14 +9,18 @@ target triple = "i386-apple-darwin10.0"
 
 define void @test(i32 %i) nounwind ssp {
 entry:
+  call void @test(i32 1)
   br label %foo
 
-foo:                                              ; preds = %indirectgoto, %indirectgoto, %indirectgoto, %indirectgoto, %indirectgoto
+foo:
+  call void @test(i32 1)
   br label %bar
 
-bar:                                              ; preds = %foo, %indirectgoto
+bar:
+  call void @test(i32 1)
   br label %hack
 
-hack:                                             ; preds = %bar, %indirectgoto
+hack:
+  call void @test(i32 1)
   ret void
 }
diff --git a/libclamav/c++/llvm/test/CodeGen/X86/and-or-fold.ll b/libclamav/c++/llvm/test/CodeGen/X86/and-or-fold.ll
index 7733b8a..836b5f1 100644
--- a/libclamav/c++/llvm/test/CodeGen/X86/and-or-fold.ll
+++ b/libclamav/c++/llvm/test/CodeGen/X86/and-or-fold.ll
@@ -1,14 +1,26 @@
-; RUN: llc < %s -march=x86 | grep and | count 1
+; RUN: llc < %s -mtriple=i686-apple-darwin | FileCheck -check-prefix=DARWIN %s
+; RUN: opt < %s -O2 | llc -mtriple=x86_64-apple-darwin | FileCheck -check-prefix=DARWIN-OPT %s
 
 ; The dag combiner should fold together (x&127)|(y&16711680) -> (x|y)&c1
 ; in this case.
 
-define i32 @test6(i32 %x, i16 %y) {
-        %tmp1 = zext i16 %y to i32              ; <i32> [#uses=1]
-        %tmp2 = and i32 %tmp1, 127              ; <i32> [#uses=1]
-        %tmp4 = shl i32 %x, 16          ; <i32> [#uses=1]
-        %tmp5 = and i32 %tmp4, 16711680         ; <i32> [#uses=1]
-        %tmp6 = or i32 %tmp2, %tmp5             ; <i32> [#uses=1]
-        ret i32 %tmp6
+define i32 @test1(i32 %x, i16 %y) {
+  %tmp1 = zext i16 %y to i32
+  %tmp2 = and i32 %tmp1, 127
+  %tmp4 = shl i32 %x, 16
+  %tmp5 = and i32 %tmp4, 16711680
+  %tmp6 = or i32 %tmp2, %tmp5
+  ret i32 %tmp6
+; DARWIN: andl $16711807, %eax
 }
 
+; <rdar://problem/7529774> The optimizer shouldn't fold this into (and (or, C),  D)
+; if (C & D) == 0
+define i64 @test2(i64 %x) nounwind readnone ssp {
+entry:
+  %tmp1 = and i64 %x, 123127
+  %tmp2 = or i64 %tmp1, 3
+  ret i64 %tmp2
+; DARWIN-OPT:       andq $123124
+; DARWIN-OPT-NEXT:  leaq 3
+}
diff --git a/libclamav/c++/llvm/test/CodeGen/X86/bswap-inline-asm.ll b/libclamav/c++/llvm/test/CodeGen/X86/bswap-inline-asm.ll
index 5bf58fa..2b70193 100644
--- a/libclamav/c++/llvm/test/CodeGen/X86/bswap-inline-asm.ll
+++ b/libclamav/c++/llvm/test/CodeGen/X86/bswap-inline-asm.ll
@@ -1,17 +1,80 @@
 ; RUN: llc < %s -march=x86-64 > %t
 ; RUN: not grep APP %t
-; RUN: grep bswapq %t | count 2
-; RUN: grep bswapl %t | count 1
+; RUN: FileCheck %s < %t
 
+; CHECK: foo:
+; CHECK: bswapq
 define i64 @foo(i64 %x) nounwind {
 	%asmtmp = tail call i64 asm "bswap $0", "=r,0,~{dirflag},~{fpsr},~{flags}"(i64 %x) nounwind
 	ret i64 %asmtmp
 }
+
+; CHECK: bar:
+; CHECK: bswapq
 define i64 @bar(i64 %x) nounwind {
 	%asmtmp = tail call i64 asm "bswapq ${0:q}", "=r,0,~{dirflag},~{fpsr},~{flags}"(i64 %x) nounwind
 	ret i64 %asmtmp
 }
+
+; CHECK: pen:
+; CHECK: bswapl
 define i32 @pen(i32 %x) nounwind {
 	%asmtmp = tail call i32 asm "bswapl ${0:q}", "=r,0,~{dirflag},~{fpsr},~{flags}"(i32 %x) nounwind
 	ret i32 %asmtmp
 }
+
+; CHECK: s16:
+; CHECK: rolw    $8,
+define zeroext i16 @s16(i16 zeroext %x) nounwind {
+  %asmtmp = tail call i16 asm "rorw $$8, ${0:w}", "=r,0,~{dirflag},~{fpsr},~{flags},~{cc}"(i16 %x) nounwind
+  ret i16 %asmtmp
+}
+
+; CHECK: t16:
+; CHECK: rolw    $8,
+define zeroext i16 @t16(i16 zeroext %x) nounwind {
+  %asmtmp = tail call i16 asm "rorw $$8, ${0:w}", "=r,0,~{cc},~{dirflag},~{fpsr},~{flags}"(i16 %x) nounwind
+  ret i16 %asmtmp
+}
+
+; CHECK: u16:
+; CHECK: rolw    $8,
+define zeroext i16 @u16(i16 zeroext %x) nounwind {
+  %asmtmp = tail call i16 asm "rolw $$8, ${0:w}", "=r,0,~{dirflag},~{fpsr},~{flags},~{cc}"(i16 %x) nounwind
+  ret i16 %asmtmp
+}
+
+; CHECK: v16:
+; CHECK: rolw    $8,
+define zeroext i16 @v16(i16 zeroext %x) nounwind {
+  %asmtmp = tail call i16 asm "rolw $$8, ${0:w}", "=r,0,~{cc},~{dirflag},~{fpsr},~{flags}"(i16 %x) nounwind
+  ret i16 %asmtmp
+}
+
+; CHECK: s32:
+; CHECK: bswapl
+define i32 @s32(i32 %x) nounwind {
+  %asmtmp = tail call i32 asm "bswap $0", "=r,0,~{dirflag},~{fpsr},~{flags}"(i32 %x) nounwind
+  ret i32 %asmtmp
+}
+
+; CHECK: t32:
+; CHECK: bswapl
+define i32 @t32(i32 %x) nounwind {
+  %asmtmp = tail call i32 asm "bswap $0", "=r,0,~{dirflag},~{flags},~{fpsr}"(i32 %x) nounwind
+  ret i32 %asmtmp
+}
+
+; CHECK: s64:
+; CHECK: bswapq
+define i64 @s64(i64 %x) nounwind {
+  %asmtmp = tail call i64 asm "bswap ${0:q}", "=r,0,~{dirflag},~{fpsr},~{flags}"(i64 %x) nounwind
+  ret i64 %asmtmp
+}
+
+; CHECK: t64:
+; CHECK: bswapq
+define i64 @t64(i64 %x) nounwind {
+  %asmtmp = tail call i64 asm "bswap ${0:q}", "=r,0,~{fpsr},~{dirflag},~{flags}"(i64 %x) nounwind
+  ret i64 %asmtmp
+}
diff --git a/libclamav/c++/llvm/test/CodeGen/X86/code_placement_eh.ll b/libclamav/c++/llvm/test/CodeGen/X86/code_placement_eh.ll
new file mode 100644
index 0000000..172d591
--- /dev/null
+++ b/libclamav/c++/llvm/test/CodeGen/X86/code_placement_eh.ll
@@ -0,0 +1,45 @@
+; RUN: llc < %s
+
+; CodePlacementOpt shouldn't try to modify this loop because
+; it involves EH edges.
+
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128-n8:16:32"
+target triple = "i386-apple-darwin10.0"
+
+define void @foo() {
+invcont5:
+  br label %bb15
+
+.noexc3:                                          ; preds = %bb15
+  br i1 undef, label %bb18.i5.i, label %bb15
+
+.noexc6.i.i:                                      ; preds = %bb18.i5.i
+  %tmp2021 = invoke float @cosf(float 0.000000e+00) readonly
+          to label %bb18.i5.i unwind label %lpad.i.i ; <float> [#uses=0]
+
+bb18.i5.i:                                        ; preds = %.noexc6.i.i, %bb51.i
+  %tmp2019 = invoke float @sinf(float 0.000000e+00) readonly
+          to label %.noexc6.i.i unwind label %lpad.i.i ; <float> [#uses=0]
+
+lpad.i.i:                                         ; preds = %bb18.i5.i, %.noexc6.i.i
+  %eh_ptr.i.i = call i8* @llvm.eh.exception()     ; <i8*> [#uses=1]
+  unreachable
+
+lpad59.i:                                         ; preds = %bb15
+  %eh_ptr60.i = call i8* @llvm.eh.exception()     ; <i8*> [#uses=1]
+  unreachable
+
+bb15:                                             ; preds = %.noexc3, %invcont5
+  invoke fastcc void @_ZN28btHashedOverlappingPairCacheC2Ev()
+          to label %.noexc3 unwind label %lpad59.i
+}
+
+declare i8* @llvm.eh.exception() nounwind readonly
+
+declare i32 @llvm.eh.selector(i8*, i8*, ...) nounwind
+
+declare float @sinf(float) readonly
+
+declare float @cosf(float) readonly
+
+declare fastcc void @_ZN28btHashedOverlappingPairCacheC2Ev() align 2
diff --git a/libclamav/c++/llvm/test/CodeGen/X86/crash.ll b/libclamav/c++/llvm/test/CodeGen/X86/crash.ll
new file mode 100644
index 0000000..1e13046
--- /dev/null
+++ b/libclamav/c++/llvm/test/CodeGen/X86/crash.ll
@@ -0,0 +1,20 @@
+; RUN: llc -march=x86 %s -o -
+; RUN: llc -march=x86-64 %s -o -
+
+; PR6497
+
+; Chain and flag folding issues.
+define i32 @test1() nounwind ssp {
+entry:
+  %tmp5.i = volatile load i32* undef              ; <i32> [#uses=1]
+  %conv.i = zext i32 %tmp5.i to i64               ; <i64> [#uses=1]
+  %tmp12.i = volatile load i32* undef             ; <i32> [#uses=1]
+  %conv13.i = zext i32 %tmp12.i to i64            ; <i64> [#uses=1]
+  %shl.i = shl i64 %conv13.i, 32                  ; <i64> [#uses=1]
+  %or.i = or i64 %shl.i, %conv.i                  ; <i64> [#uses=1]
+  %add16.i = add i64 %or.i, 256                   ; <i64> [#uses=1]
+  %shr.i = lshr i64 %add16.i, 8                   ; <i64> [#uses=1]
+  %conv19.i = trunc i64 %shr.i to i32             ; <i32> [#uses=1]
+  volatile store i32 %conv19.i, i32* undef
+  ret i32 undef
+}
diff --git a/libclamav/c++/llvm/test/CodeGen/X86/critical-edge-split.ll b/libclamav/c++/llvm/test/CodeGen/X86/critical-edge-split.ll
index 4fe554d..f29cbf3 100644
--- a/libclamav/c++/llvm/test/CodeGen/X86/critical-edge-split.ll
+++ b/libclamav/c++/llvm/test/CodeGen/X86/critical-edge-split.ll
@@ -1,4 +1,4 @@
-; RUN: llc < %s -mtriple=i386-apple-darwin -tailcallopt=false -stats -info-output-file - | grep asm-printer | grep 31
+; RUN: llc < %s -mtriple=i386-apple-darwin -stats -info-output-file - | grep asm-printer | grep 29
 
 	%CC = type { %Register }
 	%II = type { %"struct.XX::II::$_74" }
diff --git a/libclamav/c++/llvm/test/CodeGen/X86/global-sections.ll b/libclamav/c++/llvm/test/CodeGen/X86/global-sections.ll
index 1a7b577..d79c56b 100644
--- a/libclamav/c++/llvm/test/CodeGen/X86/global-sections.ll
+++ b/libclamav/c++/llvm/test/CodeGen/X86/global-sections.ll
@@ -100,7 +100,7 @@
 
 @G8 = constant [4 x i16] [ i16 1, i16 2, i16 3, i16 0 ]
 
-; DARWIN:	.section	__TEXT,__ustring
+; DARWIN:	.section	__TEXT,__const
 ; DARWIN:	.globl _G8
 ; DARWIN: _G8:
 
@@ -110,7 +110,6 @@
 
 @G9 = constant [4 x i32] [ i32 1, i32 2, i32 3, i32 0 ]
 
-; DARWIN:	.section        __TEXT,__const
 ; DARWIN:	.globl _G9
 ; DARWIN: _G9:
 
diff --git a/libclamav/c++/llvm/test/CodeGen/X86/ins_subreg_coalesce-3.ll b/libclamav/c++/llvm/test/CodeGen/X86/ins_subreg_coalesce-3.ll
index 627edc5..8c1c409 100644
--- a/libclamav/c++/llvm/test/CodeGen/X86/ins_subreg_coalesce-3.ll
+++ b/libclamav/c++/llvm/test/CodeGen/X86/ins_subreg_coalesce-3.ll
@@ -1,4 +1,4 @@
-; RUN: llc < %s -march=x86-64 | grep mov | count 5
+; RUN: llc < %s -march=x86-64 | grep mov | count 3
 
 	%struct.COMPOSITE = type { i8, i16, i16 }
 	%struct.FILE = type { i8*, i32, i32, i16, i16, %struct.__sbuf, i32, i8*, i32 (i8*)*, i32 (i8*, i8*, i32)*, i64 (i8*, i64, i32)*, i32 (i8*, i8*, i32)*, %struct.__sbuf, %struct.__sFILEX*, i32, [3 x i8], [1 x i8], %struct.__sbuf, i32, i64 }
diff --git a/libclamav/c++/llvm/test/CodeGen/X86/licm-symbol.ll b/libclamav/c++/llvm/test/CodeGen/X86/licm-symbol.ll
new file mode 100644
index 0000000..d61bbfc
--- /dev/null
+++ b/libclamav/c++/llvm/test/CodeGen/X86/licm-symbol.ll
@@ -0,0 +1,39 @@
+; RUN: llc < %s | FileCheck %s
+
+; MachineLICM should be able to hoist the sF reference out of the loop.
+
+; CHECK: pushl %esi
+; CHECK: subl  $8, %esp
+; CHECK: movl  $176, %esi
+; CHECK: addl  L___sF$non_lazy_ptr, %esi
+; CHECK: .align  4, 0x90
+
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128-n8:16:32"
+target triple = "i386-apple-darwin8"
+
+%struct.FILE = type { i8*, i32, i32, i16, i16, %struct.__sbuf, i32, i8*, i32 (i8*)*, i32 (i8*, i8*, i32)*, i64 (i8*, i64, i32)*, i32 (i8*, i8*, i32)*, %struct.__sbuf, %struct.__sFILEX*, i32, [3 x i8], [1 x i8], %struct.__sbuf, i32, i64 }
+%struct.__sFILEX = type opaque
+%struct.__sbuf = type { i8*, i32 }
+%struct.gcov_ctr_summary = type { i32, i32, i64, i64, i64 }
+%struct.gcov_summary = type { i32, [1 x %struct.gcov_ctr_summary] }
+
+ at __sF = external global [0 x %struct.FILE]        ; <[0 x %struct.FILE]*> [#uses=1]
+
+declare i32 @fprintf(%struct.FILE* nocapture) nounwind
+
+define void @gcov_exit() nounwind {
+entry:
+  br label %bb151
+
+bb151:                                            ; preds = %bb59, %bb56, %bb14
+  br i1 undef, label %bb56, label %bb59
+
+bb56:                                             ; preds = %bb151
+  %t0 = call i32 (%struct.FILE*)* @fprintf(%struct.FILE* getelementptr inbounds ([0 x %struct.FILE]* @__sF, i32 0, i32 2)) nounwind
+  br label %bb151
+
+bb59:                                             ; preds = %bb151
+  %t1 = call i32 (%struct.FILE*)* @fprintf(%struct.FILE* getelementptr inbounds ([0 x %struct.FILE]* @__sF, i32 0, i32 2)) nounwind
+  br label %bb151
+}
+
diff --git a/libclamav/c++/llvm/test/CodeGen/X86/lsr-overflow.ll b/libclamav/c++/llvm/test/CodeGen/X86/lsr-overflow.ll
new file mode 100644
index 0000000..0b0214c
--- /dev/null
+++ b/libclamav/c++/llvm/test/CodeGen/X86/lsr-overflow.ll
@@ -0,0 +1,26 @@
+; RUN: llc < %s -march=x86-64 | FileCheck %s
+
+; The comparison uses the pre-inc value, which could lead LSR to
+; try to compute -INT64_MIN.
+
+; CHECK: movabsq $-9223372036854775808, %rax
+; CHECK: cmpq  %rax, %rbx
+; CHECK: sete  %al
+
+declare i64 @bar()
+
+define i1 @foo() nounwind {
+entry:
+  br label %for.cond.i
+
+for.cond.i:
+  %indvar = phi i64 [ 0, %entry ], [ %indvar.next, %for.cond.i ]
+  %t = call i64 @bar()
+  %indvar.next = add i64 %indvar, 1
+  %s = icmp ne i64 %indvar.next, %t
+  br i1 %s, label %for.cond.i, label %__ABContainsLabel.exit
+
+__ABContainsLabel.exit:
+  %cmp = icmp eq i64 %indvar, 9223372036854775807
+  ret i1 %cmp
+}
diff --git a/libclamav/c++/llvm/test/CodeGen/X86/lsr-reuse-trunc.ll b/libclamav/c++/llvm/test/CodeGen/X86/lsr-reuse-trunc.ll
new file mode 100644
index 0000000..d1d7144
--- /dev/null
+++ b/libclamav/c++/llvm/test/CodeGen/X86/lsr-reuse-trunc.ll
@@ -0,0 +1,59 @@
+; RUN: llc < %s -march=x86-64 | FileCheck %s
+
+; Full strength reduction wouldn't reduce register pressure, so LSR should
+; stick with indexing here.
+
+; CHECK: movaps        (%rsi,%rax,4), %xmm3
+; CHECK: movaps        %xmm3, (%rdi,%rax,4)
+; CHECK: addq  $4, %rax
+; CHECK: cmpl  %eax, (%rdx)
+; CHECK-NEXT: jg
+
+define void @vvfloorf(float* nocapture %y, float* nocapture %x, i32* nocapture %n) nounwind {
+entry:
+  %0 = load i32* %n, align 4
+  %1 = icmp sgt i32 %0, 0
+  br i1 %1, label %bb, label %return
+
+bb:
+  %indvar = phi i64 [ %indvar.next, %bb ], [ 0, %entry ]
+  %tmp = shl i64 %indvar, 2
+  %scevgep = getelementptr float* %y, i64 %tmp
+  %scevgep9 = bitcast float* %scevgep to <4 x float>*
+  %scevgep10 = getelementptr float* %x, i64 %tmp
+  %scevgep1011 = bitcast float* %scevgep10 to <4 x float>*
+  %2 = load <4 x float>* %scevgep1011, align 16
+  %3 = bitcast <4 x float> %2 to <4 x i32>
+  %4 = and <4 x i32> %3, <i32 2147483647, i32 2147483647, i32 2147483647, i32 2147483647>
+  %5 = bitcast <4 x i32> %4 to <4 x float>
+  %6 = and <4 x i32> %3, <i32 -2147483648, i32 -2147483648, i32 -2147483648, i32 -2147483648>
+  %7 = tail call <4 x float> @llvm.x86.sse.cmp.ps(<4 x float> %5, <4 x float> <float 8.388608e+06, float 8.388608e+06, float 8.388608e+06, float 8.388608e+06>, i8 5) nounwind
+  %tmp.i4 = bitcast <4 x float> %7 to <4 x i32>
+  %8 = xor <4 x i32> %tmp.i4, <i32 -1, i32 -1, i32 -1, i32 -1>
+  %9 = and <4 x i32> %8, <i32 1258291200, i32 1258291200, i32 1258291200, i32 1258291200>
+  %10 = or <4 x i32> %9, %6
+  %11 = bitcast <4 x i32> %10 to <4 x float>
+  %12 = fadd <4 x float> %2, %11
+  %13 = fsub <4 x float> %12, %11
+  %14 = tail call <4 x float> @llvm.x86.sse.cmp.ps(<4 x float> %2, <4 x float> %13, i8 1) nounwind
+  %15 = bitcast <4 x float> %14 to <4 x i32>
+  %16 = tail call <4 x float> @llvm.x86.sse2.cvtdq2ps(<4 x i32> %15) nounwind readnone
+  %17 = fadd <4 x float> %13, %16
+  %tmp.i = bitcast <4 x float> %17 to <4 x i32>
+  %18 = or <4 x i32> %tmp.i, %6
+  %19 = bitcast <4 x i32> %18 to <4 x float>
+  store <4 x float> %19, <4 x float>* %scevgep9, align 16
+  %tmp12 = add i64 %tmp, 4
+  %tmp13 = trunc i64 %tmp12 to i32
+  %20 = load i32* %n, align 4
+  %21 = icmp sgt i32 %20, %tmp13
+  %indvar.next = add i64 %indvar, 1
+  br i1 %21, label %bb, label %return
+
+return:
+  ret void
+}
+
+declare <4 x float> @llvm.x86.sse.cmp.ps(<4 x float>, <4 x float>, i8) nounwind readnone
+
+declare <4 x float> @llvm.x86.sse2.cvtdq2ps(<4 x i32>) nounwind readnone
diff --git a/libclamav/c++/llvm/test/CodeGen/X86/lsr-reuse.ll b/libclamav/c++/llvm/test/CodeGen/X86/lsr-reuse.ll
index 7f2b8cc..2f6fb3f 100644
--- a/libclamav/c++/llvm/test/CodeGen/X86/lsr-reuse.ll
+++ b/libclamav/c++/llvm/test/CodeGen/X86/lsr-reuse.ll
@@ -1,4 +1,4 @@
-; RUN: llc < %s -march=x86-64 -O3 | FileCheck %s
+; RUN: llc < %s -march=x86-64 -O3 -asm-verbose=false | FileCheck %s
 target datalayout = "e-p:64:64:64"
 target triple = "x86_64-unknown-unknown"
 
@@ -384,3 +384,59 @@ loop:
 return:
   ret void
 }
+
+; LSR should use only one indvar for the inner loop.
+; rdar://7657764
+
+; CHECK: asd:
+; CHECK: BB10_5:
+; CHECK-NEXT: addl  (%r{{[^,]*}},%rdi,4), %e
+; CHECK-NEXT: incq  %rdi
+; CHECK-NEXT: cmpq  %rdi, %r{{[^,]*}}
+; CHECK-NEXT: jg
+
+%struct.anon = type { i32, [4200 x i32] }
+
+ at bars = common global [123123 x %struct.anon] zeroinitializer, align 32 ; <[123123 x %struct.anon]*> [#uses=2]
+
+define i32 @asd(i32 %n) nounwind readonly {
+entry:
+  %0 = icmp sgt i32 %n, 0                         ; <i1> [#uses=1]
+  br i1 %0, label %bb.nph14, label %bb5
+
+bb.nph14:                                         ; preds = %entry
+  %tmp18 = zext i32 %n to i64                     ; <i64> [#uses=1]
+  br label %bb
+
+bb:                                               ; preds = %bb3, %bb.nph14
+  %indvar16 = phi i64 [ 0, %bb.nph14 ], [ %indvar.next17, %bb3 ] ; <i64> [#uses=3]
+  %s.113 = phi i32 [ 0, %bb.nph14 ], [ %s.0.lcssa, %bb3 ] ; <i32> [#uses=2]
+  %scevgep2526 = getelementptr [123123 x %struct.anon]* @bars, i64 0, i64 %indvar16, i32 0 ; <i32*> [#uses=1]
+  %1 = load i32* %scevgep2526, align 4            ; <i32> [#uses=2]
+  %2 = icmp sgt i32 %1, 0                         ; <i1> [#uses=1]
+  br i1 %2, label %bb.nph, label %bb3
+
+bb.nph:                                           ; preds = %bb
+  %tmp23 = sext i32 %1 to i64                     ; <i64> [#uses=1]
+  br label %bb1
+
+bb1:                                              ; preds = %bb.nph, %bb1
+  %indvar = phi i64 [ 0, %bb.nph ], [ %tmp19, %bb1 ] ; <i64> [#uses=2]
+  %s.07 = phi i32 [ %s.113, %bb.nph ], [ %4, %bb1 ] ; <i32> [#uses=1]
+  %c.08 = getelementptr [123123 x %struct.anon]* @bars, i64 0, i64 %indvar16, i32 1, i64 %indvar ; <i32*> [#uses=1]
+  %3 = load i32* %c.08, align 4                   ; <i32> [#uses=1]
+  %4 = add nsw i32 %3, %s.07                      ; <i32> [#uses=2]
+  %tmp19 = add i64 %indvar, 1                     ; <i64> [#uses=2]
+  %5 = icmp sgt i64 %tmp23, %tmp19                ; <i1> [#uses=1]
+  br i1 %5, label %bb1, label %bb3
+
+bb3:                                              ; preds = %bb1, %bb
+  %s.0.lcssa = phi i32 [ %s.113, %bb ], [ %4, %bb1 ] ; <i32> [#uses=2]
+  %indvar.next17 = add i64 %indvar16, 1           ; <i64> [#uses=2]
+  %exitcond = icmp eq i64 %indvar.next17, %tmp18  ; <i1> [#uses=1]
+  br i1 %exitcond, label %bb5, label %bb
+
+bb5:                                              ; preds = %bb3, %entry
+  %s.1.lcssa = phi i32 [ 0, %entry ], [ %s.0.lcssa, %bb3 ] ; <i32> [#uses=1]
+  ret i32 %s.1.lcssa
+}
diff --git a/libclamav/c++/llvm/test/CodeGen/X86/lsr-wrap.ll b/libclamav/c++/llvm/test/CodeGen/X86/lsr-wrap.ll
new file mode 100644
index 0000000..ec8db50
--- /dev/null
+++ b/libclamav/c++/llvm/test/CodeGen/X86/lsr-wrap.ll
@@ -0,0 +1,37 @@
+; RUN: llc -march=x86-64 < %s | FileCheck %s
+
+; LSR would like to use a single IV for both of these, however it's
+; not safe due to wraparound.
+
+; CHECK: addb  $-4, %r
+; CHECK: decw  %
+
+ at g_19 = common global i32 0                       ; <i32*> [#uses=2]
+
+declare i32 @func_8(i8 zeroext) nounwind
+
+declare i32 @func_3(i8 signext) nounwind
+
+define void @func_1() nounwind {
+entry:
+  br label %bb
+
+bb:                                               ; preds = %bb, %entry
+  %indvar = phi i16 [ 0, %entry ], [ %indvar.next, %bb ] ; <i16> [#uses=2]
+  %tmp = sub i16 0, %indvar                       ; <i16> [#uses=1]
+  %tmp27 = trunc i16 %tmp to i8                   ; <i8> [#uses=1]
+  %tmp1 = load i32* @g_19, align 4                ; <i32> [#uses=2]
+  %tmp2 = add i32 %tmp1, 1                        ; <i32> [#uses=1]
+  store i32 %tmp2, i32* @g_19, align 4
+  %tmp3 = trunc i32 %tmp1 to i8                   ; <i8> [#uses=1]
+  %tmp4 = tail call i32 @func_8(i8 zeroext %tmp3) nounwind ; <i32> [#uses=0]
+  %tmp5 = shl i8 %tmp27, 2                        ; <i8> [#uses=1]
+  %tmp6 = add i8 %tmp5, -112                      ; <i8> [#uses=1]
+  %tmp7 = tail call i32 @func_3(i8 signext %tmp6) nounwind ; <i32> [#uses=0]
+  %indvar.next = add i16 %indvar, 1               ; <i16> [#uses=2]
+  %exitcond = icmp eq i16 %indvar.next, -28       ; <i1> [#uses=1]
+  br i1 %exitcond, label %return, label %bb
+
+return:                                           ; preds = %bb
+  ret void
+}
diff --git a/libclamav/c++/llvm/test/CodeGen/X86/omit-label.ll b/libclamav/c++/llvm/test/CodeGen/X86/omit-label.ll
deleted file mode 100644
index 0ec03eb..0000000
--- a/libclamav/c++/llvm/test/CodeGen/X86/omit-label.ll
+++ /dev/null
@@ -1,57 +0,0 @@
-; RUN: llc < %s -asm-verbose=false -mtriple=x86_64-linux-gnu | FileCheck %s
-; PR4126
-; PR4732
-
-; Don't omit these labels' definitions.
-
-; CHECK: bux:
-; CHECK: LBB1_1:
-
-define void @bux(i32 %p_53) nounwind optsize {
-entry:
-	%0 = icmp eq i32 %p_53, 0		; <i1> [#uses=1]
-	%1 = icmp sgt i32 %p_53, 0		; <i1> [#uses=1]
-	%or.cond = and i1 %0, %1		; <i1> [#uses=1]
-	br i1 %or.cond, label %bb.i, label %bb3
-
-bb.i:		; preds = %entry
-	%2 = add i32 %p_53, 1		; <i32> [#uses=1]
-	%3 = icmp slt i32 %2, 0		; <i1> [#uses=0]
-	br label %bb3
-
-bb3:		; preds = %bb.i, %entry
-	%4 = tail call i32 (...)* @baz(i32 0) nounwind		; <i32> [#uses=0]
-	ret void
-}
-
-declare i32 @baz(...)
-
-; Don't omit this label in the assembly output.
-; CHECK: int321:
-; CHECK: LBB2_1
-; CHECK: LBB2_1
-; CHECK: LBB2_1:
-
-define void @int321(i8 signext %p_103, i32 %uint8p_104) nounwind readnone {
-entry:
-  %tobool = icmp eq i8 %p_103, 0                  ; <i1> [#uses=1]
-  %cmp.i = icmp sgt i8 %p_103, 0                  ; <i1> [#uses=1]
-  %or.cond = and i1 %tobool, %cmp.i               ; <i1> [#uses=1]
-  br i1 %or.cond, label %land.end.i, label %for.cond.preheader
-
-land.end.i:                                       ; preds = %entry
-  %conv3.i = sext i8 %p_103 to i32                ; <i32> [#uses=1]
-  %div.i = sdiv i32 1, %conv3.i                   ; <i32> [#uses=1]
-  %tobool.i = icmp eq i32 %div.i, -2147483647     ; <i1> [#uses=0]
-  br label %for.cond.preheader
-
-for.cond.preheader:                               ; preds = %land.end.i, %entry
-  %cmp = icmp sgt i8 %p_103, 1                    ; <i1> [#uses=1]
-  br i1 %cmp, label %for.end.split, label %for.cond
-
-for.cond:                                         ; preds = %for.cond.preheader, %for.cond
-  br label %for.cond
-
-for.end.split:                                    ; preds = %for.cond.preheader
-  ret void
-}
diff --git a/libclamav/c++/llvm/test/CodeGen/X86/pr3495-2.ll b/libclamav/c++/llvm/test/CodeGen/X86/pr3495-2.ll
index 71aa5a0..98c064a 100644
--- a/libclamav/c++/llvm/test/CodeGen/X86/pr3495-2.ll
+++ b/libclamav/c++/llvm/test/CodeGen/X86/pr3495-2.ll
@@ -1,4 +1,8 @@
-; RUN: llc < %s -march=x86 -relocation-model=pic -disable-fp-elim -stats |& grep {Number of reloads omited}
+; RUN: llc < %s -march=x86 -relocation-model=pic -disable-fp-elim -stats |& grep {Number of loads added} | grep 1
+; PR3495
+;
+; This test may not be testing what it was supposed to test.
+; It used to have two spills and four reloads, but not it only has one spill and one reload.
 
 target datalayout = "e-p:32:32:32"
 target triple = "i386-apple-darwin9.6"
diff --git a/libclamav/c++/llvm/test/CodeGen/X86/sse-minmax.ll b/libclamav/c++/llvm/test/CodeGen/X86/sse-minmax.ll
index 17ffb5e..19fbed0 100644
--- a/libclamav/c++/llvm/test/CodeGen/X86/sse-minmax.ll
+++ b/libclamav/c++/llvm/test/CodeGen/X86/sse-minmax.ll
@@ -1,17 +1,26 @@
 ; RUN: llc < %s -march=x86-64 -asm-verbose=false | FileCheck %s
+; RUN: llc < %s -march=x86-64 -asm-verbose=false -enable-unsafe-fp-math | FileCheck -check-prefix=UNSAFE %s
+; RUN: llc < %s -march=x86-64 -asm-verbose=false -enable-finite-only-fp-math | FileCheck -check-prefix=FINITE %s
 
 ; Some of these patterns can be matched as SSE min or max. Some of
 ; then can be matched provided that the operands are swapped.
 ; Some of them can't be matched at all and require a comparison
 ; and a conditional branch.
 
-; The naming convention is {,x_}{o,u}{gt,lt,ge,le}{,_inverse}
+; The naming convention is {,x_,y_}{o,u}{gt,lt,ge,le}{,_inverse}
 ; x_ : use 0.0 instead of %y
+; y_ : use -0.0 instead of %y
 ; _inverse : swap the arms of the select.
 
 ; CHECK:      ogt:
 ; CHECK-NEXT: maxsd %xmm1, %xmm0
 ; CHECK-NEXT: ret
+; UNSAFE:      ogt:
+; UNSAFE-NEXT: maxsd %xmm1, %xmm0
+; UNSAFE-NEXT: ret
+; FINITE:      ogt:
+; FINITE-NEXT: maxsd %xmm1, %xmm0
+; FINITE-NEXT: ret
 define double @ogt(double %x, double %y) nounwind {
   %c = fcmp ogt double %x, %y
   %d = select i1 %c, double %x, double %y
@@ -21,6 +30,12 @@ define double @ogt(double %x, double %y) nounwind {
 ; CHECK:      olt:
 ; CHECK-NEXT: minsd %xmm1, %xmm0
 ; CHECK-NEXT: ret
+; UNSAFE:      olt:
+; UNSAFE-NEXT: minsd %xmm1, %xmm0
+; UNSAFE-NEXT: ret
+; FINITE:      olt:
+; FINITE-NEXT: minsd %xmm1, %xmm0
+; FINITE-NEXT: ret
 define double @olt(double %x, double %y) nounwind {
   %c = fcmp olt double %x, %y
   %d = select i1 %c, double %x, double %y
@@ -31,6 +46,14 @@ define double @olt(double %x, double %y) nounwind {
 ; CHECK-NEXT: minsd  %xmm0, %xmm1
 ; CHECK-NEXT: movapd %xmm1, %xmm0
 ; CHECK-NEXT: ret
+; UNSAFE:      ogt_inverse:
+; UNSAFE-NEXT: minsd  %xmm0, %xmm1
+; UNSAFE-NEXT: movapd %xmm1, %xmm0
+; UNSAFE-NEXT: ret
+; FINITE:      ogt_inverse:
+; FINITE-NEXT: minsd  %xmm0, %xmm1
+; FINITE-NEXT: movapd %xmm1, %xmm0
+; FINITE-NEXT: ret
 define double @ogt_inverse(double %x, double %y) nounwind {
   %c = fcmp ogt double %x, %y
   %d = select i1 %c, double %y, double %x
@@ -41,6 +64,14 @@ define double @ogt_inverse(double %x, double %y) nounwind {
 ; CHECK-NEXT: maxsd  %xmm0, %xmm1
 ; CHECK-NEXT: movapd %xmm1, %xmm0
 ; CHECK-NEXT: ret
+; UNSAFE:      olt_inverse:
+; UNSAFE-NEXT: maxsd  %xmm0, %xmm1
+; UNSAFE-NEXT: movapd %xmm1, %xmm0
+; UNSAFE-NEXT: ret
+; FINITE:      olt_inverse:
+; FINITE-NEXT: maxsd  %xmm0, %xmm1
+; FINITE-NEXT: movapd %xmm1, %xmm0
+; FINITE-NEXT: ret
 define double @olt_inverse(double %x, double %y) nounwind {
   %c = fcmp olt double %x, %y
   %d = select i1 %c, double %y, double %x
@@ -49,6 +80,12 @@ define double @olt_inverse(double %x, double %y) nounwind {
 
 ; CHECK:      oge:
 ; CHECK-NEXT: ucomisd %xmm1, %xmm0
+; UNSAFE:      oge:
+; UNSAFE-NEXT: maxsd	%xmm1, %xmm0
+; UNSAFE-NEXT: ret
+; FINITE:      oge:
+; FINITE-NEXT: maxsd	%xmm1, %xmm0
+; FINITE-NEXT: ret
 define double @oge(double %x, double %y) nounwind {
   %c = fcmp oge double %x, %y
   %d = select i1 %c, double %x, double %y
@@ -57,6 +94,10 @@ define double @oge(double %x, double %y) nounwind {
 
 ; CHECK:      ole:
 ; CHECK-NEXT: ucomisd %xmm0, %xmm1
+; UNSAFE:      ole:
+; UNSAFE-NEXT: minsd %xmm1, %xmm0
+; FINITE:      ole:
+; FINITE-NEXT: minsd %xmm1, %xmm0
 define double @ole(double %x, double %y) nounwind {
   %c = fcmp ole double %x, %y
   %d = select i1 %c, double %x, double %y
@@ -65,6 +106,14 @@ define double @ole(double %x, double %y) nounwind {
 
 ; CHECK:      oge_inverse:
 ; CHECK-NEXT: ucomisd %xmm1, %xmm0
+; UNSAFE:      oge_inverse:
+; UNSAFE-NEXT: minsd %xmm0, %xmm1
+; UNSAFE-NEXT: movapd %xmm1, %xmm0
+; UNSAFE-NEXT: ret
+; FINITE:      oge_inverse:
+; FINITE-NEXT: minsd %xmm0, %xmm1
+; FINITE-NEXT: movapd %xmm1, %xmm0
+; FINITE-NEXT: ret
 define double @oge_inverse(double %x, double %y) nounwind {
   %c = fcmp oge double %x, %y
   %d = select i1 %c, double %y, double %x
@@ -73,6 +122,14 @@ define double @oge_inverse(double %x, double %y) nounwind {
 
 ; CHECK:      ole_inverse:
 ; CHECK-NEXT: ucomisd %xmm0, %xmm1
+; UNSAFE:      ole_inverse:
+; UNSAFE-NEXT: maxsd %xmm0, %xmm1
+; UNSAFE-NEXT: movapd %xmm1, %xmm0
+; UNSAFE-NEXT: ret
+; FINITE:      ole_inverse:
+; FINITE-NEXT: maxsd %xmm0, %xmm1
+; FINITE-NEXT: movapd %xmm1, %xmm0
+; FINITE-NEXT: ret
 define double @ole_inverse(double %x, double %y) nounwind {
   %c = fcmp ole double %x, %y
   %d = select i1 %c, double %y, double %x
@@ -83,6 +140,14 @@ define double @ole_inverse(double %x, double %y) nounwind {
 ; CHECK-NEXT: pxor  %xmm1, %xmm1
 ; CHECK-NEXT: maxsd %xmm1, %xmm0
 ; CHECK-NEXT: ret
+; UNSAFE:      x_ogt:
+; UNSAFE-NEXT: pxor  %xmm1, %xmm1
+; UNSAFE-NEXT: maxsd %xmm1, %xmm0
+; UNSAFE-NEXT: ret
+; FINITE:      x_ogt:
+; FINITE-NEXT: pxor  %xmm1, %xmm1
+; FINITE-NEXT: maxsd %xmm1, %xmm0
+; FINITE-NEXT: ret
 define double @x_ogt(double %x) nounwind {
   %c = fcmp ogt double %x, 0.000000e+00
   %d = select i1 %c, double %x, double 0.000000e+00
@@ -93,6 +158,14 @@ define double @x_ogt(double %x) nounwind {
 ; CHECK-NEXT: pxor  %xmm1, %xmm1
 ; CHECK-NEXT: minsd %xmm1, %xmm0
 ; CHECK-NEXT: ret
+; UNSAFE:      x_olt:
+; UNSAFE-NEXT: pxor  %xmm1, %xmm1
+; UNSAFE-NEXT: minsd %xmm1, %xmm0
+; UNSAFE-NEXT: ret
+; FINITE:      x_olt:
+; FINITE-NEXT: pxor  %xmm1, %xmm1
+; FINITE-NEXT: minsd %xmm1, %xmm0
+; FINITE-NEXT: ret
 define double @x_olt(double %x) nounwind {
   %c = fcmp olt double %x, 0.000000e+00
   %d = select i1 %c, double %x, double 0.000000e+00
@@ -104,6 +177,16 @@ define double @x_olt(double %x) nounwind {
 ; CHECK-NEXT: minsd  %xmm0, %xmm1
 ; CHECK-NEXT: movapd %xmm1, %xmm0
 ; CHECK-NEXT: ret
+; UNSAFE:      x_ogt_inverse:
+; UNSAFE-NEXT: pxor   %xmm1, %xmm1
+; UNSAFE-NEXT: minsd  %xmm0, %xmm1
+; UNSAFE-NEXT: movapd %xmm1, %xmm0
+; UNSAFE-NEXT: ret
+; FINITE:      x_ogt_inverse:
+; FINITE-NEXT: pxor   %xmm1, %xmm1
+; FINITE-NEXT: minsd  %xmm0, %xmm1
+; FINITE-NEXT: movapd %xmm1, %xmm0
+; FINITE-NEXT: ret
 define double @x_ogt_inverse(double %x) nounwind {
   %c = fcmp ogt double %x, 0.000000e+00
   %d = select i1 %c, double 0.000000e+00, double %x
@@ -115,6 +198,16 @@ define double @x_ogt_inverse(double %x) nounwind {
 ; CHECK-NEXT: maxsd  %xmm0, %xmm1
 ; CHECK-NEXT: movapd %xmm1, %xmm0
 ; CHECK-NEXT: ret
+; UNSAFE:      x_olt_inverse:
+; UNSAFE-NEXT: pxor   %xmm1, %xmm1
+; UNSAFE-NEXT: maxsd  %xmm0, %xmm1
+; UNSAFE-NEXT: movapd %xmm1, %xmm0
+; UNSAFE-NEXT: ret
+; FINITE:      x_olt_inverse:
+; FINITE-NEXT: pxor   %xmm1, %xmm1
+; FINITE-NEXT: maxsd  %xmm0, %xmm1
+; FINITE-NEXT: movapd %xmm1, %xmm0
+; FINITE-NEXT: ret
 define double @x_olt_inverse(double %x) nounwind {
   %c = fcmp olt double %x, 0.000000e+00
   %d = select i1 %c, double 0.000000e+00, double %x
@@ -122,9 +215,15 @@ define double @x_olt_inverse(double %x) nounwind {
 }
 
 ; CHECK:      x_oge:
-; CHECK-NEXT: pxor  %xmm1, %xmm1
-; CHECK-NEXT: maxsd %xmm1, %xmm0
-; CHECK-NEXT: ret
+; CHECK:      ucomisd %xmm1, %xmm0
+; UNSAFE:      x_oge:
+; UNSAFE-NEXT: pxor    %xmm1, %xmm1
+; UNSAFE-NEXT: maxsd   %xmm1, %xmm0
+; UNSAFE-NEXT: ret
+; FINITE:      x_oge:
+; FINITE-NEXT: pxor    %xmm1, %xmm1
+; FINITE-NEXT: maxsd   %xmm1, %xmm0
+; FINITE-NEXT: ret
 define double @x_oge(double %x) nounwind {
   %c = fcmp oge double %x, 0.000000e+00
   %d = select i1 %c, double %x, double 0.000000e+00
@@ -132,9 +231,15 @@ define double @x_oge(double %x) nounwind {
 }
 
 ; CHECK:      x_ole:
-; CHECK-NEXT: pxor  %xmm1, %xmm1
-; CHECK-NEXT: minsd %xmm1, %xmm0
-; CHECK-NEXT: ret
+; CHECK:      ucomisd %xmm0, %xmm1
+; UNSAFE:      x_ole:
+; UNSAFE-NEXT: pxor %xmm1, %xmm1
+; UNSAFE-NEXT: minsd %xmm1, %xmm0
+; UNSAFE-NEXT: ret
+; FINITE:      x_ole:
+; FINITE-NEXT: pxor %xmm1, %xmm1
+; FINITE-NEXT: minsd %xmm1, %xmm0
+; FINITE-NEXT: ret
 define double @x_ole(double %x) nounwind {
   %c = fcmp ole double %x, 0.000000e+00
   %d = select i1 %c, double %x, double 0.000000e+00
@@ -142,10 +247,17 @@ define double @x_ole(double %x) nounwind {
 }
 
 ; CHECK:      x_oge_inverse:
-; CHECK-NEXT: pxor   %xmm1, %xmm1
-; CHECK-NEXT: minsd  %xmm0, %xmm1
-; CHECK-NEXT: movapd %xmm1, %xmm0
-; CHECK-NEXT: ret
+; CHECK:      ucomisd %xmm1, %xmm0
+; UNSAFE:      x_oge_inverse:
+; UNSAFE-NEXT: pxor    %xmm1, %xmm1
+; UNSAFE-NEXT: minsd   %xmm0, %xmm1
+; UNSAFE-NEXT: movapd  %xmm1, %xmm0
+; UNSAFE-NEXT: ret
+; FINITE:      x_oge_inverse:
+; FINITE-NEXT: pxor    %xmm1, %xmm1
+; FINITE-NEXT: minsd   %xmm0, %xmm1
+; FINITE-NEXT: movapd  %xmm1, %xmm0
+; FINITE-NEXT: ret
 define double @x_oge_inverse(double %x) nounwind {
   %c = fcmp oge double %x, 0.000000e+00
   %d = select i1 %c, double 0.000000e+00, double %x
@@ -153,10 +265,17 @@ define double @x_oge_inverse(double %x) nounwind {
 }
 
 ; CHECK:      x_ole_inverse:
-; CHECK-NEXT: pxor   %xmm1, %xmm1
-; CHECK-NEXT: maxsd  %xmm0, %xmm1
-; CHECK-NEXT: movapd %xmm1, %xmm0
-; CHECK-NEXT: ret
+; CHECK:      ucomisd %xmm0, %xmm1
+; UNSAFE:      x_ole_inverse:
+; UNSAFE-NEXT: pxor    %xmm1, %xmm1
+; UNSAFE-NEXT: maxsd   %xmm0, %xmm1
+; UNSAFE-NEXT: movapd  %xmm1, %xmm0
+; UNSAFE-NEXT: ret
+; FINITE:      x_ole_inverse:
+; FINITE-NEXT: pxor    %xmm1, %xmm1
+; FINITE-NEXT: maxsd   %xmm0, %xmm1
+; FINITE-NEXT: movapd  %xmm1, %xmm0
+; FINITE-NEXT: ret
 define double @x_ole_inverse(double %x) nounwind {
   %c = fcmp ole double %x, 0.000000e+00
   %d = select i1 %c, double 0.000000e+00, double %x
@@ -164,7 +283,13 @@ define double @x_ole_inverse(double %x) nounwind {
 }
 
 ; CHECK:      ugt:
-; CHECK-NEXT: ucomisd %xmm0, %xmm1
+; CHECK:      ucomisd %xmm0, %xmm1
+; UNSAFE:      ugt:
+; UNSAFE-NEXT: maxsd   %xmm1, %xmm0
+; UNSAFE-NEXT: ret
+; FINITE:      ugt:
+; FINITE-NEXT: maxsd   %xmm1, %xmm0
+; FINITE-NEXT: ret
 define double @ugt(double %x, double %y) nounwind {
   %c = fcmp ugt double %x, %y
   %d = select i1 %c, double %x, double %y
@@ -172,7 +297,13 @@ define double @ugt(double %x, double %y) nounwind {
 }
 
 ; CHECK:      ult:
-; CHECK-NEXT: ucomisd %xmm1, %xmm0
+; CHECK:      ucomisd %xmm1, %xmm0
+; UNSAFE:      ult:
+; UNSAFE-NEXT: minsd   %xmm1, %xmm0
+; UNSAFE-NEXT: ret
+; FINITE:      ult:
+; FINITE-NEXT: minsd   %xmm1, %xmm0
+; FINITE-NEXT: ret
 define double @ult(double %x, double %y) nounwind {
   %c = fcmp ult double %x, %y
   %d = select i1 %c, double %x, double %y
@@ -180,7 +311,15 @@ define double @ult(double %x, double %y) nounwind {
 }
 
 ; CHECK:      ugt_inverse:
-; CHECK-NEXT: ucomisd %xmm0, %xmm1
+; CHECK:      ucomisd %xmm0, %xmm1
+; UNSAFE:      ugt_inverse:
+; UNSAFE-NEXT: minsd   %xmm0, %xmm1
+; UNSAFE-NEXT: movapd  %xmm1, %xmm0
+; UNSAFE-NEXT: ret
+; FINITE:      ugt_inverse:
+; FINITE-NEXT: minsd   %xmm0, %xmm1
+; FINITE-NEXT: movapd  %xmm1, %xmm0
+; FINITE-NEXT: ret
 define double @ugt_inverse(double %x, double %y) nounwind {
   %c = fcmp ugt double %x, %y
   %d = select i1 %c, double %y, double %x
@@ -188,7 +327,15 @@ define double @ugt_inverse(double %x, double %y) nounwind {
 }
 
 ; CHECK:      ult_inverse:
-; CHECK-NEXT: ucomisd %xmm1, %xmm0
+; CHECK:      ucomisd %xmm1, %xmm0
+; UNSAFE:      ult_inverse:
+; UNSAFE-NEXT: maxsd   %xmm0, %xmm1
+; UNSAFE-NEXT: movapd  %xmm1, %xmm0
+; UNSAFE-NEXT: ret
+; FINITE:      ult_inverse:
+; FINITE-NEXT: maxsd   %xmm0, %xmm1
+; FINITE-NEXT: movapd  %xmm1, %xmm0
+; FINITE-NEXT: ret
 define double @ult_inverse(double %x, double %y) nounwind {
   %c = fcmp ult double %x, %y
   %d = select i1 %c, double %y, double %x
@@ -196,9 +343,15 @@ define double @ult_inverse(double %x, double %y) nounwind {
 }
 
 ; CHECK:      uge:
-; CHECK-NEXT: maxsd  %xmm0, %xmm1
-; CHECK-NEXT: movapd %xmm1, %xmm0
+; CHECK-NEXT: maxsd   %xmm0, %xmm1
+; CHECK-NEXT: movapd  %xmm1, %xmm0
 ; CHECK-NEXT: ret
+; UNSAFE:      uge:
+; UNSAFE-NEXT: maxsd   %xmm1, %xmm0
+; UNSAFE-NEXT: ret
+; FINITE:      uge:
+; FINITE-NEXT: maxsd   %xmm1, %xmm0
+; FINITE-NEXT: ret
 define double @uge(double %x, double %y) nounwind {
   %c = fcmp uge double %x, %y
   %d = select i1 %c, double %x, double %y
@@ -209,6 +362,12 @@ define double @uge(double %x, double %y) nounwind {
 ; CHECK-NEXT: minsd  %xmm0, %xmm1
 ; CHECK-NEXT: movapd %xmm1, %xmm0
 ; CHECK-NEXT: ret
+; UNSAFE:      ule:
+; UNSAFE-NEXT: minsd   %xmm1, %xmm0
+; UNSAFE-NEXT: ret
+; FINITE:      ule:
+; FINITE-NEXT: minsd   %xmm1, %xmm0
+; FINITE-NEXT: ret
 define double @ule(double %x, double %y) nounwind {
   %c = fcmp ule double %x, %y
   %d = select i1 %c, double %x, double %y
@@ -218,6 +377,14 @@ define double @ule(double %x, double %y) nounwind {
 ; CHECK:      uge_inverse:
 ; CHECK-NEXT: minsd %xmm1, %xmm0
 ; CHECK-NEXT: ret
+; UNSAFE:      uge_inverse:
+; UNSAFE-NEXT: minsd %xmm0, %xmm1
+; UNSAFE-NEXT: movapd %xmm1, %xmm0
+; UNSAFE-NEXT: ret
+; FINITE:      uge_inverse:
+; FINITE-NEXT: minsd %xmm0, %xmm1
+; FINITE-NEXT: movapd %xmm1, %xmm0
+; FINITE-NEXT: ret
 define double @uge_inverse(double %x, double %y) nounwind {
   %c = fcmp uge double %x, %y
   %d = select i1 %c, double %y, double %x
@@ -227,6 +394,14 @@ define double @uge_inverse(double %x, double %y) nounwind {
 ; CHECK:      ule_inverse:
 ; CHECK-NEXT: maxsd %xmm1, %xmm0
 ; CHECK-NEXT: ret
+; UNSAFE:      ule_inverse:
+; UNSAFE-NEXT: maxsd %xmm0, %xmm1
+; UNSAFE-NEXT: movapd %xmm1, %xmm0
+; UNSAFE-NEXT: ret
+; FINITE:      ule_inverse:
+; FINITE-NEXT: maxsd %xmm0, %xmm1
+; FINITE-NEXT: movapd %xmm1, %xmm0
+; FINITE-NEXT: ret
 define double @ule_inverse(double %x, double %y) nounwind {
   %c = fcmp ule double %x, %y
   %d = select i1 %c, double %y, double %x
@@ -234,10 +409,15 @@ define double @ule_inverse(double %x, double %y) nounwind {
 }
 
 ; CHECK:      x_ugt:
-; CHECK-NEXT: pxor   %xmm1, %xmm1
-; CHECK-NEXT: maxsd  %xmm0, %xmm1
-; CHECK-NEXT: movapd %xmm1, %xmm0
-; CHECK-NEXT: ret
+; CHECK:      ucomisd %xmm0, %xmm1
+; UNSAFE:      x_ugt:
+; UNSAFE-NEXT: pxor    %xmm1, %xmm1
+; UNSAFE-NEXT: maxsd   %xmm1, %xmm0
+; UNSAFE-NEXT: ret
+; FINITE:      x_ugt:
+; FINITE-NEXT: pxor    %xmm1, %xmm1
+; FINITE-NEXT: maxsd   %xmm1, %xmm0
+; FINITE-NEXT: ret
 define double @x_ugt(double %x) nounwind {
   %c = fcmp ugt double %x, 0.000000e+00
   %d = select i1 %c, double %x, double 0.000000e+00
@@ -245,10 +425,15 @@ define double @x_ugt(double %x) nounwind {
 }
 
 ; CHECK:      x_ult:
-; CHECK-NEXT: pxor   %xmm1, %xmm1
-; CHECK-NEXT: minsd  %xmm0, %xmm1
-; CHECK-NEXT: movapd %xmm1, %xmm0
-; CHECK-NEXT: ret
+; CHECK:      ucomisd %xmm1, %xmm0
+; UNSAFE:      x_ult:
+; UNSAFE-NEXT: pxor    %xmm1, %xmm1
+; UNSAFE-NEXT: minsd   %xmm1, %xmm0
+; UNSAFE-NEXT: ret
+; FINITE:      x_ult:
+; FINITE-NEXT: pxor    %xmm1, %xmm1
+; FINITE-NEXT: minsd   %xmm1, %xmm0
+; FINITE-NEXT: ret
 define double @x_ult(double %x) nounwind {
   %c = fcmp ult double %x, 0.000000e+00
   %d = select i1 %c, double %x, double 0.000000e+00
@@ -256,9 +441,17 @@ define double @x_ult(double %x) nounwind {
 }
 
 ; CHECK:      x_ugt_inverse:
-; CHECK-NEXT: pxor  %xmm1, %xmm1
-; CHECK-NEXT: minsd %xmm1, %xmm0
-; CHECK-NEXT: ret
+; CHECK:      ucomisd %xmm0, %xmm1
+; UNSAFE:      x_ugt_inverse:
+; UNSAFE-NEXT: pxor    %xmm1, %xmm1
+; UNSAFE-NEXT: minsd   %xmm0, %xmm1
+; UNSAFE-NEXT: movapd  %xmm1, %xmm0
+; UNSAFE-NEXT: ret
+; FINITE:      x_ugt_inverse:
+; FINITE-NEXT: pxor    %xmm1, %xmm1
+; FINITE-NEXT: minsd   %xmm0, %xmm1
+; FINITE-NEXT: movapd  %xmm1, %xmm0
+; FINITE-NEXT: ret
 define double @x_ugt_inverse(double %x) nounwind {
   %c = fcmp ugt double %x, 0.000000e+00
   %d = select i1 %c, double 0.000000e+00, double %x
@@ -266,9 +459,17 @@ define double @x_ugt_inverse(double %x) nounwind {
 }
 
 ; CHECK:      x_ult_inverse:
-; CHECK-NEXT: pxor  %xmm1, %xmm1
-; CHECK-NEXT: maxsd %xmm1, %xmm0
-; CHECK-NEXT: ret
+; CHECK:      ucomisd %xmm1, %xmm0
+; UNSAFE:      x_ult_inverse:
+; UNSAFE-NEXT: pxor    %xmm1, %xmm1
+; UNSAFE-NEXT: maxsd   %xmm0, %xmm1
+; UNSAFE-NEXT: movapd  %xmm1, %xmm0
+; UNSAFE-NEXT: ret
+; FINITE:      x_ult_inverse:
+; FINITE-NEXT: pxor    %xmm1, %xmm1
+; FINITE-NEXT: maxsd   %xmm0, %xmm1
+; FINITE-NEXT: movapd  %xmm1, %xmm0
+; FINITE-NEXT: ret
 define double @x_ult_inverse(double %x) nounwind {
   %c = fcmp ult double %x, 0.000000e+00
   %d = select i1 %c, double 0.000000e+00, double %x
@@ -280,6 +481,14 @@ define double @x_ult_inverse(double %x) nounwind {
 ; CHECK-NEXT: maxsd  %xmm0, %xmm1
 ; CHECK-NEXT: movapd %xmm1, %xmm0
 ; CHECK-NEXT: ret
+; UNSAFE:      x_uge:
+; UNSAFE-NEXT: pxor   %xmm1, %xmm1
+; UNSAFE-NEXT: maxsd  %xmm1, %xmm0
+; UNSAFE-NEXT: ret
+; FINITE:      x_uge:
+; FINITE-NEXT: pxor   %xmm1, %xmm1
+; FINITE-NEXT: maxsd  %xmm1, %xmm0
+; FINITE-NEXT: ret
 define double @x_uge(double %x) nounwind {
   %c = fcmp uge double %x, 0.000000e+00
   %d = select i1 %c, double %x, double 0.000000e+00
@@ -291,6 +500,14 @@ define double @x_uge(double %x) nounwind {
 ; CHECK-NEXT: minsd  %xmm0, %xmm1
 ; CHECK-NEXT: movapd %xmm1, %xmm0
 ; CHECK-NEXT: ret
+; UNSAFE:      x_ule:
+; UNSAFE-NEXT: pxor   %xmm1, %xmm1
+; UNSAFE-NEXT: minsd  %xmm1, %xmm0
+; UNSAFE-NEXT: ret
+; FINITE:      x_ule:
+; FINITE-NEXT: pxor   %xmm1, %xmm1
+; FINITE-NEXT: minsd  %xmm1, %xmm0
+; FINITE-NEXT: ret
 define double @x_ule(double %x) nounwind {
   %c = fcmp ule double %x, 0.000000e+00
   %d = select i1 %c, double %x, double 0.000000e+00
@@ -301,6 +518,16 @@ define double @x_ule(double %x) nounwind {
 ; CHECK-NEXT: pxor  %xmm1, %xmm1
 ; CHECK-NEXT: minsd %xmm1, %xmm0
 ; CHECK-NEXT: ret
+; UNSAFE:      x_uge_inverse:
+; UNSAFE-NEXT: pxor  %xmm1, %xmm1
+; UNSAFE-NEXT: minsd %xmm0, %xmm1
+; UNSAFE-NEXT: movapd %xmm1, %xmm0
+; UNSAFE-NEXT: ret
+; FINITE:      x_uge_inverse:
+; FINITE-NEXT: pxor  %xmm1, %xmm1
+; FINITE-NEXT: minsd %xmm0, %xmm1
+; FINITE-NEXT: movapd %xmm1, %xmm0
+; FINITE-NEXT: ret
 define double @x_uge_inverse(double %x) nounwind {
   %c = fcmp uge double %x, 0.000000e+00
   %d = select i1 %c, double 0.000000e+00, double %x
@@ -311,16 +538,301 @@ define double @x_uge_inverse(double %x) nounwind {
 ; CHECK-NEXT: pxor  %xmm1, %xmm1
 ; CHECK-NEXT: maxsd %xmm1, %xmm0
 ; CHECK-NEXT: ret
+; UNSAFE:      x_ule_inverse:
+; UNSAFE-NEXT: pxor  %xmm1, %xmm1
+; UNSAFE-NEXT: maxsd %xmm0, %xmm1
+; UNSAFE-NEXT: movapd %xmm1, %xmm0
+; UNSAFE-NEXT: ret
+; FINITE:      x_ule_inverse:
+; FINITE-NEXT: pxor  %xmm1, %xmm1
+; FINITE-NEXT: maxsd %xmm0, %xmm1
+; FINITE-NEXT: movapd %xmm1, %xmm0
+; FINITE-NEXT: ret
 define double @x_ule_inverse(double %x) nounwind {
   %c = fcmp ule double %x, 0.000000e+00
   %d = select i1 %c, double 0.000000e+00, double %x
   ret double %d
 }
 
+; CHECK:      y_ogt:
+; CHECK-NEXT: maxsd {{[^,]*}}, %xmm0
+; CHECK-NEXT: ret
+; UNSAFE:      y_ogt:
+; UNSAFE-NEXT: maxsd {{[^,]*}}, %xmm0
+; UNSAFE-NEXT: ret
+; FINITE:      y_ogt:
+; FINITE-NEXT: maxsd {{[^,]*}}, %xmm0
+; FINITE-NEXT: ret
+define double @y_ogt(double %x) nounwind {
+  %c = fcmp ogt double %x, -0.000000e+00
+  %d = select i1 %c, double %x, double -0.000000e+00
+  ret double %d
+}
+
+; CHECK:      y_olt:
+; CHECK-NEXT: minsd {{[^,]*}}, %xmm0
+; CHECK-NEXT: ret
+; UNSAFE:      y_olt:
+; UNSAFE-NEXT: minsd {{[^,]*}}, %xmm0
+; UNSAFE-NEXT: ret
+; FINITE:      y_olt:
+; FINITE-NEXT: minsd {{[^,]*}}, %xmm0
+; FINITE-NEXT: ret
+define double @y_olt(double %x) nounwind {
+  %c = fcmp olt double %x, -0.000000e+00
+  %d = select i1 %c, double %x, double -0.000000e+00
+  ret double %d
+}
+
+; CHECK:      y_ogt_inverse:
+; CHECK-NEXT: movsd  {{[^,]*}}, %xmm1
+; CHECK-NEXT: minsd  %xmm0, %xmm1
+; CHECK-NEXT: movapd %xmm1, %xmm0
+; CHECK-NEXT: ret
+; UNSAFE:      y_ogt_inverse:
+; UNSAFE-NEXT: movsd  {{[^,]*}}, %xmm1
+; UNSAFE-NEXT: minsd  %xmm0, %xmm1
+; UNSAFE-NEXT: movapd %xmm1, %xmm0
+; UNSAFE-NEXT: ret
+; FINITE:      y_ogt_inverse:
+; FINITE-NEXT: movsd  {{[^,]*}}, %xmm1
+; FINITE-NEXT: minsd  %xmm0, %xmm1
+; FINITE-NEXT: movapd %xmm1, %xmm0
+; FINITE-NEXT: ret
+define double @y_ogt_inverse(double %x) nounwind {
+  %c = fcmp ogt double %x, -0.000000e+00
+  %d = select i1 %c, double -0.000000e+00, double %x
+  ret double %d
+}
+
+; CHECK:      y_olt_inverse:
+; CHECK-NEXT: movsd  {{[^,]*}}, %xmm1
+; CHECK-NEXT: maxsd  %xmm0, %xmm1
+; CHECK-NEXT: movapd %xmm1, %xmm0
+; CHECK-NEXT: ret
+; UNSAFE:      y_olt_inverse:
+; UNSAFE-NEXT: movsd  {{[^,]*}}, %xmm1
+; UNSAFE-NEXT: maxsd  %xmm0, %xmm1
+; UNSAFE-NEXT: movapd %xmm1, %xmm0
+; UNSAFE-NEXT: ret
+; FINITE:      y_olt_inverse:
+; FINITE-NEXT: movsd  {{[^,]*}}, %xmm1
+; FINITE-NEXT: maxsd  %xmm0, %xmm1
+; FINITE-NEXT: movapd %xmm1, %xmm0
+; FINITE-NEXT: ret
+define double @y_olt_inverse(double %x) nounwind {
+  %c = fcmp olt double %x, -0.000000e+00
+  %d = select i1 %c, double -0.000000e+00, double %x
+  ret double %d
+}
+
+; CHECK:      y_oge:
+; CHECK:      ucomisd %xmm1, %xmm0
+; UNSAFE:      y_oge:
+; UNSAFE-NEXT: maxsd   {{[^,]*}}, %xmm0
+; UNSAFE-NEXT: ret
+; FINITE:      y_oge:
+; FINITE-NEXT: maxsd   {{[^,]*}}, %xmm0
+; FINITE-NEXT: ret
+define double @y_oge(double %x) nounwind {
+  %c = fcmp oge double %x, -0.000000e+00
+  %d = select i1 %c, double %x, double -0.000000e+00
+  ret double %d
+}
+
+; CHECK:      y_ole:
+; CHECK:      ucomisd %xmm0, %xmm1
+; UNSAFE:      y_ole:
+; UNSAFE-NEXT: minsd {{[^,]*}}, %xmm0
+; UNSAFE-NEXT: ret
+; FINITE:      y_ole:
+; FINITE-NEXT: minsd {{[^,]*}}, %xmm0
+; FINITE-NEXT: ret
+define double @y_ole(double %x) nounwind {
+  %c = fcmp ole double %x, -0.000000e+00
+  %d = select i1 %c, double %x, double -0.000000e+00
+  ret double %d
+}
+
+; CHECK:      y_oge_inverse:
+; CHECK:      ucomisd %xmm1, %xmm0
+; UNSAFE:      y_oge_inverse:
+; UNSAFE-NEXT: movsd   {{[^,]*}}, %xmm1
+; UNSAFE-NEXT: minsd   %xmm0, %xmm1
+; UNSAFE-NEXT: movapd  %xmm1, %xmm0
+; UNSAFE-NEXT: ret
+; FINITE:      y_oge_inverse:
+; FINITE-NEXT: movsd   {{[^,]*}}, %xmm1
+; FINITE-NEXT: minsd   %xmm0, %xmm1
+; FINITE-NEXT: movapd  %xmm1, %xmm0
+; FINITE-NEXT: ret
+define double @y_oge_inverse(double %x) nounwind {
+  %c = fcmp oge double %x, -0.000000e+00
+  %d = select i1 %c, double -0.000000e+00, double %x
+  ret double %d
+}
+
+; CHECK:      y_ole_inverse:
+; CHECK:      ucomisd %xmm0, %xmm1
+; UNSAFE:      y_ole_inverse:
+; UNSAFE-NEXT: movsd   {{[^,]*}}, %xmm1
+; UNSAFE-NEXT: maxsd   %xmm0, %xmm1
+; UNSAFE-NEXT: movapd  %xmm1, %xmm0
+; UNSAFE-NEXT: ret
+; FINITE:      y_ole_inverse:
+; FINITE-NEXT: movsd   {{[^,]*}}, %xmm1
+; FINITE-NEXT: maxsd   %xmm0, %xmm1
+; FINITE-NEXT: movapd  %xmm1, %xmm0
+; FINITE-NEXT: ret
+define double @y_ole_inverse(double %x) nounwind {
+  %c = fcmp ole double %x, -0.000000e+00
+  %d = select i1 %c, double -0.000000e+00, double %x
+  ret double %d
+}
+
+; CHECK:      y_ugt:
+; CHECK:      ucomisd %xmm0, %xmm1
+; UNSAFE:      y_ugt:
+; UNSAFE-NEXT: maxsd   {{[^,]*}}, %xmm0
+; UNSAFE-NEXT: ret
+; FINITE:      y_ugt:
+; FINITE-NEXT: maxsd   {{[^,]*}}, %xmm0
+; FINITE-NEXT: ret
+define double @y_ugt(double %x) nounwind {
+  %c = fcmp ugt double %x, -0.000000e+00
+  %d = select i1 %c, double %x, double -0.000000e+00
+  ret double %d
+}
+
+; CHECK:      y_ult:
+; CHECK:      ucomisd %xmm1, %xmm0
+; UNSAFE:      y_ult:
+; UNSAFE-NEXT: minsd   {{[^,]*}}, %xmm0
+; UNSAFE-NEXT: ret
+; FINITE:      y_ult:
+; FINITE-NEXT: minsd   {{[^,]*}}, %xmm0
+; FINITE-NEXT: ret
+define double @y_ult(double %x) nounwind {
+  %c = fcmp ult double %x, -0.000000e+00
+  %d = select i1 %c, double %x, double -0.000000e+00
+  ret double %d
+}
+
+; CHECK:      y_ugt_inverse:
+; CHECK:      ucomisd %xmm0, %xmm1
+; UNSAFE:      y_ugt_inverse:
+; UNSAFE-NEXT: movsd   {{[^,]*}}, %xmm1
+; UNSAFE-NEXT: minsd   %xmm0, %xmm1
+; UNSAFE-NEXT: movapd  %xmm1, %xmm0
+; UNSAFE-NEXT: ret
+; FINITE:      y_ugt_inverse:
+; FINITE-NEXT: movsd   {{[^,]*}}, %xmm1
+; FINITE-NEXT: minsd   %xmm0, %xmm1
+; FINITE-NEXT: movapd  %xmm1, %xmm0
+; FINITE-NEXT: ret
+define double @y_ugt_inverse(double %x) nounwind {
+  %c = fcmp ugt double %x, -0.000000e+00
+  %d = select i1 %c, double -0.000000e+00, double %x
+  ret double %d
+}
+
+; CHECK:      y_ult_inverse:
+; CHECK:      ucomisd %xmm1, %xmm0
+; UNSAFE:      y_ult_inverse:
+; UNSAFE-NEXT: movsd   {{[^,]*}}, %xmm1
+; UNSAFE-NEXT: maxsd   %xmm0, %xmm1
+; UNSAFE-NEXT: movapd  %xmm1, %xmm0
+; UNSAFE-NEXT: ret
+; FINITE:      y_ult_inverse:
+; FINITE-NEXT: movsd   {{[^,]*}}, %xmm1
+; FINITE-NEXT: maxsd   %xmm0, %xmm1
+; FINITE-NEXT: movapd  %xmm1, %xmm0
+; FINITE-NEXT: ret
+define double @y_ult_inverse(double %x) nounwind {
+  %c = fcmp ult double %x, -0.000000e+00
+  %d = select i1 %c, double -0.000000e+00, double %x
+  ret double %d
+}
+
+; CHECK:      y_uge:
+; CHECK-NEXT: movsd  {{[^,]*}}, %xmm1
+; CHECK-NEXT: maxsd  %xmm0, %xmm1
+; CHECK-NEXT: movapd %xmm1, %xmm0
+; CHECK-NEXT: ret
+; UNSAFE:      y_uge:
+; UNSAFE-NEXT: maxsd  {{[^,]*}}, %xmm0
+; UNSAFE-NEXT: ret
+; FINITE:      y_uge:
+; FINITE-NEXT: maxsd  {{[^,]*}}, %xmm0
+; FINITE-NEXT: ret
+define double @y_uge(double %x) nounwind {
+  %c = fcmp uge double %x, -0.000000e+00
+  %d = select i1 %c, double %x, double -0.000000e+00
+  ret double %d
+}
+
+; CHECK:      y_ule:
+; CHECK-NEXT: movsd  {{[^,]*}}, %xmm1
+; CHECK-NEXT: minsd  %xmm0, %xmm1
+; CHECK-NEXT: movapd %xmm1, %xmm0
+; CHECK-NEXT: ret
+; UNSAFE:      y_ule:
+; UNSAFE-NEXT: minsd  {{[^,]*}}, %xmm0
+; UNSAFE-NEXT: ret
+; FINITE:      y_ule:
+; FINITE-NEXT: minsd  {{[^,]*}}, %xmm0
+; FINITE-NEXT: ret
+define double @y_ule(double %x) nounwind {
+  %c = fcmp ule double %x, -0.000000e+00
+  %d = select i1 %c, double %x, double -0.000000e+00
+  ret double %d
+}
+
+; CHECK:      y_uge_inverse:
+; CHECK-NEXT: minsd {{[^,]*}}, %xmm0
+; CHECK-NEXT: ret
+; UNSAFE:      y_uge_inverse:
+; UNSAFE-NEXT: movsd {{[^,]*}}, %xmm1
+; UNSAFE-NEXT: minsd %xmm0, %xmm1
+; UNSAFE-NEXT: movapd %xmm1, %xmm0
+; UNSAFE-NEXT: ret
+; FINITE:      y_uge_inverse:
+; FINITE-NEXT: movsd {{[^,]*}}, %xmm1
+; FINITE-NEXT: minsd %xmm0, %xmm1
+; FINITE-NEXT: movapd %xmm1, %xmm0
+; FINITE-NEXT: ret
+define double @y_uge_inverse(double %x) nounwind {
+  %c = fcmp uge double %x, -0.000000e+00
+  %d = select i1 %c, double -0.000000e+00, double %x
+  ret double %d
+}
+
+; CHECK:      y_ule_inverse:
+; CHECK-NEXT: maxsd {{[^,]*}}, %xmm0
+; CHECK-NEXT: ret
+; UNSAFE:      y_ule_inverse:
+; UNSAFE-NEXT: movsd {{[^,]*}}, %xmm1
+; UNSAFE-NEXT: maxsd %xmm0, %xmm1
+; UNSAFE-NEXT: movapd %xmm1, %xmm0
+; UNSAFE-NEXT: ret
+; FINITE:      y_ule_inverse:
+; FINITE-NEXT: movsd {{[^,]*}}, %xmm1
+; FINITE-NEXT: maxsd %xmm0, %xmm1
+; FINITE-NEXT: movapd %xmm1, %xmm0
+; FINITE-NEXT: ret
+define double @y_ule_inverse(double %x) nounwind {
+  %c = fcmp ule double %x, -0.000000e+00
+  %d = select i1 %c, double -0.000000e+00, double %x
+  ret double %d
+}
 ; Test a few more misc. cases.
 
 ; CHECK: clampTo3k_a:
 ; CHECK: minsd
+; UNSAFE: clampTo3k_a:
+; UNSAFE: minsd
+; FINITE: clampTo3k_a:
+; FINITE: minsd
 define double @clampTo3k_a(double %x) nounwind readnone {
 entry:
   %0 = fcmp ogt double %x, 3.000000e+03           ; <i1> [#uses=1]
@@ -330,6 +842,10 @@ entry:
 
 ; CHECK: clampTo3k_b:
 ; CHECK: minsd
+; UNSAFE: clampTo3k_b:
+; UNSAFE: minsd
+; FINITE: clampTo3k_b:
+; FINITE: minsd
 define double @clampTo3k_b(double %x) nounwind readnone {
 entry:
   %0 = fcmp uge double %x, 3.000000e+03           ; <i1> [#uses=1]
@@ -339,6 +855,10 @@ entry:
 
 ; CHECK: clampTo3k_c:
 ; CHECK: maxsd
+; UNSAFE: clampTo3k_c:
+; UNSAFE: maxsd
+; FINITE: clampTo3k_c:
+; FINITE: maxsd
 define double @clampTo3k_c(double %x) nounwind readnone {
 entry:
   %0 = fcmp olt double %x, 3.000000e+03           ; <i1> [#uses=1]
@@ -348,6 +868,10 @@ entry:
 
 ; CHECK: clampTo3k_d:
 ; CHECK: maxsd
+; UNSAFE: clampTo3k_d:
+; UNSAFE: maxsd
+; FINITE: clampTo3k_d:
+; FINITE: maxsd
 define double @clampTo3k_d(double %x) nounwind readnone {
 entry:
   %0 = fcmp ule double %x, 3.000000e+03           ; <i1> [#uses=1]
@@ -357,6 +881,10 @@ entry:
 
 ; CHECK: clampTo3k_e:
 ; CHECK: maxsd
+; UNSAFE: clampTo3k_e:
+; UNSAFE: maxsd
+; FINITE: clampTo3k_e:
+; FINITE: maxsd
 define double @clampTo3k_e(double %x) nounwind readnone {
 entry:
   %0 = fcmp olt double %x, 3.000000e+03           ; <i1> [#uses=1]
@@ -366,6 +894,10 @@ entry:
 
 ; CHECK: clampTo3k_f:
 ; CHECK: maxsd
+; UNSAFE: clampTo3k_f:
+; UNSAFE: maxsd
+; FINITE: clampTo3k_f:
+; FINITE: maxsd
 define double @clampTo3k_f(double %x) nounwind readnone {
 entry:
   %0 = fcmp ule double %x, 3.000000e+03           ; <i1> [#uses=1]
@@ -375,6 +907,10 @@ entry:
 
 ; CHECK: clampTo3k_g:
 ; CHECK: minsd
+; UNSAFE: clampTo3k_g:
+; UNSAFE: minsd
+; FINITE: clampTo3k_g:
+; FINITE: minsd
 define double @clampTo3k_g(double %x) nounwind readnone {
 entry:
   %0 = fcmp ogt double %x, 3.000000e+03           ; <i1> [#uses=1]
@@ -384,6 +920,10 @@ entry:
 
 ; CHECK: clampTo3k_h:
 ; CHECK: minsd
+; UNSAFE: clampTo3k_h:
+; UNSAFE: minsd
+; FINITE: clampTo3k_h:
+; FINITE: minsd
 define double @clampTo3k_h(double %x) nounwind readnone {
 entry:
   %0 = fcmp uge double %x, 3.000000e+03           ; <i1> [#uses=1]
diff --git a/libclamav/c++/llvm/test/CodeGen/X86/sse3.ll b/libclamav/c++/llvm/test/CodeGen/X86/sse3.ll
index b2af7c9..921161e 100644
--- a/libclamav/c++/llvm/test/CodeGen/X86/sse3.ll
+++ b/libclamav/c++/llvm/test/CodeGen/X86/sse3.ll
@@ -144,10 +144,9 @@ define void @t9(<4 x float>* %r, <2 x i32>* %A) nounwind {
 	store <4 x float> %tmp13, <4 x float>* %r
 	ret void
 ; X64: 	t9:
-; X64: 		movsd	(%rsi), %xmm0
-; X64:	        movaps  (%rdi), %xmm1
-; X64:	        movlhps %xmm0, %xmm1
-; X64:	        movaps  %xmm1, (%rdi)
+; X64: 		movaps	(%rdi), %xmm0
+; X64:	        movhps	(%rsi), %xmm0
+; X64:	        movaps	%xmm0, (%rdi)
 ; X64: 		ret
 }
 
diff --git a/libclamav/c++/llvm/test/CodeGen/X86/stack-align.ll b/libclamav/c++/llvm/test/CodeGen/X86/stack-align.ll
index cb65e9b..e971ef7 100644
--- a/libclamav/c++/llvm/test/CodeGen/X86/stack-align.ll
+++ b/libclamav/c++/llvm/test/CodeGen/X86/stack-align.ll
@@ -1,4 +1,4 @@
-; RUN: llc < %s -relocation-model=static -mcpu=yonah | grep {andpd.*4(%esp), %xmm}
+; RUN: llc < %s -relocation-model=static -realign-stack=1 -mcpu=yonah | FileCheck %s
 
 ; The double argument is at 4(esp) which is 16-byte aligned, allowing us to
 ; fold the load into the andpd.
@@ -12,6 +12,7 @@ entry:
 	%tmp = getelementptr { double, double }* %z, i32 0, i32 0		; <double*> [#uses=1]
 	%tmp1 = load double* %tmp, align 8		; <double> [#uses=1]
 	%tmp2 = tail call double @fabs( double %tmp1 )		; <double> [#uses=1]
+    ; CHECK: andpd{{.*}}4(%esp), %xmm
 	%tmp3 = load double* @G, align 16		; <double> [#uses=1]
 	%tmp4 = tail call double @fabs( double %tmp3 )		; <double> [#uses=1]
 	%tmp6 = fadd double %tmp4, %tmp2		; <double> [#uses=1]
@@ -19,4 +20,20 @@ entry:
 	ret void
 }
 
+define void @test2() alignstack(16) {
+entry:
+    ; CHECK: andl{{.*}}$-16, %esp
+    ret void
+}
+
+; Use a call to force a spill.
+define <2 x double> @test3(<2 x double> %x, <2 x double> %y) alignstack(32) {
+entry:
+    ; CHECK: andl{{.*}}$-32, %esp
+    call void @test2()
+    %A = mul <2 x double> %x, %y
+    ret <2 x double> %A
+}
+
 declare double @fabs(double)
+
diff --git a/libclamav/c++/llvm/test/CodeGen/X86/store_op_load_fold.ll b/libclamav/c++/llvm/test/CodeGen/X86/store_op_load_fold.ll
index 66d0e47..6e47eb3 100644
--- a/libclamav/c++/llvm/test/CodeGen/X86/store_op_load_fold.ll
+++ b/libclamav/c++/llvm/test/CodeGen/X86/store_op_load_fold.ll
@@ -4,7 +4,7 @@
 
 @X = internal global i16 0              ; <i16*> [#uses=2]
 
-define void @foo() {
+define void @foo() nounwind {
         %tmp.0 = load i16* @X           ; <i16> [#uses=1]
         %tmp.3 = add i16 %tmp.0, 329            ; <i16> [#uses=1]
         store i16 %tmp.3, i16* @X
diff --git a/libclamav/c++/llvm/test/CodeGen/X86/store_op_load_fold2.ll b/libclamav/c++/llvm/test/CodeGen/X86/store_op_load_fold2.ll
index 0ccfe47..46e59e9 100644
--- a/libclamav/c++/llvm/test/CodeGen/X86/store_op_load_fold2.ll
+++ b/libclamav/c++/llvm/test/CodeGen/X86/store_op_load_fold2.ll
@@ -1,21 +1,12 @@
-; RUN: llc < %s -march=x86 -x86-asm-syntax=intel | \
-; RUN:   grep {and	DWORD PTR} | count 2
+; RUN: llc < %s -march=x86 -x86-asm-syntax=intel | FileCheck %s
 
 target datalayout = "e-p:32:32"
         %struct.Macroblock = type { i32, i32, i32, i32, i32, [8 x i32], %struct.Macroblock*, %struct.Macroblock*, i32, [2 x [4 x [4 x [2 x i32]]]], [16 x i8], [16 x i8], i32, i64, [4 x i32], [4 x i32], i64, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i16, double, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
 
-define internal fastcc i32 @dct_chroma(i32 %uv, i32 %cr_cbp) {
-entry:
-        br i1 true, label %cond_true2732.preheader, label %cond_true129
-cond_true129:           ; preds = %entry
-        ret i32 0
+define internal fastcc i32 @dct_chroma(i32 %uv, i32 %cr_cbp) nounwind {
 cond_true2732.preheader:                ; preds = %entry
         %tmp2666 = getelementptr %struct.Macroblock* null, i32 0, i32 13                ; <i64*> [#uses=2]
         %tmp2674 = trunc i32 0 to i8            ; <i8> [#uses=1]
-        br i1 true, label %cond_true2732.preheader.split.us, label %cond_true2732.preheader.split
-cond_true2732.preheader.split.us:               ; preds = %cond_true2732.preheader
-        br i1 true, label %cond_true2732.outer.us.us, label %cond_true2732.outer.us
-cond_true2732.outer.us.us:              ; preds = %cond_true2732.preheader.split.us
         %tmp2667.us.us = load i64* %tmp2666             ; <i64> [#uses=1]
         %tmp2670.us.us = load i64* null         ; <i64> [#uses=1]
         %shift.upgrd.1 = zext i8 %tmp2674 to i64                ; <i64> [#uses=1]
@@ -24,11 +15,10 @@ cond_true2732.outer.us.us:              ; preds = %cond_true2732.preheader.split
         %tmp2676.us.us = and i64 %tmp2667.us.us, %tmp2675not.us.us              ; <i64> [#uses=1]
         store i64 %tmp2676.us.us, i64* %tmp2666
         ret i32 0
-cond_true2732.outer.us:         ; preds = %cond_true2732.preheader.split.us
-        ret i32 0
-cond_true2732.preheader.split:          ; preds = %cond_true2732.preheader
-        ret i32 0
-cond_next2752:          ; No predecessors!
-        ret i32 0
+
+; CHECK: 	and	{{E..}}, DWORD PTR [360]
+; CHECK:	and	DWORD PTR [356], {{E..}}
+; CHECK:	mov	DWORD PTR [360], {{E..}}
+
 }
 
diff --git a/libclamav/c++/llvm/test/CodeGen/X86/tailcall2.ll b/libclamav/c++/llvm/test/CodeGen/X86/tailcall2.ll
index 80bab61..90315fd 100644
--- a/libclamav/c++/llvm/test/CodeGen/X86/tailcall2.ll
+++ b/libclamav/c++/llvm/test/CodeGen/X86/tailcall2.ll
@@ -195,3 +195,24 @@ bb2:
 }
 
 declare i32 @foo6(i32, i32, %struct.t* byval align 4)
+
+; rdar://r7717598
+%struct.ns = type { i32, i32 }
+%struct.cp = type { float, float }
+
+define %struct.ns* @t13(%struct.cp* %yy) nounwind ssp {
+; 32: t13:
+; 32-NOT: jmp
+; 32: call
+; 32: ret
+
+; 64: t13:
+; 64-NOT: jmp
+; 64: call
+; 64: ret
+entry:
+  %0 = tail call fastcc %struct.ns* @foo7(%struct.cp* byval align 4 %yy, i8 signext 0) nounwind
+  ret %struct.ns* %0
+}
+
+declare fastcc %struct.ns* @foo7(%struct.cp* byval align 4, i8 signext) nounwind ssp
diff --git a/libclamav/c++/llvm/test/CodeGen/X86/trunc-to-bool.ll b/libclamav/c++/llvm/test/CodeGen/X86/trunc-to-bool.ll
index bfab1ae..6062084 100644
--- a/libclamav/c++/llvm/test/CodeGen/X86/trunc-to-bool.ll
+++ b/libclamav/c++/llvm/test/CodeGen/X86/trunc-to-bool.ll
@@ -3,13 +3,14 @@
 ; value and as the operand of a branch.
 ; RUN: llc < %s -march=x86 | FileCheck %s
 
-define i1 @test1(i32 %X) zeroext {
+define i1 @test1(i32 %X) zeroext nounwind {
     %Y = trunc i32 %X to i1
     ret i1 %Y
 }
+; CHECK: test1:
 ; CHECK: andl $1, %eax
 
-define i1 @test2(i32 %val, i32 %mask) {
+define i1 @test2(i32 %val, i32 %mask) nounwind {
 entry:
     %shifted = ashr i32 %val, %mask
     %anded = and i32 %shifted, 1
@@ -20,9 +21,10 @@ ret_true:
 ret_false:
     ret i1 false
 }
-; CHECK: testb $1, %al
+; CHECK: test2:
+; CHECK: btl %eax
 
-define i32 @test3(i8* %ptr) {
+define i32 @test3(i8* %ptr) nounwind {
     %val = load i8* %ptr
     %tmp = trunc i8 %val to i1
     br i1 %tmp, label %cond_true, label %cond_false
@@ -31,9 +33,10 @@ cond_true:
 cond_false:
     ret i32 42
 }
-; CHECK: testb $1, %al
+; CHECK: test3:
+; CHECK: testb $1, (%eax)
 
-define i32 @test4(i8* %ptr) {
+define i32 @test4(i8* %ptr) nounwind {
     %tmp = ptrtoint i8* %ptr to i1
     br i1 %tmp, label %cond_true, label %cond_false
 cond_true:
@@ -41,9 +44,10 @@ cond_true:
 cond_false:
     ret i32 42
 }
-; CHECK: testb $1, %al
+; CHECK: test4:
+; CHECK: testb $1, 4(%esp)
 
-define i32 @test6(double %d) {
+define i32 @test5(double %d) nounwind {
     %tmp = fptosi double %d to i1
     br i1 %tmp, label %cond_true, label %cond_false
 cond_true:
@@ -51,4 +55,5 @@ cond_true:
 cond_false:
     ret i32 42
 }
+; CHECK: test5:
 ; CHECK: testb $1
diff --git a/libclamav/c++/llvm/test/CodeGen/X86/use-add-flags.ll b/libclamav/c++/llvm/test/CodeGen/X86/use-add-flags.ll
index 2dd2a4a..c2f0c23 100644
--- a/libclamav/c++/llvm/test/CodeGen/X86/use-add-flags.ll
+++ b/libclamav/c++/llvm/test/CodeGen/X86/use-add-flags.ll
@@ -5,13 +5,13 @@
 
 ; Use the flags on the add.
 
-; CHECK: add_zf:
+; CHECK: test1:
 ;      CHECK: addl    (%rdi), %esi
 ; CHECK-NEXT: movl    %edx, %eax
 ; CHECK-NEXT: cmovnsl %ecx, %eax
 ; CHECK-NEXT: ret
 
-define i32 @add_zf(i32* %x, i32 %y, i32 %a, i32 %b) nounwind {
+define i32 @test1(i32* %x, i32 %y, i32 %a, i32 %b) nounwind {
 	%tmp2 = load i32* %x, align 4		; <i32> [#uses=1]
 	%tmp4 = add i32 %tmp2, %y		; <i32> [#uses=1]
 	%tmp5 = icmp slt i32 %tmp4, 0		; <i1> [#uses=1]
@@ -24,10 +24,10 @@ declare void @foo(i32)
 ; Don't use the flags result of the and here, since the and has no
 ; other use. A simple test is better.
 
-; CHECK: bar:
+; CHECK: test2:
 ; CHECK: testb   $16, %dil
 
-define void @bar(i32 %x) nounwind {
+define void @test2(i32 %x) nounwind {
   %y = and i32 %x, 16
   %t = icmp eq i32 %y, 0
   br i1 %t, label %true, label %false
@@ -40,11 +40,11 @@ false:
 
 ; Do use the flags result of the and here, since the and has another use.
 
-; CHECK: qux:
+; CHECK: test3:
 ;      CHECK: andl    $16, %edi
 ; CHECK-NEXT: jne
 
-define void @qux(i32 %x) nounwind {
+define void @test3(i32 %x) nounwind {
   %y = and i32 %x, 16
   %t = icmp eq i32 %y, 0
   br i1 %t, label %true, label %false
diff --git a/libclamav/c++/llvm/test/CodeGen/X86/vec_cast.ll b/libclamav/c++/llvm/test/CodeGen/X86/vec_cast.ll
index 1f899b3..6f18d13 100644
--- a/libclamav/c++/llvm/test/CodeGen/X86/vec_cast.ll
+++ b/libclamav/c++/llvm/test/CodeGen/X86/vec_cast.ll
@@ -31,11 +31,10 @@ define <1 x i32> @f(<1 x i16> %a) nounwind {
   ret <1 x i32> %c
 }
 
-; TODO: Legalize doesn't yet handle this.
-;define <8 x i16> @g(<8 x i32> %a) nounwind {
-;  %c = trunc <8 x i32> %a to <8 x i16>
-;  ret <8 x i16> %c
-;}
+define <8 x i16> @g(<8 x i32> %a) nounwind {
+  %c = trunc <8 x i32> %a to <8 x i16>
+  ret <8 x i16> %c
+}
 
 define <3 x i16> @h(<3 x i32> %a) nounwind {
   %c = trunc <3 x i32> %a to <3 x i16>
@@ -46,3 +45,12 @@ define <1 x i16> @i(<1 x i32> %a) nounwind {
   %c = trunc <1 x i32> %a to <1 x i16>
   ret <1 x i16> %c
 }
+
+; PR6438
+define void @__OpenCL_math_kernel4_kernel() nounwind {
+  %tmp12.i = and <4 x i32> zeroinitializer, <i32 2139095040, i32 2139095040, i32 2139095040, i32 2139095040> ; <<4 x i32>> [#uses=1]
+  %cmp13.i = icmp eq <4 x i32> %tmp12.i, <i32 2139095040, i32 2139095040, i32 2139095040, i32 2139095040> ; <<4 x i1>> [#uses=2]
+  %cmp.ext14.i = sext <4 x i1> %cmp13.i to <4 x i32> ; <<4 x i32>> [#uses=0]
+  %tmp2110.i = and <4 x i1> %cmp13.i, zeroinitializer ; <<4 x i1>> [#uses=0]
+  ret void
+}
diff --git a/libclamav/c++/llvm/test/CodeGen/X86/vec_insert.ll b/libclamav/c++/llvm/test/CodeGen/X86/vec_insert.ll
index a7274a9..4e5d445 100644
--- a/libclamav/c++/llvm/test/CodeGen/X86/vec_insert.ll
+++ b/libclamav/c++/llvm/test/CodeGen/X86/vec_insert.ll
@@ -1,7 +1,7 @@
 ; RUN: llc < %s -march=x86 -mattr=+sse2,-sse41 | grep movss | count 1
 ; RUN: llc < %s -march=x86 -mattr=+sse2,-sse41 | not grep pinsrw
 
-define void @test(<4 x float>* %F, i32 %I) {
+define void @test(<4 x float>* %F, i32 %I) nounwind {
 	%tmp = load <4 x float>* %F		; <<4 x float>> [#uses=1]
 	%f = sitofp i32 %I to float		; <float> [#uses=1]
 	%tmp1 = insertelement <4 x float> %tmp, float %f, i32 0		; <<4 x float>> [#uses=2]
@@ -10,7 +10,7 @@ define void @test(<4 x float>* %F, i32 %I) {
 	ret void
 }
 
-define void @test2(<4 x float>* %F, i32 %I, float %g) {
+define void @test2(<4 x float>* %F, i32 %I, float %g) nounwind {
 	%tmp = load <4 x float>* %F		; <<4 x float>> [#uses=1]
 	%f = sitofp i32 %I to float		; <float> [#uses=1]
 	%tmp1 = insertelement <4 x float> %tmp, float %f, i32 2		; <<4 x float>> [#uses=1]
diff --git a/libclamav/c++/llvm/test/CodeGen/X86/vec_shuffle-36.ll b/libclamav/c++/llvm/test/CodeGen/X86/vec_shuffle-36.ll
index 8a93a7e..1ea37c8 100644
--- a/libclamav/c++/llvm/test/CodeGen/X86/vec_shuffle-36.ll
+++ b/libclamav/c++/llvm/test/CodeGen/X86/vec_shuffle-36.ll
@@ -1,9 +1,16 @@
-; RUN: llc < %s -march=x86 -mattr=sse41 -o %t
-; RUN: grep pshufb %t | count 1
-
+; RUN: llc < %s -march=x86-64 -mattr=sse41 | FileCheck %s
 
 define <8 x i16> @shuf6(<8 x i16> %T0, <8 x i16> %T1) nounwind readnone {
+; CHECK: pshufb
+; CHECK-NOT: pshufb
+; CHECK: ret
 entry:
-	%tmp9 = shufflevector <8 x i16> %T0, <8 x i16> %T1, <8 x i32> < i32 3, i32 2, i32 0, i32 2, i32 1, i32 5, i32 6 , i32 undef >
-	ret <8 x i16> %tmp9
+  %tmp9 = shufflevector <8 x i16> %T0, <8 x i16> %T1, <8 x i32> < i32 3, i32 2, i32 0, i32 2, i32 1, i32 5, i32 6 , i32 undef >
+  ret <8 x i16> %tmp9
 }
+
+define <8 x i16> @shuf7(<8 x i16> %t0) {
+; CHECK: pshufd
+  %tmp10 = shufflevector <8 x i16> %t0, <8 x i16> undef, <8 x i32> < i32 undef, i32 2, i32 2, i32 2, i32 2, i32 2, i32 undef, i32 undef >
+  ret <8 x i16> %tmp10
+}
\ No newline at end of file
diff --git a/libclamav/c++/llvm/test/CodeGen/X86/vec_ss_load_fold.ll b/libclamav/c++/llvm/test/CodeGen/X86/vec_ss_load_fold.ll
index b1613fb..c8b2927 100644
--- a/libclamav/c++/llvm/test/CodeGen/X86/vec_ss_load_fold.ll
+++ b/libclamav/c++/llvm/test/CodeGen/X86/vec_ss_load_fold.ll
@@ -1,6 +1,4 @@
-; RUN: llc < %s -march=x86 -mattr=+sse,+sse2 -o %t
-; RUN: grep minss %t | grep CPI | count 2
-; RUN: grep CPI   %t | not grep movss
+; RUN: llc < %s -march=x86 -mattr=+sse,+sse2,+sse41 | FileCheck %s
 
 target datalayout = "e-p:32:32"
 target triple = "i686-apple-darwin8.7.2"
@@ -17,6 +15,10 @@ define i16 @test1(float %f) nounwind {
 	%tmp.upgrd.1 = tail call i32 @llvm.x86.sse.cvttss2si( <4 x float> %tmp59 )		; <i32> [#uses=1]
 	%tmp69 = trunc i32 %tmp.upgrd.1 to i16		; <i16> [#uses=1]
 	ret i16 %tmp69
+; CHECK: test1:
+; CHECK: subss	LCPI1_
+; CHECK: mulss	LCPI1_
+; CHECK: minss	LCPI1_
 }
 
 define i16 @test2(float %f) nounwind {
@@ -28,6 +30,10 @@ define i16 @test2(float %f) nounwind {
 	%tmp = tail call i32 @llvm.x86.sse.cvttss2si( <4 x float> %tmp59 )		; <i32> [#uses=1]
 	%tmp69 = trunc i32 %tmp to i16		; <i16> [#uses=1]
 	ret i16 %tmp69
+; CHECK: test2:
+; CHECK: addss	LCPI2_
+; CHECK: mulss	LCPI2_
+; CHECK: minss	LCPI2_
 }
 
 declare <4 x float> @llvm.x86.sse.sub.ss(<4 x float>, <4 x float>)
@@ -39,3 +45,28 @@ declare <4 x float> @llvm.x86.sse.min.ss(<4 x float>, <4 x float>)
 declare <4 x float> @llvm.x86.sse.max.ss(<4 x float>, <4 x float>)
 
 declare i32 @llvm.x86.sse.cvttss2si(<4 x float>)
+
+
+declare <4 x float> @llvm.x86.sse41.round.ss(<4 x float>, <4 x float>, i32)
+declare <4 x float> @f()
+
+define <4 x float> @test3(<4 x float> %A, float *%b, i32 %C) nounwind {
+  %a = load float *%b
+  %B = insertelement <4 x float> undef, float %a, i32 0
+  %X = call <4 x float> @llvm.x86.sse41.round.ss(<4 x float> %A, <4 x float> %B, i32 4)
+  ret <4 x float> %X
+; CHECK: test3:
+; CHECK: roundss	$4, (%eax), %xmm0
+}
+
+define <4 x float> @test4(<4 x float> %A, float *%b, i32 %C) nounwind {
+  %a = load float *%b
+  %B = insertelement <4 x float> undef, float %a, i32 0
+  %q = call <4 x float> @f()
+  %X = call <4 x float> @llvm.x86.sse41.round.ss(<4 x float> %q, <4 x float> %B, i32 4)
+  ret <4 x float> %X
+; CHECK: test4:
+; CHECK: movss	(%eax), %xmm
+; CHECK: call
+; CHECK: roundss $4, %xmm{{.*}}, %xmm0
+}
diff --git a/libclamav/c++/llvm/test/CodeGen/X86/xor-icmp.ll b/libclamav/c++/llvm/test/CodeGen/X86/xor-icmp.ll
index a6bdb13..2d75c5d 100644
--- a/libclamav/c++/llvm/test/CodeGen/X86/xor-icmp.ll
+++ b/libclamav/c++/llvm/test/CodeGen/X86/xor-icmp.ll
@@ -1,5 +1,6 @@
 ; RUN: llc < %s -march=x86    | FileCheck %s -check-prefix=X32
 ; RUN: llc < %s -march=x86-64 | FileCheck %s -check-prefix=X64
+; rdar://7367229
 
 define i32 @t(i32 %a, i32 %b) nounwind ssp {
 entry:
@@ -34,3 +35,33 @@ bb1:                                              ; preds = %entry
 declare i32 @foo(...)
 
 declare i32 @bar(...)
+
+define i32 @t2(i32 %x, i32 %y) nounwind ssp {
+; X32: t2:
+; X32: cmpl
+; X32: sete
+; X32: cmpl
+; X32: sete
+; X32-NOT: xor
+; X32: je
+
+; X64: t2:
+; X64: testl
+; X64: sete
+; X64: testl
+; X64: sete
+; X64-NOT: xor
+; X64: je
+entry:
+  %0 = icmp eq i32 %x, 0                          ; <i1> [#uses=1]
+  %1 = icmp eq i32 %y, 0                          ; <i1> [#uses=1]
+  %2 = xor i1 %1, %0                              ; <i1> [#uses=1]
+  br i1 %2, label %bb, label %return
+
+bb:                                               ; preds = %entry
+  %3 = tail call i32 (...)* @foo() nounwind       ; <i32> [#uses=0]
+  ret i32 undef
+
+return:                                           ; preds = %entry
+  ret i32 undef
+}
diff --git a/libclamav/c++/llvm/test/ExecutionEngine/2010-01-15-UndefValue.ll b/libclamav/c++/llvm/test/ExecutionEngine/2010-01-15-UndefValue.ll
index 7d646eb..33ca63a 100644
--- a/libclamav/c++/llvm/test/ExecutionEngine/2010-01-15-UndefValue.ll
+++ b/libclamav/c++/llvm/test/ExecutionEngine/2010-01-15-UndefValue.ll
@@ -3,7 +3,7 @@
 
 define i32 @main() {
        %a = add i32 0, undef
-       %b = add float 0.0, undef
-       %c = add double 0.0, undef
+       %b = fadd float 0.0, undef
+       %c = fadd double 0.0, undef
        ret i32 0
 }
diff --git a/libclamav/c++/llvm/test/Makefile b/libclamav/c++/llvm/test/Makefile
index e7776f8..3750fdb 100644
--- a/libclamav/c++/llvm/test/Makefile
+++ b/libclamav/c++/llvm/test/Makefile
@@ -155,7 +155,6 @@ site.exp: FORCE
 	@echo 'set target_triplet "$(TARGET_TRIPLE)"' >> site.tmp
 	@echo 'set TARGETS_TO_BUILD "$(TARGETS_TO_BUILD)"' >> site.tmp
 	@echo 'set llvmgcc_langs "$(LLVMGCC_LANGS)"' >> site.tmp
-	@echo 'set llvmgcc_version "$(LLVMGCC_VERSION)"' >> site.tmp
 	@echo 'set llvmtoolsdir "$(ToolDir)"' >>site.tmp
 	@echo 'set llvmlibsdir "$(LibDir)"' >>site.tmp
 	@echo 'set llvm_bindings "$(BINDINGS_TO_BUILD)"' >> site.tmp
@@ -170,7 +169,6 @@ site.exp: FORCE
 	@echo 'set link "' $(CXX) $(CPP.Flags) $(CXX.Flags) $(TargetCommonOpts) $(CompileCommonOpts) $(LD.Flags) '"' >>site.tmp
 	@echo 'set llvmgcc "$(LLVMGCC) $(TargetCommonOpts) $(EXTRA_OPTIONS)"' >> site.tmp
 	@echo 'set llvmgxx "$(LLVMGCC) $(TargetCommonOpts) $(EXTRA_OPTIONS)"' >> site.tmp
-	@echo 'set llvmgccmajvers "$(LLVMGCC_MAJVERS)"' >> site.tmp
 	@echo 'set bugpoint_topts $(BUGPOINT_TOPTS)' >> site.tmp
 	@echo 'set shlibext "$(SHLIBEXT)"' >> site.tmp
 	@echo 'set ocamlopt "$(OCAMLOPT) -cc \"$(CXX_FOR_OCAMLOPT)\" -I $(LibDir)/ocaml"' >> site.tmp
@@ -200,4 +198,6 @@ Unit/lit.site.cfg: $(PROJ_OBJ_DIR)/Unit/.dir FORCE
 	     -e "s#@LLVM_TOOLS_DIR@#$(ToolDir)#g" \
 	     -e "s#@LLVMGCCDIR@#$(LLVMGCCDIR)#g" \
 	     -e "s#@LLVM_BUILD_MODE@#$(BuildMode)#g" \
+	     -e "s#@ENABLE_SHARED@#$(ENABLE_SHARED)#g" \
+	     -e "s#@SHLIBPATH_VAR@#$(SHLIBPATH_VAR)#g" \
 	     $(PROJ_SRC_DIR)/Unit/lit.site.cfg.in > $@
diff --git a/libclamav/c++/llvm/test/Makefile.tests b/libclamav/c++/llvm/test/Makefile.tests
index 90e9f2c..aeb5871 100644
--- a/libclamav/c++/llvm/test/Makefile.tests
+++ b/libclamav/c++/llvm/test/Makefile.tests
@@ -49,15 +49,15 @@ clean::
 
 # Compile from X.c to Output/X.ll
 Output/%.ll: %.c $(LCC1) Output/.dir $(INCLUDES)
-	-$(LLVMGCCWITHPATH) $(CPPFLAGS) $(LCCFLAGS) -S $< -o $@
+	-$(LLVMCC) $(CPPFLAGS) $(LCCFLAGS) -S $< -o $@
 
 # Compile from X.cpp to Output/X.ll
 Output/%.ll: %.cpp $(LCC1XX) Output/.dir $(INCLUDES)
-	-$(LLVMGXXWITHPATH) $(CPPFLAGS) $(LCXXFLAGS) -S $< -o $@
+	-$(LLVMCXX) $(CPPFLAGS) $(LCXXFLAGS) -S $< -o $@
 
 # Compile from X.cc to Output/X.ll
 Output/%.ll: %.cc $(LCC1XX) Output/.dir $(INCLUDES)
-	-$(LLVMGXXWITHPATH) $(CPPFLAGS) $(LCXXFLAGS) -S $< -o $@
+	-$(LLVMCXX) $(CPPFLAGS) $(LCXXFLAGS) -S $< -o $@
 
 # LLVM Assemble from Output/X.ll to Output/X.bc.  Output/X.ll must have come
 # from GCC output, so use GCCAS.
diff --git a/libclamav/c++/llvm/test/Other/2008-03-19-PassManager.ll b/libclamav/c++/llvm/test/Other/2008-03-19-PassManager.ll
deleted file mode 100644
index e208222..0000000
--- a/libclamav/c++/llvm/test/Other/2008-03-19-PassManager.ll
+++ /dev/null
@@ -1,58 +0,0 @@
-; PR 2034
-; RUN: opt < %s -anders-aa -instcombine  -gvn -disable-output
-	%struct.FULL = type { i32, i32, [1000 x float*] }
-
-define i32 @sgesl(%struct.FULL* %a, i32* %ipvt, float* %b, i32 %job) {
-entry:
-	%a_addr = alloca %struct.FULL*		; <%struct.FULL**> [#uses=1]
-	%ipvt_addr = alloca i32*		; <i32**> [#uses=1]
-	%b_addr = alloca float*		; <float**> [#uses=1]
-	%job_addr = alloca i32		; <i32*> [#uses=1]
-	%akk = alloca float*		; <float**> [#uses=2]
-	%k = alloca i32		; <i32*> [#uses=1]
-	%l = alloca i32		; <i32*> [#uses=1]
-	%n = alloca i32		; <i32*> [#uses=1]
-	%nm1 = alloca i32		; <i32*> [#uses=1]
-	%tmp5 = load i32* %job_addr, align 4		; <i32> [#uses=1]
-	%tmp6 = icmp eq i32 %tmp5, 0		; <i1> [#uses=1]
-	%tmp67 = zext i1 %tmp6 to i8		; <i8> [#uses=1]
-	%toBool = icmp ne i8 %tmp67, 0		; <i1> [#uses=1]
-	br i1 %toBool, label %cond_true, label %cond_next137
-
-cond_true:		; preds = %entry
-	%tmp732 = load i32* %nm1, align 4		; <i32> [#uses=1]
-	%tmp743 = icmp slt i32 0, %tmp732		; <i1> [#uses=1]
-	%tmp74754 = zext i1 %tmp743 to i8		; <i8> [#uses=1]
-	%toBool765 = icmp ne i8 %tmp74754, 0		; <i1> [#uses=1]
-	br i1 %toBool765, label %bb, label %bb77
-
-bb:		; preds = %cond_true
-	%tmp9 = load %struct.FULL** %a_addr, align 4		; <%struct.FULL*> [#uses=1]
-	%tmp10 = getelementptr %struct.FULL* %tmp9, i32 0, i32 2		; <[1000 x float*]*> [#uses=1]
-	%tmp11 = getelementptr [1000 x float*]* %tmp10, i32 0, i32 0		; <float**> [#uses=1]
-	%tmp12 = load float** %tmp11, align 4		; <float*> [#uses=1]
-	%tmp13 = load i32* %k, align 4		; <i32> [#uses=1]
-	%tmp14 = getelementptr float* %tmp12, i32 %tmp13		; <float*> [#uses=1]
-	store float* %tmp14, float** %akk, align 4
-	%tmp17 = load float** %b_addr, align 4		; <float*> [#uses=0]
-	%tmp18 = load i32* %l, align 4		; <i32> [#uses=0]
-	ret i32 0
-
-bb77:		; preds = %cond_true
-	ret i32 0
-
-cond_next137:		; preds = %entry
-	%tmp18922 = load i32* %n, align 4		; <i32> [#uses=1]
-	%tmp19023 = icmp slt i32 0, %tmp18922		; <i1> [#uses=1]
-	%tmp19019124 = zext i1 %tmp19023 to i8		; <i8> [#uses=1]
-	%toBool19225 = icmp ne i8 %tmp19019124, 0		; <i1> [#uses=1]
-	br i1 %toBool19225, label %bb138, label %bb193
-
-bb138:		; preds = %cond_next137
-	store float* null, float** %akk, align 4
-	ret i32 0
-
-bb193:		; preds = %cond_next137
-	%tmp196 = load i32** %ipvt_addr, align 4		; <i32*> [#uses=0]
-	ret i32 0
-}
diff --git a/libclamav/c++/llvm/test/Other/constant-fold-gep.ll b/libclamav/c++/llvm/test/Other/constant-fold-gep.ll
index 2888b3d..5358e1f 100644
--- a/libclamav/c++/llvm/test/Other/constant-fold-gep.ll
+++ b/libclamav/c++/llvm/test/Other/constant-fold-gep.ll
@@ -69,6 +69,8 @@
 ; PLAIN: @g = constant i64 ptrtoint (double* getelementptr (%0* null, i64 0, i32 1) to i64)
 ; PLAIN: @h = constant i64 ptrtoint (i1** getelementptr (i1** null, i32 1) to i64)
 ; PLAIN: @i = constant i64 ptrtoint (i1** getelementptr (%2* null, i64 0, i32 1) to i64)
+; PLAIN: @j = constant i64 ptrtoint (double* getelementptr (%0* null, i64 0, i32 1) to i64)
+; PLAIN: @k = constant i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64)
 ; OPT: @a = constant i64 mul (i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64), i64 2310)
 ; OPT: @b = constant i64 ptrtoint (double* getelementptr (%0* null, i64 0, i32 1) to i64)
 ; OPT: @c = constant i64 mul (i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64), i64 2)
@@ -78,6 +80,8 @@
 ; OPT: @g = constant i64 ptrtoint (double* getelementptr (%0* null, i64 0, i32 1) to i64)
 ; OPT: @h = constant i64 ptrtoint (i1** getelementptr (i1** null, i32 1) to i64)
 ; OPT: @i = constant i64 ptrtoint (i1** getelementptr (%2* null, i64 0, i32 1) to i64)
+; OPT: @j = constant i64 ptrtoint (double* getelementptr (%0* null, i64 0, i32 1) to i64)
+; OPT: @k = constant i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64)
 ; TO: @a = constant i64 18480
 ; TO: @b = constant i64 8
 ; TO: @c = constant i64 16
@@ -87,6 +91,8 @@
 ; TO: @g = constant i64 8
 ; TO: @h = constant i64 8
 ; TO: @i = constant i64 8
+; TO: @j = constant i64 8
+; TO: @k = constant i64 8
 
 @a = constant i64 mul (i64 3, i64 mul (i64 ptrtoint ({[7 x double], [7 x double]}* getelementptr ({[7 x double], [7 x double]}* null, i64 11) to i64), i64 5))
 @b = constant i64 ptrtoint ([13 x double]* getelementptr ({i1, [13 x double]}* null, i64 0, i32 1) to i64)
@@ -97,6 +103,8 @@
 @g = constant i64 ptrtoint ({double, double}* getelementptr ({i1, {double, double}}* null, i64 0, i32 1) to i64)
 @h = constant i64 ptrtoint (double** getelementptr (double** null, i64 1) to i64)
 @i = constant i64 ptrtoint (double** getelementptr ({i1, double*}* null, i64 0, i32 1) to i64)
+ at j = constant i64 ptrtoint (union {double, double}* getelementptr ({i1, union {double, double}}* null, i64 0, i32 1) to i64)
+ at k = constant i64 ptrtoint (union {double, double}* getelementptr (union {double, double}* null, i64 1) to i64)
 
 ; The target-dependent folder should cast GEP indices to integer-sized pointers.
 
@@ -244,15 +252,23 @@ define i1* @hoo1() nounwind {
 ; PLAIN:   ret i64 %t
 ; PLAIN: }
 ; PLAIN: define i64 @fg() nounwind {
-; PLAIN:   %t = bitcast i64 ptrtoint (double* getelementptr (%0* null, i64 0, i32 1) to i64)
+; PLAIN:   %t = bitcast i64 ptrtoint (double* getelementptr (%0* null, i64 0, i32 1) to i64) to i64
 ; PLAIN:   ret i64 %t
 ; PLAIN: }
 ; PLAIN: define i64 @fh() nounwind {
-; PLAIN:   %t = bitcast i64 ptrtoint (i1** getelementptr (i1** null, i32 1) to i64)
+; PLAIN:   %t = bitcast i64 ptrtoint (i1** getelementptr (i1** null, i32 1) to i64) to i64
 ; PLAIN:   ret i64 %t
 ; PLAIN: }
 ; PLAIN: define i64 @fi() nounwind {
-; PLAIN:   %t = bitcast i64 ptrtoint (i1** getelementptr (%2* null, i64 0, i32 1) to i64)
+; PLAIN:   %t = bitcast i64 ptrtoint (i1** getelementptr (%2* null, i64 0, i32 1) to i64) to i64
+; PLAIN:   ret i64 %t
+; PLAIN: }
+; PLAIN: define i64 @fj() nounwind {
+; PLAIN:   %t = bitcast i64 ptrtoint (double* getelementptr (%0* null, i64 0, i32 1) to i64) to i64
+; PLAIN:   ret i64 %t
+; PLAIN: }
+; PLAIN: define i64 @fk() nounwind {
+; PLAIN:   %t = bitcast i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64) to i64
 ; PLAIN:   ret i64 %t
 ; PLAIN: }
 ; OPT: define i64 @fa() nounwind {
@@ -282,6 +298,12 @@ define i1* @hoo1() nounwind {
 ; OPT: define i64 @fi() nounwind {
 ; OPT:   ret i64 ptrtoint (i1** getelementptr (%2* null, i64 0, i32 1) to i64)
 ; OPT: }
+; OPT: define i64 @fj() nounwind {
+; OPT:   ret i64 ptrtoint (double* getelementptr (%0* null, i64 0, i32 1) to i64)
+; OPT: }
+; OPT: define i64 @fk() nounwind {
+; OPT:   ret i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64)
+; OPT: }
 ; TO: define i64 @fa() nounwind {
 ; TO:   ret i64 18480
 ; TO: }
@@ -309,6 +331,12 @@ define i1* @hoo1() nounwind {
 ; TO: define i64 @fi() nounwind {
 ; TO:   ret i64 8
 ; TO: }
+; TO: define i64 @fj() nounwind {
+; TO:   ret i64 8
+; TO: }
+; TO: define i64 @fk() nounwind {
+; TO:   ret i64 8
+; TO: }
 ; SCEV: Classifying expressions for: @fa
 ; SCEV:   %t = bitcast i64 mul (i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64), i64 2310) to i64 
 ; SCEV:   -->  (2310 * sizeof(double))
@@ -328,14 +356,20 @@ define i1* @hoo1() nounwind {
 ; SCEV:   %t = bitcast i64 1 to i64 
 ; SCEV:   -->  1
 ; SCEV: Classifying expressions for: @fg
-; SCEV:   %t = bitcast i64 ptrtoint (double* getelementptr (%0* null, i64 0, i32 1) to i64)
+; SCEV:   %t = bitcast i64 ptrtoint (double* getelementptr (%0* null, i64 0, i32 1) to i64) to i64
 ; SCEV:   -->  alignof(double)
 ; SCEV: Classifying expressions for: @fh
-; SCEV:   %t = bitcast i64 ptrtoint (i1** getelementptr (i1** null, i32 1) to i64)
+; SCEV:   %t = bitcast i64 ptrtoint (i1** getelementptr (i1** null, i32 1) to i64) to i64
 ; SCEV:   -->  sizeof(i1*)
 ; SCEV: Classifying expressions for: @fi
-; SCEV:   %t = bitcast i64 ptrtoint (i1** getelementptr (%2* null, i64 0, i32 1) to i64)
+; SCEV:   %t = bitcast i64 ptrtoint (i1** getelementptr (%2* null, i64 0, i32 1) to i64) to i64
 ; SCEV:   -->  alignof(i1*)
+; SCEV: Classifying expressions for: @fj
+; SCEV:   %t = bitcast i64 ptrtoint (double* getelementptr (%0* null, i64 0, i32 1) to i64) to i64
+; SCEV:   -->  alignof(double)
+; SCEV: Classifying expressions for: @fk
+; SCEV:   %t = bitcast i64 ptrtoint (double* getelementptr (double* null, i32 1) to i64) to i64
+; SCEV:   -->  sizeof(double)
 
 define i64 @fa() nounwind {
   %t = bitcast i64 mul (i64 3, i64 mul (i64 ptrtoint ({[7 x double], [7 x double]}* getelementptr ({[7 x double], [7 x double]}* null, i64 11) to i64), i64 5)) to i64
@@ -373,6 +407,14 @@ define i64 @fi() nounwind {
   %t = bitcast i64 ptrtoint (double** getelementptr ({i1, double*}* null, i64 0, i32 1) to i64) to i64
   ret i64 %t
 }
+define i64 @fj() nounwind {
+  %t = bitcast i64 ptrtoint (union {double, double}* getelementptr ({i1, union {double, double}}* null, i64 0, i32 1) to i64) to i64
+  ret i64 %t
+}
+define i64 @fk() nounwind {
+  %t = bitcast i64 ptrtoint (union {double, double}* getelementptr (union {double, double}* null, i64 1) to i64) to i64
+  ret i64 %t
+}
 
 ; PLAIN: define i64* @fM() nounwind {
 ; PLAIN:   %t = bitcast i64* getelementptr (i64* null, i32 1) to i64*
diff --git a/libclamav/c++/llvm/test/Unit/lit.cfg b/libclamav/c++/llvm/test/Unit/lit.cfg
index 34372bb..5fe0732 100644
--- a/libclamav/c++/llvm/test/Unit/lit.cfg
+++ b/libclamav/c++/llvm/test/Unit/lit.cfg
@@ -23,7 +23,14 @@ config.test_format = lit.formats.GoogleTest(llvm_build_mode, 'Tests')
 
 ###
 
-import os
+# If necessary, point the dynamic loader at libLLVM.so.
+if config.enable_shared:
+    libdir = os.path.join(config.llvm_obj_root, config.llvm_build_mode, 'lib')
+    shlibpath = config.environment.get(config.shlibpath_var,'')
+    if shlibpath:
+        shlibpath = ':' + shlibpath
+    shlibpath = libdir + shlibpath
+    config.environment[config.shlibpath_var] = shlibpath
 
 # Check that the object root is known.
 if config.test_exec_root is None:
diff --git a/libclamav/c++/llvm/test/Unit/lit.site.cfg.in b/libclamav/c++/llvm/test/Unit/lit.site.cfg.in
index c190ffa..51b5bc4 100644
--- a/libclamav/c++/llvm/test/Unit/lit.site.cfg.in
+++ b/libclamav/c++/llvm/test/Unit/lit.site.cfg.in
@@ -5,6 +5,8 @@ config.llvm_obj_root = "@LLVM_BINARY_DIR@"
 config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
 config.llvmgcc_dir = "@LLVMGCCDIR@"
 config.llvm_build_mode = "@LLVM_BUILD_MODE@"
+config.enable_shared = @ENABLE_SHARED@
+config.shlibpath_var = "@SHLIBPATH_VAR@"
 
 # Let the main config do the real work.
 lit.load_config(config, "@LLVM_SOURCE_DIR@/test/Unit/lit.cfg")
diff --git a/libclamav/c++/llvm/test/lib/llvm.exp b/libclamav/c++/llvm/test/lib/llvm.exp
index 319cc11..19a2729 100644
--- a/libclamav/c++/llvm/test/lib/llvm.exp
+++ b/libclamav/c++/llvm/test/lib/llvm.exp
@@ -47,7 +47,7 @@ proc execOneLine { test PRS outcome lineno line } {
 # cases.
 proc substitute { line test tmpFile } {
   global srcroot objroot srcdir objdir subdir target_triplet
-  global llvmgcc llvmgxx llvmgcc_version llvmgccmajvers ocamlopt
+  global llvmgcc llvmgxx ocamlopt
   global gccpath gxxpath compile_c compile_cxx link shlibext llvmlibsdir
   global llvmdsymutil valgrind grep gas bugpoint_topts
   set path [file join $srcdir $subdir]
@@ -119,7 +119,7 @@ proc substitute { line test tmpFile } {
 
 # This procedure runs the set of tests for the test_source_files array.
 proc RunLLVMTests { test_source_files } {
-  global srcroot objroot srcdir objdir subdir target_triplet llvmgcc_version
+  global srcroot objroot srcdir objdir subdir target_triplet
   set timeout 60
 
   set path [file join $objdir $subdir]
@@ -194,12 +194,6 @@ proc RunLLVMTests { test_source_files } {
               if {$targetPASS != 1} {
                  set outcome XFAIL
               }
-          } elseif { [regexp {llvmgcc(([0-9]+)|([0-9]+[.][0-9]+))} $target match submatch submatch2]  } {
-            if { [regexp ^($submatch)$|^(($submatch)(\.)) $llvmgcc_version match] } {
-              if {$targetPASS != 1} {
-                 set outcome XFAIL
-              }
-            }
           }
         }
       } elseif {[regexp {XTARGET:[ *](.+)} $line match targets]} {
@@ -213,11 +207,6 @@ proc RunLLVMTests { test_source_files } {
           } elseif { [regexp $target $target_triplet match] } {
               set targetPASS 1
               set outcome PASS
-          } elseif { [regexp {llvmgcc(([0-9]+)|([0-9]+[.][0-9]+))} $target match submatch submatch2]  } {
-            if { [regexp ^($submatch)$|^(($submatch)(\.)) $llvmgcc_version match] } {
-              set targetPASS 1
-              set outcome PASS
-            }
           }
         }
       }
diff --git a/libclamav/c++/llvm/test/lit.cfg b/libclamav/c++/llvm/test/lit.cfg
index 0894d9b..b4aec5a 100644
--- a/libclamav/c++/llvm/test/lit.cfg
+++ b/libclamav/c++/llvm/test/lit.cfg
@@ -40,13 +40,14 @@ if llvm_obj_root is not None:
     config.environment['PATH'] = path
 
     llvmgcc_dir = getattr(config, 'llvmgcc_dir', None)
-    if not llvm_tools_dir:
-        lit.fatal('No llvm-gcc dir set!')
     if llvmgcc_dir:
         path = os.path.pathsep.join((os.path.join(llvmgcc_dir, 'bin'),
                                      config.environment['PATH']))
         config.environment['PATH'] = path
 
+# Propogate 'HOME' through the environment.
+config.environment['HOME'] = os.environ['HOME']
+
 ###
 
 import os
@@ -143,6 +144,9 @@ bindings = set(site_exp['llvm_bindings'].split(','))
 def llvm_supports_binding(name):
     return name in bindings
 
+config.conditions["TARGET"] = llvm_supports_target
+config.conditions["BINDING"] = llvm_supports_binding
+
 # Provide on_clone hook for reading 'dg.exp'.
 import os
 simpleLibData = re.compile(r"""load_lib llvm.exp
diff --git a/libclamav/c++/llvm/test/site.exp.in b/libclamav/c++/llvm/test/site.exp.in
index f88d361..c760c2c 100644
--- a/libclamav/c++/llvm/test/site.exp.in
+++ b/libclamav/c++/llvm/test/site.exp.in
@@ -3,7 +3,6 @@
 set target_triplet "@TARGET_TRIPLE@"
 set TARGETS_TO_BUILD "@TARGETS_TO_BUILD@"
 set llvmgcc_langs "@LLVMGCC_LANGS@"
-set llvmgcc_version "@LLVMGCC_VERSION@"
 set llvmtoolsdir "@LLVM_TOOLS_DIR@"
 set llvmlibsdir "@LLVM_LIBS_DIR@"
 set llvm_bindings "@LLVM_BINDINGS@"
@@ -18,7 +17,6 @@ set compile_cxx "@TEST_COMPILE_CXX_CMD@"
 set link "@TEST_LINK_CMD@"
 set llvmgcc "@LLVMGCC@"
 set llvmgxx "@LLVMGXX@"
-set llvmgccmajvers "@LLVMGCCMAJVERS@"
 set bugpoint_topts "@BUGPOINT_TOPTS@"
 set shlibext "@SHLIBEXT@"
 set ocamlopt "@OCAMLOPT@"
diff --git a/libclamav/c++/llvm/tools/Makefile b/libclamav/c++/llvm/tools/Makefile
index c9b9ff2..a108881 100644
--- a/libclamav/c++/llvm/tools/Makefile
+++ b/libclamav/c++/llvm/tools/Makefile
@@ -23,6 +23,7 @@ PARALLEL_DIRS := opt llvm-as llvm-dis \
                  bugpoint llvm-bcanalyzer llvm-stub \
                  llvm-mc llvmc \
                  edis
+                 
 
 # Let users override the set of tools to build from the command line.
 ifdef ONLY_TOOLS
@@ -32,16 +33,27 @@ endif
 
 include $(LEVEL)/Makefile.config
 
+# These libraries build as dynamic libraries (.dylib /.so), they can only be
+# built if ENABLE_PIC is set.
 ifeq ($(ENABLE_PIC),1)
-  DIRS += lto
-  ifdef BINUTILS_INCDIR
-    DIRS += gold
+  # No support for dynamic libraries on windows targets.
+  ifneq ($(TARGET_OS), $(filter $(TARGET_OS), Cygwin MingW))
+    PARALLEL_DIRS += edis
+    
+    # gold only builds if binutils is around.  It requires "lto" to build before
+    # it so it is added to DIRS.
+    ifdef BINUTILS_INCDIR
+      PARALLEL_DIRS += gold
+      DIRS += lto
+    else
+      PARALLEL_DIRS += lto
+    endif
   endif
 endif
 
-# No support for lto / gold on windows targets
-ifeq ($(TARGET_OS), $(filter $(TARGET_OS), Cygwin MingW))
-  DIRS := $(filter-out lto gold, $(DIRS))
+# Only build edis if X86 target support is enabled.
+ifeq ($(filter $(TARGETS_TO_BUILD), X86),)
+  PARALLEL_DIRS := $(filter-out edis, $(PARALLEL_DIRS))
 endif
 
 include $(LEVEL)/Makefile.common
diff --git a/libclamav/c++/llvm/tools/edis/EDDisassembler.cpp b/libclamav/c++/llvm/tools/edis/EDDisassembler.cpp
deleted file mode 100644
index 99864fb..0000000
--- a/libclamav/c++/llvm/tools/edis/EDDisassembler.cpp
+++ /dev/null
@@ -1,386 +0,0 @@
-//===-EDDisassembler.cpp - LLVM Enhanced Disassembler ---------------------===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-// 
-//===----------------------------------------------------------------------===//
-//
-// This file implements the Enhanced Disassembly library's  disassembler class.
-// The disassembler is responsible for vending individual instructions according
-// to a given architecture and disassembly syntax.
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/ADT/OwningPtr.h"
-#include "llvm/ADT/SmallVector.h"
-#include "llvm/MC/MCAsmInfo.h"
-#include "llvm/MC/MCContext.h"
-#include "llvm/MC/MCDisassembler.h"
-#include "llvm/MC/MCExpr.h"
-#include "llvm/MC/MCInst.h"
-#include "llvm/MC/MCInstPrinter.h"
-#include "llvm/MC/MCStreamer.h"
-#include "llvm/MC/MCParser/AsmLexer.h"
-#include "llvm/MC/MCParser/AsmParser.h"
-#include "llvm/MC/MCParser/MCAsmParser.h"
-#include "llvm/MC/MCParser/MCParsedAsmOperand.h"
-#include "llvm/Support/MemoryBuffer.h"
-#include "llvm/Support/MemoryObject.h"
-#include "llvm/Support/SourceMgr.h"
-#include "llvm/Target/TargetAsmLexer.h"
-#include "llvm/Target/TargetAsmParser.h"
-#include "llvm/Target/TargetRegistry.h"
-#include "llvm/Target/TargetMachine.h"
-#include "llvm/Target/TargetRegisterInfo.h"
-#include "llvm/Target/TargetSelect.h"
-
-#include "EDDisassembler.h"
-#include "EDInst.h"
-
-#include "../../lib/Target/X86/X86GenEDInfo.inc"
-
-using namespace llvm;
-
-bool EDDisassembler::sInitialized = false;
-EDDisassembler::DisassemblerMap_t EDDisassembler::sDisassemblers;
-
-struct InfoMap {
-  Triple::ArchType Arch;
-  const char *String;
-  const InstInfo *Info;
-};
-
-static struct InfoMap infomap[] = {
-  { Triple::x86,          "i386-unknown-unknown",   instInfoX86 },
-  { Triple::x86_64,       "x86_64-unknown-unknown", instInfoX86 },
-  { Triple::InvalidArch,  NULL,                     NULL        }
-};
-
-/// infoFromArch - Returns the InfoMap corresponding to a given architecture,
-///   or NULL if there is an error
-///
-/// @arg arch - The Triple::ArchType for the desired architecture
-static const InfoMap *infoFromArch(Triple::ArchType arch) {
-  unsigned int infoIndex;
-  
-  for (infoIndex = 0; infomap[infoIndex].String != NULL; ++infoIndex) {
-    if(arch == infomap[infoIndex].Arch)
-      return &infomap[infoIndex];
-  }
-  
-  return NULL;
-}
-
-/// getLLVMSyntaxVariant - gets the constant to use to get an assembly printer
-///   for the desired assembly syntax, suitable for passing to 
-///   Target::createMCInstPrinter()
-///
-/// @arg arch   - The target architecture
-/// @arg syntax - The assembly syntax in sd form
-static int getLLVMSyntaxVariant(Triple::ArchType arch,
-                                EDAssemblySyntax_t syntax) {
-  switch (syntax) {
-  default:
-    return -1;
-  // Mappings below from X86AsmPrinter.cpp
-  case kEDAssemblySyntaxX86ATT:
-    if (arch == Triple::x86 || arch == Triple::x86_64)
-      return 0;
-    else
-      return -1;
-  case kEDAssemblySyntaxX86Intel:
-    if (arch == Triple::x86 || arch == Triple::x86_64)
-      return 1;
-    else
-      return -1;
-  }
-}
-
-#define BRINGUP_TARGET(tgt)           \
-  LLVMInitialize##tgt##TargetInfo();  \
-  LLVMInitialize##tgt##Target();      \
-  LLVMInitialize##tgt##AsmPrinter();  \
-  LLVMInitialize##tgt##AsmParser();   \
-  LLVMInitialize##tgt##Disassembler();
-
-void EDDisassembler::initialize() {
-  if (sInitialized)
-    return;
-  
-  sInitialized = true;
-  
-  BRINGUP_TARGET(X86)
-}
-
-#undef BRINGUP_TARGET
-
-EDDisassembler *EDDisassembler::getDisassembler(Triple::ArchType arch,
-                                                EDAssemblySyntax_t syntax) {
-  CPUKey key;
-  key.Arch = arch;
-  key.Syntax = syntax;
-  
-  EDDisassembler::DisassemblerMap_t::iterator i = sDisassemblers.find(key);
-  
-  if (i != sDisassemblers.end()) {
-    return i->second;
-  }
-  else {
-    EDDisassembler* sdd = new EDDisassembler(key);
-    if(!sdd->valid()) {
-      delete sdd;
-      return NULL;
-    }
-    
-    sDisassemblers[key] = sdd;
-    
-    return sdd;
-  }
-  
-  return NULL;
-}
-
-EDDisassembler *EDDisassembler::getDisassembler(StringRef str,
-                                                EDAssemblySyntax_t syntax) {
-  Triple triple(str);
-  
-  return getDisassembler(triple.getArch(), syntax);
-}
-
-EDDisassembler::EDDisassembler(CPUKey &key) : 
-  Valid(false), ErrorString(), ErrorStream(ErrorString), Key(key) {
-  const InfoMap *infoMap = infoFromArch(key.Arch);
-  
-  if (!infoMap)
-    return;
-  
-  const char *triple = infoMap->String;
-  
-  int syntaxVariant = getLLVMSyntaxVariant(key.Arch, key.Syntax);
-  
-  if (syntaxVariant < 0)
-    return;
-  
-  std::string tripleString(triple);
-  std::string errorString;
-  
-  Tgt = TargetRegistry::lookupTarget(tripleString, 
-                                     errorString);
-  
-  if (!Tgt)
-    return;
-  
-  std::string featureString;
-  
-  OwningPtr<const TargetMachine>
-    targetMachine(Tgt->createTargetMachine(tripleString,
-                                           featureString));
-  
-  const TargetRegisterInfo *registerInfo = targetMachine->getRegisterInfo();
-  
-  if (!registerInfo)
-    return;
-  
-  AsmInfo.reset(Tgt->createAsmInfo(tripleString));
-  
-  if (!AsmInfo)
-    return;
-  
-  Disassembler.reset(Tgt->createMCDisassembler());
-  
-  if (!Disassembler)
-    return;
-  
-  InstString.reset(new std::string);
-  InstStream.reset(new raw_string_ostream(*InstString));
-  
-  InstPrinter.reset(Tgt->createMCInstPrinter(syntaxVariant,
-                                                *AsmInfo,
-                                                *InstStream));
-  
-  if (!InstPrinter)
-    return;
-    
-  GenericAsmLexer.reset(new AsmLexer(*AsmInfo));
-  SpecificAsmLexer.reset(Tgt->createAsmLexer(*AsmInfo));
-  SpecificAsmLexer->InstallLexer(*GenericAsmLexer);
-                          
-  InstInfos = infoMap->Info;
-  
-  initMaps(*targetMachine->getRegisterInfo());
-    
-  Valid = true;
-}
-
-EDDisassembler::~EDDisassembler() {
-  if(!valid())
-    return;
-}
-
-namespace {
-  /// EDMemoryObject - a subclass of MemoryObject that allows use of a callback
-  ///   as provided by the sd interface.  See MemoryObject.
-  class EDMemoryObject : public llvm::MemoryObject {
-  private:
-    EDByteReaderCallback Callback;
-    void *Arg;
-  public:
-    EDMemoryObject(EDByteReaderCallback callback,
-                   void *arg) : Callback(callback), Arg(arg) { }
-    ~EDMemoryObject() { }
-    uint64_t getBase() const { return 0x0; }
-    uint64_t getExtent() const { return (uint64_t)-1; }
-    int readByte(uint64_t address, uint8_t *ptr) const {
-      if(!Callback)
-        return -1;
-      
-      if(Callback(ptr, address, Arg))
-        return -1;
-      
-      return 0;
-    }
-  };
-}
-
-EDInst *EDDisassembler::createInst(EDByteReaderCallback byteReader, 
-                                   uint64_t address, 
-                                   void *arg) {
-  EDMemoryObject memoryObject(byteReader, arg);
-  
-  MCInst* inst = new MCInst;
-  uint64_t byteSize;
-  
-  if (!Disassembler->getInstruction(*inst,
-                                    byteSize,
-                                    memoryObject,
-                                    address,
-                                    ErrorStream)) {
-    delete inst;
-    return NULL;
-  }
-  else {
-    const InstInfo *thisInstInfo = &InstInfos[inst->getOpcode()];
-    
-    EDInst* sdInst = new EDInst(inst, byteSize, *this, thisInstInfo);
-    return sdInst;
-  }
-}
-
-void EDDisassembler::initMaps(const TargetRegisterInfo &registerInfo) {
-  unsigned numRegisters = registerInfo.getNumRegs();
-  unsigned registerIndex;
-  
-  for (registerIndex = 0; registerIndex < numRegisters; ++registerIndex) {
-    const char* registerName = registerInfo.get(registerIndex).Name;
-    
-    RegVec.push_back(registerName);
-    RegRMap[registerName] = registerIndex;
-  }
-  
-  if (Key.Arch == Triple::x86 ||
-      Key.Arch == Triple::x86_64) {
-    stackPointers.insert(registerIDWithName("SP"));
-    stackPointers.insert(registerIDWithName("ESP"));
-    stackPointers.insert(registerIDWithName("RSP"));
-    
-    programCounters.insert(registerIDWithName("IP"));
-    programCounters.insert(registerIDWithName("EIP"));
-    programCounters.insert(registerIDWithName("RIP"));
-  }
-}
-
-const char *EDDisassembler::nameWithRegisterID(unsigned registerID) const {
-  if (registerID >= RegVec.size())
-    return NULL;
-  else
-    return RegVec[registerID].c_str();
-}
-
-unsigned EDDisassembler::registerIDWithName(const char *name) const {
-  regrmap_t::const_iterator iter = RegRMap.find(std::string(name));
-  if (iter == RegRMap.end())
-    return 0;
-  else
-    return (*iter).second;
-}
-
-bool EDDisassembler::registerIsStackPointer(unsigned registerID) {
-  return (stackPointers.find(registerID) != stackPointers.end());
-}
-
-bool EDDisassembler::registerIsProgramCounter(unsigned registerID) {
-  return (programCounters.find(registerID) != programCounters.end());
-}
-
-int EDDisassembler::printInst(std::string& str,
-                              MCInst& inst) {
-  PrinterMutex.acquire();
-  
-  InstPrinter->printInst(&inst);
-  InstStream->flush();
-  str = *InstString;
-  InstString->clear();
-  
-  PrinterMutex.release();
-  
-  return 0;
-}
-
-int EDDisassembler::parseInst(SmallVectorImpl<MCParsedAsmOperand*> &operands,
-                              SmallVectorImpl<AsmToken> &tokens,
-                              const std::string &str) {
-  int ret = 0;
-  
-  const char *cStr = str.c_str();
-  MemoryBuffer *buf = MemoryBuffer::getMemBuffer(cStr, cStr + strlen(cStr));
-  
-  StringRef instName;
-  SMLoc instLoc;
-  
-  SourceMgr sourceMgr;
-  sourceMgr.AddNewSourceBuffer(buf, SMLoc()); // ownership of buf handed over
-  MCContext context;
-  OwningPtr<MCStreamer> streamer
-    (createNullStreamer(context));
-  AsmParser genericParser(sourceMgr, context, *streamer, *AsmInfo);
-  OwningPtr<TargetAsmParser> specificParser
-    (Tgt->createAsmParser(genericParser));
-  
-  AsmToken OpcodeToken = genericParser.Lex();
-  
-  if(OpcodeToken.is(AsmToken::Identifier)) {
-    instName = OpcodeToken.getString();
-    instLoc = OpcodeToken.getLoc();
-    if (specificParser->ParseInstruction(instName, instLoc, operands))
-      ret = -1;
-  }
-  else {
-    ret = -1;
-  }
-  
-  ParserMutex.acquire();
-  
-  if (!ret) {
-    GenericAsmLexer->setBuffer(buf);
-  
-    while (SpecificAsmLexer->Lex(),
-           SpecificAsmLexer->isNot(AsmToken::Eof) &&
-           SpecificAsmLexer->isNot(AsmToken::EndOfStatement)) {
-      if (SpecificAsmLexer->is(AsmToken::Error)) {
-        ret = -1;
-        break;
-      }
-      tokens.push_back(SpecificAsmLexer->getTok());
-    }
-  }
-
-  ParserMutex.release();
-  
-  return ret;
-}
-
-int EDDisassembler::llvmSyntaxVariant() const {
-  return LLVMSyntaxVariant;
-}
diff --git a/libclamav/c++/llvm/tools/edis/EDDisassembler.h b/libclamav/c++/llvm/tools/edis/EDDisassembler.h
deleted file mode 100644
index 6be9152..0000000
--- a/libclamav/c++/llvm/tools/edis/EDDisassembler.h
+++ /dev/null
@@ -1,248 +0,0 @@
-//===-EDDisassembler.h - LLVM Enhanced Disassembler -------------*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-// 
-//===----------------------------------------------------------------------===//
-//
-// This file defines the interface for the Enhanced Disassembly library's
-// disassembler class.  The disassembler is responsible for vending individual
-// instructions according to a given architecture and disassembly syntax.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef EDDisassembler_
-#define EDDisassembler_
-
-#include "EDInfo.inc"
-
-#include "llvm-c/EnhancedDisassembly.h"
-
-#include "llvm/ADT/OwningPtr.h"
-#include "llvm/ADT/Triple.h"
-#include "llvm/Support/raw_ostream.h"
-#include "llvm/System/Mutex.h"
-
-#include <map>
-#include <set>
-#include <string>
-#include <vector>
-
-namespace llvm {
-class AsmLexer;
-class AsmToken;
-class MCContext;
-class MCAsmInfo;
-class MCAsmLexer;
-class AsmParser;
-class TargetAsmLexer;
-class TargetAsmParser;
-class MCDisassembler;
-class MCInstPrinter;
-class MCInst;
-class MCParsedAsmOperand;
-class MCStreamer;
-template <typename T> class SmallVectorImpl;
-class SourceMgr;
-class Target;
-class TargetRegisterInfo;
-}
-
-/// EDDisassembler - Encapsulates a disassembler for a single architecture and
-///   disassembly syntax.  Also manages the static disassembler registry.
-struct EDDisassembler {
-  ////////////////////
-  // Static members //
-  ////////////////////
-  
-  /// CPUKey - Encapsulates the descriptor of an architecture/disassembly-syntax
-  ///   pair
-  struct CPUKey {
-    /// The architecture type
-    llvm::Triple::ArchType Arch;
-    
-    /// The assembly syntax
-    EDAssemblySyntax_t Syntax;
-    
-    /// operator== - Equality operator
-    bool operator==(const CPUKey &key) const {
-      return (Arch == key.Arch &&
-              Syntax == key.Syntax);
-    }
-    
-    /// operator< - Less-than operator
-    bool operator<(const CPUKey &key) const {
-      if(Arch > key.Arch)
-        return false;
-      if(Syntax >= key.Syntax)
-        return false;
-      return true;
-    }
-  };
-  
-  typedef std::map<CPUKey, EDDisassembler*> DisassemblerMap_t;
-  
-  /// True if the disassembler registry has been initialized; false if not
-  static bool sInitialized;
-  /// A map from disassembler specifications to disassemblers.  Populated
-  ///   lazily.
-  static DisassemblerMap_t sDisassemblers;
-
-  /// getDisassembler - Returns the specified disassemble, or NULL on failure
-  ///
-  /// @arg arch   - The desired architecture
-  /// @arg syntax - The desired disassembly syntax
-  static EDDisassembler *getDisassembler(llvm::Triple::ArchType arch,
-                                         EDAssemblySyntax_t syntax);
-  
-  /// getDisassembler - Returns the disassembler for a given combination of
-  ///   CPU type, CPU subtype, and assembly syntax, or NULL on failure
-  ///
-  /// @arg str    - The string representation of the architecture triple, e.g.,
-  ///               "x86_64-apple-darwin"
-  /// @arg syntax - The disassembly syntax for the required disassembler
-  static EDDisassembler *getDisassembler(llvm::StringRef str,
-                                         EDAssemblySyntax_t syntax);
-  
-  /// initialize - Initializes the disassembler registry and the LLVM backend
-  static void initialize();
-  
-  ////////////////////////
-  // Per-object members //
-  ////////////////////////
-  
-  /// True only if the object has been fully and successfully initialized
-  bool Valid;
-  
-  /// The string that stores disassembler errors from the backend
-  std::string ErrorString;
-  /// The stream that wraps the ErrorString
-  llvm::raw_string_ostream ErrorStream;
-
-  /// The architecture/syntax pair for the current architecture
-  CPUKey Key;
-  /// The LLVM target corresponding to the disassembler
-  const llvm::Target *Tgt;
-  /// The assembly information for the target architecture
-  llvm::OwningPtr<const llvm::MCAsmInfo> AsmInfo;
-  /// The disassembler for the target architecture
-  llvm::OwningPtr<const llvm::MCDisassembler> Disassembler;
-  /// The output string for the instruction printer; must be guarded with 
-  ///   PrinterMutex
-  llvm::OwningPtr<std::string> InstString;
-  /// The output stream for the disassembler; must be guarded with
-  ///   PrinterMutex
-  llvm::OwningPtr<llvm::raw_string_ostream> InstStream;
-  /// The instruction printer for the target architecture; must be guarded with
-  ///   PrinterMutex when printing
-  llvm::OwningPtr<llvm::MCInstPrinter> InstPrinter;
-  /// The mutex that guards the instruction printer's printing functions, which
-  ///   use a shared stream
-  llvm::sys::Mutex PrinterMutex;
-  /// The array of instruction information provided by the TableGen backend for
-  ///   the target architecture
-  const InstInfo *InstInfos;
-  /// The target-specific lexer for use in tokenizing strings, in
-  ///   target-independent and target-specific portions
-  llvm::OwningPtr<llvm::AsmLexer> GenericAsmLexer;
-  llvm::OwningPtr<llvm::TargetAsmLexer> SpecificAsmLexer;
-  /// The guard for the above
-  llvm::sys::Mutex ParserMutex;
-  /// The LLVM number used for the target disassembly syntax variant
-  int LLVMSyntaxVariant;
-    
-  typedef std::vector<std::string> regvec_t;
-  typedef std::map<std::string, unsigned> regrmap_t;
-  
-  /// A vector of registers for quick mapping from LLVM register IDs to names
-  regvec_t RegVec;
-  /// A map of registers for quick mapping from register names to LLVM IDs
-  regrmap_t RegRMap;
-  
-  /// A set of register IDs for aliases of the stack pointer for the current
-  ///   architecture
-  std::set<unsigned> stackPointers;
-  /// A set of register IDs for aliases of the program counter for the current
-  ///   architecture
-  std::set<unsigned> programCounters;
-  
-  /// Constructor - initializes a disassembler with all the necessary objects,
-  ///   which come pre-allocated from the registry accessor function
-  ///
-  /// @arg key                - the architecture and disassembly syntax for the 
-  ///                           disassembler
-  EDDisassembler(CPUKey& key);
-  
-  /// valid - reports whether there was a failure in the constructor.
-  bool valid() {
-    return Valid;
-  }
-  
-  ~EDDisassembler();
-  
-  /// createInst - creates and returns an instruction given a callback and
-  ///   memory address, or NULL on failure
-  ///
-  /// @arg byteReader - A callback function that provides machine code bytes
-  /// @arg address    - The address of the first byte of the instruction,
-  ///                   suitable for passing to byteReader
-  /// @arg arg        - An opaque argument for byteReader
-  EDInst *createInst(EDByteReaderCallback byteReader, 
-                     uint64_t address, 
-                     void *arg);
-
-  /// initMaps - initializes regVec and regRMap using the provided register
-  ///   info
-  ///
-  /// @arg registerInfo - the register information to use as a source
-  void initMaps(const llvm::TargetRegisterInfo &registerInfo);
-  /// nameWithRegisterID - Returns the name (owned by the EDDisassembler) of a 
-  ///   register for a given register ID, or NULL on failure
-  ///
-  /// @arg registerID - the ID of the register to be queried
-  const char *nameWithRegisterID(unsigned registerID) const;
-  /// registerIDWithName - Returns the ID of a register for a given register
-  ///   name, or (unsigned)-1 on failure
-  ///
-  /// @arg name - The name of the register
-  unsigned registerIDWithName(const char *name) const;
-  
-  /// registerIsStackPointer - reports whether a register ID is an alias for the
-  ///   stack pointer register
-  ///
-  /// @arg registerID - The LLVM register ID
-  bool registerIsStackPointer(unsigned registerID);
-  /// registerIsStackPointer - reports whether a register ID is an alias for the
-  ///   stack pointer register
-  ///
-  /// @arg registerID - The LLVM register ID
-  bool registerIsProgramCounter(unsigned registerID);
-  
-  /// printInst - prints an MCInst to a string, returning 0 on success, or -1
-  ///   otherwise
-  ///
-  /// @arg str  - A reference to a string which is filled in with the string
-  ///             representation of the instruction
-  /// @arg inst - A reference to the MCInst to be printed
-  int printInst(std::string& str,
-                llvm::MCInst& inst);
-  
-  /// parseInst - extracts operands and tokens from a string for use in
-  ///   tokenizing the string.  Returns 0 on success, or -1 otherwise.
-  ///
-  /// @arg operands - A reference to a vector that will be filled in with the
-  ///                 parsed operands
-  /// @arg tokens   - A reference to a vector that will be filled in with the
-  ///                 tokens
-  /// @arg str      - The string representation of the instruction
-  int parseInst(llvm::SmallVectorImpl<llvm::MCParsedAsmOperand*> &operands,
-                llvm::SmallVectorImpl<llvm::AsmToken> &tokens,
-                const std::string &str);
-  
-  /// llvmSyntaxVariant - returns the LLVM syntax variant for this disassembler
-  int llvmSyntaxVariant() const;  
-};
-
-#endif
diff --git a/libclamav/c++/llvm/tools/edis/EDInst.cpp b/libclamav/c++/llvm/tools/edis/EDInst.cpp
deleted file mode 100644
index 9ed2700..0000000
--- a/libclamav/c++/llvm/tools/edis/EDInst.cpp
+++ /dev/null
@@ -1,205 +0,0 @@
-//===-EDInst.cpp - LLVM Enhanced Disassembler -----------------------------===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-// 
-//===----------------------------------------------------------------------===//
-//
-// This file implements the Enhanced Disassembly library's instruction class.
-// The instruction is responsible for vending the string representation, 
-// individual tokens, and operands for a single instruction.
-//
-//===----------------------------------------------------------------------===//
-
-#include "EDDisassembler.h"
-#include "EDInst.h"
-#include "EDOperand.h"
-#include "EDToken.h"
-
-#include "llvm/MC/MCInst.h"
-
-using namespace llvm;
-
-EDInst::EDInst(llvm::MCInst *inst,
-               uint64_t byteSize, 
-               EDDisassembler &disassembler,
-               const InstInfo *info) :
-  Disassembler(disassembler),
-  Inst(inst),
-  ThisInstInfo(info),
-  ByteSize(byteSize),
-  BranchTarget(-1),
-  MoveSource(-1),
-  MoveTarget(-1) {
-}
-
-EDInst::~EDInst() {
-  unsigned int index;
-  unsigned int numOperands = Operands.size();
-  
-  for (index = 0; index < numOperands; ++index)
-    delete Operands[index];
-  
-  unsigned int numTokens = Tokens.size();
-  
-  for (index = 0; index < numTokens; ++index)
-    delete Tokens[index];
-  
-  delete Inst;
-}
-
-uint64_t EDInst::byteSize() {
-  return ByteSize;
-}
-
-int EDInst::stringify() {
-  if (StringifyResult.valid())
-    return StringifyResult.result();
-  
-  if (Disassembler.printInst(String, *Inst))
-    return StringifyResult.setResult(-1);
-
-  OperandOrder = ThisInstInfo->operandOrders[Disassembler.llvmSyntaxVariant()];
-  
-  return StringifyResult.setResult(0);
-}
-
-int EDInst::getString(const char*& str) {
-  if (stringify())
-    return -1;
-  
-  str = String.c_str();
-  
-  return 0;
-}
-
-unsigned EDInst::instID() {
-  return Inst->getOpcode();
-}
-
-bool EDInst::isBranch() {
-  if (ThisInstInfo)
-    return ThisInstInfo->instructionFlags & kInstructionFlagBranch;
-  else
-    return false;
-}
-
-bool EDInst::isMove() {
-  if (ThisInstInfo)
-    return ThisInstInfo->instructionFlags & kInstructionFlagMove;
-  else
-    return false;
-}
-
-int EDInst::parseOperands() {
-  if (ParseResult.valid())
-    return ParseResult.result(); 
-  
-  if (!ThisInstInfo)
-    return ParseResult.setResult(-1);
-  
-  unsigned int opIndex;
-  unsigned int mcOpIndex = 0;
-  
-  for (opIndex = 0; opIndex < ThisInstInfo->numOperands; ++opIndex) {
-    if (isBranch() &&
-        (ThisInstInfo->operandFlags[opIndex] & kOperandFlagTarget)) {
-      BranchTarget = opIndex;
-    }
-    else if (isMove()) {
-      if (ThisInstInfo->operandFlags[opIndex] & kOperandFlagSource)
-        MoveSource = opIndex;
-      else if (ThisInstInfo->operandFlags[opIndex] & kOperandFlagTarget)
-        MoveTarget = opIndex;
-    }
-    
-    EDOperand *operand = new EDOperand(Disassembler, *this, opIndex, mcOpIndex);
-    
-    Operands.push_back(operand);
-  }
-  
-  return ParseResult.setResult(0);
-}
-
-int EDInst::branchTargetID() {
-  if (parseOperands())
-    return -1;
-  return BranchTarget;
-}
-
-int EDInst::moveSourceID() {
-  if (parseOperands())
-    return -1;
-  return MoveSource;
-}
-
-int EDInst::moveTargetID() {
-  if (parseOperands())
-    return -1;
-  return MoveTarget;
-}
-
-int EDInst::numOperands() {
-  if (parseOperands())
-    return -1;
-  return Operands.size();
-}
-
-int EDInst::getOperand(EDOperand *&operand, unsigned int index) {
-  if (parseOperands())
-    return -1;
-  
-  if (index >= Operands.size())
-    return -1;
-  
-  operand = Operands[index];
-  return 0;
-}
-
-int EDInst::tokenize() {
-  if (TokenizeResult.valid())
-    return TokenizeResult.result();
-  
-  if (stringify())
-    return TokenizeResult.setResult(-1);
-    
-  return TokenizeResult.setResult(EDToken::tokenize(Tokens,
-                                                    String,
-                                                    OperandOrder,
-                                                    Disassembler));
-    
-}
-
-int EDInst::numTokens() {
-  if (tokenize())
-    return -1;
-  return Tokens.size();
-}
-
-int EDInst::getToken(EDToken *&token, unsigned int index) {
-  if (tokenize())
-    return -1;
-  token = Tokens[index];
-  return 0;
-}
-
-#ifdef __BLOCKS__
-int EDInst::visitTokens(EDTokenVisitor_t visitor) {
-  if (tokenize())
-    return -1;
-  
-  tokvec_t::iterator iter;
-  
-  for (iter = Tokens.begin(); iter != Tokens.end(); ++iter) {
-    int ret = visitor(*iter);
-    if (ret == 1)
-      return 0;
-    if (ret != 0)
-      return -1;
-  }
-  
-  return 0;
-}
-#endif
diff --git a/libclamav/c++/llvm/tools/edis/EDInst.h b/libclamav/c++/llvm/tools/edis/EDInst.h
deleted file mode 100644
index db03a78..0000000
--- a/libclamav/c++/llvm/tools/edis/EDInst.h
+++ /dev/null
@@ -1,171 +0,0 @@
-//===-EDInst.h - LLVM Enhanced Disassembler ---------------------*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-// 
-//===----------------------------------------------------------------------===//
-//
-// This file defines the interface for the Enhanced Disassembly library's
-// instruction class.  The instruction is responsible for vending the string
-// representation, individual tokens and operands for a single instruction.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef EDInst_
-#define EDInst_
-
-#include "llvm-c/EnhancedDisassembly.h"
-
-#include "llvm/ADT/SmallVector.h"
-
-#include <string>
-#include <vector>
-
-/// CachedResult - Encapsulates the result of a function along with the validity
-///   of that result, so that slow functions don't need to run twice
-struct CachedResult {
-  /// True if the result has been obtained by executing the function
-  bool Valid;
-  /// The result last obtained from the function
-  int Result;
-  
-  /// Constructor - Initializes an invalid result
-  CachedResult() : Valid(false) { }
-  /// valid - Returns true if the result has been obtained by executing the
-  ///   function and false otherwise
-  bool valid() { return Valid; }
-  /// result - Returns the result of the function or an undefined value if
-  ///   valid() is false
-  int result() { return Result; }
-  /// setResult - Sets the result of the function and declares it valid
-  ///   returning the result (so that setResult() can be called from inside a
-  ///   return statement)
-  /// @arg result - The result of the function
-  int setResult(int result) { Result = result; Valid = true; return result; }
-};
-
-/// EDInst - Encapsulates a single instruction, which can be queried for its
-///   string representation, as well as its operands and tokens
-struct EDInst {
-  /// The parent disassembler
-  EDDisassembler &Disassembler;
-  /// The containing MCInst
-  llvm::MCInst *Inst;
-  /// The instruction information provided by TableGen for this instruction
-  const InstInfo *ThisInstInfo;
-  /// The number of bytes for the machine code representation of the instruction
-  uint64_t ByteSize;
-  
-  /// The result of the stringify() function
-  CachedResult StringifyResult;
-  /// The string representation of the instruction
-  std::string String;
-  /// The order in which operands from the InstInfo's operand information appear
-  /// in String
-  const char* OperandOrder;
-  
-  /// The result of the parseOperands() function
-  CachedResult ParseResult;
-  typedef llvm::SmallVector<EDOperand*, 5> opvec_t;
-  /// The instruction's operands
-  opvec_t Operands;
-  /// The operand corresponding to the target, if the instruction is a branch
-  int BranchTarget;
-  /// The operand corresponding to the source, if the instruction is a move
-  int MoveSource;
-  /// The operand corresponding to the target, if the instruction is a move
-  int MoveTarget;
-  
-  /// The result of the tokenize() function
-  CachedResult TokenizeResult;
-  typedef std::vector<EDToken*> tokvec_t;
-  /// The instruction's tokens
-  tokvec_t Tokens;
-  
-  /// Constructor - initializes an instruction given the output of the LLVM
-  ///   C++ disassembler
-  ///
-  /// @arg inst         - The MCInst, which will now be owned by this object
-  /// @arg byteSize     - The size of the consumed instruction, in bytes
-  /// @arg disassembler - The parent disassembler
-  /// @arg instInfo     - The instruction information produced by the table
-  ///                     generator for this instruction
-  EDInst(llvm::MCInst *inst,
-         uint64_t byteSize,
-         EDDisassembler &disassembler,
-         const InstInfo *instInfo);
-  ~EDInst();
-  
-  /// byteSize - returns the number of bytes consumed by the machine code
-  ///   representation of the instruction
-  uint64_t byteSize();
-  /// instID - returns the LLVM instruction ID of the instruction
-  unsigned instID();
-  
-  /// stringify - populates the String and AsmString members of the instruction,
-  ///   returning 0 on success or -1 otherwise
-  int stringify();
-  /// getString - retrieves a pointer to the string representation of the
-  ///   instructinon, returning 0 on success or -1 otherwise
-  ///
-  /// @arg str - A reference to a pointer that, on success, is set to point to
-  ///   the string representation of the instruction; this string is still owned
-  ///   by the instruction and will be deleted when it is
-  int getString(const char *&str);
-  
-  /// isBranch - Returns true if the instruction is a branch
-  bool isBranch();
-  /// isMove - Returns true if the instruction is a move
-  bool isMove();
-  
-  /// parseOperands - populates the Operands member of the instruction,
-  ///   returning 0 on success or -1 otherwise
-  int parseOperands();
-  /// branchTargetID - returns the ID (suitable for use with getOperand()) of 
-  ///   the target operand if the instruction is a branch, or -1 otherwise
-  int branchTargetID();
-  /// moveSourceID - returns the ID of the source operand if the instruction
-  ///   is a move, or -1 otherwise
-  int moveSourceID();
-  /// moveTargetID - returns the ID of the target operand if the instruction
-  ///   is a move, or -1 otherwise
-  int moveTargetID();
-  
-  /// numOperands - returns the number of operands available to retrieve, or -1
-  ///   on error
-  int numOperands();
-  /// getOperand - retrieves an operand from the instruction's operand list by
-  ///   index, returning 0 on success or -1 on error
-  ///
-  /// @arg operand  - A reference whose target is pointed at the operand on
-  ///                 success, although the operand is still owned by the EDInst
-  /// @arg index    - The index of the operand in the instruction
-  int getOperand(EDOperand *&operand, unsigned int index);
-
-  /// tokenize - populates the Tokens member of the instruction, returning 0 on
-  ///   success or -1 otherwise
-  int tokenize();
-  /// numTokens - returns the number of tokens in the instruction, or -1 on
-  ///   error
-  int numTokens();
-  /// getToken - retrieves a token from the instruction's token list by index,
-  ///   returning 0 on success or -1 on error
-  ///
-  /// @arg token  - A reference whose target is pointed at the token on success,
-  ///               although the token is still owned by the EDInst
-  /// @arg index  - The index of the token in the instrcutino
-  int getToken(EDToken *&token, unsigned int index);
-
-#ifdef __BLOCKS__
-  /// visitTokens - Visits each token in turn and applies a block to it,
-  ///   returning 0 if all blocks are visited and/or the block signals
-  ///   termination by returning 1; returns -1 on error
-  ///
-  /// @arg visitor  - The visitor block to apply to all tokens.
-  int visitTokens(EDTokenVisitor_t visitor);
-#endif
-};
-
-#endif
diff --git a/libclamav/c++/llvm/tools/edis/EDMain.cpp b/libclamav/c++/llvm/tools/edis/EDMain.cpp
deleted file mode 100644
index 3585657..0000000
--- a/libclamav/c++/llvm/tools/edis/EDMain.cpp
+++ /dev/null
@@ -1,293 +0,0 @@
-//===-EDMain.cpp - LLVM Enhanced Disassembly C API ------------------------===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-// 
-//===----------------------------------------------------------------------===//
-//
-// This file implements the enhanced disassembler's public C API.
-//
-//===----------------------------------------------------------------------===//
-
-#include "EDDisassembler.h"
-#include "EDInst.h"
-#include "EDOperand.h"
-#include "EDToken.h"
-
-#include "llvm-c/EnhancedDisassembly.h"
-
-int EDGetDisassembler(EDDisassemblerRef *disassembler,
-                      const char *triple,
-                      EDAssemblySyntax_t syntax) {
-  EDDisassembler::initialize();
-  
-  EDDisassemblerRef ret = EDDisassembler::getDisassembler(triple,
-                                                          syntax);
-  
-  if (ret) {
-    *disassembler = ret;
-    return 0;
-  }
-  else {
-    return -1;
-  }
-}
-
-int EDGetRegisterName(const char** regName,
-                      EDDisassemblerRef disassembler,
-                      unsigned regID) {
-  const char* name = disassembler->nameWithRegisterID(regID);
-  if(!name)
-    return -1;
-  *regName = name;
-  return 0;
-}
-
-int EDRegisterIsStackPointer(EDDisassemblerRef disassembler,
-                             unsigned regID) {
-  return disassembler->registerIsStackPointer(regID) ? 1 : 0;
-}
-
-int EDRegisterIsProgramCounter(EDDisassemblerRef disassembler,
-                               unsigned regID) {
-  return disassembler->registerIsProgramCounter(regID) ? 1 : 0;
-}
-
-unsigned int EDCreateInsts(EDInstRef *insts,
-                           unsigned int count,
-                           EDDisassemblerRef disassembler,
-                           EDByteReaderCallback byteReader,
-                           uint64_t address,
-                           void *arg) {
-  unsigned int index;
-  
-  for (index = 0; index < count; index++) {
-    EDInst *inst = disassembler->createInst(byteReader, address, arg);
-    
-    if(!inst)
-      return index;
-    
-    insts[index] = inst;
-    address += inst->byteSize();
-  }
-  
-  return count;
-}
-
-void EDReleaseInst(EDInstRef inst) {
-  delete inst;
-}
-
-int EDInstByteSize(EDInstRef inst) {
-  return inst->byteSize();
-}
-
-int EDGetInstString(const char **buf,
-                    EDInstRef inst) {
-  return inst->getString(*buf);
-}
-
-int EDInstID(unsigned *instID, EDInstRef inst) {
-  *instID = inst->instID();
-  return 0;
-}
-
-int EDInstIsBranch(EDInstRef inst) {
-  return inst->isBranch();
-}
-
-int EDInstIsMove(EDInstRef inst) {
-  return inst->isMove();
-}
-
-int EDBranchTargetID(EDInstRef inst) {
-  return inst->branchTargetID();
-}
-
-int EDMoveSourceID(EDInstRef inst) {
-  return inst->moveSourceID();
-}
-
-int EDMoveTargetID(EDInstRef inst) {
-  return inst->moveTargetID();
-}
-
-int EDNumTokens(EDInstRef inst) {
-  return inst->numTokens();
-}
-
-int EDGetToken(EDTokenRef *token,
-               EDInstRef inst,
-               int index) {
-  return inst->getToken(*token, index);
-}
-
-int EDGetTokenString(const char **buf,
-                     EDTokenRef token) {
-  return token->getString(*buf);
-}
-
-int EDOperandIndexForToken(EDTokenRef token) {
-  return token->operandID();
-}
-
-int EDTokenIsWhitespace(EDTokenRef token) {
-  if(token->type() == EDToken::kTokenWhitespace)
-    return 1;
-  else
-    return 0;
-}
-
-int EDTokenIsPunctuation(EDTokenRef token) {
-  if(token->type() == EDToken::kTokenPunctuation)
-    return 1;
-  else
-    return 0;
-}
-
-int EDTokenIsOpcode(EDTokenRef token) {
-  if(token->type() == EDToken::kTokenOpcode)
-    return 1;
-  else
-    return 0;
-}
-
-int EDTokenIsLiteral(EDTokenRef token) {
-  if(token->type() == EDToken::kTokenLiteral)
-    return 1;
-  else
-    return 0;
-}
-
-int EDTokenIsRegister(EDTokenRef token) {
-  if(token->type() == EDToken::kTokenRegister)
-    return 1;
-  else
-    return 0;
-}
-
-int EDTokenIsNegativeLiteral(EDTokenRef token) {
-  if(token->type() != EDToken::kTokenLiteral)
-    return -1;
-  
-  return token->literalSign();
-}
-
-int EDLiteralTokenAbsoluteValue(uint64_t *value,
-                                EDTokenRef token) {
-  if(token->type() != EDToken::kTokenLiteral)
-    return -1;
-  
-  return token->literalAbsoluteValue(*value);
-}
-
-int EDRegisterTokenValue(unsigned *registerID,
-                         EDTokenRef token) {
-  if(token->type() != EDToken::kTokenRegister)
-    return -1;
-  
-  return token->registerID(*registerID);
-}
-
-int EDNumOperands(EDInstRef inst) {
-  return inst->numOperands();
-}
-
-int EDGetOperand(EDOperandRef *operand,
-                 EDInstRef inst,
-                 int index) {
-  return inst->getOperand(*operand, index);
-}
-
-int EDOperandIsRegister(EDOperandRef operand) {
-  return operand->isRegister();
-}
-
-int EDOperandIsImmediate(EDOperandRef operand) {
-  return operand->isImmediate();
-}
-
-int EDOperandIsMemory(EDOperandRef operand) {
-  return operand->isMemory();
-}
-
-int EDRegisterOperandValue(unsigned *value, 
-                           EDOperandRef operand) {
-  if(!operand->isRegister())
-    return -1;
-  *value = operand->regVal();
-  return 0;
-}
-
-int EDImmediateOperandValue(uint64_t *value,
-                           EDOperandRef operand) {
-  if(!operand->isImmediate())
-    return -1;
-  *value = operand->immediateVal();
-  return 0;
-}
-
-int EDEvaluateOperand(uint64_t *result,
-                      EDOperandRef operand,
-                      EDRegisterReaderCallback regReader,
-                      void *arg) {
-  return operand->evaluate(*result, regReader, arg);
-}
-
-#ifdef __BLOCKS__
-
-struct ByteReaderWrapper {
-  EDByteBlock_t byteBlock;
-};
-
-static int readerWrapperCallback(uint8_t *byte, 
-                          uint64_t address,
-                          void *arg) {
-  struct ByteReaderWrapper *wrapper = (struct ByteReaderWrapper *)arg;
-  return wrapper->byteBlock(byte, address);
-}
-
-unsigned int EDBlockCreateInsts(EDInstRef *insts,
-                                int count,
-                                EDDisassemblerRef disassembler,
-                                EDByteBlock_t byteBlock,
-                                uint64_t address) {
-  struct ByteReaderWrapper wrapper;
-  wrapper.byteBlock = byteBlock;
-  
-  return EDCreateInsts(insts,
-                       count,
-                       disassembler, 
-                       readerWrapperCallback, 
-                       address, 
-                       (void*)&wrapper);
-}
-
-int EDBlockEvaluateOperand(uint64_t *result,
-                           EDOperandRef operand,
-                           EDRegisterBlock_t regBlock) {
-  return operand->evaluate(*result, regBlock);
-}
-
-int EDBlockVisitTokens(EDInstRef inst,
-                       EDTokenVisitor_t visitor) {
-  return inst->visitTokens(visitor);
-}
-
-#else
-
-extern "C" unsigned int EDBlockCreateInsts() {
-  return 0;
-}
-
-extern "C" int EDBlockEvaluateOperand() {
-  return -1;
-}
-
-extern "C" int EDBlockVisitTokens() {
-  return -1;
-}
-
-#endif
diff --git a/libclamav/c++/llvm/tools/edis/EDOperand.cpp b/libclamav/c++/llvm/tools/edis/EDOperand.cpp
deleted file mode 100644
index da6797e..0000000
--- a/libclamav/c++/llvm/tools/edis/EDOperand.cpp
+++ /dev/null
@@ -1,168 +0,0 @@
-//===-EDOperand.cpp - LLVM Enhanced Disassembler --------------------------===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-// 
-//===----------------------------------------------------------------------===//
-//
-// This file implements the Enhanced Disassembly library's operand class.  The
-// operand is responsible for allowing evaluation given a particular register 
-// context.
-//
-//===----------------------------------------------------------------------===//
-
-#include "EDDisassembler.h"
-#include "EDInst.h"
-#include "EDOperand.h"
-
-#include "llvm/MC/MCInst.h"
-
-using namespace llvm;
-
-EDOperand::EDOperand(const EDDisassembler &disassembler,
-                     const EDInst &inst,
-                     unsigned int opIndex,
-                     unsigned int &mcOpIndex) :
-  Disassembler(disassembler),
-  Inst(inst),
-  OpIndex(opIndex),
-  MCOpIndex(mcOpIndex) {
-  unsigned int numMCOperands = 0;
-    
-  if(Disassembler.Key.Arch == Triple::x86 ||
-     Disassembler.Key.Arch == Triple::x86_64) {
-    uint8_t operandFlags = inst.ThisInstInfo->operandFlags[opIndex];
-    
-    if (operandFlags & kOperandFlagImmediate) {
-      numMCOperands = 1;
-    }
-    else if (operandFlags & kOperandFlagRegister) {
-      numMCOperands = 1;
-    }
-    else if (operandFlags & kOperandFlagMemory) {
-      if (operandFlags & kOperandFlagPCRelative) {
-        numMCOperands = 1;
-      }
-      else {
-        numMCOperands = 5;
-      }
-    }
-    else if (operandFlags & kOperandFlagEffectiveAddress) {
-      numMCOperands = 4;
-    }
-  }
-    
-  mcOpIndex += numMCOperands;
-}
-
-EDOperand::~EDOperand() {
-}
-
-int EDOperand::evaluate(uint64_t &result,
-                        EDRegisterReaderCallback callback,
-                        void *arg) {
-  if (Disassembler.Key.Arch == Triple::x86 ||
-      Disassembler.Key.Arch == Triple::x86_64) {
-    uint8_t operandFlags = Inst.ThisInstInfo->operandFlags[OpIndex];
-    
-    if (operandFlags & kOperandFlagImmediate) {
-      result = Inst.Inst->getOperand(MCOpIndex).getImm();
-      return 0;
-    }
-    if (operandFlags & kOperandFlagRegister) {
-      unsigned reg = Inst.Inst->getOperand(MCOpIndex).getReg();
-      return callback(&result, reg, arg);
-    }
-    if (operandFlags & kOperandFlagMemory ||
-        operandFlags & kOperandFlagEffectiveAddress){
-      if(operandFlags & kOperandFlagPCRelative) {
-        int64_t displacement = Inst.Inst->getOperand(MCOpIndex).getImm();
-        
-        uint64_t ripVal;
-        
-        // TODO fix how we do this
-        
-        if (callback(&ripVal, Disassembler.registerIDWithName("RIP"), arg))
-          return -1;
-        
-        result = ripVal + displacement;
-        return 0;
-      }
-      else {
-        unsigned baseReg = Inst.Inst->getOperand(MCOpIndex).getReg();
-        uint64_t scaleAmount = Inst.Inst->getOperand(MCOpIndex+1).getImm();
-        unsigned indexReg = Inst.Inst->getOperand(MCOpIndex+2).getReg();
-        int64_t displacement = Inst.Inst->getOperand(MCOpIndex+3).getImm();
-        //unsigned segmentReg = Inst.Inst->getOperand(MCOpIndex+4).getReg();
-      
-        uint64_t addr = 0;
-        
-        if(baseReg) {
-          uint64_t baseVal;
-          if (callback(&baseVal, baseReg, arg))
-            return -1;
-          addr += baseVal;
-        }
-        
-        if(indexReg) {
-          uint64_t indexVal;
-          if (callback(&indexVal, indexReg, arg))
-            return -1;
-          addr += (scaleAmount * indexVal);
-        }
-        
-        addr += displacement;
-        
-        result = addr;
-        return 0;
-      }
-    }
-    return -1;
-  }
-  
-  return -1;
-}
-
-int EDOperand::isRegister() {
-  return(Inst.ThisInstInfo->operandFlags[OpIndex] & kOperandFlagRegister);
-}
-
-unsigned EDOperand::regVal() {
-  return Inst.Inst->getOperand(MCOpIndex).getReg(); 
-}
-
-int EDOperand::isImmediate() {
-  return(Inst.ThisInstInfo->operandFlags[OpIndex] & kOperandFlagImmediate);
-}
-
-uint64_t EDOperand::immediateVal() {
-  return Inst.Inst->getOperand(MCOpIndex).getImm();
-}
-
-int EDOperand::isMemory() {
-  return(Inst.ThisInstInfo->operandFlags[OpIndex] & kOperandFlagMemory);
-}
-
-#ifdef __BLOCKS__
-struct RegisterReaderWrapper {
-  EDRegisterBlock_t regBlock;
-};
-
-int readerWrapperCallback(uint64_t *value, 
-                          unsigned regID, 
-                          void *arg) {
-  struct RegisterReaderWrapper *wrapper = (struct RegisterReaderWrapper *)arg;
-  return wrapper->regBlock(value, regID);
-}
-
-int EDOperand::evaluate(uint64_t &result,
-                        EDRegisterBlock_t regBlock) {
-  struct RegisterReaderWrapper wrapper;
-  wrapper.regBlock = regBlock;
-  return evaluate(result, 
-                  readerWrapperCallback, 
-                  (void*)&wrapper);
-}
-#endif
diff --git a/libclamav/c++/llvm/tools/edis/EDOperand.h b/libclamav/c++/llvm/tools/edis/EDOperand.h
deleted file mode 100644
index ad9345b..0000000
--- a/libclamav/c++/llvm/tools/edis/EDOperand.h
+++ /dev/null
@@ -1,78 +0,0 @@
-//===-EDOperand.h - LLVM Enhanced Disassembler ------------------*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-// 
-//===----------------------------------------------------------------------===//
-//
-// This file defines the interface for the Enhanced Disassembly library's 
-// operand class.  The operand is responsible for allowing evaluation given a
-// particular register context.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef EDOperand_
-#define EDOperand_
-
-#include "llvm-c/EnhancedDisassembly.h"
-
-/// EDOperand - Encapsulates a single operand, which can be evaluated by the
-///   client
-struct EDOperand {
-  /// The parent disassembler
-  const EDDisassembler &Disassembler;
-  /// The parent instruction
-  const EDInst &Inst;
-  
-  /// The index of the operand in the EDInst
-  unsigned int OpIndex;
-  /// The index of the first component of the operand in the MCInst
-  unsigned int MCOpIndex;
-  
-  /// Constructor - Initializes an EDOperand
-  ///
-  /// @arg disassembler - The disassembler responsible for the operand
-  /// @arg inst         - The instruction containing this operand
-  /// @arg opIndex      - The index of the operand in inst
-  /// @arg mcOpIndex    - The index of the operand in the original MCInst
-  EDOperand(const EDDisassembler &disassembler,
-            const EDInst &inst,
-            unsigned int opIndex,
-            unsigned int &mcOpIndex);
-  ~EDOperand();
-  
-  /// evaluate - Returns the numeric value of an operand to the extent possible,
-  ///   returning 0 on success or -1 if there was some problem (such as a 
-  ///   register not being readable)
-  ///
-  /// @arg result   - A reference whose target is filled in with the value of
-  ///                 the operand (the address if it is a memory operand)
-  /// @arg callback - A function to call to obtain register values
-  /// @arg arg      - An opaque argument to pass to callback
-  int evaluate(uint64_t &result,
-               EDRegisterReaderCallback callback,
-               void *arg);
-
-  /// isRegister - Returns 1 if the operand is a register or 0 otherwise
-  int isRegister();
-  /// regVal - Returns the register value.
-  unsigned regVal();
-  
-  /// isImmediate - Returns 1 if the operand is an immediate or 0 otherwise
-  int isImmediate();
-  /// immediateVal - Returns the immediate value.
-  uint64_t immediateVal();
-  
-  /// isMemory - Returns 1 if the operand is a memory location or 0 otherwise
-  int isMemory();
-  
-#ifdef __BLOCKS__
-  /// evaluate - Like evaluate for a callback, but uses a block instead
-  int evaluate(uint64_t &result,
-               EDRegisterBlock_t regBlock);
-#endif
-};
-
-#endif
diff --git a/libclamav/c++/llvm/tools/edis/EDToken.cpp b/libclamav/c++/llvm/tools/edis/EDToken.cpp
deleted file mode 100644
index cd79152..0000000
--- a/libclamav/c++/llvm/tools/edis/EDToken.cpp
+++ /dev/null
@@ -1,208 +0,0 @@
-//===-EDToken.cpp - LLVM Enhanced Disassembler ----------------------------===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-// 
-//===----------------------------------------------------------------------===//
-//
-// This file implements the Enhanced Disassembler library's token class.  The
-// token is responsible for vending information about the token, such as its
-// type and logical value.
-//
-//===----------------------------------------------------------------------===//
-
-#include "EDDisassembler.h"
-#include "EDToken.h"
-
-#include "llvm/ADT/SmallVector.h"
-#include "llvm/MC/MCParser/MCAsmLexer.h"
-#include "llvm/MC/MCParser/MCParsedAsmOperand.h"
-
-using namespace llvm;
-
-EDToken::EDToken(StringRef str,
-                 enum tokenType type,
-                 uint64_t localType,
-                 EDDisassembler &disassembler) :
-  Disassembler(disassembler),
-  Str(str),
-  Type(type),
-  LocalType(localType),
-  OperandID(-1) {
-}
-
-EDToken::~EDToken() {
-}
-
-void EDToken::makeLiteral(bool sign, uint64_t absoluteValue) {
-  Type = kTokenLiteral;
-  LiteralSign = sign;
-  LiteralAbsoluteValue = absoluteValue;
-}
-
-void EDToken::makeRegister(unsigned registerID) {
-  Type = kTokenRegister;
-  RegisterID = registerID;
-}
-
-void EDToken::setOperandID(int operandID) {
-  OperandID = operandID;
-}
-
-enum EDToken::tokenType EDToken::type() const {
-  return Type;
-}
-
-uint64_t EDToken::localType() const {
-  return LocalType;
-}
-
-StringRef EDToken::string() const {
-  return Str;
-}
-
-int EDToken::operandID() const {
-  return OperandID;
-}
-
-int EDToken::literalSign() const {
-  if(Type != kTokenLiteral)
-    return -1;
-  return (LiteralSign ? 1 : 0);
-}
-
-int EDToken::literalAbsoluteValue(uint64_t &value) const {
-  if(Type != kTokenLiteral)
-    return -1;
-  value = LiteralAbsoluteValue;
-  return 0;
-}
-
-int EDToken::registerID(unsigned &registerID) const {
-  if(Type != kTokenRegister)
-    return -1;
-  registerID = RegisterID;
-  return 0;
-}
-
-int EDToken::tokenize(std::vector<EDToken*> &tokens,
-                      std::string &str,
-                      const char *operandOrder,
-                      EDDisassembler &disassembler) {
-  SmallVector<MCParsedAsmOperand*, 5> parsedOperands;
-  SmallVector<AsmToken, 10> asmTokens;
-  
-  if(disassembler.parseInst(parsedOperands, asmTokens, str))
-    return -1;
-  
-  SmallVectorImpl<MCParsedAsmOperand*>::iterator operandIterator;
-  unsigned int operandIndex;
-  SmallVectorImpl<AsmToken>::iterator tokenIterator;
-  
-  operandIterator = parsedOperands.begin();
-  operandIndex = 0;
-  
-  bool readOpcode = false;
-  
-  const char *wsPointer = asmTokens.begin()->getLoc().getPointer();
-  
-  for (tokenIterator = asmTokens.begin();
-       tokenIterator != asmTokens.end();
-       ++tokenIterator) {
-    SMLoc tokenLoc = tokenIterator->getLoc();
-    
-    const char *tokenPointer = tokenLoc.getPointer();
-    
-    if(tokenPointer > wsPointer) {
-      unsigned long wsLength = tokenPointer - wsPointer;
-      
-      EDToken *whitespaceToken = new EDToken(StringRef(wsPointer, wsLength),
-                                             EDToken::kTokenWhitespace,
-                                             0,
-                                             disassembler);
-      
-      tokens.push_back(whitespaceToken);
-    }
-    
-    wsPointer = tokenPointer + tokenIterator->getString().size();
-    
-    while (operandIterator != parsedOperands.end() &&
-           tokenLoc.getPointer() > 
-           (*operandIterator)->getEndLoc().getPointer()) {
-      ++operandIterator;
-      ++operandIndex;
-    }
-    
-    EDToken *token;
-    
-    switch (tokenIterator->getKind()) {
-    case AsmToken::Identifier:
-      if (!readOpcode) {
-        token = new EDToken(tokenIterator->getString(),
-                            EDToken::kTokenOpcode,
-                            (uint64_t)tokenIterator->getKind(),
-                            disassembler);
-        readOpcode = true;
-        break;
-      }
-      // any identifier that isn't an opcode is mere punctuation; so we fall
-      // through
-    default:
-      token = new EDToken(tokenIterator->getString(),
-                          EDToken::kTokenPunctuation,
-                          (uint64_t)tokenIterator->getKind(),
-                          disassembler);
-      break;
-    case AsmToken::Integer:
-    {
-      token = new EDToken(tokenIterator->getString(),
-                          EDToken::kTokenLiteral,
-                          (uint64_t)tokenIterator->getKind(),
-                          disassembler);
-        
-      int64_t intVal = tokenIterator->getIntVal();
-      
-      if(intVal < 0)  
-        token->makeLiteral(true, -intVal);
-      else
-        token->makeLiteral(false, intVal);
-      break;
-    }
-    case AsmToken::Register:
-    {
-      token = new EDToken(tokenIterator->getString(),
-                          EDToken::kTokenLiteral,
-                          (uint64_t)tokenIterator->getKind(),
-                          disassembler);
-      
-      token->makeRegister((unsigned)tokenIterator->getRegVal());
-      break;
-    }
-    }
-    
-    if(operandIterator != parsedOperands.end() &&
-       tokenLoc.getPointer() >= 
-       (*operandIterator)->getStartLoc().getPointer()) {
-      /// operandIndex == 0 means the operand is the instruction (which the
-      /// AsmParser treats as an operand but edis does not).  We therefore skip
-      /// operandIndex == 0 and subtract 1 from all other operand indices.
-      
-      if(operandIndex > 0)
-        token->setOperandID(operandOrder[operandIndex - 1]);
-    }
-    
-    tokens.push_back(token);
-  }
-  
-  return 0;
-}
-
-int EDToken::getString(const char*& buf) {
-  if(PermStr.length() == 0) {
-    PermStr = Str.str();
-  }
-  buf = PermStr.c_str();
-  return 0;
-}
diff --git a/libclamav/c++/llvm/tools/edis/EDToken.h b/libclamav/c++/llvm/tools/edis/EDToken.h
deleted file mode 100644
index e4ae91f..0000000
--- a/libclamav/c++/llvm/tools/edis/EDToken.h
+++ /dev/null
@@ -1,135 +0,0 @@
-//===-EDToken.h - LLVM Enhanced Disassembler --------------------*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-// 
-//===----------------------------------------------------------------------===//
-//
-// This file defines the interface for the Enhanced Disassembly library's token
-// class.  The token is responsible for vending information about the token, 
-// such as its type and logical value.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef EDToken_
-#define EDToken_
-
-#include "llvm-c/EnhancedDisassembly.h"
-#include "llvm/ADT/StringRef.h"
-
-#include <string>
-#include <vector>
-
-/// EDToken - Encapsulates a single token, which can provide a string
-///   representation of itself or interpret itself in various ways, depending
-///   on the token type.
-struct EDToken {
-  enum tokenType {
-    kTokenWhitespace,
-    kTokenOpcode,
-    kTokenLiteral,
-    kTokenRegister,
-    kTokenPunctuation
-  };
-  
-  /// The parent disassembler
-  EDDisassembler &Disassembler;
-
-  /// The token's string representation
-  llvm::StringRef Str;
-  /// The token's string representation, but in a form suitable for export
-  std::string PermStr;
-  /// The type of the token, as exposed through the external API
-  enum tokenType Type;
-  /// The type of the token, as recorded by the syntax-specific tokenizer
-  uint64_t LocalType;
-  /// The operand corresponding to the token, or (unsigned int)-1 if not
-  ///   part of an operand.
-  int OperandID;
-  
-  /// The sign if the token is a literal (1 if negative, 0 otherwise)
-  bool LiteralSign;
-  /// The absolute value if the token is a literal
-  uint64_t LiteralAbsoluteValue;
-  /// The LLVM register ID if the token is a register name
-  unsigned RegisterID;
-  
-  /// Constructor - Initializes an EDToken with the information common to all
-  ///   tokens
-  ///
-  /// @arg str          - The string corresponding to the token
-  /// @arg type         - The token's type as exposed through the public API
-  /// @arg localType    - The token's type as recorded by the tokenizer
-  /// @arg disassembler - The disassembler responsible for the token
-  EDToken(llvm::StringRef str,
-          enum tokenType type,
-          uint64_t localType,
-          EDDisassembler &disassembler);
-  
-  /// makeLiteral - Adds the information specific to a literal
-  /// @arg sign           - The sign of the literal (1 if negative, 0 
-  ///                       otherwise)
-  ///
-  /// @arg absoluteValue  - The absolute value of the literal
-  void makeLiteral(bool sign, uint64_t absoluteValue);
-  /// makeRegister - Adds the information specific to a register
-  ///
-  /// @arg registerID - The LLVM register ID
-  void makeRegister(unsigned registerID);
-  
-  /// setOperandID - Links the token to a numbered operand
-  ///
-  /// @arg operandID  - The operand ID to link to
-  void setOperandID(int operandID);
-  
-  ~EDToken();
-  
-  /// type - Returns the public type of the token
-  enum tokenType type() const;
-  /// localType - Returns the tokenizer-specific type of the token
-  uint64_t localType() const;
-  /// string - Returns the string representation of the token
-  llvm::StringRef string() const;
-  /// operandID - Returns the operand ID of the token
-  int operandID() const;
-  
-  /// literalSign - Returns the sign of the token 
-  ///   (1 if negative, 0 if positive or unsigned, -1 if it is not a literal)
-  int literalSign() const;
-  /// literalAbsoluteValue - Retrieves the absolute value of the token, and
-  ///   returns -1 if the token is not a literal
-  /// @arg value  - A reference to a value that is filled in with the absolute
-  ///               value, if it is valid
-  int literalAbsoluteValue(uint64_t &value) const;
-  /// registerID - Retrieves the register ID of the token, and returns -1 if the
-  ///   token is not a register
-  ///
-  /// @arg registerID - A reference to a value that is filled in with the 
-  ///                   register ID, if it is valid
-  int registerID(unsigned &registerID) const;
-  
-  /// tokenize - Tokenizes a string using the platform- and syntax-specific
-  ///   tokenizer, and returns 0 on success (-1 on failure)
-  ///
-  /// @arg tokens       - A vector that will be filled in with pointers to
-  ///                     allocated tokens
-  /// @arg str          - The string, as outputted by the AsmPrinter
-  /// @arg operandOrder - The order of the operands from the operandFlags array
-  ///                     as they appear in str
-  /// @arg disassembler - The disassembler for the desired target and
-  //                      assembly syntax
-  static int tokenize(std::vector<EDToken*> &tokens,
-                      std::string &str,
-                      const char *operandOrder,
-                      EDDisassembler &disassembler);
-  
-  /// getString - Directs a character pointer to the string, returning 0 on
-  ///   success (-1 on failure)
-  /// @arg buf  - A reference to a pointer that is set to point to the string.
-  ///   The string is still owned by the token.
-  int getString(const char*& buf);
-};
-
-#endif
diff --git a/libclamav/c++/llvm/tools/edis/EnhancedDisassembly.exports b/libclamav/c++/llvm/tools/edis/EnhancedDisassembly.exports
deleted file mode 100644
index d3f8743..0000000
--- a/libclamav/c++/llvm/tools/edis/EnhancedDisassembly.exports
+++ /dev/null
@@ -1,36 +0,0 @@
-_EDGetDisassembler
-_EDGetRegisterName
-_EDRegisterIsStackPointer
-_EDRegisterIsProgramCounter
-_EDCreateInsts
-_EDReleaseInst
-_EDInstByteSize
-_EDGetInstString
-_EDInstIsBranch
-_EDInstIsMove
-_EDBranchTargetID
-_EDMoveSourceID
-_EDMoveTargetID
-_EDNumTokens
-_EDGetToken
-_EDGetTokenString
-_EDOperandIndexForToken
-_EDTokenIsWhitespace
-_EDTokenIsPunctuation
-_EDTokenIsOpcode
-_EDTokenIsLiteral
-_EDTokenIsRegister
-_EDTokenIsNegativeLiteral
-_EDLiteralTokenAbsoluteValue
-_EDRegisterTokenValue
-_EDNumOperands
-_EDGetOperand
-_EDOperandIsRegister
-_EDOperandIsImmediate
-_EDOperandIsMemory
-_EDRegisterOperandValue
-_EDImmediateOperandValue
-_EDEvaluateOperand
-_EDBlockCreateInsts
-_EDBlockEvaluateOperand
-_EDBlockVisitTokens
diff --git a/libclamav/c++/llvm/tools/edis/Makefile b/libclamav/c++/llvm/tools/edis/Makefile
deleted file mode 100644
index a3c5879..0000000
--- a/libclamav/c++/llvm/tools/edis/Makefile
+++ /dev/null
@@ -1,55 +0,0 @@
-##===- tools/ed/Makefile -----------------------------------*- Makefile -*-===##
-# 
-#                     The LLVM Compiler Infrastructure
-#
-# This file is distributed under the University of Illinois Open Source
-# License. See LICENSE.TXT for details.
-# 
-##===----------------------------------------------------------------------===##
-
-LEVEL = ../..
-LIBRARYNAME = EnhancedDisassembly
-
-BUILT_SOURCES = EDInfo.inc
-
-# Include this here so we can get the configuration of the targets
-# that have been configured for construction. We have to do this 
-# early so we can set up LINK_COMPONENTS before including Makefile.rules
-include $(LEVEL)/Makefile.config
-
-LINK_LIBS_IN_SHARED = 1
-SHARED_LIBRARY = 1
-
-LINK_COMPONENTS := $(TARGETS_TO_BUILD) x86asmprinter x86disassembler
-
-include $(LEVEL)/Makefile.common
-
-ifeq ($(HOST_OS),Darwin)
-    # set dylib internal version number to llvmCore submission number
-    ifdef LLVM_SUBMIT_VERSION
-        LLVMLibsOptions := $(LLVMLibsOptions) -Wl,-current_version \
-                        -Wl,$(LLVM_SUBMIT_VERSION).$(LLVM_SUBMIT_SUBVERSION) \
-                        -Wl,-compatibility_version -Wl,1
-    endif
-    # extra options to override libtool defaults 
-    LLVMLibsOptions    := $(LLVMLibsOptions)  \
-                         -avoid-version \
-                         -Wl,-exported_symbols_list -Wl,$(PROJ_SRC_DIR)/EnhancedDisassembly.exports \
-                         -Wl,-dead_strip \
-                         -Wl,-seg1addr -Wl,0xE0000000 
-
-    # Mac OS X 10.4 and earlier tools do not allow a second -install_name on command line
-    DARWIN_VERS := $(shell echo $(TARGET_TRIPLE) | sed 's/.*darwin\([0-9]*\).*/\1/')
-    ifneq ($(DARWIN_VERS),8)
-       LLVMLibsOptions    := $(LLVMLibsOptions)  \
-                            -no-undefined -Wl,-install_name \
-                            -Wl,"@executable_path/../lib/lib$(LIBRARYNAME)$(SHLIBEXT)"
-    endif
-endif
-
-EDInfo.inc:	$(TBLGEN)
-	$(Echo) "Building semantic information header"
-	$(Verb) $(TableGen) -o $(call SYSPATH, $@) -gen-enhanced-disassembly-header /dev/null
-
-clean::
-	-$(Verb) $(RM) -f EDInfo.inc
diff --git a/libclamav/c++/llvm/tools/llc/llc.cpp b/libclamav/c++/llvm/tools/llc/llc.cpp
index fe34bd1..810ba42 100644
--- a/libclamav/c++/llvm/tools/llc/llc.cpp
+++ b/libclamav/c++/llvm/tools/llc/llc.cpp
@@ -305,6 +305,14 @@ int main(int argc, char **argv) {
   case '3': OLvl = CodeGenOpt::Aggressive; break;
   }
 
+  // Request that addPassesToEmitFile run the Verifier after running
+  // passes which modify the IR.
+#ifndef NDEBUG
+  bool DisableVerify = false;
+#else
+  bool DisableVerify = true;
+#endif
+
   // If this target requires addPassesToEmitWholeFile, do it now.  This is
   // used by strange things like the C backend.
   if (Target.WantsWholeFile()) {
@@ -320,7 +328,8 @@ int main(int argc, char **argv) {
       PM.add(createVerifierPass());
 
     // Ask the target to add backend passes as necessary.
-    if (Target.addPassesToEmitWholeFile(PM, *Out, FileType, OLvl)) {
+    if (Target.addPassesToEmitWholeFile(PM, *Out, FileType, OLvl,
+                                        DisableVerify)) {
       errs() << argv[0] << ": target does not support generation of this"
              << " file type!\n";
       if (Out != &fouts()) delete Out;
@@ -347,7 +356,8 @@ int main(int argc, char **argv) {
     // Override default to generate verbose assembly.
     Target.setAsmVerbosityDefault(true);
 
-    if (Target.addPassesToEmitFile(Passes, *Out, FileType, OLvl)) {
+    if (Target.addPassesToEmitFile(Passes, *Out, FileType, OLvl,
+                                   DisableVerify)) {
       errs() << argv[0] << ": target does not support generation of this"
              << " file type!\n";
       if (Out != &fouts()) delete Out;
diff --git a/libclamav/c++/llvm/tools/llvm-config/CMakeLists.txt b/libclamav/c++/llvm/tools/llvm-config/CMakeLists.txt
index 8a710ea..7a43dba 100644
--- a/libclamav/c++/llvm/tools/llvm-config/CMakeLists.txt
+++ b/libclamav/c++/llvm/tools/llvm-config/CMakeLists.txt
@@ -18,8 +18,6 @@ execute_process(COMMAND date
 #set(LLVMGCCDIR "")
 #set(LLVMGCC "")
 #set(LLVMGXX "")
-#set(LLVMGCC_VERSION "")
-#set(LLVMGCC_MAJVERS "")
 test_big_endian(IS_BIG_ENDIAN)
 if( IS_BIG_ENDIAN )
   set(ENDIAN "big")
diff --git a/libclamav/c++/llvm/tools/llvm-config/Makefile b/libclamav/c++/llvm/tools/llvm-config/Makefile
index cc5cf43..c7f7b32 100644
--- a/libclamav/c++/llvm/tools/llvm-config/Makefile
+++ b/libclamav/c++/llvm/tools/llvm-config/Makefile
@@ -126,6 +126,6 @@ clean-local::
 	  $(LibDeps) GenLibDeps.out
 install-local:: all-local
 	$(Echo) Installing llvm-config
-	$(Verb) $(MKDIR) $(PROJ_bindir)
-	$(Verb) $(ScriptInstall) $(ToolDir)/llvm-config $(PROJ_bindir)
+	$(Verb) $(MKDIR) $(DESTDIR)$(PROJ_bindir)
+	$(Verb) $(ScriptInstall) $(ToolDir)/llvm-config $(DESTDIR)$(PROJ_bindir)
 
diff --git a/libclamav/c++/llvm/tools/llvmc/doc/LLVMC-Reference.rst b/libclamav/c++/llvm/tools/llvmc/doc/LLVMC-Reference.rst
index dfe3898..ca8500d 100644
--- a/libclamav/c++/llvm/tools/llvmc/doc/LLVMC-Reference.rst
+++ b/libclamav/c++/llvm/tools/llvmc/doc/LLVMC-Reference.rst
@@ -329,16 +329,22 @@ separate option groups syntactically.
 
    - ``required`` - this option must be specified exactly once (or, in case of
      the list options without the ``multi_val`` property, at least
-     once). Incompatible with ``zero_or_one`` and ``one_or_more``.
-
-   - ``one_or_more`` - the option must be specified at least one time. Useful
-     only for list options in conjunction with ``multi_val``; for ordinary lists
-     it is synonymous with ``required``. Incompatible with ``required`` and
-     ``zero_or_one``.
-
-   - ``optional`` - the option can be specified zero or one times. Useful only
-     for list options in conjunction with ``multi_val``. Incompatible with
-     ``required`` and ``one_or_more``.
+     once). Incompatible with ``optional`` and ``one_or_more``.
+
+   - ``optional`` - the option can be specified either zero times or exactly
+     once. The default for switch options. Useful only for list options in
+     conjunction with ``multi_val``. Incompatible with ``required``,
+     ``zero_or_more`` and ``one_or_more``.
+
+   - ``one_or_more`` - the option must be specified at least once. Can be useful
+     to allow switch options be both obligatory and be specified multiple
+     times. For list options is useful only in conjunction with ``multi_val``;
+     for ordinary it is synonymous with ``required``. Incompatible with
+     ``required``, ``optional`` and ``zero_or_more``.
+
+   - ``zero_or_more`` - the option can be specified zero or more times. Useful
+     to allow a single switch option to be specified more than
+     once. Incompatible with ``required``, ``optional`` and ``one_or_more``.
 
    - ``hidden`` - the description of this option will not appear in
      the ``--help`` output (but will appear in the ``--help-hidden``
diff --git a/libclamav/c++/llvm/tools/llvmc/example/mcc16/plugins/PIC16Base/PIC16Base.td b/libclamav/c++/llvm/tools/llvmc/example/mcc16/plugins/PIC16Base/PIC16Base.td
index f13b9f8..25149ad 100644
--- a/libclamav/c++/llvm/tools/llvmc/example/mcc16/plugins/PIC16Base/PIC16Base.td
+++ b/libclamav/c++/llvm/tools/llvmc/example/mcc16/plugins/PIC16Base/PIC16Base.td
@@ -56,7 +56,7 @@ def OptionList : OptionList<[
 // (parameter_option "pre-RA-sched",
 //    (help "Example of an option that is passed to llc")),
  (parameter_option "regalloc",
-    (help "Register allocator to use.(possible values: simple, linearscan, pbqp, local. default = linearscan)")),
+    (help "Register allocator to use (possible values: simple, linearscan, pbqp, local; default=linearscan)")),
  (prefix_list_option "Wa,", (comma_separated),
     (help "Pass options to assembler (Run 'gpasm -help' for assembler options)")),
  (prefix_list_option "Wl,", (comma_separated),
@@ -72,16 +72,14 @@ class clang_based<string language, string cmd, string ext_E> : Tool<
 [(in_language language),
  (out_language "llvm-bitcode"),
  (output_suffix "bc"),
- (cmd_line (case
-           (switch_on "E"),
-           (case 
-              (not_empty "o"), !strconcat(cmd, " -E $INFILE -o $OUTFILE"),
-              (default), !strconcat(cmd, " -E $INFILE")),
-           (default), !strconcat(cmd, " $INFILE -o $OUTFILE"))),
- (actions (case 
-                (and (multiple_input_files), (or (switch_on "S"), (switch_on "c"))),
-              (error "cannot specify -o with -c or -S with multiple files"),
-                (switch_on "E"), [(stop_compilation), (output_suffix ext_E)],
+ (command cmd),
+ (actions (case
+                (and (multiple_input_files),
+                     (or (switch_on "S"), (switch_on "c"))),
+                  (error "cannot specify -o with -c or -S with multiple files"),
+                (switch_on "E"), [(forward "E"),
+                                  (stop_compilation), (output_suffix ext_E)],
+                (and (switch_on "E"), (empty "o")), (no_out_file),
                 (switch_on "bc"),[(stop_compilation), (output_suffix "bc")],
                 (switch_on "g"), (append_cmd "-g"),
                 (switch_on "w"), (append_cmd "-w"),
@@ -116,12 +114,13 @@ def llvm_ld : Tool<[
  (in_language "llvm-bitcode"),
  (out_language "llvm-bitcode"),
  (output_suffix "bc"),
- (cmd_line "$CALL(GetBinDir)llvm-ld -L $CALL(GetStdLibsDir) -disable-gvn -disable-licm-promotion -disable-mem2reg $INFILE -b $OUTFILE -l std"),
+ (command "$CALL(GetBinDir)llvm-ld -L $CALL(GetStdLibsDir) -disable-licm-promotion -l std"),
+ (out_file_option "-b"),
  (actions (case
           (switch_on "O0"), (append_cmd "-disable-opt"),
           (switch_on "O1"), (append_cmd "-disable-opt"),
 // Whenever O3 is not specified on the command line, default i.e. disable-inlining will always be added.
-          (switch_on "O2"), (append_cmd ""), 
+          (switch_on "O2"), (append_cmd ""),
           (switch_on "O3"), (append_cmd ""),
           (default), (append_cmd "-disable-inlining"))),
  (join)
@@ -134,12 +133,13 @@ def llvm_ld_optimizer : Tool<[
  (output_suffix "bc"),
 // FIXME: we are still not disabling licm-promotion.
 // -disable-licm-promotion and building stdn library causes c16-71 to fail.
- (cmd_line "$CALL(GetBinDir)llvm-ld -disable-gvn -disable-mem2reg                              $INFILE -b $OUTFILE"),
+ (command "$CALL(GetBinDir)llvm-ld "),
+ (out_file_option "-b"),
  (actions (case
           (switch_on "O0"), (append_cmd "-disable-opt"),
           (switch_on "O1"), (append_cmd "-disable-opt"),
 // Whenever O3 is not specified on the command line, default i.e. disable-inlining will always be added.
-          (switch_on "O2"), (append_cmd ""), 
+          (switch_on "O2"), (append_cmd ""),
           (switch_on "O3"), (append_cmd ""),
           (default), (append_cmd "-disable-inlining")))
 ]>;
@@ -149,7 +149,7 @@ def pic16passes : Tool<[
  (in_language "llvm-bitcode"),
  (out_language "llvm-bitcode"),
  (output_suffix "obc"),
- (cmd_line "$CALL(GetBinDir)opt -pic16cg -pic16overlay $INFILE -f -o $OUTFILE"),
+ (command "$CALL(GetBinDir)opt -pic16cloner -pic16overlay -f"),
  (actions (case
           (switch_on "O0"), (append_cmd "-disable-opt")))
 ]>;
@@ -158,7 +158,7 @@ def llc : Tool<[
  (in_language "llvm-bitcode"),
  (out_language "assembler"),
  (output_suffix "s"),
- (cmd_line "$CALL(GetBinDir)llc -march=pic16 -disable-jump-tables -pre-RA-sched=list-burr -f $INFILE -o $OUTFILE"),
+ (command "$CALL(GetBinDir)llc -march=pic16 -disable-jump-tables -pre-RA-sched=list-burr -f"),
  (actions (case
           (switch_on "S"), (stop_compilation),
 //          (not_empty "Wllc,"), (unpack_values "Wllc,"),
@@ -171,7 +171,7 @@ def gpasm : Tool<[
  (in_language "assembler"),
  (out_language "object-code"),
  (output_suffix "o"),
- (cmd_line "$CALL(GetBinDir)gpasm -z -r decimal -I $CALL(GetStdAsmHeadersDir) -C -c -w 2 $INFILE -o $OUTFILE"),
+ (command "$CALL(GetBinDir)gpasm -z -r decimal -I $CALL(GetStdAsmHeadersDir) -C -c -w 2"),
  (actions (case
           (switch_on "c"), (stop_compilation),
           (switch_on "g"), (append_cmd "-g"),
@@ -184,7 +184,7 @@ def mplink : Tool<[
  (in_language "object-code"),
  (out_language "executable"),
  (output_suffix "cof"),
- (cmd_line "$CALL(GetBinDir)mplink -e -k $CALL(GetStdLinkerScriptsDir) -l $CALL(GetStdLibsDir) intrinsics.lib stdn.lib $INFILE -o $OUTFILE"),
+ (command "$CALL(GetBinDir)mplink -e -k $CALL(GetStdLinkerScriptsDir) -l $CALL(GetStdLibsDir) intrinsics.lib stdn.lib"),
  (actions (case
           (not_empty "Wl,"), (forward_value "Wl,"),
           (switch_on "X"), (append_cmd "-x"),
@@ -217,13 +217,13 @@ def LanguageMap : LanguageMap<[
 def CompilationGraph : CompilationGraph<[
     Edge<"root", "clang_cc">,
     Edge<"root", "llvm_ld">,
-    OptionalEdge<"root", "llvm_ld_optimizer", (case 
+    OptionalEdge<"root", "llvm_ld_optimizer", (case
                                          (switch_on "S"), (inc_weight),
                                          (switch_on "c"), (inc_weight))>,
     Edge<"root", "gpasm">,
     Edge<"root", "mplink">,
     Edge<"clang_cc", "llvm_ld">,
-    OptionalEdge<"clang_cc", "llvm_ld_optimizer", (case 
+    OptionalEdge<"clang_cc", "llvm_ld_optimizer", (case
                                          (switch_on "S"), (inc_weight),
                                          (switch_on "c"), (inc_weight))>,
     Edge<"llvm_ld", "pic16passes">,
diff --git a/libclamav/c++/llvm/tools/llvmc/plugins/Base/Base.td.in b/libclamav/c++/llvm/tools/llvmc/plugins/Base/Base.td.in
index 1acd969..ac0f665 100644
--- a/libclamav/c++/llvm/tools/llvmc/plugins/Base/Base.td.in
+++ b/libclamav/c++/llvm/tools/llvmc/plugins/Base/Base.td.in
@@ -25,13 +25,13 @@ def OptList : OptionList<[
  (switch_option "opt",
     (help "Enable opt")),
  (switch_option "O0",
-    (help "Turn off optimization")),
+    (help "Turn off optimization"), (zero_or_more)),
  (switch_option "O1",
-    (help "Optimization level 1")),
+    (help "Optimization level 1"), (zero_or_more)),
  (switch_option "O2",
-    (help "Optimization level 2")),
+    (help "Optimization level 2"), (zero_or_more)),
  (switch_option "O3",
-    (help "Optimization level 3")),
+    (help "Optimization level 3"), (zero_or_more)),
  (switch_option "S",
     (help "Stop after compilation, do not assemble")),
  (switch_option "c",
@@ -49,7 +49,7 @@ def OptList : OptionList<[
  (parameter_option "linker",
     (help "Choose linker (possible values: gcc, g++)")),
  (parameter_option "mtune",
-    (help "Target a specific CPU type"), (hidden)),
+    (help "Target a specific CPU type"), (hidden), (forward_not_split)),
 
  // TODO: Add a conditional compilation mechanism to make Darwin-only options
  // like '-arch' really Darwin-only.
@@ -57,9 +57,9 @@ def OptList : OptionList<[
  (parameter_option "arch",
     (help "Compile for the specified target architecture"), (hidden)),
  (parameter_option "march",
-    (help "A synonym for -mtune"), (hidden)),
+    (help "A synonym for -mtune"), (hidden), (forward_not_split)),
  (parameter_option "mcpu",
-    (help "A deprecated synonym for -mtune"), (hidden)),
+    (help "A deprecated synonym for -mtune"), (hidden), (forward_not_split)),
  (switch_option "mfix-and-continue",
     (help "Needed by gdb to load .o files dynamically"), (hidden)),
  (parameter_option "MF",
@@ -76,14 +76,20 @@ def OptList : OptionList<[
     (help "Specifies a framework to link against")),
  (parameter_list_option "weak_framework",
     (help "Specifies a framework to weakly link against"), (hidden)),
+ (parameter_option "filelist", (hidden),
+    (help "Link the files listed in file")),
  (prefix_list_option "F",
     (help "Add a directory to framework search path")),
  (prefix_list_option "I",
     (help "Add a directory to include path")),
  (prefix_list_option "D",
     (help "Define a macro")),
+ (parameter_list_option "Xpreprocessor", (hidden),
+    (help "Pass options to preprocessor")),
  (prefix_list_option "Wa,", (comma_separated),
     (help "Pass options to assembler")),
+ (parameter_list_option "Xassembler", (hidden),
+    (help "Pass options to assembler")),
  (prefix_list_option "Wllc,", (comma_separated),
     (help "Pass options to llc")),
  (prefix_list_option "L",
@@ -92,6 +98,8 @@ def OptList : OptionList<[
     (help "Search a library when linking")),
  (prefix_list_option "Wl,",
     (help "Pass options to linker")),
+ (parameter_list_option "Xlinker", (hidden),
+    (help "Pass options to linker")),
  (prefix_list_option "Wo,", (comma_separated),
     (help "Pass options to opt")),
  (prefix_list_option "m",
@@ -105,6 +113,8 @@ def OptList : OptionList<[
      (help "Remove unreachable blocks of code")),
  (switch_option "single_module", (hidden),
      (help "Build the library so it contains only one module")),
+ (parameter_option "install_name", (hidden),
+     (help "File name the library will be installed in")),
  (parameter_option "compatibility_version", (hidden),
      (help "Compatibility version number")),
  (parameter_option "current_version", (hidden),
@@ -126,31 +136,31 @@ def Preprocess : OptionPreprocessor<
 
 // Tools
 
-class llvm_gcc_based <string cmd_prefix, string in_lang, string E_ext> : Tool<
+class llvm_gcc_based <string cmd_prefix, string in_lang,
+                      string E_ext, string out_lang> : Tool<
 [(in_language in_lang),
  (out_language "llvm-bitcode"),
- (output_suffix "bc"),
- (cmd_line (case
-            (switch_on "E"),
-              (case (not_empty "o"),
-                    !strconcat(cmd_prefix, " -E $INFILE -o $OUTFILE"),
-                    (default),
-                    !strconcat(cmd_prefix, " -E $INFILE")),
-            (switch_on "fsyntax-only"),
-              !strconcat(cmd_prefix, " -fsyntax-only $INFILE"),
-            (and (switch_on "S"), (switch_on "emit-llvm")),
-              !strconcat(cmd_prefix, " -S $INFILE -o $OUTFILE -emit-llvm"),
-            (default),
-              !strconcat(cmd_prefix, " -c $INFILE -o $OUTFILE -emit-llvm"))),
+ (output_suffix out_lang),
+ (command cmd_prefix),
  (actions
      (case
-         (and (multiple_input_files), (or (switch_on "S"), (switch_on "c"))),
+         (and (not_empty "o"),
+              (multiple_input_files), (or (switch_on "S"), (switch_on "c"))),
               (error "cannot specify -o with -c or -S with multiple files"),
-         (switch_on "E"), [(stop_compilation), (output_suffix E_ext)],
+         (switch_on "E"),
+              [(forward "E"), (stop_compilation), (output_suffix E_ext)],
+         (and (switch_on "E"), (empty "o")), (no_out_file),
          (switch_on ["emit-llvm", "S"]),
               [(output_suffix "ll"), (stop_compilation)],
          (switch_on ["emit-llvm", "c"]), (stop_compilation),
-         (switch_on "fsyntax-only"), (stop_compilation),
+         (switch_on "fsyntax-only"), [(forward "fsyntax-only"),
+                                      (no_out_file), (stop_compilation)],
+         (switch_on ["S", "emit-llvm"]), [(forward "S"), (forward "emit-llvm")],
+         (not (or (switch_on ["S", "emit-llvm"]), (switch_on "fsyntax-only"))),
+             [(append_cmd "-c"), (append_cmd "-emit-llvm")],
+
+         // Forwards
+         (not_empty "Xpreprocessor"), (forward "Xpreprocessor"),
          (not_empty "include"), (forward "include"),
          (not_empty "iquote"), (forward "iquote"),
          (not_empty "save-temps"), (append_cmd "-save-temps"),
@@ -176,12 +186,24 @@ class llvm_gcc_based <string cmd_prefix, string in_lang, string E_ext> : Tool<
  (sink)
 ]>;
 
-def llvm_gcc_c : llvm_gcc_based<"@LLVMGCCCOMMAND@ -x c", "c", "i">;
-def llvm_gcc_cpp : llvm_gcc_based<"@LLVMGXXCOMMAND@ -x c++", "c++", "i">;
+def llvm_gcc_c : llvm_gcc_based<"@LLVMGCCCOMMAND@ -x c", "c", "i", "bc">;
+def llvm_gcc_cpp : llvm_gcc_based<"@LLVMGXXCOMMAND@ -x c++", "c++", "i", "bc">;
 def llvm_gcc_m : llvm_gcc_based<"@LLVMGCCCOMMAND@ -x objective-c",
-                                                  "objective-c", "mi">;
+                                                  "objective-c", "mi", "bc">;
 def llvm_gcc_mxx : llvm_gcc_based<"@LLVMGCCCOMMAND@ -x objective-c++",
-                                  "objective-c++", "mi">;
+                                  "objective-c++", "mi", "bc">;
+
+def llvm_gcc_c_pch : llvm_gcc_based<"@LLVMGCCCOMMAND@ -x c-header",
+                                                      "c-header", "i", "gch">;
+def llvm_gcc_cpp_pch : llvm_gcc_based<"@LLVMGXXCOMMAND@ -x c++-header",
+                                                        "c++-header",
+                                                        "i", "gch">;
+def llvm_gcc_m_pch : llvm_gcc_based<"@LLVMGCCCOMMAND@ -x objective-c-header",
+                                                      "objective-c-header",
+                                                      "mi", "gch">;
+def llvm_gcc_mxx_pch
+    : llvm_gcc_based<"@LLVMGCCCOMMAND@ -x objective-c++-header",
+                                       "objective-c++-header", "mi", "gch">;
 
 def opt : Tool<
 [(in_language "llvm-bitcode"),
@@ -191,14 +213,14 @@ def opt : Tool<
                 (switch_on "O1"), (forward "O1"),
                 (switch_on "O2"), (forward "O2"),
                 (switch_on "O3"), (forward "O3"))),
- (cmd_line "opt -f $INFILE -o $OUTFILE")
+ (command "opt -f")
 ]>;
 
 def llvm_as : Tool<
 [(in_language "llvm-assembler"),
  (out_language "llvm-bitcode"),
  (output_suffix "bc"),
- (cmd_line "llvm-as $INFILE -o $OUTFILE"),
+ (command "llvm-as"),
  (actions (case (switch_on "emit-llvm"), (stop_compilation)))
 ]>;
 
@@ -206,18 +228,19 @@ def llvm_gcc_assembler : Tool<
 [(in_language "assembler"),
  (out_language "object-code"),
  (output_suffix "o"),
- (cmd_line "@LLVMGCCCOMMAND@ -c -x assembler $INFILE -o $OUTFILE"),
+ (command "@LLVMGCCCOMMAND@ -c -x assembler"),
  (actions (case
           (switch_on "c"), (stop_compilation),
           (not_empty "arch"), (forward "arch"),
-          (not_empty "Wa,"), (forward_value "Wa,")))
+          (not_empty "Xassembler"), (forward "Xassembler"),
+          (not_empty "Wa,"), (forward "Wa,")))
 ]>;
 
 def llc : Tool<
 [(in_language ["llvm-bitcode", "llvm-assembler"]),
  (out_language "assembler"),
  (output_suffix "s"),
- (cmd_line "llc -f $INFILE -o $OUTFILE"),
+ (command "llc -f"),
  (actions (case
           (switch_on "S"), (stop_compilation),
           (switch_on "O0"), (forward "O0"),
@@ -227,8 +250,8 @@ def llc : Tool<
           (switch_on "fPIC"), (append_cmd "-relocation-model=pic"),
           (switch_on "mdynamic-no-pic"),
                      (append_cmd "-relocation-model=dynamic-no-pic"),
-          (not_empty "march"), (forward "mcpu"),
-          (not_empty "mtune"), (forward "mcpu"),
+          (not_empty "march"), (forward_as "mtune", "-mcpu"),
+          (not_empty "mtune"), (forward_as "mtune", "-mcpu"),
           (not_empty "mcpu"), (forward "mcpu"),
           (not_empty "m"), (forward_transformed_value "m", "ConvertToMAttr"),
           (not_empty "Wllc,"), (forward_value "Wllc,")))
@@ -239,7 +262,9 @@ class llvm_gcc_based_linker <string cmd_prefix> : Tool<
 [(in_language "object-code"),
  (out_language "executable"),
  (output_suffix "out"),
- (cmd_line !strconcat(cmd_prefix, " $INFILE -o $OUTFILE")),
+ (command cmd_prefix),
+ (works_on_empty (case (not_empty "filelist"), true,
+                       (default), false)),
  (join),
  (actions (case
           (switch_on "pthread"), (append_cmd "-lpthread"),
@@ -248,9 +273,11 @@ class llvm_gcc_based_linker <string cmd_prefix> : Tool<
           (not_empty "arch"), (forward "arch"),
           (not_empty "framework"), (forward "framework"),
           (not_empty "weak_framework"), (forward "weak_framework"),
+          (not_empty "filelist"), (forward "filelist"),
           (switch_on "m32"), (forward "m32"),
           (switch_on "m64"), (forward "m64"),
           (not_empty "l"), (forward "l"),
+          (not_empty "Xlinker"), (forward "Xlinker"),
           (not_empty "Wl,"), (forward "Wl,"),
           (switch_on "dynamiclib"), (forward "dynamiclib"),
           (switch_on "prebind"), (forward "prebind"),
@@ -258,8 +285,8 @@ class llvm_gcc_based_linker <string cmd_prefix> : Tool<
           (switch_on "single_module"), (forward "single_module"),
           (not_empty "compatibility_version"),
                      (forward "compatibility_version"),
-          (not_empty "current_version"),
-                     (forward "current_version")))
+          (not_empty "current_version"), (forward "current_version"),
+          (not_empty "install_name"), (forward "install_name")))
 ]>;
 
 // Default linker
@@ -271,16 +298,20 @@ def llvm_gcc_cpp_linker : llvm_gcc_based_linker<"@LLVMGXXCOMMAND@">;
 
 def LanguageMap : LanguageMap<
     [LangToSuffixes<"c++", ["cc", "cp", "cxx", "cpp", "CPP", "c++", "C"]>,
+     LangToSuffixes<"c++-header", ["hpp"]>,
      LangToSuffixes<"c", ["c"]>,
+     LangToSuffixes<"c-header", ["h"]>,
      LangToSuffixes<"c-cpp-output", ["i"]>,
      LangToSuffixes<"objective-c-cpp-output", ["mi"]>,
      LangToSuffixes<"objective-c++", ["mm"]>,
+     LangToSuffixes<"objective-c++-header", ["hmm"]>,
      LangToSuffixes<"objective-c", ["m"]>,
+     LangToSuffixes<"objective-c-header", ["hm"]>,
      LangToSuffixes<"assembler", ["s"]>,
      LangToSuffixes<"assembler-with-cpp", ["S"]>,
      LangToSuffixes<"llvm-assembler", ["ll"]>,
      LangToSuffixes<"llvm-bitcode", ["bc"]>,
-     LangToSuffixes<"object-code", ["o"]>,
+     LangToSuffixes<"object-code", ["o", "*empty*"]>,
      LangToSuffixes<"executable", ["out"]>
      ]>;
 
@@ -294,6 +325,11 @@ def CompilationGraph : CompilationGraph<[
     Edge<"root", "llvm_gcc_mxx">,
     Edge<"root", "llc">,
 
+    Edge<"root", "llvm_gcc_c_pch">,
+    Edge<"root", "llvm_gcc_cpp_pch">,
+    Edge<"root", "llvm_gcc_m_pch">,
+    Edge<"root", "llvm_gcc_mxx_pch">,
+
     Edge<"llvm_gcc_c", "llc">,
     Edge<"llvm_gcc_cpp", "llc">,
     Edge<"llvm_gcc_m", "llc">,
diff --git a/libclamav/c++/llvm/tools/llvmc/plugins/Clang/Clang.td b/libclamav/c++/llvm/tools/llvmc/plugins/Clang/Clang.td
index ac8ac15..988d9b1 100644
--- a/libclamav/c++/llvm/tools/llvmc/plugins/Clang/Clang.td
+++ b/libclamav/c++/llvm/tools/llvmc/plugins/Clang/Clang.td
@@ -1,12 +1,3 @@
-// A replacement for the Clang's ccc script.
-// Depends on the Base plugin.
-// To compile, use this command:
-//
-//    cd $LLVMC2_DIR
-//    make DRIVER_NAME=ccc2 BUILTIN_PLUGINS=Clang
-//
-// Or just use the default llvmc, which now has this plugin enabled.
-
 include "llvm/CompilerDriver/Common.td"
 
 def Priority : PluginPriority<1>;
@@ -33,23 +24,17 @@ class clang_based<string language, string cmd, string ext_E> : Tool<
 [(in_language language),
  (out_language "llvm-bitcode"),
  (output_suffix "bc"),
- (cmd_line (case
-           (switch_on "E"),
-           (case
-                (not_empty "o"),
-                !strconcat(cmd, " -E $INFILE -o $OUTFILE"),
-                (default),
-                !strconcat(cmd, " -E $INFILE")),
-          (and (switch_on "S"), (switch_on "emit-llvm")),
-          !strconcat(cmd, " -emit-llvm $INFILE -o $OUTFILE"),
-          (default),
-          !strconcat(cmd, " -emit-llvm-bc $INFILE -o $OUTFILE"))),
+ (command cmd),
  (actions (case (switch_on "E"),
-                [(stop_compilation), (output_suffix ext_E)],
+                    [(forward "E"), (stop_compilation), (output_suffix ext_E)],
+                (and (switch_on "E"), (empty "o")), (no_out_file),
                 (switch_on "fsyntax-only"), (stop_compilation),
-                (and (switch_on "S"), (switch_on "emit-llvm")),
-                           [(stop_compilation), (output_suffix "ll")],
-                (and (switch_on "c"), (switch_on "emit-llvm")),
+                (switch_on ["S", "emit-llvm"]),
+                           [(append_cmd "-emit-llvm"),
+                            (stop_compilation), (output_suffix "ll")],
+                (not (switch_on ["S", "emit-llvm"])),
+                     (append_cmd "-emit-llvm-bc"),
+                (switch_on ["c", "emit-llvm"]),
                            (stop_compilation),
                 (not_empty "include"), (forward "include"),
                 (not_empty "I"), (forward "I"))),
@@ -67,7 +52,7 @@ def as : Tool<
 [(in_language "assembler"),
  (out_language "object-code"),
  (output_suffix "o"),
- (cmd_line "as $INFILE -o $OUTFILE"),
+ (command "as"),
  (actions (case (not_empty "Wa,"), (forward_value "Wa,"),
                 (switch_on "c"), (stop_compilation)))
 ]>;
@@ -77,7 +62,7 @@ def llvm_ld : Tool<
 [(in_language "object-code"),
  (out_language "executable"),
  (output_suffix "out"),
- (cmd_line "llvm-ld -native -disable-internalize $INFILE -o $OUTFILE"),
+ (command "llvm-ld -native -disable-internalize"),
  (actions (case
           (switch_on "pthread"), (append_cmd "-lpthread"),
           (not_empty "L"), (forward "L"),
diff --git a/libclamav/c++/llvm/unittests/ADT/APFloatTest.cpp b/libclamav/c++/llvm/unittests/ADT/APFloatTest.cpp
index b02cc3e..5719960 100644
--- a/libclamav/c++/llvm/unittests/ADT/APFloatTest.cpp
+++ b/libclamav/c++/llvm/unittests/ADT/APFloatTest.cpp
@@ -236,6 +236,13 @@ TEST(APFloatTest, fromDecimalString) {
   EXPECT_EQ(2.05e12,   APFloat(APFloat::IEEEdouble, "002.05000e12").convertToDouble());
   EXPECT_EQ(2.05e+12,  APFloat(APFloat::IEEEdouble, "002.05000e+12").convertToDouble());
   EXPECT_EQ(2.05e-12,  APFloat(APFloat::IEEEdouble, "002.05000e-12").convertToDouble());
+
+  // These are "carefully selected" to overflow the fast log-base
+  // calculations in APFloat.cpp
+  EXPECT_TRUE(APFloat(APFloat::IEEEdouble, "99e99999").isInfinity());
+  EXPECT_TRUE(APFloat(APFloat::IEEEdouble, "-99e99999").isInfinity());
+  EXPECT_TRUE(APFloat(APFloat::IEEEdouble, "1e-99999").isPosZero());
+  EXPECT_TRUE(APFloat(APFloat::IEEEdouble, "-1e-99999").isNegZero());
 }
 
 TEST(APFloatTest, fromHexadecimalString) {
@@ -337,6 +344,35 @@ TEST(APFloatTest, toString) {
   ASSERT_EQ("8.731834E+2", convertToString(873.1834, 0, 0));
 }
 
+static APInt nanbits(const fltSemantics &Sem,
+                     bool SNaN, bool Negative, uint64_t fill) {
+  APInt apfill(64, fill);
+  if (SNaN)
+    return APFloat::getSNaN(Sem, Negative, &apfill).bitcastToAPInt();
+  else
+    return APFloat::getQNaN(Sem, Negative, &apfill).bitcastToAPInt();
+}
+
+TEST(APFloatTest, makeNaN) {
+  ASSERT_EQ(0x7fc00000, nanbits(APFloat::IEEEsingle, false, false, 0));
+  ASSERT_EQ(0xffc00000, nanbits(APFloat::IEEEsingle, false, true, 0));
+  ASSERT_EQ(0x7fc0ae72, nanbits(APFloat::IEEEsingle, false, false, 0xae72));
+  ASSERT_EQ(0x7fffae72, nanbits(APFloat::IEEEsingle, false, false, 0xffffae72));
+  ASSERT_EQ(0x7fa00000, nanbits(APFloat::IEEEsingle, true, false, 0));
+  ASSERT_EQ(0xffa00000, nanbits(APFloat::IEEEsingle, true, true, 0));
+  ASSERT_EQ(0x7f80ae72, nanbits(APFloat::IEEEsingle, true, false, 0xae72));
+  ASSERT_EQ(0x7fbfae72, nanbits(APFloat::IEEEsingle, true, false, 0xffffae72));
+
+  ASSERT_EQ(0x7ff8000000000000ULL, nanbits(APFloat::IEEEdouble, false, false, 0));
+  ASSERT_EQ(0xfff8000000000000ULL, nanbits(APFloat::IEEEdouble, false, true, 0));
+  ASSERT_EQ(0x7ff800000000ae72ULL, nanbits(APFloat::IEEEdouble, false, false, 0xae72));
+  ASSERT_EQ(0x7fffffffffffae72ULL, nanbits(APFloat::IEEEdouble, false, false, 0xffffffffffffae72ULL));
+  ASSERT_EQ(0x7ff4000000000000ULL, nanbits(APFloat::IEEEdouble, true, false, 0));
+  ASSERT_EQ(0xfff4000000000000ULL, nanbits(APFloat::IEEEdouble, true, true, 0));
+  ASSERT_EQ(0x7ff000000000ae72ULL, nanbits(APFloat::IEEEdouble, true, false, 0xae72));
+  ASSERT_EQ(0x7ff7ffffffffae72ULL, nanbits(APFloat::IEEEdouble, true, false, 0xffffffffffffae72ULL));
+}
+
 #ifdef GTEST_HAS_DEATH_TEST
 TEST(APFloatTest, SemanticsDeath) {
   EXPECT_DEATH(APFloat(APFloat::IEEEsingle, 0.0f).convertToDouble(), "Float semantics are not IEEEdouble");
diff --git a/libclamav/c++/llvm/unittests/ExecutionEngine/JIT/JITTest.cpp b/libclamav/c++/llvm/unittests/ExecutionEngine/JIT/JITTest.cpp
index 53f5b38..1f90e8c 100644
--- a/libclamav/c++/llvm/unittests/ExecutionEngine/JIT/JITTest.cpp
+++ b/libclamav/c++/llvm/unittests/ExecutionEngine/JIT/JITTest.cpp
@@ -65,6 +65,8 @@ public:
     stubsAllocated = 0;
   }
 
+  void setSizeRequired(bool Required) { SizeRequired = Required; }
+
   virtual void setMemoryWritable() { Base->setMemoryWritable(); }
   virtual void setMemoryExecutable() { Base->setMemoryExecutable(); }
   virtual void setPoisonMemory(bool poison) { Base->setPoisonMemory(poison); }
@@ -630,6 +632,54 @@ TEST_F(JITTest, AvailableExternallyFunctionIsntCompiled) {
                         << " not 7 from the IR version.";
 }
 
+TEST_F(JITTest, NeedsExactSizeWithManyGlobals) {
+  // PR5291: When the JMM needed the exact size of function bodies before
+  // starting to emit them, the JITEmitter would modify a set while iterating
+  // over it.
+  TheJIT->DisableLazyCompilation(true);
+  RJMM->setSizeRequired(true);
+
+  LoadAssembly("@A = global i32 42 "
+               "@B = global i32* @A "
+               "@C = global i32** @B "
+               "@D = global i32*** @C "
+               "@E = global i32**** @D "
+               "@F = global i32***** @E "
+               "@G = global i32****** @F "
+               "@H = global i32******* @G "
+               "@I = global i32******** @H "
+               "define i32********* @test() { "
+               "  ret i32********* @I "
+               "}");
+  Function *testIR = M->getFunction("test");
+  int32_t********* (*test)() = reinterpret_cast<int32_t*********(*)()>(
+    (intptr_t)TheJIT->getPointerToFunction(testIR));
+  EXPECT_EQ(42, *********test());
+}
+
+TEST_F(JITTest, EscapedLazyStubStillCallable) {
+  TheJIT->DisableLazyCompilation(false);
+  LoadAssembly("define internal i32 @stubbed() { "
+               "  ret i32 42 "
+               "} "
+               " "
+               "define i32()* @get_stub() { "
+               "  ret i32()* @stubbed "
+               "} ");
+  typedef int32_t(*StubTy)();
+
+  // Call get_stub() to get the address of @stubbed without actually JITting it.
+  Function *get_stubIR = M->getFunction("get_stub");
+  StubTy (*get_stub)() = reinterpret_cast<StubTy(*)()>(
+    (intptr_t)TheJIT->getPointerToFunction(get_stubIR));
+  StubTy stubbed = get_stub();
+  // Now get_stubIR is the only reference to stubbed's stub.
+  get_stubIR->eraseFromParent();
+  // Now there are no references inside the JIT, but we've got a pointer outside
+  // it.  The stub should be callable and return the right value.
+  EXPECT_EQ(42, stubbed());
+}
+
 // Converts the LLVM assembly to bitcode and returns it in a std::string.  An
 // empty string indicates an error.
 std::string AssembleToBitcode(LLVMContext &Context, const char *Assembly) {
diff --git a/libclamav/c++/llvm/unittests/Makefile.unittest b/libclamav/c++/llvm/unittests/Makefile.unittest
index 6fbef54..b1c1d2c 100644
--- a/libclamav/c++/llvm/unittests/Makefile.unittest
+++ b/libclamav/c++/llvm/unittests/Makefile.unittest
@@ -28,6 +28,15 @@ CPP.Flags += -I$(LLVM_SRC_ROOT)/utils/unittest/googletest/include/
 CPP.Flags += $(NO_VARIADIC_MACROS)
 TESTLIBS = -lGoogleTest -lUnitTestMain
 
+ifeq ($(ENABLE_SHARED), 1)
+  # Add the absolute path to the dynamic library.  This is ok because
+  # we'll never install unittests.
+  LD.Flags += $(RPATH) -Wl,$(LibDir)
+  # Also set {DYLD,LD}_LIBRARY_PATH because OSX ignores the rpath most
+  # of the time.
+  Run.Shared := $(SHLIBPATH_VAR)="$(LibDir)$${$(SHLIBPATH_VAR):+:}$$$(SHLIBPATH_VAR)"
+endif
+
 $(LLVMUnitTestExe): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths)
 	$(Echo) Linking $(BuildMode) unit test $(TESTNAME) $(StripWarnMsg)
 	$(Verb) $(Link) -o $@ $(TOOLLINKOPTS) $(ObjectsO) $(ProjLibsOptions) \
@@ -38,6 +47,6 @@ $(LLVMUnitTestExe): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths)
 all:: $(LLVMUnitTestExe)
 
 unitcheck:: $(LLVMUnitTestExe)
-	$(LLVMUnitTestExe)
+	$(Run.Shared) $(LLVMUnitTestExe)
 
 endif
diff --git a/libclamav/c++/llvm/unittests/Support/AllocatorTest.cpp b/libclamav/c++/llvm/unittests/Support/AllocatorTest.cpp
index 2a01f3a..6c0fca9 100644
--- a/libclamav/c++/llvm/unittests/Support/AllocatorTest.cpp
+++ b/libclamav/c++/llvm/unittests/Support/AllocatorTest.cpp
@@ -88,7 +88,7 @@ TEST(AllocatorTest, TestOverflow) {
   Alloc.Allocate(4096 - sizeof(MemSlab), 0);
   EXPECT_EQ(1U, Alloc.GetNumSlabs());
 
-  // If we dont't allocate a new slab, then we will have overflowed.
+  // If we don't allocate a new slab, then we will have overflowed.
   Alloc.Allocate(1, 0);
   EXPECT_EQ(2U, Alloc.GetNumSlabs());
 }
diff --git a/libclamav/c++/llvm/unittests/Support/RegexTest.cpp b/libclamav/c++/llvm/unittests/Support/RegexTest.cpp
index 44c7e55..65b66c3 100644
--- a/libclamav/c++/llvm/unittests/Support/RegexTest.cpp
+++ b/libclamav/c++/llvm/unittests/Support/RegexTest.cpp
@@ -62,4 +62,33 @@ TEST_F(RegexTest, Basics) {
   EXPECT_TRUE(r5.match(String));
 }
 
+TEST_F(RegexTest, Substitution) {
+  std::string Error;
+
+  EXPECT_EQ("aNUMber", Regex("[0-9]+").sub("NUM", "a1234ber"));
+
+  // Standard Escapes
+  EXPECT_EQ("a\\ber", Regex("[0-9]+").sub("\\\\", "a1234ber", &Error));
+  EXPECT_EQ(Error, "");
+  EXPECT_EQ("a\nber", Regex("[0-9]+").sub("\\n", "a1234ber", &Error));
+  EXPECT_EQ(Error, "");
+  EXPECT_EQ("a\tber", Regex("[0-9]+").sub("\\t", "a1234ber", &Error));
+  EXPECT_EQ(Error, "");
+  EXPECT_EQ("ajber", Regex("[0-9]+").sub("\\j", "a1234ber", &Error));
+  EXPECT_EQ(Error, "");
+
+  EXPECT_EQ("aber", Regex("[0-9]+").sub("\\", "a1234ber", &Error));
+  EXPECT_EQ(Error, "replacement string contained trailing backslash");
+  
+  // Backreferences
+  EXPECT_EQ("aa1234bber", Regex("a[0-9]+b").sub("a\\0b", "a1234ber", &Error));
+  EXPECT_EQ(Error, "");
+
+  EXPECT_EQ("a1234ber", Regex("a([0-9]+)b").sub("a\\1b", "a1234ber", &Error));
+  EXPECT_EQ(Error, "");
+
+  EXPECT_EQ("aber", Regex("a[0-9]+b").sub("a\\100b", "a1234ber", &Error));
+  EXPECT_EQ(Error, "invalid backreference string '100'");
+}
+
 }
diff --git a/libclamav/c++/llvm/unittests/VMCore/MetadataTest.cpp b/libclamav/c++/llvm/unittests/VMCore/MetadataTest.cpp
index e374789..13bf27e 100644
--- a/libclamav/c++/llvm/unittests/VMCore/MetadataTest.cpp
+++ b/libclamav/c++/llvm/unittests/VMCore/MetadataTest.cpp
@@ -20,11 +20,15 @@ using namespace llvm;
 
 namespace {
 
-LLVMContext &Context = getGlobalContext();
+class MetadataTest : public testing::Test {
+protected:
+  LLVMContext Context;
+};
+typedef MetadataTest MDStringTest;
 
 // Test that construction of MDString with different value produces different
 // MDString objects, even with the same string pointer and nulls in the string.
-TEST(MDStringTest, CreateDifferent) {
+TEST_F(MDStringTest, CreateDifferent) {
   char x[3] = { 'f', 0, 'A' };
   MDString *s1 = MDString::get(Context, StringRef(&x[0], 3));
   x[2] = 'B';
@@ -34,7 +38,7 @@ TEST(MDStringTest, CreateDifferent) {
 
 // Test that creation of MDStrings with the same string contents produces the
 // same MDString object, even with different pointers.
-TEST(MDStringTest, CreateSame) {
+TEST_F(MDStringTest, CreateSame) {
   char x[4] = { 'a', 'b', 'c', 'X' };
   char y[4] = { 'a', 'b', 'c', 'Y' };
 
@@ -44,7 +48,7 @@ TEST(MDStringTest, CreateSame) {
 }
 
 // Test that MDString prints out the string we fed it.
-TEST(MDStringTest, PrintingSimple) {
+TEST_F(MDStringTest, PrintingSimple) {
   char *str = new char[13];
   strncpy(str, "testing 1 2 3", 13);
   MDString *s = MDString::get(Context, StringRef(str, 13));
@@ -58,7 +62,7 @@ TEST(MDStringTest, PrintingSimple) {
 }
 
 // Test printing of MDString with non-printable characters.
-TEST(MDStringTest, PrintingComplex) {
+TEST_F(MDStringTest, PrintingComplex) {
   char str[5] = {0, '\n', '"', '\\', -1};
   MDString *s = MDString::get(Context, StringRef(str+0, 5));
   std::string Str;
@@ -67,8 +71,10 @@ TEST(MDStringTest, PrintingComplex) {
   EXPECT_STREQ("metadata !\"\\00\\0A\\22\\5C\\FF\"", oss.str().c_str());
 }
 
+typedef MetadataTest MDNodeTest;
+
 // Test the two constructors, and containing other Constants.
-TEST(MDNodeTest, Simple) {
+TEST_F(MDNodeTest, Simple) {
   char x[3] = { 'a', 'b', 'c' };
   char y[3] = { '1', '2', '3' };
 
@@ -101,7 +107,7 @@ TEST(MDNodeTest, Simple) {
   EXPECT_EQ(n1, n2->getOperand(0));
 }
 
-TEST(MDNodeTest, Delete) {
+TEST_F(MDNodeTest, Delete) {
   Constant *C = ConstantInt::get(Type::getInt32Ty(getGlobalContext()), 1);
   Instruction *I = new BitCastInst(C, Type::getInt32Ty(getGlobalContext()));
 
@@ -115,8 +121,9 @@ TEST(MDNodeTest, Delete) {
 }
 
 TEST(NamedMDNodeTest, Search) {
-  Constant *C = ConstantInt::get(Type::getInt32Ty(getGlobalContext()), 1);
-  Constant *C2 = ConstantInt::get(Type::getInt32Ty(getGlobalContext()), 2);
+  LLVMContext Context;
+  Constant *C = ConstantInt::get(Type::getInt32Ty(Context), 1);
+  Constant *C2 = ConstantInt::get(Type::getInt32Ty(Context), 2);
 
   Value *const V = C;
   Value *const V2 = C2;
@@ -125,9 +132,9 @@ TEST(NamedMDNodeTest, Search) {
 
   MDNode *Nodes[2] = { n, n2 };
 
-  Module *M = new Module("MyModule", getGlobalContext());
+  Module *M = new Module("MyModule", Context);
   const char *Name = "llvm.NMD1";
-  NamedMDNode *NMD = NamedMDNode::Create(getGlobalContext(), Name, &Nodes[0], 2, M);
+  NamedMDNode *NMD = NamedMDNode::Create(Context, Name, &Nodes[0], 2, M);
   std::string Str;
   raw_string_ostream oss(Str);
   NMD->print(oss);
diff --git a/libclamav/c++/llvm/unittests/VMCore/VerifierTest.cpp b/libclamav/c++/llvm/unittests/VMCore/VerifierTest.cpp
new file mode 100644
index 0000000..c8838c5
--- /dev/null
+++ b/libclamav/c++/llvm/unittests/VMCore/VerifierTest.cpp
@@ -0,0 +1,44 @@
+//===- llvm/unittest/VMCore/VerifierTest.cpp - Verifier unit tests --------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/Constants.h"
+#include "llvm/DerivedTypes.h"
+#include "llvm/Function.h"
+#include "llvm/Instructions.h"
+#include "llvm/LLVMContext.h"
+#include "llvm/Analysis/Verifier.h"
+#include "gtest/gtest.h"
+
+namespace llvm {
+namespace {
+
+TEST(VerifierTest, Branch_i1) {
+  LLVMContext &C = getGlobalContext();
+  FunctionType *FTy = FunctionType::get(Type::getVoidTy(C), /*isVarArg=*/false);
+  Function *F = Function::Create(FTy, GlobalValue::ExternalLinkage);
+  BasicBlock *Entry = BasicBlock::Create(C, "entry", F);
+  BasicBlock *Exit = BasicBlock::Create(C, "exit", F);
+  ReturnInst::Create(C, Exit);
+
+  // To avoid triggering an assertion in BranchInst::Create, we first create
+  // a branch with an 'i1' condition ...
+
+  Constant *False = ConstantInt::getFalse(C);
+  BranchInst *BI = BranchInst::Create(Exit, Exit, False, Entry);
+
+  // ... then use setOperand to redirect it to a value of different type.
+
+  Constant *Zero32 = ConstantInt::get(IntegerType::get(C, 32), 0);
+  BI->setOperand(0, Zero32);
+
+  EXPECT_TRUE(verifyFunction(*F, ReturnStatusAction));
+}
+
+}
+}
diff --git a/libclamav/c++/llvm/utils/GenLibDeps.pl b/libclamav/c++/llvm/utils/GenLibDeps.pl
index b320a91..f1f7e72 100755
--- a/libclamav/c++/llvm/utils/GenLibDeps.pl
+++ b/libclamav/c++/llvm/utils/GenLibDeps.pl
@@ -70,6 +70,8 @@ opendir DIR,$Directory;
 my @files = readdir DIR;
 closedir DIR;
 my @libs = grep(/libLLVM.*\.(dylib|so|a)$/,sort(@files));
+# Omit the all-of-llvm shared library.
+ at libs = grep(!/libLLVM-\d\.\d(svn)?\.(dylib|so)/, @libs);
 my @objs = grep(/LLVM.*\.o$/,sort(@files));
 
 # Declare the hashes we will use to keep track of the library and object file
diff --git a/libclamav/c++/llvm/utils/TableGen/CMakeLists.txt b/libclamav/c++/llvm/utils/TableGen/CMakeLists.txt
index a2678a2..881b50a 100644
--- a/libclamav/c++/llvm/utils/TableGen/CMakeLists.txt
+++ b/libclamav/c++/llvm/utils/TableGen/CMakeLists.txt
@@ -11,6 +11,7 @@ add_executable(tblgen
   DAGISelEmitter.cpp
   DAGISelMatcherEmitter.cpp
   DAGISelMatcherGen.cpp
+  DAGISelMatcherOpt.cpp
   DAGISelMatcher.cpp
   DisassemblerEmitter.cpp
   EDEmitter.cpp
diff --git a/libclamav/c++/llvm/utils/TableGen/CodeGenDAGPatterns.cpp b/libclamav/c++/llvm/utils/TableGen/CodeGenDAGPatterns.cpp
index 94d3534..ce737bf 100644
--- a/libclamav/c++/llvm/utils/TableGen/CodeGenDAGPatterns.cpp
+++ b/libclamav/c++/llvm/utils/TableGen/CodeGenDAGPatterns.cpp
@@ -447,6 +447,30 @@ SDNodeInfo::SDNodeInfo(Record *R) : Def(R) {
   TypeConstraints.assign(ConstraintList.begin(), ConstraintList.end());
 }
 
+/// getKnownType - If the type constraints on this node imply a fixed type
+/// (e.g. all stores return void, etc), then return it as an
+/// MVT::SimpleValueType.  Otherwise, return EEVT::isUnknown.
+unsigned SDNodeInfo::getKnownType() const {
+  unsigned NumResults = getNumResults();
+  assert(NumResults <= 1 &&
+         "We only work with nodes with zero or one result so far!");
+  
+  for (unsigned i = 0, e = TypeConstraints.size(); i != e; ++i) {
+    // Make sure that this applies to the correct node result.
+    if (TypeConstraints[i].OperandNo >= NumResults)  // FIXME: need value #
+      continue;
+    
+    switch (TypeConstraints[i].ConstraintType) {
+    default: break;
+    case SDTypeConstraint::SDTCisVT:
+      return TypeConstraints[i].x.SDTCisVT_Info.VT;
+    case SDTypeConstraint::SDTCisPtrTy:
+      return MVT::iPTR;
+    }
+  }
+  return EEVT::isUnknown;
+}
+
 //===----------------------------------------------------------------------===//
 // TreePatternNode implementation
 //
@@ -568,33 +592,36 @@ bool TreePatternNode::UpdateNodeType(const std::vector<unsigned char> &ExtVTs,
   return true; // unreachable
 }
 
+static std::string GetTypeName(unsigned char TypeID) {
+  switch (TypeID) {
+  case MVT::Other:      return "Other";
+  case MVT::iAny:       return "iAny";
+  case MVT::fAny:       return "fAny";
+  case MVT::vAny:       return "vAny";
+  case EEVT::isUnknown: return "isUnknown";
+  case MVT::iPTR:       return "iPTR";
+  case MVT::iPTRAny:    return "iPTRAny";
+  default:
+    std::string VTName = llvm::getName((MVT::SimpleValueType)TypeID);
+    // Strip off EVT:: prefix if present.
+    if (VTName.substr(0,5) == "MVT::")
+      VTName = VTName.substr(5);
+    return VTName;
+  }
+}
+
 
 void TreePatternNode::print(raw_ostream &OS) const {
   if (isLeaf()) {
     OS << *getLeafValue();
   } else {
-    OS << "(" << getOperator()->getName();
+    OS << '(' << getOperator()->getName();
   }
   
   // FIXME: At some point we should handle printing all the value types for 
   // nodes that are multiply typed.
-  switch (getExtTypeNum(0)) {
-  case MVT::Other: OS << ":Other"; break;
-  case MVT::iAny: OS << ":iAny"; break;
-  case MVT::fAny : OS << ":fAny"; break;
-  case MVT::vAny: OS << ":vAny"; break;
-  case EEVT::isUnknown: ; /*OS << ":?";*/ break;
-  case MVT::iPTR:  OS << ":iPTR"; break;
-  case MVT::iPTRAny:  OS << ":iPTRAny"; break;
-  default: {
-    std::string VTName = llvm::getName(getTypeNum(0));
-    // Strip off EVT:: prefix if present.
-    if (VTName.substr(0,5) == "MVT::")
-      VTName = VTName.substr(5);
-    OS << ":" << VTName;
-    break;
-  }
-  }
+  if (getExtTypeNum(0) != EEVT::isUnknown)
+    OS << ':' << GetTypeName(getExtTypeNum(0));
 
   if (!isLeaf()) {
     if (getNumChildren() != 0) {
@@ -956,19 +983,25 @@ bool TreePatternNode::ApplyTypeConstraints(TreePattern &TP, bool NotRegisters) {
       MadeChange |= UpdateNodeType(MVT::isVoid, TP);
     }
     return MadeChange;
-  } else if (getOperator()->getName() == "implicit" ||
-             getOperator()->getName() == "parallel") {
+  }
+  
+  if (getOperator()->getName() == "implicit" ||
+      getOperator()->getName() == "parallel") {
     bool MadeChange = false;
     for (unsigned i = 0; i < getNumChildren(); ++i)
       MadeChange = getChild(i)->ApplyTypeConstraints(TP, NotRegisters);
     MadeChange |= UpdateNodeType(MVT::isVoid, TP);
     return MadeChange;
-  } else if (getOperator()->getName() == "COPY_TO_REGCLASS") {
+  }
+  
+  if (getOperator()->getName() == "COPY_TO_REGCLASS") {
     bool MadeChange = false;
     MadeChange |= getChild(0)->ApplyTypeConstraints(TP, NotRegisters);
     MadeChange |= getChild(1)->ApplyTypeConstraints(TP, NotRegisters);
     return MadeChange;
-  } else if (const CodeGenIntrinsic *Int = getIntrinsicInfo(CDP)) {
+  }
+  
+  if (const CodeGenIntrinsic *Int = getIntrinsicInfo(CDP)) {
     bool MadeChange = false;
 
     // Apply the result type to the node.
@@ -992,7 +1025,9 @@ bool TreePatternNode::ApplyTypeConstraints(TreePattern &TP, bool NotRegisters) {
       MadeChange |= getChild(i)->ApplyTypeConstraints(TP, NotRegisters);
     }
     return MadeChange;
-  } else if (getOperator()->isSubClassOf("SDNode")) {
+  }
+  
+  if (getOperator()->isSubClassOf("SDNode")) {
     const SDNodeInfo &NI = CDP.getSDNodeInfo(getOperator());
     
     bool MadeChange = NI.ApplyTypeConstraints(this, TP);
@@ -1004,7 +1039,9 @@ bool TreePatternNode::ApplyTypeConstraints(TreePattern &TP, bool NotRegisters) {
       MadeChange |= UpdateNodeType(MVT::isVoid, TP);
     
     return MadeChange;  
-  } else if (getOperator()->isSubClassOf("Instruction")) {
+  }
+  
+  if (getOperator()->isSubClassOf("Instruction")) {
     const DAGInstruction &Inst = CDP.getInstruction(getOperator());
     bool MadeChange = false;
     unsigned NumResults = Inst.getNumResults();
@@ -1080,24 +1117,24 @@ bool TreePatternNode::ApplyTypeConstraints(TreePattern &TP, bool NotRegisters) {
                "' was provided too many operands!");
     
     return MadeChange;
-  } else {
-    assert(getOperator()->isSubClassOf("SDNodeXForm") && "Unknown node type!");
-    
-    // Node transforms always take one operand.
-    if (getNumChildren() != 1)
-      TP.error("Node transform '" + getOperator()->getName() +
-               "' requires one operand!");
-
-    // If either the output or input of the xform does not have exact
-    // type info. We assume they must be the same. Otherwise, it is perfectly
-    // legal to transform from one type to a completely different type.
-    if (!hasTypeSet() || !getChild(0)->hasTypeSet()) {
-      bool MadeChange = UpdateNodeType(getChild(0)->getExtTypes(), TP);
-      MadeChange |= getChild(0)->UpdateNodeType(getExtTypes(), TP);
-      return MadeChange;
-    }
-    return false;
   }
+  
+  assert(getOperator()->isSubClassOf("SDNodeXForm") && "Unknown node type!");
+  
+  // Node transforms always take one operand.
+  if (getNumChildren() != 1)
+    TP.error("Node transform '" + getOperator()->getName() +
+             "' requires one operand!");
+
+  // If either the output or input of the xform does not have exact
+  // type info. We assume they must be the same. Otherwise, it is perfectly
+  // legal to transform from one type to a completely different type.
+  if (!hasTypeSet() || !getChild(0)->hasTypeSet()) {
+    bool MadeChange = UpdateNodeType(getChild(0)->getExtTypes(), TP);
+    MadeChange |= getChild(0)->UpdateNodeType(getExtTypes(), TP);
+    return MadeChange;
+  }
+  return false;
 }
 
 /// OnlyOnRHSOfCommutative - Return true if this value is only allowed on the
@@ -1370,7 +1407,6 @@ void TreePattern::dump() const { print(errs()); }
 // CodeGenDAGPatterns implementation
 //
 
-// FIXME: REMOVE OSTREAM ARGUMENT
 CodeGenDAGPatterns::CodeGenDAGPatterns(RecordKeeper &R) : Records(R) {
   Intrinsics = LoadIntrinsics(Records, false);
   TgtIntrinsics = LoadIntrinsics(Records, true);
@@ -1569,10 +1605,10 @@ void CodeGenDAGPatterns::ParseDefaultOperands() {
         if (TPN->ContainsUnresolvedType()) {
           if (iter == 0)
             throw "Value #" + utostr(i) + " of PredicateOperand '" +
-              DefaultOps[iter][i]->getName() + "' doesn't have a concrete type!";
+              DefaultOps[iter][i]->getName() +"' doesn't have a concrete type!";
           else
             throw "Value #" + utostr(i) + " of OptionalDefOperand '" +
-              DefaultOps[iter][i]->getName() + "' doesn't have a concrete type!";
+              DefaultOps[iter][i]->getName() +"' doesn't have a concrete type!";
         }
         DefaultOpInfo.DefaultOps.push_back(TPN);
       }
@@ -1616,21 +1652,21 @@ static bool HandleUse(TreePattern *I, TreePatternNode *Pat,
   TreePatternNode *&Slot = InstInputs[Pat->getName()];
   if (!Slot) {
     Slot = Pat;
+    return true;
+  }
+  Record *SlotRec;
+  if (Slot->isLeaf()) {
+    SlotRec = dynamic_cast<DefInit*>(Slot->getLeafValue())->getDef();
   } else {
-    Record *SlotRec;
-    if (Slot->isLeaf()) {
-      SlotRec = dynamic_cast<DefInit*>(Slot->getLeafValue())->getDef();
-    } else {
-      assert(Slot->getNumChildren() == 0 && "can't be a use with children!");
-      SlotRec = Slot->getOperator();
-    }
-    
-    // Ensure that the inputs agree if we've already seen this input.
-    if (Rec != SlotRec)
-      I->error("All $" + Pat->getName() + " inputs must agree with each other");
-    if (Slot->getExtTypes() != Pat->getExtTypes())
-      I->error("All $" + Pat->getName() + " inputs must agree with each other");
+    assert(Slot->getNumChildren() == 0 && "can't be a use with children!");
+    SlotRec = Slot->getOperator();
   }
+  
+  // Ensure that the inputs agree if we've already seen this input.
+  if (Rec != SlotRec)
+    I->error("All $" + Pat->getName() + " inputs must agree with each other");
+  if (Slot->getExtTypes() != Pat->getExtTypes())
+    I->error("All $" + Pat->getName() + " inputs must agree with each other");
   return true;
 }
 
@@ -1648,7 +1684,9 @@ FindPatternInputsAndOutputs(TreePattern *I, TreePatternNode *Pat,
     if (!isUse && Pat->getTransformFn())
       I->error("Cannot specify a transform function for a non-input value!");
     return;
-  } else if (Pat->getOperator()->getName() == "implicit") {
+  }
+  
+  if (Pat->getOperator()->getName() == "implicit") {
     for (unsigned i = 0, e = Pat->getNumChildren(); i != e; ++i) {
       TreePatternNode *Dest = Pat->getChild(i);
       if (!Dest->isLeaf())
@@ -1660,7 +1698,9 @@ FindPatternInputsAndOutputs(TreePattern *I, TreePatternNode *Pat,
       InstImpResults.push_back(Val->getDef());
     }
     return;
-  } else if (Pat->getOperator()->getName() != "set") {
+  }
+  
+  if (Pat->getOperator()->getName() != "set") {
     // If this is not a set, verify that the children nodes are not void typed,
     // and recurse.
     for (unsigned i = 0, e = Pat->getNumChildren(); i != e; ++i) {
@@ -1677,7 +1717,7 @@ FindPatternInputsAndOutputs(TreePattern *I, TreePatternNode *Pat,
     if (!isUse && Pat->getTransformFn())
       I->error("Cannot specify a transform function for a non-input value!");
     return;
-  } 
+  }
   
   // Otherwise, this is a set, validate and collect instruction results.
   if (Pat->getNumChildren() == 0)
@@ -2063,20 +2103,100 @@ void CodeGenDAGPatterns::ParseInstructions() {
       SrcPattern = Pattern;
     }
     
-    std::string Reason;
-    if (!SrcPattern->canPatternMatch(Reason, *this))
-      I->error("Instruction can never match: " + Reason);
-    
     Record *Instr = II->first;
-    TreePatternNode *DstPattern = TheInst.getResultPattern();
-    PatternsToMatch.
-      push_back(PatternToMatch(Instr->getValueAsListInit("Predicates"),
-                               SrcPattern, DstPattern, TheInst.getImpResults(),
-                               Instr->getValueAsInt("AddedComplexity")));
+    AddPatternToMatch(I,
+                      PatternToMatch(Instr->getValueAsListInit("Predicates"),
+                                     SrcPattern,
+                                     TheInst.getResultPattern(),
+                                     TheInst.getImpResults(),
+                                     Instr->getValueAsInt("AddedComplexity"),
+                                     Instr->getID()));
   }
 }
 
 
+typedef std::pair<const TreePatternNode*, unsigned> NameRecord;
+
+static void FindNames(const TreePatternNode *P, 
+                      std::map<std::string, NameRecord> &Names,
+                      const TreePattern *PatternTop) {
+  if (!P->getName().empty()) {
+    NameRecord &Rec = Names[P->getName()];
+    // If this is the first instance of the name, remember the node.
+    if (Rec.second++ == 0)
+      Rec.first = P;
+    else if (Rec.first->getExtTypes() != P->getExtTypes())
+      PatternTop->error("repetition of value: $" + P->getName() +
+                        " where different uses have different types!");
+  }
+  
+  if (!P->isLeaf()) {
+    for (unsigned i = 0, e = P->getNumChildren(); i != e; ++i)
+      FindNames(P->getChild(i), Names, PatternTop);
+  }
+}
+
+void CodeGenDAGPatterns::AddPatternToMatch(const TreePattern *Pattern,
+                                           const PatternToMatch &PTM) {
+  // Do some sanity checking on the pattern we're about to match.
+  std::string Reason;
+  if (!PTM.getSrcPattern()->canPatternMatch(Reason, *this))
+    Pattern->error("Pattern can never match: " + Reason);
+  
+  // If the source pattern's root is a complex pattern, that complex pattern
+  // must specify the nodes it can potentially match.
+  if (const ComplexPattern *CP =
+        PTM.getSrcPattern()->getComplexPatternInfo(*this))
+    if (CP->getRootNodes().empty())
+      Pattern->error("ComplexPattern at root must specify list of opcodes it"
+                     " could match");
+  
+  
+  // Find all of the named values in the input and output, ensure they have the
+  // same type.
+  std::map<std::string, NameRecord> SrcNames, DstNames;
+  FindNames(PTM.getSrcPattern(), SrcNames, Pattern);
+  FindNames(PTM.getDstPattern(), DstNames, Pattern);
+
+  // Scan all of the named values in the destination pattern, rejecting them if
+  // they don't exist in the input pattern.
+  for (std::map<std::string, NameRecord>::iterator
+       I = DstNames.begin(), E = DstNames.end(); I != E; ++I) {
+    if (SrcNames[I->first].first == 0)
+      Pattern->error("Pattern has input without matching name in output: $" +
+                     I->first);
+    
+#if 0
+    const std::vector<unsigned char> &SrcTypeVec =
+      SrcNames[I->first].first->getExtTypes();
+    const std::vector<unsigned char> &DstTypeVec =
+      I->second.first->getExtTypes();
+    if (SrcTypeVec == DstTypeVec) continue;
+    
+    std::string SrcType, DstType;
+    for (unsigned i = 0, e = SrcTypeVec.size(); i != e; ++i)
+      SrcType += ":" + GetTypeName(SrcTypeVec[i]);
+    for (unsigned i = 0, e = DstTypeVec.size(); i != e; ++i)
+      DstType += ":" + GetTypeName(DstTypeVec[i]);
+    
+    Pattern->error("Variable $" + I->first +
+                   " has different types in source (" + SrcType +
+                   ") and dest (" + DstType + ") pattern!");
+#endif
+  }
+  
+  // Scan all of the named values in the source pattern, rejecting them if the
+  // name isn't used in the dest, and isn't used to tie two values together.
+  for (std::map<std::string, NameRecord>::iterator
+       I = SrcNames.begin(), E = SrcNames.end(); I != E; ++I)
+    if (DstNames[I->first].first == 0 && SrcNames[I->first].second == 1)
+      Pattern->error("Pattern has dead named input: $" + I->first);
+  
+  PatternsToMatch.push_back(PTM);
+}
+
+
+
 void CodeGenDAGPatterns::InferInstructionFlags() {
   std::map<std::string, CodeGenInstruction> &InstrDescs =
     Target.getInstructions();
@@ -2204,15 +2324,13 @@ void CodeGenDAGPatterns::ParsePatterns() {
     TreePattern Temp(Result->getRecord(), DstPattern, false, *this);
     Temp.InferAllTypes();
 
-    std::string Reason;
-    if (!Pattern->getTree(0)->canPatternMatch(Reason, *this))
-      Pattern->error("Pattern can never match: " + Reason);
     
-    PatternsToMatch.
-      push_back(PatternToMatch(Patterns[i]->getValueAsListInit("Predicates"),
-                               Pattern->getTree(0),
-                               Temp.getOnlyTree(), InstImpResults,
-                               Patterns[i]->getValueAsInt("AddedComplexity")));
+    AddPatternToMatch(Pattern,
+                 PatternToMatch(Patterns[i]->getValueAsListInit("Predicates"),
+                                Pattern->getTree(0),
+                                Temp.getOnlyTree(), InstImpResults,
+                                Patterns[i]->getValueAsInt("AddedComplexity"),
+                                Patterns[i]->getID()));
   }
 }
 
@@ -2234,13 +2352,13 @@ static void CombineChildVariants(TreePatternNode *Orig,
   bool NotDone;
   do {
 #ifndef NDEBUG
-    if (DebugFlag && !Idxs.empty()) {
-      errs() << Orig->getOperator()->getName() << ": Idxs = [ ";
-        for (unsigned i = 0; i < Idxs.size(); ++i) {
-          errs() << Idxs[i] << " ";
-      }
-      errs() << "]\n";
-    }
+    DEBUG(if (!Idxs.empty()) {
+            errs() << Orig->getOperator()->getName() << ": Idxs = [ ";
+              for (unsigned i = 0; i < Idxs.size(); ++i) {
+                errs() << Idxs[i] << " ";
+            }
+            errs() << "]\n";
+          });
 #endif
     // Create the variant and add it to the output list.
     std::vector<TreePatternNode*> NewChildren;
@@ -2506,7 +2624,8 @@ void CodeGenDAGPatterns::GenerateVariants() {
         push_back(PatternToMatch(PatternsToMatch[i].getPredicates(),
                                  Variant, PatternsToMatch[i].getDstPattern(),
                                  PatternsToMatch[i].getDstRegs(),
-                                 PatternsToMatch[i].getAddedComplexity()));
+                                 PatternsToMatch[i].getAddedComplexity(),
+                                 Record::getNewUID()));
     }
 
     DEBUG(errs() << "\n");
diff --git a/libclamav/c++/llvm/utils/TableGen/CodeGenDAGPatterns.h b/libclamav/c++/llvm/utils/TableGen/CodeGenDAGPatterns.h
index 5eef9e1..37d633e 100644
--- a/libclamav/c++/llvm/utils/TableGen/CodeGenDAGPatterns.h
+++ b/libclamav/c++/llvm/utils/TableGen/CodeGenDAGPatterns.h
@@ -125,6 +125,11 @@ public:
     return TypeConstraints;
   }
   
+  /// getKnownType - If the type constraints on this node imply a fixed type
+  /// (e.g. all stores return void, etc), then return it as an
+  /// MVT::SimpleValueType.  Otherwise, return EEVT::isUnknown.
+  unsigned getKnownType() const;
+  
   /// hasProperty - Return true if this node has the specified property.
   ///
   bool hasProperty(enum SDNP Prop) const { return Properties & (1 << Prop); }
@@ -216,6 +221,13 @@ public:
   void setChild(unsigned i, TreePatternNode *N) {
     Children[i] = N;
   }
+  
+  /// hasChild - Return true if N is any of our children.
+  bool hasChild(const TreePatternNode *N) const {
+    for (unsigned i = 0, e = Children.size(); i != e; ++i)
+      if (Children[i] == N) return true;
+    return false;
+  }
 
   const std::vector<std::string> &getPredicateFns() const {return PredicateFns;}
   void clearPredicateFns() { PredicateFns.clear(); }
@@ -459,19 +471,21 @@ public:
   
 /// PatternToMatch - Used by CodeGenDAGPatterns to keep tab of patterns
 /// processed to produce isel.
-struct PatternToMatch {
+class PatternToMatch {
+public:
   PatternToMatch(ListInit *preds,
                  TreePatternNode *src, TreePatternNode *dst,
                  const std::vector<Record*> &dstregs,
-                 unsigned complexity):
-    Predicates(preds), SrcPattern(src), DstPattern(dst), Dstregs(dstregs),
-    AddedComplexity(complexity) {}
+                 unsigned complexity, unsigned uid)
+    : Predicates(preds), SrcPattern(src), DstPattern(dst),
+      Dstregs(dstregs), AddedComplexity(complexity), ID(uid) {}
 
   ListInit        *Predicates;  // Top level predicate conditions to match.
   TreePatternNode *SrcPattern;  // Source pattern to match.
   TreePatternNode *DstPattern;  // Resulting pattern.
   std::vector<Record*> Dstregs; // Physical register defs being matched.
   unsigned         AddedComplexity; // Add to matching pattern complexity.
+  unsigned         ID;          // Unique ID for the record.
 
   ListInit        *getPredicates() const { return Predicates; }
   TreePatternNode *getSrcPattern() const { return SrcPattern; }
@@ -567,7 +581,7 @@ public:
     abort();
   }
   
-  const DAGDefaultOperand &getDefaultOperand(Record *R) {
+  const DAGDefaultOperand &getDefaultOperand(Record *R) const {
     assert(DefaultOperands.count(R) &&"Isn't an analyzed default operand!");
     return DefaultOperands.find(R)->second;
   }
@@ -617,6 +631,7 @@ private:
   void InferInstructionFlags();
   void GenerateVariants();
   
+  void AddPatternToMatch(const TreePattern *Pattern, const PatternToMatch &PTM);
   void FindPatternInputsAndOutputs(TreePattern *I, TreePatternNode *Pat,
                                    std::map<std::string,
                                    TreePatternNode*> &InstInputs,
diff --git a/libclamav/c++/llvm/utils/TableGen/CodeGenInstruction.cpp b/libclamav/c++/llvm/utils/TableGen/CodeGenInstruction.cpp
index d31502b..f5b52ec 100644
--- a/libclamav/c++/llvm/utils/TableGen/CodeGenInstruction.cpp
+++ b/libclamav/c++/llvm/utils/TableGen/CodeGenInstruction.cpp
@@ -117,7 +117,6 @@ CodeGenInstruction::CodeGenInstruction(Record *R, const std::string &AsmStr)
   hasCtrlDep   = R->getValueAsBit("hasCtrlDep");
   isNotDuplicable = R->getValueAsBit("isNotDuplicable");
   hasSideEffects = R->getValueAsBit("hasSideEffects");
-  mayHaveSideEffects = R->getValueAsBit("mayHaveSideEffects");
   neverHasSideEffects = R->getValueAsBit("neverHasSideEffects");
   isAsCheapAsAMove = R->getValueAsBit("isAsCheapAsAMove");
   hasExtraSrcRegAllocReq = R->getValueAsBit("hasExtraSrcRegAllocReq");
@@ -125,7 +124,7 @@ CodeGenInstruction::CodeGenInstruction(Record *R, const std::string &AsmStr)
   hasOptionalDef = false;
   isVariadic = false;
 
-  if (mayHaveSideEffects + neverHasSideEffects + hasSideEffects > 1)
+  if (neverHasSideEffects + hasSideEffects > 1)
     throw R->getName() + ": multiple conflicting side-effect flags set!";
 
   DagInit *DI;
diff --git a/libclamav/c++/llvm/utils/TableGen/CodeGenInstruction.h b/libclamav/c++/llvm/utils/TableGen/CodeGenInstruction.h
index 285da14..aae2cac 100644
--- a/libclamav/c++/llvm/utils/TableGen/CodeGenInstruction.h
+++ b/libclamav/c++/llvm/utils/TableGen/CodeGenInstruction.h
@@ -133,7 +133,6 @@ namespace llvm {
     bool isNotDuplicable;
     bool hasOptionalDef;
     bool hasSideEffects;
-    bool mayHaveSideEffects;
     bool neverHasSideEffects;
     bool isAsCheapAsAMove;
     bool hasExtraSrcRegAllocReq;
diff --git a/libclamav/c++/llvm/utils/TableGen/DAGISelEmitter.cpp b/libclamav/c++/llvm/utils/TableGen/DAGISelEmitter.cpp
index 0eb06bb..e0fa7c8 100644
--- a/libclamav/c++/llvm/utils/TableGen/DAGISelEmitter.cpp
+++ b/libclamav/c++/llvm/utils/TableGen/DAGISelEmitter.cpp
@@ -14,49 +14,13 @@
 #include "DAGISelEmitter.h"
 #include "DAGISelMatcher.h"
 #include "Record.h"
-#include "llvm/ADT/StringExtras.h"
-#include "llvm/Support/CommandLine.h"
 #include "llvm/Support/Debug.h"
-#include "llvm/Support/MathExtras.h"
-#include "llvm/Support/Debug.h"
-#include <algorithm>
-#include <deque>
-#include <iostream>
 using namespace llvm;
 
-static cl::opt<bool>
-GenDebug("gen-debug", cl::desc("Generate debug code"), cl::init(false));
-
 //===----------------------------------------------------------------------===//
 // DAGISelEmitter Helper methods
 //
 
-/// getNodeName - The top level Select_* functions have an "SDNode* N"
-/// argument. When expanding the pattern-matching code, the intermediate
-/// variables have type SDValue. This function provides a uniform way to
-/// reference the underlying "SDNode *" for both cases.
-static std::string getNodeName(const std::string &S) {
-  if (S == "N") return S;
-  return S + ".getNode()";
-}
-
-/// getNodeValue - Similar to getNodeName, except it provides a uniform
-/// way to access the SDValue for both cases.
-static std::string getValueName(const std::string &S) {
-  if (S == "N") return "SDValue(N, 0)";
-  return S;
-}
-
-/// NodeIsComplexPattern - return true if N is a leaf node and a subclass of
-/// ComplexPattern.
-static bool NodeIsComplexPattern(TreePatternNode *N) {
-  return (N->isLeaf() &&
-          dynamic_cast<DefInit*>(N->getLeafValue()) &&
-          static_cast<DefInit*>(N->getLeafValue())->getDef()->
-          isSubClassOf("ComplexPattern"));
-}
-
-
 /// getPatternSize - Return the 'size' of this pattern.  We want to match large
 /// patterns before small ones.  This is used to determine the size of a
 /// pattern.
@@ -96,7 +60,7 @@ static unsigned getPatternSize(TreePatternNode *P, CodeGenDAGPatterns &CGP) {
     else if (Child->isLeaf()) {
       if (dynamic_cast<IntInit*>(Child->getLeafValue())) 
         Size += 5;  // Matches a ConstantSDNode (+3) and a specific value (+2).
-      else if (NodeIsComplexPattern(Child))
+      else if (Child->getComplexPatternInfo(CGP))
         Size += getPatternSize(Child, CGP);
       else if (!Child->getPredicateFns().empty())
         ++Size;
@@ -142,106 +106,6 @@ static unsigned getResultPatternSize(TreePatternNode *P,
   return Cost;
 }
 
-// PatternSortingPredicate - return true if we prefer to match LHS before RHS.
-// In particular, we want to match maximal patterns first and lowest cost within
-// a particular complexity first.
-struct PatternSortingPredicate {
-  PatternSortingPredicate(CodeGenDAGPatterns &cgp) : CGP(cgp) {}
-  CodeGenDAGPatterns &CGP;
-
-  typedef std::pair<unsigned, std::string> CodeLine;
-  typedef std::vector<CodeLine> CodeList;
-  typedef std::vector<std::pair<const PatternToMatch*, CodeList> > PatternList;
-
-  bool operator()(const std::pair<const PatternToMatch*, CodeList> &LHSPair,
-                  const std::pair<const PatternToMatch*, CodeList> &RHSPair) {
-    const PatternToMatch *LHS = LHSPair.first;
-    const PatternToMatch *RHS = RHSPair.first;
-
-    unsigned LHSSize = getPatternSize(LHS->getSrcPattern(), CGP);
-    unsigned RHSSize = getPatternSize(RHS->getSrcPattern(), CGP);
-    LHSSize += LHS->getAddedComplexity();
-    RHSSize += RHS->getAddedComplexity();
-    if (LHSSize > RHSSize) return true;   // LHS -> bigger -> less cost
-    if (LHSSize < RHSSize) return false;
-    
-    // If the patterns have equal complexity, compare generated instruction cost
-    unsigned LHSCost = getResultPatternCost(LHS->getDstPattern(), CGP);
-    unsigned RHSCost = getResultPatternCost(RHS->getDstPattern(), CGP);
-    if (LHSCost < RHSCost) return true;
-    if (LHSCost > RHSCost) return false;
-
-    return getResultPatternSize(LHS->getDstPattern(), CGP) <
-      getResultPatternSize(RHS->getDstPattern(), CGP);
-  }
-};
-
-/// getRegisterValueType - Look up and return the ValueType of the specified
-/// register. If the register is a member of multiple register classes which
-/// have different associated types, return MVT::Other.
-static MVT::SimpleValueType getRegisterValueType(Record *R, const CodeGenTarget &T) {
-  bool FoundRC = false;
-  MVT::SimpleValueType VT = MVT::Other;
-  const std::vector<CodeGenRegisterClass> &RCs = T.getRegisterClasses();
-  std::vector<CodeGenRegisterClass>::const_iterator RC;
-  std::vector<Record*>::const_iterator Element;
-
-  for (RC = RCs.begin() ; RC != RCs.end() ; RC++) {
-    Element = find((*RC).Elements.begin(), (*RC).Elements.end(), R);
-    if (Element != (*RC).Elements.end()) {
-      if (!FoundRC) {
-        FoundRC = true;
-        VT = (*RC).getValueTypeNum(0);
-      } else {
-        // In multiple RC's
-        if (VT != (*RC).getValueTypeNum(0)) {
-          // Types of the RC's do not agree. Return MVT::Other. The
-          // target is responsible for handling this.
-          return MVT::Other;
-        }
-      }
-    }
-  }
-  return VT;
-}
-
-static std::string getOpcodeName(Record *Op, CodeGenDAGPatterns &CGP) {
-  return CGP.getSDNodeInfo(Op).getEnumName();
-}
-
-//===----------------------------------------------------------------------===//
-// Node Transformation emitter implementation.
-//
-void DAGISelEmitter::EmitNodeTransforms(raw_ostream &OS) {
-  // Walk the pattern fragments, adding them to a map, which sorts them by
-  // name.
-  typedef std::map<std::string, CodeGenDAGPatterns::NodeXForm> NXsByNameTy;
-  NXsByNameTy NXsByName;
-
-  for (CodeGenDAGPatterns::nx_iterator I = CGP.nx_begin(), E = CGP.nx_end();
-       I != E; ++I)
-    NXsByName.insert(std::make_pair(I->first->getName(), I->second));
-  
-  OS << "\n// Node transformations.\n";
-  
-  for (NXsByNameTy::iterator I = NXsByName.begin(), E = NXsByName.end();
-       I != E; ++I) {
-    Record *SDNode = I->second.first;
-    std::string Code = I->second.second;
-    
-    if (Code.empty()) continue;  // Empty code?  Skip it.
-    
-    std::string ClassName = CGP.getSDNodeInfo(SDNode).getSDClassName();
-    const char *C2 = ClassName == "SDNode" ? "N" : "inN";
-    
-    OS << "inline SDValue Transform_" << I->first << "(SDNode *" << C2
-       << ") {\n";
-    if (ClassName != "SDNode")
-      OS << "  " << ClassName << " *N = cast<" << ClassName << ">(inN);\n";
-    OS << Code << "\n}\n";
-  }
-}
-
 //===----------------------------------------------------------------------===//
 // Predicate emitter implementation.
 //
@@ -270,14 +134,14 @@ void DAGISelEmitter::EmitPredicateFunctions(raw_ostream &OS) {
     
     if (P->getOnlyTree()->isLeaf())
       OS << "inline bool Predicate_" << PatFragRecord->getName()
-      << "(SDNode *N) {\n";
+      << "(SDNode *N) const {\n";
     else {
       std::string ClassName =
         CGP.getSDNodeInfo(P->getOnlyTree()->getOperator()).getSDClassName();
       const char *C2 = ClassName == "SDNode" ? "N" : "inN";
       
       OS << "inline bool Predicate_" << PatFragRecord->getName()
-         << "(SDNode *" << C2 << ") {\n";
+         << "(SDNode *" << C2 << ") const {\n";
       if (ClassName != "SDNode")
         OS << "  " << ClassName << " *N = cast<" << ClassName << ">(inN);\n";
     }
@@ -287,1701 +151,41 @@ void DAGISelEmitter::EmitPredicateFunctions(raw_ostream &OS) {
   OS << "\n\n";
 }
 
-
-//===----------------------------------------------------------------------===//
-// PatternCodeEmitter implementation.
-//
-class PatternCodeEmitter {
-private:
+namespace {
+// PatternSortingPredicate - return true if we prefer to match LHS before RHS.
+// In particular, we want to match maximal patterns first and lowest cost within
+// a particular complexity first.
+struct PatternSortingPredicate {
+  PatternSortingPredicate(CodeGenDAGPatterns &cgp) : CGP(cgp) {}
   CodeGenDAGPatterns &CGP;
-
-  // Predicates.
-  std::string PredicateCheck;
-  // Pattern cost.
-  unsigned Cost;
-  // Instruction selector pattern.
-  TreePatternNode *Pattern;
-  // Matched instruction.
-  TreePatternNode *Instruction;
-  
-  // Node to name mapping
-  std::map<std::string, std::string> VariableMap;
-  // Node to operator mapping
-  std::map<std::string, Record*> OperatorMap;
-  // Name of the folded node which produces a flag.
-  std::pair<std::string, unsigned> FoldedFlag;
-  // Names of all the folded nodes which produce chains.
-  std::vector<std::pair<std::string, unsigned> > FoldedChains;
-  // Original input chain(s).
-  std::vector<std::pair<std::string, std::string> > OrigChains;
-  std::set<std::string> Duplicates;
-
-  /// LSI - Load/Store information.
-  /// Save loads/stores matched by a pattern, and generate a MemOperandSDNode
-  /// for each memory access. This facilitates the use of AliasAnalysis in
-  /// the backend.
-  std::vector<std::string> LSI;
-
-  /// GeneratedCode - This is the buffer that we emit code to.  The first int
-  /// indicates whether this is an exit predicate (something that should be
-  /// tested, and if true, the match fails) [when 1], or normal code to emit
-  /// [when 0], or initialization code to emit [when 2].
-  std::vector<std::pair<unsigned, std::string> > &GeneratedCode;
-  /// GeneratedDecl - This is the set of all SDValue declarations needed for
-  /// the set of patterns for each top-level opcode.
-  std::set<std::string> &GeneratedDecl;
-  /// TargetOpcodes - The target specific opcodes used by the resulting
-  /// instructions.
-  std::vector<std::string> &TargetOpcodes;
-  std::vector<std::string> &TargetVTs;
-  /// OutputIsVariadic - Records whether the instruction output pattern uses
-  /// variable_ops.  This requires that the Emit function be passed an
-  /// additional argument to indicate where the input varargs operands
-  /// begin.
-  bool &OutputIsVariadic;
-  /// NumInputRootOps - Records the number of operands the root node of the
-  /// input pattern has.  This information is used in the generated code to
-  /// pass to Emit functions when variable_ops processing is needed.
-  unsigned &NumInputRootOps;
-
-  std::string ChainName;
-  unsigned TmpNo;
-  unsigned OpcNo;
-  unsigned VTNo;
-  
-  void emitCheck(const std::string &S) {
-    if (!S.empty())
-      GeneratedCode.push_back(std::make_pair(1, S));
-  }
-  void emitCode(const std::string &S) {
-    if (!S.empty())
-      GeneratedCode.push_back(std::make_pair(0, S));
-  }
-  void emitInit(const std::string &S) {
-    if (!S.empty())
-      GeneratedCode.push_back(std::make_pair(2, S));
-  }
-  void emitDecl(const std::string &S) {
-    assert(!S.empty() && "Invalid declaration");
-    GeneratedDecl.insert(S);
-  }
-  void emitOpcode(const std::string &Opc) {
-    TargetOpcodes.push_back(Opc);
-    OpcNo++;
-  }
-  void emitVT(const std::string &VT) {
-    TargetVTs.push_back(VT);
-    VTNo++;
-  }
-public:
-  PatternCodeEmitter(CodeGenDAGPatterns &cgp, std::string predcheck,
-                     TreePatternNode *pattern, TreePatternNode *instr,
-                     std::vector<std::pair<unsigned, std::string> > &gc,
-                     std::set<std::string> &gd,
-                     std::vector<std::string> &to,
-                     std::vector<std::string> &tv,
-                     bool &oiv,
-                     unsigned &niro)
-  : CGP(cgp), PredicateCheck(predcheck), Pattern(pattern), Instruction(instr),
-    GeneratedCode(gc), GeneratedDecl(gd),
-    TargetOpcodes(to), TargetVTs(tv),
-    OutputIsVariadic(oiv), NumInputRootOps(niro),
-    TmpNo(0), OpcNo(0), VTNo(0) {}
-
-  /// EmitMatchCode - Emit a matcher for N, going to the label for PatternNo
-  /// if the match fails. At this point, we already know that the opcode for N
-  /// matches, and the SDNode for the result has the RootName specified name.
-  void EmitMatchCode(TreePatternNode *N, TreePatternNode *P,
-                     const std::string &RootName, const std::string &ChainSuffix,
-                     bool &FoundChain);
-
-  void EmitChildMatchCode(TreePatternNode *Child, TreePatternNode *Parent,
-                          const std::string &RootName, 
-                          const std::string &ChainSuffix, bool &FoundChain);
-
-  /// EmitResultCode - Emit the action for a pattern.  Now that it has matched
-  /// we actually have to build a DAG!
-  std::vector<std::string>
-  EmitResultCode(TreePatternNode *N, std::vector<Record*> DstRegs,
-                 bool InFlagDecled, bool ResNodeDecled,
-                 bool LikeLeaf = false, bool isRoot = false);
-
-  /// InsertOneTypeCheck - Insert a type-check for an unresolved type in 'Pat'
-  /// and add it to the tree. 'Pat' and 'Other' are isomorphic trees except that 
-  /// 'Pat' may be missing types.  If we find an unresolved type to add a check
-  /// for, this returns true otherwise false if Pat has all types.
-  bool InsertOneTypeCheck(TreePatternNode *Pat, TreePatternNode *Other,
-                          const std::string &Prefix, bool isRoot = false) {
-    // Did we find one?
-    if (Pat->getExtTypes() != Other->getExtTypes()) {
-      // Move a type over from 'other' to 'pat'.
-      Pat->setTypes(Other->getExtTypes());
-      // The top level node type is checked outside of the select function.
-      if (!isRoot)
-        emitCheck(Prefix + ".getValueType() == " +
-                  getName(Pat->getTypeNum(0)));
-      return true;
-    }
-  
-    unsigned OpNo = (unsigned)Pat->NodeHasProperty(SDNPHasChain, CGP);
-    for (unsigned i = 0, e = Pat->getNumChildren(); i != e; ++i, ++OpNo)
-      if (InsertOneTypeCheck(Pat->getChild(i), Other->getChild(i),
-                             Prefix + utostr(OpNo)))
-        return true;
-    return false;
-  }
-
-private:
-  /// EmitInFlagSelectCode - Emit the flag operands for the DAG that is
-  /// being built.
-  void EmitInFlagSelectCode(TreePatternNode *N, const std::string &RootName,
-                            bool &ChainEmitted, bool &InFlagDecled,
-                            bool &ResNodeDecled, bool isRoot = false) {
-    const CodeGenTarget &T = CGP.getTargetInfo();
-    unsigned OpNo = (unsigned)N->NodeHasProperty(SDNPHasChain, CGP);
-    bool HasInFlag = N->NodeHasProperty(SDNPInFlag, CGP);
-    for (unsigned i = 0, e = N->getNumChildren(); i != e; ++i, ++OpNo) {
-      TreePatternNode *Child = N->getChild(i);
-      if (!Child->isLeaf()) {
-        EmitInFlagSelectCode(Child, RootName + utostr(OpNo), ChainEmitted,
-                             InFlagDecled, ResNodeDecled);
-      } else {
-        if (DefInit *DI = dynamic_cast<DefInit*>(Child->getLeafValue())) {
-          if (!Child->getName().empty()) {
-            std::string Name = RootName + utostr(OpNo);
-            if (Duplicates.find(Name) != Duplicates.end())
-              // A duplicate! Do not emit a copy for this node.
-              continue;
-          }
-
-          Record *RR = DI->getDef();
-          if (RR->isSubClassOf("Register")) {
-            MVT::SimpleValueType RVT = getRegisterValueType(RR, T);
-            if (RVT == MVT::Flag) {
-              if (!InFlagDecled) {
-                emitCode("SDValue InFlag = " +
-                         getValueName(RootName + utostr(OpNo)) + ";");
-                InFlagDecled = true;
-              } else
-                emitCode("InFlag = " +
-                         getValueName(RootName + utostr(OpNo)) + ";");
-            } else {
-              if (!ChainEmitted) {
-                emitCode("SDValue Chain = CurDAG->getEntryNode();");
-                ChainName = "Chain";
-                ChainEmitted = true;
-              }
-              if (!InFlagDecled) {
-                emitCode("SDValue InFlag(0, 0);");
-                InFlagDecled = true;
-              }
-              std::string Decl = (!ResNodeDecled) ? "SDNode *" : "";
-              emitCode(Decl + "ResNode = CurDAG->getCopyToReg(" + ChainName +
-                       ", " + getNodeName(RootName) + "->getDebugLoc()" +
-                       ", " + getQualifiedName(RR) +
-                       ", " +  getValueName(RootName + utostr(OpNo)) +
-                       ", InFlag).getNode();");
-              ResNodeDecled = true;
-              emitCode(ChainName + " = SDValue(ResNode, 0);");
-              emitCode("InFlag = SDValue(ResNode, 1);");
-            }
-          }
-        }
-      }
-    }
-
-    if (HasInFlag) {
-      if (!InFlagDecled) {
-        emitCode("SDValue InFlag = " + getNodeName(RootName) +
-               "->getOperand(" + utostr(OpNo) + ");");
-        InFlagDecled = true;
-      } else
-        emitCode("InFlag = " + getNodeName(RootName) +
-               "->getOperand(" + utostr(OpNo) + ");");
-    }
-  }
-};
-
-
-/// EmitMatchCode - Emit a matcher for N, going to the label for PatternNo
-/// if the match fails. At this point, we already know that the opcode for N
-/// matches, and the SDNode for the result has the RootName specified name.
-void PatternCodeEmitter::EmitMatchCode(TreePatternNode *N, TreePatternNode *P,
-                                       const std::string &RootName,
-                                       const std::string &ChainSuffix,
-                                       bool &FoundChain) {
-  
-  // Save loads/stores matched by a pattern.
-  if (!N->isLeaf() && N->getName().empty()) {
-    if (N->NodeHasProperty(SDNPMemOperand, CGP))
-      LSI.push_back(getNodeName(RootName));
-  }
-  
-  bool isRoot = (P == NULL);
-  // Emit instruction predicates. Each predicate is just a string for now.
-  if (isRoot) {
-    // Record input varargs info.
-    NumInputRootOps = N->getNumChildren();
-    emitCheck(PredicateCheck);
-  }
-  
-  if (N->isLeaf()) {
-    if (IntInit *II = dynamic_cast<IntInit*>(N->getLeafValue())) {
-      emitCheck("cast<ConstantSDNode>(" + getNodeName(RootName) +
-                ")->getSExtValue() == INT64_C(" +
-                itostr(II->getValue()) + ")");
-      return;
-    } else if (!NodeIsComplexPattern(N)) {
-      assert(0 && "Cannot match this as a leaf value!");
-      abort();
-    }
-  }
-  
-  // If this node has a name associated with it, capture it in VariableMap. If
-  // we already saw this in the pattern, emit code to verify dagness.
-  if (!N->getName().empty()) {
-    std::string &VarMapEntry = VariableMap[N->getName()];
-    if (VarMapEntry.empty()) {
-      VarMapEntry = RootName;
-    } else {
-      // If we get here, this is a second reference to a specific name.  Since
-      // we already have checked that the first reference is valid, we don't
-      // have to recursively match it, just check that it's the same as the
-      // previously named thing.
-      emitCheck(VarMapEntry + " == " + RootName);
-      return;
-    }
-    
-    if (!N->isLeaf())
-      OperatorMap[N->getName()] = N->getOperator();
-  }
-  
-  
-  // Emit code to load the child nodes and match their contents recursively.
-  unsigned OpNo = 0;
-  bool NodeHasChain = N->NodeHasProperty(SDNPHasChain, CGP);
-  bool HasChain     = N->TreeHasProperty(SDNPHasChain, CGP);
-  bool EmittedUseCheck = false;
-  if (HasChain) {
-    if (NodeHasChain)
-      OpNo = 1;
-    if (!isRoot) {
-      // Multiple uses of actual result?
-      emitCheck(getValueName(RootName) + ".hasOneUse()");
-      EmittedUseCheck = true;
-      if (NodeHasChain) {
-        // If the immediate use can somehow reach this node through another
-        // path, then can't fold it either or it will create a cycle.
-        // e.g. In the following diagram, XX can reach ld through YY. If
-        // ld is folded into XX, then YY is both a predecessor and a successor
-        // of XX.
-        //
-        //         [ld]
-        //         ^  ^
-        //         |  |
-        //        /   \---
-        //      /        [YY]
-        //      |         ^
-        //     [XX]-------|
-        bool NeedCheck = P != Pattern;
-        if (!NeedCheck) {
-          const SDNodeInfo &PInfo = CGP.getSDNodeInfo(P->getOperator());
-          NeedCheck =
-          P->getOperator() == CGP.get_intrinsic_void_sdnode() ||
-          P->getOperator() == CGP.get_intrinsic_w_chain_sdnode() ||
-          P->getOperator() == CGP.get_intrinsic_wo_chain_sdnode() ||
-          PInfo.getNumOperands() > 1 ||
-          PInfo.hasProperty(SDNPHasChain) ||
-          PInfo.hasProperty(SDNPInFlag) ||
-          PInfo.hasProperty(SDNPOptInFlag);
-        }
-        
-        if (NeedCheck) {
-          std::string ParentName(RootName.begin(), RootName.end()-1);
-          emitCheck("IsLegalAndProfitableToFold(" + getNodeName(RootName) +
-                    ", " + getNodeName(ParentName) + ", N)");
-        }
-      }
-    }
-    
-    if (NodeHasChain) {
-      if (FoundChain) {
-        emitCheck("(" + ChainName + ".getNode() == " +
-                  getNodeName(RootName) + " || "
-                  "IsChainCompatible(" + ChainName + ".getNode(), " +
-                  getNodeName(RootName) + "))");
-        OrigChains.push_back(std::make_pair(ChainName,
-                                            getValueName(RootName)));
-      } else
-        FoundChain = true;
-      ChainName = "Chain" + ChainSuffix;
-      emitInit("SDValue " + ChainName + " = " + getNodeName(RootName) +
-               "->getOperand(0);");
-    }
-  }
-  
-  // Don't fold any node which reads or writes a flag and has multiple uses.
-  // FIXME: We really need to separate the concepts of flag and "glue". Those
-  // real flag results, e.g. X86CMP output, can have multiple uses.
-  // FIXME: If the optional incoming flag does not exist. Then it is ok to
-  // fold it.
-  if (!isRoot &&
-      (N->TreeHasProperty(SDNPInFlag, CGP) ||
-       N->TreeHasProperty(SDNPOptInFlag, CGP) ||
-       N->TreeHasProperty(SDNPOutFlag, CGP))) {
-        if (!EmittedUseCheck) {
-          // Multiple uses of actual result?
-          emitCheck(getValueName(RootName) + ".hasOneUse()");
-        }
-      }
-  
-  // If there are node predicates for this, emit the calls.
-  for (unsigned i = 0, e = N->getPredicateFns().size(); i != e; ++i)
-    emitCheck(N->getPredicateFns()[i] + "(" + getNodeName(RootName) + ")");
-  
-  // If this is an 'and R, 1234' where the operation is AND/OR and the RHS is
-  // a constant without a predicate fn that has more that one bit set, handle
-  // this as a special case.  This is usually for targets that have special
-  // handling of certain large constants (e.g. alpha with it's 8/16/32-bit
-  // handling stuff).  Using these instructions is often far more efficient
-  // than materializing the constant.  Unfortunately, both the instcombiner
-  // and the dag combiner can often infer that bits are dead, and thus drop
-  // them from the mask in the dag.  For example, it might turn 'AND X, 255'
-  // into 'AND X, 254' if it knows the low bit is set.  Emit code that checks
-  // to handle this.
-  if (!N->isLeaf() && 
-      (N->getOperator()->getName() == "and" || 
-       N->getOperator()->getName() == "or") &&
-      N->getChild(1)->isLeaf() &&
-      N->getChild(1)->getPredicateFns().empty()) {
-    if (IntInit *II = dynamic_cast<IntInit*>(N->getChild(1)->getLeafValue())) {
-      if (!isPowerOf2_32(II->getValue())) {  // Don't bother with single bits.
-        emitInit("SDValue " + RootName + "0" + " = " +
-                 getNodeName(RootName) + "->getOperand(" + utostr(0) + ");");
-        emitInit("SDValue " + RootName + "1" + " = " +
-                 getNodeName(RootName) + "->getOperand(" + utostr(1) + ");");
-        
-        unsigned NTmp = TmpNo++;
-        emitCode("ConstantSDNode *Tmp" + utostr(NTmp) +
-                 " = dyn_cast<ConstantSDNode>(" +
-                 getNodeName(RootName + "1") + ");");
-        emitCheck("Tmp" + utostr(NTmp));
-        const char *MaskPredicate = N->getOperator()->getName() == "or"
-        ? "CheckOrMask(" : "CheckAndMask(";
-        emitCheck(MaskPredicate + getValueName(RootName + "0") +
-                  ", Tmp" + utostr(NTmp) +
-                  ", INT64_C(" + itostr(II->getValue()) + "))");
-        
-        EmitChildMatchCode(N->getChild(0), N, RootName + utostr(0),
-                           ChainSuffix + utostr(0), FoundChain);
-        return;
-      }
-    }
-  }
-  
-  for (unsigned i = 0, e = N->getNumChildren(); i != e; ++i, ++OpNo) {
-    emitInit("SDValue " + getValueName(RootName + utostr(OpNo)) + " = " +
-             getNodeName(RootName) + "->getOperand(" + utostr(OpNo) + ");");
-    
-    EmitChildMatchCode(N->getChild(i), N, RootName + utostr(OpNo),
-                       ChainSuffix + utostr(OpNo), FoundChain);
-  }
-  
-  // Handle cases when root is a complex pattern.
-  const ComplexPattern *CP;
-  if (isRoot && N->isLeaf() && (CP = N->getComplexPatternInfo(CGP))) {
-    std::string Fn = CP->getSelectFunc();
-    unsigned NumOps = CP->getNumOperands();
-    for (unsigned i = 0; i < NumOps; ++i) {
-      emitDecl("CPTmp" + RootName + "_" + utostr(i));
-      emitCode("SDValue CPTmp" + RootName + "_" + utostr(i) + ";");
-    }
-    if (CP->hasProperty(SDNPHasChain)) {
-      emitDecl("CPInChain");
-      emitDecl("Chain" + ChainSuffix);
-      emitCode("SDValue CPInChain;");
-      emitCode("SDValue Chain" + ChainSuffix + ";");
-    }
-    
-    std::string Code = Fn + "(" +
-    getNodeName(RootName) + ", " +
-    getValueName(RootName);
-    for (unsigned i = 0; i < NumOps; i++)
-      Code += ", CPTmp" + RootName + "_" + utostr(i);
-    if (CP->hasProperty(SDNPHasChain)) {
-      ChainName = "Chain" + ChainSuffix;
-      Code += ", CPInChain, Chain" + ChainSuffix;
-    }
-    emitCheck(Code + ")");
-  }
-}
-
-void PatternCodeEmitter::EmitChildMatchCode(TreePatternNode *Child,
-                                            TreePatternNode *Parent,
-                                            const std::string &RootName, 
-                                            const std::string &ChainSuffix,
-                                            bool &FoundChain) {
-  if (!Child->isLeaf()) {
-    // If it's not a leaf, recursively match.
-    const SDNodeInfo &CInfo = CGP.getSDNodeInfo(Child->getOperator());
-    emitCheck(getNodeName(RootName) + "->getOpcode() == " +
-              CInfo.getEnumName());
-    EmitMatchCode(Child, Parent, RootName, ChainSuffix, FoundChain);
-    bool HasChain = false;
-    if (Child->NodeHasProperty(SDNPHasChain, CGP)) {
-      HasChain = true;
-      FoldedChains.push_back(std::make_pair(getValueName(RootName),
-                                            CInfo.getNumResults()));
-    }
-    if (Child->NodeHasProperty(SDNPOutFlag, CGP)) {
-      assert(FoldedFlag.first == "" && FoldedFlag.second == 0 &&
-             "Pattern folded multiple nodes which produce flags?");
-      FoldedFlag = std::make_pair(getValueName(RootName),
-                                  CInfo.getNumResults() + (unsigned)HasChain);
-    }
-  } else {
-    // If this child has a name associated with it, capture it in VarMap. If
-    // we already saw this in the pattern, emit code to verify dagness.
-    if (!Child->getName().empty()) {
-      std::string &VarMapEntry = VariableMap[Child->getName()];
-      if (VarMapEntry.empty()) {
-        VarMapEntry = getValueName(RootName);
-      } else {
-        // If we get here, this is a second reference to a specific name.
-        // Since we already have checked that the first reference is valid,
-        // we don't have to recursively match it, just check that it's the
-        // same as the previously named thing.
-        emitCheck(VarMapEntry + " == " + getValueName(RootName));
-        Duplicates.insert(getValueName(RootName));
-        return;
-      }
-    }
-    
-    // Handle leaves of various types.
-    if (DefInit *DI = dynamic_cast<DefInit*>(Child->getLeafValue())) {
-      Record *LeafRec = DI->getDef();
-      if (LeafRec->isSubClassOf("RegisterClass") || 
-          LeafRec->isSubClassOf("PointerLikeRegClass")) {
-        // Handle register references.  Nothing to do here.
-      } else if (LeafRec->isSubClassOf("Register")) {
-        // Handle register references.
-      } else if (LeafRec->isSubClassOf("ComplexPattern")) {
-        // Handle complex pattern.
-        const ComplexPattern *CP = Child->getComplexPatternInfo(CGP);
-        std::string Fn = CP->getSelectFunc();
-        unsigned NumOps = CP->getNumOperands();
-        for (unsigned i = 0; i < NumOps; ++i) {
-          emitDecl("CPTmp" + RootName + "_" + utostr(i));
-          emitCode("SDValue CPTmp" + RootName + "_" + utostr(i) + ";");
-        }
-        if (CP->hasProperty(SDNPHasChain)) {
-          const SDNodeInfo &PInfo = CGP.getSDNodeInfo(Parent->getOperator());
-          FoldedChains.push_back(std::make_pair("CPInChain",
-                                                PInfo.getNumResults()));
-          ChainName = "Chain" + ChainSuffix;
-          emitDecl("CPInChain");
-          emitDecl(ChainName);
-          emitCode("SDValue CPInChain;");
-          emitCode("SDValue " + ChainName + ";");
-        }
-        
-        std::string Code = Fn + "(N, ";
-        if (CP->hasProperty(SDNPHasChain)) {
-          std::string ParentName(RootName.begin(), RootName.end()-1);
-          Code += getValueName(ParentName) + ", ";
-        }
-        Code += getValueName(RootName);
-        for (unsigned i = 0; i < NumOps; i++)
-          Code += ", CPTmp" + RootName + "_" + utostr(i);
-        if (CP->hasProperty(SDNPHasChain))
-          Code += ", CPInChain, Chain" + ChainSuffix;
-        emitCheck(Code + ")");
-      } else if (LeafRec->getName() == "srcvalue") {
-        // Place holder for SRCVALUE nodes. Nothing to do here.
-      } else if (LeafRec->isSubClassOf("ValueType")) {
-        // Make sure this is the specified value type.
-        emitCheck("cast<VTSDNode>(" + getNodeName(RootName) +
-                  ")->getVT() == MVT::" + LeafRec->getName());
-      } else if (LeafRec->isSubClassOf("CondCode")) {
-        // Make sure this is the specified cond code.
-        emitCheck("cast<CondCodeSDNode>(" + getNodeName(RootName) +
-                  ")->get() == ISD::" + LeafRec->getName());
-      } else {
-#ifndef NDEBUG
-        Child->dump();
-        errs() << " ";
-#endif
-        assert(0 && "Unknown leaf type!");
-      }
-      
-      // If there are node predicates for this, emit the calls.
-      for (unsigned i = 0, e = Child->getPredicateFns().size(); i != e; ++i)
-        emitCheck(Child->getPredicateFns()[i] + "(" + getNodeName(RootName) +
-                  ")");
-    } else if (IntInit *II =
-               dynamic_cast<IntInit*>(Child->getLeafValue())) {
-      unsigned NTmp = TmpNo++;
-      emitCode("ConstantSDNode *Tmp"+ utostr(NTmp) +
-               " = dyn_cast<ConstantSDNode>("+
-               getNodeName(RootName) + ");");
-      emitCheck("Tmp" + utostr(NTmp));
-      unsigned CTmp = TmpNo++;
-      emitCode("int64_t CN"+ utostr(CTmp) +
-               " = Tmp" + utostr(NTmp) + "->getSExtValue();");
-      emitCheck("CN" + utostr(CTmp) + " == "
-                "INT64_C(" +itostr(II->getValue()) + ")");
-    } else {
-#ifndef NDEBUG
-      Child->dump();
-#endif
-      assert(0 && "Unknown leaf type!");
-    }
-  }
-}
-
-/// EmitResultCode - Emit the action for a pattern.  Now that it has matched
-/// we actually have to build a DAG!
-std::vector<std::string>
-PatternCodeEmitter::EmitResultCode(TreePatternNode *N, 
-                                   std::vector<Record*> DstRegs,
-                                   bool InFlagDecled, bool ResNodeDecled,
-                                   bool LikeLeaf, bool isRoot) {
-  // List of arguments of getMachineNode() or SelectNodeTo().
-  std::vector<std::string> NodeOps;
-  // This is something selected from the pattern we matched.
-  if (!N->getName().empty()) {
-    const std::string &VarName = N->getName();
-    std::string Val = VariableMap[VarName];
-    bool ModifiedVal = false;
-    if (Val.empty()) {
-      errs() << "Variable '" << VarName << " referenced but not defined "
-      << "and not caught earlier!\n";
-      abort();
-    }
-    if (Val[0] == 'T' && Val[1] == 'm' && Val[2] == 'p') {
-      // Already selected this operand, just return the tmpval.
-      NodeOps.push_back(getValueName(Val));
-      return NodeOps;
-    }
-    
-    const ComplexPattern *CP;
-    unsigned ResNo = TmpNo++;
-    if (!N->isLeaf() && N->getOperator()->getName() == "imm") {
-      assert(N->getExtTypes().size() == 1 && "Multiple types not handled!");
-      std::string CastType;
-      std::string TmpVar =  "Tmp" + utostr(ResNo);
-      switch (N->getTypeNum(0)) {
-        default:
-          errs() << "Cannot handle " << getEnumName(N->getTypeNum(0))
-          << " type as an immediate constant. Aborting\n";
-          abort();
-        case MVT::i1:  CastType = "bool"; break;
-        case MVT::i8:  CastType = "unsigned char"; break;
-        case MVT::i16: CastType = "unsigned short"; break;
-        case MVT::i32: CastType = "unsigned"; break;
-        case MVT::i64: CastType = "uint64_t"; break;
-      }
-      emitCode("SDValue " + TmpVar + 
-               " = CurDAG->getTargetConstant(((" + CastType +
-               ") cast<ConstantSDNode>(" + Val + ")->getZExtValue()), " +
-               getEnumName(N->getTypeNum(0)) + ");");
-      // Add Tmp<ResNo> to VariableMap, so that we don't multiply select this
-      // value if used multiple times by this pattern result.
-      Val = TmpVar;
-      ModifiedVal = true;
-      NodeOps.push_back(getValueName(Val));
-    } else if (!N->isLeaf() && N->getOperator()->getName() == "fpimm") {
-      assert(N->getExtTypes().size() == 1 && "Multiple types not handled!");
-      std::string TmpVar =  "Tmp" + utostr(ResNo);
-      emitCode("SDValue " + TmpVar + 
-               " = CurDAG->getTargetConstantFP(*cast<ConstantFPSDNode>(" + 
-               Val + ")->getConstantFPValue(), cast<ConstantFPSDNode>(" +
-               Val + ")->getValueType(0));");
-      // Add Tmp<ResNo> to VariableMap, so that we don't multiply select this
-      // value if used multiple times by this pattern result.
-      Val = TmpVar;
-      ModifiedVal = true;
-      NodeOps.push_back(getValueName(Val));
-    } else if (!N->isLeaf() && N->getOperator()->getName() == "texternalsym"){
-      Record *Op = OperatorMap[N->getName()];
-      // Transform ExternalSymbol to TargetExternalSymbol
-      if (Op && Op->getName() == "externalsym") {
-        std::string TmpVar = "Tmp"+utostr(ResNo);
-        emitCode("SDValue " + TmpVar + " = CurDAG->getTarget"
-                 "ExternalSymbol(cast<ExternalSymbolSDNode>(" +
-                 Val + ")->getSymbol(), " +
-                 getEnumName(N->getTypeNum(0)) + ");");
-        // Add Tmp<ResNo> to VariableMap, so that we don't multiply select
-        // this value if used multiple times by this pattern result.
-        Val = TmpVar;
-        ModifiedVal = true;
-      }
-      NodeOps.push_back(getValueName(Val));
-    } else if (!N->isLeaf() && (N->getOperator()->getName() == "tglobaladdr"
-                                || N->getOperator()->getName() == "tglobaltlsaddr")) {
-      Record *Op = OperatorMap[N->getName()];
-      // Transform GlobalAddress to TargetGlobalAddress
-      if (Op && (Op->getName() == "globaladdr" ||
-                 Op->getName() == "globaltlsaddr")) {
-        std::string TmpVar = "Tmp" + utostr(ResNo);
-        emitCode("SDValue " + TmpVar + " = CurDAG->getTarget"
-                 "GlobalAddress(cast<GlobalAddressSDNode>(" + Val +
-                 ")->getGlobal(), " + getEnumName(N->getTypeNum(0)) +
-                 ");");
-        // Add Tmp<ResNo> to VariableMap, so that we don't multiply select
-        // this value if used multiple times by this pattern result.
-        Val = TmpVar;
-        ModifiedVal = true;
-      }
-      NodeOps.push_back(getValueName(Val));
-    } else if (!N->isLeaf()
-               && (N->getOperator()->getName() == "texternalsym" ||
-                   N->getOperator()->getName() == "tconstpool")) {
-      // Do not rewrite the variable name, since we don't generate a new
-      // temporary.
-      NodeOps.push_back(getValueName(Val));
-    } else if (N->isLeaf() && (CP = N->getComplexPatternInfo(CGP))) {
-      for (unsigned i = 0; i < CP->getNumOperands(); ++i) {
-        NodeOps.push_back(getValueName("CPTmp" + Val + "_" + utostr(i)));
-      }
-    } else {
-      // This node, probably wrapped in a SDNodeXForm, behaves like a leaf
-      // node even if it isn't one. Don't select it.
-      if (!LikeLeaf) {
-        if (isRoot && N->isLeaf()) {
-          emitCode("ReplaceUses(SDValue(N, 0), " + Val + ");");
-          emitCode("return NULL;");
-        }
-      }
-      NodeOps.push_back(getValueName(Val));
-    }
-    
-    if (ModifiedVal)
-      VariableMap[VarName] = Val;
-    return NodeOps;
-  }
-  if (N->isLeaf()) {
-    // If this is an explicit register reference, handle it.
-    if (DefInit *DI = dynamic_cast<DefInit*>(N->getLeafValue())) {
-      unsigned ResNo = TmpNo++;
-      if (DI->getDef()->isSubClassOf("Register")) {
-        emitCode("SDValue Tmp" + utostr(ResNo) + " = CurDAG->getRegister(" +
-                 getQualifiedName(DI->getDef()) + ", " +
-                 getEnumName(N->getTypeNum(0)) + ");");
-        NodeOps.push_back(getValueName("Tmp" + utostr(ResNo)));
-        return NodeOps;
-      } else if (DI->getDef()->getName() == "zero_reg") {
-        emitCode("SDValue Tmp" + utostr(ResNo) +
-                 " = CurDAG->getRegister(0, " +
-                 getEnumName(N->getTypeNum(0)) + ");");
-        NodeOps.push_back(getValueName("Tmp" + utostr(ResNo)));
-        return NodeOps;
-      } else if (DI->getDef()->isSubClassOf("RegisterClass")) {
-        // Handle a reference to a register class. This is used
-        // in COPY_TO_SUBREG instructions.
-        emitCode("SDValue Tmp" + utostr(ResNo) +
-                 " = CurDAG->getTargetConstant(" +
-                 getQualifiedName(DI->getDef()) + "RegClassID, " +
-                 "MVT::i32);");
-        NodeOps.push_back(getValueName("Tmp" + utostr(ResNo)));
-        return NodeOps;
-      }
-    } else if (IntInit *II = dynamic_cast<IntInit*>(N->getLeafValue())) {
-      unsigned ResNo = TmpNo++;
-      assert(N->getExtTypes().size() == 1 && "Multiple types not handled!");
-      emitCode("SDValue Tmp" + utostr(ResNo) + 
-               " = CurDAG->getTargetConstant(0x" + 
-               utohexstr((uint64_t) II->getValue()) +
-               "ULL, " + getEnumName(N->getTypeNum(0)) + ");");
-      NodeOps.push_back(getValueName("Tmp" + utostr(ResNo)));
-      return NodeOps;
-    }
-    
-#ifndef NDEBUG
-    N->dump();
-#endif
-    assert(0 && "Unknown leaf type!");
-    return NodeOps;
-  }
-  
-  Record *Op = N->getOperator();
-  if (Op->isSubClassOf("Instruction")) {
-    const CodeGenTarget &CGT = CGP.getTargetInfo();
-    CodeGenInstruction &II = CGT.getInstruction(Op->getName());
-    const DAGInstruction &Inst = CGP.getInstruction(Op);
-    const TreePattern *InstPat = Inst.getPattern();
-    // FIXME: Assume actual pattern comes before "implicit".
-    TreePatternNode *InstPatNode =
-    isRoot ? (InstPat ? InstPat->getTree(0) : Pattern)
-    : (InstPat ? InstPat->getTree(0) : NULL);
-    if (InstPatNode && !InstPatNode->isLeaf() &&
-        InstPatNode->getOperator()->getName() == "set") {
-      InstPatNode = InstPatNode->getChild(InstPatNode->getNumChildren()-1);
-    }
-    bool IsVariadic = isRoot && II.isVariadic;
-    // FIXME: fix how we deal with physical register operands.
-    bool HasImpInputs  = isRoot && Inst.getNumImpOperands() > 0;
-    bool HasImpResults = isRoot && DstRegs.size() > 0;
-    bool NodeHasOptInFlag = isRoot &&
-      Pattern->TreeHasProperty(SDNPOptInFlag, CGP);
-    bool NodeHasInFlag  = isRoot &&
-      Pattern->TreeHasProperty(SDNPInFlag, CGP);
-    bool NodeHasOutFlag = isRoot &&
-      Pattern->TreeHasProperty(SDNPOutFlag, CGP);
-    bool NodeHasChain = InstPatNode &&
-      InstPatNode->TreeHasProperty(SDNPHasChain, CGP);
-    bool InputHasChain = isRoot && Pattern->NodeHasProperty(SDNPHasChain, CGP);
-    unsigned NumResults = Inst.getNumResults();    
-    unsigned NumDstRegs = HasImpResults ? DstRegs.size() : 0;
-    
-    // Record output varargs info.
-    OutputIsVariadic = IsVariadic;
-    
-    if (NodeHasOptInFlag) {
-      emitCode("bool HasInFlag = "
-               "(N->getOperand(N->getNumOperands()-1).getValueType() == "
-               "MVT::Flag);");
-    }
-    if (IsVariadic)
-      emitCode("SmallVector<SDValue, 8> Ops" + utostr(OpcNo) + ";");
-    
-    // How many results is this pattern expected to produce?
-    unsigned NumPatResults = 0;
-    for (unsigned i = 0, e = Pattern->getExtTypes().size(); i != e; i++) {
-      MVT::SimpleValueType VT = Pattern->getTypeNum(i);
-      if (VT != MVT::isVoid && VT != MVT::Flag)
-        NumPatResults++;
-    }
-    
-    if (OrigChains.size() > 0) {
-      // The original input chain is being ignored. If it is not just
-      // pointing to the op that's being folded, we should create a
-      // TokenFactor with it and the chain of the folded op as the new chain.
-      // We could potentially be doing multiple levels of folding, in that
-      // case, the TokenFactor can have more operands.
-      emitCode("SmallVector<SDValue, 8> InChains;");
-      for (unsigned i = 0, e = OrigChains.size(); i < e; ++i) {
-        emitCode("if (" + OrigChains[i].first + ".getNode() != " +
-                 OrigChains[i].second + ".getNode()) {");
-        emitCode("  InChains.push_back(" + OrigChains[i].first + ");");
-        emitCode("}");
-      }
-      emitCode("InChains.push_back(" + ChainName + ");");
-      emitCode(ChainName + " = CurDAG->getNode(ISD::TokenFactor, "
-               "N->getDebugLoc(), MVT::Other, "
-               "&InChains[0], InChains.size());");
-      if (GenDebug) {
-        emitCode("CurDAG->setSubgraphColor(" + ChainName +".getNode(), \"yellow\");");
-        emitCode("CurDAG->setSubgraphColor(" + ChainName +".getNode(), \"black\");");
-      }
-    }
-    
-    // Loop over all of the operands of the instruction pattern, emitting code
-    // to fill them all in.  The node 'N' usually has number children equal to
-    // the number of input operands of the instruction.  However, in cases
-    // where there are predicate operands for an instruction, we need to fill
-    // in the 'execute always' values.  Match up the node operands to the
-    // instruction operands to do this.
-    std::vector<std::string> AllOps;
-    for (unsigned ChildNo = 0, InstOpNo = NumResults;
-         InstOpNo != II.OperandList.size(); ++InstOpNo) {
-      std::vector<std::string> Ops;
-      
-      // Determine what to emit for this operand.
-      Record *OperandNode = II.OperandList[InstOpNo].Rec;
-      if ((OperandNode->isSubClassOf("PredicateOperand") ||
-           OperandNode->isSubClassOf("OptionalDefOperand")) &&
-          !CGP.getDefaultOperand(OperandNode).DefaultOps.empty()) {
-        // This is a predicate or optional def operand; emit the
-        // 'default ops' operands.
-        const DAGDefaultOperand &DefaultOp =
-        CGP.getDefaultOperand(II.OperandList[InstOpNo].Rec);
-        for (unsigned i = 0, e = DefaultOp.DefaultOps.size(); i != e; ++i) {
-          Ops = EmitResultCode(DefaultOp.DefaultOps[i], DstRegs,
-                               InFlagDecled, ResNodeDecled);
-          AllOps.insert(AllOps.end(), Ops.begin(), Ops.end());
-        }
-      } else {
-        // Otherwise this is a normal operand or a predicate operand without
-        // 'execute always'; emit it.
-        Ops = EmitResultCode(N->getChild(ChildNo), DstRegs,
-                             InFlagDecled, ResNodeDecled);
-        AllOps.insert(AllOps.end(), Ops.begin(), Ops.end());
-        ++ChildNo;
-      }
-    }
-    
-    // Emit all the chain and CopyToReg stuff.
-    bool ChainEmitted = NodeHasChain;
-    if (NodeHasInFlag || HasImpInputs)
-      EmitInFlagSelectCode(Pattern, "N", ChainEmitted,
-                           InFlagDecled, ResNodeDecled, true);
-    if (NodeHasOptInFlag || NodeHasInFlag || HasImpInputs) {
-      if (!InFlagDecled) {
-        emitCode("SDValue InFlag(0, 0);");
-        InFlagDecled = true;
-      }
-      if (NodeHasOptInFlag) {
-        emitCode("if (HasInFlag) {");
-        emitCode("  InFlag = N->getOperand(N->getNumOperands()-1);");
-        emitCode("}");
-      }
-    }
-    
-    unsigned ResNo = TmpNo++;
-    
-    unsigned OpsNo = OpcNo;
-    std::string CodePrefix;
-    bool ChainAssignmentNeeded = NodeHasChain && !isRoot;
-    std::deque<std::string> After;
-    std::string NodeName;
-    if (!isRoot) {
-      NodeName = "Tmp" + utostr(ResNo);
-      CodePrefix = "SDValue " + NodeName + "(";
-    } else {
-      NodeName = "ResNode";
-      if (!ResNodeDecled) {
-        CodePrefix = "SDNode *" + NodeName + " = ";
-        ResNodeDecled = true;
-      } else
-        CodePrefix = NodeName + " = ";
-    }
-    
-    std::string Code = "Opc" + utostr(OpcNo);
-    
-    if (!isRoot || (InputHasChain && !NodeHasChain))
-      // For call to "getMachineNode()".
-      Code += ", N->getDebugLoc()";
-    
-    emitOpcode(II.Namespace + "::" + II.TheDef->getName());
-    
-    // Output order: results, chain, flags
-    // Result types.
-    if (NumResults > 0 && N->getTypeNum(0) != MVT::isVoid) {
-      Code += ", VT" + utostr(VTNo);
-      emitVT(getEnumName(N->getTypeNum(0)));
-    }
-    // Add types for implicit results in physical registers, scheduler will
-    // care of adding copyfromreg nodes.
-    for (unsigned i = 0; i < NumDstRegs; i++) {
-      Record *RR = DstRegs[i];
-      if (RR->isSubClassOf("Register")) {
-        MVT::SimpleValueType RVT = getRegisterValueType(RR, CGT);
-        Code += ", " + getEnumName(RVT);
-      }
-    }
-    if (NodeHasChain)
-      Code += ", MVT::Other";
-    if (NodeHasOutFlag)
-      Code += ", MVT::Flag";
-    
-    // Inputs.
-    if (IsVariadic) {
-      for (unsigned i = 0, e = AllOps.size(); i != e; ++i)
-        emitCode("Ops" + utostr(OpsNo) + ".push_back(" + AllOps[i] + ");");
-      AllOps.clear();
-      
-      // Figure out whether any operands at the end of the op list are not
-      // part of the variable section.
-      std::string EndAdjust;
-      if (NodeHasInFlag || HasImpInputs)
-        EndAdjust = "-1";  // Always has one flag.
-      else if (NodeHasOptInFlag)
-        EndAdjust = "-(HasInFlag?1:0)"; // May have a flag.
-      
-      emitCode("for (unsigned i = NumInputRootOps + " + utostr(NodeHasChain) +
-               ", e = N->getNumOperands()" + EndAdjust + "; i != e; ++i) {");
-      
-      emitCode("  Ops" + utostr(OpsNo) + ".push_back(N->getOperand(i));");
-      emitCode("}");
-    }
-    
-    // Populate MemRefs with entries for each memory accesses covered by 
-    // this pattern.
-    if (isRoot && !LSI.empty()) {
-      std::string MemRefs = "MemRefs" + utostr(OpsNo);
-      emitCode("MachineSDNode::mmo_iterator " + MemRefs + " = "
-               "MF->allocateMemRefsArray(" + utostr(LSI.size()) + ");");
-      for (unsigned i = 0, e = LSI.size(); i != e; ++i)
-        emitCode(MemRefs + "[" + utostr(i) + "] = "
-                 "cast<MemSDNode>(" + LSI[i] + ")->getMemOperand();");
-      After.push_back("cast<MachineSDNode>(ResNode)->setMemRefs(" +
-                      MemRefs + ", " + MemRefs + " + " + utostr(LSI.size()) +
-                      ");");
-    }
-    
-    if (NodeHasChain) {
-      if (IsVariadic)
-        emitCode("Ops" + utostr(OpsNo) + ".push_back(" + ChainName + ");");
-      else
-        AllOps.push_back(ChainName);
-    }
-    
-    if (IsVariadic) {
-      if (NodeHasInFlag || HasImpInputs)
-        emitCode("Ops" + utostr(OpsNo) + ".push_back(InFlag);");
-      else if (NodeHasOptInFlag) {
-        emitCode("if (HasInFlag)");
-        emitCode("  Ops" + utostr(OpsNo) + ".push_back(InFlag);");
-      }
-      Code += ", &Ops" + utostr(OpsNo) + "[0], Ops" + utostr(OpsNo) +
-      ".size()";
-    } else if (NodeHasInFlag || NodeHasOptInFlag || HasImpInputs)
-      AllOps.push_back("InFlag");
-    
-    unsigned NumOps = AllOps.size();
-    if (NumOps) {
-      if (!NodeHasOptInFlag && NumOps < 4) {
-        for (unsigned i = 0; i != NumOps; ++i)
-          Code += ", " + AllOps[i];
-      } else {
-        std::string OpsCode = "SDValue Ops" + utostr(OpsNo) + "[] = { ";
-        for (unsigned i = 0; i != NumOps; ++i) {
-          OpsCode += AllOps[i];
-          if (i != NumOps-1)
-            OpsCode += ", ";
-        }
-        emitCode(OpsCode + " };");
-        Code += ", Ops" + utostr(OpsNo) + ", ";
-        if (NodeHasOptInFlag) {
-          Code += "HasInFlag ? ";
-          Code += utostr(NumOps) + " : " + utostr(NumOps-1);
-        } else
-          Code += utostr(NumOps);
-      }
-    }
-    
-    if (!isRoot)
-      Code += "), 0";
-    
-    std::vector<std::string> ReplaceFroms;
-    std::vector<std::string> ReplaceTos;
-    if (!isRoot) {
-      NodeOps.push_back("Tmp" + utostr(ResNo));
-    } else {
-      
-      if (NodeHasOutFlag) {
-        if (!InFlagDecled) {
-          After.push_back("SDValue InFlag(ResNode, " + 
-                          utostr(NumResults+NumDstRegs+(unsigned)NodeHasChain) +
-                          ");");
-          InFlagDecled = true;
-        } else
-          After.push_back("InFlag = SDValue(ResNode, " + 
-                          utostr(NumResults+NumDstRegs+(unsigned)NodeHasChain) +
-                          ");");
-      }
-      
-      for (unsigned j = 0, e = FoldedChains.size(); j < e; j++) {
-        ReplaceFroms.push_back("SDValue(" +
-                               FoldedChains[j].first + ".getNode(), " +
-                               utostr(FoldedChains[j].second) +
-                               ")");
-        ReplaceTos.push_back("SDValue(ResNode, " +
-                             utostr(NumResults+NumDstRegs) + ")");
-      }
-      
-      if (NodeHasOutFlag) {
-        if (FoldedFlag.first != "") {
-          ReplaceFroms.push_back("SDValue(" + FoldedFlag.first + ".getNode(), " +
-                                 utostr(FoldedFlag.second) + ")");
-          ReplaceTos.push_back("InFlag");
-        } else {
-          assert(Pattern->NodeHasProperty(SDNPOutFlag, CGP));
-          ReplaceFroms.push_back("SDValue(N, " +
-                                 utostr(NumPatResults + (unsigned)InputHasChain)
-                                 + ")");
-          ReplaceTos.push_back("InFlag");
-        }
-      }
-      
-      if (!ReplaceFroms.empty() && InputHasChain) {
-        ReplaceFroms.push_back("SDValue(N, " +
-                               utostr(NumPatResults) + ")");
-        ReplaceTos.push_back("SDValue(" + ChainName + ".getNode(), " +
-                             ChainName + ".getResNo()" + ")");
-        ChainAssignmentNeeded |= NodeHasChain;
-      }
-      
-      // User does not expect the instruction would produce a chain!
-      if ((!InputHasChain && NodeHasChain) && NodeHasOutFlag) {
-        ;
-      } else if (InputHasChain && !NodeHasChain) {
-        // One of the inner node produces a chain.
-        assert(!NodeHasOutFlag && "Node has flag but not chain!");
-        ReplaceFroms.push_back("SDValue(N, " +
-                               utostr(NumPatResults) + ")");
-        ReplaceTos.push_back(ChainName);
-      }
-    }
-    
-    if (ChainAssignmentNeeded) {
-      // Remember which op produces the chain.
-      std::string ChainAssign;
-      if (!isRoot)
-        ChainAssign = ChainName + " = SDValue(" + NodeName +
-        ".getNode(), " + utostr(NumResults+NumDstRegs) + ");";
-      else
-        ChainAssign = ChainName + " = SDValue(" + NodeName +
-        ", " + utostr(NumResults+NumDstRegs) + ");";
-      
-      After.push_front(ChainAssign);
-    }
-    
-    if (ReplaceFroms.size() == 1) {
-      After.push_back("ReplaceUses(" + ReplaceFroms[0] + ", " +
-                      ReplaceTos[0] + ");");
-    } else if (!ReplaceFroms.empty()) {
-      After.push_back("const SDValue Froms[] = {");
-      for (unsigned i = 0, e = ReplaceFroms.size(); i != e; ++i)
-        After.push_back("  " + ReplaceFroms[i] + (i + 1 != e ? "," : ""));
-      After.push_back("};");
-      After.push_back("const SDValue Tos[] = {");
-      for (unsigned i = 0, e = ReplaceFroms.size(); i != e; ++i)
-        After.push_back("  " + ReplaceTos[i] + (i + 1 != e ? "," : ""));
-      After.push_back("};");
-      After.push_back("ReplaceUses(Froms, Tos, " +
-                      itostr(ReplaceFroms.size()) + ");");
-    }
-    
-    // We prefer to use SelectNodeTo since it avoids allocation when
-    // possible and it avoids CSE map recalculation for the node's
-    // users, however it's tricky to use in a non-root context.
-    //
-    // We also don't use SelectNodeTo if the pattern replacement is being
-    // used to jettison a chain result, since morphing the node in place
-    // would leave users of the chain dangling.
-    //
-    if (!isRoot || (InputHasChain && !NodeHasChain)) {
-      Code = "CurDAG->getMachineNode(" + Code;
-    } else {
-      Code = "CurDAG->SelectNodeTo(N, " + Code;
-    }
-    if (isRoot) {
-      if (After.empty())
-        CodePrefix = "return ";
-      else
-        After.push_back("return ResNode;");
-    }
-    
-    emitCode(CodePrefix + Code + ");");
-    
-    if (GenDebug) {
-      if (!isRoot) {
-        emitCode("CurDAG->setSubgraphColor(" +
-                 NodeName +".getNode(), \"yellow\");");
-        emitCode("CurDAG->setSubgraphColor(" +
-                 NodeName +".getNode(), \"black\");");
-      } else {
-        emitCode("CurDAG->setSubgraphColor(" + NodeName +", \"yellow\");");
-        emitCode("CurDAG->setSubgraphColor(" + NodeName +", \"black\");");
-      }
-    }
-    
-    for (unsigned i = 0, e = After.size(); i != e; ++i)
-      emitCode(After[i]);
-    
-    return NodeOps;
-  }
-  if (Op->isSubClassOf("SDNodeXForm")) {
-    assert(N->getNumChildren() == 1 && "node xform should have one child!");
-    // PatLeaf node - the operand may or may not be a leaf node. But it should
-    // behave like one.
-    std::vector<std::string> Ops =
-    EmitResultCode(N->getChild(0), DstRegs, InFlagDecled,
-                   ResNodeDecled, true);
-    unsigned ResNo = TmpNo++;
-    emitCode("SDValue Tmp" + utostr(ResNo) + " = Transform_" + Op->getName()
-             + "(" + Ops.back() + ".getNode());");
-    NodeOps.push_back("Tmp" + utostr(ResNo));
-    if (isRoot)
-      emitCode("return Tmp" + utostr(ResNo) + ".getNode();");
-    return NodeOps;
-  }
-  
-  N->dump();
-  errs() << "\n";
-  throw std::string("Unknown node in result pattern!");
-}
-
-
-/// EmitCodeForPattern - Given a pattern to match, emit code to the specified
-/// stream to match the pattern, and generate the code for the match if it
-/// succeeds.  Returns true if the pattern is not guaranteed to match.
-void DAGISelEmitter::GenerateCodeForPattern(const PatternToMatch &Pattern,
-                  std::vector<std::pair<unsigned, std::string> > &GeneratedCode,
-                                           std::set<std::string> &GeneratedDecl,
-                                        std::vector<std::string> &TargetOpcodes,
-                                            std::vector<std::string> &TargetVTs,
-                                            bool &OutputIsVariadic,
-                                            unsigned &NumInputRootOps) {
-  OutputIsVariadic = false;
-  NumInputRootOps = 0;
-
-  PatternCodeEmitter Emitter(CGP, Pattern.getPredicateCheck(),
-                             Pattern.getSrcPattern(), Pattern.getDstPattern(),
-                             GeneratedCode, GeneratedDecl,
-                             TargetOpcodes, TargetVTs,
-                             OutputIsVariadic, NumInputRootOps);
-
-  // Emit the matcher, capturing named arguments in VariableMap.
-  bool FoundChain = false;
-  Emitter.EmitMatchCode(Pattern.getSrcPattern(), NULL, "N", "", FoundChain);
-
-  // TP - Get *SOME* tree pattern, we don't care which.  It is only used for
-  // diagnostics, which we know are impossible at this point.
-  TreePattern &TP = *CGP.pf_begin()->second;
-  
-  // At this point, we know that we structurally match the pattern, but the
-  // types of the nodes may not match.  Figure out the fewest number of type 
-  // comparisons we need to emit.  For example, if there is only one integer
-  // type supported by a target, there should be no type comparisons at all for
-  // integer patterns!
-  //
-  // To figure out the fewest number of type checks needed, clone the pattern,
-  // remove the types, then perform type inference on the pattern as a whole.
-  // If there are unresolved types, emit an explicit check for those types,
-  // apply the type to the tree, then rerun type inference.  Iterate until all
-  // types are resolved.
-  //
-  TreePatternNode *Pat = Pattern.getSrcPattern()->clone();
-  Pat->RemoveAllTypes();
   
-  do {
-    // Resolve/propagate as many types as possible.
-    try {
-      bool MadeChange = true;
-      while (MadeChange)
-        MadeChange = Pat->ApplyTypeConstraints(TP,
-                                               true/*Ignore reg constraints*/);
-    } catch (...) {
-      assert(0 && "Error: could not find consistent types for something we"
-             " already decided was ok!");
-      abort();
-    }
-
-    // Insert a check for an unresolved type and add it to the tree.  If we find
-    // an unresolved type to add a check for, this returns true and we iterate,
-    // otherwise we are done.
-  } while (Emitter.InsertOneTypeCheck(Pat, Pattern.getSrcPattern(), "N", true));
-
-  Emitter.EmitResultCode(Pattern.getDstPattern(), Pattern.getDstRegs(),
-                         false, false, false, true);
-  delete Pat;
-}
-
-/// EraseCodeLine - Erase one code line from all of the patterns.  If removing
-/// a line causes any of them to be empty, remove them and return true when
-/// done.
-static bool EraseCodeLine(std::vector<std::pair<const PatternToMatch*, 
-                          std::vector<std::pair<unsigned, std::string> > > >
-                          &Patterns) {
-  bool ErasedPatterns = false;
-  for (unsigned i = 0, e = Patterns.size(); i != e; ++i) {
-    Patterns[i].second.pop_back();
-    if (Patterns[i].second.empty()) {
-      Patterns.erase(Patterns.begin()+i);
-      --i; --e;
-      ErasedPatterns = true;
-    }
-  }
-  return ErasedPatterns;
-}
-
-/// EmitPatterns - Emit code for at least one pattern, but try to group common
-/// code together between the patterns.
-void DAGISelEmitter::EmitPatterns(std::vector<std::pair<const PatternToMatch*, 
-                              std::vector<std::pair<unsigned, std::string> > > >
-                                  &Patterns, unsigned Indent,
-                                  raw_ostream &OS) {
-  typedef std::pair<unsigned, std::string> CodeLine;
-  typedef std::vector<CodeLine> CodeList;
-  typedef std::vector<std::pair<const PatternToMatch*, CodeList> > PatternList;
-  
-  if (Patterns.empty()) return;
-  
-  // Figure out how many patterns share the next code line.  Explicitly copy
-  // FirstCodeLine so that we don't invalidate a reference when changing
-  // Patterns.
-  const CodeLine FirstCodeLine = Patterns.back().second.back();
-  unsigned LastMatch = Patterns.size()-1;
-  while (LastMatch != 0 && Patterns[LastMatch-1].second.back() == FirstCodeLine)
-    --LastMatch;
-  
-  // If not all patterns share this line, split the list into two pieces.  The
-  // first chunk will use this line, the second chunk won't.
-  if (LastMatch != 0) {
-    PatternList Shared(Patterns.begin()+LastMatch, Patterns.end());
-    PatternList Other(Patterns.begin(), Patterns.begin()+LastMatch);
-    
-    // FIXME: Emit braces?
-    if (Shared.size() == 1) {
-      const PatternToMatch &Pattern = *Shared.back().first;
-      OS << "\n" << std::string(Indent, ' ') << "// Pattern: ";
-      Pattern.getSrcPattern()->print(OS);
-      OS << "\n" << std::string(Indent, ' ') << "// Emits: ";
-      Pattern.getDstPattern()->print(OS);
-      OS << "\n";
-      unsigned AddedComplexity = Pattern.getAddedComplexity();
-      OS << std::string(Indent, ' ') << "// Pattern complexity = "
-         << getPatternSize(Pattern.getSrcPattern(), CGP) + AddedComplexity
-         << "  cost = "
-         << getResultPatternCost(Pattern.getDstPattern(), CGP)
-         << "  size = "
-         << getResultPatternSize(Pattern.getDstPattern(), CGP) << "\n";
-    }
-    if (FirstCodeLine.first != 1) {
-      OS << std::string(Indent, ' ') << "{\n";
-      Indent += 2;
-    }
-    EmitPatterns(Shared, Indent, OS);
-    if (FirstCodeLine.first != 1) {
-      Indent -= 2;
-      OS << std::string(Indent, ' ') << "}\n";
-    }
+  bool operator()(const PatternToMatch *LHS,
+                  const PatternToMatch *RHS) {
+    unsigned LHSSize = getPatternSize(LHS->getSrcPattern(), CGP);
+    unsigned RHSSize = getPatternSize(RHS->getSrcPattern(), CGP);
+    LHSSize += LHS->getAddedComplexity();
+    RHSSize += RHS->getAddedComplexity();
+    if (LHSSize > RHSSize) return true;   // LHS -> bigger -> less cost
+    if (LHSSize < RHSSize) return false;
     
-    if (Other.size() == 1) {
-      const PatternToMatch &Pattern = *Other.back().first;
-      OS << "\n" << std::string(Indent, ' ') << "// Pattern: ";
-      Pattern.getSrcPattern()->print(OS);
-      OS << "\n" << std::string(Indent, ' ') << "// Emits: ";
-      Pattern.getDstPattern()->print(OS);
-      OS << "\n";
-      unsigned AddedComplexity = Pattern.getAddedComplexity();
-      OS << std::string(Indent, ' ') << "// Pattern complexity = "
-         << getPatternSize(Pattern.getSrcPattern(), CGP) + AddedComplexity
-         << "  cost = "
-         << getResultPatternCost(Pattern.getDstPattern(), CGP)
-         << "  size = "
-         << getResultPatternSize(Pattern.getDstPattern(), CGP) << "\n";
-    }
-    EmitPatterns(Other, Indent, OS);
-    return;
-  }
-  
-  // Remove this code from all of the patterns that share it.
-  bool ErasedPatterns = EraseCodeLine(Patterns);
-  
-  bool isPredicate = FirstCodeLine.first == 1;
-  
-  // Otherwise, every pattern in the list has this line.  Emit it.
-  if (!isPredicate) {
-    // Normal code.
-    OS << std::string(Indent, ' ') << FirstCodeLine.second << "\n";
-  } else {
-    OS << std::string(Indent, ' ') << "if (" << FirstCodeLine.second;
+    // If the patterns have equal complexity, compare generated instruction cost
+    unsigned LHSCost = getResultPatternCost(LHS->getDstPattern(), CGP);
+    unsigned RHSCost = getResultPatternCost(RHS->getDstPattern(), CGP);
+    if (LHSCost < RHSCost) return true;
+    if (LHSCost > RHSCost) return false;
     
-    // If the next code line is another predicate, and if all of the pattern
-    // in this group share the same next line, emit it inline now.  Do this
-    // until we run out of common predicates.
-    while (!ErasedPatterns && Patterns.back().second.back().first == 1) {
-      // Check that all of the patterns in Patterns end with the same predicate.
-      bool AllEndWithSamePredicate = true;
-      for (unsigned i = 0, e = Patterns.size(); i != e; ++i)
-        if (Patterns[i].second.back() != Patterns.back().second.back()) {
-          AllEndWithSamePredicate = false;
-          break;
-        }
-      // If all of the predicates aren't the same, we can't share them.
-      if (!AllEndWithSamePredicate) break;
-      
-      // Otherwise we can.  Emit it shared now.
-      OS << " &&\n" << std::string(Indent+4, ' ')
-         << Patterns.back().second.back().second;
-      ErasedPatterns = EraseCodeLine(Patterns);
-    }
+    unsigned LHSPatSize = getResultPatternSize(LHS->getDstPattern(), CGP);
+    unsigned RHSPatSize = getResultPatternSize(RHS->getDstPattern(), CGP);
+    if (LHSPatSize < RHSPatSize) return true;
+    if (LHSPatSize > RHSPatSize) return false;
     
-    OS << ") {\n";
-    Indent += 2;
+    // Sort based on the UID of the pattern, giving us a deterministic ordering.
+    assert(LHS == RHS || LHS->ID != RHS->ID);
+    return LHS->ID < RHS->ID;
   }
-  
-  EmitPatterns(Patterns, Indent, OS);
-  
-  if (isPredicate)
-    OS << std::string(Indent-2, ' ') << "}\n";
-}
-
-static std::string getLegalCName(std::string OpName) {
-  std::string::size_type pos = OpName.find("::");
-  if (pos != std::string::npos)
-    OpName.replace(pos, 2, "_");
-  return OpName;
+};
 }
 
-void DAGISelEmitter::EmitInstructionSelector(raw_ostream &OS) {
-  const CodeGenTarget &Target = CGP.getTargetInfo();
-
-  // Get the namespace to insert instructions into.
-  std::string InstNS = Target.getInstNamespace();
-  if (!InstNS.empty()) InstNS += "::";
-  
-  // Group the patterns by their top-level opcodes.
-  std::map<std::string, std::vector<const PatternToMatch*> > PatternsByOpcode;
-  // All unique target node emission functions.
-  std::map<std::string, unsigned> EmitFunctions;
-  for (CodeGenDAGPatterns::ptm_iterator I = CGP.ptm_begin(),
-       E = CGP.ptm_end(); I != E; ++I) {
-    const PatternToMatch &Pattern = *I;
-    TreePatternNode *Node = Pattern.getSrcPattern();
-    if (!Node->isLeaf()) {
-      PatternsByOpcode[getOpcodeName(Node->getOperator(), CGP)].
-        push_back(&Pattern);
-    } else {
-      const ComplexPattern *CP;
-      if (dynamic_cast<IntInit*>(Node->getLeafValue())) {
-        PatternsByOpcode[getOpcodeName(CGP.getSDNodeNamed("imm"), CGP)].
-          push_back(&Pattern);
-      } else if ((CP = Node->getComplexPatternInfo(CGP))) {
-        std::vector<Record*> OpNodes = CP->getRootNodes();
-        for (unsigned j = 0, e = OpNodes.size(); j != e; j++) {
-          PatternsByOpcode[getOpcodeName(OpNodes[j], CGP)]
-            .insert(PatternsByOpcode[getOpcodeName(OpNodes[j], CGP)].begin(),
-                    &Pattern);
-        }
-      } else {
-        errs() << "Unrecognized opcode '";
-        Node->dump();
-        errs() << "' on tree pattern '";
-        errs() << Pattern.getDstPattern()->getOperator()->getName() << "'!\n";
-        exit(1);
-      }
-    }
-  }
-
-  // For each opcode, there might be multiple select functions, one per
-  // ValueType of the node (or its first operand if it doesn't produce a
-  // non-chain result.
-  std::map<std::string, std::vector<std::string> > OpcodeVTMap;
-
-  // Emit one Select_* method for each top-level opcode.  We do this instead of
-  // emitting one giant switch statement to support compilers where this will
-  // result in the recursive functions taking less stack space.
-  for (std::map<std::string, std::vector<const PatternToMatch*> >::iterator
-         PBOI = PatternsByOpcode.begin(), E = PatternsByOpcode.end();
-       PBOI != E; ++PBOI) {
-    const std::string &OpName = PBOI->first;
-    std::vector<const PatternToMatch*> &PatternsOfOp = PBOI->second;
-    assert(!PatternsOfOp.empty() && "No patterns but map has entry?");
-
-    // Split them into groups by type.
-    std::map<MVT::SimpleValueType,
-             std::vector<const PatternToMatch*> > PatternsByType;
-    for (unsigned i = 0, e = PatternsOfOp.size(); i != e; ++i) {
-      const PatternToMatch *Pat = PatternsOfOp[i];
-      TreePatternNode *SrcPat = Pat->getSrcPattern();
-      PatternsByType[SrcPat->getTypeNum(0)].push_back(Pat);
-    }
-
-    for (std::map<MVT::SimpleValueType,
-                  std::vector<const PatternToMatch*> >::iterator
-           II = PatternsByType.begin(), EE = PatternsByType.end(); II != EE;
-         ++II) {
-      MVT::SimpleValueType OpVT = II->first;
-      std::vector<const PatternToMatch*> &Patterns = II->second;
-      typedef std::pair<unsigned, std::string> CodeLine;
-      typedef std::vector<CodeLine> CodeList;
-      typedef CodeList::iterator CodeListI;
-    
-      std::vector<std::pair<const PatternToMatch*, CodeList> > CodeForPatterns;
-      std::vector<std::vector<std::string> > PatternOpcodes;
-      std::vector<std::vector<std::string> > PatternVTs;
-      std::vector<std::set<std::string> > PatternDecls;
-      std::vector<bool> OutputIsVariadicFlags;
-      std::vector<unsigned> NumInputRootOpsCounts;
-      for (unsigned i = 0, e = Patterns.size(); i != e; ++i) {
-        CodeList GeneratedCode;
-        std::set<std::string> GeneratedDecl;
-        std::vector<std::string> TargetOpcodes;
-        std::vector<std::string> TargetVTs;
-        bool OutputIsVariadic;
-        unsigned NumInputRootOps;
-        GenerateCodeForPattern(*Patterns[i], GeneratedCode, GeneratedDecl,
-                               TargetOpcodes, TargetVTs,
-                               OutputIsVariadic, NumInputRootOps);
-        CodeForPatterns.push_back(std::make_pair(Patterns[i], GeneratedCode));
-        PatternDecls.push_back(GeneratedDecl);
-        PatternOpcodes.push_back(TargetOpcodes);
-        PatternVTs.push_back(TargetVTs);
-        OutputIsVariadicFlags.push_back(OutputIsVariadic);
-        NumInputRootOpsCounts.push_back(NumInputRootOps);
-      }
-    
-      // Factor target node emission code (emitted by EmitResultCode) into
-      // separate functions. Uniquing and share them among all instruction
-      // selection routines.
-      for (unsigned i = 0, e = CodeForPatterns.size(); i != e; ++i) {
-        CodeList &GeneratedCode = CodeForPatterns[i].second;
-        std::vector<std::string> &TargetOpcodes = PatternOpcodes[i];
-        std::vector<std::string> &TargetVTs = PatternVTs[i];
-        std::set<std::string> Decls = PatternDecls[i];
-        bool OutputIsVariadic = OutputIsVariadicFlags[i];
-        unsigned NumInputRootOps = NumInputRootOpsCounts[i];
-        std::vector<std::string> AddedInits;
-        int CodeSize = (int)GeneratedCode.size();
-        int LastPred = -1;
-        for (int j = CodeSize-1; j >= 0; --j) {
-          if (LastPred == -1 && GeneratedCode[j].first == 1)
-            LastPred = j;
-          else if (LastPred != -1 && GeneratedCode[j].first == 2)
-            AddedInits.push_back(GeneratedCode[j].second);
-        }
-
-        std::string CalleeCode = "(SDNode *N";
-        std::string CallerCode = "(N";
-        for (unsigned j = 0, e = TargetOpcodes.size(); j != e; ++j) {
-          CalleeCode += ", unsigned Opc" + utostr(j);
-          CallerCode += ", " + TargetOpcodes[j];
-        }
-        for (unsigned j = 0, e = TargetVTs.size(); j != e; ++j) {
-          CalleeCode += ", MVT::SimpleValueType VT" + utostr(j);
-          CallerCode += ", " + TargetVTs[j];
-        }
-        for (std::set<std::string>::iterator
-               I = Decls.begin(), E = Decls.end(); I != E; ++I) {
-          std::string Name = *I;
-          CalleeCode += ", SDValue &" + Name;
-          CallerCode += ", " + Name;
-        }
-
-        if (OutputIsVariadic) {
-          CalleeCode += ", unsigned NumInputRootOps";
-          CallerCode += ", " + utostr(NumInputRootOps);
-        }
-
-        CallerCode += ");";
-        CalleeCode += ") {\n";
-
-        for (std::vector<std::string>::const_reverse_iterator
-               I = AddedInits.rbegin(), E = AddedInits.rend(); I != E; ++I)
-          CalleeCode += "  " + *I + "\n";
-
-        for (int j = LastPred+1; j < CodeSize; ++j)
-          CalleeCode += "  " + GeneratedCode[j].second + "\n";
-        for (int j = LastPred+1; j < CodeSize; ++j)
-          GeneratedCode.pop_back();
-        CalleeCode += "}\n";
-
-        // Uniquing the emission routines.
-        unsigned EmitFuncNum;
-        std::map<std::string, unsigned>::iterator EFI =
-          EmitFunctions.find(CalleeCode);
-        if (EFI != EmitFunctions.end()) {
-          EmitFuncNum = EFI->second;
-        } else {
-          EmitFuncNum = EmitFunctions.size();
-          EmitFunctions.insert(std::make_pair(CalleeCode, EmitFuncNum));
-          // Prevent emission routines from being inlined to reduce selection
-          // routines stack frame sizes.
-          OS << "DISABLE_INLINE ";
-          OS << "SDNode *Emit_" << utostr(EmitFuncNum) << CalleeCode;
-        }
-
-        // Replace the emission code within selection routines with calls to the
-        // emission functions.
-        if (GenDebug)
-          GeneratedCode.push_back(std::make_pair(0, "CurDAG->setSubgraphColor(N, \"red\");"));
-        CallerCode = "SDNode *Result = Emit_" + utostr(EmitFuncNum) + CallerCode;
-        GeneratedCode.push_back(std::make_pair(3, CallerCode));
-        if (GenDebug) {
-          GeneratedCode.push_back(std::make_pair(0, "if(Result) {"));
-          GeneratedCode.push_back(std::make_pair(0, "  CurDAG->setSubgraphColor(Result, \"yellow\");"));
-          GeneratedCode.push_back(std::make_pair(0, "  CurDAG->setSubgraphColor(Result, \"black\");"));
-          GeneratedCode.push_back(std::make_pair(0, "}"));
-          //GeneratedCode.push_back(std::make_pair(0, "CurDAG->setSubgraphColor(N, \"black\");"));
-        }
-        GeneratedCode.push_back(std::make_pair(0, "return Result;"));
-      }
-
-      // Print function.
-      std::string OpVTStr;
-      if (OpVT == MVT::iPTR) {
-        OpVTStr = "_iPTR";
-      } else if (OpVT == MVT::iPTRAny) {
-        OpVTStr = "_iPTRAny";
-      } else if (OpVT == MVT::isVoid) {
-        // Nodes with a void result actually have a first result type of either
-        // Other (a chain) or Flag.  Since there is no one-to-one mapping from
-        // void to this case, we handle it specially here.
-      } else {
-        OpVTStr = "_" + getEnumName(OpVT).substr(5);  // Skip 'MVT::'
-      }
-      std::map<std::string, std::vector<std::string> >::iterator OpVTI =
-        OpcodeVTMap.find(OpName);
-      if (OpVTI == OpcodeVTMap.end()) {
-        std::vector<std::string> VTSet;
-        VTSet.push_back(OpVTStr);
-        OpcodeVTMap.insert(std::make_pair(OpName, VTSet));
-      } else
-        OpVTI->second.push_back(OpVTStr);
-
-      // We want to emit all of the matching code now.  However, we want to emit
-      // the matches in order of minimal cost.  Sort the patterns so the least
-      // cost one is at the start.
-      std::stable_sort(CodeForPatterns.begin(), CodeForPatterns.end(),
-                       PatternSortingPredicate(CGP));
-
-      // Scan the code to see if all of the patterns are reachable and if it is
-      // possible that the last one might not match.
-      bool mightNotMatch = true;
-      for (unsigned i = 0, e = CodeForPatterns.size(); i != e; ++i) {
-        CodeList &GeneratedCode = CodeForPatterns[i].second;
-        mightNotMatch = false;
-
-        for (unsigned j = 0, e = GeneratedCode.size(); j != e; ++j) {
-          if (GeneratedCode[j].first == 1) { // predicate.
-            mightNotMatch = true;
-            break;
-          }
-        }
-      
-        // If this pattern definitely matches, and if it isn't the last one, the
-        // patterns after it CANNOT ever match.  Error out.
-        if (mightNotMatch == false && i != CodeForPatterns.size()-1) {
-          errs() << "Pattern '";
-          CodeForPatterns[i].first->getSrcPattern()->print(errs());
-          errs() << "' is impossible to select!\n";
-          exit(1);
-        }
-      }
-
-      // Loop through and reverse all of the CodeList vectors, as we will be
-      // accessing them from their logical front, but accessing the end of a
-      // vector is more efficient.
-      for (unsigned i = 0, e = CodeForPatterns.size(); i != e; ++i) {
-        CodeList &GeneratedCode = CodeForPatterns[i].second;
-        std::reverse(GeneratedCode.begin(), GeneratedCode.end());
-      }
-    
-      // Next, reverse the list of patterns itself for the same reason.
-      std::reverse(CodeForPatterns.begin(), CodeForPatterns.end());
-    
-      OS << "SDNode *Select_" << getLegalCName(OpName)
-         << OpVTStr << "(SDNode *N) {\n";
-
-      // Emit all of the patterns now, grouped together to share code.
-      EmitPatterns(CodeForPatterns, 2, OS);
-    
-      // If the last pattern has predicates (which could fail) emit code to
-      // catch the case where nothing handles a pattern.
-      if (mightNotMatch) {
-        OS << "\n";
-        if (OpName != "ISD::INTRINSIC_W_CHAIN" &&
-            OpName != "ISD::INTRINSIC_WO_CHAIN" &&
-            OpName != "ISD::INTRINSIC_VOID")
-          OS << "  CannotYetSelect(N);\n";
-        else
-          OS << "  CannotYetSelectIntrinsic(N);\n";
-
-        OS << "  return NULL;\n";
-      }
-      OS << "}\n\n";
-    }
-  }
-  
-  OS << "// The main instruction selector code.\n"
-     << "SDNode *SelectCode(SDNode *N) {\n"
-     << "  MVT::SimpleValueType NVT = N->getValueType(0).getSimpleVT().SimpleTy;\n"
-     << "  switch (N->getOpcode()) {\n"
-     << "  default:\n"
-     << "    assert(!N->isMachineOpcode() && \"Node already selected!\");\n"
-     << "    break;\n"
-     << "  case ISD::EntryToken:       // These nodes remain the same.\n"
-     << "  case ISD::BasicBlock:\n"
-     << "  case ISD::Register:\n"
-     << "  case ISD::HANDLENODE:\n"
-     << "  case ISD::TargetConstant:\n"
-     << "  case ISD::TargetConstantFP:\n"
-     << "  case ISD::TargetConstantPool:\n"
-     << "  case ISD::TargetFrameIndex:\n"
-     << "  case ISD::TargetExternalSymbol:\n"
-     << "  case ISD::TargetBlockAddress:\n"
-     << "  case ISD::TargetJumpTable:\n"
-     << "  case ISD::TargetGlobalTLSAddress:\n"
-     << "  case ISD::TargetGlobalAddress:\n"
-     << "  case ISD::TokenFactor:\n"
-     << "  case ISD::CopyFromReg:\n"
-     << "  case ISD::CopyToReg: {\n"
-     << "    return NULL;\n"
-     << "  }\n"
-     << "  case ISD::AssertSext:\n"
-     << "  case ISD::AssertZext: {\n"
-     << "    ReplaceUses(SDValue(N, 0), N->getOperand(0));\n"
-     << "    return NULL;\n"
-     << "  }\n"
-     << "  case ISD::INLINEASM: return Select_INLINEASM(N);\n"
-     << "  case ISD::EH_LABEL: return Select_EH_LABEL(N);\n"
-     << "  case ISD::UNDEF: return Select_UNDEF(N);\n";
-
-  // Loop over all of the case statements, emiting a call to each method we
-  // emitted above.
-  for (std::map<std::string, std::vector<const PatternToMatch*> >::iterator
-         PBOI = PatternsByOpcode.begin(), E = PatternsByOpcode.end();
-       PBOI != E; ++PBOI) {
-    const std::string &OpName = PBOI->first;
-    // Potentially multiple versions of select for this opcode. One for each
-    // ValueType of the node (or its first true operand if it doesn't produce a
-    // result.
-    std::map<std::string, std::vector<std::string> >::iterator OpVTI =
-      OpcodeVTMap.find(OpName);
-    std::vector<std::string> &OpVTs = OpVTI->second;
-    OS << "  case " << OpName << ": {\n";
-    // If we have only one variant and it's the default, elide the
-    // switch.  Marginally faster, and makes MSVC happier.
-    if (OpVTs.size()==1 && OpVTs[0].empty()) {
-      OS << "    return Select_" << getLegalCName(OpName) << "(N);\n";
-      OS << "    break;\n";
-      OS << "  }\n";
-      continue;
-    }
-    // Keep track of whether we see a pattern that has an iPtr result.
-    bool HasPtrPattern = false;
-    bool HasDefaultPattern = false;
-      
-    OS << "    switch (NVT) {\n";
-    for (unsigned i = 0, e = OpVTs.size(); i < e; ++i) {
-      std::string &VTStr = OpVTs[i];
-      if (VTStr.empty()) {
-        HasDefaultPattern = true;
-        continue;
-      }
-
-      // If this is a match on iPTR: don't emit it directly, we need special
-      // code.
-      if (VTStr == "_iPTR") {
-        HasPtrPattern = true;
-        continue;
-      }
-      OS << "    case MVT::" << VTStr.substr(1) << ":\n"
-         << "      return Select_" << getLegalCName(OpName)
-         << VTStr << "(N);\n";
-    }
-    OS << "    default:\n";
-      
-    // If there is an iPTR result version of this pattern, emit it here.
-    if (HasPtrPattern) {
-      OS << "      if (TLI.getPointerTy() == NVT)\n";
-      OS << "        return Select_" << getLegalCName(OpName) <<"_iPTR(N);\n";
-    }
-    if (HasDefaultPattern) {
-      OS << "      return Select_" << getLegalCName(OpName) << "(N);\n";
-    }
-    OS << "      break;\n";
-    OS << "    }\n";
-    OS << "    break;\n";
-    OS << "  }\n";
-  }
-
-  OS << "  } // end of big switch.\n\n"
-     << "  if (N->getOpcode() != ISD::INTRINSIC_W_CHAIN &&\n"
-     << "      N->getOpcode() != ISD::INTRINSIC_WO_CHAIN &&\n"
-     << "      N->getOpcode() != ISD::INTRINSIC_VOID) {\n"
-     << "    CannotYetSelect(N);\n"
-     << "  } else {\n"
-     << "    CannotYetSelectIntrinsic(N);\n"
-     << "  }\n"
-     << "  return NULL;\n"
-     << "}\n\n";
-}
 
 void DAGISelEmitter::run(raw_ostream &OS) {
   EmitSourceFileHeader("DAG Instruction Selector for the " +
@@ -1991,46 +195,45 @@ void DAGISelEmitter::run(raw_ostream &OS) {
      << "// *** instruction selector class.  These functions are really "
      << "methods.\n\n";
 
-  OS << "// Include standard, target-independent definitions and methods used\n"
-     << "// by the instruction selector.\n";
-  OS << "#include \"llvm/CodeGen/DAGISelHeader.h\"\n\n";
-  
-  EmitNodeTransforms(OS);
+  DEBUG(errs() << "\n\nALL PATTERNS TO MATCH:\n\n";
+        for (CodeGenDAGPatterns::ptm_iterator I = CGP.ptm_begin(),
+             E = CGP.ptm_end(); I != E; ++I) {
+          errs() << "PATTERN: ";   I->getSrcPattern()->dump();
+          errs() << "\nRESULT:  "; I->getDstPattern()->dump();
+          errs() << "\n";
+        });
+
+  // FIXME: These are being used by hand written code, gross.
   EmitPredicateFunctions(OS);
-  
-  DEBUG(errs() << "\n\nALL PATTERNS TO MATCH:\n\n");
+
+  // Add all the patterns to a temporary list so we can sort them.
+  std::vector<const PatternToMatch*> Patterns;
   for (CodeGenDAGPatterns::ptm_iterator I = CGP.ptm_begin(), E = CGP.ptm_end();
-       I != E; ++I) {
-    DEBUG(errs() << "PATTERN: ";   I->getSrcPattern()->dump());
-    DEBUG(errs() << "\nRESULT:  "; I->getDstPattern()->dump());
-    DEBUG(errs() << "\n");
-  }
+       I != E; ++I)
+    Patterns.push_back(&*I);
+
+  // We want to process the matches in order of minimal cost.  Sort the patterns
+  // so the least cost one is at the start.
+  std::stable_sort(Patterns.begin(), Patterns.end(),
+                   PatternSortingPredicate(CGP));
   
-  // At this point, we have full information about the 'Patterns' we need to
-  // parse, both implicitly from instructions as well as from explicit pattern
-  // definitions.  Emit the resultant instruction selector.
-  EmitInstructionSelector(OS);  
   
-#if 0
-  MatcherNode *Matcher = 0;
-  // Walk the patterns backwards, building a matcher for each and adding it to
-  // the matcher for the whole target.
-  for (CodeGenDAGPatterns::ptm_iterator I = CGP.ptm_begin(),
-       E = CGP.ptm_end(); I != E;) {
-    const PatternToMatch &Pattern = *--E;
-    MatcherNode *N = ConvertPatternToMatcher(Pattern, CGP);
-    
-    if (Matcher == 0)
-      Matcher = N;
-    else
-      Matcher = new PushMatcherNode(N, Matcher);
+  // Convert each variant of each pattern into a Matcher.
+  std::vector<Matcher*> PatternMatchers;
+  for (unsigned i = 0, e = Patterns.size(); i != e; ++i) {
+    for (unsigned Variant = 0; ; ++Variant) {
+      if (Matcher *M = ConvertPatternToMatcher(*Patterns[i], Variant, CGP))
+        PatternMatchers.push_back(M);
+      else
+        break;
+    }
   }
-  
-  
-  EmitMatcherTable(Matcher, OS);
-  
-  
+          
+  Matcher *TheMatcher = new ScopeMatcher(&PatternMatchers[0],
+                                         PatternMatchers.size());
+
+  TheMatcher = OptimizeMatcher(TheMatcher, CGP);
   //Matcher->dump();
-  delete Matcher;
-#endif
+  EmitMatcherTable(TheMatcher, CGP, OS);
+  delete TheMatcher;
 }
diff --git a/libclamav/c++/llvm/utils/TableGen/DAGISelEmitter.h b/libclamav/c++/llvm/utils/TableGen/DAGISelEmitter.h
index d5b889b..5ffdde8 100644
--- a/libclamav/c++/llvm/utils/TableGen/DAGISelEmitter.h
+++ b/libclamav/c++/llvm/utils/TableGen/DAGISelEmitter.h
@@ -31,24 +31,8 @@ public:
 
   // run - Output the isel, returning true on failure.
   void run(raw_ostream &OS);
-  
-  
 private:
-  void EmitNodeTransforms(raw_ostream &OS);
   void EmitPredicateFunctions(raw_ostream &OS);
-  
-  void GenerateCodeForPattern(const PatternToMatch &Pattern,
-                  std::vector<std::pair<unsigned, std::string> > &GeneratedCode,
-                              std::set<std::string> &GeneratedDecl,
-                              std::vector<std::string> &TargetOpcodes,
-                              std::vector<std::string> &TargetVTs,
-                              bool &OutputIsVariadic,
-                              unsigned &NumInputRootOps);
-  void EmitPatterns(std::vector<std::pair<const PatternToMatch*, 
-                  std::vector<std::pair<unsigned, std::string> > > > &Patterns, 
-                    unsigned Indent, raw_ostream &OS);
-  
-  void EmitInstructionSelector(raw_ostream &OS);
 };
 
 } // End llvm namespace
diff --git a/libclamav/c++/llvm/utils/TableGen/DAGISelMatcher.cpp b/libclamav/c++/llvm/utils/TableGen/DAGISelMatcher.cpp
index 1363aa3..c4f1cbf 100644
--- a/libclamav/c++/llvm/utils/TableGen/DAGISelMatcher.cpp
+++ b/libclamav/c++/llvm/utils/TableGen/DAGISelMatcher.cpp
@@ -10,99 +10,338 @@
 #include "DAGISelMatcher.h"
 #include "CodeGenDAGPatterns.h"
 #include "CodeGenTarget.h"
+#include "Record.h"
 #include "llvm/Support/raw_ostream.h"
+#include "llvm/ADT/StringExtras.h"
 using namespace llvm;
 
-void MatcherNode::dump() const {
-  print(errs());
+void Matcher::dump() const {
+  print(errs(), 0);
 }
 
-void EmitNodeMatcherNode::print(raw_ostream &OS, unsigned indent) const {
-  OS.indent(indent) << "EmitNode: Src = " << *Pattern.getSrcPattern() << "\n";
-  OS.indent(indent) << "EmitNode: Dst = " << *Pattern.getDstPattern() << "\n";
+void Matcher::print(raw_ostream &OS, unsigned indent) const {
+  printImpl(OS, indent);
+  if (Next)
+    return Next->print(OS, indent);
 }
 
-void MatcherNodeWithChild::printChild(raw_ostream &OS, unsigned indent) const {
-  if (Child)
-    return Child->print(OS, indent);
-  OS.indent(indent) << "<null child>\n";
+void Matcher::printOne(raw_ostream &OS) const {
+  printImpl(OS, 0);
 }
 
+ScopeMatcher::~ScopeMatcher() {
+  for (unsigned i = 0, e = Children.size(); i != e; ++i)
+    delete Children[i];
+}
+
+
+// printImpl methods.
 
-void PushMatcherNode::print(raw_ostream &OS, unsigned indent) const {
-  OS.indent(indent) << "Push\n";
-  printChild(OS, indent+2);
-  Failure->print(OS, indent);
+void ScopeMatcher::printImpl(raw_ostream &OS, unsigned indent) const {
+  OS.indent(indent) << "Scope\n";
+  for (unsigned i = 0, e = getNumChildren(); i != e; ++i) {
+    if (getChild(i) == 0)
+      OS.indent(indent+1) << "NULL POINTER\n";
+    else
+      getChild(i)->print(OS, indent+2);
+  }
 }
 
-void RecordMatcherNode::print(raw_ostream &OS, unsigned indent) const {
+void RecordMatcher::printImpl(raw_ostream &OS, unsigned indent) const {
   OS.indent(indent) << "Record\n";
-  printChild(OS, indent);
 }
 
-void MoveChildMatcherNode::print(raw_ostream &OS, unsigned indent) const {
+void RecordChildMatcher::printImpl(raw_ostream &OS, unsigned indent) const {
+  OS.indent(indent) << "RecordChild: " << ChildNo << '\n';
+}
+
+void RecordMemRefMatcher::printImpl(raw_ostream &OS, unsigned indent) const {
+  OS.indent(indent) << "RecordMemRef\n";
+}
+
+void CaptureFlagInputMatcher::printImpl(raw_ostream &OS, unsigned indent) const{
+  OS.indent(indent) << "CaptureFlagInput\n";
+}
+
+void MoveChildMatcher::printImpl(raw_ostream &OS, unsigned indent) const {
   OS.indent(indent) << "MoveChild " << ChildNo << '\n';
-  printChild(OS, indent);
 }
 
-void MoveParentMatcherNode::print(raw_ostream &OS, unsigned indent) const {
+void MoveParentMatcher::printImpl(raw_ostream &OS, unsigned indent) const {
   OS.indent(indent) << "MoveParent\n";
-  printChild(OS, indent);
 }
 
-void CheckSameMatcherNode::print(raw_ostream &OS, unsigned indent) const {
+void CheckSameMatcher::printImpl(raw_ostream &OS, unsigned indent) const {
   OS.indent(indent) << "CheckSame " << MatchNumber << '\n';
-  printChild(OS, indent);
 }
 
-void CheckPatternPredicateMatcherNode::
-print(raw_ostream &OS, unsigned indent) const {
+void CheckPatternPredicateMatcher::
+printImpl(raw_ostream &OS, unsigned indent) const {
   OS.indent(indent) << "CheckPatternPredicate " << Predicate << '\n';
-  printChild(OS, indent);
 }
 
-void CheckPredicateMatcherNode::print(raw_ostream &OS, unsigned indent) const {
+void CheckPredicateMatcher::printImpl(raw_ostream &OS, unsigned indent) const {
   OS.indent(indent) << "CheckPredicate " << PredName << '\n';
-  printChild(OS, indent);
 }
 
-void CheckOpcodeMatcherNode::print(raw_ostream &OS, unsigned indent) const {
-  OS.indent(indent) << "CheckOpcode " << OpcodeName << '\n';
-  printChild(OS, indent);
+void CheckOpcodeMatcher::printImpl(raw_ostream &OS, unsigned indent) const {
+  OS.indent(indent) << "CheckOpcode " << Opcode.getEnumName() << '\n';
+}
+
+void SwitchOpcodeMatcher::printImpl(raw_ostream &OS, unsigned indent) const {
+  OS.indent(indent) << "SwitchOpcode: {\n";
+  for (unsigned i = 0, e = Cases.size(); i != e; ++i) {
+    OS.indent(indent) << "case " << Cases[i].first->getEnumName() << ":\n";
+    Cases[i].second->print(OS, indent+2);
+  }
+  OS.indent(indent) << "}\n";
 }
 
-void CheckTypeMatcherNode::print(raw_ostream &OS, unsigned indent) const {
+
+void CheckTypeMatcher::printImpl(raw_ostream &OS, unsigned indent) const {
   OS.indent(indent) << "CheckType " << getEnumName(Type) << '\n';
-  printChild(OS, indent);
 }
 
-void CheckIntegerMatcherNode::print(raw_ostream &OS, unsigned indent) const {
+void SwitchTypeMatcher::printImpl(raw_ostream &OS, unsigned indent) const {
+  OS.indent(indent) << "SwitchType: {\n";
+  for (unsigned i = 0, e = Cases.size(); i != e; ++i) {
+    OS.indent(indent) << "case " << getEnumName(Cases[i].first) << ":\n";
+    Cases[i].second->print(OS, indent+2);
+  }
+  OS.indent(indent) << "}\n";
+}
+
+void CheckChildTypeMatcher::printImpl(raw_ostream &OS, unsigned indent) const {
+  OS.indent(indent) << "CheckChildType " << ChildNo << " "
+    << getEnumName(Type) << '\n';
+}
+
+
+void CheckIntegerMatcher::printImpl(raw_ostream &OS, unsigned indent) const {
   OS.indent(indent) << "CheckInteger " << Value << '\n';
-  printChild(OS, indent);
 }
 
-void CheckCondCodeMatcherNode::print(raw_ostream &OS, unsigned indent) const {
+void CheckCondCodeMatcher::printImpl(raw_ostream &OS, unsigned indent) const {
   OS.indent(indent) << "CheckCondCode ISD::" << CondCodeName << '\n';
-  printChild(OS, indent);
 }
 
-void CheckValueTypeMatcherNode::print(raw_ostream &OS, unsigned indent) const {
+void CheckValueTypeMatcher::printImpl(raw_ostream &OS, unsigned indent) const {
   OS.indent(indent) << "CheckValueType MVT::" << TypeName << '\n';
-  printChild(OS, indent);
 }
 
-void CheckComplexPatMatcherNode::print(raw_ostream &OS, unsigned indent) const {
+void CheckComplexPatMatcher::printImpl(raw_ostream &OS, unsigned indent) const {
   OS.indent(indent) << "CheckComplexPat " << Pattern.getSelectFunc() << '\n';
-  printChild(OS, indent);
 }
 
-void CheckAndImmMatcherNode::print(raw_ostream &OS, unsigned indent) const {
+void CheckAndImmMatcher::printImpl(raw_ostream &OS, unsigned indent) const {
   OS.indent(indent) << "CheckAndImm " << Value << '\n';
-  printChild(OS, indent);
 }
 
-void CheckOrImmMatcherNode::print(raw_ostream &OS, unsigned indent) const {
+void CheckOrImmMatcher::printImpl(raw_ostream &OS, unsigned indent) const {
   OS.indent(indent) << "CheckOrImm " << Value << '\n';
-  printChild(OS, indent);
 }
 
+void CheckFoldableChainNodeMatcher::printImpl(raw_ostream &OS,
+                                              unsigned indent) const {
+  OS.indent(indent) << "CheckFoldableChainNode\n";
+}
+
+void EmitIntegerMatcher::printImpl(raw_ostream &OS, unsigned indent) const {
+  OS.indent(indent) << "EmitInteger " << Val << " VT=" << VT << '\n';
+}
+
+void EmitStringIntegerMatcher::
+printImpl(raw_ostream &OS, unsigned indent) const {
+  OS.indent(indent) << "EmitStringInteger " << Val << " VT=" << VT << '\n';
+}
+
+void EmitRegisterMatcher::printImpl(raw_ostream &OS, unsigned indent) const {
+  OS.indent(indent) << "EmitRegister ";
+  if (Reg)
+    OS << Reg->getName();
+  else
+    OS << "zero_reg";
+  OS << " VT=" << VT << '\n';
+}
+
+void EmitConvertToTargetMatcher::
+printImpl(raw_ostream &OS, unsigned indent) const {
+  OS.indent(indent) << "EmitConvertToTarget " << Slot << '\n';
+}
+
+void EmitMergeInputChainsMatcher::
+printImpl(raw_ostream &OS, unsigned indent) const {
+  OS.indent(indent) << "EmitMergeInputChains <todo: args>\n";
+}
+
+void EmitCopyToRegMatcher::printImpl(raw_ostream &OS, unsigned indent) const {
+  OS.indent(indent) << "EmitCopyToReg <todo: args>\n";
+}
+
+void EmitNodeXFormMatcher::printImpl(raw_ostream &OS, unsigned indent) const {
+  OS.indent(indent) << "EmitNodeXForm " << NodeXForm->getName()
+     << " Slot=" << Slot << '\n';
+}
+
+
+void EmitNodeMatcherCommon::printImpl(raw_ostream &OS, unsigned indent) const {
+  OS.indent(indent);
+  OS << (isa<MorphNodeToMatcher>(this) ? "MorphNodeTo: " : "EmitNode: ")
+     << OpcodeName << ": <todo flags> ";
+
+  for (unsigned i = 0, e = VTs.size(); i != e; ++i)
+    OS << ' ' << getEnumName(VTs[i]);
+  OS << '(';
+  for (unsigned i = 0, e = Operands.size(); i != e; ++i)
+    OS << Operands[i] << ' ';
+  OS << ")\n";
+}
+
+void MarkFlagResultsMatcher::printImpl(raw_ostream &OS, unsigned indent) const {
+  OS.indent(indent) << "MarkFlagResults <todo: args>\n";
+}
+
+void CompleteMatchMatcher::printImpl(raw_ostream &OS, unsigned indent) const {
+  OS.indent(indent) << "CompleteMatch <todo args>\n";
+  OS.indent(indent) << "Src = " << *Pattern.getSrcPattern() << "\n";
+  OS.indent(indent) << "Dst = " << *Pattern.getDstPattern() << "\n";
+}
+
+// getHashImpl Implementation.
+
+unsigned CheckPatternPredicateMatcher::getHashImpl() const {
+  return HashString(Predicate);
+}
+
+unsigned CheckPredicateMatcher::getHashImpl() const {
+  return HashString(PredName);
+}
+
+unsigned CheckOpcodeMatcher::getHashImpl() const {
+  return HashString(Opcode.getEnumName());
+}
+
+unsigned CheckCondCodeMatcher::getHashImpl() const {
+  return HashString(CondCodeName);
+}
+
+unsigned CheckValueTypeMatcher::getHashImpl() const {
+  return HashString(TypeName);
+}
+
+unsigned EmitStringIntegerMatcher::getHashImpl() const {
+  return HashString(Val) ^ VT;
+}
+
+template<typename It>
+static unsigned HashUnsigneds(It I, It E) {
+  unsigned Result = 0;
+  for (; I != E; ++I)
+    Result = (Result<<3) ^ *I;
+  return Result;
+}
+
+unsigned EmitMergeInputChainsMatcher::getHashImpl() const {
+  return HashUnsigneds(ChainNodes.begin(), ChainNodes.end());
+}
+
+bool CheckOpcodeMatcher::isEqualImpl(const Matcher *M) const {
+  // Note: pointer equality isn't enough here, we have to check the enum names
+  // to ensure that the nodes are for the same opcode. 
+  return cast<CheckOpcodeMatcher>(M)->Opcode.getEnumName() ==
+          Opcode.getEnumName();
+}
+
+
+bool EmitNodeMatcherCommon::isEqualImpl(const Matcher *m) const {
+  const EmitNodeMatcherCommon *M = cast<EmitNodeMatcherCommon>(m);
+  return M->OpcodeName == OpcodeName && M->VTs == VTs &&
+         M->Operands == Operands && M->HasChain == HasChain &&
+         M->HasInFlag == HasInFlag && M->HasOutFlag == HasOutFlag &&
+         M->HasMemRefs == HasMemRefs &&
+         M->NumFixedArityOperands == NumFixedArityOperands;
+}
+
+unsigned EmitNodeMatcherCommon::getHashImpl() const {
+  return (HashString(OpcodeName) << 4) | Operands.size();
+}
+
+
+unsigned MarkFlagResultsMatcher::getHashImpl() const {
+  return HashUnsigneds(FlagResultNodes.begin(), FlagResultNodes.end());
+}
+
+unsigned CompleteMatchMatcher::getHashImpl() const {
+  return HashUnsigneds(Results.begin(), Results.end()) ^ 
+          ((unsigned)(intptr_t)&Pattern << 8);
+}
+
+// isContradictoryImpl Implementations.
+
+static bool TypesAreContradictory(MVT::SimpleValueType T1,
+                                  MVT::SimpleValueType T2) {
+  // If the two types are the same, then they are the same, so they don't
+  // contradict.
+  if (T1 == T2) return false;
+  
+  // If either type is about iPtr, then they don't conflict unless the other
+  // one is not a scalar integer type.
+  if (T1 == MVT::iPTR)
+    return !MVT(T2).isInteger() || MVT(T2).isVector();
+  
+  if (T2 == MVT::iPTR)
+    return !MVT(T1).isInteger() || MVT(T1).isVector();
+  
+  // Otherwise, they are two different non-iPTR types, they conflict.
+  return true;
+}
+
+bool CheckOpcodeMatcher::isContradictoryImpl(const Matcher *M) const {
+  if (const CheckOpcodeMatcher *COM = dyn_cast<CheckOpcodeMatcher>(M)) {
+    // One node can't have two different opcodes!
+    // Note: pointer equality isn't enough here, we have to check the enum names
+    // to ensure that the nodes are for the same opcode. 
+    return COM->getOpcode().getEnumName() != getOpcode().getEnumName();
+  }
+  
+  // If the node has a known type, and if the type we're checking for is
+  // different, then we know they contradict.  For example, a check for
+  // ISD::STORE will never be true at the same time a check for Type i32 is.
+  if (const CheckTypeMatcher *CT = dyn_cast<CheckTypeMatcher>(M)) {
+    // FIXME: What result is this referring to?
+    unsigned NodeType;
+    if (getOpcode().getNumResults() == 0)
+      NodeType = MVT::isVoid;
+    else
+      NodeType = getOpcode().getKnownType();
+    if (NodeType != EEVT::isUnknown)
+      return TypesAreContradictory((MVT::SimpleValueType)NodeType,
+                                   CT->getType());
+  }
+  
+  return false;
+}
+
+bool CheckTypeMatcher::isContradictoryImpl(const Matcher *M) const {
+  if (const CheckTypeMatcher *CT = dyn_cast<CheckTypeMatcher>(M))
+    return TypesAreContradictory(getType(), CT->getType());
+  return false;
+}
+
+bool CheckChildTypeMatcher::isContradictoryImpl(const Matcher *M) const {
+  if (const CheckChildTypeMatcher *CC = dyn_cast<CheckChildTypeMatcher>(M)) {
+    // If the two checks are about different nodes, we don't know if they
+    // conflict!
+    if (CC->getChildNo() != getChildNo())
+      return false;
+    
+    return TypesAreContradictory(getType(), CC->getType());
+  }
+  return false;
+}
+  
+bool CheckIntegerMatcher::isContradictoryImpl(const Matcher *M) const {
+  if (const CheckIntegerMatcher *CIM = dyn_cast<CheckIntegerMatcher>(M))
+    return CIM->getValue() != getValue();
+  return false;
+}
diff --git a/libclamav/c++/llvm/utils/TableGen/DAGISelMatcher.h b/libclamav/c++/llvm/utils/TableGen/DAGISelMatcher.h
index 72bdb7b..7955c7e 100644
--- a/libclamav/c++/llvm/utils/TableGen/DAGISelMatcher.h
+++ b/libclamav/c++/llvm/utils/TableGen/DAGISelMatcher.h
@@ -10,353 +10,1059 @@
 #ifndef TBLGEN_DAGISELMATCHER_H
 #define TBLGEN_DAGISELMATCHER_H
 
+#include "llvm/CodeGen/ValueTypes.h"
 #include "llvm/ADT/OwningPtr.h"
 #include "llvm/ADT/StringRef.h"
-#include "llvm/CodeGen/ValueTypes.h"
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/Support/Casting.h"
 
 namespace llvm {
   class CodeGenDAGPatterns;
-  class MatcherNode;
+  class Matcher;
   class PatternToMatch;
   class raw_ostream;
   class ComplexPattern;
+  class Record;
+  class SDNodeInfo;
 
-MatcherNode *ConvertPatternToMatcher(const PatternToMatch &Pattern,
-                                     const CodeGenDAGPatterns &CGP);
-
-void EmitMatcherTable(const MatcherNode *Matcher, raw_ostream &OS);
+Matcher *ConvertPatternToMatcher(const PatternToMatch &Pattern,unsigned Variant,
+                                 const CodeGenDAGPatterns &CGP);
+Matcher *OptimizeMatcher(Matcher *Matcher, const CodeGenDAGPatterns &CGP);
+void EmitMatcherTable(const Matcher *Matcher, const CodeGenDAGPatterns &CGP,
+                      raw_ostream &OS);
 
   
-/// MatcherNode - Base class for all the the DAG ISel Matcher representation
+/// Matcher - Base class for all the the DAG ISel Matcher representation
 /// nodes.
-class MatcherNode {
+class Matcher {
+  // The next matcher node that is executed after this one.  Null if this is the
+  // last stage of a match.
+  OwningPtr<Matcher> Next;
 public:
   enum KindTy {
-    EmitNode,
-    Push,           // [Push, Dest0, Dest1, Dest2, Dest3]
-    Record,         // [Record]
-    MoveChild,      // [MoveChild, Child#]
-    MoveParent,     // [MoveParent]
+    // Matcher state manipulation.
+    Scope,                // Push a checking scope.
+    RecordNode,           // Record the current node.
+    RecordChild,          // Record a child of the current node.
+    RecordMemRef,         // Record the memref in the current node.
+    CaptureFlagInput,     // If the current node has an input flag, save it.
+    MoveChild,            // Move current node to specified child.
+    MoveParent,           // Move current node to parent.
     
-    CheckSame,      // [CheckSame, N]         Fail if not same as prev match.
+    // Predicate checking.
+    CheckSame,            // Fail if not same as prev match.
     CheckPatternPredicate,
-    CheckPredicate, // [CheckPredicate, P]    Fail if predicate fails.
-    CheckOpcode,    // [CheckOpcode, Opcode]  Fail if not opcode.
-    CheckType,      // [CheckType, MVT]       Fail if not correct type.
-    CheckInteger,   // [CheckInteger, int0,int1,int2,...int7] Fail if wrong val.
-    CheckCondCode,  // [CheckCondCode, CondCode] Fail if not condcode.
+    CheckPredicate,       // Fail if node predicate fails.
+    CheckOpcode,          // Fail if not opcode.
+    SwitchOpcode,         // Dispatch based on opcode.
+    CheckType,            // Fail if not correct type.
+    SwitchType,           // Dispatch based on type.
+    CheckChildType,       // Fail if child has wrong type.
+    CheckInteger,         // Fail if wrong val.
+    CheckCondCode,        // Fail if not condcode.
     CheckValueType,
     CheckComplexPat,
     CheckAndImm,
-    CheckOrImm
+    CheckOrImm,
+    CheckFoldableChainNode,
+    
+    // Node creation/emisssion.
+    EmitInteger,          // Create a TargetConstant
+    EmitStringInteger,    // Create a TargetConstant from a string.
+    EmitRegister,         // Create a register.
+    EmitConvertToTarget,  // Convert a imm/fpimm to target imm/fpimm
+    EmitMergeInputChains, // Merge together a chains for an input.
+    EmitCopyToReg,        // Emit a copytoreg into a physreg.
+    EmitNode,             // Create a DAG node
+    EmitNodeXForm,        // Run a SDNodeXForm
+    MarkFlagResults,      // Indicate which interior nodes have flag results.
+    CompleteMatch,        // Finish a match and update the results.
+    MorphNodeTo           // Build a node, finish a match and update results.
   };
   const KindTy Kind;
-  
+
 protected:
-  MatcherNode(KindTy K) : Kind(K) {}
+  Matcher(KindTy K) : Kind(K) {}
 public:
-  virtual ~MatcherNode() {}
+  virtual ~Matcher() {}
   
   KindTy getKind() const { return Kind; }
+
+  Matcher *getNext() { return Next.get(); }
+  const Matcher *getNext() const { return Next.get(); }
+  void setNext(Matcher *C) { Next.reset(C); }
+  Matcher *takeNext() { return Next.take(); }
+
+  OwningPtr<Matcher> &getNextPtr() { return Next; }
   
+  static inline bool classof(const Matcher *) { return true; }
   
-  static inline bool classof(const MatcherNode *) { return true; }
+  bool isEqual(const Matcher *M) const {
+    if (getKind() != M->getKind()) return false;
+    return isEqualImpl(M);
+  }
+  
+  unsigned getHash() const {
+    // Clear the high bit so we don't conflict with tombstones etc.
+    return ((getHashImpl() << 4) ^ getKind()) & (~0U>>1);
+  }
+  
+  /// isSafeToReorderWithPatternPredicate - Return true if it is safe to sink a
+  /// PatternPredicate node past this one.
+  virtual bool isSafeToReorderWithPatternPredicate() const {
+    return false;
+  }
+  
+  /// isContradictory - Return true of these two matchers could never match on
+  /// the same node.
+  bool isContradictory(const Matcher *Other) const {
+    // Since this predicate is reflexive, we canonicalize the ordering so that
+    // we always match a node against nodes with kinds that are greater or equal
+    // to them.  For example, we'll pass in a CheckType node as an argument to
+    // the CheckOpcode method, not the other way around.
+    if (getKind() < Other->getKind())
+      return isContradictoryImpl(Other);
+    return Other->isContradictoryImpl(this);
+  }
   
-  virtual void print(raw_ostream &OS, unsigned indent = 0) const = 0;
+  void print(raw_ostream &OS, unsigned indent = 0) const;
+  void printOne(raw_ostream &OS) const;
   void dump() const;
+protected:
+  virtual void printImpl(raw_ostream &OS, unsigned indent) const = 0;
+  virtual bool isEqualImpl(const Matcher *M) const = 0;
+  virtual unsigned getHashImpl() const = 0;
+  virtual bool isContradictoryImpl(const Matcher *M) const { return false; }
 };
   
-/// EmitNodeMatcherNode - This signals a successful match and generates a node.
-class EmitNodeMatcherNode : public MatcherNode {
-  const PatternToMatch &Pattern;
+/// ScopeMatcher - This attempts to match each of its children to find the first
+/// one that successfully matches.  If one child fails, it tries the next child.
+/// If none of the children match then this check fails.  It never has a 'next'.
+class ScopeMatcher : public Matcher {
+  SmallVector<Matcher*, 4> Children;
 public:
-  EmitNodeMatcherNode(const PatternToMatch &pattern)
-    : MatcherNode(EmitNode), Pattern(pattern) {}
-
-  const PatternToMatch &getPattern() const { return Pattern; }
+  ScopeMatcher(Matcher *const *children, unsigned numchildren)
+    : Matcher(Scope), Children(children, children+numchildren) {
+  }
+  virtual ~ScopeMatcher();
+  
+  unsigned getNumChildren() const { return Children.size(); }
+  
+  Matcher *getChild(unsigned i) { return Children[i]; }
+  const Matcher *getChild(unsigned i) const { return Children[i]; }
+  
+  void resetChild(unsigned i, Matcher *N) {
+    delete Children[i];
+    Children[i] = N;
+  }
 
-  static inline bool classof(const MatcherNode *N) {
-    return N->getKind() == EmitNode;
+  Matcher *takeChild(unsigned i) {
+    Matcher *Res = Children[i];
+    Children[i] = 0;
+    return Res;
+  }
+  
+  void setNumChildren(unsigned NC) {
+    if (NC < Children.size()) {
+      // delete any children we're about to lose pointers to.
+      for (unsigned i = NC, e = Children.size(); i != e; ++i)
+        delete Children[i];
+    }
+    Children.resize(NC);
   }
 
-  virtual void print(raw_ostream &OS, unsigned indent = 0) const;
+  static inline bool classof(const Matcher *N) {
+    return N->getKind() == Scope;
+  }
+  
+private:
+  virtual void printImpl(raw_ostream &OS, unsigned indent) const;
+  virtual bool isEqualImpl(const Matcher *M) const { return false; }
+  virtual unsigned getHashImpl() const { return 12312; }
 };
 
-/// MatcherNodeWithChild - Every node accept the final accept state has a child
-/// that is executed after the node runs.  This class captures this commonality.
-class MatcherNodeWithChild : public MatcherNode {
-  OwningPtr<MatcherNode> Child;
+/// RecordMatcher - Save the current node in the operand list.
+class RecordMatcher : public Matcher {
+  /// WhatFor - This is a string indicating why we're recording this.  This
+  /// should only be used for comment generation not anything semantic.
+  std::string WhatFor;
+  
+  /// ResultNo - The slot number in the RecordedNodes vector that this will be,
+  /// just printed as a comment.
+  unsigned ResultNo;
 public:
-  MatcherNodeWithChild(KindTy K) : MatcherNode(K) {}
+  RecordMatcher(const std::string &whatfor, unsigned resultNo)
+    : Matcher(RecordNode), WhatFor(whatfor), ResultNo(resultNo) {}
   
-  MatcherNode *getChild() { return Child.get(); }
-  const MatcherNode *getChild() const { return Child.get(); }
-  void setChild(MatcherNode *C) { Child.reset(C); }
+  const std::string &getWhatFor() const { return WhatFor; }
+  unsigned getResultNo() const { return ResultNo; }
   
-  static inline bool classof(const MatcherNode *N) {
-    return N->getKind() != EmitNode;
+  static inline bool classof(const Matcher *N) {
+    return N->getKind() == RecordNode;
   }
   
-protected:
-  void printChild(raw_ostream &OS, unsigned indent) const;
+  virtual bool isSafeToReorderWithPatternPredicate() const { return true; }
+private:
+  virtual void printImpl(raw_ostream &OS, unsigned indent) const;
+  virtual bool isEqualImpl(const Matcher *M) const { return true; }
+  virtual unsigned getHashImpl() const { return 0; }
 };
-
-/// PushMatcherNode - This pushes a failure scope on the stack and evaluates
-/// 'child'.  If 'child' fails to match, it pops its scope and attempts to
-/// match 'Failure'.
-class PushMatcherNode : public MatcherNodeWithChild {
-  OwningPtr<MatcherNode> Failure;
+  
+/// RecordChildMatcher - Save a numbered child of the current node, or fail
+/// the match if it doesn't exist.  This is logically equivalent to:
+///    MoveChild N + RecordNode + MoveParent.
+class RecordChildMatcher : public Matcher {
+  unsigned ChildNo;
+  
+  /// WhatFor - This is a string indicating why we're recording this.  This
+  /// should only be used for comment generation not anything semantic.
+  std::string WhatFor;
+  
+  /// ResultNo - The slot number in the RecordedNodes vector that this will be,
+  /// just printed as a comment.
+  unsigned ResultNo;
 public:
-  PushMatcherNode(MatcherNode *child = 0, MatcherNode *failure = 0)
-    : MatcherNodeWithChild(Push), Failure(failure) {
-    setChild(child);
+  RecordChildMatcher(unsigned childno, const std::string &whatfor,
+                     unsigned resultNo)
+  : Matcher(RecordChild), ChildNo(childno), WhatFor(whatfor),
+    ResultNo(resultNo) {}
+  
+  unsigned getChildNo() const { return ChildNo; }
+  const std::string &getWhatFor() const { return WhatFor; }
+  unsigned getResultNo() const { return ResultNo; }
+
+  static inline bool classof(const Matcher *N) {
+    return N->getKind() == RecordChild;
   }
   
-  MatcherNode *getFailure() { return Failure.get(); }
-  const MatcherNode *getFailure() const { return Failure.get(); }
-  void setFailure(MatcherNode *N) { Failure.reset(N); }
+  virtual bool isSafeToReorderWithPatternPredicate() const { return true; }
 
-  static inline bool classof(const MatcherNode *N) {
-    return N->getKind() == Push;
+private:
+  virtual void printImpl(raw_ostream &OS, unsigned indent) const;
+  virtual bool isEqualImpl(const Matcher *M) const {
+    return cast<RecordChildMatcher>(M)->getChildNo() == getChildNo();
+  }
+  virtual unsigned getHashImpl() const { return getChildNo(); }
+};
+  
+/// RecordMemRefMatcher - Save the current node's memref.
+class RecordMemRefMatcher : public Matcher {
+public:
+  RecordMemRefMatcher() : Matcher(RecordMemRef) {}
+  
+  static inline bool classof(const Matcher *N) {
+    return N->getKind() == RecordMemRef;
   }
   
-  virtual void print(raw_ostream &OS, unsigned indent = 0) const;
+  virtual bool isSafeToReorderWithPatternPredicate() const { return true; }
+
+private:
+  virtual void printImpl(raw_ostream &OS, unsigned indent) const;
+  virtual bool isEqualImpl(const Matcher *M) const { return true; }
+  virtual unsigned getHashImpl() const { return 0; }
 };
 
-/// RecordMatcherNode - Save the current node in the operand list.
-class RecordMatcherNode : public MatcherNodeWithChild {
+  
+/// CaptureFlagInputMatcher - If the current record has a flag input, record
+/// it so that it is used as an input to the generated code.
+class CaptureFlagInputMatcher : public Matcher {
 public:
-  RecordMatcherNode() : MatcherNodeWithChild(Record) {}
+  CaptureFlagInputMatcher() : Matcher(CaptureFlagInput) {}
   
-  static inline bool classof(const MatcherNode *N) {
-    return N->getKind() == Record;
+  static inline bool classof(const Matcher *N) {
+    return N->getKind() == CaptureFlagInput;
   }
   
-  virtual void print(raw_ostream &OS, unsigned indent = 0) const;
+  virtual bool isSafeToReorderWithPatternPredicate() const { return true; }
+
+private:
+  virtual void printImpl(raw_ostream &OS, unsigned indent) const;
+  virtual bool isEqualImpl(const Matcher *M) const { return true; }
+  virtual unsigned getHashImpl() const { return 0; }
 };
   
-/// MoveChildMatcherNode - This tells the interpreter to move into the
+/// MoveChildMatcher - This tells the interpreter to move into the
 /// specified child node.
-class MoveChildMatcherNode : public MatcherNodeWithChild {
+class MoveChildMatcher : public Matcher {
   unsigned ChildNo;
 public:
-  MoveChildMatcherNode(unsigned childNo)
-  : MatcherNodeWithChild(MoveChild), ChildNo(childNo) {}
+  MoveChildMatcher(unsigned childNo) : Matcher(MoveChild), ChildNo(childNo) {}
   
   unsigned getChildNo() const { return ChildNo; }
   
-  static inline bool classof(const MatcherNode *N) {
+  static inline bool classof(const Matcher *N) {
     return N->getKind() == MoveChild;
   }
   
-  virtual void print(raw_ostream &OS, unsigned indent = 0) const;
+  virtual bool isSafeToReorderWithPatternPredicate() const { return true; }
+
+private:
+  virtual void printImpl(raw_ostream &OS, unsigned indent) const;
+  virtual bool isEqualImpl(const Matcher *M) const {
+    return cast<MoveChildMatcher>(M)->getChildNo() == getChildNo();
+  }
+  virtual unsigned getHashImpl() const { return getChildNo(); }
 };
   
-/// MoveParentMatcherNode - This tells the interpreter to move to the parent
+/// MoveParentMatcher - This tells the interpreter to move to the parent
 /// of the current node.
-class MoveParentMatcherNode : public MatcherNodeWithChild {
+class MoveParentMatcher : public Matcher {
 public:
-  MoveParentMatcherNode()
-  : MatcherNodeWithChild(MoveParent) {}
+  MoveParentMatcher() : Matcher(MoveParent) {}
   
-  static inline bool classof(const MatcherNode *N) {
+  static inline bool classof(const Matcher *N) {
     return N->getKind() == MoveParent;
   }
   
-  virtual void print(raw_ostream &OS, unsigned indent = 0) const;
+  virtual bool isSafeToReorderWithPatternPredicate() const { return true; }
+
+private:
+  virtual void printImpl(raw_ostream &OS, unsigned indent) const;
+  virtual bool isEqualImpl(const Matcher *M) const { return true; }
+  virtual unsigned getHashImpl() const { return 0; }
 };
 
-/// CheckSameMatcherNode - This checks to see if this node is exactly the same
+/// CheckSameMatcher - This checks to see if this node is exactly the same
 /// node as the specified match that was recorded with 'Record'.  This is used
 /// when patterns have the same name in them, like '(mul GPR:$in, GPR:$in)'.
-class CheckSameMatcherNode : public MatcherNodeWithChild {
+class CheckSameMatcher : public Matcher {
   unsigned MatchNumber;
 public:
-  CheckSameMatcherNode(unsigned matchnumber)
-  : MatcherNodeWithChild(CheckSame), MatchNumber(matchnumber) {}
+  CheckSameMatcher(unsigned matchnumber)
+    : Matcher(CheckSame), MatchNumber(matchnumber) {}
   
   unsigned getMatchNumber() const { return MatchNumber; }
   
-  static inline bool classof(const MatcherNode *N) {
+  static inline bool classof(const Matcher *N) {
     return N->getKind() == CheckSame;
   }
   
-  virtual void print(raw_ostream &OS, unsigned indent = 0) const;
+  virtual bool isSafeToReorderWithPatternPredicate() const { return true; }
+
+private:
+  virtual void printImpl(raw_ostream &OS, unsigned indent) const;
+  virtual bool isEqualImpl(const Matcher *M) const {
+    return cast<CheckSameMatcher>(M)->getMatchNumber() == getMatchNumber();
+  }
+  virtual unsigned getHashImpl() const { return getMatchNumber(); }
 };
   
-/// CheckPatternPredicateMatcherNode - This checks the target-specific predicate
+/// CheckPatternPredicateMatcher - This checks the target-specific predicate
 /// to see if the entire pattern is capable of matching.  This predicate does
 /// not take a node as input.  This is used for subtarget feature checks etc.
-class CheckPatternPredicateMatcherNode : public MatcherNodeWithChild {
+class CheckPatternPredicateMatcher : public Matcher {
   std::string Predicate;
 public:
-  CheckPatternPredicateMatcherNode(StringRef predicate)
-  : MatcherNodeWithChild(CheckPatternPredicate), Predicate(predicate) {}
+  CheckPatternPredicateMatcher(StringRef predicate)
+    : Matcher(CheckPatternPredicate), Predicate(predicate) {}
   
   StringRef getPredicate() const { return Predicate; }
   
-  static inline bool classof(const MatcherNode *N) {
+  static inline bool classof(const Matcher *N) {
     return N->getKind() == CheckPatternPredicate;
   }
   
-  virtual void print(raw_ostream &OS, unsigned indent = 0) const;
+  virtual bool isSafeToReorderWithPatternPredicate() const { return true; }
+
+private:
+  virtual void printImpl(raw_ostream &OS, unsigned indent) const;
+  virtual bool isEqualImpl(const Matcher *M) const {
+    return cast<CheckPatternPredicateMatcher>(M)->getPredicate() == Predicate;
+  }
+  virtual unsigned getHashImpl() const;
 };
   
-/// CheckPredicateMatcherNode - This checks the target-specific predicate to
+/// CheckPredicateMatcher - This checks the target-specific predicate to
 /// see if the node is acceptable.
-class CheckPredicateMatcherNode : public MatcherNodeWithChild {
+class CheckPredicateMatcher : public Matcher {
   StringRef PredName;
 public:
-  CheckPredicateMatcherNode(StringRef predname)
-    : MatcherNodeWithChild(CheckPredicate), PredName(predname) {}
+  CheckPredicateMatcher(StringRef predname)
+    : Matcher(CheckPredicate), PredName(predname) {}
   
   StringRef getPredicateName() const { return PredName; }
 
-  static inline bool classof(const MatcherNode *N) {
+  static inline bool classof(const Matcher *N) {
     return N->getKind() == CheckPredicate;
   }
   
-  virtual void print(raw_ostream &OS, unsigned indent = 0) const;
+  // TODO: Ok?
+  //virtual bool isSafeToReorderWithPatternPredicate() const { return true; }
+
+private:
+  virtual void printImpl(raw_ostream &OS, unsigned indent) const;
+  virtual bool isEqualImpl(const Matcher *M) const {
+    return cast<CheckPredicateMatcher>(M)->PredName == PredName;
+  }
+  virtual unsigned getHashImpl() const;
 };
   
   
-/// CheckOpcodeMatcherNode - This checks to see if the current node has the
+/// CheckOpcodeMatcher - This checks to see if the current node has the
 /// specified opcode, if not it fails to match.
-class CheckOpcodeMatcherNode : public MatcherNodeWithChild {
-  StringRef OpcodeName;
+class CheckOpcodeMatcher : public Matcher {
+  const SDNodeInfo &Opcode;
 public:
-  CheckOpcodeMatcherNode(StringRef opcodename)
-    : MatcherNodeWithChild(CheckOpcode), OpcodeName(opcodename) {}
+  CheckOpcodeMatcher(const SDNodeInfo &opcode)
+    : Matcher(CheckOpcode), Opcode(opcode) {}
   
-  StringRef getOpcodeName() const { return OpcodeName; }
+  const SDNodeInfo &getOpcode() const { return Opcode; }
   
-  static inline bool classof(const MatcherNode *N) {
+  static inline bool classof(const Matcher *N) {
     return N->getKind() == CheckOpcode;
   }
   
-  virtual void print(raw_ostream &OS, unsigned indent = 0) const;
+  virtual bool isSafeToReorderWithPatternPredicate() const { return true; }
+
+private:
+  virtual void printImpl(raw_ostream &OS, unsigned indent) const;
+  virtual bool isEqualImpl(const Matcher *M) const;
+  virtual unsigned getHashImpl() const;
+  virtual bool isContradictoryImpl(const Matcher *M) const;
 };
+
+/// SwitchOpcodeMatcher - Switch based on the current node's opcode, dispatching
+/// to one matcher per opcode.  If the opcode doesn't match any of the cases,
+/// then the match fails.  This is semantically equivalent to a Scope node where
+/// every child does a CheckOpcode, but is much faster.
+class SwitchOpcodeMatcher : public Matcher {
+  SmallVector<std::pair<const SDNodeInfo*, Matcher*>, 8> Cases;
+public:
+  SwitchOpcodeMatcher(const std::pair<const SDNodeInfo*, Matcher*> *cases,
+                      unsigned numcases)
+    : Matcher(SwitchOpcode), Cases(cases, cases+numcases) {}
+
+  static inline bool classof(const Matcher *N) {
+    return N->getKind() == SwitchOpcode;
+  }
+  
+  unsigned getNumCases() const { return Cases.size(); }
   
-/// CheckTypeMatcherNode - This checks to see if the current node has the
+  const SDNodeInfo &getCaseOpcode(unsigned i) const { return *Cases[i].first; }
+  Matcher *getCaseMatcher(unsigned i) { return Cases[i].second; }
+  const Matcher *getCaseMatcher(unsigned i) const { return Cases[i].second; }
+  
+private:
+  virtual void printImpl(raw_ostream &OS, unsigned indent) const;
+  virtual bool isEqualImpl(const Matcher *M) const { return false; }
+  virtual unsigned getHashImpl() const { return 4123; }
+};
+  
+/// CheckTypeMatcher - This checks to see if the current node has the
 /// specified type, if not it fails to match.
-class CheckTypeMatcherNode : public MatcherNodeWithChild {
+class CheckTypeMatcher : public Matcher {
   MVT::SimpleValueType Type;
 public:
-  CheckTypeMatcherNode(MVT::SimpleValueType type)
-    : MatcherNodeWithChild(CheckType), Type(type) {}
+  CheckTypeMatcher(MVT::SimpleValueType type)
+    : Matcher(CheckType), Type(type) {}
   
   MVT::SimpleValueType getType() const { return Type; }
   
-  static inline bool classof(const MatcherNode *N) {
+  static inline bool classof(const Matcher *N) {
     return N->getKind() == CheckType;
   }
   
-  virtual void print(raw_ostream &OS, unsigned indent = 0) const;
+  virtual bool isSafeToReorderWithPatternPredicate() const { return true; }
+
+private:
+  virtual void printImpl(raw_ostream &OS, unsigned indent) const;
+  virtual bool isEqualImpl(const Matcher *M) const {
+    return cast<CheckTypeMatcher>(M)->Type == Type;
+  }
+  virtual unsigned getHashImpl() const { return Type; }
+  virtual bool isContradictoryImpl(const Matcher *M) const;
 };
+  
+/// SwitchTypeMatcher - Switch based on the current node's type, dispatching
+/// to one matcher per case.  If the type doesn't match any of the cases,
+/// then the match fails.  This is semantically equivalent to a Scope node where
+/// every child does a CheckType, but is much faster.
+class SwitchTypeMatcher : public Matcher {
+  SmallVector<std::pair<MVT::SimpleValueType, Matcher*>, 8> Cases;
+public:
+  SwitchTypeMatcher(const std::pair<MVT::SimpleValueType, Matcher*> *cases,
+                    unsigned numcases)
+  : Matcher(SwitchType), Cases(cases, cases+numcases) {}
+  
+  static inline bool classof(const Matcher *N) {
+    return N->getKind() == SwitchType;
+  }
+  
+  unsigned getNumCases() const { return Cases.size(); }
+  
+  MVT::SimpleValueType getCaseType(unsigned i) const { return Cases[i].first; }
+  Matcher *getCaseMatcher(unsigned i) { return Cases[i].second; }
+  const Matcher *getCaseMatcher(unsigned i) const { return Cases[i].second; }
+  
+private:
+  virtual void printImpl(raw_ostream &OS, unsigned indent) const;
+  virtual bool isEqualImpl(const Matcher *M) const { return false; }
+  virtual unsigned getHashImpl() const { return 4123; }
+};
+  
+  
+/// CheckChildTypeMatcher - This checks to see if a child node has the
+/// specified type, if not it fails to match.
+class CheckChildTypeMatcher : public Matcher {
+  unsigned ChildNo;
+  MVT::SimpleValueType Type;
+public:
+  CheckChildTypeMatcher(unsigned childno, MVT::SimpleValueType type)
+    : Matcher(CheckChildType), ChildNo(childno), Type(type) {}
+  
+  unsigned getChildNo() const { return ChildNo; }
+  MVT::SimpleValueType getType() const { return Type; }
+  
+  static inline bool classof(const Matcher *N) {
+    return N->getKind() == CheckChildType;
+  }
+  
+  virtual bool isSafeToReorderWithPatternPredicate() const { return true; }
 
-/// CheckIntegerMatcherNode - This checks to see if the current node is a
+private:
+  virtual void printImpl(raw_ostream &OS, unsigned indent) const;
+  virtual bool isEqualImpl(const Matcher *M) const {
+    return cast<CheckChildTypeMatcher>(M)->ChildNo == ChildNo &&
+           cast<CheckChildTypeMatcher>(M)->Type == Type;
+  }
+  virtual unsigned getHashImpl() const { return (Type << 3) | ChildNo; }
+  virtual bool isContradictoryImpl(const Matcher *M) const;
+};
+  
+
+/// CheckIntegerMatcher - This checks to see if the current node is a
 /// ConstantSDNode with the specified integer value, if not it fails to match.
-class CheckIntegerMatcherNode : public MatcherNodeWithChild {
+class CheckIntegerMatcher : public Matcher {
   int64_t Value;
 public:
-  CheckIntegerMatcherNode(int64_t value)
-    : MatcherNodeWithChild(CheckInteger), Value(value) {}
+  CheckIntegerMatcher(int64_t value)
+    : Matcher(CheckInteger), Value(value) {}
   
   int64_t getValue() const { return Value; }
   
-  static inline bool classof(const MatcherNode *N) {
+  static inline bool classof(const Matcher *N) {
     return N->getKind() == CheckInteger;
   }
   
-  virtual void print(raw_ostream &OS, unsigned indent = 0) const;
+  virtual bool isSafeToReorderWithPatternPredicate() const { return true; }
+
+private:
+  virtual void printImpl(raw_ostream &OS, unsigned indent) const;
+  virtual bool isEqualImpl(const Matcher *M) const {
+    return cast<CheckIntegerMatcher>(M)->Value == Value;
+  }
+  virtual unsigned getHashImpl() const { return Value; }
+  virtual bool isContradictoryImpl(const Matcher *M) const;
 };
   
-/// CheckCondCodeMatcherNode - This checks to see if the current node is a
+/// CheckCondCodeMatcher - This checks to see if the current node is a
 /// CondCodeSDNode with the specified condition, if not it fails to match.
-class CheckCondCodeMatcherNode : public MatcherNodeWithChild {
+class CheckCondCodeMatcher : public Matcher {
   StringRef CondCodeName;
 public:
-  CheckCondCodeMatcherNode(StringRef condcodename)
-  : MatcherNodeWithChild(CheckCondCode), CondCodeName(condcodename) {}
+  CheckCondCodeMatcher(StringRef condcodename)
+    : Matcher(CheckCondCode), CondCodeName(condcodename) {}
   
   StringRef getCondCodeName() const { return CondCodeName; }
   
-  static inline bool classof(const MatcherNode *N) {
+  static inline bool classof(const Matcher *N) {
     return N->getKind() == CheckCondCode;
   }
   
-  virtual void print(raw_ostream &OS, unsigned indent = 0) const;
+  virtual bool isSafeToReorderWithPatternPredicate() const { return true; }
+
+private:
+  virtual void printImpl(raw_ostream &OS, unsigned indent) const;
+  virtual bool isEqualImpl(const Matcher *M) const {
+    return cast<CheckCondCodeMatcher>(M)->CondCodeName == CondCodeName;
+  }
+  virtual unsigned getHashImpl() const;
 };
   
-/// CheckValueTypeMatcherNode - This checks to see if the current node is a
+/// CheckValueTypeMatcher - This checks to see if the current node is a
 /// VTSDNode with the specified type, if not it fails to match.
-class CheckValueTypeMatcherNode : public MatcherNodeWithChild {
+class CheckValueTypeMatcher : public Matcher {
   StringRef TypeName;
 public:
-  CheckValueTypeMatcherNode(StringRef type_name)
-  : MatcherNodeWithChild(CheckValueType), TypeName(type_name) {}
+  CheckValueTypeMatcher(StringRef type_name)
+    : Matcher(CheckValueType), TypeName(type_name) {}
   
   StringRef getTypeName() const { return TypeName; }
 
-  static inline bool classof(const MatcherNode *N) {
+  static inline bool classof(const Matcher *N) {
     return N->getKind() == CheckValueType;
   }
   
-  virtual void print(raw_ostream &OS, unsigned indent = 0) const;
+  virtual bool isSafeToReorderWithPatternPredicate() const { return true; }
+
+private:
+  virtual void printImpl(raw_ostream &OS, unsigned indent) const;
+  virtual bool isEqualImpl(const Matcher *M) const {
+    return cast<CheckValueTypeMatcher>(M)->TypeName == TypeName;
+  }
+  virtual unsigned getHashImpl() const;
 };
   
   
   
-/// CheckComplexPatMatcherNode - This node runs the specified ComplexPattern on
+/// CheckComplexPatMatcher - This node runs the specified ComplexPattern on
 /// the current node.
-class CheckComplexPatMatcherNode : public MatcherNodeWithChild {
+class CheckComplexPatMatcher : public Matcher {
   const ComplexPattern &Pattern;
+  
+  /// MatchNumber - This is the recorded nodes slot that contains the node we want to
+  /// match against.
+  unsigned MatchNumber;
+  
+  /// Name - The name of the node we're matching, for comment emission.
+  std::string Name;
+  
+  /// FirstResult - This is the first slot in the RecordedNodes list that the
+  /// result of the match populates.
+  unsigned FirstResult;
 public:
-  CheckComplexPatMatcherNode(const ComplexPattern &pattern)
-  : MatcherNodeWithChild(CheckComplexPat), Pattern(pattern) {}
+  CheckComplexPatMatcher(const ComplexPattern &pattern, unsigned matchnumber,
+                         const std::string &name, unsigned firstresult)
+    : Matcher(CheckComplexPat), Pattern(pattern), MatchNumber(matchnumber),
+      Name(name), FirstResult(firstresult) {}
   
-  static inline bool classof(const MatcherNode *N) {
+  const ComplexPattern &getPattern() const { return Pattern; }
+  unsigned getMatchNumber() const { return MatchNumber; }
+  
+  const std::string getName() const { return Name; }
+  unsigned getFirstResult() const { return FirstResult; }
+  
+  static inline bool classof(const Matcher *N) {
     return N->getKind() == CheckComplexPat;
   }
   
-  virtual void print(raw_ostream &OS, unsigned indent = 0) const;
+  // Not safe to move a pattern predicate past a complex pattern.
+  virtual bool isSafeToReorderWithPatternPredicate() const { return false; }
+
+private:
+  virtual void printImpl(raw_ostream &OS, unsigned indent) const;
+  virtual bool isEqualImpl(const Matcher *M) const {
+    return &cast<CheckComplexPatMatcher>(M)->Pattern == &Pattern &&
+           cast<CheckComplexPatMatcher>(M)->MatchNumber == MatchNumber;
+  }
+  virtual unsigned getHashImpl() const {
+    return (unsigned)(intptr_t)&Pattern ^ MatchNumber;
+  }
 };
   
-/// CheckAndImmMatcherNode - This checks to see if the current node is an 'and'
+/// CheckAndImmMatcher - This checks to see if the current node is an 'and'
 /// with something equivalent to the specified immediate.
-class CheckAndImmMatcherNode : public MatcherNodeWithChild {
+class CheckAndImmMatcher : public Matcher {
   int64_t Value;
 public:
-  CheckAndImmMatcherNode(int64_t value)
-  : MatcherNodeWithChild(CheckAndImm), Value(value) {}
+  CheckAndImmMatcher(int64_t value)
+    : Matcher(CheckAndImm), Value(value) {}
   
   int64_t getValue() const { return Value; }
   
-  static inline bool classof(const MatcherNode *N) {
+  static inline bool classof(const Matcher *N) {
     return N->getKind() == CheckAndImm;
   }
   
-  virtual void print(raw_ostream &OS, unsigned indent = 0) const;
+  virtual bool isSafeToReorderWithPatternPredicate() const { return true; }
+
+private:
+  virtual void printImpl(raw_ostream &OS, unsigned indent) const;
+  virtual bool isEqualImpl(const Matcher *M) const {
+    return cast<CheckAndImmMatcher>(M)->Value == Value;
+  }
+  virtual unsigned getHashImpl() const { return Value; }
 };
 
-/// CheckOrImmMatcherNode - This checks to see if the current node is an 'and'
+/// CheckOrImmMatcher - This checks to see if the current node is an 'and'
 /// with something equivalent to the specified immediate.
-class CheckOrImmMatcherNode : public MatcherNodeWithChild {
+class CheckOrImmMatcher : public Matcher {
   int64_t Value;
 public:
-  CheckOrImmMatcherNode(int64_t value)
-    : MatcherNodeWithChild(CheckOrImm), Value(value) {}
+  CheckOrImmMatcher(int64_t value)
+    : Matcher(CheckOrImm), Value(value) {}
   
   int64_t getValue() const { return Value; }
 
-  static inline bool classof(const MatcherNode *N) {
+  static inline bool classof(const Matcher *N) {
     return N->getKind() == CheckOrImm;
   }
   
-  virtual void print(raw_ostream &OS, unsigned indent = 0) const;
+  virtual bool isSafeToReorderWithPatternPredicate() const { return true; }
+
+private:
+  virtual void printImpl(raw_ostream &OS, unsigned indent) const;
+  virtual bool isEqualImpl(const Matcher *M) const {
+    return cast<CheckOrImmMatcher>(M)->Value == Value;
+  }
+  virtual unsigned getHashImpl() const { return Value; }
 };
+
+/// CheckFoldableChainNodeMatcher - This checks to see if the current node
+/// (which defines a chain operand) is safe to fold into a larger pattern.
+class CheckFoldableChainNodeMatcher : public Matcher {
+public:
+  CheckFoldableChainNodeMatcher()
+    : Matcher(CheckFoldableChainNode) {}
   
+  static inline bool classof(const Matcher *N) {
+    return N->getKind() == CheckFoldableChainNode;
+  }
   
+  virtual bool isSafeToReorderWithPatternPredicate() const { return true; }
+
+private:
+  virtual void printImpl(raw_ostream &OS, unsigned indent) const;
+  virtual bool isEqualImpl(const Matcher *M) const { return true; }
+  virtual unsigned getHashImpl() const { return 0; }
+};
+
+/// EmitIntegerMatcher - This creates a new TargetConstant.
+class EmitIntegerMatcher : public Matcher {
+  int64_t Val;
+  MVT::SimpleValueType VT;
+public:
+  EmitIntegerMatcher(int64_t val, MVT::SimpleValueType vt)
+    : Matcher(EmitInteger), Val(val), VT(vt) {}
+  
+  int64_t getValue() const { return Val; }
+  MVT::SimpleValueType getVT() const { return VT; }
+  
+  static inline bool classof(const Matcher *N) {
+    return N->getKind() == EmitInteger;
+  }
+  
+private:
+  virtual void printImpl(raw_ostream &OS, unsigned indent) const;
+  virtual bool isEqualImpl(const Matcher *M) const {
+    return cast<EmitIntegerMatcher>(M)->Val == Val &&
+           cast<EmitIntegerMatcher>(M)->VT == VT;
+  }
+  virtual unsigned getHashImpl() const { return (Val << 4) | VT; }
+};
+
+/// EmitStringIntegerMatcher - A target constant whose value is represented
+/// by a string.
+class EmitStringIntegerMatcher : public Matcher {
+  std::string Val;
+  MVT::SimpleValueType VT;
+public:
+  EmitStringIntegerMatcher(const std::string &val, MVT::SimpleValueType vt)
+    : Matcher(EmitStringInteger), Val(val), VT(vt) {}
+  
+  const std::string &getValue() const { return Val; }
+  MVT::SimpleValueType getVT() const { return VT; }
+  
+  static inline bool classof(const Matcher *N) {
+    return N->getKind() == EmitStringInteger;
+  }
+  
+private:
+  virtual void printImpl(raw_ostream &OS, unsigned indent) const;
+  virtual bool isEqualImpl(const Matcher *M) const {
+    return cast<EmitStringIntegerMatcher>(M)->Val == Val &&
+           cast<EmitStringIntegerMatcher>(M)->VT == VT;
+  }
+  virtual unsigned getHashImpl() const;
+};
+  
+/// EmitRegisterMatcher - This creates a new TargetConstant.
+class EmitRegisterMatcher : public Matcher {
+  /// Reg - The def for the register that we're emitting.  If this is null, then
+  /// this is a reference to zero_reg.
+  Record *Reg;
+  MVT::SimpleValueType VT;
+public:
+  EmitRegisterMatcher(Record *reg, MVT::SimpleValueType vt)
+    : Matcher(EmitRegister), Reg(reg), VT(vt) {}
+  
+  Record *getReg() const { return Reg; }
+  MVT::SimpleValueType getVT() const { return VT; }
+  
+  static inline bool classof(const Matcher *N) {
+    return N->getKind() == EmitRegister;
+  }
+  
+private:
+  virtual void printImpl(raw_ostream &OS, unsigned indent) const;
+  virtual bool isEqualImpl(const Matcher *M) const {
+    return cast<EmitRegisterMatcher>(M)->Reg == Reg &&
+           cast<EmitRegisterMatcher>(M)->VT == VT;
+  }
+  virtual unsigned getHashImpl() const {
+    return ((unsigned)(intptr_t)Reg) << 4 | VT;
+  }
+};
+
+/// EmitConvertToTargetMatcher - Emit an operation that reads a specified
+/// recorded node and converts it from being a ISD::Constant to
+/// ISD::TargetConstant, likewise for ConstantFP.
+class EmitConvertToTargetMatcher : public Matcher {
+  unsigned Slot;
+public:
+  EmitConvertToTargetMatcher(unsigned slot)
+    : Matcher(EmitConvertToTarget), Slot(slot) {}
+  
+  unsigned getSlot() const { return Slot; }
+  
+  static inline bool classof(const Matcher *N) {
+    return N->getKind() == EmitConvertToTarget;
+  }
+  
+private:
+  virtual void printImpl(raw_ostream &OS, unsigned indent) const;
+  virtual bool isEqualImpl(const Matcher *M) const {
+    return cast<EmitConvertToTargetMatcher>(M)->Slot == Slot;
+  }
+  virtual unsigned getHashImpl() const { return Slot; }
+};
+  
+/// EmitMergeInputChainsMatcher - Emit a node that merges a list of input
+/// chains together with a token factor.  The list of nodes are the nodes in the
+/// matched pattern that have chain input/outputs.  This node adds all input
+/// chains of these nodes if they are not themselves a node in the pattern.
+class EmitMergeInputChainsMatcher : public Matcher {
+  SmallVector<unsigned, 3> ChainNodes;
+public:
+  EmitMergeInputChainsMatcher(const unsigned *nodes, unsigned NumNodes)
+    : Matcher(EmitMergeInputChains), ChainNodes(nodes, nodes+NumNodes) {}
+  
+  unsigned getNumNodes() const { return ChainNodes.size(); }
+  
+  unsigned getNode(unsigned i) const {
+    assert(i < ChainNodes.size());
+    return ChainNodes[i];
+  }  
+  
+  static inline bool classof(const Matcher *N) {
+    return N->getKind() == EmitMergeInputChains;
+  }
+  
+private:
+  virtual void printImpl(raw_ostream &OS, unsigned indent) const;
+  virtual bool isEqualImpl(const Matcher *M) const {
+    return cast<EmitMergeInputChainsMatcher>(M)->ChainNodes == ChainNodes;
+  }
+  virtual unsigned getHashImpl() const;
+};
+  
+/// EmitCopyToRegMatcher - Emit a CopyToReg node from a value to a physreg,
+/// pushing the chain and flag results.
+///
+class EmitCopyToRegMatcher : public Matcher {
+  unsigned SrcSlot; // Value to copy into the physreg.
+  Record *DestPhysReg;
+public:
+  EmitCopyToRegMatcher(unsigned srcSlot, Record *destPhysReg)
+    : Matcher(EmitCopyToReg), SrcSlot(srcSlot), DestPhysReg(destPhysReg) {}
+  
+  unsigned getSrcSlot() const { return SrcSlot; }
+  Record *getDestPhysReg() const { return DestPhysReg; }
+  
+  static inline bool classof(const Matcher *N) {
+    return N->getKind() == EmitCopyToReg;
+  }
+  
+private:
+  virtual void printImpl(raw_ostream &OS, unsigned indent) const;
+  virtual bool isEqualImpl(const Matcher *M) const {
+    return cast<EmitCopyToRegMatcher>(M)->SrcSlot == SrcSlot &&
+           cast<EmitCopyToRegMatcher>(M)->DestPhysReg == DestPhysReg; 
+  }
+  virtual unsigned getHashImpl() const {
+    return SrcSlot ^ ((unsigned)(intptr_t)DestPhysReg << 4);
+  }
+};
+  
+    
+  
+/// EmitNodeXFormMatcher - Emit an operation that runs an SDNodeXForm on a
+/// recorded node and records the result.
+class EmitNodeXFormMatcher : public Matcher {
+  unsigned Slot;
+  Record *NodeXForm;
+public:
+  EmitNodeXFormMatcher(unsigned slot, Record *nodeXForm)
+    : Matcher(EmitNodeXForm), Slot(slot), NodeXForm(nodeXForm) {}
+  
+  unsigned getSlot() const { return Slot; }
+  Record *getNodeXForm() const { return NodeXForm; }
+  
+  static inline bool classof(const Matcher *N) {
+    return N->getKind() == EmitNodeXForm;
+  }
+  
+private:
+  virtual void printImpl(raw_ostream &OS, unsigned indent) const;
+  virtual bool isEqualImpl(const Matcher *M) const {
+    return cast<EmitNodeXFormMatcher>(M)->Slot == Slot &&
+           cast<EmitNodeXFormMatcher>(M)->NodeXForm == NodeXForm; 
+  }
+  virtual unsigned getHashImpl() const {
+    return Slot ^ ((unsigned)(intptr_t)NodeXForm << 4);
+  }
+};
+  
+/// EmitNodeMatcherCommon - Common class shared between EmitNode and
+/// MorphNodeTo.
+class EmitNodeMatcherCommon : public Matcher {
+  std::string OpcodeName;
+  const SmallVector<MVT::SimpleValueType, 3> VTs;
+  const SmallVector<unsigned, 6> Operands;
+  bool HasChain, HasInFlag, HasOutFlag, HasMemRefs;
+  
+  /// NumFixedArityOperands - If this is a fixed arity node, this is set to -1.
+  /// If this is a varidic node, this is set to the number of fixed arity
+  /// operands in the root of the pattern.  The rest are appended to this node.
+  int NumFixedArityOperands;
+public:
+  EmitNodeMatcherCommon(const std::string &opcodeName,
+                        const MVT::SimpleValueType *vts, unsigned numvts,
+                        const unsigned *operands, unsigned numops,
+                        bool hasChain, bool hasInFlag, bool hasOutFlag,
+                        bool hasmemrefs,
+                        int numfixedarityoperands, bool isMorphNodeTo)
+    : Matcher(isMorphNodeTo ? MorphNodeTo : EmitNode), OpcodeName(opcodeName),
+      VTs(vts, vts+numvts), Operands(operands, operands+numops),
+      HasChain(hasChain), HasInFlag(hasInFlag), HasOutFlag(hasOutFlag),
+      HasMemRefs(hasmemrefs), NumFixedArityOperands(numfixedarityoperands) {}
+  
+  const std::string &getOpcodeName() const { return OpcodeName; }
+  
+  unsigned getNumVTs() const { return VTs.size(); }
+  MVT::SimpleValueType getVT(unsigned i) const {
+    assert(i < VTs.size());
+    return VTs[i];
+  }
+
+  unsigned getNumOperands() const { return Operands.size(); }
+  unsigned getOperand(unsigned i) const {
+    assert(i < Operands.size());
+    return Operands[i];
+  }
+  
+  const SmallVectorImpl<MVT::SimpleValueType> &getVTList() const { return VTs; }
+  const SmallVectorImpl<unsigned> &getOperandList() const { return Operands; }
+
+  
+  bool hasChain() const { return HasChain; }
+  bool hasInFlag() const { return HasInFlag; }
+  bool hasOutFlag() const { return HasOutFlag; }
+  bool hasMemRefs() const { return HasMemRefs; }
+  int getNumFixedArityOperands() const { return NumFixedArityOperands; }
+  
+  static inline bool classof(const Matcher *N) {
+    return N->getKind() == EmitNode || N->getKind() == MorphNodeTo;
+  }
+  
+private:
+  virtual void printImpl(raw_ostream &OS, unsigned indent) const;
+  virtual bool isEqualImpl(const Matcher *M) const;
+  virtual unsigned getHashImpl() const;
+};
+  
+/// EmitNodeMatcher - This signals a successful match and generates a node.
+class EmitNodeMatcher : public EmitNodeMatcherCommon {
+  unsigned FirstResultSlot;
+public:
+  EmitNodeMatcher(const std::string &opcodeName,
+                  const MVT::SimpleValueType *vts, unsigned numvts,
+                  const unsigned *operands, unsigned numops,
+                  bool hasChain, bool hasInFlag, bool hasOutFlag,
+                  bool hasmemrefs,
+                  int numfixedarityoperands, unsigned firstresultslot)
+  : EmitNodeMatcherCommon(opcodeName, vts, numvts, operands, numops, hasChain,
+                          hasInFlag, hasOutFlag, hasmemrefs,
+                          numfixedarityoperands, false),
+    FirstResultSlot(firstresultslot) {}
+  
+  unsigned getFirstResultSlot() const { return FirstResultSlot; }
+  
+  static inline bool classof(const Matcher *N) {
+    return N->getKind() == EmitNode;
+  }
+  
+};
+  
+class MorphNodeToMatcher : public EmitNodeMatcherCommon {
+  const PatternToMatch &Pattern;
+public:
+  MorphNodeToMatcher(const std::string &opcodeName,
+                     const MVT::SimpleValueType *vts, unsigned numvts,
+                     const unsigned *operands, unsigned numops,
+                     bool hasChain, bool hasInFlag, bool hasOutFlag,
+                     bool hasmemrefs,
+                     int numfixedarityoperands, const PatternToMatch &pattern)
+    : EmitNodeMatcherCommon(opcodeName, vts, numvts, operands, numops, hasChain,
+                            hasInFlag, hasOutFlag, hasmemrefs,
+                            numfixedarityoperands, true),
+      Pattern(pattern) {
+  }
+  
+  const PatternToMatch &getPattern() const { return Pattern; }
+
+  static inline bool classof(const Matcher *N) {
+    return N->getKind() == MorphNodeTo;
+  }
+};
+  
+/// MarkFlagResultsMatcher - This node indicates which non-root nodes in the
+/// pattern produce flags.  This allows CompleteMatchMatcher to update them
+/// with the output flag of the resultant code.
+class MarkFlagResultsMatcher : public Matcher {
+  SmallVector<unsigned, 3> FlagResultNodes;
+public:
+  MarkFlagResultsMatcher(const unsigned *nodes, unsigned NumNodes)
+    : Matcher(MarkFlagResults), FlagResultNodes(nodes, nodes+NumNodes) {}
+  
+  unsigned getNumNodes() const { return FlagResultNodes.size(); }
+  
+  unsigned getNode(unsigned i) const {
+    assert(i < FlagResultNodes.size());
+    return FlagResultNodes[i];
+  }  
+  
+  static inline bool classof(const Matcher *N) {
+    return N->getKind() == MarkFlagResults;
+  }
+  
+private:
+  virtual void printImpl(raw_ostream &OS, unsigned indent) const;
+  virtual bool isEqualImpl(const Matcher *M) const {
+    return cast<MarkFlagResultsMatcher>(M)->FlagResultNodes == FlagResultNodes;
+  }
+  virtual unsigned getHashImpl() const;
+};
+
+/// CompleteMatchMatcher - Complete a match by replacing the results of the
+/// pattern with the newly generated nodes.  This also prints a comment
+/// indicating the source and dest patterns.
+class CompleteMatchMatcher : public Matcher {
+  SmallVector<unsigned, 2> Results;
+  const PatternToMatch &Pattern;
+public:
+  CompleteMatchMatcher(const unsigned *results, unsigned numresults,
+                       const PatternToMatch &pattern)
+  : Matcher(CompleteMatch), Results(results, results+numresults),
+    Pattern(pattern) {}
+
+  unsigned getNumResults() const { return Results.size(); }
+  unsigned getResult(unsigned R) const { return Results[R]; }
+  const PatternToMatch &getPattern() const { return Pattern; }
+  
+  static inline bool classof(const Matcher *N) {
+    return N->getKind() == CompleteMatch;
+  }
+  
+private:
+  virtual void printImpl(raw_ostream &OS, unsigned indent) const;
+  virtual bool isEqualImpl(const Matcher *M) const {
+    return cast<CompleteMatchMatcher>(M)->Results == Results &&
+          &cast<CompleteMatchMatcher>(M)->Pattern == &Pattern;
+  }
+  virtual unsigned getHashImpl() const;
+};
+ 
 } // end namespace llvm
 
 #endif
diff --git a/libclamav/c++/llvm/utils/TableGen/DAGISelMatcherEmitter.cpp b/libclamav/c++/llvm/utils/TableGen/DAGISelMatcherEmitter.cpp
index 1a41713..cabf2d4 100644
--- a/libclamav/c++/llvm/utils/TableGen/DAGISelMatcherEmitter.cpp
+++ b/libclamav/c++/llvm/utils/TableGen/DAGISelMatcherEmitter.cpp
@@ -13,205 +13,767 @@
 
 #include "DAGISelMatcher.h"
 #include "CodeGenDAGPatterns.h"
+#include "Record.h"
+#include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/SmallString.h"
-#include "llvm/Support/Casting.h"
+#include "llvm/ADT/StringMap.h"
+#include "llvm/Support/CommandLine.h"
 #include "llvm/Support/FormattedStream.h"
 using namespace llvm;
 
-namespace {
 enum {
-  CommentIndent = 25
+  CommentIndent = 30
 };
-}
 
-static unsigned EmitMatcherAndChildren(const MatcherNode *N,
-                                       formatted_raw_ostream &FOS,
-                                       unsigned Indent);
-
-/// ClassifyInt - Classify an integer by size, return '1','2','4','8' if this
-/// fits in 1, 2, 4, or 8 sign extended bytes.
-static char ClassifyInt(int64_t Val) {
-  if (Val == int8_t(Val))  return '1';
-  if (Val == int16_t(Val)) return '2';
-  if (Val == int32_t(Val)) return '4';
-  return '8';
-}
+// To reduce generated source code size.
+static cl::opt<bool>
+OmitComments("omit-comments", cl::desc("Do not generate comments"),
+             cl::init(false));
+
+namespace {
+class MatcherTableEmitter {
+  StringMap<unsigned> NodePredicateMap, PatternPredicateMap;
+  std::vector<std::string> NodePredicates, PatternPredicates;
 
-/// EmitInt - Emit the specified integer, returning the number of bytes emitted.
-static unsigned EmitInt(int64_t Val, formatted_raw_ostream &OS) {
-  unsigned BytesEmitted = 1;
-  OS << (int)(unsigned char)Val << ", ";
-  if (Val == int8_t(Val)) {
-    OS << "\n";
-    return BytesEmitted;
+  DenseMap<const ComplexPattern*, unsigned> ComplexPatternMap;
+  std::vector<const ComplexPattern*> ComplexPatterns;
+
+
+  DenseMap<Record*, unsigned> NodeXFormMap;
+  std::vector<Record*> NodeXForms;
+
+public:
+  MatcherTableEmitter() {}
+
+  unsigned EmitMatcherList(const Matcher *N, unsigned Indent,
+                           unsigned StartIdx, formatted_raw_ostream &OS);
+  
+  void EmitPredicateFunctions(const CodeGenDAGPatterns &CGP,
+                              formatted_raw_ostream &OS);
+  
+  void EmitHistogram(const Matcher *N, formatted_raw_ostream &OS);
+private:
+  unsigned EmitMatcher(const Matcher *N, unsigned Indent, unsigned CurrentIdx,
+                       formatted_raw_ostream &OS);
+  
+  unsigned getNodePredicate(StringRef PredName) {
+    unsigned &Entry = NodePredicateMap[PredName];
+    if (Entry == 0) {
+      NodePredicates.push_back(PredName.str());
+      Entry = NodePredicates.size();
+    }
+    return Entry-1;
+  }
+  unsigned getPatternPredicate(StringRef PredName) {
+    unsigned &Entry = PatternPredicateMap[PredName];
+    if (Entry == 0) {
+      PatternPredicates.push_back(PredName.str());
+      Entry = PatternPredicates.size();
+    }
+    return Entry-1;
   }
   
-  OS << (int)(unsigned char)(Val >> 8) << ", ";
-  ++BytesEmitted;
+  unsigned getComplexPat(const ComplexPattern &P) {
+    unsigned &Entry = ComplexPatternMap[&P];
+    if (Entry == 0) {
+      ComplexPatterns.push_back(&P);
+      Entry = ComplexPatterns.size();
+    }
+    return Entry-1;
+  }
   
-  if (Val != int16_t(Val)) {
-    OS << (int)(unsigned char)(Val >> 16) << ','
-       << (int)(unsigned char)(Val >> 24) << ',';
-    BytesEmitted += 2;
-    
-    if (Val != int32_t(Val)) {
-      OS << (int)(unsigned char)(Val >> 32) << ','
-         << (int)(unsigned char)(Val >> 40) << ','
-         << (int)(unsigned char)(Val >> 48) << ','
-         << (int)(unsigned char)(Val >> 56) << ',';
-      BytesEmitted += 4;
-    }   
+  unsigned getNodeXFormID(Record *Rec) {
+    unsigned &Entry = NodeXFormMap[Rec];
+    if (Entry == 0) {
+      NodeXForms.push_back(Rec);
+      Entry = NodeXForms.size();
+    }
+    return Entry-1;
   }
   
-  OS.PadToColumn(CommentIndent) << "// " << Val << '\n';
-  return BytesEmitted;
+};
+} // end anonymous namespace.
+
+static unsigned GetVBRSize(unsigned Val) {
+  if (Val <= 127) return 1;
+  
+  unsigned NumBytes = 0;
+  while (Val >= 128) {
+    Val >>= 7;
+    ++NumBytes;
+  }
+  return NumBytes+1;
+}
+
+/// EmitVBRValue - Emit the specified value as a VBR, returning the number of
+/// bytes emitted.
+static uint64_t EmitVBRValue(uint64_t Val, raw_ostream &OS) {
+  if (Val <= 127) {
+    OS << Val << ", ";
+    return 1;
+  }
+  
+  uint64_t InVal = Val;
+  unsigned NumBytes = 0;
+  while (Val >= 128) {
+    OS << (Val&127) << "|128,";
+    Val >>= 7;
+    ++NumBytes;
+  }
+  OS << Val;
+  if (!OmitComments)
+    OS << "/*" << InVal << "*/";
+  OS << ", ";
+  return NumBytes+1;
 }
 
 /// EmitMatcherOpcodes - Emit bytes for the specified matcher and return
 /// the number of bytes emitted.
-static unsigned EmitMatcher(const MatcherNode *N, formatted_raw_ostream &OS,
-                            unsigned Indent) {
+unsigned MatcherTableEmitter::
+EmitMatcher(const Matcher *N, unsigned Indent, unsigned CurrentIdx,
+            formatted_raw_ostream &OS) {
   OS.PadToColumn(Indent*2);
   
   switch (N->getKind()) {
-  case MatcherNode::Push: assert(0 && "Should be handled by caller");
-  case MatcherNode::EmitNode:
-    OS << "OPC_Emit, /*XXX*/";
-    OS.PadToColumn(CommentIndent) << "// Src: "
-      << *cast<EmitNodeMatcherNode>(N)->getPattern().getSrcPattern() << '\n';
-    OS.PadToColumn(CommentIndent) << "// Dst: "
-      << *cast<EmitNodeMatcherNode>(N)->getPattern().getDstPattern() << '\n';
+  case Matcher::Scope: {
+    const ScopeMatcher *SM = cast<ScopeMatcher>(N);
+    assert(SM->getNext() == 0 && "Shouldn't have next after scope");
+    
+    unsigned StartIdx = CurrentIdx;
+    
+    // Emit all of the children.
+    for (unsigned i = 0, e = SM->getNumChildren(); i != e; ++i) {
+      if (i == 0) {
+        OS << "OPC_Scope, ";
+        ++CurrentIdx;
+      } else  {
+        if (!OmitComments) {
+          OS << "/*" << CurrentIdx << "*/";
+          OS.PadToColumn(Indent*2) << "/*Scope*/ ";
+        } else
+          OS.PadToColumn(Indent*2);
+      }
+
+      // We need to encode the child and the offset of the failure code before
+      // emitting either of them.  Handle this by buffering the output into a
+      // string while we get the size.  Unfortunately, the offset of the
+      // children depends on the VBR size of the child, so for large children we
+      // have to iterate a bit.
+      SmallString<128> TmpBuf;
+      unsigned ChildSize = 0;
+      unsigned VBRSize = 0;
+      do {
+        VBRSize = GetVBRSize(ChildSize);
+        
+        TmpBuf.clear();
+        raw_svector_ostream OS(TmpBuf);
+        formatted_raw_ostream FOS(OS);
+        ChildSize = EmitMatcherList(SM->getChild(i), Indent+1,
+                                    CurrentIdx+VBRSize, FOS);
+      } while (GetVBRSize(ChildSize) != VBRSize);
+      
+      assert(ChildSize != 0 && "Should not have a zero-sized child!");
+    
+      CurrentIdx += EmitVBRValue(ChildSize, OS);
+      if (!OmitComments) {
+        OS << "/*->" << CurrentIdx+ChildSize << "*/";
+      
+        if (i == 0)
+          OS.PadToColumn(CommentIndent) << "// " << SM->getNumChildren()
+            << " children in Scope";
+      }
+      
+      OS << '\n' << TmpBuf.str();
+      CurrentIdx += ChildSize;
+    }
+    
+    // Emit a zero as a sentinel indicating end of 'Scope'.
+    if (!OmitComments)
+      OS << "/*" << CurrentIdx << "*/";
+    OS.PadToColumn(Indent*2) << "0, ";
+    if (!OmitComments)
+      OS << "/*End of Scope*/";
+    OS << '\n';
+    return CurrentIdx - StartIdx + 1;
+  }
+      
+  case Matcher::RecordNode:
+    OS << "OPC_RecordNode,";
+    if (!OmitComments)
+      OS.PadToColumn(CommentIndent) << "// #"
+        << cast<RecordMatcher>(N)->getResultNo() << " = "
+        << cast<RecordMatcher>(N)->getWhatFor();
+    OS << '\n';
     return 1;
-  case MatcherNode::Record:
-    OS << "OPC_Record,\n";
+
+  case Matcher::RecordChild:
+    OS << "OPC_RecordChild" << cast<RecordChildMatcher>(N)->getChildNo()
+       << ',';
+    if (!OmitComments)
+      OS.PadToColumn(CommentIndent) << "// #"
+        << cast<RecordChildMatcher>(N)->getResultNo() << " = "
+        << cast<RecordChildMatcher>(N)->getWhatFor();
+    OS << '\n';
     return 1;
-  case MatcherNode::MoveChild:
-    OS << "OPC_MoveChild, "
-       << cast<MoveChildMatcherNode>(N)->getChildNo() << ",\n";
+      
+  case Matcher::RecordMemRef:
+    OS << "OPC_RecordMemRef,\n";
+    return 1;
+      
+  case Matcher::CaptureFlagInput:
+    OS << "OPC_CaptureFlagInput,\n";
+    return 1;
+      
+  case Matcher::MoveChild:
+    OS << "OPC_MoveChild, " << cast<MoveChildMatcher>(N)->getChildNo() << ",\n";
     return 2;
       
-  case MatcherNode::MoveParent:
+  case Matcher::MoveParent:
     OS << "OPC_MoveParent,\n";
     return 1;
       
-  case MatcherNode::CheckSame:
+  case Matcher::CheckSame:
     OS << "OPC_CheckSame, "
-       << cast<CheckSameMatcherNode>(N)->getMatchNumber() << ",\n";
+       << cast<CheckSameMatcher>(N)->getMatchNumber() << ",\n";
     return 2;
 
-  case MatcherNode::CheckPatternPredicate:
-    OS << "OPC_CheckPatternPredicate, /*XXX*/0,";
-    OS.PadToColumn(CommentIndent) << "// "
-      << cast<CheckPatternPredicateMatcherNode>(N)->getPredicate() << '\n';
+  case Matcher::CheckPatternPredicate: {
+    StringRef Pred = cast<CheckPatternPredicateMatcher>(N)->getPredicate();
+    OS << "OPC_CheckPatternPredicate, " << getPatternPredicate(Pred) << ',';
+    if (!OmitComments)
+      OS.PadToColumn(CommentIndent) << "// " << Pred;
+    OS << '\n';
     return 2;
-    
-  case MatcherNode::CheckPredicate:
-    OS << "OPC_CheckPredicate, /*XXX*/0,";
-    OS.PadToColumn(CommentIndent) << "// "
-      << cast<CheckPredicateMatcherNode>(N)->getPredicateName() << '\n';
+  }
+  case Matcher::CheckPredicate: {
+    StringRef Pred = cast<CheckPredicateMatcher>(N)->getPredicateName();
+    OS << "OPC_CheckPredicate, " << getNodePredicate(Pred) << ',';
+    if (!OmitComments)
+      OS.PadToColumn(CommentIndent) << "// " << Pred;
+    OS << '\n';
     return 2;
-      
-  case MatcherNode::CheckOpcode:
+  }
+
+  case Matcher::CheckOpcode:
     OS << "OPC_CheckOpcode, "
-       << cast<CheckOpcodeMatcherNode>(N)->getOpcodeName() << ",\n";
+       << cast<CheckOpcodeMatcher>(N)->getOpcode().getEnumName() << ",\n";
     return 2;
       
-  case MatcherNode::CheckType:
+  case Matcher::SwitchOpcode:
+  case Matcher::SwitchType: {
+    unsigned StartIdx = CurrentIdx;
+    
+    unsigned NumCases;
+    if (const SwitchOpcodeMatcher *SOM = dyn_cast<SwitchOpcodeMatcher>(N)) {
+      OS << "OPC_SwitchOpcode ";
+      NumCases = SOM->getNumCases();
+    } else {
+      OS << "OPC_SwitchType ";
+      NumCases = cast<SwitchTypeMatcher>(N)->getNumCases();
+    }
+
+    if (!OmitComments)
+      OS << "/*" << NumCases << " cases */";
+    OS << ", ";
+    ++CurrentIdx;
+    
+    // For each case we emit the size, then the opcode, then the matcher.
+    for (unsigned i = 0, e = NumCases; i != e; ++i) {
+      const Matcher *Child;
+      if (const SwitchOpcodeMatcher *SOM = dyn_cast<SwitchOpcodeMatcher>(N))
+        Child = SOM->getCaseMatcher(i);
+      else
+        Child = cast<SwitchTypeMatcher>(N)->getCaseMatcher(i);
+      
+      // We need to encode the opcode and the offset of the case code before
+      // emitting the case code.  Handle this by buffering the output into a
+      // string while we get the size.  Unfortunately, the offset of the
+      // children depends on the VBR size of the child, so for large children we
+      // have to iterate a bit.
+      SmallString<128> TmpBuf;
+      unsigned ChildSize = 0;
+      unsigned VBRSize = 0;
+      do {
+        VBRSize = GetVBRSize(ChildSize);
+        
+        TmpBuf.clear();
+        raw_svector_ostream OS(TmpBuf);
+        formatted_raw_ostream FOS(OS);
+        ChildSize = EmitMatcherList(Child, Indent+1, CurrentIdx+VBRSize+1, FOS);
+      } while (GetVBRSize(ChildSize) != VBRSize);
+      
+      assert(ChildSize != 0 && "Should not have a zero-sized child!");
+      
+      if (i != 0) {
+        OS.PadToColumn(Indent*2);
+        if (!OmitComments)
+        OS << (isa<SwitchOpcodeMatcher>(N) ?
+                   "/*SwitchOpcode*/ " : "/*SwitchType*/ ");
+      }
+      
+      // Emit the VBR.
+      CurrentIdx += EmitVBRValue(ChildSize, OS);
+      
+      OS << ' ';
+      if (const SwitchOpcodeMatcher *SOM = dyn_cast<SwitchOpcodeMatcher>(N))
+        OS << SOM->getCaseOpcode(i).getEnumName();
+      else
+        OS << getEnumName(cast<SwitchTypeMatcher>(N)->getCaseType(i));
+      OS << ',';
+      
+      if (!OmitComments)
+        OS << "// ->" << CurrentIdx+ChildSize+1;
+      OS << '\n';
+      ++CurrentIdx;
+      OS << TmpBuf.str();
+      CurrentIdx += ChildSize;
+    }
+
+    // Emit the final zero to terminate the switch.
+    OS.PadToColumn(Indent*2) << "0, ";
+    if (!OmitComments)
+      OS << (isa<SwitchOpcodeMatcher>(N) ?
+             "// EndSwitchOpcode" : "// EndSwitchType");
+
+    OS << '\n';
+    ++CurrentIdx;
+    return CurrentIdx-StartIdx;
+  }
+
+ case Matcher::CheckType:
     OS << "OPC_CheckType, "
-       << getEnumName(cast<CheckTypeMatcherNode>(N)->getType()) << ",\n";
+       << getEnumName(cast<CheckTypeMatcher>(N)->getType()) << ",\n";
     return 2;
-
-  case MatcherNode::CheckInteger: {
-    int64_t Val = cast<CheckIntegerMatcherNode>(N)->getValue();
-    OS << "OPC_CheckInteger" << ClassifyInt(Val) << ", ";
-    return EmitInt(Val, OS)+1;
-  }   
-  case MatcherNode::CheckCondCode:
+      
+  case Matcher::CheckChildType:
+    OS << "OPC_CheckChild"
+       << cast<CheckChildTypeMatcher>(N)->getChildNo() << "Type, "
+       << getEnumName(cast<CheckChildTypeMatcher>(N)->getType()) << ",\n";
+    return 2;
+      
+  case Matcher::CheckInteger: {
+    OS << "OPC_CheckInteger, ";
+    unsigned Bytes=1+EmitVBRValue(cast<CheckIntegerMatcher>(N)->getValue(), OS);
+    OS << '\n';
+    return Bytes;
+  }
+  case Matcher::CheckCondCode:
     OS << "OPC_CheckCondCode, ISD::"
-       << cast<CheckCondCodeMatcherNode>(N)->getCondCodeName() << ",\n";
+       << cast<CheckCondCodeMatcher>(N)->getCondCodeName() << ",\n";
     return 2;
       
-  case MatcherNode::CheckValueType:
+  case Matcher::CheckValueType:
     OS << "OPC_CheckValueType, MVT::"
-       << cast<CheckValueTypeMatcherNode>(N)->getTypeName() << ",\n";
+       << cast<CheckValueTypeMatcher>(N)->getTypeName() << ",\n";
     return 2;
 
-  case MatcherNode::CheckComplexPat:
-    OS << "OPC_CheckComplexPat, 0/*XXX*/,\n";
+  case Matcher::CheckComplexPat: {
+    const CheckComplexPatMatcher *CCPM = cast<CheckComplexPatMatcher>(N);
+    const ComplexPattern &Pattern = CCPM->getPattern();
+    OS << "OPC_CheckComplexPat, /*CP*/" << getComplexPat(Pattern) << ", /*#*/"
+       << CCPM->getMatchNumber() << ',';
+    
+    if (!OmitComments) {
+      OS.PadToColumn(CommentIndent) << "// " << Pattern.getSelectFunc();
+      OS << ":$" << CCPM->getName();
+      for (unsigned i = 0, e = Pattern.getNumOperands(); i != e; ++i)
+        OS << " #" << CCPM->getFirstResult()+i;
+           
+      if (Pattern.hasProperty(SDNPHasChain))
+        OS << " + chain result";
+    }
+    OS << '\n';
+    return 3;
+  }
+      
+  case Matcher::CheckAndImm: {
+    OS << "OPC_CheckAndImm, ";
+    unsigned Bytes=1+EmitVBRValue(cast<CheckAndImmMatcher>(N)->getValue(), OS);
+    OS << '\n';
+    return Bytes;
+  }
+
+  case Matcher::CheckOrImm: {
+    OS << "OPC_CheckOrImm, ";
+    unsigned Bytes = 1+EmitVBRValue(cast<CheckOrImmMatcher>(N)->getValue(), OS);
+    OS << '\n';
+    return Bytes;
+  }
+      
+  case Matcher::CheckFoldableChainNode:
+    OS << "OPC_CheckFoldableChainNode,\n";
+    return 1;
+      
+  case Matcher::EmitInteger: {
+    int64_t Val = cast<EmitIntegerMatcher>(N)->getValue();
+    OS << "OPC_EmitInteger, "
+       << getEnumName(cast<EmitIntegerMatcher>(N)->getVT()) << ", ";
+    unsigned Bytes = 2+EmitVBRValue(Val, OS);
+    OS << '\n';
+    return Bytes;
+  }
+  case Matcher::EmitStringInteger: {
+    const std::string &Val = cast<EmitStringIntegerMatcher>(N)->getValue();
+    // These should always fit into one byte.
+    OS << "OPC_EmitInteger, "
+      << getEnumName(cast<EmitStringIntegerMatcher>(N)->getVT()) << ", "
+      << Val << ",\n";
+    return 3;
+  }
+      
+  case Matcher::EmitRegister:
+    OS << "OPC_EmitRegister, "
+       << getEnumName(cast<EmitRegisterMatcher>(N)->getVT()) << ", ";
+    if (Record *R = cast<EmitRegisterMatcher>(N)->getReg())
+      OS << getQualifiedName(R) << ",\n";
+    else {
+      OS << "0 ";
+      if (!OmitComments)
+        OS << "/*zero_reg*/";
+      OS << ",\n";
+    }
+    return 3;
+      
+  case Matcher::EmitConvertToTarget:
+    OS << "OPC_EmitConvertToTarget, "
+       << cast<EmitConvertToTargetMatcher>(N)->getSlot() << ",\n";
     return 2;
       
-  case MatcherNode::CheckAndImm: {
-    int64_t Val = cast<CheckAndImmMatcherNode>(N)->getValue();
-    OS << "OPC_CheckAndImm" << ClassifyInt(Val) << ", ";
-    return EmitInt(Val, OS)+1;
+  case Matcher::EmitMergeInputChains: {
+    const EmitMergeInputChainsMatcher *MN =
+      cast<EmitMergeInputChainsMatcher>(N);
+    OS << "OPC_EmitMergeInputChains, " << MN->getNumNodes() << ", ";
+    for (unsigned i = 0, e = MN->getNumNodes(); i != e; ++i)
+      OS << MN->getNode(i) << ", ";
+    OS << '\n';
+    return 2+MN->getNumNodes();
+  }
+  case Matcher::EmitCopyToReg:
+    OS << "OPC_EmitCopyToReg, "
+       << cast<EmitCopyToRegMatcher>(N)->getSrcSlot() << ", "
+       << getQualifiedName(cast<EmitCopyToRegMatcher>(N)->getDestPhysReg())
+       << ",\n";
+    return 3;
+  case Matcher::EmitNodeXForm: {
+    const EmitNodeXFormMatcher *XF = cast<EmitNodeXFormMatcher>(N);
+    OS << "OPC_EmitNodeXForm, " << getNodeXFormID(XF->getNodeXForm()) << ", "
+       << XF->getSlot() << ',';
+    if (!OmitComments)
+      OS.PadToColumn(CommentIndent) << "// "<<XF->getNodeXForm()->getName();
+    OS <<'\n';
+    return 3;
   }
+      
+  case Matcher::EmitNode:
+  case Matcher::MorphNodeTo: {
+    const EmitNodeMatcherCommon *EN = cast<EmitNodeMatcherCommon>(N);
+    OS << (isa<EmitNodeMatcher>(EN) ? "OPC_EmitNode" : "OPC_MorphNodeTo");
+    OS << ", TARGET_OPCODE(" << EN->getOpcodeName() << "), 0";
+    
+    if (EN->hasChain())   OS << "|OPFL_Chain";
+    if (EN->hasInFlag())  OS << "|OPFL_FlagInput";
+    if (EN->hasOutFlag()) OS << "|OPFL_FlagOutput";
+    if (EN->hasMemRefs()) OS << "|OPFL_MemRefs";
+    if (EN->getNumFixedArityOperands() != -1)
+      OS << "|OPFL_Variadic" << EN->getNumFixedArityOperands();
+    OS << ",\n";
+    
+    OS.PadToColumn(Indent*2+4) << EN->getNumVTs();
+    if (!OmitComments)
+      OS << "/*#VTs*/";
+    OS << ", ";
+    for (unsigned i = 0, e = EN->getNumVTs(); i != e; ++i)
+      OS << getEnumName(EN->getVT(i)) << ", ";
 
-  case MatcherNode::CheckOrImm: {
-    int64_t Val = cast<CheckOrImmMatcherNode>(N)->getValue();
-    OS << "OPC_CheckOrImm" << ClassifyInt(Val) << ", ";
-    return EmitInt(Val, OS)+1;
+    OS << EN->getNumOperands();
+    if (!OmitComments)
+      OS << "/*#Ops*/";
+    OS << ", ";
+    unsigned NumOperandBytes = 0;
+    for (unsigned i = 0, e = EN->getNumOperands(); i != e; ++i)
+      NumOperandBytes += EmitVBRValue(EN->getOperand(i), OS);
+    
+    if (!OmitComments) {
+      // Print the result #'s for EmitNode.
+      if (const EmitNodeMatcher *E = dyn_cast<EmitNodeMatcher>(EN)) {
+        if (unsigned NumResults = EN->getNumVTs()) {
+          OS.PadToColumn(CommentIndent) << "// Results = ";
+          unsigned First = E->getFirstResultSlot();
+          for (unsigned i = 0; i != NumResults; ++i)
+            OS << "#" << First+i << " ";
+        }
+      }
+      OS << '\n';
+
+      if (const MorphNodeToMatcher *SNT = dyn_cast<MorphNodeToMatcher>(N)) {
+        OS.PadToColumn(Indent*2) << "// Src: "
+          << *SNT->getPattern().getSrcPattern() << '\n';
+        OS.PadToColumn(Indent*2) << "// Dst: "
+          << *SNT->getPattern().getDstPattern() << '\n';
+      }
+    } else
+      OS << '\n';
+    
+    return 6+EN->getNumVTs()+NumOperandBytes;
+  }
+  case Matcher::MarkFlagResults: {
+    const MarkFlagResultsMatcher *CFR = cast<MarkFlagResultsMatcher>(N);
+    OS << "OPC_MarkFlagResults, " << CFR->getNumNodes() << ", ";
+    unsigned NumOperandBytes = 0;
+    for (unsigned i = 0, e = CFR->getNumNodes(); i != e; ++i)
+      NumOperandBytes += EmitVBRValue(CFR->getNode(i), OS);
+    OS << '\n';
+    return 2+NumOperandBytes;
+  }
+  case Matcher::CompleteMatch: {
+    const CompleteMatchMatcher *CM = cast<CompleteMatchMatcher>(N);
+    OS << "OPC_CompleteMatch, " << CM->getNumResults() << ", ";
+    unsigned NumResultBytes = 0;
+    for (unsigned i = 0, e = CM->getNumResults(); i != e; ++i)
+      NumResultBytes += EmitVBRValue(CM->getResult(i), OS);
+    OS << '\n';
+    if (!OmitComments) {
+      OS.PadToColumn(Indent*2) << "// Src: "
+        << *CM->getPattern().getSrcPattern() << '\n';
+      OS.PadToColumn(Indent*2) << "// Dst: "
+        << *CM->getPattern().getDstPattern();
+    }
+    OS << '\n';
+    return 2 + NumResultBytes;
   }
   }
   assert(0 && "Unreachable");
   return 0;
 }
 
-/// EmitMatcherAndChildren - Emit the bytes for the specified matcher subtree.
-static unsigned EmitMatcherAndChildren(const MatcherNode *N,
-                                       formatted_raw_ostream &OS,
-                                       unsigned Indent) {
+/// EmitMatcherList - Emit the bytes for the specified matcher subtree.
+unsigned MatcherTableEmitter::
+EmitMatcherList(const Matcher *N, unsigned Indent, unsigned CurrentIdx,
+                formatted_raw_ostream &OS) {
   unsigned Size = 0;
-  while (1) {
-    // Push is a special case since it is binary.
-    if (const PushMatcherNode *PMN = dyn_cast<PushMatcherNode>(N)) {
-      // We need to encode the child and the offset of the failure code before
-      // emitting either of them.  Handle this by buffering the output into a
-      // string while we get the size.
-      SmallString<128> TmpBuf;
-      unsigned ChildSize;
-      {
-        raw_svector_ostream OS(TmpBuf);
-        formatted_raw_ostream FOS(OS);
-        ChildSize = 
-          EmitMatcherAndChildren(cast<PushMatcherNode>(N)->getChild(), FOS,
-                                 Indent+1);
-      }
+  while (N) {
+    if (!OmitComments)
+      OS << "/*" << CurrentIdx << "*/";
+    unsigned MatcherSize = EmitMatcher(N, Indent, CurrentIdx, OS);
+    Size += MatcherSize;
+    CurrentIdx += MatcherSize;
+    
+    // If there are other nodes in this list, iterate to them, otherwise we're
+    // done.
+    N = N->getNext();
+  }
+  return Size;
+}
+
+void MatcherTableEmitter::EmitPredicateFunctions(const CodeGenDAGPatterns &CGP,
+                                                 formatted_raw_ostream &OS) {
+  // Emit pattern predicates.
+  if (!PatternPredicates.empty()) {
+    OS << "bool CheckPatternPredicate(unsigned PredNo) const {\n";
+    OS << "  switch (PredNo) {\n";
+    OS << "  default: assert(0 && \"Invalid predicate in table?\");\n";
+    for (unsigned i = 0, e = PatternPredicates.size(); i != e; ++i)
+      OS << "  case " << i << ": return "  << PatternPredicates[i] << ";\n";
+    OS << "  }\n";
+    OS << "}\n\n";
+  }
+   
+  // Emit Node predicates.
+  // FIXME: Annoyingly, these are stored by name, which we never even emit. Yay?
+  StringMap<TreePattern*> PFsByName;
+  
+  for (CodeGenDAGPatterns::pf_iterator I = CGP.pf_begin(), E = CGP.pf_end();
+       I != E; ++I)
+    PFsByName[I->first->getName()] = I->second;
+  
+  if (!NodePredicates.empty()) {
+    OS << "bool CheckNodePredicate(SDNode *Node, unsigned PredNo) const {\n";
+    OS << "  switch (PredNo) {\n";
+    OS << "  default: assert(0 && \"Invalid predicate in table?\");\n";
+    for (unsigned i = 0, e = NodePredicates.size(); i != e; ++i) {
+      // FIXME: Storing this by name is horrible.
+      TreePattern *P =PFsByName[NodePredicates[i].substr(strlen("Predicate_"))];
+      assert(P && "Unknown name?");
       
-      if (ChildSize > 255) {
-        errs() <<
-          "Tblgen internal error: can't handle predicate this complex yet\n";
-        exit(1);
-      }
+      // Emit the predicate code corresponding to this pattern.
+      std::string Code = P->getRecord()->getValueAsCode("Predicate");
+      assert(!Code.empty() && "No code in this predicate");
+      OS << "  case " << i << ": { // " << NodePredicates[i] << '\n';
+      std::string ClassName;
+      if (P->getOnlyTree()->isLeaf())
+        ClassName = "SDNode";
+      else
+        ClassName =
+          CGP.getSDNodeInfo(P->getOnlyTree()->getOperator()).getSDClassName();
+      if (ClassName == "SDNode")
+        OS << "    SDNode *N = Node;\n";
+      else
+        OS << "    " << ClassName << "*N = cast<" << ClassName << ">(Node);\n";
+      OS << Code << "\n  }\n";
+    }
+    OS << "  }\n";
+    OS << "}\n\n";
+  }
+  
+  // Emit CompletePattern matchers.
+  // FIXME: This should be const.
+  if (!ComplexPatterns.empty()) {
+    OS << "bool CheckComplexPattern(SDNode *Root, SDValue N,\n";
+    OS << "      unsigned PatternNo, SmallVectorImpl<SDValue> &Result) {\n";
+    OS << "  switch (PatternNo) {\n";
+    OS << "  default: assert(0 && \"Invalid pattern # in table?\");\n";
+    for (unsigned i = 0, e = ComplexPatterns.size(); i != e; ++i) {
+      const ComplexPattern &P = *ComplexPatterns[i];
+      unsigned NumOps = P.getNumOperands();
+
+      if (P.hasProperty(SDNPHasChain))
+        ++NumOps;  // Get the chained node too.
       
-      OS.PadToColumn(Indent*2);
-      OS << "OPC_Push, " << ChildSize << ",\n";
-      OS << TmpBuf.str();
+      OS << "  case " << i << ":\n";
+      OS << "    Result.resize(Result.size()+" << NumOps << ");\n";
+      OS << "    return "  << P.getSelectFunc();
+
+      OS << "(Root, N";
+      for (unsigned i = 0; i != NumOps; ++i)
+        OS << ", Result[Result.size()-" << (NumOps-i) << ']';
+      OS << ");\n";
+    }
+    OS << "  }\n";
+    OS << "}\n\n";
+  }
+  
+  
+  // Emit SDNodeXForm handlers.
+  // FIXME: This should be const.
+  if (!NodeXForms.empty()) {
+    OS << "SDValue RunSDNodeXForm(SDValue V, unsigned XFormNo) {\n";
+    OS << "  switch (XFormNo) {\n";
+    OS << "  default: assert(0 && \"Invalid xform # in table?\");\n";
+    
+    // FIXME: The node xform could take SDValue's instead of SDNode*'s.
+    for (unsigned i = 0, e = NodeXForms.size(); i != e; ++i) {
+      const CodeGenDAGPatterns::NodeXForm &Entry =
+        CGP.getSDNodeTransform(NodeXForms[i]);
+      
+      Record *SDNode = Entry.first;
+      const std::string &Code = Entry.second;
       
-      Size += 2 + ChildSize;
+      OS << "  case " << i << ": {  ";
+      if (!OmitComments)
+        OS << "// " << NodeXForms[i]->getName();
+      OS << '\n';
       
-      N = PMN->getFailure();
-      continue;
+      std::string ClassName = CGP.getSDNodeInfo(SDNode).getSDClassName();
+      if (ClassName == "SDNode")
+        OS << "    SDNode *N = V.getNode();\n";
+      else
+        OS << "    " << ClassName << " *N = cast<" << ClassName
+           << ">(V.getNode());\n";
+      OS << Code << "\n  }\n";
     }
+    OS << "  }\n";
+    OS << "}\n\n";
+  }
+}
+
+static void BuildHistogram(const Matcher *M, std::vector<unsigned> &OpcodeFreq){
+  for (; M != 0; M = M->getNext()) {
+    // Count this node.
+    if (unsigned(M->getKind()) >= OpcodeFreq.size())
+      OpcodeFreq.resize(M->getKind()+1);
+    OpcodeFreq[M->getKind()]++;
   
-    Size += EmitMatcher(N, OS, Indent);
+    // Handle recursive nodes.
+    if (const ScopeMatcher *SM = dyn_cast<ScopeMatcher>(M)) {
+      for (unsigned i = 0, e = SM->getNumChildren(); i != e; ++i)
+        BuildHistogram(SM->getChild(i), OpcodeFreq);
+    } else if (const SwitchOpcodeMatcher *SOM = 
+                 dyn_cast<SwitchOpcodeMatcher>(M)) {
+      for (unsigned i = 0, e = SOM->getNumCases(); i != e; ++i)
+        BuildHistogram(SOM->getCaseMatcher(i), OpcodeFreq);
+    } else if (const SwitchTypeMatcher *STM = dyn_cast<SwitchTypeMatcher>(M)) {
+      for (unsigned i = 0, e = STM->getNumCases(); i != e; ++i)
+        BuildHistogram(STM->getCaseMatcher(i), OpcodeFreq);
+    }
+  }
+}
+
+void MatcherTableEmitter::EmitHistogram(const Matcher *M,
+                                        formatted_raw_ostream &OS) {
+  if (OmitComments)
+    return;
+  
+  std::vector<unsigned> OpcodeFreq;
+  BuildHistogram(M, OpcodeFreq);
+  
+  OS << "  // Opcode Histogram:\n";
+  for (unsigned i = 0, e = OpcodeFreq.size(); i != e; ++i) {
+    OS << "  // #";
+    switch ((Matcher::KindTy)i) {
+    case Matcher::Scope: OS << "OPC_Scope"; break; 
+    case Matcher::RecordNode: OS << "OPC_RecordNode"; break; 
+    case Matcher::RecordChild: OS << "OPC_RecordChild"; break;
+    case Matcher::RecordMemRef: OS << "OPC_RecordMemRef"; break;
+    case Matcher::CaptureFlagInput: OS << "OPC_CaptureFlagInput"; break;
+    case Matcher::MoveChild: OS << "OPC_MoveChild"; break;
+    case Matcher::MoveParent: OS << "OPC_MoveParent"; break;
+    case Matcher::CheckSame: OS << "OPC_CheckSame"; break;
+    case Matcher::CheckPatternPredicate:
+      OS << "OPC_CheckPatternPredicate"; break;
+    case Matcher::CheckPredicate: OS << "OPC_CheckPredicate"; break;
+    case Matcher::CheckOpcode: OS << "OPC_CheckOpcode"; break;
+    case Matcher::SwitchOpcode: OS << "OPC_SwitchOpcode"; break;
+    case Matcher::CheckType: OS << "OPC_CheckType"; break;
+    case Matcher::SwitchType: OS << "OPC_SwitchType"; break;
+    case Matcher::CheckChildType: OS << "OPC_CheckChildType"; break;
+    case Matcher::CheckInteger: OS << "OPC_CheckInteger"; break;
+    case Matcher::CheckCondCode: OS << "OPC_CheckCondCode"; break;
+    case Matcher::CheckValueType: OS << "OPC_CheckValueType"; break;
+    case Matcher::CheckComplexPat: OS << "OPC_CheckComplexPat"; break;
+    case Matcher::CheckAndImm: OS << "OPC_CheckAndImm"; break;
+    case Matcher::CheckOrImm: OS << "OPC_CheckOrImm"; break;
+    case Matcher::CheckFoldableChainNode:
+      OS << "OPC_CheckFoldableChainNode"; break;
+    case Matcher::EmitInteger: OS << "OPC_EmitInteger"; break;
+    case Matcher::EmitStringInteger: OS << "OPC_EmitStringInteger"; break;
+    case Matcher::EmitRegister: OS << "OPC_EmitRegister"; break;
+    case Matcher::EmitConvertToTarget: OS << "OPC_EmitConvertToTarget"; break;
+    case Matcher::EmitMergeInputChains: OS << "OPC_EmitMergeInputChains"; break;
+    case Matcher::EmitCopyToReg: OS << "OPC_EmitCopyToReg"; break;
+    case Matcher::EmitNode: OS << "OPC_EmitNode"; break;
+    case Matcher::MorphNodeTo: OS << "OPC_MorphNodeTo"; break;
+    case Matcher::EmitNodeXForm: OS << "OPC_EmitNodeXForm"; break;
+    case Matcher::MarkFlagResults: OS << "OPC_MarkFlagResults"; break;
+    case Matcher::CompleteMatch: OS << "OPC_CompleteMatch"; break;    
+    }
     
-    // If there are children of this node, iterate to them, otherwise we're
-    // done.
-    if (const MatcherNodeWithChild *MNWC = dyn_cast<MatcherNodeWithChild>(N))
-      N = MNWC->getChild();
-    else
-      return Size;
+    OS.PadToColumn(40) << " = " << OpcodeFreq[i] << '\n';
   }
+  OS << '\n';
 }
 
-void llvm::EmitMatcherTable(const MatcherNode *Matcher, raw_ostream &O) {
+
+void llvm::EmitMatcherTable(const Matcher *TheMatcher,
+                            const CodeGenDAGPatterns &CGP, raw_ostream &O) {
   formatted_raw_ostream OS(O);
   
   OS << "// The main instruction selector code.\n";
-  OS << "SDNode *SelectCode2(SDNode *N) {\n";
+  OS << "SDNode *SelectCode(SDNode *N) {\n";
 
+  MatcherTableEmitter MatcherEmitter;
+
+  OS << "  // Opcodes are emitted as 2 bytes, TARGET_OPCODE handles this.\n";
+  OS << "  #define TARGET_OPCODE(X) X & 255, unsigned(X) >> 8\n";
   OS << "  static const unsigned char MatcherTable[] = {\n";
-  unsigned TotalSize = EmitMatcherAndChildren(Matcher, OS, 2);
+  unsigned TotalSize = MatcherEmitter.EmitMatcherList(TheMatcher, 5, 0, OS);
   OS << "    0\n  }; // Total Array size is " << (TotalSize+1) << " bytes\n\n";
- OS << "  return SelectCodeCommon(N, MatcherTable, sizeof(MatcherTable));\n}\n";
+  
+  MatcherEmitter.EmitHistogram(TheMatcher, OS);
+  
+  OS << "  #undef TARGET_OPCODE\n";
+  OS << "  return SelectCodeCommon(N, MatcherTable,sizeof(MatcherTable));\n}\n";
+  OS << '\n';
+  
+  // Next up, emit the function for node and pattern predicates:
+  MatcherEmitter.EmitPredicateFunctions(CGP, OS);
 }
diff --git a/libclamav/c++/llvm/utils/TableGen/DAGISelMatcherGen.cpp b/libclamav/c++/llvm/utils/TableGen/DAGISelMatcherGen.cpp
index afa2587..5488853 100644
--- a/libclamav/c++/llvm/utils/TableGen/DAGISelMatcherGen.cpp
+++ b/libclamav/c++/llvm/utils/TableGen/DAGISelMatcherGen.cpp
@@ -10,9 +10,40 @@
 #include "DAGISelMatcher.h"
 #include "CodeGenDAGPatterns.h"
 #include "Record.h"
+#include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringMap.h"
+#include <utility>
 using namespace llvm;
 
+
+/// getRegisterValueType - Look up and return the ValueType of the specified
+/// register. If the register is a member of multiple register classes which
+/// have different associated types, return MVT::Other.
+static MVT::SimpleValueType getRegisterValueType(Record *R,
+                                                 const CodeGenTarget &T) {
+  bool FoundRC = false;
+  MVT::SimpleValueType VT = MVT::Other;
+  const std::vector<CodeGenRegisterClass> &RCs = T.getRegisterClasses();
+  std::vector<Record*>::const_iterator Element;
+  
+  for (unsigned rc = 0, e = RCs.size(); rc != e; ++rc) {
+    const CodeGenRegisterClass &RC = RCs[rc];
+    if (!std::count(RC.Elements.begin(), RC.Elements.end(), R))
+      continue;
+    
+    if (!FoundRC) {
+      FoundRC = true;
+      VT = RC.getValueTypeNum(0);
+      continue;
+    }
+
+    // If this occurs in multiple register classes, they all have to agree.
+    assert(VT == RC.getValueTypeNum(0));
+  }
+  return VT;
+}
+
+
 namespace {
   class MatcherGen {
     const PatternToMatch &Pattern;
@@ -27,10 +58,39 @@ namespace {
     /// number that they were captured as.  These are biased by 1 to make
     /// insertion easier.
     StringMap<unsigned> VariableMap;
+    
+    /// NextRecordedOperandNo - As we emit opcodes to record matched values in
+    /// the RecordedNodes array, this keeps track of which slot will be next to
+    /// record into.
     unsigned NextRecordedOperandNo;
     
-    MatcherNodeWithChild *Matcher;
-    MatcherNodeWithChild *CurPredicate;
+    /// MatchedChainNodes - This maintains the position in the recorded nodes
+    /// array of all of the recorded input nodes that have chains.
+    SmallVector<unsigned, 2> MatchedChainNodes;
+
+    /// MatchedFlagResultNodes - This maintains the position in the recorded
+    /// nodes array of all of the recorded input nodes that have flag results.
+    SmallVector<unsigned, 2> MatchedFlagResultNodes;
+    
+    /// MatchedComplexPatterns - This maintains a list of all of the
+    /// ComplexPatterns that we need to check.  The patterns are known to have
+    /// names which were recorded.  The second element of each pair is the first
+    /// slot number that the OPC_CheckComplexPat opcode drops the matched
+    /// results into.
+    SmallVector<std::pair<const TreePatternNode*,
+                          unsigned>, 2> MatchedComplexPatterns;
+    
+    /// PhysRegInputs - List list has an entry for each explicitly specified
+    /// physreg input to the pattern.  The first elt is the Register node, the
+    /// second is the recorded slot number the input pattern match saved it in.
+    SmallVector<std::pair<Record*, unsigned>, 2> PhysRegInputs;
+    
+    /// Matcher - This is the top level of the generated matcher, the result.
+    Matcher *TheMatcher;
+    
+    /// CurPredicate - As we emit matcher nodes, this points to the latest check
+    /// which should have future checks stuck into its Next position.
+    Matcher *CurPredicate;
   public:
     MatcherGen(const PatternToMatch &pattern, const CodeGenDAGPatterns &cgp);
     
@@ -38,25 +98,51 @@ namespace {
       delete PatWithNoTypes;
     }
     
-    void EmitMatcherCode();
+    bool EmitMatcherCode(unsigned Variant);
+    void EmitResultCode();
     
-    MatcherNodeWithChild *GetMatcher() const { return Matcher; }
-    MatcherNodeWithChild *GetCurPredicate() const { return CurPredicate; }
+    Matcher *GetMatcher() const { return TheMatcher; }
+    Matcher *GetCurPredicate() const { return CurPredicate; }
   private:
-    void AddMatcherNode(MatcherNodeWithChild *NewNode);
+    void AddMatcher(Matcher *NewNode);
     void InferPossibleTypes();
+    
+    // Matcher Generation.
     void EmitMatchCode(const TreePatternNode *N, TreePatternNode *NodeNoTypes);
     void EmitLeafMatchCode(const TreePatternNode *N);
     void EmitOperatorMatchCode(const TreePatternNode *N,
                                TreePatternNode *NodeNoTypes);
-  };
+    
+    // Result Code Generation.
+    unsigned getNamedArgumentSlot(StringRef Name) {
+      unsigned VarMapEntry = VariableMap[Name];
+      assert(VarMapEntry != 0 &&
+             "Variable referenced but not defined and not caught earlier!");
+      return VarMapEntry-1;
+    }
+
+    /// GetInstPatternNode - Get the pattern for an instruction.
+    const TreePatternNode *GetInstPatternNode(const DAGInstruction &Ins,
+                                              const TreePatternNode *N);
+    
+    void EmitResultOperand(const TreePatternNode *N,
+                           SmallVectorImpl<unsigned> &ResultOps);
+    void EmitResultOfNamedOperand(const TreePatternNode *N,
+                                  SmallVectorImpl<unsigned> &ResultOps);
+    void EmitResultLeafAsOperand(const TreePatternNode *N,
+                                 SmallVectorImpl<unsigned> &ResultOps);
+    void EmitResultInstructionAsOperand(const TreePatternNode *N,
+                                        SmallVectorImpl<unsigned> &ResultOps);
+    void EmitResultSDNodeXFormAsOperand(const TreePatternNode *N,
+                                        SmallVectorImpl<unsigned> &ResultOps);
+    };
   
 } // end anon namespace.
 
 MatcherGen::MatcherGen(const PatternToMatch &pattern,
                        const CodeGenDAGPatterns &cgp)
 : Pattern(pattern), CGP(cgp), NextRecordedOperandNo(0),
-  Matcher(0), CurPredicate(0) {
+  TheMatcher(0), CurPredicate(0) {
   // We need to produce the matcher tree for the patterns source pattern.  To do
   // this we need to match the structure as well as the types.  To do the type
   // matching, we want to figure out the fewest number of type checks we need to
@@ -97,23 +183,40 @@ void MatcherGen::InferPossibleTypes() {
 }
 
 
-/// AddMatcherNode - Add a matcher node to the current graph we're building. 
-void MatcherGen::AddMatcherNode(MatcherNodeWithChild *NewNode) {
+/// AddMatcher - Add a matcher node to the current graph we're building. 
+void MatcherGen::AddMatcher(Matcher *NewNode) {
   if (CurPredicate != 0)
-    CurPredicate->setChild(NewNode);
+    CurPredicate->setNext(NewNode);
   else
-    Matcher = NewNode;
+    TheMatcher = NewNode;
   CurPredicate = NewNode;
 }
 
 
+//===----------------------------------------------------------------------===//
+// Pattern Match Generation
+//===----------------------------------------------------------------------===//
 
 /// EmitLeafMatchCode - Generate matching code for leaf nodes.
 void MatcherGen::EmitLeafMatchCode(const TreePatternNode *N) {
   assert(N->isLeaf() && "Not a leaf?");
+  
+  // If there are node predicates for this node, generate their checks.
+  for (unsigned i = 0, e = N->getPredicateFns().size(); i != e; ++i)
+    AddMatcher(new CheckPredicateMatcher(N->getPredicateFns()[i]));
+  
   // Direct match against an integer constant.
-  if (IntInit *II = dynamic_cast<IntInit*>(N->getLeafValue()))
-    return AddMatcherNode(new CheckIntegerMatcherNode(II->getValue()));
+  if (IntInit *II = dynamic_cast<IntInit*>(N->getLeafValue())) {
+    // If this is the root of the dag we're matching, we emit a redundant opcode
+    // check to ensure that this gets folded into the normal top-level
+    // OpcodeSwitch.
+    if (N == Pattern.getSrcPattern()) {
+      const SDNodeInfo &NI = CGP.getSDNodeInfo(CGP.getSDNodeNamed("imm"));
+      AddMatcher(new CheckOpcodeMatcher(NI));
+    }
+
+    return AddMatcher(new CheckIntegerMatcher(II->getValue()));
+  }
   
   DefInit *DI = dynamic_cast<DefInit*>(N->getLeafValue());
   if (DI == 0) {
@@ -125,21 +228,37 @@ void MatcherGen::EmitLeafMatchCode(const TreePatternNode *N) {
   if (// Handle register references.  Nothing to do here, they always match.
       LeafRec->isSubClassOf("RegisterClass") || 
       LeafRec->isSubClassOf("PointerLikeRegClass") ||
-      LeafRec->isSubClassOf("Register") ||
       // Place holder for SRCVALUE nodes. Nothing to do here.
       LeafRec->getName() == "srcvalue")
     return;
+
+  // If we have a physreg reference like (mul gpr:$src, EAX) then we need to
+  // record the register 
+  if (LeafRec->isSubClassOf("Register")) {
+    AddMatcher(new RecordMatcher("physreg input "+LeafRec->getName(),
+                                 NextRecordedOperandNo));
+    PhysRegInputs.push_back(std::make_pair(LeafRec, NextRecordedOperandNo++));
+    return;
+  }
   
   if (LeafRec->isSubClassOf("ValueType"))
-    return AddMatcherNode(new CheckValueTypeMatcherNode(LeafRec->getName()));
+    return AddMatcher(new CheckValueTypeMatcher(LeafRec->getName()));
   
   if (LeafRec->isSubClassOf("CondCode"))
-    return AddMatcherNode(new CheckCondCodeMatcherNode(LeafRec->getName()));
+    return AddMatcher(new CheckCondCodeMatcher(LeafRec->getName()));
   
   if (LeafRec->isSubClassOf("ComplexPattern")) {
-    // Handle complex pattern.
-    const ComplexPattern &CP = CGP.getComplexPattern(LeafRec);
-    return AddMatcherNode(new CheckComplexPatMatcherNode(CP));
+    // We can't model ComplexPattern uses that don't have their name taken yet.
+    // The OPC_CheckComplexPattern operation implicitly records the results.
+    if (N->getName().empty()) {
+      errs() << "We expect complex pattern uses to have names: " << *N << "\n";
+      exit(1);
+    }
+
+    // Remember this ComplexPattern so that we can emit it after all the other
+    // structural matches are done.
+    MatchedComplexPatterns.push_back(std::make_pair(N, 0));
+    return;
   }
   
   errs() << "Unknown leaf kind: " << *N << "\n";
@@ -163,51 +282,132 @@ void MatcherGen::EmitOperatorMatchCode(const TreePatternNode *N,
   // to handle this.
   if ((N->getOperator()->getName() == "and" || 
        N->getOperator()->getName() == "or") &&
-      N->getChild(1)->isLeaf() && N->getChild(1)->getPredicateFns().empty()) {
+      N->getChild(1)->isLeaf() && N->getChild(1)->getPredicateFns().empty() &&
+      N->getPredicateFns().empty()) {
     if (IntInit *II = dynamic_cast<IntInit*>(N->getChild(1)->getLeafValue())) {
       if (!isPowerOf2_32(II->getValue())) {  // Don't bother with single bits.
+        // If this is at the root of the pattern, we emit a redundant
+        // CheckOpcode so that the following checks get factored properly under
+        // a single opcode check.
+        if (N == Pattern.getSrcPattern())
+          AddMatcher(new CheckOpcodeMatcher(CInfo));
+
+        // Emit the CheckAndImm/CheckOrImm node.
         if (N->getOperator()->getName() == "and")
-          AddMatcherNode(new CheckAndImmMatcherNode(II->getValue()));
+          AddMatcher(new CheckAndImmMatcher(II->getValue()));
         else
-          AddMatcherNode(new CheckOrImmMatcherNode(II->getValue()));
+          AddMatcher(new CheckOrImmMatcher(II->getValue()));
 
         // Match the LHS of the AND as appropriate.
-        AddMatcherNode(new MoveChildMatcherNode(0));
+        AddMatcher(new MoveChildMatcher(0));
         EmitMatchCode(N->getChild(0), NodeNoTypes->getChild(0));
-        AddMatcherNode(new MoveParentMatcherNode());
+        AddMatcher(new MoveParentMatcher());
         return;
       }
     }
   }
   
   // Check that the current opcode lines up.
-  AddMatcherNode(new CheckOpcodeMatcherNode(CInfo.getEnumName()));
+  AddMatcher(new CheckOpcodeMatcher(CInfo));
+  
+  // If there are node predicates for this node, generate their checks.
+  for (unsigned i = 0, e = N->getPredicateFns().size(); i != e; ++i)
+    AddMatcher(new CheckPredicateMatcher(N->getPredicateFns()[i]));
+  
+  
+  // If this node has memory references (i.e. is a load or store), tell the
+  // interpreter to capture them in the memref array.
+  if (N->NodeHasProperty(SDNPMemOperand, CGP))
+    AddMatcher(new RecordMemRefMatcher());
   
   // If this node has a chain, then the chain is operand #0 is the SDNode, and
   // the child numbers of the node are all offset by one.
   unsigned OpNo = 0;
-  if (N->NodeHasProperty(SDNPHasChain, CGP))
+  if (N->NodeHasProperty(SDNPHasChain, CGP)) {
+    // Record the node and remember it in our chained nodes list.
+    AddMatcher(new RecordMatcher("'" + N->getOperator()->getName() +
+                                         "' chained node",
+                                 NextRecordedOperandNo));
+    // Remember all of the input chains our pattern will match.
+    MatchedChainNodes.push_back(NextRecordedOperandNo++);
+    
+    // Don't look at the input chain when matching the tree pattern to the
+    // SDNode.
     OpNo = 1;
 
-  if (N->TreeHasProperty(SDNPHasChain, CGP)) {
-    // FIXME: Handle Chains with multiple uses etc.
-    //         [ld]
+    // If this node is not the root and the subtree underneath it produces a
+    // chain, then the result of matching the node is also produce a chain.
+    // Beyond that, this means that we're also folding (at least) the root node
+    // into the node that produce the chain (for example, matching
+    // "(add reg, (load ptr))" as a add_with_memory on X86).  This is
+    // problematic, if the 'reg' node also uses the load (say, its chain).
+    // Graphically:
+    //
+    //         [LD]
     //         ^  ^
-    //         |  |
-    //        /   \---
-    //      /        [YY]
-    //      |         ^
-    //     [XX]-------|
-  }
+    //         |  \                              DAG's like cheese.
+    //        /    |
+    //       /    [YY]
+    //       |     ^
+    //      [XX]--/
+    //
+    // It would be invalid to fold XX and LD.  In this case, folding the two
+    // nodes together would induce a cycle in the DAG, making it a 'cyclic DAG'
+    // To prevent this, we emit a dynamic check for legality before allowing
+    // this to be folded.
+    //
+    const TreePatternNode *Root = Pattern.getSrcPattern();
+    if (N != Root) {                             // Not the root of the pattern.
+      // If there is a node between the root and this node, then we definitely
+      // need to emit the check.
+      bool NeedCheck = !Root->hasChild(N);
       
-  // FIXME: Handle Flags & .hasOneUse()
+      // If it *is* an immediate child of the root, we can still need a check if
+      // the root SDNode has multiple inputs.  For us, this means that it is an
+      // intrinsic, has multiple operands, or has other inputs like chain or
+      // flag).
+      if (!NeedCheck) {
+        const SDNodeInfo &PInfo = CGP.getSDNodeInfo(Root->getOperator());
+        NeedCheck =
+          Root->getOperator() == CGP.get_intrinsic_void_sdnode() ||
+          Root->getOperator() == CGP.get_intrinsic_w_chain_sdnode() ||
+          Root->getOperator() == CGP.get_intrinsic_wo_chain_sdnode() ||
+          PInfo.getNumOperands() > 1 ||
+          PInfo.hasProperty(SDNPHasChain) ||
+          PInfo.hasProperty(SDNPInFlag) ||
+          PInfo.hasProperty(SDNPOptInFlag);
+      }
+      
+      if (NeedCheck)
+        AddMatcher(new CheckFoldableChainNodeMatcher());
+    }
+  }
+
+  // If this node has an output flag and isn't the root, remember it.
+  if (N->NodeHasProperty(SDNPOutFlag, CGP) && 
+      N != Pattern.getSrcPattern()) {
+    // TODO: This redundantly records nodes with both flags and chains.
+    
+    // Record the node and remember it in our chained nodes list.
+    AddMatcher(new RecordMatcher("'" + N->getOperator()->getName() +
+                                         "' flag output node",
+                                 NextRecordedOperandNo));
+    // Remember all of the nodes with output flags our pattern will match.
+    MatchedFlagResultNodes.push_back(NextRecordedOperandNo++);
+  }
   
+  // If this node is known to have an input flag or if it *might* have an input
+  // flag, capture it as the flag input of the pattern.
+  if (N->NodeHasProperty(SDNPOptInFlag, CGP) ||
+      N->NodeHasProperty(SDNPInFlag, CGP))
+    AddMatcher(new CaptureFlagInputMatcher());
+      
   for (unsigned i = 0, e = N->getNumChildren(); i != e; ++i, ++OpNo) {
     // Get the code suitable for matching this child.  Move to the child, check
     // it then move back to the parent.
-    AddMatcherNode(new MoveChildMatcherNode(i));
+    AddMatcher(new MoveChildMatcher(OpNo));
     EmitMatchCode(N->getChild(i), NodeNoTypes->getChild(i));
-    AddMatcherNode(new MoveParentMatcherNode());
+    AddMatcher(new MoveParentMatcher());
   }
 }
 
@@ -217,70 +417,471 @@ void MatcherGen::EmitMatchCode(const TreePatternNode *N,
   // If N and NodeNoTypes don't agree on a type, then this is a case where we
   // need to do a type check.  Emit the check, apply the tyep to NodeNoTypes and
   // reinfer any correlated types.
+  unsigned NodeType = EEVT::isUnknown;
   if (NodeNoTypes->getExtTypes() != N->getExtTypes()) {
-    AddMatcherNode(new CheckTypeMatcherNode(N->getTypeNum(0)));
+    NodeType = N->getTypeNum(0);
     NodeNoTypes->setTypes(N->getExtTypes());
     InferPossibleTypes();
   }
   
-  
   // If this node has a name associated with it, capture it in VariableMap. If
   // we already saw this in the pattern, emit code to verify dagness.
   if (!N->getName().empty()) {
     unsigned &VarMapEntry = VariableMap[N->getName()];
     if (VarMapEntry == 0) {
+      // If it is a named node, we must emit a 'Record' opcode.
+      AddMatcher(new RecordMatcher("$" + N->getName(), NextRecordedOperandNo));
       VarMapEntry = ++NextRecordedOperandNo;
-      AddMatcherNode(new RecordMatcherNode());
     } else {
       // If we get here, this is a second reference to a specific name.  Since
       // we already have checked that the first reference is valid, we don't
       // have to recursively match it, just check that it's the same as the
       // previously named thing.
-      AddMatcherNode(new CheckSameMatcherNode(VarMapEntry-1));
+      AddMatcher(new CheckSameMatcher(VarMapEntry-1));
       return;
     }
   }
   
-  // If there are node predicates for this node, generate their checks.
-  for (unsigned i = 0, e = N->getPredicateFns().size(); i != e; ++i)
-    AddMatcherNode(new CheckPredicateMatcherNode(N->getPredicateFns()[i]));
-
   if (N->isLeaf())
     EmitLeafMatchCode(N);
   else
     EmitOperatorMatchCode(N, NodeNoTypes);
+  
+  if (NodeType != EEVT::isUnknown)
+    AddMatcher(new CheckTypeMatcher((MVT::SimpleValueType)NodeType));
+
 }
 
-void MatcherGen::EmitMatcherCode() {
+/// EmitMatcherCode - Generate the code that matches the predicate of this
+/// pattern for the specified Variant.  If the variant is invalid this returns
+/// true and does not generate code, if it is valid, it returns false.
+bool MatcherGen::EmitMatcherCode(unsigned Variant) {
+  // If the root of the pattern is a ComplexPattern and if it is specified to
+  // match some number of root opcodes, these are considered to be our variants.
+  // Depending on which variant we're generating code for, emit the root opcode
+  // check.
+  if (const ComplexPattern *CP =
+                   Pattern.getSrcPattern()->getComplexPatternInfo(CGP)) {
+    const std::vector<Record*> &OpNodes = CP->getRootNodes();
+    assert(!OpNodes.empty() &&"Complex Pattern must specify what it can match");
+    if (Variant >= OpNodes.size()) return true;
+    
+    AddMatcher(new CheckOpcodeMatcher(CGP.getSDNodeInfo(OpNodes[Variant])));
+  } else {
+    if (Variant != 0) return true;
+  }
+    
+  // Emit the matcher for the pattern structure and types.
+  EmitMatchCode(Pattern.getSrcPattern(), PatWithNoTypes);
+  
   // If the pattern has a predicate on it (e.g. only enabled when a subtarget
   // feature is around, do the check).
   if (!Pattern.getPredicateCheck().empty())
-    AddMatcherNode(new 
-                 CheckPatternPredicateMatcherNode(Pattern.getPredicateCheck()));
+    AddMatcher(new CheckPatternPredicateMatcher(Pattern.getPredicateCheck()));
   
-  // Emit the matcher for the pattern structure and types.
-  EmitMatchCode(Pattern.getSrcPattern(), PatWithNoTypes);
+  // Now that we've completed the structural type match, emit any ComplexPattern
+  // checks (e.g. addrmode matches).  We emit this after the structural match
+  // because they are generally more expensive to evaluate and more difficult to
+  // factor.
+  for (unsigned i = 0, e = MatchedComplexPatterns.size(); i != e; ++i) {
+    const TreePatternNode *N = MatchedComplexPatterns[i].first;
+    
+    // Remember where the results of this match get stuck.
+    MatchedComplexPatterns[i].second = NextRecordedOperandNo;
+
+    // Get the slot we recorded the value in from the name on the node.
+    unsigned RecNodeEntry = VariableMap[N->getName()];
+    assert(!N->getName().empty() && RecNodeEntry &&
+           "Complex pattern should have a name and slot");
+    --RecNodeEntry;  // Entries in VariableMap are biased.
+    
+    const ComplexPattern &CP =
+      CGP.getComplexPattern(((DefInit*)N->getLeafValue())->getDef());
+    
+    // Emit a CheckComplexPat operation, which does the match (aborting if it
+    // fails) and pushes the matched operands onto the recorded nodes list.
+    AddMatcher(new CheckComplexPatMatcher(CP, RecNodeEntry,
+                                          N->getName(), NextRecordedOperandNo));
+    
+    // Record the right number of operands.
+    NextRecordedOperandNo += CP.getNumOperands();
+    if (CP.hasProperty(SDNPHasChain)) {
+      // If the complex pattern has a chain, then we need to keep track of the
+      // fact that we just recorded a chain input.  The chain input will be
+      // matched as the last operand of the predicate if it was successful.
+      ++NextRecordedOperandNo; // Chained node operand.
+    
+      // It is the last operand recorded.
+      assert(NextRecordedOperandNo > 1 &&
+             "Should have recorded input/result chains at least!");
+      MatchedChainNodes.push_back(NextRecordedOperandNo-1);
+    }
+    
+    // TODO: Complex patterns can't have output flags, if they did, we'd want
+    // to record them.
+  }
+  
+  return false;
 }
 
 
-MatcherNode *llvm::ConvertPatternToMatcher(const PatternToMatch &Pattern,
-                                           const CodeGenDAGPatterns &CGP) {
+//===----------------------------------------------------------------------===//
+// Node Result Generation
+//===----------------------------------------------------------------------===//
+
+void MatcherGen::EmitResultOfNamedOperand(const TreePatternNode *N,
+                                          SmallVectorImpl<unsigned> &ResultOps){
+  assert(!N->getName().empty() && "Operand not named!");
+  
+  // A reference to a complex pattern gets all of the results of the complex
+  // pattern's match.
+  if (const ComplexPattern *CP = N->getComplexPatternInfo(CGP)) {
+    unsigned SlotNo = 0;
+    for (unsigned i = 0, e = MatchedComplexPatterns.size(); i != e; ++i)
+      if (MatchedComplexPatterns[i].first->getName() == N->getName()) {
+        SlotNo = MatchedComplexPatterns[i].second;
+        break;
+      }
+    assert(SlotNo != 0 && "Didn't get a slot number assigned?");
+    
+    // The first slot entry is the node itself, the subsequent entries are the
+    // matched values.
+    for (unsigned i = 0, e = CP->getNumOperands(); i != e; ++i)
+      ResultOps.push_back(SlotNo+i);
+    return;
+  }
+
+  unsigned SlotNo = getNamedArgumentSlot(N->getName());
+
+  // If this is an 'imm' or 'fpimm' node, make sure to convert it to the target
+  // version of the immediate so that it doesn't get selected due to some other
+  // node use.
+  if (!N->isLeaf()) {
+    StringRef OperatorName = N->getOperator()->getName();
+    if (OperatorName == "imm" || OperatorName == "fpimm") {
+      AddMatcher(new EmitConvertToTargetMatcher(SlotNo));
+      ResultOps.push_back(NextRecordedOperandNo++);
+      return;
+    }
+  }
+  
+  ResultOps.push_back(SlotNo);
+}
+
+void MatcherGen::EmitResultLeafAsOperand(const TreePatternNode *N,
+                                         SmallVectorImpl<unsigned> &ResultOps) {
+  assert(N->isLeaf() && "Must be a leaf");
+  
+  if (IntInit *II = dynamic_cast<IntInit*>(N->getLeafValue())) {
+    AddMatcher(new EmitIntegerMatcher(II->getValue(),N->getTypeNum(0)));
+    ResultOps.push_back(NextRecordedOperandNo++);
+    return;
+  }
+  
+  // If this is an explicit register reference, handle it.
+  if (DefInit *DI = dynamic_cast<DefInit*>(N->getLeafValue())) {
+    if (DI->getDef()->isSubClassOf("Register")) {
+      AddMatcher(new EmitRegisterMatcher(DI->getDef(),
+                                                 N->getTypeNum(0)));
+      ResultOps.push_back(NextRecordedOperandNo++);
+      return;
+    }
+    
+    if (DI->getDef()->getName() == "zero_reg") {
+      AddMatcher(new EmitRegisterMatcher(0, N->getTypeNum(0)));
+      ResultOps.push_back(NextRecordedOperandNo++);
+      return;
+    }
+    
+    // Handle a reference to a register class. This is used
+    // in COPY_TO_SUBREG instructions.
+    if (DI->getDef()->isSubClassOf("RegisterClass")) {
+      std::string Value = getQualifiedName(DI->getDef()) + "RegClassID";
+      AddMatcher(new EmitStringIntegerMatcher(Value, MVT::i32));
+      ResultOps.push_back(NextRecordedOperandNo++);
+      return;
+    }
+  }
+  
+  errs() << "unhandled leaf node: \n";
+  N->dump();
+}
+
+/// GetInstPatternNode - Get the pattern for an instruction.
+/// 
+const TreePatternNode *MatcherGen::
+GetInstPatternNode(const DAGInstruction &Inst, const TreePatternNode *N) {
+  const TreePattern *InstPat = Inst.getPattern();
+  
+  // FIXME2?: Assume actual pattern comes before "implicit".
+  TreePatternNode *InstPatNode;
+  if (InstPat)
+    InstPatNode = InstPat->getTree(0);
+  else if (/*isRoot*/ N == Pattern.getDstPattern())
+    InstPatNode = Pattern.getSrcPattern();
+  else
+    return 0;
+  
+  if (InstPatNode && !InstPatNode->isLeaf() &&
+      InstPatNode->getOperator()->getName() == "set")
+    InstPatNode = InstPatNode->getChild(InstPatNode->getNumChildren()-1);
+  
+  return InstPatNode;
+}
+
+void MatcherGen::
+EmitResultInstructionAsOperand(const TreePatternNode *N,
+                               SmallVectorImpl<unsigned> &OutputOps) {
+  Record *Op = N->getOperator();
+  const CodeGenTarget &CGT = CGP.getTargetInfo();
+  CodeGenInstruction &II = CGT.getInstruction(Op->getName());
+  const DAGInstruction &Inst = CGP.getInstruction(Op);
+  
+  // If we can, get the pattern for the instruction we're generating.  We derive
+  // a variety of information from this pattern, such as whether it has a chain.
+  //
+  // FIXME2: This is extremely dubious for several reasons, not the least of
+  // which it gives special status to instructions with patterns that Pat<>
+  // nodes can't duplicate.
+  const TreePatternNode *InstPatNode = GetInstPatternNode(Inst, N);
+
+  // NodeHasChain - Whether the instruction node we're creating takes chains.  
+  bool NodeHasChain = InstPatNode &&
+                      InstPatNode->TreeHasProperty(SDNPHasChain, CGP);
+  
+  bool isRoot = N == Pattern.getDstPattern();
+
+  // TreeHasOutFlag - True if this tree has a flag.
+  bool TreeHasInFlag = false, TreeHasOutFlag = false;
+  if (isRoot) {
+    const TreePatternNode *SrcPat = Pattern.getSrcPattern();
+    TreeHasInFlag = SrcPat->TreeHasProperty(SDNPOptInFlag, CGP) ||
+                    SrcPat->TreeHasProperty(SDNPInFlag, CGP);
+  
+    // FIXME2: this is checking the entire pattern, not just the node in
+    // question, doing this just for the root seems like a total hack.
+    TreeHasOutFlag = SrcPat->TreeHasProperty(SDNPOutFlag, CGP);
+  }
+
+  // NumResults - This is the number of results produced by the instruction in
+  // the "outs" list.
+  unsigned NumResults = Inst.getNumResults();    
+
+  // Loop over all of the operands of the instruction pattern, emitting code
+  // to fill them all in.  The node 'N' usually has number children equal to
+  // the number of input operands of the instruction.  However, in cases
+  // where there are predicate operands for an instruction, we need to fill
+  // in the 'execute always' values.  Match up the node operands to the
+  // instruction operands to do this.
+  SmallVector<unsigned, 8> InstOps;
+  for (unsigned ChildNo = 0, InstOpNo = NumResults, e = II.OperandList.size();
+       InstOpNo != e; ++InstOpNo) {
+    
+    // Determine what to emit for this operand.
+    Record *OperandNode = II.OperandList[InstOpNo].Rec;
+    if ((OperandNode->isSubClassOf("PredicateOperand") ||
+         OperandNode->isSubClassOf("OptionalDefOperand")) &&
+        !CGP.getDefaultOperand(OperandNode).DefaultOps.empty()) {
+      // This is a predicate or optional def operand; emit the
+      // 'default ops' operands.
+      const DAGDefaultOperand &DefaultOp =
+        CGP.getDefaultOperand(II.OperandList[InstOpNo].Rec);
+      for (unsigned i = 0, e = DefaultOp.DefaultOps.size(); i != e; ++i)
+        EmitResultOperand(DefaultOp.DefaultOps[i], InstOps);
+      continue;
+    }
+    
+    // Otherwise this is a normal operand or a predicate operand without
+    // 'execute always'; emit it.
+    EmitResultOperand(N->getChild(ChildNo), InstOps);
+    ++ChildNo;
+  }
+  
+  // If this node has an input flag or explicitly specified input physregs, we
+  // need to add chained and flagged copyfromreg nodes and materialize the flag
+  // input.
+  if (isRoot && !PhysRegInputs.empty()) {
+    // Emit all of the CopyToReg nodes for the input physical registers.  These
+    // occur in patterns like (mul:i8 AL:i8, GR8:i8:$src).
+    for (unsigned i = 0, e = PhysRegInputs.size(); i != e; ++i)
+      AddMatcher(new EmitCopyToRegMatcher(PhysRegInputs[i].second,
+                                                  PhysRegInputs[i].first));
+    // Even if the node has no other flag inputs, the resultant node must be
+    // flagged to the CopyFromReg nodes we just generated.
+    TreeHasInFlag = true;
+  }
+  
+  // Result order: node results, chain, flags
+  
+  // Determine the result types.
+  SmallVector<MVT::SimpleValueType, 4> ResultVTs;
+  if (NumResults != 0 && N->getTypeNum(0) != MVT::isVoid) {
+    // FIXME2: If the node has multiple results, we should add them.  For now,
+    // preserve existing behavior?!
+    ResultVTs.push_back(N->getTypeNum(0));
+  }
+
+  
+  // If this is the root instruction of a pattern that has physical registers in
+  // its result pattern, add output VTs for them.  For example, X86 has:
+  //   (set AL, (mul ...))
+  // This also handles implicit results like:
+  //   (implicit EFLAGS)
+  if (isRoot && Pattern.getDstRegs().size() != 0) {
+    for (unsigned i = 0; i != Pattern.getDstRegs().size(); ++i)
+      if (Pattern.getDstRegs()[i]->isSubClassOf("Register"))
+        ResultVTs.push_back(getRegisterValueType(Pattern.getDstRegs()[i], CGT));
+  }
+
+  // FIXME2: Instead of using the isVariadic flag on the instruction, we should
+  // have an SDNP that indicates variadicism.  The TargetInstrInfo isVariadic
+  // property should be inferred from this when an instruction has a pattern.
+  int NumFixedArityOperands = -1;
+  if (isRoot && II.isVariadic)
+    NumFixedArityOperands = Pattern.getSrcPattern()->getNumChildren();
+  
+  // If this is the root node and any of the nodes matched nodes in the input
+  // pattern have MemRefs in them, have the interpreter collect them and plop
+  // them onto this node.
+  //
+  // FIXME3: This is actively incorrect for result patterns where the root of
+  // the pattern is not the memory reference and is also incorrect when the
+  // result pattern has multiple memory-referencing instructions.  For example,
+  // in the X86 backend, this pattern causes the memrefs to get attached to the
+  // CVTSS2SDrr instead of the MOVSSrm:
+  //
+  //  def : Pat<(extloadf32 addr:$src),
+  //            (CVTSS2SDrr (MOVSSrm addr:$src))>;
+  //
+  bool NodeHasMemRefs =
+    isRoot && Pattern.getSrcPattern()->TreeHasProperty(SDNPMemOperand, CGP);
+
+  AddMatcher(new EmitNodeMatcher(II.Namespace+"::"+II.TheDef->getName(),
+                                 ResultVTs.data(), ResultVTs.size(),
+                                 InstOps.data(), InstOps.size(),
+                                 NodeHasChain, TreeHasInFlag, TreeHasOutFlag,
+                                 NodeHasMemRefs, NumFixedArityOperands,
+                                 NextRecordedOperandNo));
+  
+  // The non-chain and non-flag results of the newly emitted node get recorded.
+  for (unsigned i = 0, e = ResultVTs.size(); i != e; ++i) {
+    if (ResultVTs[i] == MVT::Other || ResultVTs[i] == MVT::Flag) break;
+    OutputOps.push_back(NextRecordedOperandNo++);
+  }
+}
+
+void MatcherGen::
+EmitResultSDNodeXFormAsOperand(const TreePatternNode *N,
+                               SmallVectorImpl<unsigned> &ResultOps) {
+  assert(N->getOperator()->isSubClassOf("SDNodeXForm") && "Not SDNodeXForm?");
+
+  // Emit the operand.
+  SmallVector<unsigned, 8> InputOps;
+  
+  // FIXME2: Could easily generalize this to support multiple inputs and outputs
+  // to the SDNodeXForm.  For now we just support one input and one output like
+  // the old instruction selector.
+  assert(N->getNumChildren() == 1);
+  EmitResultOperand(N->getChild(0), InputOps);
+
+  // The input currently must have produced exactly one result.
+  assert(InputOps.size() == 1 && "Unexpected input to SDNodeXForm");
+
+  AddMatcher(new EmitNodeXFormMatcher(InputOps[0], N->getOperator()));
+  ResultOps.push_back(NextRecordedOperandNo++);
+}
+
+void MatcherGen::EmitResultOperand(const TreePatternNode *N,
+                                   SmallVectorImpl<unsigned> &ResultOps) {
+  // This is something selected from the pattern we matched.
+  if (!N->getName().empty())
+    return EmitResultOfNamedOperand(N, ResultOps);
+
+  if (N->isLeaf())
+    return EmitResultLeafAsOperand(N, ResultOps);
+
+  Record *OpRec = N->getOperator();
+  if (OpRec->isSubClassOf("Instruction"))
+    return EmitResultInstructionAsOperand(N, ResultOps);
+  if (OpRec->isSubClassOf("SDNodeXForm"))
+    return EmitResultSDNodeXFormAsOperand(N, ResultOps);
+  errs() << "Unknown result node to emit code for: " << *N << '\n';
+  throw std::string("Unknown node in result pattern!");
+}
+
+void MatcherGen::EmitResultCode() {
+  // Patterns that match nodes with (potentially multiple) chain inputs have to
+  // merge them together into a token factor.  This informs the generated code
+  // what all the chained nodes are.
+  if (!MatchedChainNodes.empty())
+    AddMatcher(new EmitMergeInputChainsMatcher
+               (MatchedChainNodes.data(), MatchedChainNodes.size()));
+  
+  // Codegen the root of the result pattern, capturing the resulting values.
+  SmallVector<unsigned, 8> Ops;
+  EmitResultOperand(Pattern.getDstPattern(), Ops);
+
+  // At this point, we have however many values the result pattern produces.
+  // However, the input pattern might not need all of these.  If there are
+  // excess values at the end (such as condition codes etc) just lop them off.
+  // This doesn't need to worry about flags or chains, just explicit results.
+  //
+  // FIXME2: This doesn't work because there is currently no way to get an
+  // accurate count of the # results the source pattern sets.  This is because
+  // of the "parallel" construct in X86 land, which looks like this:
+  //
+  //def : Pat<(parallel (X86and_flag GR8:$src1, GR8:$src2),
+  //           (implicit EFLAGS)),
+  //  (AND8rr GR8:$src1, GR8:$src2)>;
+  //
+  // This idiom means to match the two-result node X86and_flag (which is
+  // declared as returning a single result, because we can't match multi-result
+  // nodes yet).  In this case, we would have to know that the input has two
+  // results.  However, mul8r is modelled exactly the same way, but without
+  // implicit defs included.  The fix is to support multiple results directly
+  // and eliminate 'parallel'.
+  //
+  // FIXME2: When this is fixed, we should revert the terrible hack in the
+  // OPC_EmitNode code in the interpreter.
+#if 0
+  const TreePatternNode *Src = Pattern.getSrcPattern();
+  unsigned NumSrcResults = Src->getTypeNum(0) != MVT::isVoid ? 1 : 0;
+  NumSrcResults += Pattern.getDstRegs().size();
+  assert(Ops.size() >= NumSrcResults && "Didn't provide enough results");
+  Ops.resize(NumSrcResults);
+#endif
+
+  // If the matched pattern covers nodes which define a flag result, emit a node
+  // that tells the matcher about them so that it can update their results.
+  if (!MatchedFlagResultNodes.empty())
+    AddMatcher(new MarkFlagResultsMatcher(MatchedFlagResultNodes.data(),
+                                          MatchedFlagResultNodes.size()));
+  
+  AddMatcher(new CompleteMatchMatcher(Ops.data(), Ops.size(), Pattern));
+}
+
+
+/// ConvertPatternToMatcher - Create the matcher for the specified pattern with
+/// the specified variant.  If the variant number is invalid, this returns null.
+Matcher *llvm::ConvertPatternToMatcher(const PatternToMatch &Pattern,
+                                       unsigned Variant,
+                                       const CodeGenDAGPatterns &CGP) {
   MatcherGen Gen(Pattern, CGP);
 
   // Generate the code for the matcher.
-  Gen.EmitMatcherCode();
+  if (Gen.EmitMatcherCode(Variant))
+    return 0;
   
-  // If the match succeeds, then we generate Pattern.
-  EmitNodeMatcherNode *Result = new EmitNodeMatcherNode(Pattern);
+  // FIXME2: Kill extra MoveParent commands at the end of the matcher sequence.
+  // FIXME2: Split result code out to another table, and make the matcher end
+  // with an "Emit <index>" command.  This allows result generation stuff to be
+  // shared and factored?
   
-  // Link it into the pattern.
-  if (MatcherNodeWithChild *Pred = Gen.GetCurPredicate()) {
-    Pred->setChild(Result);
-    return Gen.GetMatcher();
-  }
+  // If the match succeeds, then we generate Pattern.
+  Gen.EmitResultCode();
 
   // Unconditional match.
-  return Result;
+  return Gen.GetMatcher();
 }
 
 
diff --git a/libclamav/c++/llvm/utils/TableGen/DAGISelMatcherOpt.cpp b/libclamav/c++/llvm/utils/TableGen/DAGISelMatcherOpt.cpp
new file mode 100644
index 0000000..dc077a9
--- /dev/null
+++ b/libclamav/c++/llvm/utils/TableGen/DAGISelMatcherOpt.cpp
@@ -0,0 +1,435 @@
+//===- DAGISelMatcherOpt.cpp - Optimize a DAG Matcher ---------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file implements the DAG Matcher optimizer.
+//
+//===----------------------------------------------------------------------===//
+
+#define DEBUG_TYPE "isel-opt"
+#include "DAGISelMatcher.h"
+#include "CodeGenDAGPatterns.h"
+#include "llvm/ADT/DenseSet.h"
+#include "llvm/ADT/StringSet.h"
+#include "llvm/Support/Debug.h"
+#include "llvm/Support/raw_ostream.h"
+#include <vector>
+using namespace llvm;
+
+/// ContractNodes - Turn multiple matcher node patterns like 'MoveChild+Record'
+/// into single compound nodes like RecordChild.
+static void ContractNodes(OwningPtr<Matcher> &MatcherPtr,
+                          const CodeGenDAGPatterns &CGP) {
+  // If we reached the end of the chain, we're done.
+  Matcher *N = MatcherPtr.get();
+  if (N == 0) return;
+  
+  // If we have a scope node, walk down all of the children.
+  if (ScopeMatcher *Scope = dyn_cast<ScopeMatcher>(N)) {
+    for (unsigned i = 0, e = Scope->getNumChildren(); i != e; ++i) {
+      OwningPtr<Matcher> Child(Scope->takeChild(i));
+      ContractNodes(Child, CGP);
+      Scope->resetChild(i, Child.take());
+    }
+    return;
+  }
+  
+  // If we found a movechild node with a node that comes in a 'foochild' form,
+  // transform it.
+  if (MoveChildMatcher *MC = dyn_cast<MoveChildMatcher>(N)) {
+    Matcher *New = 0;
+    if (RecordMatcher *RM = dyn_cast<RecordMatcher>(MC->getNext()))
+      New = new RecordChildMatcher(MC->getChildNo(), RM->getWhatFor(),
+                                   RM->getResultNo());
+    
+    if (CheckTypeMatcher *CT= dyn_cast<CheckTypeMatcher>(MC->getNext()))
+      New = new CheckChildTypeMatcher(MC->getChildNo(), CT->getType());
+    
+    if (New) {
+      // Insert the new node.
+      New->setNext(MatcherPtr.take());
+      MatcherPtr.reset(New);
+      // Remove the old one.
+      MC->setNext(MC->getNext()->takeNext());
+      return ContractNodes(MatcherPtr, CGP);
+    }
+  }
+  
+  // Zap movechild -> moveparent.
+  if (MoveChildMatcher *MC = dyn_cast<MoveChildMatcher>(N))
+    if (MoveParentMatcher *MP = 
+          dyn_cast<MoveParentMatcher>(MC->getNext())) {
+      MatcherPtr.reset(MP->takeNext());
+      return ContractNodes(MatcherPtr, CGP);
+    }
+
+  // Turn EmitNode->MarkFlagResults->CompleteMatch into
+  // MarkFlagResults->EmitNode->CompleteMatch when we can to encourage
+  // MorphNodeTo formation.  This is safe because MarkFlagResults never refers
+  // to the root of the pattern.
+  if (isa<EmitNodeMatcher>(N) && isa<MarkFlagResultsMatcher>(N->getNext()) &&
+      isa<CompleteMatchMatcher>(N->getNext()->getNext())) {
+    // Unlink the two nodes from the list.
+    Matcher *EmitNode = MatcherPtr.take();
+    Matcher *MFR = EmitNode->takeNext();
+    Matcher *Tail = MFR->takeNext();
+        
+    // Relink them.
+    MatcherPtr.reset(MFR);
+    MFR->setNext(EmitNode);
+    EmitNode->setNext(Tail);
+    return ContractNodes(MatcherPtr, CGP);
+  }
+
+  // Turn EmitNode->CompleteMatch into MorphNodeTo if we can.
+  if (EmitNodeMatcher *EN = dyn_cast<EmitNodeMatcher>(N))
+    if (CompleteMatchMatcher *CM =
+          dyn_cast<CompleteMatchMatcher>(EN->getNext())) {
+      // We can only use MorphNodeTo if the result values match up.
+      unsigned RootResultFirst = EN->getFirstResultSlot();
+      bool ResultsMatch = true;
+      for (unsigned i = 0, e = CM->getNumResults(); i != e; ++i)
+        if (CM->getResult(i) != RootResultFirst+i)
+          ResultsMatch = false;
+      
+      // If the selected node defines a subset of the flag/chain results, we
+      // can't use MorphNodeTo.  For example, we can't use MorphNodeTo if the
+      // matched pattern has a chain but the root node doesn't.
+      const PatternToMatch &Pattern = CM->getPattern();
+      
+      if (!EN->hasChain() &&
+          Pattern.getSrcPattern()->NodeHasProperty(SDNPHasChain, CGP))
+        ResultsMatch = false;
+
+      // If the matched node has a flag and the output root doesn't, we can't
+      // use MorphNodeTo.
+      //
+      // NOTE: Strictly speaking, we don't have to check for the flag here
+      // because the code in the pattern generator doesn't handle it right.  We
+      // do it anyway for thoroughness.
+      if (!EN->hasOutFlag() &&
+          Pattern.getSrcPattern()->NodeHasProperty(SDNPOutFlag, CGP))
+        ResultsMatch = false;
+      
+      
+      // If the root result node defines more results than the source root node
+      // *and* has a chain or flag input, then we can't match it because it
+      // would end up replacing the extra result with the chain/flag.
+#if 0
+      if ((EN->hasFlag() || EN->hasChain()) &&
+          EN->getNumNonChainFlagVTs() > ... need to get no results reliably ...)
+        ResultMatch = false;
+#endif
+          
+      if (ResultsMatch) {
+        const SmallVectorImpl<MVT::SimpleValueType> &VTs = EN->getVTList();
+        const SmallVectorImpl<unsigned> &Operands = EN->getOperandList();
+        MatcherPtr.reset(new MorphNodeToMatcher(EN->getOpcodeName(),
+                                                VTs.data(), VTs.size(),
+                                                Operands.data(),Operands.size(),
+                                                EN->hasChain(), EN->hasInFlag(),
+                                                EN->hasOutFlag(),
+                                                EN->hasMemRefs(),
+                                                EN->getNumFixedArityOperands(),
+                                                Pattern));
+        return;
+      }
+
+      // FIXME2: Kill off all the SelectionDAG::SelectNodeTo and getMachineNode
+      // variants.
+    }
+  
+  ContractNodes(N->getNextPtr(), CGP);
+  
+  
+  // If we have a CheckType/CheckChildType/Record node followed by a
+  // CheckOpcode, invert the two nodes.  We prefer to do structural checks
+  // before type checks, as this opens opportunities for factoring on targets
+  // like X86 where many operations are valid on multiple types.
+  if ((isa<CheckTypeMatcher>(N) || isa<CheckChildTypeMatcher>(N) ||
+       isa<RecordMatcher>(N)) &&
+      isa<CheckOpcodeMatcher>(N->getNext())) {
+    // Unlink the two nodes from the list.
+    Matcher *CheckType = MatcherPtr.take();
+    Matcher *CheckOpcode = CheckType->takeNext();
+    Matcher *Tail = CheckOpcode->takeNext();
+    
+    // Relink them.
+    MatcherPtr.reset(CheckOpcode);
+    CheckOpcode->setNext(CheckType);
+    CheckType->setNext(Tail);
+    return ContractNodes(MatcherPtr, CGP);
+  }
+}
+
+/// SinkPatternPredicates - Pattern predicates can be checked at any level of
+/// the matching tree.  The generator dumps them at the top level of the pattern
+/// though, which prevents factoring from being able to see past them.  This
+/// optimization sinks them as far down into the pattern as possible.
+///
+/// Conceptually, we'd like to sink these predicates all the way to the last
+/// matcher predicate in the series.  However, it turns out that some
+/// ComplexPatterns have side effects on the graph, so we really don't want to
+/// run a the complex pattern if the pattern predicate will fail.  For this
+/// reason, we refuse to sink the pattern predicate past a ComplexPattern.
+///
+static void SinkPatternPredicates(OwningPtr<Matcher> &MatcherPtr) {
+  // Recursively scan for a PatternPredicate.
+  // If we reached the end of the chain, we're done.
+  Matcher *N = MatcherPtr.get();
+  if (N == 0) return;
+  
+  // Walk down all members of a scope node.
+  if (ScopeMatcher *Scope = dyn_cast<ScopeMatcher>(N)) {
+    for (unsigned i = 0, e = Scope->getNumChildren(); i != e; ++i) {
+      OwningPtr<Matcher> Child(Scope->takeChild(i));
+      SinkPatternPredicates(Child);
+      Scope->resetChild(i, Child.take());
+    }
+    return;
+  }
+  
+  // If this node isn't a CheckPatternPredicateMatcher we keep scanning until
+  // we find one.
+  CheckPatternPredicateMatcher *CPPM =dyn_cast<CheckPatternPredicateMatcher>(N);
+  if (CPPM == 0)
+    return SinkPatternPredicates(N->getNextPtr());
+  
+  // Ok, we found one, lets try to sink it. Check if we can sink it past the
+  // next node in the chain.  If not, we won't be able to change anything and
+  // might as well bail.
+  if (!CPPM->getNext()->isSafeToReorderWithPatternPredicate())
+    return;
+  
+  // Okay, we know we can sink it past at least one node.  Unlink it from the
+  // chain and scan for the new insertion point.
+  MatcherPtr.take();  // Don't delete CPPM.
+  MatcherPtr.reset(CPPM->takeNext());
+  
+  N = MatcherPtr.get();
+  while (N->getNext()->isSafeToReorderWithPatternPredicate())
+    N = N->getNext();
+  
+  // At this point, we want to insert CPPM after N.
+  CPPM->setNext(N->takeNext());
+  N->setNext(CPPM);
+}
+
+/// FactorNodes - Turn matches like this:
+///   Scope
+///     OPC_CheckType i32
+///       ABC
+///     OPC_CheckType i32
+///       XYZ
+/// into:
+///   OPC_CheckType i32
+///     Scope
+///       ABC
+///       XYZ
+///
+static void FactorNodes(OwningPtr<Matcher> &MatcherPtr) {
+  // If we reached the end of the chain, we're done.
+  Matcher *N = MatcherPtr.get();
+  if (N == 0) return;
+  
+  // If this is not a push node, just scan for one.
+  ScopeMatcher *Scope = dyn_cast<ScopeMatcher>(N);
+  if (Scope == 0)
+    return FactorNodes(N->getNextPtr());
+  
+  // Okay, pull together the children of the scope node into a vector so we can
+  // inspect it more easily.  While we're at it, bucket them up by the hash
+  // code of their first predicate.
+  SmallVector<Matcher*, 32> OptionsToMatch;
+  
+  for (unsigned i = 0, e = Scope->getNumChildren(); i != e; ++i) {
+    // Factor the subexpression.
+    OwningPtr<Matcher> Child(Scope->takeChild(i));
+    FactorNodes(Child);
+    
+    if (Matcher *N = Child.take())
+      OptionsToMatch.push_back(N);
+  }
+  
+  SmallVector<Matcher*, 32> NewOptionsToMatch;
+  
+  // Loop over options to match, merging neighboring patterns with identical
+  // starting nodes into a shared matcher.
+  for (unsigned OptionIdx = 0, e = OptionsToMatch.size(); OptionIdx != e;) {
+    // Find the set of matchers that start with this node.
+    Matcher *Optn = OptionsToMatch[OptionIdx++];
+
+    if (OptionIdx == e) {
+      NewOptionsToMatch.push_back(Optn);
+      continue;
+    }
+    
+    // See if the next option starts with the same matcher.  If the two
+    // neighbors *do* start with the same matcher, we can factor the matcher out
+    // of at least these two patterns.  See what the maximal set we can merge
+    // together is.
+    SmallVector<Matcher*, 8> EqualMatchers;
+    EqualMatchers.push_back(Optn);
+    
+    // Factor all of the known-equal matchers after this one into the same
+    // group.
+    while (OptionIdx != e && OptionsToMatch[OptionIdx]->isEqual(Optn))
+      EqualMatchers.push_back(OptionsToMatch[OptionIdx++]);
+
+    // If we found a non-equal matcher, see if it is contradictory with the
+    // current node.  If so, we know that the ordering relation between the
+    // current sets of nodes and this node don't matter.  Look past it to see if
+    // we can merge anything else into this matching group.
+    unsigned Scan = OptionIdx;
+    while (1) {
+      while (Scan != e && Optn->isContradictory(OptionsToMatch[Scan]))
+        ++Scan;
+      
+      // Ok, we found something that isn't known to be contradictory.  If it is
+      // equal, we can merge it into the set of nodes to factor, if not, we have
+      // to cease factoring.
+      if (Scan == e || !Optn->isEqual(OptionsToMatch[Scan])) break;
+
+      // If is equal after all, add the option to EqualMatchers and remove it
+      // from OptionsToMatch.
+      EqualMatchers.push_back(OptionsToMatch[Scan]);
+      OptionsToMatch.erase(OptionsToMatch.begin()+Scan);
+      --e;
+    }
+      
+    if (Scan != e &&
+        // Don't print it's obvious nothing extra could be merged anyway.
+        Scan+1 != e) {
+      DEBUG(errs() << "Couldn't merge this:\n";
+            Optn->print(errs(), 4);
+            errs() << "into this:\n";
+            OptionsToMatch[Scan]->print(errs(), 4);
+            if (Scan+1 != e)
+              OptionsToMatch[Scan+1]->printOne(errs());
+            if (Scan+2 < e)
+              OptionsToMatch[Scan+2]->printOne(errs());
+            errs() << "\n");
+    }
+    
+    // If we only found one option starting with this matcher, no factoring is
+    // possible.
+    if (EqualMatchers.size() == 1) {
+      NewOptionsToMatch.push_back(EqualMatchers[0]);
+      continue;
+    }
+    
+    // Factor these checks by pulling the first node off each entry and
+    // discarding it.  Take the first one off the first entry to reuse.
+    Matcher *Shared = Optn;
+    Optn = Optn->takeNext();
+    EqualMatchers[0] = Optn;
+
+    // Remove and delete the first node from the other matchers we're factoring.
+    for (unsigned i = 1, e = EqualMatchers.size(); i != e; ++i) {
+      Matcher *Tmp = EqualMatchers[i]->takeNext();
+      delete EqualMatchers[i];
+      EqualMatchers[i] = Tmp;
+    }
+    
+    Shared->setNext(new ScopeMatcher(&EqualMatchers[0], EqualMatchers.size()));
+
+    // Recursively factor the newly created node.
+    FactorNodes(Shared->getNextPtr());
+    
+    NewOptionsToMatch.push_back(Shared);
+  }
+  
+  // If we're down to a single pattern to match, then we don't need this scope
+  // anymore.
+  if (NewOptionsToMatch.size() == 1) {
+    MatcherPtr.reset(NewOptionsToMatch[0]);
+    return;
+  }
+  
+  if (NewOptionsToMatch.empty()) {
+    MatcherPtr.reset(0);
+    return;
+  }
+  
+  // If our factoring failed (didn't achieve anything) see if we can simplify in
+  // other ways.
+  
+  // Check to see if all of the leading entries are now opcode checks.  If so,
+  // we can convert this Scope to be a OpcodeSwitch instead.
+  bool AllOpcodeChecks = true, AllTypeChecks = true;
+  for (unsigned i = 0, e = NewOptionsToMatch.size(); i != e; ++i) {
+    if (!isa<CheckOpcodeMatcher>(NewOptionsToMatch[i])) {
+#if 0
+      if (i > 3 && AllOpcodeChecks) {
+        errs() << "FAILING OPC #" << i << "\n";
+        NewOptionsToMatch[i]->dump();
+      }
+#endif
+      AllOpcodeChecks = false;
+    }
+
+    if (!isa<CheckTypeMatcher>(NewOptionsToMatch[i]) ||
+        // iPTR checks could alias any other case without us knowing, don't
+        // bother with them.
+        cast<CheckTypeMatcher>(NewOptionsToMatch[i])->getType() == MVT::iPTR) {
+#if 0
+      if (i > 3 && AllTypeChecks) {
+        errs() << "FAILING TYPE #" << i << "\n";
+        NewOptionsToMatch[i]->dump();
+      }
+#endif
+      AllTypeChecks = false;
+    }
+  }
+  // TODO: Can also do CheckChildNType.
+  
+  // If all the options are CheckOpcode's, we can form the SwitchOpcode, woot.
+  if (AllOpcodeChecks) {
+    StringSet<> Opcodes;
+    SmallVector<std::pair<const SDNodeInfo*, Matcher*>, 8> Cases;
+    for (unsigned i = 0, e = NewOptionsToMatch.size(); i != e; ++i) {
+      CheckOpcodeMatcher *COM = cast<CheckOpcodeMatcher>(NewOptionsToMatch[i]);
+      assert(Opcodes.insert(COM->getOpcode().getEnumName()) &&
+             "Duplicate opcodes not factored?");
+      Cases.push_back(std::make_pair(&COM->getOpcode(), COM->getNext()));
+    }
+    
+    MatcherPtr.reset(new SwitchOpcodeMatcher(&Cases[0], Cases.size()));
+    return;
+  }
+  
+  // If all the options are CheckType's, we can form the SwitchType, woot.
+  if (AllTypeChecks) {
+    DenseSet<unsigned> Types;
+    SmallVector<std::pair<MVT::SimpleValueType, Matcher*>, 8> Cases;
+    for (unsigned i = 0, e = NewOptionsToMatch.size(); i != e; ++i) {
+      CheckTypeMatcher *CTM = cast<CheckTypeMatcher>(NewOptionsToMatch[i]);
+      assert(Types.insert(CTM->getType()).second &&
+             "Duplicate types not factored?");
+      Cases.push_back(std::make_pair(CTM->getType(), CTM->getNext()));
+    }
+    
+    MatcherPtr.reset(new SwitchTypeMatcher(&Cases[0], Cases.size()));
+    return;
+  }
+  
+
+  // Reassemble the Scope node with the adjusted children.
+  Scope->setNumChildren(NewOptionsToMatch.size());
+  for (unsigned i = 0, e = NewOptionsToMatch.size(); i != e; ++i)
+    Scope->resetChild(i, NewOptionsToMatch[i]);
+}
+
+Matcher *llvm::OptimizeMatcher(Matcher *TheMatcher,
+                               const CodeGenDAGPatterns &CGP) {
+  OwningPtr<Matcher> MatcherPtr(TheMatcher);
+  ContractNodes(MatcherPtr, CGP);
+  SinkPatternPredicates(MatcherPtr);
+  FactorNodes(MatcherPtr);
+  return MatcherPtr.take();
+}
diff --git a/libclamav/c++/llvm/utils/TableGen/InstrEnumEmitter.cpp b/libclamav/c++/llvm/utils/TableGen/InstrEnumEmitter.cpp
index f382d34..d1e7f3d 100644
--- a/libclamav/c++/llvm/utils/TableGen/InstrEnumEmitter.cpp
+++ b/libclamav/c++/llvm/utils/TableGen/InstrEnumEmitter.cpp
@@ -29,7 +29,7 @@ void InstrEnumEmitter::run(raw_ostream &OS) {
   std::string Namespace;
   for (CodeGenTarget::inst_iterator II = Target.inst_begin(), 
        E = Target.inst_end(); II != E; ++II) {
-    if (II->second.Namespace != "TargetInstrInfo") {
+    if (II->second.Namespace != "TargetOpcode") {
       Namespace = II->second.Namespace;
       break;
     }
diff --git a/libclamav/c++/llvm/utils/TableGen/LLVMCConfigurationEmitter.cpp b/libclamav/c++/llvm/utils/TableGen/LLVMCConfigurationEmitter.cpp
index 2abc94b..da2d54f 100644
--- a/libclamav/c++/llvm/utils/TableGen/LLVMCConfigurationEmitter.cpp
+++ b/libclamav/c++/llvm/utils/TableGen/LLVMCConfigurationEmitter.cpp
@@ -43,6 +43,7 @@ const unsigned TabWidth = 4;
 const unsigned Indent1  = TabWidth*1;
 const unsigned Indent2  = TabWidth*2;
 const unsigned Indent3  = TabWidth*3;
+const unsigned Indent4  = TabWidth*4;
 
 // Default help string.
 const char * const DefaultHelpString = "NO HELP MESSAGE PROVIDED";
@@ -229,7 +230,8 @@ namespace OptionDescriptionFlags {
   enum OptionDescriptionFlags { Required = 0x1, Hidden = 0x2,
                                 ReallyHidden = 0x4, Extern = 0x8,
                                 OneOrMore = 0x10, Optional = 0x20,
-                                CommaSeparated = 0x40 };
+                                CommaSeparated = 0x40, ForwardNotSplit = 0x80,
+                                ZeroOrMore = 0x100 };
 }
 
 /// OptionDescription - Represents data contained in a single
@@ -259,6 +261,9 @@ struct OptionDescription {
   /// Merge - Merge two option descriptions.
   void Merge (const OptionDescription& other);
 
+  /// CheckConsistency - Check that the flags are consistent.
+  void CheckConsistency() const;
+
   // Misc convenient getters/setters.
 
   bool isAlias() const;
@@ -271,12 +276,18 @@ struct OptionDescription {
   bool isExtern() const;
   void setExtern();
 
+  bool isForwardNotSplit() const;
+  void setForwardNotSplit();
+
   bool isRequired() const;
   void setRequired();
 
   bool isOneOrMore() const;
   void setOneOrMore();
 
+  bool isZeroOrMore() const;
+  void setZeroOrMore();
+
   bool isOptional() const;
   void setOptional();
 
@@ -297,6 +308,20 @@ struct OptionDescription {
 
 };
 
+void OptionDescription::CheckConsistency() const {
+  unsigned i = 0;
+
+  i += this->isRequired();
+  i += this->isOptional();
+  i += this->isOneOrMore();
+  i += this->isZeroOrMore();
+
+  if (i > 1) {
+    throw "Only one of (required), (optional), (one_or_more) or "
+      "(zero_or_more) properties is allowed!";
+  }
+}
+
 void OptionDescription::Merge (const OptionDescription& other)
 {
   if (other.Type != Type)
@@ -327,6 +352,13 @@ void OptionDescription::setCommaSeparated() {
   Flags |= OptionDescriptionFlags::CommaSeparated;
 }
 
+bool OptionDescription::isForwardNotSplit() const {
+  return Flags & OptionDescriptionFlags::ForwardNotSplit;
+}
+void OptionDescription::setForwardNotSplit() {
+  Flags |= OptionDescriptionFlags::ForwardNotSplit;
+}
+
 bool OptionDescription::isExtern() const {
   return Flags & OptionDescriptionFlags::Extern;
 }
@@ -348,6 +380,13 @@ void OptionDescription::setOneOrMore() {
   Flags |= OptionDescriptionFlags::OneOrMore;
 }
 
+bool OptionDescription::isZeroOrMore() const {
+  return Flags & OptionDescriptionFlags::ZeroOrMore;
+}
+void OptionDescription::setZeroOrMore() {
+  Flags |= OptionDescriptionFlags::ZeroOrMore;
+}
+
 bool OptionDescription::isOptional() const {
   return Flags & OptionDescriptionFlags::Optional;
 }
@@ -582,10 +621,13 @@ public:
       AddHandler("init", &CollectOptionProperties::onInit);
       AddHandler("multi_val", &CollectOptionProperties::onMultiVal);
       AddHandler("one_or_more", &CollectOptionProperties::onOneOrMore);
+      AddHandler("zero_or_more", &CollectOptionProperties::onZeroOrMore);
       AddHandler("really_hidden", &CollectOptionProperties::onReallyHidden);
       AddHandler("required", &CollectOptionProperties::onRequired);
       AddHandler("optional", &CollectOptionProperties::onOptional);
       AddHandler("comma_separated", &CollectOptionProperties::onCommaSeparated);
+      AddHandler("forward_not_split",
+                 &CollectOptionProperties::onForwardNotSplit);
 
       staticMembersInitialized_ = true;
     }
@@ -629,12 +671,18 @@ private:
     optDesc_.setCommaSeparated();
   }
 
+  void onForwardNotSplit (const DagInit& d) {
+    CheckNumberOfArguments(d, 0);
+    if (!optDesc_.isParameter())
+      throw "'forward_not_split' is valid only for parameter options!";
+    optDesc_.setForwardNotSplit();
+  }
+
   void onRequired (const DagInit& d) {
     CheckNumberOfArguments(d, 0);
-    if (optDesc_.isOneOrMore() || optDesc_.isOptional())
-      throw "Only one of (required), (optional) or "
-        "(one_or_more) properties is allowed!";
+
     optDesc_.setRequired();
+    optDesc_.CheckConsistency();
   }
 
   void onInit (const DagInit& d) {
@@ -653,24 +701,31 @@ private:
 
   void onOneOrMore (const DagInit& d) {
     CheckNumberOfArguments(d, 0);
-    if (optDesc_.isRequired() || optDesc_.isOptional())
-      throw "Only one of (required), (optional) or "
-        "(one_or_more) properties is allowed!";
-    if (!OptionType::IsList(optDesc_.Type))
-      llvm::errs() << "Warning: specifying the 'one_or_more' property "
-        "on a non-list option will have no effect.\n";
+
     optDesc_.setOneOrMore();
+    optDesc_.CheckConsistency();
+  }
+
+  void onZeroOrMore (const DagInit& d) {
+    CheckNumberOfArguments(d, 0);
+
+    if (OptionType::IsList(optDesc_.Type))
+      llvm::errs() << "Warning: specifying the 'zero_or_more' property "
+        "on a list option has no effect.\n";
+
+    optDesc_.setZeroOrMore();
+    optDesc_.CheckConsistency();
   }
 
   void onOptional (const DagInit& d) {
     CheckNumberOfArguments(d, 0);
-    if (optDesc_.isRequired() || optDesc_.isOneOrMore())
-      throw "Only one of (required), (optional) or "
-        "(one_or_more) properties is allowed!";
+
     if (!OptionType::IsList(optDesc_.Type))
       llvm::errs() << "Warning: specifying the 'optional' property"
-        "on a non-list option will have no effect.\n";
+        "on a non-list option has no effect.\n";
+
     optDesc_.setOptional();
+    optDesc_.CheckConsistency();
   }
 
   void onMultiVal (const DagInit& d) {
@@ -761,9 +816,12 @@ struct ToolDescription : public RefCountedBase<ToolDescription> {
   Init* CmdLine;
   Init* Actions;
   StrVector InLanguage;
+  std::string InFileOption;
+  std::string OutFileOption;
   std::string OutLanguage;
   std::string OutputSuffix;
   unsigned Flags;
+  const Init* OnEmpty;
 
   // Various boolean properties
   void setSink()      { Flags |= ToolFlags::Sink; }
@@ -773,9 +831,13 @@ struct ToolDescription : public RefCountedBase<ToolDescription> {
 
   // Default ctor here is needed because StringMap can only store
   // DefaultConstructible objects
-  ToolDescription() : CmdLine(0), Actions(0), Flags(0) {}
+  ToolDescription ()
+    : CmdLine(0), Actions(0), OutFileOption("-o"),
+      Flags(0), OnEmpty(0)
+  {}
   ToolDescription (const std::string& n)
-  : Name(n), CmdLine(0), Actions(0), Flags(0)
+    : Name(n), CmdLine(0), Actions(0), OutFileOption("-o"),
+      Flags(0), OnEmpty(0)
   {}
 };
 
@@ -806,12 +868,17 @@ public:
     if (!staticMembersInitialized_) {
 
       AddHandler("actions", &CollectToolProperties::onActions);
-      AddHandler("cmd_line", &CollectToolProperties::onCmdLine);
+      AddHandler("command", &CollectToolProperties::onCommand);
       AddHandler("in_language", &CollectToolProperties::onInLanguage);
       AddHandler("join", &CollectToolProperties::onJoin);
       AddHandler("out_language", &CollectToolProperties::onOutLanguage);
+
+      AddHandler("out_file_option", &CollectToolProperties::onOutFileOption);
+      AddHandler("in_file_option", &CollectToolProperties::onInFileOption);
+
       AddHandler("output_suffix", &CollectToolProperties::onOutputSuffix);
       AddHandler("sink", &CollectToolProperties::onSink);
+      AddHandler("works_on_empty", &CollectToolProperties::onWorksOnEmpty);
 
       staticMembersInitialized_ = true;
     }
@@ -836,7 +903,7 @@ private:
     toolDesc_.Actions = Case;
   }
 
-  void onCmdLine (const DagInit& d) {
+  void onCommand (const DagInit& d) {
     CheckNumberOfArguments(d, 1);
     toolDesc_.CmdLine = d.getArg(0);
   }
@@ -878,6 +945,16 @@ private:
     toolDesc_.OutLanguage = InitPtrToString(d.getArg(0));
   }
 
+  void onOutFileOption (const DagInit& d) {
+    CheckNumberOfArguments(d, 1);
+    toolDesc_.OutFileOption = InitPtrToString(d.getArg(0));
+  }
+
+  void onInFileOption (const DagInit& d) {
+    CheckNumberOfArguments(d, 1);
+    toolDesc_.InFileOption = InitPtrToString(d.getArg(0));
+  }
+
   void onOutputSuffix (const DagInit& d) {
     CheckNumberOfArguments(d, 1);
     toolDesc_.OutputSuffix = InitPtrToString(d.getArg(0));
@@ -888,6 +965,10 @@ private:
     toolDesc_.setSink();
   }
 
+  void onWorksOnEmpty (const DagInit& d) {
+    toolDesc_.OnEmpty = d.getArg(0);
+  }
+
 };
 
 /// CollectToolDescriptions - Gather information about tool properties
@@ -1490,7 +1571,7 @@ public:
 /// EmitCaseConstructHandler - Emit code that handles the 'case'
 /// construct. Takes a function object that should emit code for every case
 /// clause. Implemented on top of WalkCase.
-/// Callback's type is void F(Init* Statement, unsigned IndentLevel,
+/// Callback's type is void F(const Init* Statement, unsigned IndentLevel,
 /// raw_ostream& O).
 /// EmitElseIf parameter controls the type of condition that is emitted ('if
 /// (..) {..} else if (..) {} .. else {..}' vs. 'if (..) {..} if(..)  {..}
@@ -1699,82 +1780,41 @@ void EmitCmdLineVecFill(const Init* CmdLine, const std::string& ToolName,
   if (StrVec.empty())
     throw "Tool '" + ToolName + "' has empty command line!";
 
-  StrVector::const_iterator I = StrVec.begin(), E = StrVec.end();
+  StrVector::const_iterator B = StrVec.begin(), E = StrVec.end();
 
-  // If there is a hook invocation on the place of the first command, skip it.
+  // Emit the command itself.
   assert(!StrVec[0].empty());
+  O.indent(IndentLevel) << "cmd = ";
   if (StrVec[0][0] == '$') {
-    while (I != E && (*I)[0] != ')' )
-      ++I;
-
-    // Skip the ')' symbol.
-    ++I;
+    B = SubstituteSpecialCommands(B, E, IsJoin, O);
+    ++B;
   }
   else {
-    ++I;
+    O << '"' << StrVec[0] << '"';
+    ++B;
   }
+  O << ";\n";
 
-  bool hasINFILE = false;
+  // Go through the command arguments.
+  assert(B <= E);
+  for (; B != E; ++B) {
+    const std::string& cmd = *B;
 
-  for (; I != E; ++I) {
-    const std::string& cmd = *I;
     assert(!cmd.empty());
     O.indent(IndentLevel);
+
     if (cmd.at(0) == '$') {
-      if (cmd == "$INFILE") {
-        hasINFILE = true;
-        if (IsJoin) {
-          O << "for (PathVector::const_iterator B = inFiles.begin()"
-            << ", E = inFiles.end();\n";
-          O.indent(IndentLevel) << "B != E; ++B)\n";
-          O.indent(IndentLevel + Indent1) << "vec.push_back(B->str());\n";
-        }
-        else {
-          O << "vec.push_back(inFile.str());\n";
-        }
-      }
-      else if (cmd == "$OUTFILE") {
-        O << "vec.push_back(\"\");\n";
-        O.indent(IndentLevel) << "out_file_index = vec.size()-1;\n";
-      }
-      else {
-        O << "vec.push_back(";
-        I = SubstituteSpecialCommands(I, E, IsJoin, O);
-        O << ");\n";
-      }
+      O << "vec.push_back(std::make_pair(0, ";
+      B = SubstituteSpecialCommands(B, E, IsJoin, O);
+      O << "));\n";
     }
     else {
-      O << "vec.push_back(\"" << cmd << "\");\n";
+      O << "vec.push_back(std::make_pair(0, \"" << cmd << "\"));\n";
     }
   }
-  if (!hasINFILE)
-    throw "Tool '" + ToolName + "' doesn't take any input!";
 
-  O.indent(IndentLevel) << "cmd = ";
-  if (StrVec[0][0] == '$')
-    SubstituteSpecialCommands(StrVec.begin(), StrVec.end(), IsJoin, O);
-  else
-    O << '"' << StrVec[0] << '"';
-  O << ";\n";
 }
 
-/// EmitCmdLineVecFillCallback - A function object wrapper around
-/// EmitCmdLineVecFill(). Used by EmitGenerateActionMethod() as an
-/// argument to EmitCaseConstructHandler().
-class EmitCmdLineVecFillCallback {
-  bool IsJoin;
-  const std::string& ToolName;
- public:
-  EmitCmdLineVecFillCallback(bool J, const std::string& TN)
-    : IsJoin(J), ToolName(TN) {}
-
-  void operator()(const Init* Statement, unsigned IndentLevel,
-                  raw_ostream& O) const
-  {
-    EmitCmdLineVecFill(Statement, ToolName, IsJoin, IndentLevel, O);
-  }
-};
-
 /// EmitForwardOptionPropertyHandlingCode - Helper function used to
 /// implement EmitActionHandler. Emits code for
 /// handling the (forward) and (forward_as) option properties.
@@ -1789,15 +1829,30 @@ void EmitForwardOptionPropertyHandlingCode (const OptionDescription& D,
 
   switch (D.Type) {
   case OptionType::Switch:
-    O.indent(IndentLevel) << "vec.push_back(\"" << Name << "\");\n";
+    O.indent(IndentLevel)
+      << "vec.push_back(std::make_pair(" << D.GenVariableName()
+      << ".getPosition(), \"" << Name << "\"));\n";
     break;
   case OptionType::Parameter:
-    O.indent(IndentLevel) << "vec.push_back(\"" << Name << "\");\n";
-    O.indent(IndentLevel) << "vec.push_back(" << D.GenVariableName() << ");\n";
+    O.indent(IndentLevel) << "vec.push_back(std::make_pair("
+                          << D.GenVariableName()
+                          <<".getPosition(), \"" << Name;
+
+    if (!D.isForwardNotSplit()) {
+      O << "\"));\n";
+      O.indent(IndentLevel) << "vec.push_back(std::make_pair("
+                            << D.GenVariableName() << ".getPosition(), "
+                            << D.GenVariableName() << "));\n";
+    }
+    else {
+      O << "=\" + " << D.GenVariableName() << "));\n";
+    }
     break;
   case OptionType::Prefix:
-    O.indent(IndentLevel) << "vec.push_back(\"" << Name << "\" + "
-                          << D.GenVariableName() << ");\n";
+    O.indent(IndentLevel) << "vec.push_back(std::make_pair("
+                          << D.GenVariableName() << ".getPosition(), \""
+                          << Name << "\" + "
+                          << D.GenVariableName() << "));\n";
     break;
   case OptionType::PrefixList:
     O.indent(IndentLevel)
@@ -1805,11 +1860,15 @@ void EmitForwardOptionPropertyHandlingCode (const OptionDescription& D,
       << "::iterator B = " << D.GenVariableName() << ".begin(),\n";
     O.indent(IndentLevel)
       << "E = " << D.GenVariableName() << ".end(); B != E;) {\n";
-    O.indent(IndentLevel1) << "vec.push_back(\"" << Name << "\" + " << "*B);\n";
+    O.indent(IndentLevel1) << "unsigned pos = " << D.GenVariableName()
+                           << ".getPosition(B - " << D.GenVariableName()
+                           << ".begin());\n";
+    O.indent(IndentLevel1) << "vec.push_back(std::make_pair(pos, \""
+                           << Name << "\" + " << "*B));\n";
     O.indent(IndentLevel1) << "++B;\n";
 
     for (int i = 1, j = D.MultiVal; i < j; ++i) {
-      O.indent(IndentLevel1) << "vec.push_back(*B);\n";
+      O.indent(IndentLevel1) << "vec.push_back(std::make_pair(pos, *B));\n";
       O.indent(IndentLevel1) << "++B;\n";
     }
 
@@ -1821,10 +1880,14 @@ void EmitForwardOptionPropertyHandlingCode (const OptionDescription& D,
       << D.GenVariableName() << ".begin(),\n";
     O.indent(IndentLevel) << "E = " << D.GenVariableName()
                           << ".end() ; B != E;) {\n";
-    O.indent(IndentLevel1) << "vec.push_back(\"" << Name << "\");\n";
+    O.indent(IndentLevel1) << "unsigned pos = " << D.GenVariableName()
+                           << ".getPosition(B - " << D.GenVariableName()
+                           << ".begin());\n";
+    O.indent(IndentLevel1) << "vec.push_back(std::make_pair(pos, \""
+                           << Name << "\"));\n";
 
     for (int i = 0, j = D.MultiVal; i < j; ++i) {
-      O.indent(IndentLevel1) << "vec.push_back(*B);\n";
+      O.indent(IndentLevel1) << "vec.push_back(std::make_pair(pos, *B));\n";
       O.indent(IndentLevel1) << "++B;\n";
     }
 
@@ -1906,7 +1969,8 @@ class EmitActionHandlersCallback :
   {
     CheckNumberOfArguments(Dag, 1);
     this->EmitHookInvocation(InitPtrToString(Dag.getArg(0)),
-                             "vec.push_back(", ");\n", IndentLevel, O);
+                             "vec.push_back(std::make_pair(65536, ", "));\n",
+                             IndentLevel, O);
   }
 
   void onForward (const DagInit& Dag,
@@ -1936,13 +2000,23 @@ class EmitActionHandlersCallback :
     const OptionDescription& D = OptDescs.FindListOrParameter(Name);
 
     if (D.isParameter()) {
-      O.indent(IndentLevel) << "vec.push_back("
-                            << D.GenVariableName() << ");\n";
+      O.indent(IndentLevel) << "vec.push_back(std::make_pair("
+                            << D.GenVariableName() << ".getPosition(), "
+                            << D.GenVariableName() << "));\n";
     }
     else {
-      O.indent(IndentLevel) << "std::copy(" << D.GenVariableName()
-                            << ".begin(), " << D.GenVariableName()
-                            << ".end(), std::back_inserter(vec));\n";
+      O.indent(IndentLevel) << "for (cl::list<std::string>::iterator B = "
+                            << D.GenVariableName() << ".begin(), \n";
+      O.indent(IndentLevel + Indent1) << " E = " << D.GenVariableName()
+                                      << ".end(); B != E; ++B)\n";
+      O.indent(IndentLevel) << "{\n";
+      O.indent(IndentLevel + Indent1)
+        << "unsigned pos = " << D.GenVariableName()
+        << ".getPosition(B - " << D.GenVariableName()
+        << ".begin());\n";
+      O.indent(IndentLevel + Indent1)
+        << "vec.push_back(std::make_pair(pos, *B));\n";
+      O.indent(IndentLevel) << "}\n";
     }
   }
 
@@ -1954,9 +2028,18 @@ class EmitActionHandlersCallback :
     const std::string& Hook = InitPtrToString(Dag.getArg(1));
     const OptionDescription& D = OptDescs.FindListOrParameter(Name);
 
-    O.indent(IndentLevel) << "vec.push_back(" << "hooks::"
-                          << Hook << "(" << D.GenVariableName()
-                          << (D.isParameter() ? ".c_str()" : "") << "));\n";
+    O.indent(IndentLevel) << "vec.push_back(std::make_pair("
+                          << D.GenVariableName() << ".getPosition("
+                          << (D.isList() ? "0" : "") << "), "
+                          << "hooks::" << Hook << "(" << D.GenVariableName()
+                          << (D.isParameter() ? ".c_str()" : "") << ")));\n";
+  }
+
+  void onNoOutFile (const DagInit& Dag,
+                    unsigned IndentLevel, raw_ostream& O) const
+  {
+    CheckNumberOfArguments(Dag, 0);
+    O.indent(IndentLevel) << "no_out_file = true;\n";
   }
 
   void onOutputSuffix (const DagInit& Dag,
@@ -1995,12 +2078,15 @@ class EmitActionHandlersCallback :
       AddHandler("forward_value", &EmitActionHandlersCallback::onForwardValue);
       AddHandler("forward_transformed_value",
                  &EmitActionHandlersCallback::onForwardTransformedValue);
+      AddHandler("no_out_file",
+                 &EmitActionHandlersCallback::onNoOutFile);
       AddHandler("output_suffix", &EmitActionHandlersCallback::onOutputSuffix);
       AddHandler("stop_compilation",
                  &EmitActionHandlersCallback::onStopCompilation);
       AddHandler("unpack_values",
                  &EmitActionHandlersCallback::onUnpackValues);
 
+
       staticMembersInitialized_ = true;
     }
   }
@@ -2012,58 +2098,6 @@ class EmitActionHandlersCallback :
   }
 };
 
-bool IsOutFileIndexCheckRequiredStr (const Init* CmdLine) {
-  StrVector StrVec;
-  TokenizeCmdLine(InitPtrToString(CmdLine), StrVec);
-
-  for (StrVector::const_iterator I = StrVec.begin(), E = StrVec.end();
-       I != E; ++I) {
-    if (*I == "$OUTFILE")
-      return false;
-  }
-
-  return true;
-}
-
-class IsOutFileIndexCheckRequiredStrCallback {
-  bool* ret_;
-
-public:
-  IsOutFileIndexCheckRequiredStrCallback(bool* ret) : ret_(ret)
-  {}
-
-  void operator()(const Init* CmdLine) {
-    // Ignore nested 'case' DAG.
-    if (typeid(*CmdLine) == typeid(DagInit))
-      return;
-
-    if (IsOutFileIndexCheckRequiredStr(CmdLine))
-      *ret_ = true;
-  }
-
-  void operator()(const DagInit* Test, unsigned, bool) {
-    this->operator()(Test);
-  }
-  void operator()(const Init* Statement, unsigned) {
-    this->operator()(Statement);
-  }
-};
-
-bool IsOutFileIndexCheckRequiredCase (Init* CmdLine) {
-  bool ret = false;
-  WalkCase(CmdLine, Id(), IsOutFileIndexCheckRequiredStrCallback(&ret));
-  return ret;
-}
-
-/// IsOutFileIndexCheckRequired - Should we emit an "out_file_index != -1" check
-/// in EmitGenerateActionMethod() ?
-bool IsOutFileIndexCheckRequired (Init* CmdLine) {
-  if (typeid(*CmdLine) == typeid(StringInit))
-    return IsOutFileIndexCheckRequiredStr(CmdLine);
-  else
-    return IsOutFileIndexCheckRequiredCase(CmdLine);
-}
-
 void EmitGenerateActionMethodHeader(const ToolDescription& D,
                                     bool IsJoin, raw_ostream& O)
 {
@@ -2078,8 +2112,10 @@ void EmitGenerateActionMethodHeader(const ToolDescription& D,
   O.indent(Indent2) << "const LanguageMap& LangMap) const\n";
   O.indent(Indent1) << "{\n";
   O.indent(Indent2) << "std::string cmd;\n";
-  O.indent(Indent2) << "std::vector<std::string> vec;\n";
+  O.indent(Indent2) << "std::string out_file;\n";
+  O.indent(Indent2) << "std::vector<std::pair<unsigned, std::string> > vec;\n";
   O.indent(Indent2) << "bool stop_compilation = !HasChildren;\n";
+  O.indent(Indent2) << "bool no_out_file = false;\n";
   O.indent(Indent2) << "const char* output_suffix = \""
                     << D.OutputSuffix << "\";\n";
 }
@@ -2095,46 +2131,67 @@ void EmitGenerateActionMethod (const ToolDescription& D,
   if (!D.CmdLine)
     throw "Tool " + D.Name + " has no cmd_line property!";
 
-  bool IndexCheckRequired = IsOutFileIndexCheckRequired(D.CmdLine);
-  O.indent(Indent2) << "int out_file_index"
-                    << (IndexCheckRequired ? " = -1" : "")
-                    << ";\n\n";
-
-  // Process the cmd_line property.
-  if (typeid(*D.CmdLine) == typeid(StringInit))
-    EmitCmdLineVecFill(D.CmdLine, D.Name, IsJoin, Indent2, O);
-  else
-    EmitCaseConstructHandler(D.CmdLine, Indent2,
-                             EmitCmdLineVecFillCallback(IsJoin, D.Name),
-                             true, OptDescs, O);
+  // Process the 'command' property.
+  O << '\n';
+  EmitCmdLineVecFill(D.CmdLine, D.Name, IsJoin, Indent2, O);
+  O << '\n';
 
-  // For every understood option, emit handling code.
+  // Process the 'actions' list of this tool.
   if (D.Actions)
     EmitCaseConstructHandler(D.Actions, Indent2,
                              EmitActionHandlersCallback(OptDescs),
                              false, OptDescs, O);
-
   O << '\n';
-  O.indent(Indent2)
-    << "std::string out_file = OutFilename("
-    << (IsJoin ? "sys::Path(),\n" : "inFile,\n");
-  O.indent(Indent3) << "TempDir, stop_compilation, output_suffix).str();\n\n";
 
-  if (IndexCheckRequired)
-    O.indent(Indent2) << "if (out_file_index != -1)\n";
-  O.indent(IndexCheckRequired ? Indent3 : Indent2)
-    << "vec[out_file_index] = out_file;\n";
+  // Input file (s)
+  if (!D.InFileOption.empty()) {
+    O.indent(Indent2)
+      << "vec.push_back(std::make_pair(InputFilenames.getPosition(0), \""
+      << D.InFileOption << "\");\n";
+  }
+
+  if (IsJoin) {
+    O.indent(Indent2)
+      << "for (PathVector::const_iterator B = inFiles.begin(),\n";
+    O.indent(Indent3) << "E = inFiles.end(); B != E; ++B)\n";
+    O.indent(Indent2) << "{\n";
+    O.indent(Indent3) << "vec.push_back(std::make_pair("
+                      << "InputFilenames.getPosition(B - inFiles.begin()), "
+                      << "B->str()));\n";
+    O.indent(Indent2) << "}\n";
+  }
+  else {
+    O.indent(Indent2) << "vec.push_back(std::make_pair("
+                      << "InputFilenames.getPosition(0), inFile.str()));\n";
+  }
+
+  // Output file
+  O.indent(Indent2) << "if (!no_out_file) {\n";
+  if (!D.OutFileOption.empty())
+    O.indent(Indent3) << "vec.push_back(std::make_pair(65536, \""
+                      << D.OutFileOption << "\"));\n";
+
+  O.indent(Indent3) << "out_file = this->OutFilename("
+                    << (IsJoin ? "sys::Path(),\n" : "inFile,\n");
+  O.indent(Indent4) << "TempDir, stop_compilation, output_suffix).str();\n\n";
+  O.indent(Indent3) << "vec.push_back(std::make_pair(65536, out_file));\n";
+
+  O.indent(Indent2) << "}\n\n";
 
   // Handle the Sink property.
   if (D.isSink()) {
     O.indent(Indent2) << "if (!" << SinkOptionName << ".empty()) {\n";
-    O.indent(Indent3) << "vec.insert(vec.end(), "
-                      << SinkOptionName << ".begin(), " << SinkOptionName
-                      << ".end());\n";
+    O.indent(Indent3) << "for (cl::list<std::string>::iterator B = "
+                      << SinkOptionName << ".begin(), E = " << SinkOptionName
+                      << ".end(); B != E; ++B)\n";
+    O.indent(Indent4) << "vec.push_back(std::make_pair(" << SinkOptionName
+                      << ".getPosition(B - " << SinkOptionName
+                      <<  ".begin()), *B));\n";
     O.indent(Indent2) << "}\n";
   }
 
-  O.indent(Indent2) << "return Action(cmd, vec, stop_compilation, out_file);\n";
+  O.indent(Indent2) << "return Action(cmd, this->SortArgs(vec), "
+                    << "stop_compilation, out_file);\n";
   O.indent(Indent1) << "}\n\n";
 }
 
@@ -2194,6 +2251,29 @@ void EmitIsJoinMethod (const ToolDescription& D, raw_ostream& O) {
   O.indent(Indent1) << "}\n\n";
 }
 
+/// EmitWorksOnEmptyCallback - Callback used by EmitWorksOnEmptyMethod in
+/// conjunction with EmitCaseConstructHandler.
+void EmitWorksOnEmptyCallback (const Init* Value,
+                               unsigned IndentLevel, raw_ostream& O) {
+  CheckBooleanConstant(Value);
+  O.indent(IndentLevel) << "return " << Value->getAsString() << ";\n";
+}
+
+/// EmitWorksOnEmptyMethod - Emit the WorksOnEmpty() method for a given Tool
+/// class.
+void EmitWorksOnEmptyMethod (const ToolDescription& D,
+                             const OptionDescriptions& OptDescs,
+                             raw_ostream& O)
+{
+  O.indent(Indent1) << "bool WorksOnEmpty() const {\n";
+  if (D.OnEmpty == 0)
+    O.indent(Indent2) << "return false;\n";
+  else
+    EmitCaseConstructHandler(D.OnEmpty, Indent2, EmitWorksOnEmptyCallback,
+                             /*EmitElseIf = */ true, OptDescs, O);
+  O.indent(Indent1) << "}\n\n";
+}
+
 /// EmitStaticMemberDefinitions - Emit static member definitions for a
 /// given Tool class.
 void EmitStaticMemberDefinitions(const ToolDescription& D, raw_ostream& O) {
@@ -2228,6 +2308,7 @@ void EmitToolClassDefinition (const ToolDescription& D,
   EmitNameMethod(D, O);
   EmitInOutLanguageMethods(D, O);
   EmitIsJoinMethod(D, O);
+  EmitWorksOnEmptyMethod(D, OptDescs, O);
   EmitGenerateActionMethods(D, OptDescs, O);
 
   // Close class definition
@@ -2277,12 +2358,15 @@ void EmitOptionDefinitions (const OptionDescriptions& descs,
       else
         O << ", cl::Required";
     }
-    else if (val.isOneOrMore() && val.isList()) {
-        O << ", cl::OneOrMore";
-    }
-    else if (val.isOptional() && val.isList()) {
+
+    if (val.isOptional())
         O << ", cl::Optional";
-    }
+
+    if (val.isOneOrMore())
+        O << ", cl::OneOrMore";
+
+    if (val.isZeroOrMore())
+        O << ", cl::ZeroOrMore";
 
     if (val.isReallyHidden())
       O << ", cl::ReallyHidden";
@@ -2981,7 +3065,7 @@ void LLVMCConfigurationEmitter::run (raw_ostream &O) {
   CollectPluginData(Records, Data);
   CheckPluginData(Data);
 
-  EmitSourceFileHeader("LLVMC Configuration Library", O);
+  this->EmitSourceFileHeader("LLVMC Configuration Library", O);
   EmitPluginCode(Data, O);
 
   } catch (std::exception& Error) {
diff --git a/libclamav/c++/llvm/utils/TableGen/Record.h b/libclamav/c++/llvm/utils/TableGen/Record.h
index 45f3072..90096e9 100644
--- a/libclamav/c++/llvm/utils/TableGen/Record.h
+++ b/libclamav/c++/llvm/utils/TableGen/Record.h
@@ -1225,6 +1225,10 @@ public:
     ID(LastID++), Name(N), Loc(loc) {}
   ~Record() {}
 
+  
+  static unsigned getNewUID() { return LastID++; }
+    
+    
   unsigned getID() const { return ID; }
 
   const std::string &getName() const { return Name; }
diff --git a/libclamav/c++/llvm/utils/TableGen/X86RecognizableInstr.cpp b/libclamav/c++/llvm/utils/TableGen/X86RecognizableInstr.cpp
index 3843e56..ea78d41 100644
--- a/libclamav/c++/llvm/utils/TableGen/X86RecognizableInstr.cpp
+++ b/libclamav/c++/llvm/utils/TableGen/X86RecognizableInstr.cpp
@@ -282,6 +282,10 @@ RecognizableInstr::filter_ret RecognizableInstr::filter() const {
       IsCodeGenOnly)
     return FILTER_STRONG;
   
+  if (Form == X86Local::MRMInitReg)
+    return FILTER_STRONG;
+
+  
   // Filter out instructions with a LOCK prefix;
   //   prefer forms that do not have the prefix
   if (HasLockPrefix)
@@ -353,9 +357,6 @@ RecognizableInstr::filter_ret RecognizableInstr::filter() const {
   if (AsmString.find("subreg") != AsmString.npos)
     return FILTER_STRONG;
 
-  assert(Form != X86Local::MRMInitReg &&
-         "FORMAT_MRMINITREG instruction not skipped");
-  
   if (HasFROperands && Name.find("MOV") != Name.npos &&
      ((Name.find("2") != Name.npos && Name.find("32") == Name.npos) || 
       (Name.find("to") != Name.npos)))
diff --git a/libclamav/c++/llvm/utils/buildit/GNUmakefile b/libclamav/c++/llvm/utils/buildit/GNUmakefile
index 57aac43..8d8504c 100644
--- a/libclamav/c++/llvm/utils/buildit/GNUmakefile
+++ b/libclamav/c++/llvm/utils/buildit/GNUmakefile
@@ -34,9 +34,9 @@ DSTROOT = $(OBJROOT)/../dst
 
 PREFIX = /usr/local
 
-# Unless assertions are forced on in the GMAKE command line, enable them.
+# Unless assertions are forced on in the GMAKE command line, disable them.
 ifndef ENABLE_ASSERTIONS
-ENABLE_ASSERTIONS := yes
+ENABLE_ASSERTIONS := no
 endif
 
 # Default is optimized build.
diff --git a/libclamav/c++/llvm/utils/git/find-rev b/libclamav/c++/llvm/utils/git/find-rev
new file mode 100755
index 0000000..a6161db
--- /dev/null
+++ b/libclamav/c++/llvm/utils/git/find-rev
@@ -0,0 +1,50 @@
+#!/usr/bin/python
+
+import os, sys, subprocess
+
+def main():
+    from optparse import OptionParser, OptionGroup
+    parser = OptionParser("usage: %prog [options] <repo> <revision>")
+    parser.add_option("", "--dump-section-data", dest="dumpSectionData",
+                      help="Dump the contents of sections",
+                      action="store_true", default=False)    
+    (opts, args) = parser.parse_args()
+
+    if len(args) != 2:
+        parser.error("invalid number of arguments")
+
+    repo,rev = args
+
+    try:
+        rev = int(rev)
+    except:
+        parser.error("invalid revision argument (not an integer)")
+
+    os.chdir(repo)
+    p = subprocess.Popen(['git', 'rev-list', 'git-svn', '--pretty'],
+                         stdout=subprocess.PIPE)
+
+    bestRev = bestCommit = None
+    lastCommit = None
+    for ln in p.stdout:
+        if ln.startswith('commit '):
+            lastCommit = ln.split(' ',2)[1]
+        elif ln.startswith('    git-svn-id: '):
+            _,repo,_ = ln.strip().split(' ')
+            _,lrev = repo.rsplit('@',1)
+            lrev = int(lrev)
+            if lrev<=rev:
+                if bestRev is None or lrev>bestRev:
+                    assert lastCommit
+                    bestCommit = lastCommit
+                    bestRev = lrev
+                    if lrev == rev:
+                        break
+    
+    if bestCommit is not None:
+        print bestCommit
+        sys.exit(0)
+    sys.exit(1)
+
+if __name__=='__main__':
+    main()
diff --git a/libclamav/c++/llvm/utils/lit/lit/ExampleTests/LLVM.InTree/test/site.exp b/libclamav/c++/llvm/utils/lit/lit/ExampleTests/LLVM.InTree/test/site.exp
index 1d9c743..efa839e 100644
--- a/libclamav/c++/llvm/utils/lit/lit/ExampleTests/LLVM.InTree/test/site.exp
+++ b/libclamav/c++/llvm/utils/lit/lit/ExampleTests/LLVM.InTree/test/site.exp
@@ -4,7 +4,6 @@
 set target_triplet "x86_64-apple-darwin10"
 set TARGETS_TO_BUILD "X86 Sparc PowerPC Alpha ARM Mips CellSPU PIC16 XCore MSP430 SystemZ Blackfin CBackend MSIL CppBackend"
 set llvmgcc_langs "c,c++,objc,obj-c++"
-set llvmgcc_version "4.2.1"
 set prcontext "/usr/bin/tclsh8.4 /Volumes/Data/ddunbar/llvm/test/Scripts/prcontext.tcl"
 set llvmtoolsdir "/Users/ddunbar/llvm.obj.64/Debug/bin"
 set llvmlibsdir "/Users/ddunbar/llvm.obj.64/Debug/lib"
@@ -19,7 +18,6 @@ set compile_cxx " /usr/bin/g++ -arch x86_64 -I/Users/ddunbar/llvm.obj.64/include
 set link " /usr/bin/g++ -arch x86_64 -I/Users/ddunbar/llvm.obj.64/include -I/Users/ddunbar/llvm.obj.64/test -I/Volumes/Data/ddunbar/llvm.obj.64/include -I/Volumes/Data/ddunbar/llvm/include -I/Volumes/Data/ddunbar/llvm/test -D_DEBUG -D_GNU_SOURCE -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -g -fno-exceptions -fno-common -Woverloaded-virtual -m64 -pedantic -Wno-long-long -Wall -W -Wno-unused-parameter -Wwrite-strings -g -L/Users/ddunbar/llvm.obj.64/Debug/lib -L/Volumes/Data/ddunbar/llvm.obj.64/Debug/lib "
 set llvmgcc "/Users/ddunbar/llvm-gcc/install/bin/llvm-gcc -m64 "
 set llvmgxx "/Users/ddunbar/llvm-gcc/install/bin/llvm-gcc -m64 "
-set llvmgccmajvers "4"
 set bugpoint_topts "-gcc-tool-args -m64"
 set shlibext ".dylib"
 set ocamlopt "/sw/bin/ocamlopt -cc \"g++ -Wall -D_FILE_OFFSET_BITS=64 -D_REENTRANT\" -I /Users/ddunbar/llvm.obj.64/Debug/lib/ocaml"
diff --git a/libclamav/c++/llvm/utils/lit/lit/ExampleTests/LLVM.OutOfTree/obj/test/site.exp b/libclamav/c++/llvm/utils/lit/lit/ExampleTests/LLVM.OutOfTree/obj/test/site.exp
index 1d9c743..efa839e 100644
--- a/libclamav/c++/llvm/utils/lit/lit/ExampleTests/LLVM.OutOfTree/obj/test/site.exp
+++ b/libclamav/c++/llvm/utils/lit/lit/ExampleTests/LLVM.OutOfTree/obj/test/site.exp
@@ -4,7 +4,6 @@
 set target_triplet "x86_64-apple-darwin10"
 set TARGETS_TO_BUILD "X86 Sparc PowerPC Alpha ARM Mips CellSPU PIC16 XCore MSP430 SystemZ Blackfin CBackend MSIL CppBackend"
 set llvmgcc_langs "c,c++,objc,obj-c++"
-set llvmgcc_version "4.2.1"
 set prcontext "/usr/bin/tclsh8.4 /Volumes/Data/ddunbar/llvm/test/Scripts/prcontext.tcl"
 set llvmtoolsdir "/Users/ddunbar/llvm.obj.64/Debug/bin"
 set llvmlibsdir "/Users/ddunbar/llvm.obj.64/Debug/lib"
@@ -19,7 +18,6 @@ set compile_cxx " /usr/bin/g++ -arch x86_64 -I/Users/ddunbar/llvm.obj.64/include
 set link " /usr/bin/g++ -arch x86_64 -I/Users/ddunbar/llvm.obj.64/include -I/Users/ddunbar/llvm.obj.64/test -I/Volumes/Data/ddunbar/llvm.obj.64/include -I/Volumes/Data/ddunbar/llvm/include -I/Volumes/Data/ddunbar/llvm/test -D_DEBUG -D_GNU_SOURCE -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -g -fno-exceptions -fno-common -Woverloaded-virtual -m64 -pedantic -Wno-long-long -Wall -W -Wno-unused-parameter -Wwrite-strings -g -L/Users/ddunbar/llvm.obj.64/Debug/lib -L/Volumes/Data/ddunbar/llvm.obj.64/Debug/lib "
 set llvmgcc "/Users/ddunbar/llvm-gcc/install/bin/llvm-gcc -m64 "
 set llvmgxx "/Users/ddunbar/llvm-gcc/install/bin/llvm-gcc -m64 "
-set llvmgccmajvers "4"
 set bugpoint_topts "-gcc-tool-args -m64"
 set shlibext ".dylib"
 set ocamlopt "/sw/bin/ocamlopt -cc \"g++ -Wall -D_FILE_OFFSET_BITS=64 -D_REENTRANT\" -I /Users/ddunbar/llvm.obj.64/Debug/lib/ocaml"
diff --git a/libclamav/c++/llvm/utils/lit/lit/TestRunner.py b/libclamav/c++/llvm/utils/lit/lit/TestRunner.py
index 20fbc6c..a7de2b7 100644
--- a/libclamav/c++/llvm/utils/lit/lit/TestRunner.py
+++ b/libclamav/c++/llvm/utils/lit/lit/TestRunner.py
@@ -353,6 +353,8 @@ def isExpectedFail(xfails, xtargets, target_triple):
 
     return True
 
+import re
+
 def parseIntegratedTestScript(test):
     """parseIntegratedTestScript - Scan an LLVM/Clang style integrated test
     script and extract the lines to 'RUN' as well as 'XFAIL' and 'XTARGET'
@@ -385,7 +387,21 @@ def parseIntegratedTestScript(test):
     script = []
     xfails = []
     xtargets = []
+    ignoredAny = False
     for ln in open(sourcepath):
+        conditional = re.search('IF\((.+?)\((.+?)\)\):', ln)
+        if conditional:
+            ln = ln[conditional.end():]
+            condition = conditional.group(1)
+            value = conditional.group(2)
+
+            # Actually test the condition.
+            if condition not in test.config.conditions:
+                return (Test.UNRESOLVED, "unknown condition '"+condition+"'")
+            if not test.config.conditions[condition](value):
+                ignoredAny = True
+                continue
+
         if 'RUN:' in ln:
             # Isolate the command to run.
             index = ln.index('RUN:')
@@ -422,6 +438,8 @@ def parseIntegratedTestScript(test):
 
     # Verify the script contains a run line.
     if not script:
+        if ignoredAny:
+            return (Test.UNSUPPORTED, "Test has only ignored run lines")
         return (Test.UNRESOLVED, "Test has no run line!")
 
     if script[-1][-1] == '\\':
diff --git a/libclamav/c++/llvm/utils/lit/lit/TestingConfig.py b/libclamav/c++/llvm/utils/lit/lit/TestingConfig.py
index 1f5067c..d6f2a4d 100644
--- a/libclamav/c++/llvm/utils/lit/lit/TestingConfig.py
+++ b/libclamav/c++/llvm/utils/lit/lit/TestingConfig.py
@@ -10,6 +10,7 @@ class TestingConfig:
         if config is None:
             # Set the environment based on the command line arguments.
             environment = {
+                'LD_LIBRARY_PATH' : os.environ.get('LD_LIBRARY_PATH',''),
                 'PATH' : os.pathsep.join(litConfig.path +
                                          [os.environ.get('PATH','')]),
                 'PATHEXT' : os.environ.get('PATHEXT',''),
@@ -27,7 +28,8 @@ class TestingConfig:
                                    on_clone = None,
                                    test_exec_root = None,
                                    test_source_root = None,
-                                   excludes = [])
+                                   excludes = [],
+                                   conditions = {})
 
         if os.path.exists(path):
             # FIXME: Improve detection and error reporting of errors in the
@@ -53,7 +55,7 @@ class TestingConfig:
 
     def __init__(self, parent, name, suffixes, test_format,
                  environment, substitutions, unsupported, on_clone,
-                 test_exec_root, test_source_root, excludes):
+                 test_exec_root, test_source_root, excludes, conditions):
         self.parent = parent
         self.name = str(name)
         self.suffixes = set(suffixes)
@@ -65,6 +67,7 @@ class TestingConfig:
         self.test_exec_root = test_exec_root
         self.test_source_root = test_source_root
         self.excludes = set(excludes)
+        self.conditions = dict(conditions)
 
     def clone(self, path):
         # FIXME: Chain implementations?
@@ -74,7 +77,7 @@ class TestingConfig:
                             self.environment, self.substitutions,
                             self.unsupported, self.on_clone,
                             self.test_exec_root, self.test_source_root,
-                            self.excludes)
+                            self.excludes, self.conditions)
         if cfg.on_clone:
             cfg.on_clone(self, cfg, path)
         return cfg
diff --git a/libclamav/c++/llvm/utils/llvm.grm b/libclamav/c++/llvm/utils/llvm.grm
index 86a707a..d391e2a 100644
--- a/libclamav/c++/llvm/utils/llvm.grm
+++ b/libclamav/c++/llvm/utils/llvm.grm
@@ -162,6 +162,7 @@ FuncAttr      ::= noreturn
  | readnone
  | readonly
  | inlinehint
+ | alignstack
  | noinline
  | alwaysinline
  | optsize
diff --git a/libclamav/c++/llvm/utils/vim/llvm.vim b/libclamav/c++/llvm/utils/vim/llvm.vim
index 6e4a207..ffdf711 100644
--- a/libclamav/c++/llvm/utils/vim/llvm.vim
+++ b/libclamav/c++/llvm/utils/vim/llvm.vim
@@ -1,7 +1,7 @@
 " Vim syntax file
 " Language:   llvm
 " Maintainer: The LLVM team, http://llvm.org/
-" Updated:    2003-06-02
+" Version:      $Revision$
 
 if version < 600
   syntax clear
@@ -52,11 +52,12 @@ syn keyword llvmKeyword x86_stdcallcc x86_fastcallcc
 syn keyword llvmKeyword signext zeroext inreg sret nounwind noreturn
 syn keyword llvmKeyword nocapture byval nest readnone readonly noalias
 syn keyword llvmKeyword inlinehint noinline alwaysinline optsize ssp sspreq
-syn keyword llvmKeyword noredzone noimplicitfloat naked
+syn keyword llvmKeyword noredzone noimplicitfloat naked alignstack
 syn keyword llvmKeyword module asm align tail to
 syn keyword llvmKeyword addrspace section alias sideeffect c gc
 syn keyword llvmKeyword target datalayout triple
 syn keyword llvmKeyword blockaddress
+syn keyword llvmKeyword union
 
 " Obsolete keywords.
 syn keyword llvmError  uninitialized implementation
diff --git a/libclamav/c++/llvm/utils/vim/tablegen.vim b/libclamav/c++/llvm/utils/vim/tablegen.vim
index ad35872..3043489 100644
--- a/libclamav/c++/llvm/utils/vim/tablegen.vim
+++ b/libclamav/c++/llvm/utils/vim/tablegen.vim
@@ -1,7 +1,7 @@
 " Vim syntax file
 " Language:   TableGen
 " Maintainer: The LLVM team, http://llvm.org/
-" Updated:    2003-08-11
+" Version:    $Revision$
 
 if version < 600
   syntax clear
diff --git a/libclamav/c++/llvm/utils/vim/vimrc b/libclamav/c++/llvm/utils/vim/vimrc
index 4909f60..8ae3e67 100644
--- a/libclamav/c++/llvm/utils/vim/vimrc
+++ b/libclamav/c++/llvm/utils/vim/vimrc
@@ -1,4 +1,5 @@
 " LLVM coding guidelines conformance for VIM
+" $Revision$
 "
 " Maintainer: The LLVM Team, http://llvm.org
 " WARNING:    Read before you source in all these commands and macros!  Some
@@ -10,17 +11,30 @@
 " It's VIM, not VI
 set nocompatible
 
-" Wrap text at 80 cols
-set textwidth=80
-
 " A tab produces a 2-space indentation
 set softtabstop=2
 set shiftwidth=2
 set expandtab
 
-" Highlight trailing whitespace
+" Highlight trailing whitespace and lines longer than 80 columns.
+highlight LongLine ctermbg=DarkYellow guibg=DarkYellow
 highlight WhitespaceEOL ctermbg=DarkYellow guibg=DarkYellow
-match WhitespaceEOL /\s\+$/
+if v:version >= 702
+  " Lines longer than 80 columns.
+  au BufWinEnter * let w:m0=matchadd('LongLine', '\%>80v.\+', -1)
+
+  " Whitespace at the end of a line. This little dance suppresses
+  " whitespace that has just been typed.
+  au BufWinEnter * let w:m1=matchadd('WhitespaceEOL', '\s\+$', -1)
+  au InsertEnter * call matchdelete(w:m1)
+  au InsertEnter * let w:m2=matchadd('WhitespaceEOL', '\s\+\%#\@<!$', -1)
+  au InsertLeave * call matchdelete(w:m2)
+  au InsertLeave * let w:m1=matchadd('WhitespaceEOL', '\s\+$', -1)
+else
+  au BufRead,BufNewFile * syntax match LongLine /\%>80v.\+/
+  au InsertEnter * syntax match WhitespaceEOL /\s\+\%#\@<!$/
+  au InsertLeave * syntax match WhitespaceEOL /\s\+$/
+endif
 
 " Enable filetype detection
 filetype on
@@ -70,3 +84,10 @@ augroup END
 augroup filetype
   au! BufRead,BufNewFile *.td     set filetype=tablegen
 augroup END
+
+" Additional vim features to optionally uncomment.
+"set showcmd
+"set showmatch
+"set showmode
+"set incsearch
+"set ruler

-- 
Debian repository for ClamAV



More information about the Pkg-clamav-commits mailing list