Commit Graph

43 Commits

Author SHA1 Message Date
Dan Gohman 6556c8962c Add the ability to "intern" FoldingSetNodeID data into a
BumpPtrAllocator-allocated region to allow it to be stored in a more
compact form and to avoid the need for a non-trivial destructor call.

Use this new mechanism in ScalarEvolution instead of
FastFoldingSetNode to avoid leaking memory in the case where a
FoldingSetNodeID uses heap storage, and to reduce overall memory
usage.

llvm-svn: 98829
2010-03-18 16:16:38 +00:00
Daniel Dunbar 78faee0664 Switch FoldingSet::AddString to StringRef based API.
- This also fixes a dereference of std::string::end, which makes MSVC unhappy and was causing all the static analyzer clang tests to fail.

llvm-svn: 82517
2009-09-22 03:34:53 +00:00
Torok Edwin fbcc663cbf llvm_unreachable->llvm_unreachable(0), LLVM_UNREACHABLE->llvm_unreachable.
This adds location info for all llvm_unreachable calls (which is a macro now) in
!NDEBUG builds.
In NDEBUG builds location info and the message is off (it only prints
"UREACHABLE executed").

llvm-svn: 75640
2009-07-14 16:55:14 +00:00
Torok Edwin 56d0659726 assert(0) -> LLVM_UNREACHABLE.
Make llvm_unreachable take an optional string, thus moving the cerr<< out of
line.
LLVM_UNREACHABLE is now a simple wrapper that makes the message go away for
NDEBUG builds.

llvm-svn: 75379
2009-07-11 20:10:48 +00:00
Nick Lewycky ef01e112aa Add an API for strings with possible NULLs in the middle. Refactor the other
two AddString methods to use it.

llvm-svn: 64005
2009-02-07 04:57:08 +00:00
Dale Johannesen 1f86498f93 Do not use host floating point types when emitting
ASCII IR; loading and storing these can change the
bits of NaNs on some hosts.  Remove or add warnings
at a few other places using host floating point;
this is a bad thing to do in general.

llvm-svn: 62712
2009-01-21 20:32:55 +00:00
Dan Gohman bde853911f Overload AddInteger on int/long/long long instead of on int/int64_t,
to avoid overload ambiguities. This fixes build errors introduced
by r58623.

llvm-svn: 58632
2008-11-03 19:40:18 +00:00
Dan Gohman 0e44e0d7a8 Add a clear() method to FoldingSet.
llvm-svn: 55210
2008-08-23 00:42:16 +00:00
Dan Gohman be5e69ed37 Avoid repeatedly reallocating the FoldingSetNodeID when searching
through multiple nodes in a bucket.

llvm-svn: 54687
2008-08-12 17:40:22 +00:00
Owen Anderson 31936d6ab6 Add a version of AddString that takes a const char* so we can avoid extraneous
conversions to std::string.

llvm-svn: 52995
2008-07-01 23:49:59 +00:00
Ted Kremenek 90ada832be Consistently set "Buckets[NumBuckets] = reinterpret_cast<void*>(-1)" throughout FoldingSet.cpp.
llvm-svn: 52425
2008-06-17 19:12:43 +00:00
Evan Cheng 86cb31862f Fix more -Wshorten-64-to-32 warnings.
llvm-svn: 50659
2008-05-05 18:30:58 +00:00
Anton Korobeynikov 579f07135a 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
Ted Kremenek d66c791904 Fixed bug in FoldingSetIteratorImpl where we did not correctly check if
we had reached the "fake bucket" after the last bucket, allowing the iterator
in some cases to run off the end of the hashtable.

llvm-svn: 47178
2008-02-15 21:12:46 +00:00
Ted Kremenek 6f30a0798f Added "Profile" method to APFloat for use with FoldingSet.
Added member template "Add" to FoldingSetNodeID that allows "adding" arbitrary
objects to a profile via dispatch to FoldingSetTrait<T>::Profile().

Removed FoldingSetNodeID::AddAPFloat and FoldingSetNodeID::APInt, as their
functionality is now replaced using the above mentioned member template.

llvm-svn: 46957
2008-02-11 17:24:50 +00:00
Dan Gohman 4f26eb7270 Add support to FoldingSet for hashing APInt objects.
llvm-svn: 46833
2008-02-06 23:09:15 +00:00
Ted Kremenek e288786356 Added "bucket_iterators" to FoldingSet. Bucket iterators allow iteration
over all the nodes in a particular bucket.

