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

23 Commits

Author SHA1 Message Date
Evgeniy Stepanov
0e1477e15b Fix BitVector move ctor/assignment.
Current implementation leaves the object in an invalid state.

This reverts commit bf0c389ac683cd6c0e5959b16537e59e5f4589e3.

llvm-svn: 272965
2016-06-16 21:45:13 +00:00
Yaron Keren
ec99ed2cc1 Simplify SmallBitVector::applyMask by consolidating common code for 32- and 64-bit builds
and assert when mask is too large to apply in the small case,
previously the extra words were silently ignored.
clang-format the entire function to match current code standards.

This is a rewrite of r247972 which was reverted in r247983 due to
warning and possible UB on 32-bits hosts.

llvm-svn: 247993
2015-09-18 15:08:24 +00:00
Aaron Ballman
def3e26caa Reverting r247972 (and subordinate commit r247972) as the 32-bit left-shift is undefined behavior on implementations where uinptr_t is 32-bits. One such platform is Windows, MSVC, x86.
llvm-svn: 247983
2015-09-18 12:18:41 +00:00
Yaron Keren
4c0fa3700e Fix BitVectorTest on 32-bit hosts after r247972.
We can't apply two words of 32-bit mask in the small case
where the internal storage is just one 32-bit word.

llvm-svn: 247974
2015-09-18 07:24:35 +00:00
Yaron Keren
c155166785 Simplify SmallBitVector::applyMask by consolidating common code for 32-bit and 64-bit builds.
Extend mask value to 64 bits before taking its complement and assert when mask is
too large to apply in the small case (previously the extra words were silently ignored).

http://reviews.llvm.org/D11890

Patch by James Touton!

llvm-svn: 247972
2015-09-18 06:35:12 +00:00
Anna Zaks
3a3a64f7fe Fix a buffer overrun detected by AddressSanitizer.
llvm-svn: 197647
2013-12-19 02:35:26 +00:00
Rafael Espindola
326babb234 Revert "[PowerPC] Improve consistency in use of __ppc__, __powerpc__, etc."
This reverts commit r187248. It broke many bots.

llvm-svn: 187254
2013-07-26 22:13:57 +00:00
Bill Schmidt
149eda1b1e [PowerPC] Improve consistency in use of __ppc__, __powerpc__, etc.
Both GCC and LLVM will implicitly define __ppc__ and __powerpc__ for
all PowerPC targets, whether 32- or 64-bit.  They will both implicitly
define __ppc64__ and __powerpc64__ for 64-bit PowerPC targets, and not
for 32-bit targets.  We cannot be sure that all other possible
compilers used to compile Clang/LLVM define both __ppc__ and
__powerpc__, for example, so it is best to check for both when relying
on either inside the Clang/LLVM code base.

This patch makes sure we always check for both variants.  In addition,
it fixes one unnecessary check in lib/Target/PowerPC/PPCJITInfo.cpp.
(At least one of __ppc__ and __powerpc__ should always be defined when
compiling for a PowerPC target, no matter which compiler is used, so
testing for them is unnecessary.)

There are some places in the compiler that check for other variants,
like __POWERPC__ and _POWER, and I have left those in place.  There is
no need to add them elsewhere.  This seems to be in Apple-specific
code, and I won't take a chance on breaking it.

There is no intended change in behavior; thus, no test cases are
added.

llvm-svn: 187248
2013-07-26 21:39:15 +00:00
Benjamin Kramer
5d304115ca Sync SmallBitVector with BitVector. Add unit tests for the missing methods.
llvm-svn: 186123
2013-07-11 21:59:16 +00:00
Benjamin Kramer
2fbc7287e4 BitVector: Do the right thing in all() when Size is a multiple of BITWORD_SIZE.
llvm-svn: 183525
2013-06-07 15:14:31 +00:00
Benjamin Kramer
5f752c703f Optimize BitVector::all().
llvm-svn: 183521
2013-06-07 14:14:38 +00:00
Owen Anderson
cb8d1f6815 Fix a bug in the set(I,E)/reset(I,E) methods that I recently added. The boundary condition for checking if I and E were in the same word were incorrect, and, beyond that, the mask computation was not using a wide enough constant.
llvm-svn: 166015
2012-10-16 06:04:27 +00:00
Owen Anderson
e678a60cc8 Add range-based set()/reset() to BitVector. These allow fast setting/resetting of ranges of bits, particularly useful when dealing with very large BitVector's.
llvm-svn: 165984
2012-10-15 22:05:27 +00:00
Benjamin Kramer
ed052699c6 Merge the SmallBitVector and BitVector unit tests with gtest's typed test magic and bring SmallBitVector up to date.
llvm-svn: 158600
2012-06-16 10:51:07 +00:00
Jakob Stoklund Olesen
184e921187 Remove the expensive BitVector::operator~().
Returning a temporary BitVector is very expensive. If you must, create
the temporary explicitly: Use BitVector(A).flip() instead of ~A.

llvm-svn: 156768
2012-05-14 15:46:27 +00:00
Jakob Stoklund Olesen
8783cdf045 Add BitVector::anyCommon().
The existing operation (A & B).any() is very slow.

llvm-svn: 156760
2012-05-14 15:01:19 +00:00
Jakob Stoklund Olesen
4004b18f94 Add portable bit mask operations to BitVector.
BitVector uses the native word size for its internal representation.
That doesn't work well for literal bit masks in source code.

This patch adds BitVector operations to efficiently apply literal bit
masks specified as arrays of uint32_t.  Since each array entry always
holds exactly 32 bits, these portable bit masks can be source code
literals, probably produced by TableGen.

llvm-svn: 148272
2012-01-17 01:24:32 +00:00
Dan Gohman
f9d7d6c9f9 Add an all() method to BitVector, for testing whether all bits are set.
llvm-svn: 114830
2010-09-27 15:48:37 +00:00
Dan Gohman
73722062f7 Update BitVectorTest.cpp to stay in sync with SmallBitVectorTest.cpp,
and fix a bug in BitVector's reference proxy class which this exposed.

llvm-svn: 102768
2010-04-30 20:50:28 +00:00
Benjamin Kramer
0a0f0f6465 Silence GCC warnings.
llvm-svn: 95779
2010-02-10 13:34:02 +00:00
Dan Gohman
2dd0d36f14 Implement operators |=, &=, and ^= for SmallBitVector, and remove the
restriction in BitVector for |= and ^= that the operand must be the
same length.

llvm-svn: 95768
2010-02-10 05:54:04 +00:00
Dale Johannesen
af10702e49 Disable unittests/ADT/BitVectorTest on PPC Darwin.
It fails with a release build only, for reasons
as yet unknown.  (If there's a better way to Xfail
things here let me know, doesn't seem to be any
prior art in unittests.)

llvm-svn: 95700
2010-02-09 22:15:27 +00:00
Dan Gohman
090f279ac5 Add a SmallBitVector class, which mimics BitVector but uses only
a single pointer (PointerIntPair) member. In "small" mode, the
pointer field is reinterpreted as a set of bits. In "large" mode,
the pointer points to a heap-allocated object.

Also, give BitVector empty and swap functions.

And, add some simple unittests for BitVector and SmallBitVector.

llvm-svn: 92730
2010-01-05 15:04:49 +00:00