Commit Graph

16964 Commits

Author SHA1 Message Date
Chris Lattner f49c27c65c Squelch optimized warning.
llvm-svn: 19475
2005-01-11 17:46:49 +00:00
Reid Spencer 792bbf02a2 Fix the documentation for executeAndWait so the argument comments are
actually attributed to the arguments by doxygen.

llvm-svn: 19473
2005-01-11 06:37:27 +00:00
Chris Lattner b74ec4cd24 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".

llvm-svn: 19472
2005-01-11 06:36:20 +00:00
Reid Spencer 4596db3509 Make the construction of doxygen documentation a repeatable process
llvm-svn: 19469
2005-01-11 06:26:27 +00:00
Chris Lattner c07164e909 Implement MEMCPY natively in terms of rep movs*
llvm-svn: 19468
2005-01-11 06:19:26 +00:00
Chris Lattner 36f7848b26 Implement memset -> rep stos*
llvm-svn: 19467
2005-01-11 06:14:36 +00:00
Chris Lattner a19f84240f Announce that we don't support mem ops yet.
llvm-svn: 19466
2005-01-11 05:57:36 +00:00
Chris Lattner 85d70c6fd5 Teach legalize to lower MEMSET/MEMCPY/MEMMOVE operations if the target
does not support them.

llvm-svn: 19465
2005-01-11 05:57:22 +00:00
Chris Lattner 844277fb1e Print new operations.
llvm-svn: 19464
2005-01-11 05:57:01 +00:00
Chris Lattner 875def9b71 Turn memset/memcpy/memmove into the corresponding operations.
llvm-svn: 19463
2005-01-11 05:56:49 +00:00
Chris Lattner 1d7b8e118b Add MEMSET/MEMCPY/MEMMOVE operations. Fix a really bad bug in the vector
SDNode ctor.

llvm-svn: 19462
2005-01-11 05:56:17 +00:00
Reid Spencer 4a1ab18fbf * 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.

llvm-svn: 19459
2005-01-11 05:16:23 +00:00
Reid Spencer 1e008c200d * Describe the LOADABLE_MODULE feature
* Get rid of non-compliant <font> elements (how did that get in there?)

llvm-svn: 19458
2005-01-11 05:12:54 +00:00
Chris Lattner 378262d33b Teach the address selector to make 'reg+reg' addressing modes.
llvm-svn: 19457
2005-01-11 04:40:19 +00:00
Reid Spencer 134f02d0c7 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.

llvm-svn: 19456
2005-01-11 04:33:32 +00:00
Chris Lattner 9d7cf998ca Emit NOT instructions.
llvm-svn: 19455
2005-01-11 04:31:30 +00:00
Reid Spencer 87e645c5bd 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.

llvm-svn: 19454
2005-01-11 04:31:07 +00:00
Chris Lattner a86fa4455b shift X, 0 -> X
llvm-svn: 19453
2005-01-11 04:25:13 +00:00
Chris Lattner 37ed28558f Fix a bug emitting branches that broke a lot of programs.
llvm-svn: 19452
2005-01-11 04:06:27 +00:00
Chris Lattner e44e6d16fb 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.

llvm-svn: 19451
2005-01-11 03:50:45 +00:00
Chris Lattner 8fea42bd6d Fix a major bug in setcc/cmov folding, where we accidentally
inverted the sense of the comparison.

llvm-svn: 19450
2005-01-11 03:37:59 +00:00
Chris Lattner 0d1f82ac2f 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.

llvm-svn: 19449
2005-01-11 03:11:44 +00:00
Chris Lattner 788bdba13d 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.

