Commit Graph

4540 Commits

Author SHA1 Message Date
Chris Lattner
8e1f7ac87d Simplify SelectionDAG::getNode so that a big switch stmt is not #ifndef
NDEBUG.  This is in response to a really nasty bug I introduced that 
Dale tracked down, hopefully this won't happen in the future.  
Many thanks Dale.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46254 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-22 19:09:33 +00:00
Duncan Sands
7e857201f3 The final piece needed for storing arbitrary precision
integers.  Handle truncstore of a legal type to an unusual
number of bits.  Most of this code is not reachable unless
the new legalize infrastructure is turned on.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46249 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-22 07:17:34 +00:00
Owen Anderson
a6b1926531 Clarify a deviation from the original algorithm.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46218 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-21 22:03:00 +00:00
Owen Anderson
3b489522df Improve a few comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46217 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-21 22:01:01 +00:00
Dale Johannesen
da9bb3578e Move DAG-changing code out of #ifndef NDEBUG.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46204 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-21 01:00:34 +00:00
Dale Johannesen
713ed3f7c0 Do not generate a FP_ROUND of f64 to f64.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46195 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-20 01:18:38 +00:00
Chris Lattner
c9133f9772 remove extraneous &'s.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46171 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-18 19:36:20 +00:00
Chris Lattner
ddf89566a9 This commit changes:
1. Legalize now always promotes truncstore of i1 to i8. 
2. Remove patterns and gunk related to truncstore i1 from targets.
3. Rename the StoreXAction stuff to TruncStoreAction in TLI.
4. Make the TLI TruncStoreAction table a 2d table to handle from/to conversions.
5. Mark a wide variety of invalid truncstores as such in various targets, e.g.
   X86 currently doesn't support truncstore of any of its integer types.
6. Add legalize support for truncstores with invalid value input types.
7. Add a dag combine transform to turn store(truncate) into truncstore when
   safe.

The later allows us to compile CodeGen/X86/storetrunc-fp.ll to:

_foo:
	fldt	20(%esp)
	fldt	4(%esp)
	faddp	%st(1)
	movl	36(%esp), %eax
	fstps	(%eax)
	ret

instead of:

_foo:
	subl	$4, %esp
	fldt	24(%esp)
	fldt	8(%esp)
	faddp	%st(1)
	fstps	(%esp)
	movl	40(%esp), %eax
	movss	(%esp), %xmm0
	movss	%xmm0, (%eax)
	addl	$4, %esp
	ret



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46140 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-17 19:59:44 +00:00
Chris Lattner
4626b250a2 code cleanups, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46126 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-17 07:20:38 +00:00
Chris Lattner
0bd4893a07 * Introduce a new SelectionDAG::getIntPtrConstant method
and switch various codegen pieces and the X86 backend over
  to using it.

* Add some comments to SelectionDAGNodes.h

* Introduce a second argument to FP_ROUND, which indicates
  whether the FP_ROUND changes the value of its input. If
  not it is safe to xform things like fp_extend(fp_round(x)) -> x.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46125 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-17 07:00:52 +00:00
