1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-23 04:52:54 +02:00
Commit Graph

93 Commits

Author SHA1 Message Date
Duncan Sands
6284b3db58 GCC extensions are no longer used here - update the comment.
llvm-svn: 115463
2010-10-03 15:31:50 +00:00
Duncan Sands
39e0233734 Remove two uses of the gcc specific 'aligned' attribute. This
is partly because this attribute caused trouble in the past (the
SmallVector one had to be changed from aligned to aligned(8) due
to causing crashes on i386 for example; in theory the same might
be needed in the Allocator case...).  But it's mostly because
there seems to be no point in special casing gcc here.  Using the
same implementation for all compilers results in better testing.

llvm-svn: 115462
2010-10-03 15:15:19 +00:00
John McCall
b91df6e799 After some discussion with djg, teach SmallVector to grow from a zero
capacity and remove the workaround in SmallVector<T,0>.  There are some
theoretical benefits to a N->2N+1 growth policy anyway.

llvm-svn: 112870
2010-09-02 21:55:03 +00:00
John McCall
33faad67cc SmallVector's growth policies don't like starting from zero capacity.
I think there are good reasons to change this, but in the interests
of short-term stability, make SmallVector<...,0> reserve non-zero
capacity in its constructors.  This means that SmallVector<...,0>
uses more memory than SmallVector<...,1> and should really only be
used (unless/until this workaround is removed) by clients that
care about using SmallVector with an incomplete type.

llvm-svn: 112147
2010-08-26 02:11:48 +00:00
John McCall
0c3659857d Provide an explicit specialization of SmallVector at N=0 which does
not require its type argument to be complete if no members are
actually used.

llvm-svn: 112106
2010-08-25 23:11:24 +00:00
Chris Lattner
7420a283cf disable SmallVectorImpl's copy constructor. This prevents a class
of base class slicing bugs reported on irc

llvm-svn: 106028
2010-06-15 18:59:43 +00:00
Duncan Sands
78593d094f Add includes to get ptrdiff_t. This is needed by gcc-4.6 which has
done some more header trimming, resulting in cstdef being included
by less header files.

llvm-svn: 105786
2010-06-10 10:13:58 +00:00
Benjamin Kramer
d62b29412b Use realloc instead of malloc+memcpy when growing a POD SmallVector. A smart
realloc implementation can try to expand the allocated memory block in-place,
avoiding the copy.

llvm-svn: 105605
2010-06-08 11:44:30 +00:00
Jim Grosbach
90ca622864 remove trailing whitespace
llvm-svn: 105333
2010-06-02 17:45:54 +00:00
Torok Edwin
9ddbae859f Fix PR6910.
Limit alignment in SmallVector 8, otherwise GCC assumes 16 byte alignment.
opetaror new, and malloc only return 8-byte aligned memory on 32-bit Linux,
which cause a crash if code is compiled with -O3 (or -ftree-vectorize) and some
SmallVector code is vectorized.

llvm-svn: 102604
2010-04-29 06:43:12 +00:00
Dan Gohman
8d37faa2f7 Fix SmallVector's insert to handle non-random-access iterators.
llvm-svn: 99633
2010-03-26 18:53:37 +00:00
Benjamin Kramer
d6a976f1da Fix a name clash that was breaking MSVC builds.
llvm-svn: 98852
2010-03-18 19:34:06 +00:00
Dan Gohman
24dc8de2a9 Fix a bug found by inspection; in the __GNUC__ code, the alignment
doesn't apply to the type, only to the variable, so subsequent uses
of U which expect it to be aligned weren't actually aligned.

llvm-svn: 98843
2010-03-18 18:40:47 +00:00
Chris Lattner
2e0b4ea606 tabs -> spaces.
llvm-svn: 91622
2009-12-17 21:23:46 +00:00
Steve Naroff
cbffdd23ee Fix Windows build breakage...
llvm-svn: 91617
2009-12-17 20:39:34 +00:00
Eric Christopher
9219efa49e Fix unused variable warning.
llvm-svn: 91609
2009-12-17 19:07:19 +00:00
Daniel Dunbar
9d1eac0cdd Fix one more missing this-> to placate that picky clang++.
llvm-svn: 91536
2009-12-16 11:38:03 +00:00
Chris Lattner
4b21831c59 fix more missing this->'s to placate clang++
llvm-svn: 91531
2009-12-16 09:17:12 +00:00
Chris Lattner
ccad2e6bd4 Fix a missing this-> that clang++ notices.
llvm-svn: 91530
2009-12-16 09:09:54 +00:00
Chris Lattner
eee37b7ba5 now that libsystem no longer uses SmallVector, we can move
SmallVectorBase::grow_pod out of line, finally satisfying PR3758.

llvm-svn: 91529
2009-12-16 08:44:24 +00:00
Chris Lattner
7ea3176b0c factor out the grow() method for all pod implementations into one
common function.  It is still an inline method, which will be fixed next.

llvm-svn: 91526
2009-12-16 08:34:40 +00:00
Chris Lattner
bc295111a1 pull destroy_range and uninitialized_copy up to the
SmallVectorTemplateBase class, which allows us to statically
dispatch on isPodLike instead of dynamically.

llvm-svn: 91523
2009-12-16 08:09:23 +00:00
Chris Lattner
c9b5e915c2 sink most of the meat in smallvector back from SmallVectorTemplateCommon
down into SmallVectorImpl.  This requires sprinking a ton of this->'s in,
but gives us a place to factor.

llvm-svn: 91522
2009-12-16 08:05:48 +00:00
Chris Lattner
19ee3f5216 substantial refactoring of SmallVector, now most code is in SmallVectorTemplateCommon,
and there is a new SmallVectorTemplateBase class in between it and SmallVectorImpl.
SmallVectorTemplateBase can be specialized based on isPodLike.