llvm-svn: 19448
2005-01-11 03:05:03 +00:00
Chris Lattner 1308b488ea Print SelectionDAGs bottom up, include extra info in the node labels
llvm-svn: 19447
2005-01-11 00:34:33 +00:00
Chris Lattner 39c5808fdb Add support for bottom-up graphs.
llvm-svn: 19446
2005-01-11 00:24:59 +00:00
Chris Lattner b241b443b6 Add a marker for the graph root.
llvm-svn: 19445
2005-01-10 23:52:04 +00:00
Chris Lattner 12be02722f Put the operation name in each node, put the function name on the graph.
llvm-svn: 19444
2005-01-10 23:26:00 +00:00
Chris Lattner 9e4c76123c Split out SDNode::getOperationName into its own method.
llvm-svn: 19443
2005-01-10 23:25:25 +00:00
Chris Lattner 7fa992e976 Add a helper method.
llvm-svn: 19442
2005-01-10 23:25:04 +00:00
Chris Lattner 7f65075be3 Implement initial selectiondag printing support. This gets us a nice
graph with no labels! :)

llvm-svn: 19441
2005-01-10 23:08:40 +00:00
Chris Lattner e32371bad6 Add support for graph operations, and add a viewGraph method to SelectionDAG.
llvm-svn: 19440
2005-01-10 23:05:53 +00:00
Chris Lattner da7c050442 Add a helper method
llvm-svn: 19439
2005-01-10 23:05:07 +00:00
Chris Lattner 1d13a92af4 Fold setcc instructions into selects.
llvm-svn: 19438
2005-01-10 22:10:13 +00:00
Chris Lattner 5b589ec0c4 Add conditional moves for the parity flag.
llvm-svn: 19437
2005-01-10 22:09:33 +00:00
Chris Lattner be02d430a9 Lower to the correct functions. This fixes FreeBench/fourinarow
llvm-svn: 19436
2005-01-10 21:02:37 +00:00
Chris Lattner 750d38b5b7 Implement 8-bit multiply for X86.
llvm-svn: 19435
2005-01-10 20:55:48 +00:00
Chris Lattner 5326f35715 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.

llvm-svn: 19434
2005-01-10 18:23:22 +00:00
Jeff Cohen 3e62e7c68b Apply feedback from Chris.
llvm-svn: 19432
2005-01-10 04:23:32 +00:00
Jeff Cohen 703f7db254 Apply feed back from Chris:
1. Rename createLoaderPass to CreateProfileLoaderPass
  2. Opt shouldn't use the pass registered in CodeGen.

llvm-svn: 19431
2005-01-10 03:56:27 +00:00
Chris Lattner 41b764144d 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

llvm-svn: 19430
2005-01-10 02:03:02 +00:00
Chris Lattner 00c231baa7 Fix incorrect constant folds, fixing Stepanov after the SHR patch.
llvm-svn: 19429
2005-01-10 01:16:03 +00:00
Jeff Cohen c783e07a7c Update System project in Visual Studio to reflect renamed files.
llvm-svn: 19428
2005-01-10 00:50:11 +00:00
Chris Lattner 0966a75e76 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

llvm-svn: 19427
2005-01-10 00:07:15 +00:00
Reid Spencer c892a0db9f 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})

llvm-svn: 19426
2005-01-09 23:29:00 +00:00
Chris Lattner fde3a212e2 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

llvm-svn: 19425
2005-01-09 20:52:51 +00:00
Jeff Cohen 292845d2d9 Add last four createXxxPass functions
llvm-svn: 19424
2005-01-09 20:42:52 +00:00
Jeff Cohen 7d1670da3f Fix VC++ compilation error
llvm-svn: 19423
2005-01-09 20:41:56 +00:00
Chris Lattner e6f7882c27 Print the DAG out more like a DAG in nested format.
llvm-svn: 19422
2005-01-09 20:38:33 +00:00
Chris Lattner 1270acc1ce Print out nodes sorted by their address to make it easier to find them in a list.
llvm-svn: 19421
2005-01-09 20:26:36 +00:00
Chris Lattner cf8fd0c0db 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

llvm-svn: 19420
2005-01-09 20:20:29 +00:00