Commit Graph

306 Commits

Author SHA1 Message Date
Eugene Zelenko
1d475d81f9 [BinaryFormat, Option, TableGen] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305537 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-16 00:43:26 +00:00
Chandler Carruth
e3e43d9d57 Sort the remaining #include lines in include/... and lib/....
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).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304787 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-06 11:49:48 +00:00
Craig Topper
4b8d5408e9 [TableGen] Remove RecordVal constructor that takes a StringRef and Record::setName(StringRef). Leave just the versions that take an Init.
They weren't used often enough to justify having two different interfaces. Push the responsiblity of creating a StringInit up to the caller.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304388 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-01 06:56:16 +00:00
Craig Topper
c469be384c [TableGen] Make Record::getValueAsString and getValueAsListOfStrings return 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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304325 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-31 19:01:11 +00:00
Craig Topper
fa336f863c [TableGen] Make one of RecordVal's constructors delegate to the other to reduce duplicate code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304280 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-31 05:12:33 +00:00
Craig Topper
04877f744d [TableGen] Use StringMap instead of DenseMap<StringRef> to unique CodeInit and StringInit objects. Override the allocator to keep using the BumpPtrAllocator. NFCI
StringMap is better suited to mapping strings than a DenseMap.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304178 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-29 21:49:37 +00:00
Craig Topper
70ac7747fa [TableGen] Introduce DagInit::getArgs that returns an ArrayRef. Use it to fix 80 column violations in arg_begin/arg_end. Remove DagInit::args and use getArgs instead. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304177 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-29 21:49:34 +00:00
Craig Topper
67886788e2 [TableGen] Prevent DagInit from leaking its Args and ArgNames when they exceed the size of the SmallVector.
DagInits are allocated in a BumpPtrAllocator so they are never destructed. This means the destructor for the SmallVector never runs.

