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

62 Commits

Author SHA1 Message Date
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
Jakob Stoklund Olesen
011cea42b9 Optimize empty DenseMap iteration.
llvm-svn: 103962
2010-05-17 20:01:24 +00:00
Andrew Lenharth
4f4af9d95c Iterator traits and swap. closes PR6548 and PR6549
llvm-svn: 97974
2010-03-08 20:45:52 +00:00
Junjie Gu
4d7286efef Make sure the size is doubled (not 4x).
llvm-svn: 94845
2010-01-29 21:34:26 +00:00
Chris Lattner
609eded2e8 add a helper ctor.
llvm-svn: 91819
2009-12-21 07:15:15 +00:00
Chris Lattner
587962c667 Remove isPod() from DenseMapInfo, splitting it out to its own
isPodLike type trait.  This is a generally useful type trait for
more than just DenseMap, and we really care about whether something
acts like a pod, not whether it really is a pod.

llvm-svn: 91421
2009-12-15 07:26:43 +00:00
Jeffrey Yasskin
23ac706aab Fix DenseMap iterator constness.
This patch forbids implicit conversion of DenseMap::const_iterator to
DenseMap::iterator which was possible because DenseMapIterator inherited
(publicly) from DenseMapConstIterator. Conversion the other way around is now
allowed as one may expect.

The template DenseMapConstIterator is removed and the template parameter
IsConst which specifies whether the iterator is constant is added to
DenseMapIterator.

Actually IsConst parameter is not necessary since the constness can be
determined from KeyT but this is not relevant to the fix and can be addressed
later.

Patch by Victor Zverovich!

llvm-svn: 86636
2009-11-10 01:02:17 +00:00
Jeffrey Yasskin
bc5f122491 Fix stylistic and documentation problems in ValueMap found by Nick Lewycky and
Evan Cheng.

llvm-svn: 84967
2009-10-23 20:54:00 +00:00
Torok Edwin
8203691f27 Add a comment explaining how DenseMap::insert works, because it is not
intuitive.
It does NOT update the value if the key is already in the map,
it also returns false if the key is already in the map, regardless
if the value matched.

llvm-svn: 83458
2009-10-07 09:23:56 +00:00
Chris Lattner
f0c81c94c9 give densemap iterators real iterator traits.
llvm-svn: 81538
2009-09-11 18:15:46 +00:00
Chris Lattner
0ba5632cf6 make DenseMap::clear() early exit if there is nothing to do.
llvm-svn: 80480
2009-08-30 05:55:04 +00:00
Dan Gohman
bc6b14ba00 This void is implicit in C++.
llvm-svn: 78848
2009-08-12 22:10:57 +00:00
Dan Gohman
3d7cadb0c2 Split DenseMapInfo into a separate header file, so that it can be
included separately.

llvm-svn: 77693
2009-07-31 18:18:19 +00:00
Torok Edwin
4d8202474c Add freed memory poisoning in !NDEBUG mode for DenseMap.
llvm-svn: 76597
2009-07-21 18:01:37 +00:00
Stuart Hastings
b3c08d427a Prevent looping when DenseSet is abused.
llvm-svn: 70572
2009-05-01 20:47:53 +00:00
Chris Lattner
aad8bd245f DenseMap.h needs <new> because it explicitly calls operator new/delete.
Patch by John McCall!

llvm-svn: 70068
2009-04-25 19:50:14 +00:00
Chris Lattner
d052c5bb9b Add range insert method for DenseSet and define DenseMapInfo for chars.
Patch by Kevin Fan!

llvm-svn: 68239
2009-04-01 19:50:49 +00:00
Chris Lattner
dd41c286e5 add some accessors so I can play games with DenseMaps.
llvm-svn: 68145
2009-03-31 20:57:23 +00:00
Chris Lattner
f3d562df05 When forming sentinels for empty/tombstone, make sure to respect the
pointer's expected number of zero low-bits.

This should fix the breakage I introduced recently.

llvm-svn: 67990
2009-03-29 06:33:22 +00:00
Bill Wendling
b7de7afd32 Get rid of warning about implicit 64-to-32 bit conversions.
llvm-svn: 62741
2009-01-22 02:10:33 +00:00
Chris Lattner
45a7b5ce57 improve compatibility with cygwin, patch by Jay Foad!
llvm-svn: 62535
2009-01-19 22:00:18 +00:00
Misha Brukman
da77da48f3 Removed trailing whitespace.
llvm-svn: 62000
2009-01-09 19:25:42 +00:00
Chris Lattner
0cb74d3d8e add densemap range insertion method.
llvm-svn: 60400
2008-12-02 06:08:04 +00:00
Chris Lattner
8c592b282e fix indentation. std::pair is "isPod" if the first/second are both isPod.
llvm-svn: 60262
2008-11-30 00:50:20 +00:00
David Greene
e8f05397ca Add STL-style typedefs and default constructors to make it possible to
use DenseMap in more contexts.