llvm-svn: 91518
2009-12-16 06:55:45 +00:00
Chris Lattner
b3db396df3 a few improvements:
1. Use std::equal instead of reinventing it.
2. don't run dtors in destroy_range if element is pod-like.
3. Use isPodLike to decide between memcpy/uninitialized_copy 
   instead of is_class.  isPodLike is more generous in some cases.

llvm-svn: 91427
2009-12-15 08:34:01 +00:00
Chris Lattner
f4e5966cf1 hoist the begin/end/capacity members and a few trivial methods
up into the non-templated SmallVectorBase class.

llvm-svn: 91426
2009-12-15 08:29:22 +00:00
Chris Lattner
f1a0d32b5f improve isPodLike to know that all non-class types are pod.
llvm-svn: 91425
2009-12-15 07:40:44 +00:00
Gabor Greif
cc8681cea3 Clean up the minor mess I caused with removing iterator.h. I shall take care of 80-col violations and the FIXME later. (Thanks goodness that I live in another continent, so the monkeypox did not strike me :-)
llvm-svn: 80224
2009-08-27 06:41:46 +00:00
Daniel Dunbar
6812c0db35 Add SmallVector::{capacity,set_size}.
- These allow clients to make use of the extra elements in the vector which
   have already been allocated, without requiring them to be value initialized.

llvm-svn: 79433
2009-08-19 17:48:28 +00:00
Jay Foad
c934b656f9 Tighten up the asserts in SmallVector::operator[]().
If this causes any new assertion failures that I didn't catch in
testing, the fix is usually to change "&v[0]" to "v.data()" for some
SmallVector v.

llvm-svn: 72221
2009-05-21 19:48:58 +00:00
Jay Foad
2ca356aa76 Implement new SmallVector::data() methods.
llvm-svn: 72209
2009-05-21 09:00:37 +00:00
Owen Anderson
dd6babaa30 Fix for PR3946, in which SmallVector could behave strangely in corner cases.
Patch by Peter Johnson.

llvm-svn: 69785
2009-04-22 07:16:54 +00:00
Chris Lattner
09cab2de98 fix overflow checks in SmallVector:
"The code was doing "if (End+NumInputs > Capacity) ...". If End is
close to 0xFFFFFFFF and NumInputs is large, it'll overflow, the
condition will come out false, and the vector won't grow to
accommodate the new elements, and the program will crash in memmove."

Patch by Jeffrey Yasskin!

llvm-svn: 68277
2009-04-02 03:06:26 +00:00
Chris Lattner
9c7b21d369 Fix PR3860 by correcting a predicate.
llvm-svn: 67473
2009-03-22 19:22:53 +00:00
Misha Brukman
380e3db1b4 Fixed lint errors:
* Alphabetized #includes
* Removed trailing whitespace
* Wrapped or shortened lines over 80 chars

llvm-svn: 65181
2009-02-20 22:20:18 +00:00
Dan Gohman
30770ee7b3 Add explicit keywords.
llvm-svn: 64915
2009-02-18 16:37:45 +00:00
Misha Brukman
da77da48f3 Removed trailing whitespace.
llvm-svn: 62000
2009-01-09 19:25:42 +00:00
Cedric Venet
b260c282bc Add explicit this-> for some member function in templated base class.
These call are probably dependent but VS with /Za don't seems to think so. We need to help him.

llvm-svn: 60978
2008-12-13 10:55:13 +00:00
Chris Lattner
5a1d7ab054 add a new pop_back_val method which returns the value popped. This is
heretical from a STL standpoint, but is oh-so-useful for things that 
can't throw exceptions when copied, like, well, everything in LLVM.

llvm-svn: 60587
2008-12-05 07:11:05 +00:00
Dan Gohman
440dea174f Implement a SmallVector insert method that can insert multiple
copies of a value, and add several additional utilities to make
SmallVector better conform to the Container concept.

llvm-svn: 57616
2008-10-16 00:15:24 +00:00
Rafael Espindola
efe64e5f1e Add bound checks in SmallVector
llvm-svn: 56432
2008-09-22 10:06:26 +00:00
Dan Gohman
3b4af81381 Fix SmallVector's size calculation so that a size of 0 is
handled correctly, and change a few SmallVector uses to use
size 0 to more clearly reflect their intent.

llvm-svn: 55181
2008-08-22 16:07:55 +00:00
Owen Anderson
b307df554d Add a value_type typedef to SmallVector, to make it more compatible with STL adapters.
llvm-svn: 54819
2008-08-15 18:45:51 +00:00
Dan Gohman
3755664b6d Remove unnecessary static_casts.
llvm-svn: 53181
2008-07-07 18:08:20 +00:00
Seo Sanghyeon
0b4c1205fb Compilation fix
llvm-svn: 52950
2008-07-01 05:27:28 +00:00
Dan Gohman
081848d881 Make SmallVector's grow use memcpy in common cases
instead of std::uninitialized_copy, which uses memmove.

llvm-svn: 52928
2008-06-30 21:45:13 +00:00
Dan Gohman
06ca992a01 Use plain operator new instead of new char[].
llvm-svn: 52927
2008-06-30 21:33:02 +00:00
Dan Gohman
b67e96f3aa Add an operator< for SmallVector.
llvm-svn: 51791
2008-05-30 22:37:47 +00:00
Anton Korobeynikov
f77142326f For PR1338: rename include/llvm/ADT/ilist and friends to end with ".h"
llvm-svn: 51687
2008-05-29 17:41:17 +00:00
Bill Wendling
1866fa680f Remove warnings about unused parameters and shadowed variables.
llvm-svn: 51266
2008-05-19 20:15:12 +00:00