Commit Graph

466 Commits

Author SHA1 Message Date
Ted Kremenek
ebdbed3844 Added preliminary support for iterators in ImutAVLTree.
Implemented ImutAVLTree::isEqual.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42833 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-10 18:11:16 +00:00
Ted Kremenek
be24d91d82 Renamed internal method "Create" of ImutAVLTree to "CreateNode".
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42825 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-10 16:27:33 +00:00
Ted Kremenek
33bbed8f2a Added implementation of immutable (functional) maps and sets, as
implemented on top of a functional AVL tree.  The AVL balancing code
is inspired by the OCaml implementation of Map, which also uses a functional
AVL tree.

Documentation is currently limited and cleanups are planned, but this code
compiles and has been tested.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42813 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-09 21:38:09 +00:00
Chris Lattner
05831c073a Fix problems where DenseMap used operator!= instead of correctly
calling the traits implementation of isEqual.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42782 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-09 05:42:12 +00:00
Chris Lattner
be2c4596cb Change a #include into a forward declaration
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42781 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-09 03:40:30 +00:00
Neil Booth
68e53ad6cb Add a new function tcExtract for extracting a bignum from an
arbitrary range of bits embedded in the middle of another bignum.
This kind of operation is desirable in many cases of software
floating point, e.g. converting bignum integers to floating point
numbers of fixed precision (you want to extract the precision most
significant bits).

Elsewhere, add an assertion, and exit the shift functions early if
the shift count is zero.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42745 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-08 13:47:12 +00:00
Chris Lattner
f8a3ee1d63 Finish off PR1723, by working around some strange compiler bug.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42737 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-07 17:57:10 +00:00
Neil Booth
f16c595252 Add back convertFromSignExtendedInteger.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42735 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-07 12:15:41 +00:00
Neil Booth
643ce59495 Reimplement convertFromUnsignedInteger so it is passed a const bignum.
It used to modify its argument in-place.

This interface is saner and the implementation more efficient.  It will
be needed for decimal->binary conversion.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42733 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-07 12:07:53 +00:00
Neil Booth
ccf596a53e convertFromInteger, as originally written, expected sign-extended
input.  APInt unfortunately zero-extends signed integers, so Dale
modified the function to expect zero-extended input.  Make this
assumption explicit in the function name.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42732 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-07 11:45:55 +00:00
Neil Booth
33d4c92e78 combineLostFractions does not need to be a member function
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42729 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-07 08:51:21 +00:00
Daniel Berlin
c27d61d3ae Some more problems noticed by Curtis
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42717 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-07 04:47:57 +00:00
Neil Booth
978661d053 Generalize tcFullMultiply so that the operands can be of differing
part widths.  Also, return the number of parts actually required to
hold the result's value.
Remove an over-cautious condition from rounding of float->hex conversion.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42669 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-06 00:24:48 +00:00
Chris Lattner
bca98326b6 Mark count method const.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42639 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-05 17:40:38 +00:00
Daniel Berlin
ad92c633c7 Fix intersectWithComplement bug noticed by Curtis Dunham
Optimize |= case for empty RHS


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42629 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-05 05:10:53 +00:00
Daniel Berlin
08bb699843 Fix the previous bug a slightly different way (by modifying how find_next works)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42613 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-04 21:27:17 +00:00
Daniel Berlin
9d03724c8c Fix off by one error in iterator
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42612 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-04 21:18:20 +00:00
Daniel Berlin
8d69b5a113 It helps a lot when you check for the end of your list before randomly
dereferencing things.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42605 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-04 05:29:36 +00:00
Daniel Berlin
c3a32d190c Make SparseBitVector::set actually work properly when sets are not in ascending or descending order.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42604 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-04 05:25:51 +00:00
Neil Booth
a30b0ee959 Add APFloat -> hexadecimal string conversion, as per %a and %A in C99.
Useful for diagnostics and debugging.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42598 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-03 22:26:02 +00:00
Owen Anderson
9c8a9af5af Add a GraphTraits partial specialization to make the inverse of an inverse be the same as the underlying graph.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42592 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-03 21:24:38 +00:00
Chris Lattner
116c3219df Add initial iterator support for folding set.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42589 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-03 21:12:09 +00:00
Neil Booth
b7dea4cb36 Tweak RoundAwayFromZero the bit number below which is truncated, and make
it const.

