Commit Graph

5944 Commits

Author SHA1 Message Date
David Greene
c5e7e8d87d Add setSubgraphColor to color an entire portion of a SelectionDAG. This
will be used to support debug features in TableGen.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58257 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-27 18:17:03 +00:00
David Greene
26b86a0b56 Fix PR2634. Create new virtual registers from spills early so that we
can give it the same stack slot as the spilled interval if it is folded.
This prevents the fold/unfold code from pointing to the wrong register.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58255 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-27 17:38:59 +00:00
Duncan Sands
0dc4045bd2 Fix UpdateNodeOperands so that it does CSE of calls
(and a bunch of other node types).  While there, I
added a doNotCSE predicate and used it to reduce code
duplication (some of the duplicated code was wrong...).
This fixes ARM/cse-libcalls.ll when using LegalizeTypes. 


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58249 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-27 15:30:53 +00:00
Duncan Sands
20f04e9fdd Fix a bug in which a node could be added to the
worklist twice: UpdateNodeOperands could morph
a new node into a node already on the worklist.
We would then recalculate the NodeId for this
existing node and add it to the worklist.  The
testcase is ARM/cse-libcalls.ll, the problem
showing up once UpdateNodeOperands is taught to
do CSE for calls.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58246 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-27 13:18:32 +00:00
Duncan Sands
7cb07874dc Turn on LegalizeTypes, the new type legalization
codegen infrastructure, by default.  Please report
any breakage to the mailing lists.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58232 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-27 08:42:46 +00:00
Evan Cheng
23066288fd For now, don't split live intervals around x87 stack register barriers. FpGET_ST0_80 must be right after a call instruction (and ADJCALLSTACKUP) so we need to find a way to prevent reload of x87 registers between them.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58230 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-27 07:14:50 +00:00
Dale Johannesen
622addbe49 Increase default setting of tail-merge-threshold to
150, based on llvm-test measurements.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58225 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-27 02:10:21 +00:00
Evan Cheng
aaf510c932 Do not shrink wrap live interval in a mbb if it's livein any of its successor blocks. The mbb can be revisited again after all of the successors are processed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58184 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-26 07:49:03 +00:00
Evan Cheng
79d5b5acae Handle cases where there aren't uses in the barrier mbb.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58174 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-25 23:49:39 +00:00
Dan Gohman
048ca55dc1 SDNodes may have at most one Flag result. Update this comment
to reflect that.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58145 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-25 17:51:24 +00:00
Dan Gohman
71b7f646de Move the code that adds the DeadMachineInstructionElimPass from
target-independent code to target-specific code. This prevents it
from running on targets that aren't using fast-isel.

