oota-llvm.git
19 years agoTreat int constants as not requiring a register, since they are almost always
Chris Lattner [Tue, 11 Jan 2005 22:29:12 +0000 (22:29 +0000)]
Treat int constants as not requiring a register, since they are almost always
folded into an instruction.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19486 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoPrint the value types in the nodes of the graph
Chris Lattner [Tue, 11 Jan 2005 22:21:04 +0000 (22:21 +0000)]
Print the value types in the nodes of the graph

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19485 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoadd an assertion, avoid creating copyfromreg/copytoreg pairs that are the
Chris Lattner [Tue, 11 Jan 2005 22:03:46 +0000 (22:03 +0000)]
add an assertion, avoid creating copyfromreg/copytoreg pairs that are the
same for PHI nodes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19484 91177308-0d34-0410-b5e6-96231b3b80d8

19 years ago* Factor a bunch of binary operator cases into shared code.
Chris Lattner [Tue, 11 Jan 2005 21:19:59 +0000 (21:19 +0000)]
* Factor a bunch of binary operator cases into shared code.
* Fold loads into Add, sub, and, or, xor and mul when possible.
* Codegen shl X, 1 as add X, X

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19483 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoClear the whole array, always.
Chris Lattner [Tue, 11 Jan 2005 20:25:26 +0000 (20:25 +0000)]
Clear the whole array, always.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19482 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoNo need to repeat the word `build' since it's under `Build status'
Misha Brukman [Tue, 11 Jan 2005 19:51:24 +0000 (19:51 +0000)]
No need to repeat the word `build' since it's under `Build status'

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19481 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoFold multiplies by 3,5,9 into addressing modes when possible.
Chris Lattner [Tue, 11 Jan 2005 19:37:02 +0000 (19:37 +0000)]
Fold multiplies by 3,5,9 into addressing modes when possible.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19480 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoWe don't always have build errors, so call it `status', not `error'
Misha Brukman [Tue, 11 Jan 2005 18:27:16 +0000 (18:27 +0000)]
We don't always have build errors, so call it `status', not `error'

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19479 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoSquelch optimized warning.
Chris Lattner [Tue, 11 Jan 2005 17:46:49 +0000 (17:46 +0000)]
Squelch optimized warning.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19475 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoFix the documentation for executeAndWait so the argument comments are
Reid Spencer [Tue, 11 Jan 2005 06:37:27 +0000 (06:37 +0000)]
Fix the documentation for executeAndWait so the argument comments are
actually attributed to the arguments by doxygen.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19473 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoInstead of generating stuff like this:
Chris Lattner [Tue, 11 Jan 2005 06:36:20 +0000 (06:36 +0000)]
Instead of generating stuff like this:

        mov %ECX, %EAX
        add %ECX, 32768
        mov %SI, WORD PTR [2*%ECX + l13_prev]

Generate this:

        mov %SI, WORD PTR [2*%ECX + l13_prev + 65536]

This occurs when you have a GEP instruction where an index is
"something + imm".

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19472 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoMake the construction of doxygen documentation a repeatable process
Reid Spencer [Tue, 11 Jan 2005 06:26:27 +0000 (06:26 +0000)]
Make the construction of doxygen documentation a repeatable process

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19469 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoImplement MEMCPY natively in terms of rep movs*
Chris Lattner [Tue, 11 Jan 2005 06:19:26 +0000 (06:19 +0000)]
Implement MEMCPY natively in terms of rep movs*

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19468 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoImplement memset -> rep stos*
Chris Lattner [Tue, 11 Jan 2005 06:14:36 +0000 (06:14 +0000)]
Implement memset -> rep stos*

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19467 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoAnnounce that we don't support mem ops yet.
Chris Lattner [Tue, 11 Jan 2005 05:57:36 +0000 (05:57 +0000)]
Announce that we don't support mem ops yet.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19466 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoTeach legalize to lower MEMSET/MEMCPY/MEMMOVE operations if the target
Chris Lattner [Tue, 11 Jan 2005 05:57:22 +0000 (05:57 +0000)]
Teach legalize to lower MEMSET/MEMCPY/MEMMOVE operations if the target
does not support them.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19465 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoPrint new operations.
Chris Lattner [Tue, 11 Jan 2005 05:57:01 +0000 (05:57 +0000)]
Print new operations.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19464 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoTurn memset/memcpy/memmove into the corresponding operations.
Chris Lattner [Tue, 11 Jan 2005 05:56:49 +0000 (05:56 +0000)]
Turn memset/memcpy/memmove into the corresponding operations.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19463 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoAdd MEMSET/MEMCPY/MEMMOVE operations. Fix a really bad bug in the vector
Chris Lattner [Tue, 11 Jan 2005 05:56:17 +0000 (05:56 +0000)]
Add MEMSET/MEMCPY/MEMMOVE operations.  Fix a really bad bug in the vector
SDNode ctor.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19462 91177308-0d34-0410-b5e6-96231b3b80d8

