1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 12:02:58 +02:00
Commit Graph

257 Commits

Author SHA1 Message Date
Benjamin Kramer
69d7d618d7 [TblGen] ArrayRefize TGParser. No functional change intended.
llvm-svn: 251186
2015-10-24 12:46:45 +00:00
Matt Arsenault
bd927a4ea1 TableGen: Support folding casts from bits to int
This is to fix an incorrect error when trying to initialize
DwarfNumbers with a !cast<int> of a bits initializer.
getValuesAsListOfInts("DwarfNumbers") would not see an IntInit
and instead the cast, so would give up.

It seems likely that this could be generalized to attempt
the convertInitializerTo for any type. I'm not really sure
why the existing code seems to special case the string cast cases
when convertInitializerTo seems like it should generally handle this
sort of thing.

llvm-svn: 243722
2015-07-31 01:12:06 +00:00
Davide Italiano
a3effedb4a [TableGen] Emit the correct error message.
llvm-svn: 243284
2015-07-27 17:22:19 +00:00
Craig Topper
156446ee87 [TableGen] Change a couple methods to return an ArrayRef instead of a const std::vector reference. NFC
llvm-svn: 241430
2015-07-06 06:23:01 +00:00
Craig Topper
f5bf09aa95 [TableGen] Restore the use of the TheInit field in Record to cache the Record's DefInit. I broke this when I fixed memory leaks recently. Remove the DenseMap that mapped Record's to DefInit.
llvm-svn: 240524
2015-06-24 06:19:19 +00:00
Alexander Kornienko
f993659b8f Revert r240137 (Fixed/added namespace ending comments using clang-tidy. NFC)
Apparently, the style needs to be agreed upon first.

llvm-svn: 240390
2015-06-23 09:49:53 +00:00
Alexander Kornienko
40cb19d802 Fixed/added namespace ending comments using clang-tidy. NFC
The patch is generated using this command:

tools/clang/tools/extra/clang-tidy/tool/run-clang-tidy.py -fix \
  -checks=-*,llvm-namespace-comment -header-filter='llvm/.*|clang/.*' \
  llvm/lib/


Thanks to Eugene Kosov for the original patch!

llvm-svn: 240137
2015-06-19 15:57:42 +00:00
Craig Topper
70c292f8a1 [TableGen] Change OpInit::getNumOperands and getOperand to use unsigned integers. NFC
llvm-svn: 239210
2015-06-06 01:34:04 +00:00
Craig Topper
eac31e7750 [TableGen] Remove trailing whitespace, add space between 'if' and paren, other formatting fixes. NFC
llvm-svn: 239209
2015-06-06 01:34:01 +00:00
Craig Topper
122ea1e4ea [TableGen] Remove unnecessary temporary. NFC
llvm-svn: 239208
2015-06-06 01:34:00 +00:00
Craig Topper
a19f3db07c [TableGen] Fold variable declaration/initialization into if condition for a couple short lived variables. NFC
llvm-svn: 239207
2015-06-06 01:33:58 +00:00
Craig Topper
3ea261726d [TableGen] Remove unnecessary outer 'if' and merge it's conditions into the inner 'if's. NFC
llvm-svn: 239206
2015-06-06 01:33:55 +00:00
Craig Topper
eb053fe4cf [TableGen] Fold variable declarations with their assignments. NFC
llvm-svn: 239205
2015-06-06 00:44:45 +00:00
Craig Topper
ed67ff0612 [TableGen] Use range-based for loops. NFC
llvm-svn: 239022
2015-06-04 07:40:14 +00:00
Craig Topper
db6fb90199 [TableGen] Merge single prefix bit in RecordVal into PointerIntPair with Name to reduce memory usage.
llvm-svn: 239021
2015-06-04 07:40:12 +00:00
Craig Topper
4d00961e59 [TableGen] Use range-based for loops. NFC
llvm-svn: 238808
2015-06-02 06:19:28 +00:00
Craig Topper
e630929d8d [TableGen] Rename ListInit::getSize to just 'size' to be more consistent.
llvm-svn: 238806
2015-06-02 04:15:57 +00:00
Craig Topper
79584d4de4 [TableGen] Use range-based for loops. NFC.
llvm-svn: 238805
2015-06-02 04:15:51 +00:00
Craig Topper
36634fb48e [TableGen] Move a couple virtual methods out of line so vtable anchors can be removed. NFC
llvm-svn: 238727
2015-06-01 06:44:18 +00:00
Craig Topper
baa40e9044 [TableGen] Merge RecTy::typeIsConvertibleTo and RecTy::baseClassOf. NFC
typeIsConvertibleTo was just calling baseClassOf(this) on the argument passed to it, but there weren't different signatures for baseClassOf so passing 'this' didn't really do anything interesting. typeIsConvertibleTo could have just been a non-virtual method in RecTy. But since that would be kind of a silly method, I instead re-distributed the logic from baseClassOf into typeIsConvertibleTo.

