Commit Graph

2945 Commits

Author SHA1 Message Date
Chris Lattner
7c306da505 Sink InstructionSelect() out of each target into SDISel, and rename it
DoInstructionSelection.  Inline "SelectRoot" into it from DAGISelHeader.
Sink some other stuff out of DAGISelHeader into SDISel.

Eliminate the various 'Indent' stuff from various targets, which dates
to when isel was recursive.

 17 files changed, 114 insertions(+), 430 deletions(-)



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97555 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-02 06:34:30 +00:00
Chris Lattner
17b4b172eb move some code out of DAGISelHeader up to SelectionDAGISel.h where it
is shared by all targets.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97553 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-02 06:04:12 +00:00
Evan Cheng
c6fe333688 Add skeleton of a machine level cse pass.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97543 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-02 02:38:24 +00:00
Chris Lattner
c6d7ad3c7d Rewrite chain handling validation and input TokenFactor handling
stuff now that we don't care about emulating the old broken 
behavior of the old isel.  This eliminates the 
'CheckChainCompatible' check (along with IsChainCompatible) which
did an incorrect and inefficient scan *up* the chain nodes which
happened as the pattern was being formed and does the validation
at the end in HandleMergeInputChains when it forms a structural 
pattern.  This scans "down" the graph, which means that it is
quickly bounded by nodes already selected.  This also handles
token factors that get "trapped" in the dag.

Removing the CheckChainCompatible nodes also shrinks the 
generated tables by about 6K for X86 (down to 83K).

There are two pieces remaining before I can nuke PreprocessRMW:
1. I xfailed a test because we're now producing worse code in a 
   case that has nothing to do with the change: it turns out that
   our use of MorphNodeTo will leave dead nodes in the graph
   which (depending on how the graph is walked) end up causing
   bogus uses of chains and blocking matches.  This is really 
   bad for other reasons, so I'll fix this in a follow-up patch.

2. CheckFoldableChainNode needs to be improved to handle the TF.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97539 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-02 02:22:10 +00:00
Chris Lattner
7a855760b1 remove some functions that were only used by the
old isel generated code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97522 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-01 23:40:33 +00:00
Chris Lattner
df51247725 remove all but one version of SelectionDAG::MorphNodeTo
(the most general) the others are dead.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97511 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-01 22:20:05 +00:00
Jakob Stoklund Olesen
e5d90416ee Use methods to determine if a LiveInterval is spillable.
Don't accidentally produce unspillable intervals for deeply nested loops.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97496 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-01 20:59:38 +00:00
Chris Lattner
7390eebd49 Accelerate isel dispatch for tables that start with a top-level
OPC_SwitchOpcode to use a table lookup instead of having to go
through the interpreter for this.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97469 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-01 18:47:11 +00:00
Chris Lattner
fa342faef9 eliminate the CheckMultiOpcodeMatcher code and have each
ComplexPattern at the root be generated multiple times, once
for each opcode they are part of.  This encourages factoring
because the opcode checks get treated just like everything
else in the matcher.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97439 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-01 07:17:40 +00:00
Chris Lattner
eb66921adb add a new OPC_SwitchOpcode which is semantically equivalent
to a scope where every child starts with a CheckOpcode, but
executes more efficiently.  Enhance DAGISelMatcherOpt to 
form it.

