summaryrefslogtreecommitdiffstats
path: root/llvm/utils/TableGen/CodeGenDAGPatterns.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* [TableGen] Fix bug in TableGen CodeGenPatterns when adding variants of the ↵Ayman Musa2017-06-271-2/+2
| | | | | | | | | | | | | | | | | patterns. All patterns reside in a std::vector container, where new variants are added to it using the standard library's emplace_back function. When calling this with a new element while there is no enough allocated space, a bigger space is allocated and all the old info in the small vector is copied to the newly allocated vector, then the old vector is freed. The problem is that before doing this "copying", we take a reference of one of the elements in the old vector, and after the "copying" we add it to the new vector. As the old vector is freed after the copying, the reference now does not point to a valid element. Added new function to the API of CodeGenDAGPatterns class to return the same information as a copy in order to avoid this issue. This was revealed in rL305465 that added many patterns and forced the reallocation of the vector which caused crashes in windows bots. Differential Revision: https://reviews.llvm.org/D34341 llvm-svn: 306371
* [TableGen] Remove some copies around PatternToMatch.Craig Topper2017-06-251-10/+8
| | | | | | | | | | | | | | | | | | | Summary: This patch does a few things that should remove some copies around PatternsToMatch. These were noticed while reviewing code for D34341. Change constructor to take Dstregs by value and move it into the class. Change one of the callers to add std::move to the argument so that it gets moved. Make AddPatternToMatch take PatternToMatch by rvalue reference so we can move it into the PatternsToMatch vector. I believe we should have a implicit default move constructor available on PatternToMatch. I chose rvalue reference because both callers call it with temporaries already. Reviewers: RKSimon, aymanmus, spatel Reviewed By: aymanmus Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D34411 llvm-svn: 306251
* [TableGen] Take a parameter by reference instead of pointer so we don't have ↵Craig Topper2017-06-201-4/+4
| | | | | | to add & on both callers. NFC llvm-svn: 305807
* [TableGen] Use range based for loop. NFCCraig Topper2017-06-201-3/+1
| | | | llvm-svn: 305806
* [TableGen] Do not assume that the first variant is the original patternKrzysztof Parzyszek2017-06-161-3/+1
| | | | | | | | | The variant generation for commutative/associative patterns would simply delete the first output from the list assuming that it was identical to the original pattern. This does not have to be the case, and a legitimate variant could actually be removed that way. llvm-svn: 305556
* [TableGen] Adapt more places to getValueAsString now returning a StringRef ↵Craig Topper2017-05-311-1/+1
| | | | | | instead of a std::string. llvm-svn: 304347
* [TableGen] Make Record::getValueAsString and getValueAsListOfStrings return ↵Craig Topper2017-05-311-1/+3
| | | | | | | | | | | | StringRefs instead of std::string Internally both these methods just return the result of getValue on either a StringInit or a CodeInit object. In both cases this returns a StringRef pointing to a string allocated in the BumpPtrAllocator so its not going anywhere. So we can just pass that StringRef along. This is a fairly naive patch that targets just the build failures caused by this change. There's additional work that can be done to avoid creating std::string at call sites that still think getValueAsString returns a std::string. I'll try to clean those up in future patches. Differential Revision: https://reviews.llvm.org/D33710 llvm-svn: 304325
* TableGen: Add IntrHasSideEffects property for intrinsicsMatt Arsenault2017-04-281-1/+2
| | | | | | | | | | | | | | | The IntrNoMem, IntrReadMem, IntrWriteMem, and IntrArgMemOnly intrinsic properties differ from their corresponding LLVM IR attributes by specifying that the intrinsic, in addition to its memory properties, has no other side effects. The IntrHasSideEffects flag used in combination with one of the memory flags listed above, makes it possible to define an intrinsic such that its properties at the CodeGen layer match its properties at the IR layer. Patch by Tom Stellard llvm-svn: 301685
* [SelectionDAG] Enhance SDTCisSameNumEltsAs to work with scalar types and use ↵Craig Topper2017-03-131-35/+53
| | | | | | | | | | | | it on extend/trunc/round operations. Currently we don't enforce that ISD::ANY_EXTEND, ZERO_EXTEND, SIGN_EXTEND, TRUNC, FP_ROUND, FP_EXTEND have the same number of elements(including scalar) between their input and output. Though we have them documented as such. Up until a few months ago x86 created nodes that violated this rule. That's all been fixed now, and we should enforce the rule going forward. In order to do this we need to allow SDTCisSameNumEltsAs to support scalar types and not enforce being a vector. If one type is scalar we will force the other type to also be scalar. Differential Revision: https://reviews.llvm.org/D30878 llvm-svn: 297648
* [TableGen] Make sure EnforceSameSize populates the type sets if necessary.Craig Topper2017-02-181-0/+6
| | | | | | This was found by another commit I'm working on. llvm-svn: 295578
* Cleanup dump() functions.Matthias Braun2017-01-281-2/+2
| | | | | | | | | | | | | | | | | | We had various variants of defining dump() functions in LLVM. Normalize them (this should just consistently implement the things discussed in http://lists.llvm.org/pipermail/cfe-dev/2014-January/034323.html For reference: - Public headers should just declare the dump() method but not use LLVM_DUMP_METHOD or #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) - The definition of a dump method should look like this: #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) LLVM_DUMP_METHOD void MyClass::dump() { // print stuff to dbgs()... } #endif llvm-svn: 293359
* [TableGen] Use 'unsigned' instead of 'bool' in a place where the code ↵Craig Topper2016-12-191-1/+1
| | | | | | conditionally assigns numeric values. They happen to be 0 and 1 so this is NFC. llvm-svn: 290088
* TableGen: Use StringInit instead of std::string for DagInit arg namesMatthias Braun2016-12-051-9/+11
| | | | llvm-svn: 288644
* TableGen: Use StringInit instead of std::string for DagInit nameMatthias Braun2016-12-051-4/+4
| | | | llvm-svn: 288643
* TableGen: Use StringRef instead of const std::string& in return vals.Matthias Braun2016-12-041-1/+1
| | | | | | | This will allow to switch to a different string storage in an upcoming commit. llvm-svn: 288612
* Re-apply r286384, "X86: Introduce the "relocImm" ComplexPattern, which ↵Peter Collingbourne2016-11-091-6/+1
| | | | | | | | | represents a relocatable immediate.", with a fix for 32-bit x86. Teach X86InstrInfo::analyzeCompare() not to crash on CMP and SUB instructions that take a global address operand. llvm-svn: 286420
* Revert r286384, "X86: Introduce the "relocImm" ComplexPattern, which ↵Peter Collingbourne2016-11-091-1/+6
| | | | | | | | | represents a relocatable immediate." Suspected to be the cause of a sanitizer-windows bot failure: Assertion failed: isImm() && "Wrong MachineOperand accessor", file C:\b\slave\sanitizer-windows\llvm\include\llvm/CodeGen/MachineOperand.h, line 420 llvm-svn: 286385
* X86: Introduce the "relocImm" ComplexPattern, which represents a relocatable ↵Peter Collingbourne2016-11-091-6/+1
| | | | | | | | | | | | | | | immediate. A relocatable immediate is either an immediate operand or an operand that can be relocated by the linker to an immediate, such as a regular symbol in non-PIC code. Start using relocImm for 32-bit and 64-bit MOV instructions, and for operands of type "imm32_su". Remove a number of now-redundant patterns. Differential Revision: https://reviews.llvm.org/D25812 llvm-svn: 286384
* Use the range variant of remove_if instead of unpacking begin/endDavid Majnemer2016-08-121-54/+39
| | | | | | No functionality change is intended. llvm-svn: 278475
* Use range algorithms instead of unpacking begin/endDavid Majnemer2016-08-111-8/+7
| | | | | | No functionality change is intended. llvm-svn: 278417
* IR: Sort generic intrinsics before target specific onesJustin Bogner2016-07-151-2/+2
| | | | | | | | | | | | This splits out the intrinsic table such that generic intrinsics come first and target specific intrinsics are grouped by target. From here we can find out which target an intrinsic is for or differentiate between generic and target intrinsics. The motivation here is to make it easier to move target specific intrinsic handling out of generic code. llvm-svn: 275575
* Add IntrWrite[Arg]Mem intrinsic propertyNicolai Haehnle2016-04-191-3/+3
| | | | | | | | | | | | | | | | | | | | | | Summary: This property is used to mark an intrinsic that only writes to memory, but neither reads from memory nor has other side effects. An example where this is useful is the llvm.amdgcn.buffer.store.format.* intrinsic, which corresponds to a store instruction that goes through a special buffer descriptor rather than through a plain pointer. With this property, the intrinsic should still be handled as having side effects at the LLVM IR level, but machine scheduling can make smarter decisions. Reviewers: tstellarAMD, arsenm, joker.eph, reames Subscribers: arsenm, llvm-commits Differential Revision: http://reviews.llvm.org/D18291 llvm-svn: 266826
* [TableGen] Make an error message slightly more informativeNicolai Haehnle2016-04-191-2/+9
| | | | | | | | | | Reviewers: ab, spop, stoklund Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D19192 llvm-svn: 266823
* [TableGen] Store result of getInstructionsByEnumValue in an ArrayRef instead ↵Craig Topper2016-02-011-1/+1
| | | | | | of accidentally copying to a vector. llvm-svn: 259336
* [TableGen] Remove an assumption about the order of encodings in the ↵Craig Topper2015-12-031-2/+13
| | | | | | MVT::SimpleValueType enum. Instead of assuming the types are sorted by size, scan the typeset arrays to find the smallest/largest type. NFC llvm-svn: 254589
* [TableGen] Use SmallString instead of std::string to build up a string to ↵Craig Topper2015-11-281-2/+3
| | | | | | avoid heap allocations. NFC llvm-svn: 254221
* [TableGen] Sort pattern predicates before concatenating into a string so ↵Craig Topper2015-11-271-4/+11
| | | | | | that different orders of the same set will produce the same string. This can reduce the number of unique predicates in the isel tables. NFC llvm-svn: 254192
* [SelectionDAG] Add a SDTCisSameSizeAs type constraint that can be used to ↵Craig Topper2015-11-261-0/+66
| | | | | | ensure vector widths match even if the element size and count don't. llvm-svn: 254138
* [TableGen] Flip reversed comments.Craig Topper2015-11-261-2/+2
| | | | llvm-svn: 254136
* [TableGen] Use std::remove_if instead of manually coded loops that call ↵Craig Topper2015-11-241-74/+74
| | | | | | erase multiple times. NFC llvm-svn: 253964
* [TableGen] Use the other version of EnforceVectorEltTypeIs inside the ↵Craig Topper2015-11-241-15/+1
| | | | | | TypeSet version of EnforceVectorEltTypeIs to reduce duplicated code. NFC llvm-svn: 253963
* [TableGen] Fix formatting and use logical OR. NFCCraig Topper2015-11-241-2/+1
| | | | llvm-svn: 253962
* [TableGen] Use std::set_intersection to merge TypeSets. NFCCraig Topper2015-11-241-9/+8
| | | | llvm-svn: 253961
* [TableGen] Use SmallVector::assign instead of a resize and replace element.Craig Topper2015-11-241-2/+1
| | | | llvm-svn: 253960
* [TableGen] Use std::remove_if instead of manually coded loops that called ↵Craig Topper2015-11-231-15/+13
| | | | | | erase inside them. NFC llvm-svn: 253857
* [TableGen] Use empty() instead of checking if size of vector is greater than ↵Craig Topper2015-11-231-1/+2
| | | | | | or equal to 1. llvm-svn: 253856
* Revert a portion of r253836 that seems to have broke a couple bots.Craig Topper2015-11-221-11/+14
| | | | llvm-svn: 253838
* [TableGen] Use range-based for loops. NFCCraig Topper2015-11-221-127/+112
| | | | llvm-svn: 253836
* [TableGen] Use std::fill instead of a manually coded loop. NFCCraig Topper2015-11-221-2/+2
| | | | llvm-svn: 253835
* Further simplify from r253832 with some unique_ptr and coalescing conditionsDavid Blaikie2015-11-221-17/+12
| | | | llvm-svn: 253834
* Further simplify from r253832, removing unnecessary intermediate lambdasDavid Blaikie2015-11-221-16/+4
| | | | llvm-svn: 253833
* [TableGen] Use std::any_of and std::find instead of manual loops. NFCCraig Topper2015-11-221-32/+23
| | | | llvm-svn: 253832
* [TableGen] Add a space between type and '*' in front of a variable name in ↵Craig Topper2015-10-111-1/+1
| | | | | | output file. While there replace type with 'auto' since there's a cast on the right side of the assignment. NFC llvm-svn: 249980
* Fix typos.Bruce Mitchener2015-09-121-9/+9
| | | | | | | | | | Summary: This fixes a variety of typos in docs, code and headers. Subscribers: jholewinski, sanjoy, arsenm, llvm-commits Differential Revision: http://reviews.llvm.org/D12626 llvm-svn: 247495
* Avoid a Symbol -> Name -> Symbol conversion.Rafael Espindola2015-06-221-1/+2
| | | | | | | | | | | | | | Before this we were producing a TargetExternalSymbol from a MCSymbol. That meant extracting the symbol name and fetching the symbol again down the pipeline. This patch adds a DAG.getMCSymbol that lets the MCSymbol pass unchanged on the DAG. Doing so removes the need for MO_NOPREFIX and fixes the root cause of pr23900, allowing r240130 to be committed again. llvm-svn: 240300
* [TableGen] Use range-based for loops. NFC.Craig Topper2015-06-021-6/+6
| | | | llvm-svn: 238805
* Replace push_back(Constructor(foo)) with emplace_back(foo) for non-trivial typesBenjamin Kramer2015-05-291-7/+5
| | | | | | | | | | | | | | | | | | | | If the type isn't trivially moveable emplace can skip a potentially expensive move. It also saves a couple of characters. Call sites were found with the ASTMatcher + some semi-automated cleanup. memberCallExpr( argumentCountIs(1), callee(methodDecl(hasName("push_back"))), on(hasType(recordDecl(has(namedDecl(hasName("emplace_back")))))), hasArgument(0, bindTemporaryExpr( hasType(recordDecl(hasNonTrivialDestructor())), has(constructExpr()))), unless(isInTemplateInstantiation())) No functional change intended. llvm-svn: 238602
* [TableGen] Replace some calls to ListInit::getSize() with ListInit::empty() ↵Craig Topper2015-05-141-2/+2
| | | | | | if it was just comparing to 0. NFC. llvm-svn: 237340
* Fix tablegen's PrintFatalError function to run registered fileJames Y Knight2015-05-111-15/+13
| | | | | | | | | | | | | | | cleanups. Also, change code in tablegen which printed a message and then called "exit(1)" to use PrintFatalError, instead. This fixes instances where an empty output file was left behind after a failed tablegen invocation, which would confuse subsequent ninja runs into not attempting to rebuild. Differential Revision: http://reviews.llvm.org/D9608 llvm-svn: 237058
* [TableGen] Use 'isa' to identify UnsetInits rather than comparing with the ↵Craig Topper2015-04-221-1/+1
| | | | | | singleton object created by UnsetInit::get(). Makes it more consistent with the other types. llvm-svn: 235465
OpenPOWER on IntegriCloud