19 years ago* Add the use of LOADABLE_MODULE=1 in the makefile example
Reid Spencer [Tue, 11 Jan 2005 05:16:23 +0000 (05:16 +0000)]
* Add the use of LOADABLE_MODULE=1 in the makefile example
* Change the names of the resulting module to Hello instead of libHello
* Change lib/Debug -> Debug/lib per new makefile implementation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19459 91177308-0d34-0410-b5e6-96231b3b80d8

19 years ago* Describe the LOADABLE_MODULE feature
Reid Spencer [Tue, 11 Jan 2005 05:12:54 +0000 (05:12 +0000)]
* Describe the LOADABLE_MODULE feature
* Get rid of non-compliant <font> elements (how did that get in there?)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19458 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoTeach the address selector to make 'reg+reg' addressing modes.
Chris Lattner [Tue, 11 Jan 2005 04:40:19 +0000 (04:40 +0000)]
Teach the address selector to make 'reg+reg' addressing modes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19457 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoAdd the LOADABLE_MODULE=1 directive to indicate that this shared library is
Reid Spencer [Tue, 11 Jan 2005 04:33:32 +0000 (04:33 +0000)]
Add the LOADABLE_MODULE=1 directive to indicate that this shared library is
intended to be a dlopenable module and not a "plain" shared library.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19456 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoEmit NOT instructions.
Chris Lattner [Tue, 11 Jan 2005 04:31:30 +0000 (04:31 +0000)]
Emit NOT instructions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19455 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoImplement the LOADABLE_MODULE option when building a shared library. This
Reid Spencer [Tue, 11 Jan 2005 04:31:07 +0000 (04:31 +0000)]
Implement the LOADABLE_MODULE option when building a shared library. This
passes the -module option on the libtool command line to ensure that the
shared library being built can be dlopened and dlsym can work on that
module. LOADABLE_MODULE should be sent only in conjunction with the
SHARED_LIBRARY directive. It should generally be used for any module that
is intended to be the target of an LLVM -load option. Note that loadable
modules will not have the lib prefix but otherwise look like shared
libraries. This is per the libtool recommendations and prevents these
special shared libraries from being linked in via -l option to the linker.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19454 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoshift X, 0 -> X
Chris Lattner [Tue, 11 Jan 2005 04:25:13 +0000 (04:25 +0000)]
shift X, 0 -> X

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19453 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoFix a bug emitting branches that broke a lot of programs.
Chris Lattner [Tue, 11 Jan 2005 04:06:27 +0000 (04:06 +0000)]
Fix a bug emitting branches that broke a lot of programs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19452 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoBe more careful where we set ContainsFPCode. We were missing a set in the
Chris Lattner [Tue, 11 Jan 2005 03:50:45 +0000 (03:50 +0000)]
Be more careful where we set ContainsFPCode.  We were missing a set in the
int -> FP casting code.  Note that we don't have to set it for FP operations
that take FP values as operands: whatever produces the FP value will set the
flag.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19451 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoFix a major bug in setcc/cmov folding, where we accidentally
Chris Lattner [Tue, 11 Jan 2005 03:37:59 +0000 (03:37 +0000)]
Fix a major bug in setcc/cmov folding, where we accidentally
inverted the sense of the comparison.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19450 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoTake register pressure into account when we have to decide whether to
Chris Lattner [Tue, 11 Jan 2005 03:11:44 +0000 (03:11 +0000)]
Take register pressure into account when we have to decide whether to
evaluate the LHS or the RHS of an operation first.  This causes good things
to happen.  For example, instead of compiling a loop to this:

