Commit Graph

1324 Commits

Author SHA1 Message Date
Chris Lattner
c871e1d56f 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
2005-01-11 22:21:04 +00:00
Chris Lattner
f1fdacae8c 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
2005-01-11 22:03:46 +00:00
Chris Lattner
7abf820182 Clear the whole array, always.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19482 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-11 20:25:26 +00:00
Chris Lattner
64da653ba9 Squelch optimized warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19475 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-11 17:46:49 +00:00
Chris Lattner
e1bd822ddb 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
2005-01-11 05:57:22 +00:00
Chris Lattner
4c633e82f6 Print new operations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19464 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-11 05:57:01 +00:00
Chris Lattner
7041ee35ad 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
2005-01-11 05:56:49 +00:00
Chris Lattner
a8d9cc8705 shift X, 0 -> X
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19453 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-11 04:25:13 +00:00
Chris Lattner
e9c44cdf18 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
2005-01-11 00:34:33 +00:00
Chris Lattner
fc08d9c789 Add a marker for the graph root.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19445 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-10 23:52:04 +00:00
Chris Lattner
e0646b86e3 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
2005-01-10 23:26:00 +00:00
Chris Lattner
d75f19fa42 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
2005-01-10 23:25:25 +00:00
Chris Lattner
66328480bb 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
2005-01-10 23:08:40 +00:00
Chris Lattner
6b7598b995 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
2005-01-10 21:02:37 +00:00
Chris Lattner
68dc310942 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
2005-01-10 02:03:02 +00:00
Chris Lattner
87ae6ae41c 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
2005-01-10 01:16:03 +00:00
Chris Lattner
8136d1f8cb 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
2005-01-10 00:07:15 +00:00
Chris Lattner
5cdcc58d51 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
2005-01-09 20:52:51 +00:00
Jeff Cohen
fd161e964a Fix VC++ compilation error
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19423 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-09 20:41:56 +00:00
Chris Lattner
ea946cdb1b 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
2005-01-09 20:38:33 +00:00
Chris Lattner
49d24716a4 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
2005-01-09 20:26:36 +00:00
Chris Lattner
abd2182875 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
2005-01-09 20:09:57 +00:00
Chris Lattner
38d6be5d49 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
2005-01-09 19:43:23 +00:00
Chris Lattner
513e52ec4e 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
2005-01-09 19:07:54 +00:00
Chris Lattner
fa404e8a76 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
2005-01-09 19:03:49 +00:00
Chris Lattner
ee749d7488 Handle static alloca arguments to PHI nodes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19409 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-09 01:16:24 +00:00
Chris Lattner
39ae362279 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
2005-01-09 00:00:49 +00:00
Chris Lattner
64e14b1679 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
2005-01-08 22:48:57 +00:00
Chris Lattner
e3304a3d24 Tighten up assertions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19397 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-08 20:35:13 +00:00
Chris Lattner
dea18b6c0d Silence VS warnings
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19388 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-08 19:59:10 +00:00
Chris Lattner
28696bee02 Silence warnings from VS
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19386 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-08 19:55:00 +00:00
Chris Lattner
5e5fb942e6 Silence VS warnings
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19385 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-08 19:53:50 +00:00
Chris Lattner
f26bc8ef48 Silence VS warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19384 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-08 19:52:31 +00:00
Chris Lattner
4e6c746899 Implement handling of most long operators through libcalls.
Fix a bug legalizing "ret (Val,Val)"


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19375 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-08 19:27:05 +00:00
Chris Lattner
cf5734dddd Adjust to changes in LowerCAllTo interfaces
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19374 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-08 19:26:18 +00:00
Chris Lattner
ae0aacb833 Add support for FP->INT conversions and back.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19369 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-08 08:08:56 +00:00
Chris Lattner
5d2c6c784b Implement the 'store FPIMM, Ptr' -> 'store INTIMM, Ptr' optimization for
all targets.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19366 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-08 06:25:56 +00:00
Chris Lattner
623f70dd4c 1ULL << 64 is undefined, don't do it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19365 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-08 06:24:30 +00:00
Chris Lattner
7c68ec6b70 Fix a pointer invalidation problem. This fixes Generic/badarg6.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19361 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-07 23:32:00 +00:00
Chris Lattner
5351e9b172 Fold conditional branches on constants away.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19360 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-07 22:49:57 +00:00
Chris Lattner
4287d5e355 Fix a thinko in the reassociation code, fixing Generic/badlive.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19359 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-07 22:44:09 +00:00
Chris Lattner
b00a6425de Add support for truncating integer casts from long.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19358 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-07 22:37:48 +00:00
Chris Lattner
8afc48e44a Fix a bug in load expansion legalization and ret legalization. This fixes
CodeGen/Generic/select.ll:castconst.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19357 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-07 22:28:47 +00:00
Chris Lattner
c7af17923e Legalize unconditional branches too
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19356 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-07 22:12:08 +00:00
Chris Lattner
7cc4777a26 Implement support for long GEP indices on 32-bit archs and support for
int GEP indices on 64-bit archs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19354 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-07 21:56:57 +00:00
Chris Lattner
fd8c39b773 Simplify: truncate ({zero|sign}_extend (X))
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19353 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-07 21:56:24 +00:00
Chris Lattner
03c0cf822e implement legalization of a bunch more operators.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19352 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-07 21:45:56 +00:00
Chris Lattner
fad71ebe1e Fix another bug legalizing calls!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19350 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-07 21:35:32 +00:00
Chris Lattner
f44fd88e9c Fix handling of dead PHI nodes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19349 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-07 21:34:19 +00:00
Chris Lattner
ebda942efc Fix a bug legalizing calls
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19348 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-07 21:34:13 +00:00