To fix this we now allocate the vectors in the BumpPtrAllocator too using TrailingObjects.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304077 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-27 17:36:50 +00:00
Craig Topper
f6f10854e2 [TableGen] Remove all the static vectors named TheActualPool.
These used to hold std::unique_ptrs that managed the allocation for the various *Init object so that they would be deleted on exit. Everything is allocated in a BumpPtrAllocator name so there is no reason for these to still exist.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304066 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-27 06:14:12 +00:00
Matthias Braun
d6da5dbf7b Use print() instead of dump() in code
The dump() functions are meant to be used in a debugger, code should
typically use something like print(errs());

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293365 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-28 02:47:46 +00:00
Matthias Braun
88d207542b Cleanup dump() functions.
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293359 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-28 02:02:38 +00:00
Eugene Zelenko
8fa7bb4231 [Hexagon, TableGen] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290925 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-04 02:02:05 +00:00
Davide Italiano
fb77f46543 [TableGen] Centralize/Unify error handling.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288724 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-05 22:58:01 +00:00
Matthias Braun
2b86a875bf TableGen: Some more std::string->StringInit* replacements
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288653 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-05 07:35:13 +00:00
Matthias Braun
f3a991b8e3 TableGen: TableGenStringKey is no longer necessary as of r288642
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288651 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-05 07:04:19 +00:00
Matthias Braun
c2e7826e2b TableGen: Use range based for; reserve vectors where possible
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288650 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-05 07:00:44 +00:00
Matthias Braun
a3f0e48f72 TableGen/TGParser: Prefer SmallVector/ArrayRef over std::vector
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288649 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-05 06:41:54 +00:00
Matthias Braun
5a87cb27d9 TableGen/Record: Replace std::vector with SmallVector/ArrayRef
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288648 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-05 06:41:51 +00:00
Matthias Braun
2ba1a51cf5 ListInit::convertInitializerTo: avoid foldingset lookup if nothing changed
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288647 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-05 06:41:47 +00:00
Matthias Braun
ddbd6db517 TableGen: Use StringInit instead of std::string for DagInit arg names
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288644 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-05 06:00:46 +00:00
Matthias Braun
205e9501a0 TableGen: Use StringInit instead of std::string for DagInit name
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288643 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-05 06:00:41 +00:00
Matthias Braun
1ecbef9056 TableGen: Use more StringInit instead of StringRef
This forces the code to call StringInit::get on the string early and
avoids storing duplicates in std::string and sometimes allows pointer
comparisons instead of string comparisons.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288642 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-05 06:00:36 +00:00
Matthias Braun
c7fb36d42d TableGen: Factor out STRCONCAT constructor, add shortcut.
Introduce new constructor for STRCONCAT binop with a shortcut that
immediately concatenates if the two arguments are StringInits.
Makes the QualifyName code more readable and tablegen 2-3% faster.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288639 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-05 05:21:18 +00:00
Matthias Braun
ccd8fece37 TableGen/Record: Move PointerIntPair to less used field of RecordVal
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288638 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-05 05:21:13 +00:00
Matthias Braun
013ca3cf77 TableGen: Store Records on a BumpPtrAllocator
All these records are internalized and will live until exit.  This makes
them perfect candidates for a fast BumpPtrAllocator.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288613 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-04 05:48:20 +00:00
Matthias Braun
0c517c8dff TableGen: Use StringRef instead of const std::string& in return vals.
This will allow to switch to a different string storage in an upcoming
commit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288612 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-04 05:48:16 +00:00
Matthias Braun
607c68326d TableGen: Optimize common string concatenation with SmallString
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288611 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-04 05:48:06 +00:00
Matthias Braun
5084450e17 TableGen: Use StringRef instead of const std::string& for parameters
This avoid an extra construction of a std::string (and a heap
allocation) when the caller only has a StringRef but no std::string at
hand.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288610 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-04 05:48:03 +00:00
Matt Arsenault
ee23318db7 TableGen: Add operator !or
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286936 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-15 06:49:28 +00:00
Eugene Zelenko
9feaa97ada Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes.
Differential revision: https://reviews.llvm.org/D23789


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279535 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-23 17:14:32 +00:00
Justin Bogner
7d7a23e700 Replace a few more "fall through" comments with LLVM_FALLTHROUGH
Follow up to r278902. I had missed "fall through", with a space.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278970 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-17 20:30:52 +00:00
Justin Bogner
833a10e76a Fix a use of LLVM_FALLTHROUGH that wasn't even in a switch.
I was over-aggressive in my conversions from comments to the
fallthrough attribute.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278903 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-17 05:25:38 +00:00
Justin Bogner
6673ea81f6 Replace "fallthrough" comments with LLVM_FALLTHROUGH
This is a mechanical change of comments in switches like fallthrough,
fall-through, or fall-thru to use the LLVM_FALLTHROUGH macro instead.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278902 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-17 05:10:15 +00:00
Ahmed Bougacha
27cc0cc039 [TableGen] Autobrief-ize Record. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275425 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-14 14:53:14 +00:00
Ahmed Bougacha
cf03606efc [TableGen] Cleanup Record comments. NFC.
LLVM doesn't use exceptions anymore.
Also remove the implementation comments. Some of them diverged.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275424 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-14 14:53:11 +00:00
Tim Northover
edff0683c8 TableGen: promote "code" type from syntactic sugar.
It's being immediately converted to a "string", but being able to tell what
type the field was originally can be useful in backends.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@274575 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-05 21:22:55 +00:00
Benjamin Kramer
04a303b821 Avoid copies of std::strings and APInt/APFloats where we only read from it
As suggested by clang-tidy's performance-unnecessary-copy-initialization.
This can easily hit lifetime issues, so I audited every change and ran the
tests under asan, which came back clean.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272126 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-08 10:01:20 +00:00
Mehdi Amini
f6071e14c5 [NFC] Header cleanup
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>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@266595 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-18 09:17:29 +00:00
Richard Smith
43ef70d524 Update and fix LLVM_ENABLE_MODULES:
1) We need to add this flag prior to adding any other, in case the user has
specified a -fmodule-cache-path= flag in their custom CXXFLAGS. Such a flag
causes -Werror builds to fail, and thus all config checks fail, until we add
the corresponding -fmodules flag. The modules selfhost bot does this, for
instance.

