Commit Graph

4286 Commits

Author SHA1 Message Date
Owen Anderson
fe0c882e5a As Chris and Evan pointed out, BreakCriticalMachineEdges doesn't really need
to be a pass of its own.  Instead, move it out into a helper method.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44002 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-12 01:05:09 +00:00
Hartmut Kaiser
7168be956d Fixed a strange construct. Please review.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43960 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-09 19:59:00 +00:00
Duncan Sands
fd617d0143 Move MinAlign to MathExtras.h.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43944 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-09 13:41:39 +00:00
Duncan Sands
c6fa170b4d Fix some load/store logic that would be wrong for
apints on big-endian machines if the bitwidth is
not a multiple of 8.  Introduce a new helper,
MVT::getStoreSizeInBits, and use it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43934 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-09 08:57:19 +00:00
Duncan Sands
f6bd0ce4c9 Add terminating newline.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43933 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-09 08:30:21 +00:00
Evan Cheng
cc41586b9d Much improved pic jumptable codegen:
Then:
        call    "L1$pb"
"L1$pb":
        popl    %eax
		...
LBB1_1: # entry
        imull   $4, %ecx, %ecx
        leal    LJTI1_0-"L1$pb"(%eax), %edx
        addl    LJTI1_0-"L1$pb"(%ecx,%eax), %edx
        jmpl    *%edx

        .align  2
        .set L1_0_set_3,LBB1_3-LJTI1_0
        .set L1_0_set_2,LBB1_2-LJTI1_0
        .set L1_0_set_5,LBB1_5-LJTI1_0
        .set L1_0_set_4,LBB1_4-LJTI1_0
LJTI1_0:
        .long    L1_0_set_3
        .long    L1_0_set_2

Now:
        call    "L1$pb"
"L1$pb":
        popl    %eax
		...
LBB1_1: # entry
        addl    LJTI1_0-"L1$pb"(%eax,%ecx,4), %eax
        jmpl    *%eax

		.align  2
		.set L1_0_set_3,LBB1_3-"L1$pb"
		.set L1_0_set_2,LBB1_2-"L1$pb"
		.set L1_0_set_5,LBB1_5-"L1$pb"
		.set L1_0_set_4,LBB1_4-"L1$pb"
