summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/SubtargetFeature.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [Subtarget] Move SubtargetFeatureKV/SubtargetInfoKV from SubtargetFeature.h ↵Craig Topper2019-03-051-187/+1
| | | | | | | | | | | | | | | | to MCSubtargetInfo.h. Move all code that operates on ProcFeatures and ProcDesc arrays to MCSubtargetInfo. The SubtargetFeature class managed a list of features as strings. And it also had functions for setting bits in a FeatureBitset. The methods that operated on the Feature list as strings are used in other parts of the backend. But the parts that operate on FeatureBitset are very tightly coupled to MCSubtargetInfo and requires passing in the arrays that MCSubtargetInfo owns. And the same struct type is used for ProcFeatures and ProcDesc. This has led to MCSubtargetInfo having 2 arrays keyed by CPU name. One containing a mapping from a CPU name to its features. And one containing a mapping from CPU name to its scheduler model. I would like to make a single CPU array containing all CPU information and remove some unneeded fields the ProcDesc array currently has. But I don't want to make SubtargetFeatures.h have to know about the scheduler model type and have to forward declare or pull in the header file. Differential Revision: https://reviews.llvm.org/D58937 llvm-svn: 355428
* [SubtargetFeatures] Don't call ApplyFeatureFlag if the feature name is '+help'Craig Topper2019-03-041-2/+2
| | | | | | Just print the help and stop. Otherwise we'll print a message about it not being a real feature name after printing the help text. llvm-svn: 355299
* [SubtargetFeatuers] Simplify the code used to imply features from CPU name.Craig Topper2019-03-041-14/+7
| | | | | | If we make SetImpliedBits OR features outside of its loop, we can reuse it for the first round of implying features for CPUs. llvm-svn: 355298
* [Subtarget] Remove static global constructor call from the tablegened ↵Craig Topper2019-03-011-18/+14
| | | | | | | | | | | | | | | | | | subtarget feature tables Subtarget features are stored in a std::bitset that has been subclassed. There is a special constructor to allow the tablegen files to provide a list of bits to initialize the std::bitset to. This constructor isn't constexpr and std::bitset doesn't support many constexpr operations either. This results in a static global constructor being used to initialize the feature bitsets in these files at startup. To fix this I've introduced a new FeatureBitArray class that holds three 64-bit values representing the initial bit values and taught tablegen to emit hex constants for them based on the feature enum values. This makes the tablegen files less readable than they were before. I can add the list of features back as a comment if we think that's important. I've added a method to convert from this class into the std::bitset subclass we had before. I considered making the new FeatureBitArray class just implement the std::bitset interface we need instead, but thought I'd see how others felts about that first. I've simplified the interfaces to SetImpliedBits and ClearImpliedBits a little minimize the number of times we need to convert to the bitset. This removes about 27K from my local release+asserts build of llc. Differential Revision: https://reviews.llvm.org/D58520 llvm-svn: 355167
* [MC] Make SubtargetFeatureKV only store one FeatureBitset and use an ↵Craig Topper2019-02-181-11/+11
| | | | | | | | | | | | 'unsigned' to hold the value. This class is used for two difference tablegen generated tables. For one of the tables the Value FeatureBitset only has one bit set. For the other usage the Implies field was unused. This patch changes the Value field to just be an unsigned. For the usage that put a real vector in bitset, we now use the previously unused Implies field and leave the Value field unused instead. This is good for a 16K reduction in the size of llc on my local build with all targets enabled. llvm-svn: 354243
* 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
* IWYU for llvm-config.h in llvm, additions.Nico Weber2018-04-301-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | See r331124 for how I made a list of files missing the include. I then ran this Python script: for f in open('filelist.txt'): f = f.strip() fl = open(f).readlines() found = False for i in xrange(len(fl)): p = '#include "llvm/' if not fl[i].startswith(p): continue if fl[i][len(p):] > 'Config': fl.insert(i, '#include "llvm/Config/llvm-config.h"\n') found = True break if not found: print 'not found', f else: open(f, 'w').write(''.join(fl)) and then looked through everything with `svn diff | diffstat -l | xargs -n 1000 gvim -p` and tried to fix include ordering and whatnot. No intended behavior change. llvm-svn: 331184
* Reverting r315590; it did not include changes for llvm-tblgen, which is ↵Aaron Ballman2017-10-151-1/+1
| | | | | | | | causing link errors for several people. Error LNK2019 unresolved external symbol "public: void __cdecl `anonymous namespace'::MatchableInfo::dump(void)const " (?dump@MatchableInfo@?A0xf4f1c304@@QEBAXXZ) referenced in function "public: void __cdecl `anonymous namespace'::AsmMatcherEmitter::run(class llvm::raw_ostream &)" (?run@AsmMatcherEmitter@?A0xf4f1c304@@QEAAXAEAVraw_ostream@llvm@@@Z) llvm-tblgen D:\llvm\2017\utils\TableGen\AsmMatcherEmitter.obj 1 llvm-svn: 315854
* [dump] Remove NDEBUG from test to enable dump methods [NFC]Don Hinton2017-10-121-1/+1
| | | | | | | | | | | | | | | Summary: Add LLVM_FORCE_ENABLE_DUMP cmake option, and use it along with LLVM_ENABLE_ASSERTIONS to set LLVM_ENABLE_DUMP. Remove NDEBUG and only use LLVM_ENABLE_DUMP to enable dump methods. Move definition of LLVM_ENABLE_DUMP from config.h to llvm-config.h so it'll be picked up by public headers. Differential Revision: https://reviews.llvm.org/D38406 llvm-svn: 315590
* Sort the remaining #include lines in include/... and lib/....Chandler Carruth2017-06-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | I did this a long time ago with a janky python script, but now clang-format has built-in support for this. I fed clang-format every line with a #include and let it re-sort things according to the precise LLVM rules for include ordering baked into clang-format these days. I've reverted a number of files where the results of sorting includes isn't healthy. Either places where we have legacy code relying on particular include ordering (where possible, I'll fix these separately) or where we have particular formatting around #include lines that I didn't want to disturb in this patch. This patch is *entirely* mechanical. If you get merge conflicts or anything, just ignore the changes in this patch and run clang-format over your #include lines in the files. Sorry for any noise here, but it is important to keep these things stable. I was seeing an increasing number of patches with irrelevant re-ordering of #include lines because clang-format was used. This patch at least isolates that churn, makes it easy to skip when resolving conflicts, and gets us to a clean baseline (again). llvm-svn: 304787
* SubtargetFeature: Cleanup; NFCMatthias Braun2017-02-211-65/+31
| | | | | | | | | - Fix doxygen comments - Remove duplicated comments - Remove section comments (which became wrong over time) - Use more `const` and references but less `auto` llvm-svn: 295687
* [MC] Fix some Clang-tidy modernize and Include What You Use warnings in ↵Eugene Zelenko2017-02-091-8/+11
| | | | | | | | SubtargetFeature; other minor fixes (NFC). Same changes in files affected by reduced SubtargetFeature.h dependencies. llvm-svn: 294548
* Cleanup dump() functions.Matthias Braun2017-01-281-0/+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
* [MC] Remove guard(s). NFCI.Davide Italiano2016-08-221-2/+0
| | | | | | | All the methods are already marked with LLVM_DUMP_METHOD. llvm-svn: 279428
* [NFC] Header cleanupMehdi Amini2016-04-181-0/+1
| | | | | | | | | | | | | | Removed some unused headers, replaced some headers with forward class declarations. Found using simple scripts like this one: clear && ack --cpp -l '#include "llvm/ADT/IndexedMap.h"' | xargs grep -L 'IndexedMap[<]' | xargs grep -n --color=auto 'IndexedMap' Patch by Eugene Kosov <claprix@yandex.ru> Differential Revision: http://reviews.llvm.org/D19219 From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 266595
* Annotate dump() methods with LLVM_DUMP_METHOD, addressing Richard Smith ↵Yaron Keren2016-01-291-1/+1
| | | | | | | | r259192 post commit comment. clang part in r259232, this is the LLVM part of the patch. llvm-svn: 259240
* (NFC) Change SubtargetFeatures::ToggleFeature andArtyom Skrobov2016-01-051-12/+6
| | | | | | | | | | | SubtargetFeatures::ApplyFeatureFlag to be static, so that MCSubtargetInfo doesn't need to instantiate SubtargetFeatures for nothing. Also change the return type to void, as it wasn't ever used. This is a partial commit of http://reviews.llvm.org/D15746 llvm-svn: 256823
* Use std::is_sorted instead of manual loops. NFCCraig Topper2016-01-031-8/+4
| | | | llvm-svn: 256701
* [ADT] Switch a bunch of places in LLVM that were doing single-characterChandler Carruth2015-09-101-1/+1
| | | | | | | splits to actually use the single character split routine which does less work, and in a debug build is *substantially* faster. llvm-svn: 247245
* [ARM] Add knowledge of FPU subtarget features to TargetParserJohn Brawn2015-06-051-22/+33
| | | | | | | | | | | | | Add getFPUFeatures to TargetParser, which gets the list of subtarget features that are enabled/disabled for each FPU, and use it when handling the .fpu directive. No functional change in this commit, though clang will start behaving differently once it starts using this. Differential Revision: http://reviews.llvm.org/D10237 llvm-svn: 239150
* [MC] Replace custom string join function with the one from StringExtras.Benjamin Kramer2015-05-281-22/+2
| | | | | | NFC. llvm-svn: 238414
* Use std::bitset for SubtargetFeatures.Michael Kuperstein2015-05-261-11/+12
| | | | | | | | | | | | Previously, subtarget features were a bitfield with the underlying type being uint64_t. Since several targets (X86 and ARM, in particular) have hit or were very close to hitting this bound, switching the features to use a bitset. No functional change. The first several times this was committed (e.g. r229831, r233055), it caused several buildbot failures. Apparently the reason for most failures was both clang and gcc's inability to deal with large numbers (> 10K) of bitset constructor calls in tablegen-generated initializers of instruction info tables. This should now be fixed. llvm-svn: 238192
* Reverting r237234, "Use std::bitset for SubtargetFeatures"Michael Kuperstein2015-05-131-12/+11
| | | | | | | The buildbots are still not satisfied. MIPS and ARM are failing (even though at least MIPS was expected to pass). llvm-svn: 237245
* Use std::bitset for SubtargetFeaturesMichael Kuperstein2015-05-131-11/+12
| | | | | | | | | | | Previously, subtarget features were a bitfield with the underlying type being uint64_t. Since several targets (X86 and ARM, in particular) have hit or were very close to hitting this bound, switching the features to use a bitset. No functional change. The first two times this was committed (r229831, r233055), it caused several buildbot failures. At least some of the ARM and MIPS ones were due to gcc/binutils issues, and should now be fixed. llvm-svn: 237234
* Make llc use getHostCPUFeatures when 'native' is specified for cpu.Craig Topper2015-03-311-2/+3
| | | | | | This is necessary for x86 where not all Sandybridge, Ivybrige, Haswell, and Broadwell CPUs support AVX. Currently we modify the CPU name back to Nehalem for this case, but that turns off additional features for these CPUs. llvm-svn: 233673
* Convert feature strings to lowercase even if they have a '+'/'-' in front of ↵Craig Topper2015-03-281-1/+1
| | | | | | them. llvm-svn: 233475
* Update comment to match code behavior.Craig Topper2015-03-281-1/+1
| | | | llvm-svn: 233470
* Revert "Use std::bitset for SubtargetFeatures"Michael Kuperstein2015-03-241-12/+11
| | | | | | | | This reverts commit r233055. It still causes buildbot failures (gcc running out of memory on several platforms, and a self-host failure on arm), although less than the previous time. llvm-svn: 233068
* Use std::bitset for SubtargetFeaturesMichael Kuperstein2015-03-241-11/+12
| | | | | | | | | | | | | Previously, subtarget features were a bitfield with the underlying type being uint64_t. Since several targets (X86 and ARM, in particular) have hit or were very close to hitting this bound, switching the features to use a bitset. No functional change. The first time this was committed (r229831), it caused several buildbot failures. At least some of the ARM ones were due to gcc/binutils issues, and should now be fixed. Differential Revision: http://reviews.llvm.org/D8542 llvm-svn: 233055
* Reverting r229831 due to multiple ARM/PPC/MIPS build-bot failures.Michael Kuperstein2015-02-191-12/+11
| | | | llvm-svn: 229841
* Use std::bitset for SubtargetFeaturesMichael Kuperstein2015-02-191-11/+12
| | | | | | | | | | | Previously, subtarget features were a bitfield with the underlying type being uint64_t. Since several targets (X86 and ARM, in particular) have hit or were very close to hitting this bound, switching the features to use a bitset. No functional change. Differential Revision: http://reviews.llvm.org/D7065 llvm-svn: 229831
* Fix some cases where StringRef was being passed by const reference. Remove ↵Craig Topper2014-08-301-8/+8
| | | | | | const from some other StringRefs since its implicitly const already. llvm-svn: 216820
* SubTargetFeature.cpp: it seems the size of this SmallVector should be 3Hans Wennborg2014-08-111-1/+1
| | | | | | because some subtarget feature strings have three components. llvm-svn: 215339
* Make the split function use StringRef::split.Eric Christopher2014-05-131-19/+3
| | | | llvm-svn: 208723
* Use a range based for loop for the SubtargetFeatures print function.Eric Christopher2014-05-061-2/+2
| | | | llvm-svn: 208132
* Fix odd formatting that snuck into last patch.Eric Christopher2014-05-061-3/+3
| | | | llvm-svn: 208130
* ArrayRef-ize the Feature and Processor tables for SubtargetFeatures.Eric Christopher2014-05-061-60/+46
| | | | | | | | This removes arguments passed everywhere and allows the use of standard iteration over lists. Should be no functional change. llvm-svn: 208127
* Have the SubtargetFeature help routine just not return a number andEric Christopher2014-05-061-6/+4
| | | | | | | | fall back to the normal path without a cpu. While doing this fix llc to just exit when we don't have a module to process instead of asserting. llvm-svn: 208102
* Revert "Walk back commits for unused function parameters - they're still being"Eric Christopher2014-05-061-19/+5
| | | | | | this reapplies 208012 and 208002. llvm-svn: 208037
* Walk back commits for unused function parameters - they're still beingEric Christopher2014-05-051-5/+19
| | | | | | used via dragonegg for now. llvm-svn: 208016
* Remove a now unnecessary function since all calls have one versionEric Christopher2014-05-051-17/+4
| | | | | | and inline it into its caller. llvm-svn: 208012
* Remove a call to std::exit in a library. Make "Help" returnEric Christopher2014-05-051-5/+7
| | | | | | a 0 as a default answer. llvm-svn: 208009
* Remove unused argument from AddFeature.Eric Christopher2014-05-051-3/+2
| | | | llvm-svn: 208002
* [C++11] More 'nullptr' conversion or in some cases just using a boolean ↵Craig Topper2014-04-131-1/+1
| | | | | | check instead of comparing to nullptr. llvm-svn: 206129
* Reverting r199886 (Prevent repetitive warnings for unrecognized processors ↵Artyom Skrobov2014-01-251-34/+20
| | | | | | and features) llvm-svn: 200083
* Prevent repetitive warnings for unrecognized processors and featuresArtyom Skrobov2014-01-231-20/+34
| | | | llvm-svn: 199886
* MC: Don't assume incoming StringRef's are null terminated.Will Dietz2013-10-131-4/+1
| | | | | | | | | | This can happen when processing command line arguments, which are often stored as std::string's and later turned into StringRef's via std::string::data(). Unfortunately this is not guaranteed to return a null-terminated string until C++11, causing breakage on platforms that don't do this. llvm-svn: 192558
* Fix the documentation of getDefaultSubtargetFeatures.Rafael Espindola2013-10-071-2/+1
| | | | | | Patch by David Nadlinger. llvm-svn: 192098
* Symbol hygiene: Make sure declarations and definitions match, make helper ↵Benjamin Kramer2012-10-201-2/+2
| | | | | | functions static. llvm-svn: 166376
* Remove template from function that is only used with one type after r165092.Craig Topper2012-10-041-4/+5
| | | | llvm-svn: 165203
OpenPOWER on IntegriCloud