Commit Graph

165 Commits

Author SHA1 Message Date
Chris Lattner
41be951a47 Print some new nodes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21001 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-02 03:30:42 +00:00
Chris Lattner
f4b457987f Fix a bug when inserting a libcall into a function with no other calls.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20999 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-02 03:22:40 +00:00
Nate Begeman
ea19cd51aa Fix a warning about an unhandled switch case
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20994 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-02 00:41:14 +00:00
Nate Begeman
fc1b1dad88 Add ISD::UNDEF node
Teach the SelectionDAG code how to expand and promote it
Have PPC32 LowerCallTo generate ISD::UNDEF for int arg regs used up by fp
  arguments, but not shadowing their value.  This allows us to do the right
  thing with both fixed and vararg floating point arguments.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20988 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-01 22:34:39 +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
Chris Lattner
d4e50bb2e2 implement legalization of build_pair for nate
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20901 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-28 22:03:13 +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
Chris Lattner
ee639f1760 Fix a bug where we would incorrectly do a sign ext instead of a zero ext
because we were checking the wrong thing.  Thanks to andrew for pointing
this out!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20554 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-10 20:55:51 +00:00
Chris Lattner
14723c264d constant fold FP_ROUND_INREG, ZERO_EXTEND_INREG, and SIGN_EXTEND_INREG
This allows the alpha backend to compile:

bool %test(uint %P) {
        %c = seteq uint %P, 0
        ret bool %c
}

into:

test:
        ldgp $29, 0($27)
        ZAP $16,240,$0
        CMPEQ $0,0,$0
        AND $0,1,$0
        ret $31,($26),1

instead of:

test:
        ldgp $29, 0($27)
        ZAP $16,240,$0
        ldiq $1,0
        ZAP $1,240,$1
        CMPEQ $0,$1,$0
        AND $0,1,$0
        ret $31,($26),1

... and fixes PR534.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20534 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-09 18:37:12 +00:00
Chris Lattner
84734ce8ef Fix a bug in the 'store fpimm, ptr' -> 'store intimm, ptr' handling code.
Changing 'op' here caused us to not enter the store into a map, causing
reemission of the code!!  In practice, a simple loop like this:

no_exit:                ; preds = %no_exit, %entry
        %indvar = phi uint [ %indvar.next, %no_exit ], [ 0, %entry ]            ; <uint> [#uses=3]
        %tmp.4 = getelementptr "complex long double"* %P, uint %indvar, uint 0          ; <double*> [#uses=1]
        store double 0.000000e+00, double* %tmp.4
        %indvar.next = add uint %indvar, 1              ; <uint> [#uses=2]
        %exitcond = seteq uint %indvar.next, %N         ; <bool> [#uses=1]
        br bool %exitcond, label %return, label %no_exit

was being code gen'd to:

.LBBtest_1:     # no_exit
        movl %edx, %esi
        shll $4, %esi
        movl $0, 4(%eax,%esi)
        movl $0, (%eax,%esi)
        incl %edx
        movl $0, (%eax,%esi)
        movl $0, 4(%eax,%esi)
        cmpl %ecx, %edx
        jne .LBBtest_1  # no_exit

Note that we are doing 4 32-bit stores instead of 2.  Now we generate:

.LBBtest_1:     # no_exit
        movl %edx, %esi
        incl %esi
        shll $4, %edx
        movl $0, (%eax,%edx)
        movl $0, 4(%eax,%edx)
        cmpl %ecx, %esi
        movl %esi, %edx
        jne .LBBtest_1  # no_exit

This is much happier, though it would be even better if the increment of ESI
was scheduled after the compare :-/


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20265 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-22 07:23:39 +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
d8658616cf Don't rely on doubles comparing identical to each other, which doesn't work
for 0.0 and -0.0.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20230 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-17 20:17:32 +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
595dc5408a Fix a case where were incorrectly compiled cast from short to int on 64-bit
targets.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20030 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-04 18:39:19 +00:00
Chris Lattner
272455b404 Fix yet another memset issue.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19986 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-02 03:44:41 +00:00
Chris Lattner
deb692e756 Fix some bugs andrew noticed legalizing memset for alpha
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19969 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-01 18:38:28 +00:00
Chris Lattner
99939d39c9 Alpha doesn't have a native f32 extload instruction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19880 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-28 22:58:25 +00:00
Chris Lattner
e76ad6de40 implement legalization of truncates whose results and sources need to be
truncated, e.g. (truncate:i8 something:i16) on a 32 or 64-bit RISC.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19879 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-28 22:52:50 +00:00
Chris Lattner
e560521f1a Get alpha working with memset/memcpy/memmove
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19878 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-28 22:29:18 +00:00
Chris Lattner
13c184de29 CopyFromReg produces two values. Make sure that we remember that both are
legalized, and actually return the correct result when we legalize the chain first.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19866 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-28 06:27:38 +00:00
Chris Lattner
fed5577066 Silence optimized warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19797 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-23 23:19:44 +00:00
Chris Lattner
9c32d3b798 Adjust to changes in SelectionDAG interfaces
The first half of correct chain insertion for libcalls. This is not enough
to fix Fhourstones yet though.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19781 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-23 04:42:50 +00:00
Chris Lattner
b48da39536 Remove the 3 HACK HACK HACKs I put in before, fixing them properly with
the new TLI that is available.

Implement support for handling out of range shifts.  This allows us to
compile this code (a 64-bit rotate):

unsigned long long f3(unsigned long long x) {
  return (x << 32) | (x >> (64-32));
}

into this:

f3:
        mov %EDX, DWORD PTR [%ESP + 4]
        mov %EAX, DWORD PTR [%ESP + 8]
        ret

GCC produces this:

$ gcc t.c -masm=intel -O3 -S -o - -fomit-frame-pointer
..
f3:
        push    %ebx
        mov     %ebx, DWORD PTR [%esp+12]
        mov     %ecx, DWORD PTR [%esp+8]
        mov     %eax, %ebx
        mov     %edx, %ecx
        pop     %ebx
        ret

The Simple ISEL produces (eww gross):

f3:
        sub %ESP, 4
        mov DWORD PTR [%ESP], %ESI
        mov %EDX, DWORD PTR [%ESP + 8]
        mov %ECX, DWORD PTR [%ESP + 12]
        mov %EAX, 0
        mov %ESI, 0
        or %EAX, %ECX
        or %EDX, %ESI
        mov %ESI, DWORD PTR [%ESP]
        add %ESP, 4
        ret


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19780 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-23 04:39:44 +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
7cd50cf286 More bugfixes for IA64 shifts.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19739 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-22 00:33:03 +00:00
Chris Lattner
27ff112948 Fix problems with non-x86 targets.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19738 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-22 00:31:52 +00:00
Chris Lattner
a7306db5f7 Add a nasty hack to fix Alpha/IA64 multiplies by a power of two.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19737 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-22 00:20:42 +00:00
Chris Lattner
9bb86f46e1 Remove unneeded line.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19736 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-21 23:43:12 +00:00
Chris Lattner
1e7ceaf0a0 test commit
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19735 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-21 23:38:56 +00:00
Chris Lattner
a93ec3ebfb Unary token factor nodes are unneeded.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19727 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-21 18:01:22 +00:00
Chris Lattner
77e77a6aa0 Refactor libcall code a bit. Initial implementation of expanding int -> FP
operations for 64-bit integers.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19724 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-21 06:05:23 +00:00
Chris Lattner
e5544f851a Simplify the shift-expansion code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19721 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-20 20:29:23 +00:00
Chris Lattner
84f6788044 Expand add/sub into ADD_PARTS/SUB_PARTS instead of a non-existant libcall.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19715 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-20 18:52:28 +00:00
Chris Lattner
17eee18f40 implement add_parts/sub_parts.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19714 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-20 18:50:55 +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
3d9dffc586 Add support for targets that pass args in registers to calls.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19703 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-19 20:24:35 +00:00
Chris Lattner
1e81b9e511 Fold single use token factor nodes into other token factor nodes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19701 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-19 19:10:54 +00:00
Chris Lattner
ec39a45bdb Realize the individual pieces of an expanded copytoreg/store/load are
independent of each other.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19700 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-19 18:02:17 +00:00
Chris Lattner
39908e0ce0 Know some identities about tokenfactor nodes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19699 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-19 18:01:40 +00:00
Chris Lattner
88218ef706 Know some simple identities. This improves codegen for (1LL << N).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19698 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-19 17:29:49 +00:00
Chris Lattner
e34b396ab7 Implement a way of expanding shifts. This applies to targets that offer
select operations or to shifts that are by a constant.  This automatically
implements (with no special code) all of the special cases for shift by 32,
shift by < 32 and shift by > 32.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19679 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-19 04:19:40 +00:00
Chris Lattner
d6e496732b Add a hook to find out how the target handles shift amounts that are out of
range.  Either they are undefined (the default), they mask the shift amount
to the size of the register (X86, Alpha, etc), or they extend the shift (PPC).

This defaults to undefined, which is conservatively correct.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19677 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-19 03:36:14 +00:00
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
4a9b4f1943 Keep track of the retval type as well.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19670 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-18 19:26:36 +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