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

45 Commits

Author SHA1 Message Date
Craig Topper
e18a06be4d Convert assert(0) to llvm_unreachable
llvm-svn: 149849
2012-02-05 22:14:15 +00:00
Jakob Stoklund Olesen
033045b6da Add a BitVector::reset(BitVector&) method.
The alternative LHS &= ~RHS is way too slow because it creates a
temporary that calls malloc/free.

llvm-svn: 149187
2012-01-29 01:29:22 +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
Benjamin Kramer
3b0f0fd785 BitVector tweaks.
- Double the vector's capacity when growing to avoid unneeccesary reallocation.
- Do the reallocation with realloc(3) which can expand the memory in place.

llvm-svn: 120183
2010-11-26 18:25:20 +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
Chris Lattner
bc3c70b81f work around an MSVC2010 bug, PR6504
llvm-svn: 98653
2010-03-16 19:07:05 +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
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
Dan Gohman
770f4158e5 Use CHAR_BIT instead of hard-coding 8 in several places where it
is appropriate. This helps visually differentiate host-oriented
calculations from target-oriented calculations.

llvm-svn: 68227
2009-04-01 18:45:54 +00:00
Roman Levenstein
504ba4c98b Fix a bug in BitVector.h. All assignment operations (except the usual
assignment operator) were returning a copy of the bit vector, instead of a
reference! This old semantics probably did not meet the expectations.
With this patch, chained assignments happen to the right object.

llvm-svn: 63012
2009-01-26 11:07:20 +00:00
Misha Brukman
da77da48f3 Removed trailing whitespace.
llvm-svn: 62000
2009-01-09 19:25:42 +00:00
Dan Gohman
3ea2dceca0 Prune and tidy #includes.
llvm-svn: 51697
2008-05-29 19:52:31 +00:00
Evan Cheng
d9353009b7 Fix more -Wshorten-64-to-32 warnings.
llvm-svn: 50659
2008-05-05 18:30:58 +00:00
Anton Korobeynikov
0c5e186924 Unbreak build with gcc 4.3: provide missed includes and silence most annoying warnings.
llvm-svn: 47367
2008-02-20 11:08:44 +00:00
Chris Lattner
e0b1ee937a Don't attribute in file headers anymore. See llvmdev for the
discussion of this change.  Boy are my fingers tired. ;-)

llvm-svn: 45411
2007-12-29 19:59:42 +00:00
Ted Kremenek
d0f4955b73 Added two bounds checks to the BitVector class to detect
out-of-bounds bit accesses.  The checks are only performed
in a Debug build.

llvm-svn: 44815
2007-12-10 22:28:35 +00:00
Hartmut Kaiser
ed12f66488 Updated VC++ build system.
Silenced some VC warnings.

I'm getting linker errors, though: unresolved externals:

llvm::Split<class llvm::BasicBlock *,struct llvm::GraphTraits<class llvm::BasicBlock *> >(class llvm::DominatorTreeBase<class llvm::BasicBlock> &,class llvm::BasicBlock *)

and

llvm::Split<struct llvm::Inverse<class llvm::BasicBlock *>,struct llvm::GraphTraits<struct llvm::Inverse<class llvm::BasicBlock *> > >(class llvm::DominatorTreeBase<class llvm::BasicBlock> &,class llvm::BasicBlock *)

Where are these defined?

llvm-svn: 43073
2007-10-17 14:56:40 +00:00
Chris Lattner
e47ae5fe94 make operator== work with non-equal sized bitvectors, as long as
the extra bits are all zeros.  This allows  "010" and "010000" to be
treated as equal.

llvm-svn: 42889
2007-10-12 03:48:59 +00:00
Chris Lattner
0330d81fcf make bitvector &= do the right thing if vectors have mismatched length.
llvm-svn: 42860
2007-10-11 06:12:33 +00:00
Chandler Carruth
e717210757 This fixes resizing issues with BitVectors. It ensures that the BitWord type and type size is always used, and ensures completely correct clearing of unused high bits, and setting of bits when resizing. It should resolve PR1563.
llvm-svn: 40871
2007-08-06 20:52:17 +00:00
Owen Anderson
31eaa152b8 Evidently my earlier fix did not go far enough. When resizing a zero-sized
BitVector, make sure to set or clear ALL of the bits.

