Commit Graph

3840 Commits

Author SHA1 Message Date
Chris Lattner
ea0354346f don't reserve space for tailcall arg areas. It explicitly managed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22050 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-15 06:07:10 +00:00
Chris Lattner
5fae9ccd39 Teach reginfo how to deal with ADJSTACKPTRri, allowing us to generate:
add %ESP, 20
        jmp %EDX  # TAIL CALL

instead of:
        add %ESP, -8
        add %ESP, 28
        jmp %EDX  # TAIL CALL


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22047 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-15 05:49:58 +00:00
Chris Lattner
381e88799e Implement proper tail calls in the X86 backend for all fastcc->fastcc
tail calls.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22046 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-15 05:46:45 +00:00
Chris Lattner
1e9448bce8 Add markers in the asm file for tail calls, add a new ADJSTACKPTRri
sorta-pseudo-instruction


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22042 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-15 03:10:37 +00:00
Chris Lattner
0dede079e7 Yes, calltarget is the operand of the day.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22040 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-15 01:10:30 +00:00
Chris Lattner
6972177bd4 When emitting the function epilog, check to see if there already a stack
adjustment.  If so, we merge the adjustment into the existing one.  This
allows us to generate:

caller2:
        sub %ESP, 12
        mov DWORD PTR [%ESP], 0
        mov %EAX, 1234567890
        mov %EDX, 0
        call func2
        add %ESP, 8
        ret 4

intead of:

caller2:
        sub %ESP, 12
        mov DWORD PTR [%ESP], 0
        mov %EAX, 1234567890
        mov %EDX, 0
        call func2
        sub %ESP, 4
        add %ESP, 12
        ret 4

for X86/fast-cc-merge-stack-adj.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22038 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-14 23:53:43 +00:00
Chris Lattner
2b3d56ee72 Add some new instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22036 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-14 23:35:21 +00:00
Chris Lattner
920c0aa9c2 Pass i64 values correctly split in reg/mem to fastcc calls.
This fixes fourinarow with -enable-x86-fastcc.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22022 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-14 12:03:10 +00:00
Chris Lattner
239738a162 Use target-specific nodes for calls. This allows the fastcc code to not have
to do ugly hackery to avoid emitting code like this:

   call foo
   mov vreg, EAX
   adjcallstackup ...

If foo is a fastcc call and if vreg gets spilled, we might end up with this:

   call foo
   mov [ESP+offset], EAX     ;; Offset doesn't consider the 12!
   sub ESP, 12

Which is bad.  The previous hacky code to deal with this was A) gross B) not
good enough.  In particular, it could miss cases and emit the bad code above.
Now we always emit this:

   call foo
   adjcallstackup ...
   mov vreg, EAX

directly.

This makes fastcc with callees poping the stack work much better.  Next
stop (finally!) really is tail calls.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22021 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-14 08:48:15 +00:00
Chris Lattner
67649dfc32 use a target-specific node and custom expander to lower long->FP to FILD64m.
This should fix some missing symbols problems on BSD and improve performance
of programs that use that operation.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22012 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-14 06:52:07 +00:00
Chris Lattner
10d2645710 Make sure the start of the arg area and the end (after the RA is pushed)
is always 8-byte aligned for fastcc


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21995 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-13 23:49:10 +00:00
Chris Lattner
653f7230ad fix typo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21991 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-13 22:46:57 +00:00
Chris Lattner
06cebb456a Fix the problems with callee popped argument lists
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21988 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-13 22:13:49 +00:00
Chris Lattner
ca96c8217d Don't emit SAR X, 0 in the case of sdiv Y, 2
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21986 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-13 21:50:27 +00:00
Chris Lattner
a96e577f53 Fix UnitTests/2005-05-13-SDivTwo.c
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21985 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-13 21:48:20 +00:00
Chris Lattner
3648c67eb2 switch to having the callee pop stack operands for fastcc. This is currently buggy
do not use


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21984 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-13 21:44:04 +00:00
Chris Lattner
24ddc6d067 allow RETI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21980 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-13 20:46:35 +00:00
Chris Lattner
b5d8e6ece6 treat TAILCALL nodes identically to CALL nodes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21977 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-13 20:29:26 +00:00
Chris Lattner
2e7714ad2b Build TAILCALL nodes in LowerCallTo, treat them like normal calls everywhere.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21976 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-13 20:29:13 +00:00
Chris Lattner
7d93727bb2 capitalize
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21962 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-13 19:48:34 +00:00
Chris Lattner
f8492193b9 clarify that these are v9 options
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21960 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-13 19:45:45 +00:00
Chris Lattner
6bc2dc7b2c hide this option
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21959 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-13 19:44:21 +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
1be4811d34 add 'ret imm' instruction
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21945 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-13 17:56:48 +00:00
Chris Lattner
32f3cf612e Realize that we don't support fmod directly, fixing CodeGen/Generic/print-arith-fp.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21939 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-13 16:20:22 +00:00
Chris Lattner
63602fb868 Do not CopyFromReg physregs for live-in values. Instead, create a vreg for
each live in, and copy the regs from the vregs.  As the very first thing we
do in the function, insert copies from the pregs to the vregs.  This fixes
problems where the token chain of CopyFromReg was not enough to allow reordering
of the copyfromreg nodes and other unchained nodes (e.g. div, which clobbers
eax on intel).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21932 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-13 07:38:09 +00:00
Chris Lattner
16cd04d26c rename the ADJCALLSTACKDOWN/ADJCALLSTACKUP nodes to be CALLSEQ_START/BEGIN.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21915 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-12 23:24:06 +00:00
Chris Lattner
c6f4181923 Add a new -enable-x86-fastcc option that enables passing the first
two integer values in registers for the fastcc calling conv.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21912 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-12 23:06:28 +00:00
Chris Lattner
c57f682113 Pass in Calling Convention to use into LowerCallTo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21899 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-12 19:56:45 +00:00
Chris Lattner
6649418598 Enable pattern isel by default
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21898 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-12 19:56:09 +00:00
Chris Lattner
9bce0f92c3 These targets don't like setcc
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21884 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-12 02:06:00 +00:00
Nate Begeman
d7c4a4a6c0 Necessary changes to codegen cttz efficiently on PowerPC
1. Teach LegalizeDAG how to better legalize CTTZ if the target doesn't have
   CTPOP, but does have CTLZ
