summaryrefslogtreecommitdiffstats
path: root/llvm/utils/TableGen/CodeGenDAGPatterns.h
Commit message (Collapse)AuthorAgeFilesLines
* Make all unnamed RegisterClass TreePatternNodes typed MVT::i32.Jakob Stoklund Olesen2013-03-231-0/+1
| | | | | | | | | | | | | | | | | | | | | A register class can appear as a leaf TreePatternNode with and without a name: (COPY_TO_REGCLASS GPR:$src, F8RC) In a named leaf node like GPR:$src, the register class provides type information for the named variable represented by the node. The TypeSet for such a node is the set of value types that the register class can represent. In an unnamed leaf node like F8RC above, the register class represents itself as a kind of immediate. Such a node has the type MVT::i32, we'll never create a virtual register representing it. This change makes it possible to remove the special handling of COPY_TO_REGCLASS in CodeGenDAGPatterns.cpp. llvm-svn: 177825
* Extract a method.Jakob Stoklund Olesen2013-03-181-0/+5
| | | | | | | This computes the type of an instruction operand or result based on the records in the instruction's ins and outs lists. llvm-svn: 177244
* Use ArrayRef<MVT::SimpleValueType> when possible.Jakob Stoklund Olesen2013-03-171-1/+1
| | | | | | | Not passing vector references around makes it possible to use SmallVector in most places. llvm-svn: 177235
* Sort the #include lines for utils/...Chandler Carruth2012-12-041-3/+3
| | | | | | | I've tried to find main moudle headers where possible, but the TableGen stuff may warrant someone else looking at it. llvm-svn: 169251
* Remove exception handling usage from tblgen.Joerg Sonnenberger2012-10-251-14/+23
| | | | | | | | | | | Most places can use PrintFatalError as the unwinding mechanism was not used for anything other than printing the error. The single exception was CodeGenDAGPatterns.cpp, where intermediate errors during type resolution were ignored to simplify incremental platform development. This use is replaced by an error flag in TreePattern and bailout earlier in various places if it is set. llvm-svn: 166712
* Refactor Record* by-ID comparator to Record.hSean Silva2012-09-191-13/+8
| | | | | | | | | | | This is a generally useful utility; there's no reason to have it hidden in CodeGenDAGPatterns.cpp. Also, rename it to fit the other comparators in Record.h Review by Jakob. llvm-svn: 164189
* Tablegen: Add OperandWithDefaultOps Operand typeTom Stellard2012-09-061-2/+2
| | | | | | | This Operand type takes a default argument, and is initialized to this value if it does not appear in a patter. llvm-svn: 163315
* Check all patterns for missing instruction flags.Jakob Stoklund Olesen2012-08-281-0/+1
| | | | | | | Both single-instruction and multi-instruction patterns can be checked for missing mayLoad / mayStore, and hasSideEffects flags. llvm-svn: 162734
* Convert assert(0) to llvm_unreachableCraig Topper2012-02-051-6/+4
| | | | llvm-svn: 149814
* Unconstify InitsDavid Greene2011-07-291-9/+9
| | | | | | Remove const qualifiers from Init references, per Chris' request. llvm-svn: 136531
* [AVX] Constify InitsDavid Greene2011-07-291-9/+9
| | | | | | | Make references to Inits const everywhere. This is the final step before making them unique. llvm-svn: 136485
* struct Init -> class InitDavid Greene2011-07-131-1/+1
| | | | | | | Rename struct Init to class Init for consistency and in preparation for making Init a FoldingSetNode. llvm-svn: 135097
* Revert r134921, 134917, 134908 and 134907. They're causing failuresEric Christopher2011-07-111-10/+10
| | | | | | in multiple buildbots. llvm-svn: 134936
* struct Init -> class Init.Evan Cheng2011-07-111-1/+1
| | | | llvm-svn: 134917
* [AVX] Make Inits FoldableDavid Greene2011-07-111-9/+9
| | | | | | | | | | | | | | | | | | Manage Inits in a FoldingSet. This provides several benefits: - Memory for Inits is properly managed - Duplicate Inits are folded into Flyweights, saving memory - It enforces const-correctness, protecting against certain classes of bugs The above benefits allow Inits to be used in more contexts, which in turn provides more dynamism to TableGen. This enhanced capability will be used by the AVX code generator to a fold common patterns together. llvm-svn: 134907
* Implement major new fastisel functionality: the matcher can now handle ↵Chris Lattner2011-04-181-0/+11
| | | | | | | | | | | | | | | | | | | | | | | immediates with value constraints on them (when defined as ImmLeaf's). This is particularly important for X86-64, where almost all reg/imm instructions take a i64immSExt32 immediate operand, which has a value constraint. Before this patch we ended up iseling the examples into such amazing code as: movabsq $7, %rax imulq %rax, %rdi movq %rdi, %rax ret now we produce: imulq $7, %rdi, %rax ret This dramatically shrinks the generated code at -O0 on x86-64. llvm-svn: 129691
* now that predicates have a decent abstraction layer on them, introduce a new Chris Lattner2011-04-171-1/+2
| | | | | | | | | kind of predicate: one that is specific to imm nodes. The predicate function specified here just checks an int64_t directly instead of messing around with SDNode's. The virtue of this is that it means that fastisel and other things can reason about these predicates. llvm-svn: 129675
* Rework our internal representation of node predicates to expose moreChris Lattner2011-04-171-5/+48
| | | | | | | | 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
* [AVX] Add type checking support for vector/subvector type constraints.David Greene2011-01-241-1/+9
| | | | | | | | | This will be used to check patterns referencing a forthcoming INSERT_SUBVECTOR SDNode. INSERT_SUBVECTOR in turn is very useful for matching to VINSERTF128 instructions and complements the already existing EXTRACT_SUBVECTOR SDNode. llvm-svn: 124145
* Trailing whitespace.Jim Grosbach2010-12-241-96/+96
| | | | llvm-svn: 122542
* Add source Record* reference to PatternToMatch. Allows better diagnostics.Jim Grosbach2010-12-071-2/+4
| | | | llvm-svn: 121196
* stop computing InstImpInputs, it is deadChris Lattner2010-04-201-1/+0
| | | | llvm-svn: 101881
* DAGInstruction::ImpOperands is dead after my recent tblgen work, zap it.Chris Lattner2010-04-201-11/+2
| | | | llvm-svn: 101880
* print the complexity of the pattern being matched in theChris Lattner2010-03-291-0/+4
| | | | | | comment in the generated table. llvm-svn: 99794
* improve type checking of SDNode operand count. This rejects all casesChris Lattner2010-03-281-0/+3
| | | | | | | where an incorrect number of operands is provided to an sdnode instead of just a few cases. llvm-svn: 99761
* eliminate a bunch of code duplication in ParseTreePatternChris Lattner2010-03-281-2/+2
| | | | | | by rotating it. llvm-svn: 99746
* add plumbing for handling multiple result nodes Chris Lattner2010-03-241-1/+1
| | | | | | in some more places. llvm-svn: 99366
* bring sanity to EnforceVectorEltTypeChris Lattner2010-03-241-1/+1
| | | | llvm-svn: 99354
* make getOperandNum a static function (since it's just used by Chris Lattner2010-03-191-5/+0
| | | | | | ApplyTypeConstraint) and make it handle multiple result nodes. llvm-svn: 99003
* major surgery on tblgen: generalize TreePatternNodeChris Lattner2010-03-191-19/+42
| | | | | | | | | 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
* make FillWithPossibleTypes take a predicate to filter types so that Chris Lattner2010-03-191-3/+6
| | | | | | we don't blow the smallvector as often. No functionality change. llvm-svn: 98968
* rewrite EnforceSmallerThan to be less bone headed.Chris Lattner2010-03-191-0/+5
| | | | llvm-svn: 98933
* eliminate the last use of EEVT::isUnknownChris Lattner2010-03-191-7/+2
| | | | llvm-svn: 98918
* Finally change the instruction looking map to be a densemap fromChris Lattner2010-03-191-4/+4
| | | | | | | | | record* -> instrinfo instead of std::string -> instrinfo. This speeds up tblgen on cellcpu from 7.28 -> 5.98s with a debug build (20%). llvm-svn: 98916
* infer results of a pattern from implicit defs. This allows you to do something Chris Lattner2010-03-181-0/+4
| | | | | | | | | | | | like this: def : Pat<(add ...), (FOOINST)>; When fooinst only has a single implicit def (e.g. to R1). This will be handled as if written as (set R1, (FOOINST ...)) llvm-svn: 98897
* Completely rewrite tblgen's type inference mechanism,Chris Lattner2010-03-151-47/+128
| | | | | | | | | | | | | | | | | | | | | | | | 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
* Fix PR2590 by making PatternSortingPredicate actually be Chris Lattner2010-03-011-3/+4
| | | | | | | | | | | | | | | ordered correctly. Previously it would get in trouble when two patterns were too similar and give them nondet ordering. We force this by using the record ID order as a fallback. The testsuite diff is due to alpha patterns being ordered slightly differently, the change is a semantic noop afaict: < lda $0,-100($16) --- > subq $16,100,$0 llvm-svn: 97509
* Generalize my hack to use SDNodeInfo to find out when aChris Lattner2010-02-281-0/+5
| | | | | | | | | 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
* merge some code.Chris Lattner2010-02-231-0/+1
| | | | llvm-svn: 96896
* start sketching out the structure of code for result emission generation.Chris Lattner2010-02-181-2/+3
| | | | | | Nothing real here yet. llvm-svn: 96575
* add support for the new isel matcher to generate Chris Lattner2010-02-161-0/+7
| | | | | | (isprofitable|islegal)tofold checks. llvm-svn: 96331
* constizeChris Lattner2010-02-141-2/+2
| | | | llvm-svn: 96199
* clean up a bunch of code, move some random predicatesChris Lattner2010-02-141-1/+16
| | | | | | on TreePatternNode to be methods on TreePatternNode. llvm-svn: 96197
* add an insertion operator.Chris Lattner2010-02-141-0/+5
| | | | llvm-svn: 96187
* Remove unneeded ';' and a class/struct mismatch (noticed by clang).Daniel Dunbar2009-12-091-1/+1
| | | | llvm-svn: 90934
* Report errors correctly for unselected target intrinsics.Jakob Stoklund Olesen2009-10-151-0/+2
| | | | llvm-svn: 84193
* PR4795: Remove EEVT::isFP, isInt and isVec types used by TableGen's typeBob Wilson2009-08-291-7/+7
| | | | | | | | | | | | | | | inferencing. As far as I can tell, these are equivalent to the existing MVT::fAny, iAny and vAny types, and having both of them makes it harder to reason about and modify the type inferencing code. The specific problem in PR4795 occurs when updating a vAny type to be fAny or iAny, or vice versa. Both iAny and fAny include vector types -- they intersect with the set of types represented by vAny. When merging them, choose fAny/iAny to represent the intersection. This is not perfect, since fAny/iAny also include scalar types, but it is good enough for TableGen's type inferencing. llvm-svn: 80423
* Try to fix MSVC build after r79846.Benjamin Kramer2009-08-231-2/+4
| | | | llvm-svn: 79850
* Fix non-determinism in DAGISel emitter.Daniel Dunbar2009-08-231-6/+10
| | | | | | | | | | | | | | | | | | | | | | | - This manifested as non-determinism in the .inc output in rare cases (when two distinct patterns ended up being equivalent, which is rather rare). That meant the pattern matching was non-deterministic, which could eventually mean the code generator selected different instructions based on the arch. - It's probably worth making the DAGISel ensure a total ordering (or force the user to), but the simple fix here is to totally order the Record* maps based on a unique ID. - PR4672, PR4711. Yay: -- ddunbar@giles:~$ cat ~/llvm.obj.64/lib/Target/*/*.inc | shasum d1099ff34b21459a5a3e7021c225c080e6017ece - ddunbar@giles:~$ cat ~/llvm.obj.ppc/lib/Target/*/*.inc | shasum d1099ff34b21459a5a3e7021c225c080e6017ece - -- llvm-svn: 79846
* Add a new "SDTCisVec" SDTypeConstraint. This complements the vAny type.Bob Wilson2009-08-121-5/+10
| | | | | | | | There have been a few times where I've wanted this but ended up leaving the operand type unconstrained. It is easy to add this now and should help catch errors in the future. llvm-svn: 78849
OpenPOWER on IntegriCloud