llvm-svn: 38481
2007-07-10 02:01:16 +00:00
Owen Anderson
1ab53d5ee7 When resizing a BitVector with size 0, be sure to clear the low word before using it.
llvm-svn: 38476
2007-07-09 23:39:39 +00:00
Jeff Cohen
34d6dc5574 Rename identifier that GCC uses as a macro, breaking llvm-gcc build.
llvm-svn: 36474
2007-04-26 15:07:47 +00:00
Anton Korobeynikov
f3e62a428a Removed tabs everywhere except autogenerated & external files. Add make
target for tabs checking.

llvm-svn: 36146
2007-04-16 18:10:23 +00:00
Lauro Ramos Venancio
2dfc0515a6 Fix release build.
llvm-svn: 35676
2007-04-04 22:13:39 +00:00
Anton Korobeynikov
e16f421e0e Properly emit range comparisons for switch cases, where neighbour cases
go to the same destination. Now we're producing really good code for
switch-lower-feature.ll testcase

llvm-svn: 35672
2007-04-04 21:14:49 +00:00
Chris Lattner
305c3525af Add a dtor to fix leaks from all clients of BitVector.
llvm-svn: 35200
2007-03-20 02:10:56 +00:00
Evan Cheng
44257955c8 Make it 64-bit safe.
llvm-svn: 34829
2007-03-02 02:31:37 +00:00
Evan Cheng
c17b6ab5f7 Proper fix for the off-by-one bug in clear_unused_bits().
llvm-svn: 34328
2007-02-15 21:38:15 +00:00
Reid Spencer
3b68dab779 Fix an off-by-one bug in computing the index of the word to clear.
llvm-svn: 34326
2007-02-15 20:49:10 +00:00
Reid Spencer
6fd2d9d381 Make sure Capacity gets initialized too.
llvm-svn: 34325
2007-02-15 20:14:06 +00:00
Evan Cheng
ca4cab1cd2 Missing a ;
llvm-svn: 34322
2007-02-15 19:29:05 +00:00
Evan Cheng
f73b1abdea BitVector::reference operator=(const reference& rhs) is unnecessary thanks to autoconvert to bool.
llvm-svn: 34320
2007-02-15 19:21:44 +00:00
Evan Cheng
471e882080 Remove unnecessary checks.
llvm-svn: 34319
2007-02-15 19:18:12 +00:00
Evan Cheng
25a8dc8e25 operator== returns false when two bitvectors have different sizes.
llvm-svn: 34317
2007-02-15 19:16:21 +00:00
Evan Cheng
84142d6607 Merges two resize() variants.
llvm-svn: 34316
2007-02-15 19:12:39 +00:00
Evan Cheng
fe4d7486d2 Clear no longer deleting the bits to avoid mallocs.
llvm-svn: 34315
2007-02-15 19:10:34 +00:00
Evan Cheng
21177a5395 BitVector::count() bugs.
llvm-svn: 34314
2007-02-15 19:09:36 +00:00
Evan Cheng
a916761a3a Eliminate a redundent ctor; eliminate one more potential new [0].
llvm-svn: 34313
2007-02-15 19:05:25 +00:00
Evan Cheng
622cd4bd4d 1 -> 1L since BitWord has type unsigned long.
llvm-svn: 34312
2007-02-15 19:03:23 +00:00
Evan Cheng
a8fcf075f1 Eliminate new[0], just set Bits to NULL.
llvm-svn: 34311
2007-02-15 18:59:15 +00:00
Evan Cheng
2216148289 Inverted the condition by accident.
llvm-svn: 34309
2007-02-15 18:48:41 +00:00
Evan Cheng
7ff021d148 Bug fixes: assignment operator forgot to copy over size; copy ctor forgot to clear unused top bits.
llvm-svn: 34305
2007-02-15 08:15:58 +00:00
Evan Cheng
0cd0f0f232 Add a BitVector class.
llvm-svn: 34301
2007-02-15 05:56:11 +00:00