Commit Graph

192 Commits

Author SHA1 Message Date
Chris Lattner
bf209489ad Significantly simplify this code and make it more aggressive. Instead of having
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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24115 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-30 19:42:35 +00:00
Nate Begeman
4a95945fa5 Add the ability to lower return instructions to TargetLowering. This
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).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23802 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-18 23:23:37 +00:00
Chris Lattner
d222f6ab67 Fix Generic/2005-10-18-ZeroSizeStackObject.ll by not requesting a zero
sized stack object if either the array size or the type size is zero.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23801 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-18 22:14:06 +00:00
Chris Lattner
2dfa8192ab remove hack
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23797 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-18 22:11:42 +00:00
Chris Lattner
af21d55aee Enable Nate's excellent DAG combiner work by default. This allows the
removal of a bunch of ad-hoc and crufty code from SelectionDAG.cpp.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23682 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-10 16:47:10 +00:00
Chris Lattner
d48050aa15 make sure that -view-isel-dags is the input to the isel, not the input to
the second phase of dag combining


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23631 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-05 06:09:10 +00:00
Jeff Cohen
2aeaf4e839 Fix VC++ warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23579 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-01 03:57:14 +00:00
Chris Lattner
01b3d73c20 Add FP versions of the binary operators, keeping the int and fp worlds seperate.
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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23504 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-28 22:28:18 +00:00
Chris Lattner
6c38b33613 If the target prefers it, use _setjmp/_longjmp should be used instead of setjmp/longjmp for llvm.setjmp/llvm.longjmp.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23481 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-27 22:15:53 +00:00
Chris Lattner
fa57702388 If a function has liveins, and if the target requested that they be plopped
into particular vregs, emit copies into the entry MBB.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23331 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-13 19:30:54 +00:00
Nate Begeman
2300f55046 Add an option to the DAG Combiner to enable it for beta runs, and turn on
that option for PowerPC's beta.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23253 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-07 00:15:36 +00:00
Chris Lattner
fd88f64934 Don't create zero sized stack objects even for array allocas with a zero
number of elements.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23219 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-02 18:41:28 +00:00
Chris Lattner
a639a43602 Fix the release build, noticed by Eric van Riet Paap
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23215 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-02 07:09:28 +00:00
Chris Lattner
fab08875b7 For values that are live across basic blocks and need promotion, use ANY_EXTEND
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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23205 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-02 00:19:37 +00:00
Chris Lattner
da8abb0239 It is NDEBUG not _NDEBUG
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23186 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-01 18:44:10 +00:00
Chris Lattner
88b9c15912 Disable this code, which broke many tests last night
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23114 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-27 16:16:51 +00:00
Chris Lattner
9d3a483a38 Don't copy regs that are only used in the entry block into a vreg. This
changes the code generated for:

short %test(short %A) {
  %B = xor short %A, -32768
  ret short %B
}

to:

_test:
        xori r2, r3, 32768
        xoris r2, r2, 65535
        extsh r3, r2
        blr

instead of:

_test:
        rlwinm r2, r3, 0, 16, 31
        xori r2, r3, 32768
        xoris r2, r2, 65535
        extsh r3, r2
        blr


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23109 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-26 22:49:59 +00:00
Chris Lattner
025c39bf36 Call the InsertAtEndOfBasicBlock hook if the usesCustomDAGSchedInserter
flag is set on an instruction.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23098 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-26 20:54:47 +00:00
Chris Lattner
82cfa5d616 Make -view-isel-dags show the dag before instruction selecting, in case
the target isel crashes due to unimplemented features like calls :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22997 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-24 00:34:29 +00:00
Chris Lattner
8f03405ee5 Fix a problem where constant expr shifts would not have their shift amount
promoted to the right type.  This fixes: IA64/2005-08-22-LegalizerCrash.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22969 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-22 17:28:31 +00:00
Chris Lattner
36b708f057 Enable critical edge splitting by default
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22863 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-18 17:35:14 +00:00
Chris Lattner
495a0b5191 Add a new beta option for critical edge splitting, to avoid a problem that
Nate noticed in yacr2 (and I know occurs in other places as well).