Evan Cheng
839b759c38 When a live virtual register is being clobbered by an implicit def, it is spilled
and the spill is its kill. However, if the local allocator has determined the
register has not been modified (possible when its value was reloaded), it would
not issue a restore. In that case, mark the last use of the virtual register as
kill.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46111 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-17 02:08:17 +00:00
Evan Cheng
644340a9bd Replace std::vector<bool> with BitVector.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46104 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-17 00:35:26 +00:00
Evan Cheng
02c4285643 Fixes a nasty dag combiner bug that causes a bunch of tests to fail at -O0.
It's not safe to use the two value CombineTo variant to combine away a dead load.
e.g. 
v1, chain2 = load chain1, loc
v2, chain3 = load chain2, loc
v3         = add v2, c 
Now we replace use of v1 with undef, use of chain2 with chain1.
ReplaceAllUsesWith() will iterate through uses of the first load and update operands:
v1, chain2 = load chain1, loc
v2, chain3 = load chain1, loc
v3         = add v2, c 
Now the second load is the same as the first load, SelectionDAG cse will ensure
the use of second load is replaced with the first load.
v1, chain2 = load chain1, loc
v3         = add v1, c
Then v1 is replaced with undef and bad things happen.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46099 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-16 23:11:54 +00:00
Dale Johannesen
48ae02fe62 Do not mark EH tables no-dead-strip unless the
associated function is so marked.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46088 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-16 19:59:28 +00:00
Chris Lattner
7e2e033e23 Fix a ppc long double regression I introduced yesterday due to a
simplification.  This fixes automotive-basicmath on PPC.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46072 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-16 17:59:31 +00:00
Chris Lattner
a66bb39e97 merge a few pieces of code that do the store/load to stack
pattern to use EmitStackConvert now.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46066 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-16 07:51:34 +00:00
Chris Lattner
1401d15c99 rename ExpandBIT_CONVERT to EmitStackConvert, generalizing
it to allow it to emit different load and store kinds.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46065 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-16 07:45:30 +00:00
Chris Lattner
23594d4537 simplify a bunch of code by using SelectionDAG::CreateStackTemporary
instead of inlining its body.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46062 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-16 07:03:22 +00:00
Chris Lattner
f2670a89a7 Change legalizeop of FP_ROUND and FP_EXTEND to not fall through
into the ANY_EXTEND/ZERO_EXTEND/SIGN_EXTEND code to simplify it.

