1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00
Commit Graph

58 Commits

Author SHA1 Message Date
Chris Lattner
cb2f61f245 add plumbing for handling multiple result nodes
in some more places.

llvm-svn: 99366
2010-03-24 00:41:19 +00:00
Chris Lattner
e425c6ab6c major surgery on tblgen: generalize TreePatternNode
to maintain a list of types (one for each result of
the node) instead of a single type.  There are liberal
hacks added to emulate the old behavior in various
situations, but they can start disolving now.

llvm-svn: 98999
2010-03-19 21:37:09 +00:00
Chris Lattner
5afb55e172 resolve fixme: we now infer the instruction-level 'isvariadic' bit
from the pattern if present, and we use it instead of the bit.

llvm-svn: 98938
2010-03-19 05:34:15 +00:00
Chris Lattner
6b395fca87 add a new SDNPVariadic SDNP node flag, and use it in
dag isel gen instead of instruction properties.  This
allows the oh-so-useful behavior of matching a variadic
non-root node.

llvm-svn: 98934
2010-03-19 05:07:09 +00:00
Chris Lattner
3e5af02a79 look up instructions by record, not by name.
llvm-svn: 98904
2010-03-19 00:07:20 +00:00
Chris Lattner
0ed7a372d6 expand tblgen's support for instructions with implicit defs.
llvm-svn: 98900
2010-03-18 23:57:40 +00:00
Chris Lattner
c008597c0a Completely rewrite tblgen's type inference mechanism,
changing the primary datastructure from being a 
"std::vector<unsigned char>" to being a new TypeSet class
that actually has (gasp) invariants!

This changes more things than I remember, but one major
innovation here is that it enforces that named input 
values agree in type with their output values.

This also eliminates code that transparently assumes (in 
some cases) that SDNodeXForm input/output types are the
same, because this is wrong in many case.

This also eliminates a bug which caused a lot of ambiguous
patterns to go undetected, where a register class would
sometimes pick the first possible type, causing an
ambiguous pattern to get arbitrary results.

With all the recent target changes, this causes no 
functionality change!

llvm-svn: 98534
2010-03-15 06:00:16 +00:00
Chris Lattner
c056e2020e more factoring.
llvm-svn: 97911
2010-03-07 07:20:49 +00:00
Chris Lattner
cf09c9dcef zap fixme.
llvm-svn: 97705
2010-03-04 01:26:00 +00:00
Chris Lattner
72df178091 now that complexpatterns are all emitted at the end of the match
sequence, just emit instruction predicates right before them.  This
exposes yet more factoring opportunitites, shrinking the X86 table 
to 79144 bytes.

llvm-svn: 97704
2010-03-04 01:25:36 +00:00
Chris Lattner
2bbca2de9e change the new isel matcher to emit ComplexPattern matches
as the very last thing before node emission.  This should
dramatically reduce the number of times we do 'MatchAddress'
on X86, speeding up compile time.  This also improves comments
in the tables and shrinks the table a bit, now down to 
80506 bytes for x86.

llvm-svn: 97703
2010-03-04 01:23:08 +00:00
Chris Lattner
87aaa6af4f enhance comment output to specify what recorded slot
numbers a ComplexPat will match into.

llvm-svn: 97696
2010-03-04 00:28:05 +00:00
Chris Lattner
0b41a42411 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.

llvm-svn: 97539
2010-03-02 02:22:10 +00:00
Chris Lattner
e37f8fa74a resolve some fixmes
llvm-svn: 97515
2010-03-01 22:49:06 +00:00
Chris Lattner
4fb9708649 resolve a fixme and simplify code by moving insertion of the
EmitMergeInputChainsMatcher node up into EmitResultCode.  This
doesn't have much of an effect on the generated code, the X86
table is exactly the same size.

llvm-svn: 97514
2010-03-01 22:46:42 +00:00
Chris Lattner
14ef40723a resolve a fixme by having the .td file parser reject thigns like
(set GPR, somecomplexpattern)

if somecomplexpattern doesn't declare what it can match.

llvm-svn: 97513
2010-03-01 22:29:19 +00:00
Chris Lattner
19b59d2278 Emit type checks late instead of early, this encourages
structural matching code to be factored and shared this
shrinks the X86 isel table from 86537 to 83890 bytes.

llvm-svn: 97442
2010-03-01 07:54:59 +00:00
Chris Lattner
4baff2da00 Emit a redundant check for immediates at root context, e.g. (imm 0).
This allows formation of OpcodeSwitch for top level patterns, in
particular on X86.  This saves about 1K of data space in the x86
table and makes the dispatch much more efficient.

llvm-svn: 97440
2010-03-01 07:27:07 +00:00
Chris Lattner
cdfa80eaaf 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.

llvm-svn: 97439
2010-03-01 07:17:40 +00:00
Chris Lattner
c63cbf5105 enhance RecordNode and RecordChild comments to indicate what
slot they're recording into, no functionality change.

llvm-svn: 97433
2010-03-01 02:24:17 +00:00
Chris Lattner
17b56423d9 Emit redundant opcode checks for andimm and orimm tests at root
so that we get grouping at the top level.

Add an optimization to reorder type check & record nodes
after opcode checks.  We prefer to expose tree shape 
matching which improves grouping and will enhance the next
optimization.

llvm-svn: 97432
2010-03-01 02:15:34 +00:00
Chris Lattner
ac55b2ddbc inline the node transforms and node predicates into the generated
dispatcher method.  This eliminates the dependence of the new isel's
generated code on the old isel's predicates, however some random
hand written isel code still uses them.

