summaryrefslogtreecommitdiffstats
path: root/llvm/utils/TableGen/DAGISelMatcher.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [TableGen] Replace a dyn_cast with isa to avoid an unused variable warning ↵Craig Topper2019-03-111-6/+2
| | | | | | introduced in r355785. NFC llvm-svn: 355837
* [TableGen] Make CheckImmAllOnesVMatcher and CheckImmAllZerosVMatcher ↵Craig Topper2019-03-101-0/+13
| | | | | | | | contradictory matchers. This improves X86 factoring a little bit. llvm-svn: 355785
* Recommit r355224 "[TableGen][SelectionDAG][X86] Add specific isel matchers ↵Craig Topper2019-03-101-0/+10
| | | | | | | | | | | | | | | | | | for immAllZerosV/immAllOnesV. Remove bitcasts from X86 patterns that are no longer necessary." Includes a fix to emit a CheckOpcode for build_vector when immAllZerosV/immAllOnesV is used as a pattern root. This means it can't be used to look through bitcasts when used as a root, but that's probably ok. This extra CheckOpcode will ensure that the first match in the isel table will be a SwitchOpcode which is needed by the caching optimization in the ISel Matcher. Original commit message: Previously we had build_vector PatFrags that called ISD::isBuildVectorAllZeros/Ones. Internally the ISD::isBuildVectorAllZeros/Ones look through bitcasts, but we aren't able to take advantage of that in isel. Instead of we have to canonicalize the types of the all zeros/ones build_vectors and insert bitcasts. Then we have to pattern match those exact bitcasts. By emitting specific matchers for these 2 nodes, we can make isel look through any bitcasts without needing to explicitly match them. We should also be able to remove the canonicalization to vXi32 from lowering, but I've left that for a follow up. This removes something like 40,000 bytes from the X86 isel table. Differential Revision: https://reviews.llvm.org/D58595 llvm-svn: 355784
* Revert r355224 "[TableGen][SelectionDAG][X86] Add specific isel matchers for ↵Craig Topper2019-03-051-10/+0
| | | | | | | | immAllZerosV/immAllOnesV. Remove bitcasts from X86 patterns that are no longer necessary." This caused the first matcher in the isel table for many targets to Opc_Scope instead of Opc_SwitchOpcode. This leads to a significant increase in isel match failures. llvm-svn: 355433
* [TableGen][SelectionDAG][X86] Add specific isel matchers for ↵Craig Topper2019-03-011-0/+10
| | | | | | | | | | | | | | immAllZerosV/immAllOnesV. Remove bitcasts from X86 patterns that are no longer necessary. Previously we had build_vector PatFrags that called ISD::isBuildVectorAllZeros/Ones. Internally the ISD::isBuildVectorAllZeros/Ones look through bitcasts, but we aren't able to take advantage of that in isel. Instead of we have to canonicalize the types of the all zeros/ones build_vectors and insert bitcasts. Then we have to pattern match those exact bitcasts. By emitting specific matchers for these 2 nodes, we can make isel look through any bitcasts without needing to explicitly match them. We should also be able to remove the canonicalization to vXi32 from lowering, but I've left that for a follow up. This removes something like 40,000 bytes from the X86 isel table. Differential Revision: https://reviews.llvm.org/D58595 llvm-svn: 355224
* [SelectionDAG] Add a OPC_CheckChild2CondCode to SelectionDAGISel to remove a ↵Craig Topper2019-02-251-0/+5
| | | | | | | | | | MoveChild and MoveParent pair. OPC_CheckCondCode is always used as operand 2 of a setcc. And its always surrounded by a MoveChild2 and a MoveParent. By having a dedicated opcode for this case we can reduce the number of bytes needed for this pattern from 4 bytes to 2. This saves ~3000 bytes in the X86 table. llvm-svn: 354763
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* TableGen/ISel: Allow PatFrag predicate code to access captured operandsNicolai Haehnle2018-11-301-2/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This simplifies writing predicates for pattern fragments that are automatically re-associated or commuted. For example, a followup patch adds patterns for fragments of the form (add (shl $x, $y), $z) to the AMDGPU backend. Such patterns are automatically commuted to (add $z, (shl $x, $y)), which makes it basically impossible to refer to $x, $y, and $z generically in the PredicateCode. With this change, the PredicateCode can refer to $x, $y, and $z simply as `Operands[i]`. Test confirmed that there are no changes to any of the generated files when building all (non-experimental) targets. Change-Id: I61c00ace7eed42c1d4edc4c5351174b56b77a79c Reviewers: arsenm, rampitec, RKSimon, craig.topper, hfinkel, uweigand Subscribers: wdng, tpr, llvm-commits Differential Revision: https://reviews.llvm.org/D51994 llvm-svn: 347992
* Remove redundant includes from utils/TableGen.Michael Zolotukhin2017-12-131-1/+0
| | | | llvm-svn: 320632
* [TableGen] Range loopify DAGISelMatcher. NFC.Javed Absar2017-10-161-15/+15
| | | | llvm-svn: 315891
* [TableGen] Remove getHash support from DAGISelMatcher. It hasn't been used ↵Craig Topper2016-05-061-48/+0
| | | | | | for some time. llvm-svn: 268706
* SDAG: Remove OPC_MarkGlueResults and associated logic. NFCJustin Bogner2016-05-051-8/+0
| | | | | | | | | This opcode never happens in practice, and yet the logic we have in place to handle it would be undefined behaviour if we ever executed it. Remove it rather than trying to refactor code that's never reached. llvm-svn: 268692
* Declare MVT::SimpleValueType as an int8_t sized enum. This removes 400 bytes ↵Craig Topper2016-04-171-3/+5
| | | | | | | | | | from TargetLoweringBase and probably other places. This required changing several places to print VT enums as strings instead of raw ints since the proper method to use to print became ambiguous. This is probably an improvement anyway. This also appears to save ~8K from an x86 self host build of llc. llvm-svn: 266562
* [C++11] More 'nullptr' conversion. In some cases just using a boolean check ↵Craig Topper2014-04-151-2/+2
| | | | | | instead of comparing to nullptr. llvm-svn: 206254
* Add CheckChildInteger to ISelMatcher operations. Removes nearly 2000 bytes ↵Craig Topper2014-02-051-0/+17
| | | | | | from X86 matcher table. llvm-svn: 200821
* Delete the Matchers stored in the SmallVectors in ↵Craig Topper2014-01-291-0/+9
| | | | | | SwitchOpcodeMatcher/SwitchTypeMatcher. llvm-svn: 200377
* Add OPC_CheckChildSame0-3 to the DAG isel matcher. This replaces sequences ↵Craig Topper2013-10-051-0/+4
| | | | | | of MoveChild, CheckSame, MoveParent. Saves 846 bytes from the X86 DAG isel matcher, ~300 from ARM, ~840 from Hexagon. llvm-svn: 192026
* Revert r191940 to see if it fixes the build bots.Craig Topper2013-10-041-4/+0
| | | | llvm-svn: 191941
* Add OPC_CheckChildSame0-3 to the DAG isel matcher. This replaces sequences ↵Craig Topper2013-10-041-0/+4
| | | | | | of MoveChild, CheckSame, MoveParent. Saves 846 bytes from the X86 DAG isel matcher, ~300 from ARM, ~840 from Hexagon. llvm-svn: 191940
* Fix doxygen comments to use correct function name.Craig Topper2013-09-251-1/+1
| | | | llvm-svn: 191356
* Sort the #include lines for utils/...Chandler Carruth2012-12-041-2/+2
| | | | | | | I've tried to find main moudle headers where possible, but the TableGen stuff may warrant someone else looking at it. llvm-svn: 169251
* Unweaken vtables as per ↵David Blaikie2011-12-201-0/+6
| | | | | | http://llvm.org/docs/CodingStandards.html#ll_virtual_anch llvm-svn: 146960
* Move TableGen's parser and entry point into a libraryPeter Collingbourne2011-10-011-1/+1
| | | | | | This is the first step towards splitting LLVM and Clang's tblgen executables. llvm-svn: 140951
* Rework our internal representation of node predicates to expose moreChris Lattner2011-04-171-3/+11
| | | | | | | | 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
* Flag -> Glue, the ongoing sagaChris Lattner2010-12-231-1/+1
| | | | llvm-svn: 122513
* continue renaming flag -> glue.Chris Lattner2010-12-231-6/+6
| | | | llvm-svn: 122506
* Tidy up a bit. Trailing whitespace, hard tabs and 80-columns.Jim Grosbach2010-12-211-14/+14
| | | | llvm-svn: 122337
* add plumbing for handling multiple result nodes Chris Lattner2010-03-241-7/+7
| | | | | | in some more places. llvm-svn: 99366
* eliminate the last use of EEVT::isUnknownChris Lattner2010-03-191-4/+3
| | | | llvm-svn: 98918
* add some helper functions and implement isContradictory Chris Lattner2010-03-071-0/+55
| | | | | | | | for CheckValueTypeMatcher. The isContradictory implementation helps us factor better, shrinking x86 table from 79144 -> 78896 bytes. llvm-svn: 97905
* introduce a new SwitchTypeMatcher node (which is analogous toChris Lattner2010-03-031-0/+9
| | | | | | | | 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
* Rewrite chain handling validation and input TokenFactor handlingChris Lattner2010-03-021-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* eliminate the CheckMultiOpcodeMatcher code and have each Chris Lattner2010-03-011-13/+0
| | | | | | | | | 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
* add a new OPC_SwitchOpcode which is semantically equivalentChris Lattner2010-03-011-1/+21
| | | | | | | | | | | | 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
* enhance the EmitNode/MorphNodeTo operands to take a bit thatChris Lattner2010-02-281-1/+2
| | | | | | | | 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
* use MorphNodeTo instead of SelectNodeTo. SelectNodeToChris Lattner2010-02-281-1/+1
| | | | | | is just a silly wrapper around MorphNodeTo. llvm-svn: 97416
* enhance the new isel to use SelectNodeTo for most patterns,Chris Lattner2010-02-281-2/+6
| | | | | | | | | 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
* enhance EmitNodeMatcher to keep track of the recorded slot numbersChris Lattner2010-02-281-1/+1
| | | | | | it will populate. llvm-svn: 97363
* add infrastructure to support forming selectnodeto. Not used yetChris Lattner2010-02-281-5/+7
| | | | | | because I have to go on another detour first. llvm-svn: 97362
* Generalize my hack to use SDNodeInfo to find out when aChris Lattner2010-02-281-19/+26
| | | | | | | | | node is always guaranteed to have a particular type instead of hacking in ISD::STORE explicitly. This allows us to use implied types for a broad range of nodes, even target specific ones. llvm-svn: 97355
* change CheckOpcodeMatcher to hold the SDNodeInfo instead ofChris Lattner2010-02-271-7/+7
| | | | | | the opcode name. This gives the optimizer more semantic info. llvm-svn: 97346
* add another case from the ppc backend. This is obviously a huge andChris Lattner2010-02-271-1/+4
| | | | | | dissatisfying hack. TODO: Improve it. :) llvm-svn: 97317
* teach the optimizer that opcode == ISD::STORE is contradictoryChris Lattner2010-02-271-2/+11
| | | | | | | | with getType() == MVT::i32 etc. Teach it that two different integer constants are contradictory. This cuts 1K off the X86 table, down to 98k llvm-svn: 97314
* Teach the grouper some simple tricks about looking contradictoryChris Lattner2010-02-271-0/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | predicates. For example if we have: Scope: CheckType i32 ABC CheckType f32 DEF CheckType i32 GHI Then we know that we can transform this into: Scope: CheckType i32 Scope ABC GHI CheckType f32 DEF This reorders the check for the 'GHI' predicate above the check for the 'DEF' predidate. However it is safe to do this in this situation because we know that a node cannot have both an i32 and f32 type. We're now doing more factoring that the old isel did. llvm-svn: 97312
* change the scope node to include a list of children to be checkedChris Lattner2010-02-251-1/+10
| | | | | | | | | 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. llvm-svn: 97160
* factor the print method better.Chris Lattner2010-02-251-66/+35
| | | | llvm-svn: 97125
* add methods to do equality checks and get hashes of MatchersChris Lattner2010-02-251-1/+67
| | | | llvm-svn: 97123
* rename fooMatcherNode to fooMatcher.Chris Lattner2010-02-251-34/+34
| | | | llvm-svn: 97096
* rename PushMatcherNode -> ScopeMatcherNode to more accuratelyChris Lattner2010-02-251-4/+4
| | | | | | | reflect what it does. Switch the sense of the Next and the Check arms to be more logical. No functionality change. llvm-svn: 97093
* contract movechild+checktype into a new checkchild node, shrinking theChris Lattner2010-02-241-0/+7
| | | | | | x86 table by 1200 bytes. llvm-svn: 97053
OpenPOWER on IntegriCloud