Craig Topper
a60ee86f60
[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
Craig Topper
f4b449cec2
[TableGen] Change OpInit::getNumOperands and getOperand to use unsigned integers. NFC
...
llvm-svn: 239210
2015-06-06 01:34:04 +00:00
Craig Topper
1af1566ce6
[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
5a2dfdcd20
[TableGen] Remove unnecessary temporary. NFC
...
llvm-svn: 239208
2015-06-06 01:34:00 +00:00
Craig Topper
5904beb666
[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
daf263de84
[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
25a849ca02
[TableGen] Fold variable declarations with their assignments. NFC
...
llvm-svn: 239205
2015-06-06 00:44:45 +00:00
Craig Topper
5ec17246a2
[TableGen] Use range-based for loops. NFC
...
llvm-svn: 239022
2015-06-04 07:40:14 +00:00
Craig Topper
b849203c94
[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
664f6a0405
[TableGen] Rename ListInit::getSize to just 'size' to be more consistent.
...
llvm-svn: 238806
2015-06-02 04:15:57 +00:00
Craig Topper
ef0578a8cb
[TableGen] Use range-based for loops. NFC.
...
llvm-svn: 238805
2015-06-02 04:15:51 +00:00
Craig Topper
6548196c6f
[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
15864f1518
[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
9581906983
[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
Craig Topper
2af5e6fbf9
[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
Craig Topper
85693aeb43
[TableGen] Use DefInit::getAsString instead of getDef()->getName(). NFC
...
llvm-svn: 238399
2015-05-28 06:38:32 +00:00
Craig Topper
2a8d4b294c
[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
259d0c1605
[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
a74f986aa3
[TableGen] Fix a memory leak.
...
llvm-svn: 237774
2015-05-20 05:40:09 +00:00
Craig Topper
41ce4de0b4
[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
8ddb0d825d
[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
6ee494b677
[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
1a9ca774b6
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
b1846a352e
[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
42467f25e4
[TableGen] Simplify some code. NFC
...
llvm-svn: 237342
2015-05-14 05:53:59 +00:00
Craig Topper
ec9072d661
[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
607ac92dcb
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
a0ff540b7e
Remove unnecessary variables by folding calls into for loop header. NFC.
...
llvm-svn: 237090
2015-05-12 05:25:10 +00:00
Craig Topper
23fdafe682
[TableGen] Replace 'static_cast' with 'cast'.
...
llvm-svn: 236398
2015-05-04 01:35:42 +00:00
Craig Topper
a9642b4ec8
[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
85c07007ea
[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
9ed595e41d
[TableGen] Used range-based for loop. NFC.
...
llvm-svn: 236205
2015-04-30 05:54:20 +00:00
Craig Topper
9ef76499b2
[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
...
llvm-svn: 236204
2015-04-30 05:12:52 +00:00
Craig Topper
119998dbf1
[TableGen] Use range-based for loops. NFC.
...
llvm-svn: 236089
2015-04-29 07:13:14 +00:00
Craig Topper
39ba33b8f0
[TableGen] Fold a couple dyn_casts into the ifs that check their results. NFC
...
llvm-svn: 236088
2015-04-29 07:13:12 +00:00
Craig Topper
ed5a950808
[TableGen] Replace some dyn_casts followed by an assert with just a regular cast which asserts internally. NFC
...
llvm-svn: 236087
2015-04-29 07:13:05 +00:00
Craig Topper
17b3a378c5
[TableGen] Fix all remaining memory leaks of Init and RecTy objects.
...
llvm-svn: 235696
2015-04-24 05:38:48 +00:00
Craig Topper
1f429e4926
[TableGen] Use range based for loops.
...
llvm-svn: 235482
2015-04-22 05:27:47 +00:00
Craig Topper
d05991304b
[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.
...
llvm-svn: 235481
2015-04-22 05:27:11 +00:00
Craig Topper
fe0cdf9899
[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.
llvm-svn: 235477
2015-04-22 04:18:32 +00:00
Craig Topper
e8005f90f5
Don't use 'nullptr' in comment. Just use 'null'.
...
llvm-svn: 235476
2015-04-22 04:18:27 +00:00
Craig Topper
b534eabf9e
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.
llvm-svn: 235469
2015-04-22 02:59:06 +00:00
Craig Topper
c7a9cfb7f6
Fix stale comment that mentioned 0 instead of nullptr. NFC.
...
llvm-svn: 235468
2015-04-22 02:59:03 +00:00
Craig Topper
0e04bee8df
[TableGen] Remove Pool helper class and just use unique_ptr in the maps.
...
llvm-svn: 235467
2015-04-22 02:20:44 +00:00
Craig Topper
b15012bc6b
[TableGen] Use StringRecTy::get() instead of allocating (and leaking) a StringRecTy object.
...
llvm-svn: 235466
2015-04-22 02:09:47 +00:00
Craig Topper
1bf3d1f5dd
[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.
...
llvm-svn: 235465
2015-04-22 02:09:45 +00:00
Craig Topper
f8344c60a6
[TableGen] Use cast instead of dyn_cast where result isn't checked before being dereferenced.
...
llvm-svn: 235463
2015-04-22 02:09:42 +00:00
Benjamin Kramer
619c4e57ba
Reduce dyn_cast<> to isa<> or cast<> where possible.
...
No functional change intended.
llvm-svn: 234586
2015-04-10 11:24:51 +00:00
Alexander Kornienko
8c0809c7f8
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!
llvm-svn: 226161
2015-01-15 11:41:30 +00:00
Michael Ilseman
5be22a12c2
Clean up static analyzer warnings.
...
Clang's static analyzer found several potential cases of undefined
behavior, use of un-initialized values, and potentially null pointer
dereferences in tablegen, Support, MC, and ADT. This cleans them up
with specific assertions on the assumptions of the code.
llvm-svn: 224154
2014-12-12 21:48:03 +00:00