Preparation for APFloat -> hexadecimal string conversion.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42576 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-03 15:16:41 +00:00
Chris Lattner
1bcc79666d Add a helper useful when mapping from a map element to its hash node.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42480 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-30 08:31:46 +00:00
Chris Lattner
be207738d3 Add a new DenseSet abstraction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42474 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-30 00:47:20 +00:00
Neil Booth
117acf9e36 Whitespace cleanup.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42374 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-26 21:35:05 +00:00
Daniel Berlin
9f711252f5 Fix small bug in operator== for iterators
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42331 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-26 00:11:59 +00:00
Daniel Berlin
e6f0479aee Comment fixups
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42279 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-24 22:20:45 +00:00
Daniel Berlin
d81ccc2806 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.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42269 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-24 19:45:49 +00:00
Owen Anderson
1dcca6b2d0 Fix typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42256 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-24 02:33:22 +00:00
Dale Johannesen
910993e8dc Change APFloat::convertFromInteger to take the incoming
bit width instead of number of words allocated, which
makes it actually work for int->APF conversions.
Adjust callers.  Add const to one of the APInt constructors
to prevent surprising match when called with const
argument.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42210 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-21 22:09:37 +00:00
Owen Anderson
4938d34772 Fix CopyFrom for non-POD data types.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42208 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-21 20:55:54 +00:00
Devang Patel
8feb1f4467 Do not hide APInt::dump() inside #ifndef NDEBUG.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42068 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-17 22:24:00 +00:00
Chris Lattner
76c1b97e40 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42042 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-17 18:34:04 +00:00
Daniel Berlin
430817ba18 That's what i get for using carbon emacs in a terminal
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42040 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-17 18:05:59 +00:00
Daniel Berlin
8180cf65a5 Fix iterator so it doesn't sometimes report bits that aren't in the bitmap
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42039 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-17 18:04:21 +00:00
Daniel Berlin
c6d939818b Fix bug in andersen's related to test_and_set.
Add operator == and != to SparseBitVector.
Simplify code for test_and_set


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42018 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-16 23:59:53 +00:00
Daniel Berlin
7f44657c2f Fix a few bugs related to zero'ing of elements
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42017 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-16 22:31:47 +00:00
Dale Johannesen
9e3d3abd93 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).



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41967 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-14 22:26:36 +00:00
Dan Gohman
f82e1e66ce And an FoldingSetImpl::NodeID::AddInteger overload for int64_t, to avoid
ambiguity.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41960 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-14 20:48:42 +00:00
Chris Lattner
8a901985bc Make single-argument ctors explicit to avoid tricky bugs :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41924 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-13 06:15:57 +00:00
Daniel Berlin
ec39cb98d3 Move dump out of class, use "\n" instead of endl
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41872 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-11 22:58:27 +00:00
Dale Johannesen
3f6eb7419d Add APInt interfaces to APFloat (allows directly
access to bits).  Use them in place of float and
double interfaces where appropriate.
First bits of x86 long double constants handling 
(untested, probably does not work).



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41858 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-11 18:32:33 +00:00
Daniel Berlin
6320260e06 Convert to use ilist and non-pointer lists for extra goodness
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41855 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-11 17:42:22 +00:00
Owen Anderson
29ce95511f 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41837 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-11 05:08:05 +00:00
Owen Anderson
98153ecbc1 Don't bother to initialize values corresponding to empty or tombstone
keys.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41834 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-11 04:43:51 +00:00
Daniel Berlin
16ebc260bd Fix bugs with &=, intersect with complement. Add three argument version of intersect with complement.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41832 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-11 04:11:28 +00:00
Owen Anderson
9544dc294f Fix non-deterministic behavior in the DenseMap copy constructor.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41831 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-11 03:48:08 +00:00
Daniel Berlin
1b6998e8d6 Add remaining functions necessary for andersen's
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41830 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-11 01:38:07 +00:00
Daniel Berlin
2f5d5937ec Add SparseBitVector implementation
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41790 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-09 01:10:40 +00:00