Commit Graph

101 Commits

Author SHA1 Message Date
Craig Topper
fade2f72b8 [TableGen] Change a couple methods to return an ArrayRef instead of a const std::vector reference. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@241430 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-06 06:23:01 +00:00
Craig Topper
1405564987 [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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240524 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-24 06:19:19 +00:00
Craig Topper
d032911655 [TableGen] Change OpInit::getNumOperands and getOperand to use unsigned integers. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239210 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-06 01:34:04 +00:00
Craig Topper
32d99f93e4 [TableGen] Remove trailing whitespace, add space between 'if' and paren, other formatting fixes. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239209 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-06 01:34:01 +00:00
Craig Topper
8e29f136cf [TableGen] Remove unnecessary temporary. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239208 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-06 01:34:00 +00:00
Craig Topper
33d0763bd1 [TableGen] Fold variable declaration/initialization into if condition for a couple short lived variables. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239207 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-06 01:33:58 +00:00
Craig Topper
c052f54559 [TableGen] Remove unnecessary outer 'if' and merge it's conditions into the inner 'if's. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239206 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-06 01:33:55 +00:00
Craig Topper
77411bdfe3 [TableGen] Fold variable declarations with their assignments. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239205 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-06 00:44:45 +00:00
Craig Topper
44bc71549e [TableGen] Use range-based for loops. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239022 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-04 07:40:14 +00:00
Craig Topper
40c791eda9 [TableGen] Merge single prefix bit in RecordVal into PointerIntPair with Name to reduce memory usage.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239021 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-04 07:40:12 +00:00
Craig Topper
61f49542d7 [TableGen] Rename ListInit::getSize to just 'size' to be more consistent.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238806 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-02 04:15:57 +00:00
Craig Topper
a1bedd75a0 [TableGen] Use range-based for loops. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238805 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-02 04:15:51 +00:00
Craig Topper
dd2a26fccb [TableGen] Move a couple virtual methods out of line so vtable anchors can be removed. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238727 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-01 06:44:18 +00:00
Craig Topper
be43b88fae [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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238648 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-30 07:36:01 +00:00
Craig Topper
17246b12cf [TableGen] Remove all the variations of RecTy::convertValue and just handle the conversions in convertInitializerTo directly. This saves a bunch of vtable entries. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238646 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-30 07:34:51 +00:00
Craig Topper
60bc0ab340 [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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238543 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-29 05:51:32 +00:00
Craig Topper
aac3ba8fad [TableGen] Use DefInit::getAsString instead of getDef()->getName(). NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238399 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 06:38:32 +00:00
Craig Topper
38e3e6a195 [TableGen] Don't convert types to strings to query what they are. Just use 'isa'
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238398 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-28 06:38:28 +00:00
Craig Topper
43ec501d2c [TableGen] Make some variable names consistent with their type names and just generally consistent across all of the overloads.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237775 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-20 05:40:13 +00:00
Craig Topper
ee25444b06 [TableGen] Fix a memory leak.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237774 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-20 05:40:09 +00:00
Craig Topper
d43901cbb1 [TableGen] Change 'car' to 'head' and 'cdr' to 'tail' in assert comments. These were the old names for these operations long ago. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237514 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-16 05:42:13 +00:00
Craig Topper
5dddb1909c [TableGen] Remove !! that I can't really explain why I wrote. Also remove some unnecessary curly braces from the same area.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237513 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-16 05:42:11 +00:00
Craig Topper
a4b093e2d3 [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
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237511 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-16 05:42:03 +00:00
Justin Bogner
f8ca978417 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237345 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-14 06:47:02 +00:00
Craig Topper
bed1965111 [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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237343 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-14 05:54:02 +00:00
Craig Topper
8a049abf2f [TableGen] Simplify some code. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237342 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-14 05:53:59 +00:00
Craig Topper
bbf57b36bb [TableGen] Replace some calls to ListInit::getSize() with ListInit::empty() if it was just comparing to 0. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237340 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-14 05:53:53 +00:00
Craig Topper
448c555c54 Use ArrayRef::slice instead of manually constructing an ArrayRef from ArrayRef iterators. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237231 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-13 06:57:51 +00:00
Craig Topper
ee686477ac Remove unnecessary variables by folding calls into for loop header. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237090 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-12 05:25:10 +00:00
Craig Topper
82b7c1b25b [TableGen] Replace 'static_cast' with 'cast'.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236398 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-04 01:35:42 +00:00
Craig Topper
dc0b6f2171 [TableGen] Formatting cleanup. Mostly removing trailing whitespace and unnecessary curly braces. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236397 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-04 01:35:39 +00:00
Craig Topper
21092d8a7c [TableGen] Cleanup formatting by moving operators from beginning of line to end of previous line. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236206 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-30 05:54:22 +00:00
Craig Topper
54bff8596f [TableGen] Used range-based for loop. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236205 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-30 05:54:20 +00:00
Craig Topper
4fc782c025 [TableGen] Merge a variable assignment and a return to drop curly braces. Fold an assignment into an if. Use auto on the result of a couple dyn_casts. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236204 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-30 05:12:52 +00:00
Craig Topper
40048e70d7 [TableGen] Use range-based for loops. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236089 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-29 07:13:14 +00:00
Craig Topper
ac9abe5e99 [TableGen] Fold a couple dyn_casts into the ifs that check their results. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236088 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-29 07:13:12 +00:00
Craig Topper
134e2e75b3 [TableGen] Replace some dyn_casts followed by an assert with just a regular cast which asserts internally. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236087 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-29 07:13:05 +00:00
Craig Topper
7cc4f07bdc [TableGen] Fix all remaining memory leaks of Init and RecTy objects.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235696 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-24 05:38:48 +00:00
Craig Topper
3aaf26d335 [TableGen] Use range based for loops.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235482 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-22 05:27:47 +00:00
Craig Topper
bdd6973671 [TableGen] Remove some deletes that violate ownership semantics. These don't seem to execute in our codebase today and date back to a time when there was an allocation in this function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235481 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-22 05:27:11 +00:00
Craig Topper
459448abcc [TableGen] Make BitRecTy::baseClassOf return true when RHS is an IntRecTy.
Previously the code was accidentally checking if 'this' was an IntRecTy which it can't be since 'this' is a BitRecTy. Looking back at the history it appears it was intended to check RHS.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235477 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-22 04:18:32 +00:00
Craig Topper
aee08e5bac Don't use 'nullptr' in comment. Just use 'null'.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235476 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-22 04:18:27 +00:00
Craig Topper
0b67fe7293 Revert "[TableGen] Use cast instead of dyn_cast where result isn't checked before being dereferenced."
Turns out I misread the parentheses. Though I'm pretty sure its always a RecordRecTy and non of the callers really seem to expect null. But until I'm completely sure I'm going to revert this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235469 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-22 02:59:06 +00:00
Craig Topper
fe6b36788e Fix stale comment that mentioned 0 instead of nullptr. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235468 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-22 02:59:03 +00:00
Craig Topper
458ad3e2cb [TableGen] Remove Pool helper class and just use unique_ptr in the maps.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235467 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-22 02:20:44 +00:00
Craig Topper
5def98eaee [TableGen] Use StringRecTy::get() instead of allocating (and leaking) a StringRecTy object.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235466 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-22 02:09:47 +00:00
Craig Topper
f8012eb826 [TableGen] Use 'isa' to identify UnsetInits rather than comparing with the singleton object created by UnsetInit::get(). Makes it more consistent with the other types.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235465 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-22 02:09:45 +00:00
Craig Topper
87b4c04980 [TableGen] Use cast instead of dyn_cast where result isn't checked before being dereferenced.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235463 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-22 02:09:42 +00:00
Benjamin Kramer
0973b7ddb8 Reduce dyn_cast<> to isa<> or cast<> where possible.
No functional change intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234586 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-10 11:24:51 +00:00
Alexander Kornienko
b4c6267f7c Replace size method call of containers to empty method where appropriate
This patch was generated by a clang tidy checker that is being open sourced.
The documentation of that checker is the following:

/// The emptiness of a container should be checked using the empty method
/// instead of the size method. It is not guaranteed that size is a
/// constant-time function, and it is generally more efficient and also shows
/// clearer intent to use empty. Furthermore some containers may implement the
/// empty method but not implement the size method. Using empty whenever
/// possible makes it easier to switch to another container in the future.

Patch by Gábor Horváth!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226161 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-15 11:41:30 +00:00