Commit Graph

93 Commits

Author SHA1 Message Date
Chris Lattner
d5d5682512 Zero is cheaper than sign extend.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19675 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-18 21:57:59 +00:00
Chris Lattner
47e9223e06 Fix some fixmes (promoting bools for select and brcond), fix promotion
of zero and sign extends.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19671 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-18 19:27:06 +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
82fbfb6984 Teach legalize to promote SetCC results.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19657 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-18 02:59:52 +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
8ac532c55e Implement legalize of call nodes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19617 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-16 19:46:48 +00:00
Chris Lattner
55ba8fba75 Revamp supported ops. Instead of just being supported or not, we now keep
track of how to deal with it, and provide the target with a hook that they
can use to legalize arbitrary operations in arbitrary ways.

Implement custom lowering for a couple of ops, implement promotion for select
operations (which x86 needs).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19613 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-16 07:29:19 +00:00
Chris Lattner
f8161d83f0 Implement some more missing promotions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19606 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-16 05:06:12 +00:00
Chris Lattner
9467497ae2 Clarify assertion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19597 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-16 02:23:34 +00:00
Chris Lattner
71c42a0190 Move some information into the TargetLowering object.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19583 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-16 01:11:45 +00:00
Chris Lattner
1713e73b8a legalize a bunch of operations that I missed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19580 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-16 00:38:00 +00:00
Chris Lattner
ff3e50cc39 Fix some serious bugs in promotion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19578 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-16 00:17:42 +00:00
Chris Lattner
8b6fa22e72 Implement promotion of a whole bunch more operators. I think that this is
basically everything.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19576 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-15 22:16:26 +00:00
Chris Lattner
45b8caf1c5 Add support for legalizing FP_ROUND_INREG, SIGN_EXTEND_INREG, and
ZERO_EXTEND_INREG for targets that don't support them.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19573 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-15 07:15:18 +00:00
Chris Lattner
0f69b29108 Add support for promoting ADD/MUL.
Add support for new SIGN_EXTEND_INREG, ZERO_EXTEND_INREG, and FP_ROUND_INREG operators.
Realize that if we do any promotions, we need to iterate SelectionDAG
construction.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19569 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-15 06:18:18 +00:00
Chris Lattner
03c8546ec5 Add intitial support for promoting some operators.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19565 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-15 05:21:40 +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
2ee743ff9b Start implementing truncating stores and extending loads.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19559 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-14 22:08:15 +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
a385e9b20f Legalize new node, add assertion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19527 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-13 17:59:25 +00:00
Chris Lattner
2dad454af6 Fix sign extend to long. When coming from sbyte, we used to generate:
movsbl 4(%esp), %eax
        movl %eax, %edx
        sarl $7, %edx

Now we generate:

        movsbl 4(%esp), %eax
        movl %eax, %edx
        sarl $31, %edx

Which is right.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19515 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-12 18:19:52 +00:00
Reid Spencer
3bfbf4ea99 Shut up warnings with GCC 3.4.3 about uninitialized variables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19512 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-12 14:53:45 +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
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
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
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
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
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
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
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
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
Chris Lattner
62fd269c14 After legalizing a DAG, delete dead nodes to save space.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19346 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-07 21:09:37 +00:00
Chris Lattner
c18ae4cb6a Teach legalize how to handle condbranches
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19339 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-07 08:19:42 +00:00
Chris Lattner
3e928bbd61 Initial implementation of the DAG legalization. This still has a long way
to go, but it does work for some non-trivial cases now.


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