llvm-svn: 238648
2015-05-30 07:36:01 +00:00
Craig Topper
06ba30a59e [TableGen] Remove all the variations of RecTy::convertValue and just handle the conversions in convertInitializerTo directly. This saves a bunch of vtable entries. NFC
llvm-svn: 238646
2015-05-30 07:34:51 +00:00
Benjamin Kramer
0e31955b32 Replace push_back(Constructor(foo)) with emplace_back(foo) for non-trivial types
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
2015-05-29 19:43:39 +00:00
Craig Topper
6d0adbbb1b [TableGen] Remove convertValue functions for UnOpInit, BinOpInit, and TernOpInit as they weren't able to be called.
I don't think converting the inputs to the Ops was the right behavior anyway.

llvm-svn: 238543
2015-05-29 05:51:32 +00:00
Benjamin Kramer
5a56e44e39 Don't call utostr in Twine/raw_ostream contexts.
Creating temporary std::strings there is unnecessary.

llvm-svn: 238412
2015-05-28 11:24:24 +00:00
Craig Topper
2f56a2767c [TableGen] Use DefInit::getAsString instead of getDef()->getName(). NFC
llvm-svn: 238399
2015-05-28 06:38:32 +00:00
Craig Topper
af60fb90dd [TableGen] Don't convert types to strings to query what they are. Just use 'isa'
llvm-svn: 238398
2015-05-28 06:38:28 +00:00
Craig Topper
d7a132b310 [TableGen] Fix line wrapping logic for the autogenerated header to use math that makes more sense (at least to me).
The old code had a bug if the description was between 75 and 85 characters or so as it substracted PSLen from Desc.size() instead of MAX_LINE_LEN in the compare. It also calculated odd values for PosE on the last split and just let StringRef::slice take care of it being larger than the description string.

llvm-svn: 238187
2015-05-26 08:07:56 +00:00
Craig Topper
f2dd173b6e [TableGen] Rewrite an assert to not do a bunch unsigned math and then try to ensure the result is a positive number.
I think the fact that it was explicitly excluding 0 kept this from being a tautology. The exclusion of 0 for the old math was also a bug that's easily hit if the description gets split into multiple lines.

llvm-svn: 238186
2015-05-26 08:07:49 +00:00
Craig Topper
7aac58564f [TableGen] Put a space between '*' and description in the autogenerated tablegen header. Minor cleanup in surrounding code.
llvm-svn: 238185
2015-05-26 08:07:45 +00:00
Craig Topper
ece2a0d659 [TableGen] Fix indentation. NFC
llvm-svn: 238181
2015-05-26 06:48:47 +00:00
Craig Topper
f9ae48d70b [TableGen] Include header for each cpp file first. NFC
llvm-svn: 238180
2015-05-26 06:48:46 +00:00
Craig Topper
05dc62a73c [TableGen] Remove unneeded namespace around a function. Just put llvm:: on the definition since it's already declared in a header file.
llvm-svn: 238178
2015-05-26 06:48:41 +00:00
Craig Topper
eeaddaa803 [TableGen] Use 'static' instead of an anonymous namespace.
llvm-svn: 238177
2015-05-26 06:48:38 +00:00
Hal Finkel
14d814ca9f [TableGen] Resolve complex def names inside multiclasses
We had not been trying hard enough to resolve def names inside multiclasses
that had complex concatenations, etc. Now we'll try harder.