Unmerge the code for FP_ROUND and FP_EXTEND from each other to 
make each one simpler.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46061 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-16 06:57:07 +00:00
Chris Lattner
572dee71af Factor the ReachesChainWithoutSideEffects out of dag combiner into
a public SDOperand::reachesChainWithoutSideEffects method.  No 
functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46050 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-16 05:49:24 +00:00
Dale Johannesen
4af3494452 Fix and enable EH for x86-64 Darwin. Adds
ShortenEHDataFor64Bits as a not-very-accurate
abstraction to cover all the changes in DwarfWriter.
Some cosmetic changes to Darwin assembly code for
gcc testsuite compatibility.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46029 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-15 23:24:56 +00:00
Owen Anderson
40a627ddf8 Move some calls to getVRegDef higher in the callgraph, so they don't get executed as frequently in performance sensitive code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46027 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-15 22:58:11 +00:00
Chris Lattner
034f12ea08 The type of the 'abort' node should be pointer type (because
it's a function pointer) not MVT::Other.  This fixes builtin_trap
lowering on ppc, alpha, ia64


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46018 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-15 22:09:33 +00:00
Owen Anderson
7047dd4d22 Remove DefInst from LiveVariables::VarInfo. Use the facilities on MachineRegisterInfo instead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46016 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-15 22:02:46 +00:00
Chris Lattner
41bab0beac Add support for targets that have a legal ISD::TRAP.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46014 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-15 21:58:08 +00:00
Evan Cheng
4c46fc6bbf Oops. Forgot to commit this.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46002 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-15 07:49:36 +00:00
Anton Korobeynikov
66fac79b89 For PR1839: add initial support for __builtin_trap. llvm-gcc part is missed
as well as PPC codegen


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46001 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-15 07:02:33 +00:00
Evan Cheng
c67e6e8e82 ByVal stack slot alignment should be at least as large as pointer ABI alignment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45995 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-15 03:14:05 +00:00
Chris Lattner
459525df1e don't create the post-ra scheduler unless it is enabled.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45972 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-14 19:00:06 +00:00
Chris Lattner
a6c3f80d97 remove dead #include
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45971 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-14 18:45:28 +00:00
Duncan Sands
a41d719803 Remove the assumption that byval has been applied to
a pointer to a struct.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45939 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-13 21:19:59 +00:00
Chris Lattner
aad193a7e9 implement support for sinking a load out the bottom of a block that
has no stores between the load and the end of block.  This works 
great and sinks hundreds of stores, but we can't turn it on because
machineinstrs don't have volatility information and we don't want to
sink volatile stores :(


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45894 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-12 00:17:41 +00:00
Chris Lattner
a22edc82ca Simplify the side effect stuff a bit more and make licm/sinking
both work right according to the new flags.

This removes the TII::isReallySideEffectFree predicate, and adds
TII::isInvariantLoad. 

It removes NeverHasSideEffects+MayHaveSideEffects and adds
UnmodeledSideEffects as machine instr flags.  Now the clients
can decide everything they need.

I think isRematerializable can be implemented in terms of the
flags we have now, though I will let others tackle that.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45843 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-10 23:08:24 +00:00
Chris Lattner
2445888208 Clamp down on sinking of lots of instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45841 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-10 22:35:15 +00:00
Duncan Sands
007f9847c4 Output sinl for a long double FSIN node, not sin.
Likewise fix up a bunch of other libcalls.  While
there I remove NEG_F32 and NEG_F64 since they are
not used anywhere.  This fixes 9 Ada ACATS failures.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45833 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-10 10:28:30 +00:00
Evan Cheng
8480293f41 Only remat loads from immutable stack slots.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45831 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-10 08:24:38 +00:00
Evan Cheng
a07cec9e24 Simplify some code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45830 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-10 08:22:10 +00:00
Owen Anderson
c95f075c43 Don't use LiveVariables::VarInfo::DefInst.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45815 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-10 03:12:54 +00:00
Dale Johannesen
038129dd58 Emit unused EH frames for weak definitions on Darwin,
because assembler/linker can't cope with weak absolutes.
PR 1880.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45811 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-10 02:03:30 +00:00
Owen Anderson
ddd060ffcf Get rid of all uses of LiveVariables::VarInfo::DefInst in favor of the equivalent API from
MachineRegisterInfo.  Once all clients are switched over, the former will be going away.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45805 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-10 01:36:43 +00:00
Owen Anderson
dc4d6558e4 Add more comments explaining the basics of how the decision of when to rename and when to insert
copies is made.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45799 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-10 00:47:01 +00:00
Owen Anderson
b199cbec2e Get rid of the isKillInst predicate. LiveVariables already provides this information.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45797 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-10 00:33:11 +00:00
Owen Anderson
9c2efa8a8f Copies need to be inserted before the first terminator, not at the end of the block.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45791 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-10 00:01:41 +00:00
Evan Cheng
19107563af Special copy SUnit's do not have SDNode's.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45787 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-09 23:01:55 +00:00
Owen Anderson
ec1213fbbb Clean up StrongPHIElimination a bit, and add some more comments to the internal structures. There's
still more work to do on this front.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45783 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-09 22:40:54 +00:00
Owen Anderson
864e3a3762 StrongPHIElim: Now with even fewer trivial bugs!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45775 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-09 10:41:39 +00:00
Owen Anderson
719fef648d Fix an infinite recursion bug in InsertCopies.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45774 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-09 10:32:30 +00:00
Owen Anderson
cb7d949a19 Fix some simple bugs. StrongPHIElimination now does not crash on 164.gzip.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45773 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-09 06:19:05 +00:00
Chris Lattner
07649d9265 Make load->store deletion a bit smarter. This allows us to compile this:
void test(long long *P) { *P ^= 1; }

into just:

_test:
	movl	4(%esp), %eax
	xorl	$1, (%eax)
	ret

instead of code like this:

_test:
	movl	4(%esp), %ecx
        xorl    $1, (%ecx)
	movl	4(%ecx), %edx
	movl	%edx, 4(%ecx)
	ret



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45762 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-08 23:08:06 +00:00
Owen Anderson
0c5714bb99 Rename registers that do not need copies.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45759 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-08 21:54:52 +00:00