.LBBstrength_result7_1: # loopentry
        movl 16(%esp), %edi
        movl (%edi), %edi             ;;; LOAD
        movl (%ecx), %ebx
        movl $2, (%eax,%ebx,4)
        movl (%edx), %ebx
        movl %esi, %ebp
        addl $21, %ebp
        addl $42, %esi
        cmpl $0, %edi                 ;;; USE
        cmovne %esi, %ebp
        cmpl %ebp, %ebx
        movl %ebp, %esi
        jg .LBBstrength_result7_1

We now compile it to this:

.LBBstrength_result7_1: # loopentry
        movl %edi, %ebx
        addl $42, %ebx
        addl $21, %edi
        movl (%ecx), %ebp              ;; LOAD
        cmpl $0, %ebp                  ;; USE
        cmovne %ebx, %edi
        movl (%edx), %ebx
        movl $2, (%eax,%ebx,4)
        movl (%esi), %ebx
        cmpl %edi, %ebx
        jg .LBBstrength_result7_1

Which reduces register pressure enough (in this case) to avoid spilling in the
loop.

As another example, consider the CodeGen/X86/regpressure.ll testcase.  We
used to generate this code for both cases:

regpressure1:
        subl $32, %esp
        movl %esi, 12(%esp)
        movl %edi, 8(%esp)
        movl %ebx, 4(%esp)
        movl %ebp, (%esp)
        movl 36(%esp), %ecx
        movl (%ecx), %eax
        movl 4(%ecx), %edx
        movl %edx, 24(%esp)
        movl 8(%ecx), %edx
        movl %edx, 16(%esp)
        movl 12(%ecx), %edx
        movl 16(%ecx), %esi
        movl 20(%ecx), %edi
        movl 24(%ecx), %ebx
        movl %ebx, 28(%esp)
        movl 28(%ecx), %ebx
        movl 32(%ecx), %ebp
        movl %ebp, 20(%esp)
        movl 36(%ecx), %ecx
        imull 24(%esp), %eax
        imull 16(%esp), %eax
        imull %edx, %eax
        imull %esi, %eax
        imull %edi, %eax
        imull 28(%esp), %eax
        imull %ebx, %eax
        imull 20(%esp), %eax
        imull %ecx, %eax
        movl (%esp), %ebp
        movl 4(%esp), %ebx
        movl 8(%esp), %edi
        movl 12(%esp), %esi
        addl $32, %esp
        ret

This code is basically trying to do all of the loads first, then execute all
of the multiplies.  Because we run out of registers, lots of spill code happens.
We now generate this code for both cases:

regpressure1:
        movl 4(%esp), %ecx
        movl (%ecx), %eax
        movl 4(%ecx), %edx
        imull %edx, %eax
        movl 8(%ecx), %edx
        imull %edx, %eax
        movl 12(%ecx), %edx
        imull %edx, %eax
        movl 16(%ecx), %edx
        imull %edx, %eax
        movl 20(%ecx), %edx
        imull %edx, %eax
        movl 24(%ecx), %edx
        imull %edx, %eax
        movl 28(%ecx), %edx
        imull %edx, %eax
        movl 32(%ecx), %edx
        imull %edx, %eax
        movl 36(%ecx), %ecx
        imull %ecx, %eax
        ret

which is much nicer (when we fold loads into the muls it will be even better).
The old instruction selector used to produce the good code for regpressure1
but not for regpressure2, as it depended on the order of operations in the
LLVM code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19449 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoThe pattern isel is aggressively codegen'ing all of the loads in these
Chris Lattner [Tue, 11 Jan 2005 03:05:03 +0000 (03:05 +0000)]
The pattern isel is aggressively codegen'ing all of the loads in these
functions together at the start of the basic block, causing massive spillage.
The old isel codegened the loads wherever they happened to land, so it
generated good code for the first case, but bad code for the second.