2. Teach PPC32 how to do sub x, const -> add x, -const for valid consts
3. Teach PPC32 how to do and (xor a, -1) b -> andc b, a
4. Teach PPC32 that ISD::CTLZ -> PPC::CNTLZW


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21880 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-11 23:43:56 +00:00
Tanya Lattner
d977095838 Fixed issue that broke ssa.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21878 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-11 21:45:03 +00:00
Chris Lattner
4548a0ed32 fix some GCC 4 warnings
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21877 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-11 21:40:40 +00:00
John Criswell
3163e2d9f3 Added support for decomposing constant expressions containing shr and shl
instructions.
Review of this commit would be greatly appreciated.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21876 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-11 21:16:42 +00:00
Duraid Madina
63bbed536c add the popcount instruction and support this in the isel
the primary user of this will probably end up being find-first-set-bit/find-
last-set-bit, which i'll get around to...


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21860 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-11 05:16:09 +00:00
Chris Lattner
1f38e5c431 No really IA*64* :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21858 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-11 05:03:56 +00:00
Chris Lattner
c610d4267f X86 has more than just 32-bit registers
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21857 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-11 05:00:34 +00:00
Chris Lattner
6415bb4c29 Convert feature of the simple isel over for the pattern isel to use.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21840 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-10 03:53:18 +00:00
Jeff Cohen
19bb2283e6 Silence some VC++ warnings
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21838 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-10 02:22:38 +00:00
Chris Lattner
966cdfb600 Implement READPORT/WRITEPORT, implementing the last X86 regression tests
that were failing with the pattern selector.  Note that the support that
existed in the simple selector was clearly broken in several ways though
(which has also been fixed).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21831 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-09 21:17:38 +00:00
Chris Lattner
cecd67b432 do not emit illegal instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21830 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-09 21:06:04 +00:00
Chris Lattner
82c7897f49 Fix the syntax of the i/o instructions, these are obviously unused.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21829 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-09 20:49:20 +00:00
Chris Lattner
4e6ce5f9c7 legalize readio/writeio into load/stores, fixing CodeGen/X86/io.llx with
the pattern isel.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21828 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-09 20:37:29 +00:00
Chris Lattner
a0dbf181e0 restore some non-dead code I removed last night breaking double casts to
uint


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21821 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-09 18:37:02 +00:00
Chris Lattner
cafb67b250 fold and (shl X, C1), C2 -> rlwinm when possible. Many other cases are possible,
include and (srl)    and the inverses (shl and) etc.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21820 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-09 17:39:48 +00:00
Duraid Madina
8a3042c872 fix and cleanup constmul code a bit, this fixes mediabench/toast and
probably a couple of other tests.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21814 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-09 13:18:34 +00:00
Chris Lattner
a80d2bd89c Wrap long lines, remove dead code that is now handled by legalize
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21811 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-09 05:40:26 +00:00
Chris Lattner
2afa1910d4 Fix FP -> bool casts
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21810 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-09 05:33:18 +00:00
Chris Lattner
e3e0f2765a Fix X86/2005-05-08-FPStackifierPHI.ll: ugly gross hack.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21801 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-09 03:36:39 +00:00