In addition to saving compile time, this addresses the problem
that not all targets are prepared for it. In order to use this
pass, all instructions must declare all their fixed uses and
defs of physical registers.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58144 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-25 17:46:52 +00:00
Evan Cheng
78dfef771b If val# def is ~0U, meaning it's defined by a PHI, and it's previously split, spill before the barrier because it's impossible to determine if all the defs are spilled in the same spill slot.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58129 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-25 00:52:41 +00:00
Evan Cheng
56ab0def90 Fix a pasto.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58102 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-24 18:46:44 +00:00
Evan Cheng
2efe3fd79a Fix a end() dereference; remove an abort() that wasn't meant to be left in.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58072 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-24 05:53:44 +00:00
Evan Cheng
06587497dc Avoid splitting an interval multiple times; avoid splitting re-materializable val# (for now).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58068 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-24 02:05:00 +00:00
Dale Johannesen
fea9088030 Initialize uninitialized variable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58057 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-24 01:06:58 +00:00
Evan Cheng
f5cd4f0d70 Committing a good chunk of the pre-register allocation live interval splitting pass. It's handling simple cases and appear to do good things. Next: avoid splitting an interval multiple times; renumber registers when possible; record stack slot live intervals for coloring; rematerialize defs when possible.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58044 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-23 20:43:13 +00:00
Duncan Sands
ee4c619b3b Fix thinko - the operand number has nothing to do
with the result number.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58041 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-23 19:34:23 +00:00
Duncan Sands
2cbe7fe396 LegalizeTypes soft-float support for fpow.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57973 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-22 11:49:09 +00:00
Duncan Sands
f9410141f7 Be nice to CellSPU: for this target getSetCCResultType
may return i8, which can result in SELECT nodes for
which the type of the condition is i8, but there are
no patterns for select with i8 condition.  Tweak the
LegalizeTypes logic to avoid this as much as possible.
This isn't a real fix because it is still perfectly
possible to end up with such select nodes - CellSPU
needs to be fixed IMHO.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57968 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-22 09:23:20 +00:00
Duncan Sands
29a2822f28 Port from LegalizeDAG the logic to only generate
ADDC/ADDE/SUBC/SUBE if the target supports it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57967 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-22 09:07:29 +00:00
Duncan Sands
3b521d5acc Add some comments explaining the meaning of a boolean
that is not of type MVT::i1 in SELECT and SETCC nodes.
Relax the LegalizeTypes SELECT condition promotion
sanity checks to allow other condition types than i1.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57966 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-22 09:06:24 +00:00
Duncan Sands
0954aefd81 Temporarily allow the operands of a BUILD_VECTOR
to have a different type to the vector element
type.  This should be fairly harmless because in
the past guys like this were being built all over
the place (and were cleaned up when I added this
check).  The reason for relaxing this check is
that it helps LegalizeTypes legalize vector
shuffles: the mask is a BUILD_VECTOR that it is
*not always possible* to legalize while keeping it
a BUILD_VECTOR (vector_shuffle requires the mask
to be a BUILD_VECTOR, as opposed to a vector with
the right vector type).  With this check it is even
harder to legalize the mask - turning the check off
means that LegalizeTypes manages to legalize almost
all vector shuffles encountered in practice.  The
correct solution is to change vector_shuffle to be a
variadic node with the mask built into it as operands.
While waiting for that change, this hack stops the
problem with vector_shuffle from blocking the turning
on of LegalizeTypes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57965 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-22 09:00:33 +00:00
Daniel Dunbar
3b0da26e20 Move Print*Pass to use raw_ostream.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57946 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-22 03:25:22 +00:00
Daniel Dunbar
f4db3a51c7 Privatize PrintModulePass and PrintFunctionPass and add
createPrintModulePass and createPrintFunctionPass.
 - So clients who compile w/o RTTI can use them.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57933 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-21 23:33:38 +00:00
Dale Johannesen
1c15bf58a3 Add an SSE2 algorithm for uint64->f64 conversion.
The same one Apple gcc uses, faster.  Also gets the
extreme case in gcc.c-torture/execute/ieee/rbug.c
correct which we weren't before; this is not
sufficient to get the test to pass though, there
is another bug.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57926 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-21 20:50:01 +00:00
Dan Gohman
7ea1ca6229 Fix SelectionDAGBuild lowering of Select instructions to
handle first-class aggregate values. Also, fix a bug in
the Ret handling for empty aggregates.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57925 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-21 20:00:42 +00:00
Dan Gohman
4401361a2f Don't create TargetGlobalAddress nodes with offsets that don't fit
in the 32-bit signed offset field of addresses. Even though this
may be intended, some linkers refuse to relocate code where the
relocated address computation overflows.

Also, fix the sign-extension of constant offsets to use the
actual pointer size, rather than the size of the GlobalAddress
node, which may be different, for example on x86-64 where MVT::i32
is used when the address is being fit into the 32-bit displacement
field.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57885 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-21 03:38:42 +00:00
Dan Gohman
279c22e6da Optimized FCMP_OEQ and FCMP_UNE for x86.
Where previously LLVM might emit code like this:

        ucomisd %xmm1, %xmm0
        setne   %al
        setp    %cl
        orb     %al, %cl
        jne     .LBB4_2

it now emits this:

        ucomisd %xmm1, %xmm0
        jne     .LBB4_2
        jp      .LBB4_2

It has fewer instructions and uses fewer registers, but it does
have more branches. And in the case that this code is followed by
a non-fallthrough edge, it may be followed by a jmp instruction,
resulting in three branch instructions in sequence. Some effort
is made to avoid this situation.

To achieve this, X86ISelLowering.cpp now recognizes FCMP_OEQ and
FCMP_UNE in lowered form, and replace them with code that emits
two branches, except in the case where it would require converting
a fall-through edge to an explicit branch.

Also, X86InstrInfo.cpp's branch analysis and transform code now
knows now to handle blocks with multiple conditional branches. It
uses loops instead of having fixed checks for up to two
instructions. It can now analyze and transform code generated
from FCMP_OEQ and FCMP_UNE.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57873 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-21 03:29:32 +00:00
Dan Gohman
3afda6e9d1 When the coalescer is doing rematerializing, have it remove
the copy instruction from the instruction list before asking the
target to create the new instruction. This gets the old instruction
out of the way so that it doesn't interfere with the target's
rematerialization code. In the case of x86, this helps it find
more cases where EFLAGS is not live.

