Reid Spencer
d22266f456
Review changes:
...
1. Function style changes.
2. 80-col violations.
3. Better names for things.
4. Arrange constructors so they all take bit width first.
5. Add named signed and unsigned comparison functions and remove the
corresponding operators.
6. Remove operator&& and operator|| but provide a getBoolValue function which
converts to bool as comparison against 0. This allows the normal && and
|| operators to be used as if (X.getBoolValue() && Y.getBoolValue())
Note: this still doesn't function 100% yet. I'm working on the bugs now.
llvm-svn: 34353
2007-02-16 22:36:51 +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
Zhou Sheng
9868d8d7db
Fix some buges:
...
1. Make getMinValue() returns the right value.
2. Fix the ByteSwap() crash problem.
3. Make Postfix increment work correctly.
4. Fix some bugs in LogBase2, Hi/LoBits and UDiv.
llvm-svn: 34304
2007-02-15 06:36:31 +00:00
Evan Cheng
0cd0f0f232
Add a BitVector class.
...
llvm-svn: 34301
2007-02-15 05:56:11 +00:00
Reid Spencer
80ac48cfdf
Make some minor improvements to APInt:
...
1. Make all the operators use uppercase
2. Rename APIntRoundToDouble method just RoundToDouble, the APInt is
redundant.
3. Turn the class on for compilation.
llvm-svn: 34253
2007-02-13 22:41:58 +00:00
Chris Lattner
3490afcd50
fix a critical bug in smallvector, where it would destroy elements that are
...
not in its range (!).
llvm-svn: 34230
2007-02-13 07:25:36 +00:00
Zhou Sheng
7b47556f5c
1. Make APInt::shl work correctly and more efficiently.
...
2. Add functions to support the numberical conversion between APInt and
double/float.
llvm-svn: 34201
2007-02-12 20:02:55 +00:00
Chris Lattner
d61a01003b
add new ShouldRehash method to factor out common code. Fix the dtor to not
...
delete tombstones.
llvm-svn: 34189
2007-02-11 21:46:36 +00:00
Chris Lattner
15eaaa2bbd
do not allow hash table to be filled with tombstones.
...
llvm-svn: 34186
2007-02-11 21:07:36 +00:00
Chris Lattner
ce3f5f906a
Add support for removing elements out of StringMap.
...
llvm-svn: 34185
2007-02-11 20:58:00 +00:00
Chris Lattner
3a9d38035f
Replace the ugly FindValue method with STL-like find methods.
...
llvm-svn: 34183
2007-02-11 19:49:41 +00:00
Chris Lattner
f1e2e9e259
remove support for stringmap visitors now that iterators exist.
...
llvm-svn: 34180
2007-02-11 08:22:15 +00:00
Chris Lattner
c3396d5ff8
add iterator support, plus support for size() and empty().
...
llvm-svn: 34178
2007-02-11 08:12:13 +00:00
Chris Lattner
8a8d0a44a6
Split StringMapEntry construction out of StringMap, into StringMapEntry.
...
llvm-svn: 34170
2007-02-11 00:10:26 +00:00
Chris Lattner
f686454486
Make find return the appropriate iterator/const_iterator
...
llvm-svn: 34137
2007-02-10 06:58:17 +00:00
Chris Lattner
025607b8b0
Allow DenseMAp to take an explicit DenseMapKeyInfo
...
llvm-svn: 34134
2007-02-10 06:34:58 +00:00
Zhou Sheng
20d0f4e319
Eliminates friend function declaration inside APInt, instead, adds public
...
methods as those global function's internal implementation.
llvm-svn: 34083
2007-02-09 07:48:24 +00:00
Chris Lattner
d16cc5ebcb
Rename CStringMap -> StringMap, since it now supports nul characters in the
...
strings.
llvm-svn: 34064
2007-02-08 19:20:57 +00:00
Chris Lattner
3705cf294c
Allow cstringmap to contain strings with nul characters in them.
...
llvm-svn: 34062
2007-02-08 19:08:37 +00:00
Zhou Sheng
6efcdc8049
As Chris and Reid suggested, remove "isSigned" field from APInt, instead,
...
add some signed/unsigned arithmetic operation functions into APInt.h to
handle the signed/unsigned issue. These functions will be defined inside a
namespace "APIntOps" which is inside llvm namespace.
llvm-svn: 34053
2007-02-08 14:35:19 +00:00
Lauro Ramos Venancio
30734ef2e7
Fix build error.
...
include/llvm/ADT/APInt.h:326: error: âassertâ was not declared in this scope
llvm-svn: 34002
2007-02-07 16:59:17 +00:00
Zhou Sheng
7881ec420f
As Chris suggested, fixed some problems. (This is the first part.)
...
llvm-svn: 33986
2007-02-07 05:58:38 +00:00
Chris Lattner
2c3df2a958
do not let the table fill up with tombstones.
...
llvm-svn: 33973
2007-02-07 01:11:25 +00:00
Chris Lattner
672550f0b1
Fix a really subtle bug where the entire hash table could fill with
...
tombstones, causing subsequent insertions to infinitely loop.
llvm-svn: 33972
2007-02-07 00:55:59 +00:00
Lauro Ramos Venancio
a38cfcb65c
Fix build error.
...
UniqueVector.h:66: error: âassertâ was not declared in this scope
llvm-svn: 33961
2007-02-06 14:59:28 +00:00
Zhou Sheng
8eba14bd31
As Reid suggested, fixed some problems.
...
llvm-svn: 33954
2007-02-06 05:59:47 +00:00
Chris Lattner
7a51f3a520
Simplify this a bit, add an assertion
...
llvm-svn: 33936
2007-02-05 23:24:48 +00:00
Chris Lattner
4ec6868104
Const method must use const_iterator.
...
llvm-svn: 33933
2007-02-05 23:18:32 +00:00
Zhou Sheng
4967eb71b1
Add a class APInt to represent arbitrary precision constant integral values.
...
It is a functional replacement for common case integer type like "unsigned",
"uint64_t", but also allows non-byte-width integer type and large integer
value types such as 3-bits, 15-bits, or more than 64-bits of precision. For
more details, see pr1043.
llvm-svn: 33913
2007-02-05 17:29:16 +00:00
Chris Lattner
41ec7b272f
add a version of insert that takes the key and value.
...
llvm-svn: 33856
2007-02-04 00:42:41 +00:00
Chris Lattner
1113f4c8ee
Make SmallSetVector useful
...
llvm-svn: 33854
2007-02-04 00:30:40 +00:00
Chris Lattner
9758cc5fd2
Various bugfixes
...
llvm-svn: 33848
2007-02-04 00:12:12 +00:00
Chris Lattner
cfdda5e521
Convert SetVector to be a true adapter class and add SmallSetVector.
...
llvm-svn: 33846
2007-02-03 23:56:03 +00:00
Chris Lattner
71f7b41b05
8 buckets is way too small to start out with. This was only for testing.
...
llvm-svn: 33835
2007-02-03 19:30:48 +00:00
Chris Lattner
d4bf1bd958
remove a dead header
...
llvm-svn: 33820
2007-02-03 03:02:10 +00:00
Chris Lattner
c5f2684ba7
silence annoying warning in release-asserts build
...
llvm-svn: 33797
2007-02-02 21:19:18 +00:00
Chris Lattner
10292e5997
add find/erase, add const iterators, fix bugs in iterators.
...
llvm-svn: 33791
2007-02-02 20:34:32 +00:00
Chris Lattner
d0c5814b38
add iterators
...
llvm-svn: 33790
2007-02-02 19:27:13 +00:00
Chris Lattner
fe31060a23
Add a new dense hash table implementation
...
llvm-svn: 33751
2007-02-01 07:49:59 +00:00
Chris Lattner
a24a3aaa94
rename DenseMap to IndexedMap.
...
llvm-svn: 33749
2007-02-01 05:32:05 +00:00
Chris Lattner
e61728144b
rename DenseMap -> IndexedMap.
...
llvm-svn: 33748
2007-02-01 05:28:10 +00:00
Chris Lattner
d9c5442b61
add missing ctor
...
llvm-svn: 33714
2007-01-31 20:08:34 +00:00
Chris Lattner
302032e482
provide a definition for uintptr_t
...
llvm-svn: 33592
2007-01-27 23:52:33 +00:00
Chris Lattner
38f873d682
Make SmallSet<whatever*, N> faster by transparently implementing it with
...
SmallPtrSet. Some clients will need to use SmallPtrSet directly though if
they need to iterate over the set.
llvm-svn: 33584
2007-01-27 08:20:15 +00:00
Chris Lattner
4307892029
add some missing API
...
llvm-svn: 33583
2007-01-27 08:19:03 +00:00
Chris Lattner
8360d61860
Give SmallSet a reasonable fallback if it gets large: use an std::set.
...
llvm-svn: 33582
2007-01-27 08:14:53 +00:00
Chris Lattner
2ca5edd29e
implement SmallPtrSet::erase
...
llvm-svn: 33581
2007-01-27 07:59:10 +00:00
Chris Lattner
cc42c6a00d
Fix a limitation of SmallPtrSet. Before it would assert if the smallsize
...
was not a power of two. Now it rounds up to the next power of two internally.
llvm-svn: 33580
2007-01-27 07:52:27 +00:00
Chris Lattner
6e11e4fb50
add some comments on the algorithm
...
llvm-svn: 33579
2007-01-27 07:24:51 +00:00
Chris Lattner
22513a4828
Add a new SmallSet ADT specialized for pointers.
...
llvm-svn: 33577
2007-01-27 07:10:46 +00:00
Chris Lattner
a0210a8d2b
simplify insert interface
...
llvm-svn: 33567
2007-01-27 02:13:58 +00:00
Chris Lattner
8e8ec41bea
clean up comment
...
llvm-svn: 33566
2007-01-27 01:14:20 +00:00
Chris Lattner
c7e278045f
fit in 80 cols
...
llvm-svn: 33553
2007-01-26 21:48:40 +00:00
Chris Lattner
14958b0a08
fix typo
...
llvm-svn: 33459
2007-01-23 04:59:58 +00:00
Chris Lattner
213c43eaed
make the SmallSet interface more std::set-like
...
llvm-svn: 33458
2007-01-23 01:16:19 +00:00
Chris Lattner
e24cf7736b
add a trivial SmallSet class, which operates on a similar principle to
...
SmallVector.
llvm-svn: 33456
2007-01-23 00:59:15 +00:00
Reid Spencer
f1f0b585a8
For PR1094:
...
Make the SetVector::iterator be the vector's const_iterator.
llvm-svn: 33279
2007-01-17 02:22:18 +00:00
Chris Lattner
87e0f0787e
eliminate constructor from Statistic class. It is now impossible to get a
...
static constructor for them :). Transition complete.
llvm-svn: 32710
2006-12-19 23:17:40 +00:00
John Criswell
3b18f0e184
Added operator methods to the Statistic class; some LLVM projects depend
...
on these.
llvm-svn: 32701
2006-12-19 22:55:57 +00:00
Chris Lattner
c18ec8716e
Refactor statistic a big and introduce a horrible-but-necessary macro
...
(STATISTIC), which allows us to define statistics that don't introduce
static ctors into the .o files. I'm migrating code over to use this
incrementally.
llvm-svn: 32687
2006-12-19 21:27:47 +00:00
Bill Wendling
899c552208
Removed llvm_ostream and used std::ostream instead.
...
llvm-svn: 32658
2006-12-18 21:59:00 +00:00
Bill Wendling
7f6a73eb5c
Added an automatic cast to "std::ostream*" etc. from OStream. We then can
...
rework the hacks that had us passing OStream in. We pass in std::ostream*
instead, check for null, and then dispatch to the correct print() method.
llvm-svn: 32636
2006-12-17 05:15:13 +00:00
Chris Lattner
9c52dc6c34
Change the implementation of statistic to not need destructors at all.
...
Instead, the stat info is printed when llvm_shutdown() is called.
These also don't need static ctors, but getting rid of them is uglier:
still investigating. This reduces the number of static dtors in llvm from
~1400 to ~750.
llvm-svn: 32372
2006-12-08 20:00:42 +00:00
Bill Wendling
a3246c4272
Changed llvm_ostream et all to OStream. llvm_cerr, llvm_cout, llvm_null, are
...
now cerr, cout, and NullStream resp.
llvm-svn: 32298
2006-12-07 01:30:32 +00:00
Chris Lattner
e626f6de68
merge the Statistic and StatisticBase classes, eliminating virtual methods
...
and eliminating #includes from the Statistic.h file.
llvm-svn: 32282
2006-12-06 18:20:44 +00:00
Chris Lattner
a531ce882e
Detemplatize the Statistic class. The only type it is instantiated with
...
is 'unsigned'.
llvm-svn: 32279
2006-12-06 17:46:33 +00:00
Bill Wendling
5def3648f4
Support for llvm_ostreams.
...
llvm-svn: 31988
2006-11-28 23:31:42 +00:00
Chris Lattner
339c732e0b
Add a helper function
...
llvm-svn: 31981
2006-11-28 22:32:35 +00:00
Bill Wendling
4157840bd6
Added a temporary hack to get the llvm-streams to work for future checkins.
...
llvm-svn: 31978
2006-11-28 22:21:29 +00:00
Jeff Cohen
e1003da1a2
Unbreak VC++ build.
...
llvm-svn: 31464
2006-11-05 19:31:28 +00:00
Jim Laskey
c770e68c11
Allow FoldingSet clients to pump up the initial hash size.
...
llvm-svn: 31377
2006-11-02 14:21:26 +00:00
Chris Lattner
5c33fa2a37
add a new form of insert.
...
llvm-svn: 31290
2006-10-30 05:07:51 +00:00
Chris Lattner
9a99a284dc
Add SmallString a (currently) minimal class that adapts SmallVector to be
...
more string-like.
llvm-svn: 31289
2006-10-30 03:39:20 +00:00
Chris Lattner
593e2361b4
add a method
...
llvm-svn: 31288
2006-10-30 03:14:15 +00:00
Chris Lattner
08b405916c
add newline at end of file
...
llvm-svn: 31287
2006-10-29 23:47:01 +00:00
Chris Lattner
1db6efc297
add a highly efficient hash table that is specialized for mapping C strings
...
to some other type.
llvm-svn: 31286
2006-10-29 23:42:03 +00:00
Jim Laskey
e65b6c3c60
Clean up
...
llvm-svn: 31238
2006-10-27 22:52:02 +00:00
Jim Laskey
3d1116e32c
Apply editorials.
...
llvm-svn: 31218
2006-10-27 18:05:12 +00:00
Jim Laskey
69b57830c2
Breakout folding hash set from SelectionDAGCSEMap.
...
llvm-svn: 31215
2006-10-27 16:16:16 +00:00
Andrew Lenharth
6223a6ce63
Fix build error in gcc 3.4 and make more this general
...
llvm-svn: 30839
2006-10-09 19:05:44 +00:00
Chris Lattner
e3f0524253
Fix PR897
...
llvm-svn: 30820
2006-10-08 22:28:34 +00:00
Chris Lattner
7453a7d197
add a simple reserve method.
...
llvm-svn: 30011
2006-09-01 06:08:16 +00:00
Chris Lattner
e84b1b8352
Instantiate Statistic<> in one place, not in every .o file that uses it.
...
llvm-svn: 29971
2006-08-30 04:17:00 +00:00
Chris Lattner
4fa85705f6
Add 2nd form of resize
...
llvm-svn: 29945
2006-08-28 21:52:08 +00:00
Chris Lattner
a6735ae8d1
add resize, move swap out of line
...
llvm-svn: 29823
2006-08-22 17:28:57 +00:00
Chris Lattner
19d59ce917
add a bunch more operations, including swap, insert, erase, front(), and
...
bugfixes for operator=.
llvm-svn: 29811
2006-08-22 06:27:16 +00:00