Commit Graph

89 Commits

Author SHA1 Message Date
David Blaikie 3c6ca232ed Use unique_ptr to handle ownership of TreePatterns in CodeGenDAGPatterns::PatternFragments
We might be able to use unique_ptr to handle ownership of the
TreePatternNodes too - looking into that next.

llvm-svn: 221928
2014-11-13 21:40:02 +00:00
Craig Topper 2406477179 [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr.
llvm-svn: 206254
2014-04-15 07:20:03 +00:00
Craig Topper 2d9361e325 [C++11] Add 'override' keyword to virtual methods that override their base class.
llvm-svn: 203378
2014-03-09 07:44:38 +00:00
Craig Topper 7ca1d18055 Add CheckChildInteger to ISelMatcher operations. Removes nearly 2000 bytes from X86 matcher table.
llvm-svn: 200821
2014-02-05 05:44:28 +00:00
Craig Topper bdf33ca08d Couple minor formatting fixes to the XXXGenDAGISel.inc files.
llvm-svn: 200459
2014-01-30 06:42:52 +00:00
Craig Topper a1bbc323fa Add OPC_CheckChildSame0-3 to the DAG isel matcher. This replaces sequences of MoveChild, CheckSame, MoveParent. Saves 846 bytes from the X86 DAG isel matcher, ~300 from ARM, ~840 from Hexagon.
llvm-svn: 192026
2013-10-05 05:38:16 +00:00
Craig Topper d9a6cc031d Revert r191940 to see if it fixes the build bots.
llvm-svn: 191941
2013-10-04 05:52:17 +00:00
Craig Topper a2efe9ebc6 Add OPC_CheckChildSame0-3 to the DAG isel matcher. This replaces sequences of MoveChild, CheckSame, MoveParent. Saves 846 bytes from the X86 DAG isel matcher, ~300 from ARM, ~840 from Hexagon.
llvm-svn: 191940
2013-10-04 05:22:20 +00:00
Craig Topper 51617c3d2c Add missing index comments to the left side of the DAG ISel matcher table for each individual case of SwitchOpcode/Type.
llvm-svn: 191181
2013-09-22 23:18:50 +00:00
Eli Bendersky 530a3bc5fa Fix comments
llvm-svn: 174390
2013-02-05 16:53:11 +00:00
Chandler Carruth 91d19d8e93 Sort the #include lines for utils/...
I've tried to find main moudle headers where possible, but the TableGen
stuff may warrant someone else looking at it.

llvm-svn: 169251
2012-12-04 10:37:14 +00:00
Craig Topper a583df034a Add 'virtual' keywoards to output file for overridden functions.
llvm-svn: 164002
2012-09-16 18:25:36 +00:00
Jim Grosbach 66372684f7 TblGen: Tweak to pretty-print DAGISel.inc a bit better.
llvm-svn: 160463
2012-07-18 22:41:03 +00:00
Craig Topper c4965bce14 Convert assert(0) to llvm_unreachable
llvm-svn: 149814
2012-02-05 07:21:30 +00:00
Peter Collingbourne 84c287e33c Move TableGen's parser and entry point into a library
This is the first step towards splitting LLVM and Clang's tblgen executables.

llvm-svn: 140951
2011-10-01 16:41:13 +00:00
Chris Lattner 514e292b72 Rework our internal representation of node predicates to expose more
structure and fix some fixmes.  We now have a TreePredicateFn class
that handles all of the decoding of these things.  This is an internal
cleanup that has no impact on the code generated by tblgen.

llvm-svn: 129670
2011-04-17 21:38:24 +00:00
Jim Grosbach f17b0031f3 Teach TableGen to pre-calculate register enum values when creating the
CodeGenRegister entries. Use this information to more intelligently build
the literal register entires in the DAGISel matcher table. Specifically,
use a single-byte OPC_EmitRegister entry for registers with a value of
less than 256 and OPC_EmitRegister2 entry for registers with a larger value.

rdar://9066491

llvm-svn: 127456
2011-03-11 02:19:02 +00:00
Jim Grosbach 621818ab1a trailing whitespace.
llvm-svn: 126733
2011-03-01 01:39:05 +00:00
Jim Grosbach 1d479dbc55 Generalize the register matching code in DAGISel a bit.
llvm-svn: 126731
2011-03-01 01:37:19 +00:00
Chris Lattner 11a33811b6 flags -> glue for selectiondag
llvm-svn: 122509
2010-12-23 17:24:32 +00:00
Chris Lattner f647e95b9a sdisel flag -> glue.
llvm-svn: 122507
2010-12-23 17:13:18 +00:00
Chris Lattner f7f9e8c978 continue renaming flag -> glue.
llvm-svn: 122506
2010-12-23 17:03:20 +00:00
Chris Lattner a9e57e0eff Rework passing parent pointers into complexpatterns, I forgot
that complex patterns are matched after the entire pattern has
a structural match, therefore the NodeStack isn't in a useful
state when the actual call to the matcher happens.

llvm-svn: 114489
2010-09-21 22:00:25 +00:00
Chris Lattner dd83548fea just like they can opt into getting the root of the pattern being
matched, allow ComplexPatterns to opt into getting the parent node
of the operand being matched.

llvm-svn: 114472
2010-09-21 20:37:12 +00:00
Chris Lattner 0e023ea02a fix a long standing wart: all the ComplexPattern's were being
passed the root of the match, even though only a few patterns
actually needed this (one in X86, several in ARM [which should
be refactored anyway], and some in CellSPU that I don't feel 
like detangling).   Instead of requiring all ComplexPatterns to
take the dead root, have targets opt into getting the root by
putting SDNPWantRoot on the ComplexPattern.

llvm-svn: 114471
2010-09-21 20:31:19 +00:00
Eric Christopher 957fc3df52 Moar words!
llvm-svn: 110422
2010-08-06 01:30:54 +00:00
Chris Lattner 24fdd22766 generate better code in CheckComplexPattern
llvm-svn: 105970
2010-06-14 22:33:34 +00:00
Chris Lattner 05925fe1fe print the complexity of the pattern being matched in the
comment in the generated table.

llvm-svn: 99794
2010-03-29 01:40:38 +00:00
Chris Lattner 49e2773dd8 add an optimized form of OPC_EmitMergeInputChains for the 1, 0 and
1, 1 cases which are by-far the most frequent.  This shrinks the X86
isel table from 77014 -> 74657 bytes.

llvm-svn: 99740
2010-03-28 05:50:16 +00:00
Chris Lattner e7e9f06d3b fix a bug in my recent patch that increased opcode size to 2 bytes:
the index comments nested under OPC_SwitchOpcode were off by one.
This fixes the comments.

llvm-svn: 99722
2010-03-27 18:49:33 +00:00
Chris Lattner 552dddc51c Change tblgen to emit FOOISD opcode names as two
bytes instead of one byte.  This is important because
we're running up to too many opcodes to fit in a byte
and it is aggrevated by FIRST_TARGET_MEMORY_OPCODE
making the numbering sparse.  This just bites the
bullet and bloats out the table.  In practice, this
increases the size of the x86 isel table from 74.5K
to 76K.  I think we'll cope :)

This fixes rdar://7791648

llvm-svn: 99494
2010-03-25 06:33:05 +00:00
Chris Lattner 6c2d178957 add plumbing for handling multiple result nodes
in some more places.

llvm-svn: 99366
2010-03-24 00:41:19 +00:00
Chris Lattner 127b8c9e53 so hey, it turns out that the histogram was completely wrong, because
we sometimes emit nodes multiple times to string buffers to size them.
Compute the histogram correctly.

llvm-svn: 97708
2010-03-04 01:34:29 +00:00
Chris Lattner 0acbb71bad 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 90e1c5fa44 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 3e1ffd06fc introduce a new SwitchTypeMatcher node (which is analogous to
SwitchOpcodeMatcher) and have DAGISelMatcherOpt form it.  This
speeds up selection, particularly for X86 which has lots of 
variants of instructions with only type differences.

llvm-svn: 97645
2010-03-03 06:28:15 +00:00
Chris Lattner b884fe867e 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 4b07568a56 add some missing \n's
llvm-svn: 97527
2010-03-02 00:13:03 +00:00
Chris Lattner 3144e66377 fixme resolved.
llvm-svn: 97517
2010-03-01 23:08:51 +00:00
Chris Lattner bd6e193f54 remove a little hack I did for the old isel, not needed
now that it is gone.

llvm-svn: 97516
2010-03-01 22:51:11 +00:00
Torok Edwin 04a0eab01b Missed a \n in previous commit.
llvm-svn: 97472
2010-03-01 19:00:55 +00:00
Torok Edwin 12b02282d9 Add command-line flag to tblgen to turn off generating comments for the new
isel (defaults it to generate comments).
This reduces the size of the generated source file.

llvm-svn: 97470
2010-03-01 18:49:10 +00:00
Chris Lattner 053a28a397 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 f4d1775263 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.

llvm-svn: 97438
2010-03-01 06:59:22 +00:00
Chris Lattner 4634d9beef 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 58e7dad842 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 560169d5c4 simplify some code now that chain/flag results are not stored in
the vtlist for emitnode.

llvm-svn: 97429
2010-02-28 23:00:47 +00:00
Chris Lattner d86751711d don't emit useless functions. These were producing
warnings in release-assert builds if there were no cases.

llvm-svn: 97428
2010-02-28 22:57:03 +00:00
Chris Lattner d303a365df change a few opcodes to use VBRs instead of embedding
immediate sizes into the opcode.

llvm-svn: 97423
2010-02-28 22:14:32 +00:00
Chris Lattner a838264af1 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