Patch by Amaury Sechet!

llvm-svn: 237877
2015-05-21 04:32:56 +00:00
Craig Topper
2af3864479 [TableGen] Make some variable names consistent with their type names and just generally consistent across all of the overloads.
llvm-svn: 237775
2015-05-20 05:40:13 +00:00
Craig Topper
a0a4d25b20 [TableGen] Fix a memory leak.
llvm-svn: 237774
2015-05-20 05:40:09 +00:00
Craig Topper
93e883ed9f [TableGen] Change 'car' to 'head' and 'cdr' to 'tail' in assert comments. These were the old names for these operations long ago. NFC
llvm-svn: 237514
2015-05-16 05:42:13 +00:00
Craig Topper
26394d81cd [TableGen] Remove !! that I can't really explain why I wrote. Also remove some unnecessary curly braces from the same area.
llvm-svn: 237513
2015-05-16 05:42:11 +00:00
Craig Topper
f26873fcc2 [TableGen] Restructure a loop to make it exit early instead of skipping a portion of the body based on what will also be the terminating condition. NFC
llvm-svn: 237511
2015-05-16 05:42:03 +00:00
Justin Bogner
68ade96178 TableGen: Avoid undefined behaviour by doing this shift in int64
Found by ubsan. This was taking a bool and left shifting by 32 - the
result is 64 bit, so we should really do the math in a type it fits
in.

llvm-svn: 237345
2015-05-14 06:47:02 +00:00
Craig Topper
6a3db617a1 [TableGen] Remove an unnecessary outer 'if' around 3 separate inner ifs. No functional change intended.
The outer if had 3 separate conditions ORed together and then the inner ifs detected which of the three conditions it was by using only a portion of the specific condition. Just put the whole condition in each inner if and remove the outer if.

llvm-svn: 237343
2015-05-14 05:54:02 +00:00
Craig Topper
ffac146078 [TableGen] Simplify some code. NFC
llvm-svn: 237342
2015-05-14 05:53:59 +00:00
Craig Topper
c157d061a7 [TableGen] Replace some calls to ListInit::getSize() with ListInit::empty() if it was just comparing to 0. NFC.
llvm-svn: 237340
2015-05-14 05:53:53 +00:00
Craig Topper
8641edf78d Use ArrayRef::slice instead of manually constructing an ArrayRef from ArrayRef iterators. NFC
llvm-svn: 237231
2015-05-13 06:57:51 +00:00
Craig Topper
6510becd04 Remove unnecessary variables by folding calls into for loop header. NFC.
llvm-svn: 237090
2015-05-12 05:25:10 +00:00
James Y Knight
f9b908f807 Fix tablegen's PrintFatalError function to run registered file
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
2015-05-11 22:17:13 +00:00
Craig Topper
31d1aa28e6 [TableGen] Replace 'static_cast' with 'cast'.
llvm-svn: 236398
2015-05-04 01:35:42 +00:00
Craig Topper
5725a19125 [TableGen] Formatting cleanup. Mostly removing trailing whitespace and unnecessary curly braces. NFC
llvm-svn: 236397
2015-05-04 01:35:39 +00:00
Craig Topper
abe63ac9e0 [TableGen] Cleanup formatting by moving operators from beginning of line to end of previous line. NFC
llvm-svn: 236206
2015-04-30 05:54:22 +00:00
Craig Topper
b6b2d4f5da [TableGen] Used range-based for loop. NFC.
llvm-svn: 236205
2015-04-30 05:54:20 +00:00