We really want the pattern isel to generate (the same) good code for both.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19448 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoPrint SelectionDAGs bottom up, include extra info in the node labels
Chris Lattner [Tue, 11 Jan 2005 00:34:33 +0000 (00:34 +0000)]
Print SelectionDAGs bottom up, include extra info in the node labels

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19447 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoAdd support for bottom-up graphs.
Chris Lattner [Tue, 11 Jan 2005 00:24:59 +0000 (00:24 +0000)]
Add support for bottom-up graphs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19446 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoAdd a marker for the graph root.
Chris Lattner [Mon, 10 Jan 2005 23:52:04 +0000 (23:52 +0000)]
Add a marker for the graph root.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19445 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoPut the operation name in each node, put the function name on the graph.
Chris Lattner [Mon, 10 Jan 2005 23:26:00 +0000 (23:26 +0000)]
Put the operation name in each node, put the function name on the graph.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19444 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoSplit out SDNode::getOperationName into its own method.
Chris Lattner [Mon, 10 Jan 2005 23:25:25 +0000 (23:25 +0000)]
Split out SDNode::getOperationName into its own method.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19443 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoAdd a helper method.
Chris Lattner [Mon, 10 Jan 2005 23:25:04 +0000 (23:25 +0000)]
Add a helper method.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19442 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoImplement initial selectiondag printing support. This gets us a nice
Chris Lattner [Mon, 10 Jan 2005 23:08:40 +0000 (23:08 +0000)]
Implement initial selectiondag printing support.  This gets us a nice
graph with no labels! :)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19441 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoAdd support for graph operations, and add a viewGraph method to SelectionDAG.
Chris Lattner [Mon, 10 Jan 2005 23:05:53 +0000 (23:05 +0000)]
Add support for graph operations, and add a viewGraph method to SelectionDAG.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19440 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoAdd a helper method
Chris Lattner [Mon, 10 Jan 2005 23:05:07 +0000 (23:05 +0000)]
Add a helper method

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19439 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoFold setcc instructions into selects.
Chris Lattner [Mon, 10 Jan 2005 22:10:13 +0000 (22:10 +0000)]
Fold setcc instructions into selects.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19438 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoAdd conditional moves for the parity flag.
Chris Lattner [Mon, 10 Jan 2005 22:09:33 +0000 (22:09 +0000)]
Add conditional moves for the parity flag.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19437 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoLower to the correct functions. This fixes FreeBench/fourinarow
Chris Lattner [Mon, 10 Jan 2005 21:02:37 +0000 (21:02 +0000)]
Lower to the correct functions.  This fixes FreeBench/fourinarow

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19436 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoImplement 8-bit multiply for X86.
Chris Lattner [Mon, 10 Jan 2005 20:55:48 +0000 (20:55 +0000)]
Implement 8-bit multiply for X86.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19435 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoRework constant pool handling so that function constant pools are no longer
Chris Lattner [Mon, 10 Jan 2005 18:23:22 +0000 (18:23 +0000)]
Rework constant pool handling so that function constant pools are no longer
leaked to the system.  Now they are destroyed with the JITMemoryManager is
destroyed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19434 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoApply feedback from Chris.
Jeff Cohen [Mon, 10 Jan 2005 04:23:32 +0000 (04:23 +0000)]
Apply feedback from Chris.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19432 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoApply feed back from Chris:
Jeff Cohen [Mon, 10 Jan 2005 03:56:27 +0000 (03:56 +0000)]
Apply feed back from Chris:
  1. Rename createLoaderPass to CreateProfileLoaderPass
  2. Opt shouldn't use the pass registered in CodeGen.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19431 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoImplement a couple of more simplifications. This lets us codegen:
Chris Lattner [Mon, 10 Jan 2005 02:03:02 +0000 (02:03 +0000)]
Implement a couple of more simplifications.  This lets us codegen:

int test2(int * P, int* Q, int A, int B) {
        return P+A == P;
}

into:

test2:
        movl 4(%esp), %eax
        movl 12(%esp), %eax
        shll $2, %eax
        cmpl $0, %eax
        sete %al
        movzbl %al, %eax
        ret

instead of:

test2:
        movl 4(%esp), %eax
        movl 12(%esp), %ecx
        leal (%eax,%ecx,4), %ecx
        cmpl %eax, %ecx
        sete %al
        movzbl %al, %eax
        ret

ICC is producing worse code:

test2:
        movl      4(%esp), %eax                                 #8.5
        movl      12(%esp), %edx                                #8.5
        lea       (%edx,%edx), %ecx                             #9.9
        addl      %ecx, %ecx                                    #9.9
        addl      %eax, %ecx                                    #9.9
        cmpl      %eax, %ecx                                    #9.16
        movl      $0, %eax                                      #9.16
        sete      %al                                           #9.16
        ret                                                     #9.16

as is GCC (looks like our old code):