This is still rough, as the critical edge blocks are not intelligently placed
but is added to get some idea to see if this improves performance.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22825 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-17 06:37:43 +00:00
Chris Lattner
fae59b99b8 Fix a regression on X86, where FP values can be promoted too.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22822 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-17 06:06:25 +00:00
Chris Lattner
d5d0f9bd20 Eliminate the RegSDNode class, which 3 nodes (CopyFromReg/CopyToReg/ImplicitDef)
used to tack a register number onto the node.

Instead of doing this, make a new node, RegisterSDNode, which is a leaf
containing a register number.  These three operations just become normal
DAG nodes now, instead of requiring special handling.

Note that with this change, it is no longer correct to make illegal
CopyFromReg/CopyToReg nodes.  The legalizer will not touch them, and this
is bad, so don't do it. :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22806 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-16 21:55:35 +00:00
Chris Lattner
7cf7e3f33f Eliminate the SetCCSDNode in favor of a CondCodeSDNode class. This pulls the
CC out of the SetCC operation, making SETCC a standard ternary operation and
CC's a standard DAG leaf.  This will make it possible for other node to use
CC's as operands in the future...


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22728 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-09 20:20:18 +00:00
Jeff Cohen
00b16889ab Eliminate all remaining tabs and trailing spaces.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22523 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-27 06:12:32 +00:00
Nate Begeman
700a3c97e9 Remove unnecessary FP_EXTEND. This causes worse codegen for SSE.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22469 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-19 16:50:03 +00:00
Chris Lattner
e64e72b794 Make several cleanups to Andrews varargs change:
1. Pass Value*'s into lowering methods so that the proper pointers can be
   added to load/stores from the valist
2. Intrinsics that return void should only return a token chain, not a token
   chain/retval pair.
3. Rename LowerVAArgNext -> LowerVAArg, because VANext is long gone.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22338 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-05 19:57:53 +00:00
Andrew Lenharth
06ef88472f restore old srcValueNode behavior and try to to work around it
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22315 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-29 18:54:02 +00:00
Andrew Lenharth
782ad62f33 tracking the instructions causing loads and stores provides more information than just the pointer being loaded or stored
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22311 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-29 15:57:19 +00:00
Andrew Lenharth
213e557cef If we support structs as va_list, we must pass pointers to them to va_copy
See last commit for LangRef, this implements it on all targets.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22273 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-22 21:04:42 +00:00
Andrew Lenharth
558bc88a00 core changes for varargs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22254 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-18 18:34:52 +00:00
Chris Lattner
1ca85d567c Fix construction of ioport intrinsics, fixing X86/io.llx and io-port.llx
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22026 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-14 13:56:55 +00:00
Chris Lattner
adf6c2a0cb Eliminate special purpose hacks for dynamic_stack_alloc.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22015 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-14 07:29:57 +00:00
Chris Lattner
50381b6c41 LowerOperation takes a dag
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22004 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-14 05:50:48 +00:00
Chris Lattner
a8217e3000 Align doubles on 8-byte boundaries if possible.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21993 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-13 23:14:17 +00:00
Chris Lattner
adf6a965a3 Add an isTailCall flag to LowerCallTo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21958 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-13 18:50:42 +00:00
Chris Lattner
405ef9e28d Emit function entry code after lowering hte arguments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21931 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-13 07:33:32 +00:00
Chris Lattner
3aa7832c82 Allow targets to emit code into the entry block of each function
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21930 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-13 07:23:21 +00:00
Chris Lattner
9092fa310c Pass calling convention to use into lower call to
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21900 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-12 19:56:57 +00:00
Chris Lattner
16ce0df927 wrap long line
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21870 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-11 18:57:06 +00:00
Chris Lattner
ef311aa7cf The semantics of cast X to bool are a comparison against zero, not a truncation!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21833 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-09 22:17:13 +00:00
Chris Lattner
d0f6c1f52d Add support for matching the READPORT, WRITEPORT, READIO, WRITEIO intrinsics
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21825 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-09 20:22:36 +00:00
Chris Lattner
fd414a27fd Don't use the load/store instruction as the source pointer, use the pointer
being stored/loaded through!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21806 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-09 04:28:51 +00:00
Chris Lattner
369e6db9b6 wrap long lines
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21804 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-09 04:08:33 +00:00
Chris Lattner
7ea0ade1b6 When hitting an unsupported intrinsic, actually print it
Lower debug info to noops.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21698 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-05 17:55:17 +00:00
Andrew Lenharth
691ef2ba06 Implement count leading zeros (ctlz), count trailing zeros (cttz), and count
population (ctpop).  Generic lowering is implemented, however only promotion
is implemented for SelectionDAG at the moment.