Also, in the X86InstrInfo.cpp, teach isSafeToClobberEFLAGS to check
to see if it reached the end of the block after scanning each
instruction, instead of just before. This lets it notice when the
end of the block is only two instructions away, without doing any
additional scanning.

These changes allow rematerialization to clobber EFLAGS in more
cases, for example using xor instead of mov to set the return value
to zero in the included testcase.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57872 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-21 03:24:31 +00:00
Dan Gohman
e7d238ea23 Make the NaN test come second, heuristically assuming
that NaNs are less common.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57871 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-21 03:12:54 +00:00
Oscar Fuentes
7334b15210 CMake: updated lib/CodeGen/CMakeLists.txt
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57869 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-21 02:37:50 +00:00
Chris Lattner
01426e1a27 Fix gcc.c-torture/compile/920520-1.c by inserting bitconverts
for strange asm conditions earlier.  In this case, we have a
double being passed in an integer reg class.  Convert to like
sized integer register so that we allocate the right number 
for the class (two i32's for the f64 in this case).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57862 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-21 00:45:36 +00:00
Evan Cheng
09e8ca8a58 Add skeleton for the pre-register allocation live interval splitting pass.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57847 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-20 21:44:59 +00:00
Dan Gohman
d659d50482 Fast-isel no longer an experiment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57845 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-20 21:30:12 +00:00
Evan Cheng
11a26f3697 Add a register class -> virtual registers map.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57844 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-20 20:03:28 +00:00
Duncan Sands
d398672ddd Support operations like fp_to_uint with a vector
result type when the result type is legal but
not the operand type.  Add additional support
for EXTRACT_SUBVECTOR and CONCAT_VECTORS,
needed to handle such cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57840 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-20 16:31:21 +00:00
Duncan Sands
b5f68e241f LegalizeTypes support for atomic operation promotion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57838 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-20 16:17:42 +00:00
Duncan Sands
49c18cce97 Use DAG.getIntPtrConstant rather than DAG.getConstant
with TLI.getPointerTy for a small simplification.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57837 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-20 16:14:43 +00:00
Duncan Sands
7e49822875 Always use either MVT::i1 or getSetCCResultType for
the condition of a SELECT node.  Make sure that the
correct extension type (any-, sign- or zero-extend)
is used.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57836 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-20 16:13:04 +00:00
Duncan Sands
ef5b199905 Formatting - no functional change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57834 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-20 16:06:47 +00:00
Duncan Sands
f6e29499ac Don't use a random type for the select condition,
use an MVT::i1 and simplify the code while there.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57833 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-20 16:04:57 +00:00
Bill Wendling
a1dc602542 Set N->OperandList to 0 after deletion. Otherwise, it's possible that it will
be either deleted or referenced afterwards.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57786 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-19 20:51:12 +00:00
Bill Wendling
181b627f62 Fix comment. Other formatting changes. No functionality changes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57785 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-19 20:34:04 +00:00
Duncan Sands
0e3da1def4 Vector shuffle mask elements may be "undef". Handle
this everywhere in LegalizeTypes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57783 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-19 15:00:25 +00:00
Duncan Sands
94989acaab Use a legal integer type for vector shuffle mask
elements.  Otherwise LegalizeTypes will, reasonably
enough, legalize the mask, which may result in it
no longer being a BUILD_VECTOR node (LegalizeDAG
simply ignores the legality or not of vector masks).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57782 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-19 14:58:05 +00:00
Chris Lattner
2a0b96c2c7 Reapply r57699 with a fix to not crash on asms with multiple results. Unlike
the previous patch this one actually passes make check.

"Fix PR2356 on PowerPC: if we have an input and output that are tied together
that have different sizes (e.g. i32 and i64) make sure to reserve registers for
the bigger operand."



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57771 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-18 18:49:30 +00:00
Dan Gohman
668aff6623 Don't truncate GlobalAddress offsets to int in debug output.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57770 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-18 18:22:42 +00:00
Evan Cheng
4ed4329c37 By min, I mean max.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57766 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-18 05:21:37 +00:00
Evan Cheng
99fe34b9b2 When creating intervals, leave min(1, numdefs) holes after each instruction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57765 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-18 05:18:55 +00:00