summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
Commit message (Collapse)AuthorAgeFilesLines
* For PR411:Reid Spencer2006-01-161-5/+16
| | | | | | | | | | | | | | | | This patch is an incremental step towards supporting a flat symbol table. It de-overloads the intrinsic functions by providing type-specific intrinsics and arranging for automatically upgrading from the old overloaded name to the new non-overloaded name. Specifically: llvm.isunordered -> llvm.isunordered.f32, llvm.isunordered.f64 llvm.sqrt -> llvm.sqrt.f32, llvm.sqrt.f64 llvm.ctpop -> llvm.ctpop.i8, llvm.ctpop.i16, llvm.ctpop.i32, llvm.ctpop.i64 llvm.ctlz -> llvm.ctlz.i8, llvm.ctlz.i16, llvm.ctlz.i32, llvm.ctlz.i64 llvm.cttz -> llvm.cttz.i8, llvm.cttz.i16, llvm.cttz.i32, llvm.cttz.i64 New code should not use the overloaded intrinsic names. Warnings will be emitted if they are used. llvm-svn: 25366
* Remove some duplicated codeNate Begeman2006-01-141-8/+0
| | | | llvm-svn: 25313
* bswap implementationNate Begeman2006-01-141-0/+15
| | | | llvm-svn: 25312
* Compile llvm.stacksave/restore into STACKSAVE/STACKRESTORE nodes, and allowChris Lattner2006-01-131-4/+14
| | | | | | targets to custom expand them as they desire. llvm-svn: 25273
* Add "support" for stacksave/stackrestore to the dag iselChris Lattner2006-01-131-0/+5
| | | | llvm-svn: 25268
* Added selection DAG support for the extractelement operation.Robert Bocchino2006-01-101-0/+1
| | | | llvm-svn: 25179
* Applied some recommend changes from sabre. The dominate one beginning "let theJim Laskey2006-01-041-1/+2
| | | | | | | pass manager do it's thing." Fixes crash when compiling -g files and suppresses dwarf statements if no debug info is present. llvm-svn: 25100
* enable the gep isel optChris Lattner2005-12-211-6/+0
| | | | llvm-svn: 24910
* Lower ConstantAggregateZero into zerosChris Lattner2005-12-211-7/+20
| | | | llvm-svn: 24890
* Added source file/line correspondence for dwarf (PowerPC only at this point.)Jim Laskey2005-12-161-1/+1
| | | | llvm-svn: 24748
* Don't lump the filename and working dir togetherChris Lattner2005-12-131-15/+16
| | | | llvm-svn: 24697
* Accept and ignore prefetches for nowChris Lattner2005-12-121-0/+3
| | | | llvm-svn: 24678
* Minor tweak to get isel optChris Lattner2005-12-111-1/+2
| | | | llvm-svn: 24663
* improve code insertion in two ways:Chris Lattner2005-12-081-20/+26
| | | | | | | | | | | | | 1. Only forward subst offsets into loads and stores, not into arbitrary things, where it will likely become a load. 2. If the source is a cast from pointer, forward subst the cast as well, allowing us to fold the cast away (improving cases when the cast is from an alloca or global). This hasn't been fully tested, but does appear to further reduce register pressure and improve code. Lets let the testers grind on it a bit. :) llvm-svn: 24640
* Fix a crash where ConstantVec nodes were being generated with the wrongNate Begeman2005-12-071-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | type when the target did not support them. Also teach Legalize how to expand ConstantVecs. This allows us to generate _test: lwz r2, 12(r3) lwz r4, 8(r3) lwz r5, 4(r3) lwz r6, 0(r3) addi r2, r2, 4 addi r4, r4, 3 addi r5, r5, 2 addi r6, r6, 1 stw r2, 12(r3) stw r4, 8(r3) stw r5, 4(r3) stw r6, 0(r3) blr For: void %test(%v4i *%P) { %T = load %v4i* %P %S = add %v4i %T, <int 1, int 2, int 3, int 4> store %v4i %S, %v4i * %P ret void } On PowerPC. llvm-svn: 24633
* Teach the SelectionDAG ISel how to turn ConstantPacked values intoNate Begeman2005-12-061-3/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | constant nodes with vector types. Also teach the asm printer how to print ConstantPacked constant pool entries. This allows us to generate altivec code such as the following, which adds a vector constantto a packed float. LCPI1_0: <4 x float> < float 0.0e+0, float 0.0e+0, float 0.0e+0, float 1.0e+0 > .space 4 .space 4 .space 4 .long 1065353216 ; float 1 .text .align 4 .globl _foo _foo: lis r2, ha16(LCPI1_0) la r2, lo16(LCPI1_0)(r2) li r4, 0 lvx v0, r4, r2 lvx v1, r4, r3 vaddfp v0, v1, v0 stvx v0, r4, r3 blr For the llvm code: void %foo(<4 x float> * %a) { entry: %tmp1 = load <4 x float> * %a; %tmp2 = add <4 x float> %tmp1, < float 0.0, float 0.0, float 0.0, float 1.0 > store <4 x float> %tmp2, <4 x float> *%a ret void } llvm-svn: 24616
* Fix the #1 code quality problem that I have seen on X86 (and it also affectsChris Lattner2005-12-051-6/+162
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PPC and other targets). In a particular, consider code like this: struct Vector3 { double x, y, z; }; struct Matrix3 { Vector3 a, b, c; }; double dot(Vector3 &a, Vector3 &b) { return a.x * b.x + a.y * b.y + a.z * b.z; } Vector3 mul(Vector3 &a, Matrix3 &b) { Vector3 r; r.x = dot( a, b.a ); r.y = dot( a, b.b ); r.z = dot( a, b.c ); return r; } void transform(Matrix3 &m, Vector3 *x, int n) { for (int i = 0; i < n; i++) x[i] = mul( x[i], m ); } we compile transform to a loop with all of the GEP instructions for indexing into 'm' pulled out of the loop (9 of them). Because isel occurs a bb at a time we are unable to fold the constant index into the loads in the loop, leading to PPC code that looks like this: LBB3_1: ; no_exit.preheader li r2, 0 addi r6, r3, 64 ;; 9 values live across the loop body! addi r7, r3, 56 addi r8, r3, 48 addi r9, r3, 40 addi r10, r3, 32 addi r11, r3, 24 addi r12, r3, 16 addi r30, r3, 8 LBB3_2: ; no_exit lfd f0, 0(r30) lfd f1, 8(r4) fmul f0, f1, f0 lfd f2, 0(r3) ;; no constant indices folded into the loads! lfd f3, 0(r4) lfd f4, 0(r10) lfd f5, 0(r6) lfd f6, 0(r7) lfd f7, 0(r8) lfd f8, 0(r9) lfd f9, 0(r11) lfd f10, 0(r12) lfd f11, 16(r4) fmadd f0, f3, f2, f0 fmul f2, f1, f4 fmadd f0, f11, f10, f0 fmadd f2, f3, f9, f2 fmul f1, f1, f6 stfd f0, 0(r4) fmadd f0, f11, f8, f2 fmadd f1, f3, f7, f1 stfd f0, 8(r4) fmadd f0, f11, f5, f1 addi r29, r4, 24 stfd f0, 16(r4) addi r2, r2, 1 cmpw cr0, r2, r5 or r4, r29, r29 bne cr0, LBB3_2 ; no_exit uh, yuck. With this patch, we now sink the constant offsets into the loop, producing this code: LBB3_1: ; no_exit.preheader li r2, 0 LBB3_2: ; no_exit lfd f0, 8(r3) lfd f1, 8(r4) fmul f0, f1, f0 lfd f2, 0(r3) lfd f3, 0(r4) lfd f4, 32(r3) ;; much nicer. lfd f5, 64(r3) lfd f6, 56(r3) lfd f7, 48(r3) lfd f8, 40(r3) lfd f9, 24(r3) lfd f10, 16(r3) lfd f11, 16(r4) fmadd f0, f3, f2, f0 fmul f2, f1, f4 fmadd f0, f11, f10, f0 fmadd f2, f3, f9, f2 fmul f1, f1, f6 stfd f0, 0(r4) fmadd f0, f11, f8, f2 fmadd f1, f3, f7, f1 stfd f0, 8(r4) fmadd f0, f11, f5, f1 addi r6, r4, 24 stfd f0, 16(r4) addi r2, r2, 1 cmpw cr0, r2, r5 or r4, r6, r6 bne cr0, LBB3_2 ; no_exit This is much nicer as it reduces register pressure in the loop a lot. On X86, this takes the function from having 9 spilled registers to 2. This should help some spec programs on X86 (gzip?) This is currently only enabled with -enable-gep-isel-opt to allow perf testing tonight. llvm-svn: 24606
* dbg.stoppoint returns a value, don't forget to init itChris Lattner2005-12-031-0/+1
| | | | llvm-svn: 24583
* First chunk of actually generating vector code for packed types. TheseNate Begeman2005-11-301-2/+12
| | | | | | | | | | | | | | | | | | | | | | | changes allow us to generate the following code: _foo: li r2, 0 lvx v0, r2, r3 vaddfp v0, v0, v0 stvx v0, r2, r3 blr for this llvm: void %foo(<4 x float>* %a) { entry: %tmp1 = load <4 x float>* %a %tmp2 = add <4 x float> %tmp1, %tmp1 store <4 x float> %tmp2, <4 x float>* %a ret void } llvm-svn: 24534
* Fix a problem with llvm-ranlib that (on some platforms) caused the archiveReid Spencer2005-11-301-0/+30
| | | | | | | | | | file to become corrupted due to interactions between mmap'd memory segments and file descriptors closing. The problem is completely avoiding by using a third temporary file. Patch provided by Evan Jones llvm-svn: 24527
* Add support for a new STRING and LOCATION node for line number support, patchChris Lattner2005-11-291-2/+67
| | | | | | contributed by Daniel Berlin, with a few cleanups here and there by me. llvm-svn: 24515
* Check in code to scalarize arbitrarily wide packed types for some simpleNate Begeman2005-11-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | vector operations (load, add, sub, mul). This allows us to codegen: void %foo(<4 x float> * %a) { entry: %tmp1 = load <4 x float> * %a; %tmp2 = add <4 x float> %tmp1, %tmp1 store <4 x float> %tmp2, <4 x float> *%a ret void } on ppc as: _foo: lfs f0, 12(r3) lfs f1, 8(r3) lfs f2, 4(r3) lfs f3, 0(r3) fadds f0, f0, f0 fadds f1, f1, f1 fadds f2, f2, f2 fadds f3, f3, f3 stfs f0, 12(r3) stfs f1, 8(r3) stfs f2, 4(r3) stfs f3, 0(r3) blr llvm-svn: 24484
* Rather than attempting to legalize 1 x float, make sure the SD ISel neverNate Begeman2005-11-221-6/+24
| | | | | | | | | | | generates it. Make MVT::Vector expand-only, and remove the code in Legalize that attempts to legalize it. The plan for supporting N x Type is to continually epxand it in ExpandOp until it gets down to 2 x Type, where it will be scalarized into a pair of scalars. llvm-svn: 24482
* Unbreak codegen of bools. This should fix the llc/jit/llc-beta failuresChris Lattner2005-11-191-1/+1
| | | | | | from last night. llvm-svn: 24427
* Teach LLVM how to scalarize packed types. Currently, this only works onNate Begeman2005-11-191-32/+37
| | | | | | | | | | | | | | | | | | | | | | | packed types with an element count of 1, although more generic support is coming. This allows LLVM to turn the following code: void %foo(<1 x float> * %a) { entry: %tmp1 = load <1 x float> * %a; %tmp2 = add <1 x float> %tmp1, %tmp1 store <1 x float> %tmp2, <1 x float> *%a ret void } Into: _foo: lfs f0, 0(r3) fadds f0, f0, f0 stfs f0, 0(r3) blr llvm-svn: 24416
* Split out the shift code from visitBinary.Nate Begeman2005-11-181-7/+14
| | | | llvm-svn: 24412
* when debugging lower dbg intrinsics to callsChris Lattner2005-11-161-0/+22
| | | | llvm-svn: 24377
* added a chain outputAndrew Lenharth2005-11-111-2/+10
| | | | llvm-svn: 24306
* continued readcyclecounter supportAndrew Lenharth2005-11-111-0/+3
| | | | llvm-svn: 24300
* Refactor intrinsic lowering stuff out of visitCallChris Lattner2005-11-091-98/+107
| | | | llvm-svn: 24261
* Fix CodeGen/X86/shift-folding.ll:test3 on X86Chris Lattner2005-11-091-1/+1
| | | | llvm-svn: 24256
* Avoid creating a token factor node in trivially redundant cases. ThisChris Lattner2005-11-091-1/+12
| | | | | | eliminates almost one node per block in common cases. llvm-svn: 24254
* Handle GEP's a bit more intelligently. Fold constant indices early andChris Lattner2005-11-091-16/+40
| | | | | | turn power-of-two multiplies into shifts early to improve compile time. llvm-svn: 24253
* Add the necessary support to the ISel to allow targets to codegen the newNate Begeman2005-11-061-2/+5
| | | | | | | | alignment information appropriately. Includes code for PowerPC to support fixed-size allocas with alignment larger than the stack. Support for arbitrarily aligned dynamic allocas coming soon. llvm-svn: 24224
* Significantly simplify this code and make it more aggressive. Instead of havingChris Lattner2005-10-301-103/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | a special case hack for X86, make the hack more general: if an incoming argument register is not used in any block other than the entry block, don't copy it to a vreg. This helps us compile code like this: %struct.foo = type { int, int, [0 x ubyte] } int %test(%struct.foo* %X) { %tmp1 = getelementptr %struct.foo* %X, int 0, uint 2, int 100 %tmp = load ubyte* %tmp1 ; <ubyte> [#uses=1] %tmp2 = cast ubyte %tmp to int ; <int> [#uses=1] ret int %tmp2 } to: _test: lbz r3, 108(r3) blr instead of: _test: lbz r2, 108(r3) or r3, r2, r2 blr The (dead) copy emitted to copy r3 into a vreg for extra-block uses was increasing the live range of r3 past the load, preventing the coallescing. This implements CodeGen/PowerPC/reg-coallesce-simple.ll llvm-svn: 24115
* Add the ability to lower return instructions to TargetLowering. ThisNate Begeman2005-10-181-2/+7
| | | | | | | allows us to lower legal return types to something else, to meet ABI requirements (such as that i64 be returned in two i32 regs on Darwin/ppc). llvm-svn: 23802
* Fix Generic/2005-10-18-ZeroSizeStackObject.ll by not requesting a zeroChris Lattner2005-10-181-0/+1
| | | | | | sized stack object if either the array size or the type size is zero. llvm-svn: 23801
* remove hackChris Lattner2005-10-181-3/+1
| | | | llvm-svn: 23797
* Enable Nate's excellent DAG combiner work by default. This allows theChris Lattner2005-10-101-16/+4
| | | | | | removal of a bunch of ad-hoc and crufty code from SelectionDAG.cpp. llvm-svn: 23682
* make sure that -view-isel-dags is the input to the isel, not the input toChris Lattner2005-10-051-2/+2
| | | | | | the second phase of dag combining llvm-svn: 23631
* Fix VC++ warnings.Jeff Cohen2005-10-011-4/+4
| | | | llvm-svn: 23579
* Add FP versions of the binary operators, keeping the int and fp worlds seperate.Chris Lattner2005-09-281-12/+35
| | | | | | | | Though I have done extensive testing, it is possible that this will break things in configs I can't test. Please let me know if this causes a problem and I'll fix it ASAP. llvm-svn: 23504
* If the target prefers it, use _setjmp/_longjmp should be used instead of ↵Chris Lattner2005-09-271-2/+6
| | | | | | setjmp/longjmp for llvm.setjmp/llvm.longjmp. llvm-svn: 23481
* If a function has liveins, and if the target requested that they be ploppedChris Lattner2005-09-131-0/+15
| | | | | | into particular vregs, emit copies into the entry MBB. llvm-svn: 23331
* Add an option to the DAG Combiner to enable it for beta runs, and turn onNate Begeman2005-09-071-0/+19
| | | | | | that option for PowerPC's beta. llvm-svn: 23253
* Don't create zero sized stack objects even for array allocas with a zeroChris Lattner2005-09-021-1/+2
| | | | | | number of elements. llvm-svn: 23219
* Fix the release build, noticed by Eric van Riet PaapChris Lattner2005-09-021-1/+1
| | | | llvm-svn: 23215
* For values that are live across basic blocks and need promotion, use ANY_EXTENDChris Lattner2005-09-021-10/+5
| | | | | | | | instead of ZERO_EXTEND to eliminate extraneous extensions. This eliminates dead zero extensions on formal arguments and other cases on PPC, implementing the newly tightened up test/Regression/CodeGen/PowerPC/small-arguments.ll test. llvm-svn: 23205
* It is NDEBUG not _NDEBUGChris Lattner2005-09-011-1/+1
| | | | llvm-svn: 23186
* Disable this code, which broke many tests last nightChris Lattner2005-08-271-1/+1
| | | | llvm-svn: 23114
OpenPOWER on IntegriCloud