2) Delete module maps that were putting .cpp files into modules.

3) Enable -fmodules-local-submodule-visibility, to get proper module
visibility rules applied across submodules of the same module. Disable
-fmodules for C builds, since that flag is not available there.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@266502 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-16 00:48:58 +00:00
Craig Topper
62bd2798ad [TableGen] Fix typos in comments. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261984 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-26 06:50:27 +00:00
Yaron Keren
55307987a1 Annotate dump() methods with LLVM_DUMP_METHOD, addressing Richard Smith r259192 post commit comment.
clang part in r259232, this is the LLVM part of the patch.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259240 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-29 20:50:44 +00:00
Chris Bieneman
caeade4234 Remove autoconf support
Summary:
This patch is provided in preparation for removing autoconf on 1/26. The proposal to remove autoconf on 1/26 was discussed on the llvm-dev thread here: http://lists.llvm.org/pipermail/llvm-dev/2016-January/093875.html

"I felt a great disturbance in the [build system], as if millions of [makefiles] suddenly cried out in terror and were suddenly silenced. I fear something [amazing] has happened."
- Obi Wan Kenobi

Reviewers: chandlerc, grosbach, bob.wilson, tstellarAMD, echristo, whitequark

Subscribers: chfast, simoncook, emaste, jholewinski, tberghammer, jfb, danalbert, srhines, arsenm, dschuff, jyknight, dsanders, joker.eph, llvm-commits

Differential Revision: http://reviews.llvm.org/D16471

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258861 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-26 21:29:08 +00:00
Craig Topper
dd6092dc5c [TableGen] Use FoldingSets instead of DenseMaps to unique UnOpInit, BinOpInit and TernOpInit. This remove the memory needed to store the key for the DenseMap. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258071 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-18 20:36:06 +00:00
Craig Topper
b51e7cd7a3 [TableGen] Fix an assert I missed in r258063.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258068 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-18 19:59:05 +00:00
Craig Topper
401ee722ee [TableGen] Merge the SuperClass Record and SMRange vector into a single vector. This removes the state needed to manage the extra vector thus reducing the size of the Record class. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258065 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-18 19:52:37 +00:00
Craig Topper
11c70fa131 [TableGen] Allocate the Init pointer array for BitsInit/ListInit after the BitsInit/ListInit object itself. Saves a bit of memory. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258063 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-18 19:52:24 +00:00
Craig Topper
d8f59233d2 [TableGen] Use some free space in Init to store the opcode for UnOpInit/BinOpInit/TernOpInit allowing those types to be a little smaller. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256733 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-04 06:28:49 +00:00
Craig Topper
2507b00594 [TableGen] Change TGParser::SetValue to take an ArrayRef instead of std::vector reference. Use None in many places where a default constructed vector was being passed. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256726 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-04 03:15:08 +00:00
Craig Topper
ae62636ef8 [TableGen] Fix a bug that caused the wrong name for a record built from a multiclass containing a defm called NAME that references another multiclass that contains a defm that uses NAME concatenated with other strings.
It would end up doing the concatenations from the second multiclass twice. This occured because SetValue detected a self assignment when trying to set the value of NAME to a VarInit called NAME. NAME is special here and it will get cleaned up later. So add a flag to suppress the self assignment check for this case.

Strangely the self-assignment error was returning false indicating it wasn't an error, but it wasn't doing the right thing. So this also changes it to report an error.

This fixes the names of some AVX512 FMA instructions that showed this double expansion.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256725 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-04 03:05:14 +00:00
Benjamin Kramer
55cb91eee9 [TblGen] ArrayRefize TGParser. No functional change intended.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251186 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-24 12:46:45 +00:00