llvm-svn: 46716
2008-02-04 21:11:17 +00:00
Ted Kremenek 726933a589 Fixed 80 col. violation.
llvm-svn: 46709
2008-02-04 17:14:20 +00:00
Ted Kremenek c0259639ad Made 'FoldingSetNodeID' a proper class instead of a nested class in
'FoldingSetNodeImpl' (previously 'FoldingSetNodeID' was a typedef of
'FoldingSetNodeImpl::NodeID').

Why?  Clients can now easily forward declare 'FoldingSetNodeID' without having
to include FoldingSet.h.

llvm-svn: 46187
2008-01-19 04:22:50 +00:00
Chris Lattner f3ebc3f3d2 Remove attribution from file headers, per discussion on llvmdev.
llvm-svn: 45418
2007-12-29 20:36:04 +00:00
Chris Lattner 5c50f59690 Change a #include into a forward declaration
llvm-svn: 42781
2007-10-09 03:40:30 +00:00
Chris Lattner 99f6ab7e4c Add initial iterator support for folding set.
llvm-svn: 42589
2007-10-03 21:12:09 +00:00
Chris Lattner 8c41ed61d1 Simplify implementation of the FoldingSet circular list, a necessary step
to giving it iterators.

llvm-svn: 42586
2007-10-03 20:45:43 +00:00
Chris Lattner 6395e5060d fix a gcc warning: comparison between signed and unsigned integer expressions
llvm-svn: 41972
2007-09-14 22:57:00 +00:00
Dale Johannesen 98d3a08d8f Remove the assumption that FP's are either float or
double from some of the many places in the optimizers
it appears, and do something reasonable with x86
long double.
Make APInt::dump() public, remove newline, use it to
dump ConstantSDNode's.
Allow APFloats in FoldingSet.
Expand X86 backend handling of long doubles (conversions
to/from int, mostly).

llvm-svn: 41967
2007-09-14 22:26:36 +00:00
Dan Gohman 14cf78cde5 And an FoldingSetImpl::NodeID::AddInteger overload for int64_t, to avoid
ambiguity.

llvm-svn: 41960
2007-09-14 20:48:42 +00:00
Chris Lattner a5821eca0d remove folding set debug output
llvm-svn: 34549
2007-02-24 01:41:48 +00:00
Chris Lattner 010ee96261 Encode small integers more densely in foldingset, avoiding overflowing the SmallVector as often.
llvm-svn: 33864
2007-02-04 01:48:10 +00:00
Chris Lattner 4f5cdecde3 improve comments, add an assertion
llvm-svn: 33750
2007-02-01 05:33:21 +00:00
Reid Spencer e7422f6b8d Add some debug output.
llvm-svn: 33718
2007-01-31 21:27:38 +00:00
Chris Lattner 0dbb13735e minor cleanups. Fix off-by-one in accounting the number of nodes when the
table grows.

llvm-svn: 33698
2007-01-31 06:04:41 +00:00
Chris Lattner a94523df7b reformat comment
llvm-svn: 33675
2007-01-30 23:16:22 +00:00
Rafael Espindola f16dbf697a assert.h -> cassert
llvm-svn: 31399
2006-11-03 01:38:14 +00:00
Rafael Espindola a1fde82b6b #include <assert.h>
llvm-svn: 31386
2006-11-02 23:48:53 +00:00
Jim Laskey eb0fd251c1 Allow FoldingSet clients to pump up the initial hash size.
llvm-svn: 31377
2006-11-02 14:21:26 +00:00
Jim Laskey 179ebd3fc3 Try again.
llvm-svn: 31278
2006-10-29 09:19:59 +00:00
Jim Laskey 8f05a611e9 Not handling zero length strings.
llvm-svn: 31277
2006-10-29 08:27:07 +00:00
Jim Laskey cef515fcc0 SmallVector append not insert.
llvm-svn: 31224
2006-10-27 19:38:32 +00:00
Jim Laskey a9e9cae33e Grrr.
llvm-svn: 31223
2006-10-27 19:20:12 +00:00
Jim Laskey a88e609c0f Temp patch for missing functionality.
llvm-svn: 31222
2006-10-27 19:14:16 +00:00
Bill Wendling e0412f500e MathExtras isn't in the llvm/ADT directory but in the llvm/Support directory.
llvm-svn: 31219
2006-10-27 18:47:29 +00:00
Jim Laskey 6ca4a345dd Apply editorials.
llvm-svn: 31218
2006-10-27 18:05:12 +00:00
Jim Laskey 43bc1847a2 Breakout folding hash set from SelectionDAGCSEMap.
llvm-svn: 31215
2006-10-27 16:16:16 +00:00