test2:
        movl    4(%esp), %edx
        movl    12(%esp), %eax
        leal    (%edx,%eax,4), %ecx
        cmpl    %edx, %ecx
        sete    %al
        movzbl  %al, %eax
        ret

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19430 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoFix incorrect constant folds, fixing Stepanov after the SHR patch.
Chris Lattner [Mon, 10 Jan 2005 01:16:03 +0000 (01:16 +0000)]
Fix incorrect constant folds, fixing Stepanov after the SHR patch.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19429 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoUpdate System project in Visual Studio to reflect renamed files.
Jeff Cohen [Mon, 10 Jan 2005 00:50:11 +0000 (00:50 +0000)]
Update System project in Visual Studio to reflect renamed files.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19428 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoConstant fold shifts, turning this loop:
Chris Lattner [Mon, 10 Jan 2005 00:07:15 +0000 (00:07 +0000)]
Constant fold shifts, turning this loop:

.LBB_Z5test0PdS__3:     # no_exit.1
        fldl data(,%eax,8)
        fldl 24(%esp)
        faddp %st(1)
        fstl 24(%esp)
        incl %eax
        movl $16000, %ecx
        sarl $3, %ecx
        cmpl %eax, %ecx
        fstpl 16(%esp)
        #FP_REG_KILL
        jg .LBB_Z5test0PdS__3   # no_exit.1

into:

.LBB_Z5test0PdS__3:     # no_exit.1
        fldl data(,%eax,8)
        fldl 24(%esp)
        faddp %st(1)
        fstl 24(%esp)
        incl %eax
        cmpl $2000, %eax
        fstpl 16(%esp)
        #FP_REG_KILL
        jl .LBB_Z5test0PdS__3   # no_exit.1

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19427 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoRename Unix/*.cpp and Win32/*.cpp to have a *.inc suffix so that the silly
Reid Spencer [Sun, 9 Jan 2005 23:29:00 +0000 (23:29 +0000)]
Rename Unix/*.cpp and Win32/*.cpp to have a *.inc suffix so that the silly
gdb debugger doesn't get confused on which file it is reading (the one in
lib/System or the one in lib/System/{Win32,Unix})

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19426 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoAdd some folds for == and != comparisons. This allows us to
Chris Lattner [Sun, 9 Jan 2005 20:52:51 +0000 (20:52 +0000)]
Add some folds for == and != comparisons.  This allows us to
codegen this loop in stepanov:

no_exit.i:              ; preds = %entry, %no_exit.i, %then.i, %_Z5checkd.exit
        %i.0.0 = phi int [ 0, %entry ], [ %i.0.0, %no_exit.i ], [ %inc.0, %_Z5checkd.exit ], [ %inc.012, %then.i ]              ; <int> [#uses=3]
        %indvar = phi uint [ %indvar.next, %no_exit.i ], [ 0, %entry ], [ 0, %then.i ], [ 0, %_Z5checkd.exit ]          ; <uint> [#uses=3]
        %result_addr.i.0 = phi double [ %tmp.4.i.i, %no_exit.i ], [ 0.000000e+00, %entry ], [ 0.000000e+00, %then.i ], [ 0.000000e+00, %_Z5checkd.exit ]          ; <double> [#uses=1]
        %first_addr.0.i.2.rec = cast uint %indvar to int                ; <int> [#uses=1]
        %first_addr.0.i.2 = getelementptr [2000 x double]* %data, int 0, uint %indvar           ; <double*> [#uses=1]
        %inc.i.rec = add int %first_addr.0.i.2.rec, 1           ; <int> [#uses=1]
        %inc.i = getelementptr [2000 x double]* %data, int 0, int %inc.i.rec            ; <double*> [#uses=1]
        %tmp.3.i.i = load double* %first_addr.0.i.2             ; <double> [#uses=1]
        %tmp.4.i.i = add double %result_addr.i.0, %tmp.3.i.i            ; <double> [#uses=2]
        %tmp.2.i = seteq double* %inc.i, getelementptr ([2000 x double]* %data, int 0, int 2000)                ; <bool> [#uses=1]
        %indvar.next = add uint %indvar, 1              ; <uint> [#uses=1]
        br bool %tmp.2.i, label %_Z10accumulateIPddET0_T_S2_S1_.exit, label %no_exit.i

To this:

.LBB_Z4testIPddEvT_S1_T0__1:    # no_exit.i
        fldl data(,%eax,8)
        fldl 16(%esp)
        faddp %st(1)
        fstpl 16(%esp)
        incl %eax
        movl %eax, %ecx
        shll $3, %ecx
        cmpl $16000, %ecx
        #FP_REG_KILL
        jne .LBB_Z4testIPddEvT_S1_T0__1 # no_exit.i

instead of this:

.LBB_Z4testIPddEvT_S1_T0__1:    # no_exit.i
        fldl data(,%eax,8)
        fldl 16(%esp)
        faddp %st(1)
        fstpl 16(%esp)
        incl %eax
        leal data(,%eax,8), %ecx
        leal data+16000, %edx
        cmpl %edx, %ecx
        #FP_REG_KILL
        jne .LBB_Z4testIPddEvT_S1_T0__1 # no_exit.i

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19425 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoAdd last four createXxxPass functions
Jeff Cohen [Sun, 9 Jan 2005 20:42:52 +0000 (20:42 +0000)]
Add last four createXxxPass functions

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19424 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoFix VC++ compilation error
Jeff Cohen [Sun, 9 Jan 2005 20:41:56 +0000 (20:41 +0000)]
Fix VC++ compilation error

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19423 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoPrint the DAG out more like a DAG in nested format.
Chris Lattner [Sun, 9 Jan 2005 20:38:33 +0000 (20:38 +0000)]
Print the DAG out more like a DAG in nested format.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19422 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoPrint out nodes sorted by their address to make it easier to find them in a list.
Chris Lattner [Sun, 9 Jan 2005 20:26:36 +0000 (20:26 +0000)]
Print out nodes sorted by their address to make it easier to find them in a list.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19421 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoCodegen (Reg|imm)+&GV as an LEA, because we cannot put it into the immediate field
Chris Lattner [Sun, 9 Jan 2005 20:20:29 +0000 (20:20 +0000)]
Codegen (Reg|imm)+&GV as an LEA, because we cannot put it into the immediate field
of an ADDri (due to current restrictions on MachineOperand :( ).  This allows
us to generate:

        leal Data+16000, %edx

instead of:

        movl $Data, %edx
        addl $16000, %edx

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19420 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoAdd a simple transformation. This allows us to compile one of the inner
Chris Lattner [Sun, 9 Jan 2005 20:09:57 +0000 (20:09 +0000)]
Add a simple transformation.  This allows us to compile one of the inner
loops in stepanov to this:

.LBB_Z5test0PdS__2:     # no_exit.1
        fldl data(,%eax,8)
        fldl 24(%esp)
        faddp %st(1)
        fstl 24(%esp)
        incl %eax
        cmpl $2000, %eax
        fstpl 16(%esp)
        #FP_REG_KILL
        jl .LBB_Z5test0PdS__2

instead of this:

.LBB_Z5test0PdS__2:     # no_exit.1
        fldl data(,%eax,8)
        fldl 24(%esp)
        faddp %st(1)
        fstl 24(%esp)
        incl %eax
        movl $data, %ecx
        movl %ecx, %edx
        addl $16000, %edx
        subl %ecx, %edx
        movl %edx, %ecx
        sarl $2, %ecx
        shrl $29, %ecx
        addl %ecx, %edx
        sarl $3, %edx
        cmpl %edx, %eax
        fstpl 16(%esp)
        #FP_REG_KILL
        jl .LBB_Z5test0PdS__2

The old instruction selector produced:

.LBB_Z5test0PdS__2:     # no_exit.1
        fldl 24(%esp)
        faddl data(,%eax,8)
        fstl 24(%esp)
        movl %eax, %ecx
        incl %ecx
        incl %eax
        leal data+16000, %edx
        movl $data, %edi
        subl %edi, %edx
        movl %edx, %edi
        sarl $2, %edi
        shrl $29, %edi
        addl %edi, %edx
        sarl $3, %edx
        cmpl %edx, %ecx
        fstpl 16(%esp)
        #FP_REG_KILL
        jl .LBB_Z5test0PdS__2   # no_exit.1

Which is even worse!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19419 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoFix copy and pasto's for FP -> Int. This fixes fldry
Chris Lattner [Sun, 9 Jan 2005 19:49:59 +0000 (19:49 +0000)]
Fix copy and pasto's for FP -> Int.  This fixes fldry

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19418 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoFix a bug legalizing call instructions (make sure to remember all result
Chris Lattner [Sun, 9 Jan 2005 19:43:23 +0000 (19:43 +0000)]
Fix a bug legalizing call instructions (make sure to remember all result
values), and eliminate some switch statements.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19417 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoFix a minor bug legalizing dynamic_stackalloc. This allows us to compile
Chris Lattner [Sun, 9 Jan 2005 19:07:54 +0000 (19:07 +0000)]
Fix a minor bug legalizing dynamic_stackalloc.  This allows us to compile
std::__pad<wchar_t, std::char_traits<wchar_t> >::_S_pad(std::ios_base&, wchar_t, wchar_t*, wchar_t const*, int, int, bool)

from libstdc++

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19416 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoTeach legalize to deal with DYNAMIC_STACKALLOC (aka a dynamic llvm alloca)
Chris Lattner [Sun, 9 Jan 2005 19:03:49 +0000 (19:03 +0000)]
Teach legalize to deal with DYNAMIC_STACKALLOC (aka a dynamic llvm alloca)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19415 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoInitial implementation of FP->INT and INT->FP casts
Chris Lattner [Sun, 9 Jan 2005 18:52:44 +0000 (18:52 +0000)]
Initial implementation of FP->INT and INT->FP casts

Also, fix zero_extend from bool to i8, which fixes Shootout/objinst.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19414 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoGet lib/Analysis/DataStructure to compile with VC++
Jeff Cohen [Sun, 9 Jan 2005 04:18:28 +0000 (04:18 +0000)]
Get lib/Analysis/DataStructure to compile with VC++

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19412 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoWorkaround a VC++ bug. Microsoft puts the hash_map class in namespace stdext, but
Jeff Cohen [Sun, 9 Jan 2005 04:13:09 +0000 (04:13 +0000)]
Workaround a VC++ bug.  Microsoft puts the hash_map class in namespace stdext, but
this classes uses a utility function in namespace std.  But Microsoft apparently
assumes everyone will "using namespace std;".  As LLVM doesn't....  Add a
"use std::_Distance;" to get it working.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19411 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoFix a subtle bug involving constant expr casts from int to fp
Chris Lattner [Sun, 9 Jan 2005 01:49:29 +0000 (01:49 +0000)]
Fix a subtle bug involving constant expr casts from int to fp

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19410 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoHandle static alloca arguments to PHI nodes.
Chris Lattner [Sun, 9 Jan 2005 01:16:24 +0000 (01:16 +0000)]
Handle static alloca arguments to PHI nodes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19409 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoImplement varargs and returnaddress/frameaddress intrinsics. With this
Chris Lattner [Sun, 9 Jan 2005 00:01:27 +0000 (00:01 +0000)]
Implement varargs and returnaddress/frameaddress intrinsics.  With this
patch, all of SingleSource/UnitTests passes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19408 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoUse new interfaces to correctly lower varargs and return/frame address intrinsics.
Chris Lattner [Sun, 9 Jan 2005 00:00:49 +0000 (00:00 +0000)]
Use new interfaces to correctly lower varargs and return/frame address intrinsics.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19407 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoAdd interfaces to lower varargs and return/frame address intrinsics.
Chris Lattner [Sun, 9 Jan 2005 00:00:31 +0000 (00:00 +0000)]
Add interfaces to lower varargs and return/frame address intrinsics.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19406 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoTest fails on all platforms, not just linux
Jeff Cohen [Sat, 8 Jan 2005 23:44:03 +0000 (23:44 +0000)]
Test fails on all platforms, not just linux

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19405 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoAdd support for llvm.setjmp and longjmp. Only 3 SingleSource/UnitTests fail now.
Chris Lattner [Sat, 8 Jan 2005 22:48:57 +0000 (22:48 +0000)]
Add support for llvm.setjmp and longjmp.  Only 3 SingleSource/UnitTests fail now.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19404 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoFix VC++ compilation error
Jeff Cohen [Sat, 8 Jan 2005 22:44:06 +0000 (22:44 +0000)]
Fix VC++ compilation error

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19403 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoAdd even more missing createXxxPass functions.
Jeff Cohen [Sat, 8 Jan 2005 22:01:16 +0000 (22:01 +0000)]
Add even more missing createXxxPass functions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19402 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agorename linscan -> LLCBETA as it should be
Chris Lattner [Sat, 8 Jan 2005 21:03:58 +0000 (21:03 +0000)]
rename linscan -> LLCBETA as it should be

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19401 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoOkay 15th time is the charm. Looking at the vector size is useless as it
Chris Lattner [Sat, 8 Jan 2005 20:51:36 +0000 (20:51 +0000)]
Okay 15th time is the charm.  Looking at the vector size is useless as it
gets clobbered by a previous statement.  This fixes all calls finally.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19399 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoOkay, my off by one was actually off by two. This fixes Generic/2003-07-07-BadLongCo...
Chris Lattner [Sat, 8 Jan 2005 20:39:31 +0000 (20:39 +0000)]
Okay, my off by one was actually off by two.  This fixes Generic/2003-07-07-BadLongConst.ll

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19398 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoTighten up assertions.
Chris Lattner [Sat, 8 Jan 2005 20:35:13 +0000 (20:35 +0000)]
Tighten up assertions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19397 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoFix off by one error
Chris Lattner [Sat, 8 Jan 2005 20:31:34 +0000 (20:31 +0000)]
Fix off by one error

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19396 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoAllow arrays to have more than 4G elements.
Chris Lattner [Sat, 8 Jan 2005 20:19:51 +0000 (20:19 +0000)]
Allow arrays to have more than 4G elements.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19395 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoAllow array types to have 64-bit size.
Chris Lattner [Sat, 8 Jan 2005 20:19:27 +0000 (20:19 +0000)]
Allow array types to have 64-bit size.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19394 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoUse size_t instead of long to represent memory usage. long is 32 bits
Jeff Cohen [Sat, 8 Jan 2005 20:15:57 +0000 (20:15 +0000)]
Use size_t instead of long to represent memory usage.  long is 32 bits
on 64-bit Windows.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19393 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoSilence warnings
Chris Lattner [Sat, 8 Jan 2005 20:13:44 +0000 (20:13 +0000)]
Silence warnings

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19392 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoSilence VS warnings.
Chris Lattner [Sat, 8 Jan 2005 20:13:19 +0000 (20:13 +0000)]
Silence VS warnings.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19391 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoSilence VS warnings.
Chris Lattner [Sat, 8 Jan 2005 20:07:03 +0000 (20:07 +0000)]
Silence VS warnings.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19390 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoSilence VS warnings
Chris Lattner [Sat, 8 Jan 2005 20:05:34 +0000 (20:05 +0000)]
Silence VS warnings

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19389 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoSilence VS warnings
Chris Lattner [Sat, 8 Jan 2005 19:59:10 +0000 (19:59 +0000)]
Silence VS warnings

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19388 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoAdjust prototype
Chris Lattner [Sat, 8 Jan 2005 19:57:49 +0000 (19:57 +0000)]
Adjust prototype

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19387 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoSilence warnings from VS
Chris Lattner [Sat, 8 Jan 2005 19:55:00 +0000 (19:55 +0000)]
Silence warnings from VS

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19386 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoSilence VS warnings
Chris Lattner [Sat, 8 Jan 2005 19:53:50 +0000 (19:53 +0000)]
Silence VS warnings

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19385 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoSilence VS warnings.
Chris Lattner [Sat, 8 Jan 2005 19:52:31 +0000 (19:52 +0000)]
Silence VS warnings.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19384 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoFix VS warnings
Chris Lattner [Sat, 8 Jan 2005 19:48:40 +0000 (19:48 +0000)]
Fix VS warnings

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19383 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoFix VS warnings.
Chris Lattner [Sat, 8 Jan 2005 19:45:31 +0000 (19:45 +0000)]
Fix VS warnings.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19382 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoFix uint64_t -> unsigned VS warnings.
Chris Lattner [Sat, 8 Jan 2005 19:42:22 +0000 (19:42 +0000)]
Fix uint64_t -> unsigned VS warnings.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19381 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoSilence VS warnings.
Chris Lattner [Sat, 8 Jan 2005 19:37:20 +0000 (19:37 +0000)]
Silence VS warnings.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19380 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoSilence warnings
Chris Lattner [Sat, 8 Jan 2005 19:34:41 +0000 (19:34 +0000)]
Silence warnings

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19379 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoDo not throw away bits for no reason
Chris Lattner [Sat, 8 Jan 2005 19:32:59 +0000 (19:32 +0000)]
Do not throw away bits for no reason

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19378 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoSilence a VS warning.
Chris Lattner [Sat, 8 Jan 2005 19:31:31 +0000 (19:31 +0000)]
Silence a VS warning.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19377 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoAdjust to changes in LowerCallTo interface
Chris Lattner [Sat, 8 Jan 2005 19:28:19 +0000 (19:28 +0000)]
Adjust to changes in LowerCallTo interface
Minor bugfixes

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19376 91177308-0d34-0410-b5e6-96231b3b80d8