This also fixes a bug in CheckOpcode: apparently the SDNodeInfo
objects are not pointer comparable, we have to compare the
enum name.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97438 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-01 06:59:22 +00:00
Chris Lattner
2a49d57d2d hoist the new isel interpreter out of DAGISelHeader.h
(which gets #included into the middle of each 
target's DAGISel class) into a .cpp file where it is
only compiled once.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97425 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-28 22:37:22 +00:00
Chris Lattner
5310654dc5 change a few opcodes to use VBRs instead of embedding
immediate sizes into the opcode.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97423 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-28 22:14:32 +00:00
Chris Lattner
aa6d708028 move all the opcodes out of DAGISelHeader.h (which gets
#included into the middle of each isel class) into a real 
header.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97421 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-28 21:58:42 +00:00
Chris Lattner
623a2e84fb resolve a fixme by using hte new flag.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97420 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-28 21:56:16 +00:00
Chris Lattner
ff7fb60f2a enhance the EmitNode/MorphNodeTo operands to take a bit that
specifies whether there is an output flag or not.  Use this
instead of redundantly encoding the chain/flag results in the
output vtlist.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97419 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-28 21:53:42 +00:00
Chris Lattner
21221e357c enhance the new isel to handle the 'node already exists'
case of MorphNodeTo directly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97417 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-28 21:36:14 +00:00
Chris Lattner
9a21500edc use MorphNodeTo instead of SelectNodeTo. SelectNodeTo
is just a silly wrapper around MorphNodeTo.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97416 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-28 20:55:18 +00:00
Chris Lattner
c78f2a3994 enhance the new isel to use SelectNodeTo for most patterns,
even some the old isel didn't.  There are several parts of
this that make me feel dirty, but it's no worse than the
old isel.  I'll clean up the parts I can do without ripping
out the old one next.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97415 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-28 20:49:53 +00:00
Dale Johannesen
91c38417cf Further constify MDNode* references.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97252 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-26 19:39:56 +00:00
Chris Lattner
00947ee2db fix the matcher in the presence of multiple scopes: we need to save
and restore the entire matcher stack by value.  This is because children
we're testing could do moveparent or other things besides just 
scribbling on additions to the stack.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97212 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-26 07:28:20 +00:00
Chris Lattner
d6c84720df change the scope node to include a list of children to be checked
instead of to have a chained series of scope nodes.  This makes
the generated table smaller, improves the efficiency of the
interpreter, and make the factoring optimization much more 
reasonable to implement.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97160 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-25 19:00:39 +00:00
Chris Lattner
60df53e30a rename PushMatcherNode -> ScopeMatcherNode to more accurately
reflect what it does.  Switch the sense of the Next and the Check
arms to be more logical.  No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97093 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-25 01:56:48 +00:00
Chris Lattner
556a1b47e2 fix a bug I introduced by checking the wrong node's VT in OPC_CheckChildXType
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97074 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-24 22:52:52 +00:00
Chris Lattner
23cfda719e contract movechild+checktype into a new checkchild node, shrinking the
x86 table by 1200 bytes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97053 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-24 20:15:25 +00:00
Chris Lattner
19b5a7590b implement a simple proof-of-concept optimization for
the new isel: fold movechild+record+moveparent into a
single recordchild N node.  This shrinks the X86 table
from 125443 to 117502 bytes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97031 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-24 07:31:45 +00:00
Dan Gohman
e832693acb When forming SSE min and max nodes for UGE and ULE comparisons, it's
necessary to swap the operands to handle NaN and negative zero properly.

Also, reintroduce logic for checking for NaN conditions when forming
SSE min and max instructions, fixed to take into consideration NaNs and
negative zeros. This allows forming min and max instructions in more
cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97025 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-24 06:52:40 +00:00
Chris Lattner
02f73585f7 The new isel was not properly handling patterns that covered
internal nodes with flag results.  Record these with a new 
OPC_MarkFlagResults opcode and use this to update the interior
nodes' flag results properly.  This fixes CodeGen/X86/i256-add.ll
with the new isel.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97021 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-24 05:33:42 +00:00
Chris Lattner
cec479de4e fix X86/uint_to_fp-2.ll, only fold loads when they have a
single use.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97003 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-23 23:47:34 +00:00
Jakob Stoklund Olesen
dcfe5f30b5 Keep track of phi join registers explicitly in LiveVariables.
Previously, LiveIntervalAnalysis would infer phi joins by looking for multiply
defined registers. That doesn't work if the phi join is implicitly defined in
all but one of the predecessors.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96994 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-23 22:43:58 +00:00
Chris Lattner
5ce9d0b606 fix an off-by-one error.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96844 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-23 01:07:09 +00:00
Chris Lattner
5007e1e435 switch the value# in OPC_CompleteMatch and OPC_EmitNode to use a
VBR encoding for the insanity being perpetrated by the spu backend. 


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96843 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-23 00:59:59 +00:00
Chris Lattner
3e22f2d489 add a new Push2 opcode for targets (like cellspu) which have
ridiculously ginormous patterns and need more than one byte
of displacement for encodings.  This fixes CellSPU/fdiv.ll.
SPU is still doing something else ridiculous though.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96833 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-22 23:55:39 +00:00
Chris Lattner
418b568336 expand my hack to work with nodes that have flags but no chains and the
isel doesn't know the correct # results.  This fixes 8 codegen tests,
down to 22 failures.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96815 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-22 22:37:11 +00:00
Chris Lattner
12a667c1e8 add a new CheckMultiOpcode opcode for checking that a node
has one of the list of acceptable opcodes for a complex 
pattern.  This fixes 4 regtest failures.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96814 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-22 22:30:37 +00:00
Chris Lattner
3df577b71b add some debug hooks for tracking the behavior of the isel.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96812 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-22 22:15:39 +00:00
Dan Gohman
fb76fe0929 Fix various doxygen warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96779 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-22 04:10:52 +00:00
Chris Lattner
74fd536158 enhance my hack for flags handling, this allows us to pass
CodeGen/X86/pr2182.ll.  Down to 13 x86 failures out of ~1100


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96770 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-22 00:47:38 +00:00
Chris Lattner
565a6f9480 fix most of the failures in the x86 suite by handling multiple
result nodes correctly.  Note that this includes a horrible hack
in DAGISelHeader which cannot be fixed reasonably without 
eliminating (parallel) from input patterns.  That, in turn,
can't be done until we support writing multiple result patterns
for the X86and_flag and related multiple-result nodes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96767 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-21 23:54:05 +00:00
Chris Lattner
502035e541 fix an odd thinko in an assertion, all arm tests pass now.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96758 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-21 20:57:28 +00:00
Anton Korobeynikov
293d592bf9 It turned out that we failed to emit proper symbol stubs on non-x86/darwin for ages (we emitted a reference to a stub, but no stub was emitted). The code inside x86-32/macho target objfile lowering should actually be the generic one - move it there.
This (I really, really hope) should fix EH issues on ppc/darwin
and arm/darwin.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96755 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-21 20:28:15 +00:00
Chris Lattner
be94ffcf12 speculatively teach OPC_CheckValueType and OPC_EmitNode to handle
MVT::iPTR.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96753 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-21 20:15:25 +00:00
Chris Lattner
be92e6a0d2 teach OPC_CheckType to handle MVT::iPTR, down to 2 ppc failures.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96752 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-21 20:10:43 +00:00
Chris Lattner
1d4cb41fdd make this check a bit more generous, it may be outliving its
utility.  Down to 6 ppc failures.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96751 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-21 20:02:15 +00:00
Chris Lattner
1e4b8bc93b Relax an assertion a bit. We allow replacing things like
<4 x i32> with <4 x float> values if they end up the same
register class.  This gets us up to 231 passes on the ppc
tests (only 7 fails).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96750 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-21 19:35:07 +00:00
Chris Lattner
863cc971e8 when a match fails and we have to rollback, make sure to keep 'N' in
sync with the top of stack.  This fixes a bunch of failures on larger
testcases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96732 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-21 07:55:48 +00:00
Chris Lattner
0fb65cffa6 handle optional in flags that aren't present.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96731 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-21 07:19:06 +00:00
Chris Lattner
a7399e4abf fix two bugs in OPC_EmitRegister, which makes ppc happier.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96728 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-21 06:58:27 +00:00
Chris Lattner
77f2e2724d implement the last known missing feature: updating uses of results
of the matched pattern to use the newly created node results.  Onto
the "making it actually work" phase!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96724 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-21 06:03:07 +00:00
Chris Lattner
8e946bea14 Lots of improvements to the new dagisel emitter. This gets it to
the point where it is to the 95% feature complete mark, it just
needs result updating to be done (then testing, optimization 
etc).

More specificallly, this adds support for chain and flag handling
on the result nodes, support for sdnodexforms, support for variadic
nodes, memrefs, pinned physreg inputs, and probably lots of other
stuff.

In the old DAGISelEmitter, this deletes the dead code related to
OperatorMap, cleans up a variety of dead stuff handling "implicit
remapping" from things like globaladdr -> targetglobaladdr (which
is no longer used because globaladdr always needs to be legalized),
and some minor formatting fixes.




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96716 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-21 03:22:59 +00:00
Chris Lattner
beff6a3fd0 add a hook so that the new isel can run SDNodeXForms.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96714 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-21 03:15:11 +00:00