summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
...
* Implement a couple of more simplifications. This lets us codegen:Chris Lattner2005-01-101-12/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Fix incorrect constant folds, fixing Stepanov after the SHR patch.Chris Lattner2005-01-101-4/+4
| | | | llvm-svn: 19429
* Constant fold shifts, turning this loop:Chris Lattner2005-01-101-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | .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
* Add some folds for == and != comparisons. This allows us toChris Lattner2005-01-091-41/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Fix VC++ compilation errorJeff Cohen2005-01-091-0/+1
| | | | llvm-svn: 19423
* Print the DAG out more like a DAG in nested format.Chris Lattner2005-01-091-2/+18
| | | | llvm-svn: 19422
* Print out nodes sorted by their address to make it easier to find them in a ↵Chris Lattner2005-01-091-2/+5
| | | | | | list. llvm-svn: 19421
* Add a simple transformation. This allows us to compile one of the innerChris Lattner2005-01-091-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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! llvm-svn: 19419
* Fix a bug legalizing call instructions (make sure to remember all resultChris Lattner2005-01-091-16/+10
| | | | | | values), and eliminate some switch statements. llvm-svn: 19417
* Fix a minor bug legalizing dynamic_stackalloc. This allows us to compileChris Lattner2005-01-091-0/+2
| | | | | | | | 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++ llvm-svn: 19416
* Teach legalize to deal with DYNAMIC_STACKALLOC (aka a dynamic llvm alloca)Chris Lattner2005-01-091-1/+16
| | | | llvm-svn: 19415
* Handle static alloca arguments to PHI nodes.Chris Lattner2005-01-091-3/+8
| | | | llvm-svn: 19409
* Use new interfaces to correctly lower varargs and return/frame address ↵Chris Lattner2005-01-091-25/+61
| | | | | | intrinsics. llvm-svn: 19407
* Add support for llvm.setjmp and longjmp. Only 3 SingleSource/UnitTests fail ↵Chris Lattner2005-01-081-1/+8
| | | | | | now. llvm-svn: 19404
* Tighten up assertions.Chris Lattner2005-01-081-8/+6
| | | | llvm-svn: 19397
* Silence VS warningsChris Lattner2005-01-081-7/+8
| | | | llvm-svn: 19388
* Silence warnings from VSChris Lattner2005-01-082-3/+5
| | | | llvm-svn: 19386
* Silence VS warningsChris Lattner2005-01-082-2/+2
| | | | llvm-svn: 19385
* Silence VS warnings.Chris Lattner2005-01-082-5/+4
| | | | llvm-svn: 19384
* Implement handling of most long operators through libcalls.Chris Lattner2005-01-081-5/+65
| | | | | | Fix a bug legalizing "ret (Val,Val)" llvm-svn: 19375
* Adjust to changes in LowerCAllTo interfacesChris Lattner2005-01-081-14/+27
| | | | llvm-svn: 19374
* Add support for FP->INT conversions and back.Chris Lattner2005-01-083-17/+42
| | | | llvm-svn: 19369
* Implement the 'store FPIMM, Ptr' -> 'store INTIMM, Ptr' optimization forChris Lattner2005-01-081-0/+25
| | | | | | all targets. llvm-svn: 19366
* 1ULL << 64 is undefined, don't do it.Chris Lattner2005-01-081-2/+3
| | | | llvm-svn: 19365
* Fix a pointer invalidation problem. This fixes Generic/badarg6.llChris Lattner2005-01-071-13/+7
| | | | llvm-svn: 19361
* Fold conditional branches on constants away.Chris Lattner2005-01-071-0/+6
| | | | llvm-svn: 19360
* Fix a thinko in the reassociation code, fixing Generic/badlive.llChris Lattner2005-01-071-1/+1
| | | | llvm-svn: 19359
* Add support for truncating integer casts from long.Chris Lattner2005-01-071-1/+13
| | | | llvm-svn: 19358
* Fix a bug in load expansion legalization and ret legalization. This fixesChris Lattner2005-01-071-9/+17
| | | | | | CodeGen/Generic/select.ll:castconst. llvm-svn: 19357
* Legalize unconditional branches tooChris Lattner2005-01-071-0/+6
| | | | llvm-svn: 19356
* Implement support for long GEP indices on 32-bit archs and support forChris Lattner2005-01-072-3/+15
| | | | | | int GEP indices on 64-bit archs. llvm-svn: 19354
* Simplify: truncate ({zero|sign}_extend (X))Chris Lattner2005-01-071-0/+9
| | | | llvm-svn: 19353
* implement legalization of a bunch more operators.Chris Lattner2005-01-071-0/+6
| | | | llvm-svn: 19352
* Fix another bug legalizing calls!Chris Lattner2005-01-071-1/+1
| | | | llvm-svn: 19350
* Fix handling of dead PHI nodes.Chris Lattner2005-01-071-26/+30
| | | | llvm-svn: 19349
* Fix a bug legalizing callsChris Lattner2005-01-071-1/+1
| | | | llvm-svn: 19348
* After legalizing a DAG, delete dead nodes to save space.Chris Lattner2005-01-071-6/+1
| | | | llvm-svn: 19346
* Implement RemoveDeadNodesChris Lattner2005-01-071-0/+119
| | | | llvm-svn: 19345
* Teach legalize how to handle condbranchesChris Lattner2005-01-071-0/+10
| | | | llvm-svn: 19339
* Initial implementation of the SelectionDAGISel class. This contains mostChris Lattner2005-01-071-0/+853
| | | | | | of the code for lowering from LLVM code to a SelectionDAG. llvm-svn: 19331
* This file is obsoleteChris Lattner2005-01-071-278/+0
| | | | llvm-svn: 19330
* Initial implementation of the DAG legalization. This still has a long wayChris Lattner2005-01-071-0/+703
| | | | | | to go, but it does work for some non-trivial cases now. llvm-svn: 19329
* Complete rewrite of the SelectionDAG class.Chris Lattner2005-01-071-106/+758
| | | | llvm-svn: 19327
* Make the 2-address instruction lowering pass smarter in two ways:Chris Lattner2005-01-021-17/+61
| | | | | | | | | | | | | | | | | 1. If we are two-addressing a commutable instruction and the LHS is not the last use of the variable, see if the instruction is the last use of the RHS. If so, commute the instruction, allowing us to avoid a register-register copy in many cases for common instructions like ADD, OR, AND, etc on X86. 2. If #1 doesn't hold, and if this is an instruction that also existing in 3-address form, promote the instruction to a 3-address instruction to avoid the register-register copy. We can do this for several common instructions in X86, including ADDrr, INC, DEC, etc. This patch implements test/Regression/CodeGen/X86/commute-two-addr.ll, overlap-add.ll, and overlap-shift.ll when I check in the X86 support for it. llvm-svn: 19245
* Move virtual method call out of loopChris Lattner2004-12-152-6/+6
| | | | llvm-svn: 18955
* Move virtual function call out of loop to speed up getFreePhysReg by aboutNate Begeman2004-12-071-2/+2
| | | | | | 20%, shaving 0.1s off hbd compile time on my g5. Yay. llvm-svn: 18592
* For PR387:\Reid Spencer2004-12-072-2/+2
| | | | | | | Make only one print method to avoid overloaded virtual warnings when \ compiled with -Woverloaded-virtual llvm-svn: 18589
* Prevent accessing past the end of the intervals vector, this fixesChris Lattner2004-12-041-1/+3
| | | | | | Prolang-C/bison in the JIT llvm-svn: 18477
* Fix SingleSource/UnitTests/2004-11-28-GlobalBoolLayout.c, and hopefullyChris Lattner2004-11-281-1/+1
| | | | | | PR449 llvm-svn: 18306
* Fix the FIXME, nuke the JIT specific forceCompilationOf method.Chris Lattner2004-11-221-18/+0
| | | | llvm-svn: 18131
OpenPOWER on IntegriCloud