summaryrefslogtreecommitdiffstats
path: root/llvm/utils/TableGen/AsmMatcherEmitter.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Push unique_ptr a bit further through some APIs and simplify some cleanupDavid Blaikie2014-11-281-18/+13
| | | | llvm-svn: 222938
* Use std::map<K, V> rather than std::map<K, std::unique_ptr<V>>David Blaikie2014-11-281-16/+15
| | | | | | | | | | | Pointers and references to map elements are never invalidated (except on removal, which isn't used here) so there's no need for the indirection unless there's polymorphism at work. A little const correctness had to be fixed, since the indirection allowed some benign const violations. llvm-svn: 222937
* Simplify some more ownership using forward_list<T> rather than ↵David Blaikie2014-11-281-65/+54
| | | | | | vector<unique_ptr<T>> llvm-svn: 222935
* Forgotten formatting from previous commitDavid Blaikie2014-11-281-2/+2
| | | | llvm-svn: 222934
* Simplify ownership by using forward_list<T> rather than vector<unique_ptr<T>>David Blaikie2014-11-281-42/+42
| | | | | | | | Since the elements were not polymorphic, the unique_ptr was only used to avoid pointer invalidation on container resizes - might as well skip the indirection and use a container with suitable invalidation semantics. llvm-svn: 222931
* Fix another memory leak in TableGen AsmMatcher by deleting CodeGenInstAliases.Craig Topper2014-11-281-0/+5
| | | | llvm-svn: 222912
* Use unique_ptr to fix some memory leaks in Tablegen AsmMatcherEmitter.Craig Topper2014-11-281-37/+44
| | | | llvm-svn: 222909
* Use range-based for loops and const-correct a few things.Craig Topper2014-11-281-59/+40
| | | | llvm-svn: 222908
* Remove unncessary check for Int_* and *_Int in AsmMatcherEmitter. These are ↵Craig Topper2014-11-251-7/+0
| | | | | | all marked isCodeGenOnly these days. llvm-svn: 222783
* Use range-based for loops.Craig Topper2014-11-251-126/+87
| | | | llvm-svn: 222782
* MCAsmParserExtension has a copy of the MCAsmParser. Use it.Rafael Espindola2014-11-111-1/+1
| | | | | | Base classes were storing a second copy. llvm-svn: 221667
* Repace SmallPtrSet with SmallPtrSetImpl in function arguments to avoid ↵Craig Topper2014-08-211-6/+6
| | | | | | needing to mention the size. llvm-svn: 216158
* TableGen: allow use of uint64_t for available features mask.Tim Northover2014-08-181-19/+21
| | | | | | | | | | ARM in particular is getting dangerously close to exceeding 32 bits worth of possible subtarget features. When this happens, various parts of MC start to fail inexplicably as masks get truncated to "unsigned". Mostly just refactoring at present, and there's probably no way to test. llvm-svn: 215887
* Revert "Repace SmallPtrSet with SmallPtrSetImpl in function arguments to ↵Craig Topper2014-08-181-6/+6
| | | | | | | | avoid needing to mention the size." Getting a weird buildbot failure that I need to investigate. llvm-svn: 215870
* Repace SmallPtrSet with SmallPtrSetImpl in function arguments to avoid ↵Craig Topper2014-08-171-6/+6
| | | | | | needing to mention the size. llvm-svn: 215868
* AsmMatchers: Use unique_ptr to manage ownership of MCParsedAsmOperandDavid Blaikie2014-06-081-24/+23
| | | | | | | | | | | | I saw at least a memory leak or two from inspection (on probably untested error paths) and r206991, which was the original inspiration for this change. I ran this idea by Jim Grosbach a few weeks ago & he was OK with it. Since it's a basically mechanical patch that seemed sufficient - usual post-commit review, revert, etc, as needed. llvm-svn: 210427
* [asm matcher] Fix incorrect assertion when there are exactly 32 ↵Daniel Sanders2014-05-211-13/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | SubtargetFeatures Summary: The minimal type needs to hold a value of '1ULL << 31' but getMinimalTypeForRange() is called with a value of '1ULL << 32'. This patch will also reduce the size of the matcher table when there are 8 or 16 SubtargetFeatures. Also added a dump of the SubtargetFeatures to the -debug output and corrected getMinimalTypeInRange() to consider 0xffffffffull to be a 32-bit value. The testcase is that no existing code is broken and that LLVM still successfully compiles after adding MIPS64r6 CodeGen support. Reviewers: rafael Reviewed By: rafael Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D3787 llvm-svn: 209288
* Clean up language and grammar.Eric Christopher2014-05-201-2/+2
| | | | | | | Based on a patch by jfcaron3@gmail.com! PR19806 llvm-svn: 209216
* TableGen/ARM64: print aliases even if they have syntax variants.Tim Northover2014-05-151-1/+2
| | | | | | | To get at least one use of the change (and some actual tests) in with its commit, I've enabled the AArch64 & ARM64 NEON mov aliases. llvm-svn: 208867
* [Modules] Make Support/Debug.h modular. This requires it to not changeChandler Carruth2014-04-211-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | behavior based on other files defining DEBUG_TYPE, which means it cannot define DEBUG_TYPE at all. This is actually better IMO as it forces folks to define relevant DEBUG_TYPEs for their files. However, it requires all files that currently use DEBUG(...) to define a DEBUG_TYPE if they don't already. I've updated all such files in LLVM and will do the same for other upstream projects. This still leaves one important change in how LLVM uses the DEBUG_TYPE macro going forward: we need to only define the macro *after* header files have been #include-ed. Previously, this wasn't possible because Debug.h required the macro to be pre-defined. This commit removes that. By defining DEBUG_TYPE after the includes two things are fixed: - Header files that need to provide a DEBUG_TYPE for some inline code can do so by defining the macro before their inline code and undef-ing it afterward so the macro does not escape. - We no longer have rampant ODR violations due to including headers with different DEBUG_TYPE definitions. This may be mostly an academic violation today, but with modules these types of violations are easy to check for and potentially very relevant. Where necessary to suppor headers with DEBUG_TYPE, I have moved the definitions below the includes in this commit. I plan to move the rest of the DEBUG_TYPE macros in LLVM in subsequent commits; this one is big enough. The comments in Debug.h, which were hilariously out of date already, have been updated to reflect the recommended practice going forward. llvm-svn: 206822
* [C++11] More 'nullptr' conversion. In some cases just using a boolean check ↵Craig Topper2014-04-151-6/+6
| | | | | | instead of comparing to nullptr. llvm-svn: 206254
* Retire llvm::array_endof in favor of non-member std::end.Benjamin Kramer2014-04-121-4/+4
| | | | | | While there make array_lengthof constexpr if we have support for it. llvm-svn: 206112
* tblgen: Twinify PrintFatalError.Benjamin Kramer2014-03-291-14/+14
| | | | | | No functionality change. llvm-svn: 205110
* [C++11] Add 'override' keyword to virtual methods that override their base ↵Craig Topper2014-03-091-2/+2
| | | | | | class. llvm-svn: 203418
* Replace OwningPtr<T> with std::unique_ptr<T>.Ahmed Charles2014-03-061-4/+3
| | | | | | | | | | This compiles with no changes to clang/lld/lldb with MSVC and includes overloads to various functions which are used by those projects and llvm which have OwningPtr's as parameters. This should allow out of tree projects some time to move. There are also no changes to libs/Target, which should help out of tree targets have time to move, if necessary. llvm-svn: 203083
* [C++11] Replace OwningPtr::take() with OwningPtr::release().Ahmed Charles2014-03-051-3/+3
| | | | llvm-svn: 202957
* Now that we have C++11, turn simple functors into lambdas and remove a ton ↵Benjamin Kramer2014-03-011-10/+1
| | | | | | | | of boilerplate. No intended functionality change. llvm-svn: 202588
* Add missing #include's to cctype when using isdigit/alpha/etc.Will Dietz2013-10-121-0/+1
| | | | llvm-svn: 192519
* Remove several unused variables.Rafael Espindola2013-10-011-9/+0
| | | | | | Patch by Alp Toker. llvm-svn: 191757
* TableGen: fix constness of new comparison function.Tim Northover2013-09-161-1/+1
| | | | | | libc++ didn't seem to like a non-const call operator. llvm-svn: 190797
* TableGen: give asm match classes deterministic order.Tim Northover2013-09-161-23/+46
| | | | | | | | | | | | | | | TableGen was sorting the entries in some of its internal data structures by pointer. This order filtered through to the final matching table and affected the diagnostics produced on bad assembly occasionally. It also turns out STL algorithms are ridiculously easy to misuse on containers with custom order methods. (No bugs before, or now that I know of, but plenty in the middle). This should fix the sanitizer bot, which ends up with weird pointers. llvm-svn: 190793
* AsmMatcher: emit subtarget feature enum in deterministic order.Tim Northover2013-09-161-7/+7
| | | | llvm-svn: 190792
* Add an instruction deprecation feature to TableGen.Joey Gouly2013-09-121-0/+20
| | | | | | | | | | | | | | | | | | | | | | The 'Deprecated' class allows you to specify a SubtargetFeature that the instruction is deprecated on. The 'ComplexDeprecationPredicate' class allows you to define a custom predicate that is called to check for deprecation. For example: ComplexDeprecationPredicate<"MCR"> would mean you would have to define the following function: bool getMCRDeprecationInfo(MCInst &MI, MCSubtargetInfo &STI, std::string &Info) Which returns 'false' for not deprecated, and 'true' for deprecated and store the warning message in 'Info'. The MCTargetAsmParser constructor was chaned to take an extra argument of the MCInstrInfo class, so out-of-tree targets will need to be changed. llvm-svn: 190598
* Move StringToOffsetTable into the TableGen include directory so I can use it ↵Craig Topper2013-08-291-1/+1
| | | | | | in clang. llvm-svn: 189567
* Revert r188164: Stablize MCK_Reg ordering in AsmMatcherEmitterRichard Sandiford2013-08-121-21/+19
| | | | | | Apparently caused a failure on Darwin llvm-svn: 188166
* Stablize MCK_Reg ordering in AsmMatcherEmitterRichard Sandiford2013-08-121-19/+21
| | | | | | | | | | | | | | | clang bootstraps intermittently failed for me due a difference in the MCK_Reg ordering in ARMGenAsmMatcher.inc. E.g. in my latest run the stage 1 and stage 3 versions were the same but the stage 2 one was different (though still functionally correct). This meant that the .o comparison failed. MCK_Regs were assigned by iterating over a std::set< std::set<Record*> >, and since std::set is sorted lexicographically, the order depended on the order of the pointer values. This patch replaces the pointer ordering with LessRecordByID. llvm-svn: 188164
* Remove some std stream usage from Support and TableGenReid Kleckner2013-08-061-1/+2
| | | | | | | | | | LLVM's coding standards recommend raw_ostream and MemoryBuffer for reading and writing text. This has the side effect of allowing clang to compile more of Support and TableGen in the Microsoft C++ ABI. llvm-svn: 187826
* Moving definition of MnemonicContainsDot field from class Instruction to ↵Vladimir Medic2013-08-011-2/+1
| | | | | | class AsmParser as suggested. llvm-svn: 187569
* Split generated asm mnemonic matching table into a separate table for each ↵Craig Topper2013-07-241-38/+71
| | | | | | | | asm variant. This removes the need to store the asm variant in each row of the single table that existed before. Shaves ~16K off the size of X86AsmParser.o. llvm-svn: 187026
* This patch allows targets to define weather the instruction mnemonics in asm ↵Vladimir Medic2013-07-161-4/+7
| | | | | | matcher tables will contain '.' character. llvm-svn: 186388
* Teaching llvm-tblgen to not emit a switch statement when there are no case ↵Aaron Ballman2013-07-151-22/+45
| | | | | | statements. llvm-svn: 186330
* Handle tied sub-operands in AsmMatcherEmitterUlrich Weigand2013-04-271-30/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The problem this patch addresses is the handling of register tie constraints in AsmMatcherEmitter, where one operand is tied to a sub-operand of another operand. The typical scenario for this to happen is the tie between the "write-back" register of a pre-inc instruction, and the base register sub-operand of the memory address operand of that instruction. The current AsmMatcherEmitter code attempts to handle tied operands by emitting the operand as usual first, and emitting a CVT_Tied node when handling the second (tied) operand. However, this really only works correctly if the tied operand does not have sub-operands (and isn't a sub-operand itself). Under those circumstances, a wrong MC operand list is generated. In discussions with Jim Grosbach, it turned out that the MC operand list really ought not to contain tied operands in the first place; instead, it ought to consist of exactly those operands that are named in the AsmString. However, getting there requires significant rework of (some) targets. This patch fixes the immediate problem, and at the same time makes one (small) step in the direction of the long-term solution, by implementing two changes: 1. Restricts the AsmMatcherEmitter handling of tied operands to apply solely to simple operands (not complex operands or sub-operand of such). This means that at least we don't get silently corrupt MC operand lists as output. However, if we do have tied sub-operands, they would now no longer be handled at all, except for: 2. If we have an operand that does not occur in the AsmString, and also isn't handled as tied operand, simply emit a dummy MC operand (constant 0). This works as long as target code never attempts to access MC operands that do no not occur in the AsmString (and are not tied simple operands), which happens to be the case for all targets where this situation can occur (ARM and PowerPC). [ Note that this change means that many of the ARM custom converters are now superfluous, since the implement the same "hack" now performed already by common code. ] Longer term, we ought to fix targets to never access *any* MC operand that does not occur in the AsmString (including tied simple operands), and then finally completely remove all such operands from the MC operand list. Patch approved by Jim Grosbach. llvm-svn: 180677
* [asm parser] Add support for predicating MnemonicAlias based on the assemblerChad Rosier2013-04-181-20/+45
| | | | | | | | variant/dialect. Addresses a FIXME in the emitMnemonicAliases function. Use and test case to come shortly. rdar://13688439 and part of PR13340. llvm-svn: 179804
* Allow targets to add custom asm operand matching logic.Jim Grosbach2013-02-061-0/+9
| | | | | | | | | | For example, ARM has several instructions with a literal '#0' immediate in the syntax that's not represented as an actual operand. The asm matcher is expected a token operand, but the parser will have created an immediate operand. This is currently handled by dedicated per-instruction C++ munging of the ParsedAsmOperand list, but will be better handled by this hook. llvm-svn: 174487
* [ms-inline asm] Address the FIXME in AsmParser.cpp.Chad Rosier2013-01-151-4/+8
| | | | | | | | | | // FIXME: Constraints are hard coded to 'm', but we need an 'r' // constraint for addressof. This needs to be cleaned up! Test cases are already in place. Specifically, clang/test/CodeGen/ms-inline-asm.c t15(), t16(), and t24(). llvm-svn: 172569
* Remove locale-dependence of enum mangling and use existing function.Tim Northover2013-01-101-14/+10
| | | | llvm-svn: 172077
* Make TableGen mangle operand method names before putting in enum.Tim Northover2013-01-101-2/+13
| | | | | | | | | The purpose of this patch is to allow PredicateMethods to be set to something like "isUImm<8>", calling a C++ template method to reduce code duplication. For this to work, the PredicateMethod must be mangled into a valid C++ identifier for insertion into an enum. llvm-svn: 172073
* Sort the #include lines for utils/...Chandler Carruth2012-12-041-1/+1
| | | | | | | 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-29/+29
| | | | | | | | | | | 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
* [ms-inline asm] Use the new API introduced in r165830 in lieu of theChad Rosier2012-10-121-22/+15
| | | | | | MapAndConstraints vector. Also remove the unused Kind argument. llvm-svn: 165833
OpenPOWER on IntegriCloud