llvm-svn: 58256
2008-10-27 18:15:15 +00:00
Daniel Dunbar
1b3e44db87 Add DenseMap::lookup:
/// lookup - Return the entry for the specified key, or a default
  /// constructed value if no such entry exists.

llvm-svn: 55523
2008-08-29 00:48:44 +00:00
Chris Lattner
fd64cbf22d consolidate DenseMapInfo implementations, and add one for std::pair.
Patch contributed by m-s.

llvm-svn: 55167
2008-08-22 05:08:25 +00:00
Dan Gohman
c97817aac3 Make DenseMap's insert return a pair, to more closely resemble std::map.
llvm-svn: 53177
2008-07-07 17:46:23 +00:00
Dan Gohman
9c78662057 Use operator new instead of new char[].
llvm-svn: 53067
2008-07-03 00:59:36 +00:00
Owen Anderson
609a53ac86 Fix use of placement new to actually use an address.
llvm-svn: 52423
2008-06-17 18:07:43 +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
5517254faa Added typedef "value_type" to DenseMap (similar typedef appears in std::map).
Added method FindAndConstruct() to DenseMap, which does the same thing as
operator[], except that it refers value_type& (a reference to both the
key and mapped data pair).  This method is useful for clients that wish
to access the stored key value, as opposed to the key used to do the
actual lookup (these need not always be the same).

Redefined operator[] to use FindAndConstruct() (same logic).

llvm-svn: 43594
2007-11-01 00:54:57 +00:00
Chris Lattner
8ee06ab2ab Fix problems where DenseMap used operator!= instead of correctly
calling the traits implementation of isEqual.

llvm-svn: 42782
2007-10-09 05:42:12 +00:00
Chris Lattner
ddd980044f Finish off PR1723, by working around some strange compiler bug.
llvm-svn: 42737
2007-10-07 17:57:10 +00:00
Daniel Berlin
f900d1295f Implement offline variable substitution in order to reduce memory
and time usage.
Fixup operator == to make this work, and add a resize method to DenseMap
so we can resize our hashtable once we know how big it should be.

llvm-svn: 42269
2007-09-24 19:45:49 +00:00
Owen Anderson
40196b7929 Fix CopyFrom for non-POD data types.
llvm-svn: 42208
2007-09-21 20:55:54 +00:00
Chris Lattner
cc315726f7 Merge DenseMapKeyInfo & DenseMapValueInfo into DenseMapInfo
Add a new DenseMapInfo::isEqual method to allow clients to redefine
the equality predicate used when probing the hash table.

llvm-svn: 42042
2007-09-17 18:34:04 +00:00
Owen Anderson
0c2fdab32a Add a ValueInfoT template parameter to DenseMap so that it can properly make decisions
based on whether the key AND the value require ctors/dtors.

llvm-svn: 41837
2007-09-11 05:08:05 +00:00
Owen Anderson
a96cf4c60a Don't bother to initialize values corresponding to empty or tombstone
keys.

llvm-svn: 41834
2007-09-11 04:43:51 +00:00
Owen Anderson
8014c7f1f3 Fix non-deterministic behavior in the DenseMap copy constructor.
llvm-svn: 41831
2007-09-11 03:48:08 +00:00
Owen Anderson
06cbd29787 Forgot a line.
llvm-svn: 41115
2007-08-16 00:25:42 +00:00
Owen Anderson
868a1a5ed6 Add a copy constructor and an assignment operator to DenseMap.
llvm-svn: 41114
2007-08-16 00:18:32 +00:00
Reid Spencer
8c5c7c8453 Change casts from old style to new style. This helps document the details
better, gives the compiler a chance to validate the cast and reduces warnings
if the user turns on -Wold-style-cast option.

llvm-svn: 41033
2007-08-12 08:12:35 +00:00
Chris Lattner
ab61b6f01e Fix a bug in DenseMap::clear, where we never reset a tombstone
to EmptyKey.

llvm-svn: 40839
2007-08-05 08:43:36 +00:00
Chris Lattner
10db9656ba When clearing a SmallPtrSet, if the set had a huge capacity, but the
contents of the set were small, deallocate and shrink the set.  This
avoids having us to memset as much data, significantly speeding up
some pathological cases.  For example, this speeds up the verifier
from 0.3899s to 0.0763 (5.1x) on the testcase from PR1432 in a 
release build.

llvm-svn: 40837
2007-08-05 07:32:14 +00:00
Owen Anderson
2ceefaf94d Make the heuristic for shrinking DenseMap smarter.
llvm-svn: 40114
2007-07-20 18:56:46 +00:00
Owen Anderson
07f3b97796 Have DenseMap auto-shrink itself on clear(). This improves the time to optimize
403.gcc from 15.2s to 14.3s.

llvm-svn: 40100
2007-07-20 16:15:24 +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