llvm-svn: 97431
2010-03-01 01:54:19 +00:00
Chris Lattner
6f5b656bbf 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.

llvm-svn: 97419
2010-02-28 21:53:42 +00:00
Chris Lattner
9599b6a5e9 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.

llvm-svn: 97415
2010-02-28 20:49:53 +00:00
Chris Lattner
ecc2545545 enhance EmitNodeMatcher to keep track of the recorded slot numbers
it will populate.

llvm-svn: 97363
2010-02-28 02:41:25 +00:00
Chris Lattner
6b967885bc add infrastructure to support forming selectnodeto. Not used yet
because I have to go on another detour first.

llvm-svn: 97362
2010-02-28 02:31:26 +00:00
Chris Lattner
424f0b580d change CheckOpcodeMatcher to hold the SDNodeInfo instead of
the opcode name.  This gives the optimizer more semantic info.

llvm-svn: 97346
2010-02-27 21:48:43 +00:00
Chris Lattner
02110cc687 rename fooMatcherNode to fooMatcher.
llvm-svn: 97096
2010-02-25 02:04:40 +00:00
Chris Lattner
35b88592cd add a fixme for an experiment that defeated me for the time being.
llvm-svn: 97081
2010-02-25 00:03:03 +00:00
Chris Lattner
7878da5c39 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.

llvm-svn: 97021
2010-02-24 05:33:42 +00:00
Chris Lattner
fbca302fe2 Change ComplexPattern handling to push the node being matched as
well as the operands produced when the pattern is matched.  This
allows CheckSame to work correctly when matching replicated 
names involving ComplexPatterns.  This fixes a bunch of MSP430 
failures, we're down to 13 failures, two of which are
due to a sched bug.

llvm-svn: 96824
2010-02-22 23:33:44 +00:00
Chris Lattner
1613c59dbe 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.

llvm-svn: 96814
2010-02-22 22:30:37 +00:00
Chris Lattner
b77c4c6a30 When matching patterns that have a complex pattern as their root, make
sure to only run the complex pattern on nodes where the target opts in.
This patch only handles targets with one opcode specified so far, but
fixes 16 failures, only 34 left.

llvm-svn: 96813
2010-02-22 22:18:05 +00:00
Chris Lattner
85fa3173ff 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.

llvm-svn: 96767
2010-02-21 23:54:05 +00:00
Chris Lattner
691dcb90a4 Always emit register class id references as i32 like
DAGISelEmitter does.  This fixes 11 arm failures (8 
left).

llvm-svn: 96757
2010-02-21 20:53:45 +00:00
Chris Lattner
0164635dad 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!

llvm-svn: 96724
2010-02-21 06:03:07 +00:00
Chris Lattner
8983077c87 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.

llvm-svn: 96716
2010-02-21 03:22:59 +00:00
Chris Lattner
28cc2f3f44 I confused myself, temporaries will be recorded right along with other inputs.
llvm-svn: 96639
2010-02-19 00:33:13 +00:00
Chris Lattner
fc0b27563f introduce a new ResultVal and start keeping track of temporary values.
llvm-svn: 96636
2010-02-19 00:27:40 +00:00
Chris Lattner
4cfdecc52b add support for referencing registers and immediates,
building the tree to represent them but not emitting 
table entries for them yet.

llvm-svn: 96617
2010-02-18 22:03:03 +00:00
Chris Lattner
5bc53ac6f5 start sketching out the structure of code for result emission generation.
Nothing real here yet.

llvm-svn: 96575
2010-02-18 06:47:49 +00:00
Chris Lattner
76506b3749 rename the child field to 'next'. This is not a parent/child
relationship, this is a linear list relationship.

llvm-svn: 96561
2010-02-18 02:53:41 +00:00
Chris Lattner
955650be1f eliminate the MatcherNodeWithChild class, give the 'child'
field to MatcherNode.

llvm-svn: 96560
2010-02-18 02:49:24 +00:00
Chris Lattner
8f3afbc621 Emulate the current isel's "IsChainCompatible" logic for now.
I'd like to eventually rip it out, but for now producing the
same selections as the old matcher is more important.

llvm-svn: 96458
2010-02-17 06:23:39 +00:00
Chris Lattner
15eb8504cd properly record chain inputs to complex patterns,
resolving a fixme.

llvm-svn: 96457
2010-02-17 06:08:25 +00:00
Chris Lattner
44d2031ca8 Prep work to handle input chains of matched patterns and checking for
'ischaincompatible' when a pattern has more than one input chain.  Need
to do some commenting and cleanup now that I understand how this works.

llvm-svn: 96443
2010-02-17 02:16:19 +00:00
Chris Lattner
ac9295346b record input chains.
llvm-svn: 96437
2010-02-17 01:34:15 +00:00
Chris Lattner
a6df2a60e5 prefix captured value names with $ so they look like
variables.  Use the fancy OpNo variable instead of i,
which has the right index including chains.

llvm-svn: 96436
2010-02-17 01:27:29 +00:00
Chris Lattner
ab430d225c improve comments on OPC_Record to say what we're recording a node.
llvm-svn: 96433
2010-02-17 01:03:09 +00:00
Chris Lattner
1f818d2e25 make the new isel generator plop out a CheckComplexPattern function
for evaluating complex patterns.  Some cleanup has to happen before
this can be used though.

llvm-svn: 96419
2010-02-17 00:31:50 +00:00