LJTI1_0:
        .long    L1_0_set_3
        .long    L1_0_set_2


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43924 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-09 01:32:10 +00:00
Evan Cheng
2dfdefd282 Didn't mean to check these in.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43923 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-09 01:28:33 +00:00
Evan Cheng
7da8f399bf Bug fix. Passive nodes are not in SUnitMap.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43922 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-09 01:27:11 +00:00
Owen Anderson
0823cea34a This preserves critical edge breaking.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43911 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-08 22:23:57 +00:00
Owen Anderson
d195ce1fb6 Make BreakCriticalMachineEdges available as a pass that can be depended on.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43910 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-08 22:20:23 +00:00
Evan Cheng
4471194d69 If both parts of smul_lohi, etc. are used, don't simplify. If only one part is used, try simplify it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43888 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-08 09:25:29 +00:00
Owen Anderson
01f43a4d55 Add the majority of machine-level critical edge breaking pass. Most of this was written by Fernando, cleanup and updating to TOT by me.
This still needs a bit of work, particularly to handle jump tables properly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43885 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-08 07:55:43 +00:00
Owen Anderson
14b3fb7805 Take another stab at getting isLiveIn() and isLiveOut() right.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43869 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-08 01:32:45 +00:00
Owen Anderson
a018540807 Bring UsedBlocks back. StrongPHIElimination needs this information.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43866 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-08 01:20:48 +00:00
Evan Cheng
29121848b9 Simplify my (il)logic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43819 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-07 08:08:25 +00:00
Owen Anderson
60a877d713 Add some more of StrongPHIElim.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43805 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-07 05:17:15 +00:00
Dan Gohman
0d97426b7b Remainder operations must be either integer or floating-point.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43781 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-06 22:11:54 +00:00
Evan Cheng
be6781b5d0 When the allocator rewrite a spill register with new virtual register, it replaces other operands of the same register. Watch out for situations where
only some of the operands are sub-register uses.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43776 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-06 21:12:10 +00:00
Evan Cheng
8fc9a10221 First step towards moving the coalescer to priority_queue based machinery.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43764 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-06 08:52:21 +00:00
Evan Cheng
ab84724297 Fix a bug where a def use operand isn't being detected as a sub-register use.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43763 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-06 08:50:44 +00:00
Evan Cheng
1fd15ba961 Add pseudo dependency to force two-address instruction to be scheduled after
other uses. There was a overly restricted check that prevented some obvious
cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43762 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-06 08:44:59 +00:00
Owen Anderson
8b96b9fce0 Add a few comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43755 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-06 05:26:02 +00:00
Owen Anderson
ee49b5385b DomForest is a forest of registers, not instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43754 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-06 05:22:43 +00:00
Owen Anderson
a4ad2e740a StrongPHIElimination requires LiveVariables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43751 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-06 04:49:43 +00:00
Dan Gohman
80176319f3 Add support for vector remainder operations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43744 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-05 23:35:22 +00:00
Rafael Espindola
f1ba1cad38 Move the LowerMEMCPY and LowerMEMCPYCall to a common place.
Thanks for the suggestions Bill :-)



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43742 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-05 23:12:20 +00:00
Dale Johannesen
eb57ea7ea2 Make labels work in asm blocks; allow labels as
parameters.  Rename ValueRefList to ParamList
in AsmParser, since its only use is for parameters.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43734 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-05 21:20:28 +00:00
Duncan Sands
0c8a13b510 Don't output ABI size padding twice. By using the store
size for the field we get ABI padding automatically, so
no need to put it in again when we emit the field.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43720 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-05 18:03:02 +00:00
Evan Cheng
a461c4d75b Move SimpleRegisterCoalescing.h to lib/CodeGen since there is now a common
register coalescer interface: RegisterCoalescing.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43714 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-05 17:41:38 +00:00
Evan Cheng
5031fd2d32 Skip over deleted val#'s.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43700 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-05 06:46:45 +00:00
Evan Cheng
5942efb0e5 Handle cases where a register and one of its super-register are both marked as
defined on the same instruction. This fixes PR1767.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43699 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-05 03:11:55 +00:00
Evan Cheng
5f5f3b6333 Fix PR1187.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43692 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-05 00:59:10 +00:00
Duncan Sands
ca0ed74485 Eliminate the remaining uses of getTypeSize. This
should only effect x86 when using long double.  Now
12/16 bytes are output for long double globals (the
exact amount depends on the alignment).  This brings
globals in line with the rest of LLVM: the space
reserved for an object is now always the ABI size.
One tricky point is that only 10 bytes should be
output for long double if it is a field in a packed
struct, which is the reason for the additional
argument to EmitGlobalConstant.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43688 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-05 00:04:43 +00:00
Owen Anderson
83430bce1d Another step of stronger PHI elimination down.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43684 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-04 22:33:26 +00:00
Evan Cheng
9aeaf7593b If an interval is being undone clear its preference as well since the source interval may have been undone as well.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43670 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-04 08:32:21 +00:00
Evan Cheng
c92da3882e There are times when the coalescer would not coalesce away a copy but the copy
can be eliminated by the allocator is the destination and source targets the
same register. The most common case is when the source and destination registers
are in different class. For example, on x86 mov32to32_ targets GR32_ which
contains a subset of the registers in GR32.

The allocator can do 2 things:
1. Set the preferred allocation for the destination of a copy to that of its source.
2. After allocation is done, change the allocation of a copy destination (if
   legal) so the copy can be eliminated.

This eliminates 443 extra moves from 403.gcc.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43662 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-03 07:20:12 +00:00
Dan Gohman
111c4f897e Add std:: to sort calls.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43652 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-02 22:24:01 +00:00
Dan Gohman
b61f2f061f Change illegal uses of ++ to uses of STLExtra.h's next function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43651 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-02 22:22:02 +00:00
Evan Cheng
7277a7d031 One more extract_subreg coalescing bug.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43644 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-02 17:35:08 +00:00
Duncan Sands
e414cdacb4 Fix a thinko.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43639 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-02 15:18:06 +00:00
Duncan Sands
514ab348fd Executive summary: getTypeSize -> getTypeStoreSize / getABITypeSize.
The meaning of getTypeSize was not clear - clarifying it is important
now that we have x86 long double and arbitrary precision integers.
The issue with long double is that it requires 80 bits, and this is
not a multiple of its alignment.  This gives a primitive type for
which getTypeSize differed from getABITypeSize.  For arbitrary precision
integers it is even worse: there is the minimum number of bits needed to
hold the type (eg: 36 for an i36), the maximum number of bits that will
be overwriten when storing the type (40 bits for i36) and the ABI size
(i.e. the storage size rounded up to a multiple of the alignment; 64 bits
for i36).