More coming soon.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21676 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-03 17:19:30 +00:00
Chris Lattner
f76e7dc8d8 Codegen and legalize sin/cos/llvm.sqrt as FSIN/FCOS/FSQRT calls. This patch
was contributed by Morten Ofstad, with some minor tweaks and bug fixes added
by me.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21636 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-30 04:43:14 +00:00
Andrew Lenharth
2d86ea21dd Implement Value* tracking for loads and stores in the selection DAG. This enables one to use alias analysis in the backends.
(TRUNK)Stores and (EXT|ZEXT|SEXT)Loads have an extra SDOperand which is a SrcValueSDNode which contains the Value*.  Note that if the operation is introduced by the backend, it will still have the operand, but the value* will be null.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21599 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-27 20:10:01 +00:00
Misha Brukman
dedf2bd5a3 Convert tabs to spaces
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21439 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-22 04:01:18 +00:00
Misha Brukman
edf128a7fa Remove trailing whitespace
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21420 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-21 22:36:52 +00:00
Nate Begeman
b882752bd0 Fold shift by size larger than type size to undef
Make llvm undef values generate ISD::UNDEF nodes


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21261 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-12 23:12:17 +00:00
Chris Lattner
e7ccd4acd2 Emit BRCONDTWOWAY when possible.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21167 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-09 03:30:29 +00:00
Chris Lattner
c0f18152d9 transform fabs/fabsf calls into FABS nodes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21014 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-02 05:26:53 +00:00
Chris Lattner
b9fccc4193 Turn -0.0 - X -> fneg
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21011 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-02 05:04:50 +00:00
Andrew Lenharth
95762124a1 PCMarker support for DAG and Alpha
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20965 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-31 21:24:06 +00:00
Chris Lattner
a33ef4816d Instead of setting up the CFG edges at selectiondag construction time, set
them up after the code has been emitted.  This allows targets to select one
mbb as multiple mbb's as needed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20937 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-30 01:10:47 +00:00
Chris Lattner
f51d3bd676 Fix a bug that andrew noticed where we do not correctly sign/zero extend
returned integer values all of the way to 64-bits (we only did it to 32-bits
leaving the top bits undefined).  This causes problems for targets like alpha
whose ABI's define the top bits too.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20926 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-29 19:09:56 +00:00
Nate Begeman
8e21e71b24 Change interface to LowerCallTo to take a boolean isVarArg argument.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20842 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-26 01:29:23 +00:00
Chris Lattner
e4d5c441e0 This mega patch converts us from using Function::a{iterator|begin|end} to
using Function::arg_{iterator|begin|end}.  Likewise Module::g* -> Module::global_*.

This patch is contributed by Gabor Greif, thanks!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20597 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-15 04:54:21 +00:00
Misha Brukman
d3f03e4b50 Fix compilation errors with VS 2005, patch by Aaron Gray.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20231 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-17 21:39:27 +00:00
Chris Lattner
aa781b3404 Don't sink argument loads into loops or other bad places. This disables folding of argument loads with instructions that are not in the entry block.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20228 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-17 19:40:32 +00:00
Chris Lattner
ac9dc08c7f Adjust to changes in SelectionDAG interface.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19779 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-23 04:36:26 +00:00
Chris Lattner
68cd65ea68 Get this to work for 64-bit systems.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19763 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-22 23:04:37 +00:00
Chris Lattner
2c49f27955 Support targets that do not use i8 shift amounts.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19707 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-19 22:31:21 +00:00
Chris Lattner
ef5cd1d3cf Teach legalize to promote copy(from|to)reg, instead of making the isel pass
do it.  This results in better code on X86 for floats (because if strict
precision is not required, we can elide some more expensive double -> float
conversions like the old isel did), and allows other targets to emit
CopyFromRegs that are not legal for arguments.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19668 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-18 17:54:55 +00:00
Chris Lattner
f30b73b1c6 Allow setcc operations to have nonbool types.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19656 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-18 02:52:03 +00:00
Chris Lattner
d3948116b8 Non-volatile loads can be freely reordered against each other. This fixes
X86/reg-pressure.ll again, and allows us to do nice things in other cases.
For example, we now codegen this sort of thing:

int %loadload(int *%X, int* %Y) {
  %Z = load int* %Y
  %Y = load int* %X      ;; load between %Z and store
  %Q = add int %Z, 1
  store int %Q, int* %Y
  ret int %Y
}

Into this:

loadload:
        mov %EAX, DWORD PTR [%ESP + 4]
        mov %EAX, DWORD PTR [%EAX]
        mov %ECX, DWORD PTR [%ESP + 8]
        inc DWORD PTR [%ECX]
        ret

where we weren't able to form the 'inc [mem]' before.  This also lets the
instruction selector emit loads in any order it wants to, which can be good
for register pressure as well.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19644 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-17 22:19:26 +00:00
Chris Lattner
a651cf67b7 Don't call SelectionDAG.getRoot() directly, go through a forwarding method.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19642 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-17 19:43:36 +00:00
Chris Lattner
0afa8e348e Implement a target independent optimization to codegen arguments only into
the basic block that uses them if possible.  This is a big win on X86, as it
lets us fold the argument loads into instructions and reduce register pressure
(by not loading all of the arguments in the entry block).

For this (contrived to show the optimization) testcase:

int %argtest(int %A, int %B) {
        %X = sub int 12345, %A
        br label %L
L:
        %Y = add int %X, %B
        ret int %Y
}

we used to produce:

argtest:
        mov %ECX, DWORD PTR [%ESP + 4]
        mov %EAX, 12345
        sub %EAX, %ECX
        mov %EDX, DWORD PTR [%ESP + 8]
.LBBargtest_1:  # L
        add %EAX, %EDX
        ret


now we produce:

argtest:
        mov %EAX, 12345
        sub %EAX, DWORD PTR [%ESP + 4]
.LBBargtest_1:  # L
        add %EAX, DWORD PTR [%ESP + 8]
        ret

This also fixes the FIXME in the code.

BTW, this occurs in real code.  164.gzip shrinks from 8623 to 8608 lines of
.s file.  The stack frame in huft_build shrinks from 1644->1628 bytes,
inflate_codes shrinks from 116->108 bytes, and inflate_block from 2620->2612,
due to fewer spills.

Take that alkis. :-)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19639 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-17 17:55:19 +00:00
Chris Lattner
068a81e9fc Refactor code into a new method.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19635 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-17 17:15:02 +00:00
Chris Lattner
171453a284 add method stub
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19612 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-16 07:28:41 +00:00
Chris Lattner
c8ea3c4710 Add support for promoted registers being live across blocks.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19595 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-16 02:23:07 +00:00
Chris Lattner
98e5c0e5e4 Use the new TLI method to get this.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19582 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-16 01:11:19 +00:00
Chris Lattner
fb849800ea Add support for targets that require promotions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19579 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-16 00:37:38 +00:00
Chris Lattner
859157daee Add new SIGN_EXTEND_INREG, ZERO_EXTEND_INREG, and FP_ROUND_INREG operators.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19568 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-15 06:17:04 +00:00
Chris Lattner
69a52155d2 Adjust to CopyFromReg changes, implement deletion of truncating/extending
stores/loads.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19562 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-14 22:38:01 +00:00
Chris Lattner
18c2f13e0f Add new ImplicitDef node, rename CopyRegSDNode class to RegSDNode.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19535 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-13 20:50:02 +00:00
Chris Lattner
5a6c6d98d5 Don't forget the existing root.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19531 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-13 19:53:14 +00:00
Chris Lattner
ddb870b065 Codegen independent ops as being independent.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19528 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-13 17:59:43 +00:00
Chris Lattner
7944d9d995 Add an option to view the selection dags as they are generated.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19498 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-12 03:41:21 +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
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
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
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
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
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
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
1c08c714bb Initial implementation of the SelectionDAGISel class. This contains most
of the code for lowering from LLVM code to a SelectionDAG.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19331 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-07 07:47:53 +00:00