This patch removes getTypeSize (not really - it is still there but
deprecated to allow for a gradual transition).  Instead there is:

(1) getTypeSizeInBits - a number of bits that suffices to hold all
values of the type.  For a primitive type, this is the minimum number
of bits.  For an i36 this is 36 bits.  For x86 long double it is 80.
This corresponds to gcc's TYPE_PRECISION.

(2) getTypeStoreSizeInBits - the maximum number of bits that is
written when storing the type (or read when reading it).  For an
i36 this is 40 bits, for an x86 long double it is 80 bits.  This
is the size alias analysis is interested in (getTypeStoreSize
returns the number of bytes).  There doesn't seem to be anything
corresponding to this in gcc.

(3) getABITypeSizeInBits - this is getTypeStoreSizeInBits rounded
up to a multiple of the alignment.  For an i36 this is 64, for an
x86 long double this is 96 or 128 depending on the OS.  This is the
spacing between consecutive elements when you form an array out of
this type (getABITypeSize returns the number of bytes).  This is
TYPE_SIZE in gcc.

Since successive elements in a SequentialType (arrays, pointers
and vectors) need to be aligned, the spacing between them will be
given by getABITypeSize.  This means that the size of an array
is the length times the getABITypeSize.  It also means that GEP
computations need to use getABITypeSize when computing offsets.
Furthermore, if an alloca allocates several elements at once then
these too need to be aligned, so the size of the alloca has to be
the number of elements multiplied by getABITypeSize.  Logically
speaking this doesn't have to be the case when allocating just
one element, but it is simpler to also use getABITypeSize in this
case.  So alloca's and mallocs should use getABITypeSize.  Finally,
since gcc's only notion of size is that given by getABITypeSize, if
you want to output assembler etc the same as gcc then getABITypeSize
is the size you want.

Since a store will overwrite no more than getTypeStoreSize bytes,
and a read will read no more than that many bytes, this is the
notion of size appropriate for alias analysis calculations.

In this patch I have corrected all type size uses except some of
those in ScalarReplAggregates, lib/Codegen, lib/Target (the hard
cases).  I will get around to auditing these too at some point,
but I could do with some help.

Finally, I made one change which I think wise but others might
consider pointless and suboptimal: in an unpacked struct the
amount of space allocated for a field is now given by the ABI
size rather than getTypeStoreSize.  I did this because every
other place that reserves memory for a type (eg: alloca) now
uses getABITypeSize, and I didn't want to make an exception
for unpacked structs, i.e. I did it to make things more uniform.
This only effects structs containing long doubles and arbitrary
precision integers.  If someone wants to pack these types more
tightly they can always use a packed struct.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43620 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-01 20:53:16 +00:00
Evan Cheng
0547bab214 - Coalesce extract_subreg when both intervals are relatively small.
- Some code clean up.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43606 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-01 06:22:48 +00:00
Duncan Sands
7169a2f9e8 Promotion of sdiv/srem/udiv/urem.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43551 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-31 08:57:43 +00:00
Duncan Sands
1bd3271b16 Add a newline at the end of the file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43550 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-31 08:49:24 +00:00
Owen Anderson
0bda0e8895 Add the skeleton of a better PHI elimination pass.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43542 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-31 03:37:57 +00:00
Owen Anderson
5d32ec4cb0 Some fixes to get MachineDomTree working better.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43541 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-31 03:30:14 +00:00
Dale Johannesen
25f1d08619 Make i64=expand_vector_elt(v2i64) work in 32-bit mode.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43535 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-31 00:32:36 +00:00
Evan Cheng
de1631bc85 Typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43511 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-30 20:11:21 +00:00
Duncan Sands
01405f9284 Add support for expanding trunc stores. Consider
storing an i170 on a 32 bit machine.  This is first
promoted to a trunc-i170 store of an i256.  On a
little-endian machine this expands to a store of
an i128 and a trunc-i42 store of an i128.  The
trunc-i42 store is further expanded to a trunc-i42
store of an i64, then to a store of an i32 and a
trunc-i10 store of an i32.  At this point the operand
type is legal (i32) and expansion stops (legalization
of the trunc-i10 needs to be handled in LegalizeDAG.cpp).
On big-endian machines the high bits are stored first,
and some bit-fiddling is needed in order to generate
aligned stores.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43499 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-30 12:50:39 +00:00
Duncan Sands
ba3b1d10fd If a call to getTruncStore is for a normal store,
offload to getStore rather than trying to handle
both cases at once (the assertions for example
assume the store really is truncating).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43498 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-30 12:40:58 +00:00