Commit Graph

613 Commits

Author SHA1 Message Date
Anton Korobeynikov
765d8e5cbd Remove Trie::Edge class. Now edge labels are stored into nodes itself.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44880 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-11 21:55:38 +00:00
Wojciech Matyjewicz
ac9d6cc3a1 Use correct member access operator.
(my test commit as well)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44868 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-11 17:46:25 +00:00
Anton Korobeynikov
64735ccb2b Add first and really dirty version of generic Trie structure
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44851 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-11 06:53:44 +00:00
Ted Kremenek
9324665a78 Added two bounds checks to the BitVector class to detect
out-of-bounds bit accesses.  The checks are only performed
in a Debug build.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44815 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-10 22:28:35 +00:00
Chris Lattner
921f0d40ec remove dead #include.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44711 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-08 19:06:21 +00:00
Chris Lattner
73481e04da eliminate dependency on Bitcode headers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44709 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-08 19:01:44 +00:00
Chris Lattner
065d97e7fc remove dead #include, APInt.h already has the needed forward decls.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44708 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-08 19:00:38 +00:00
Chris Lattner
d7205e6ba1 Pass the whole StringMapEntry into StringMapEntryInitializer::Initialize.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44432 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-29 06:14:41 +00:00
Chris Lattner
aec78708c2 provide an optional API to allow datatypes in a stringmap to be *gasp*
initialized with a value if they want, by specializing the 
StringMapEntryInitializer class.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44430 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-29 06:04:41 +00:00
Chris Lattner
9e513acd31 Fix PR1816, by correcting the broken definition of APInt::countTrailingZeros.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44296 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-23 22:42:31 +00:00
Dan Gohman
adf3eab773 Add explicit keywords.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44234 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-19 15:30:20 +00:00
Daniel Berlin
07268172ff Fix bugs in iterator invalidation
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44174 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-15 18:06:49 +00:00
Chris Lattner
ab64806af2 Import the boost scoped_ptr class to LLVM. This patch was prepared by
Cédric Venet.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44161 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-15 05:57:06 +00:00
Hartmut Kaiser
729bd28f62 Fixed a strange construct. Please review.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44082 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-13 23:04:06 +00:00
Ted Kremenek
c47dfdde24 Implemented generic serialization of APFloat.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43829 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-07 18:39:22 +00:00
Ted Kremenek
586504d5ed Fixed default ctor for APInt to properly initialize BitWidth to a
non-random value.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43795 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-07 00:27:59 +00:00
Chris Lattner
373a733be0 make smallptrset more const and type correct, which caught a few
minor bugs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43782 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-06 22:12:43 +00:00
Neil Booth
ee7ae384f5 When converting to integer, do bit manipulations in the destination
memory rather than in a copy of the APFloat.  This avoids problems
when the destination is wider than our significand and is cleaner.

Also provide deterministic values in all cases where conversion
fails, namely zero for NaNs and the minimal or maximal value
respectively for underflow or overflow.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43626 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-01 22:43:37 +00:00
Ted Kremenek
aef806e9cb 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).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43594 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-01 00:54:57 +00:00
Ted Kremenek
8092406e59 Changed access control within FoldingSet for some ivars from "private"
to "protected".  This allows iterators to work.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43559 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-31 17:12:47 +00:00
Ted Kremenek
20b7907c1c Added member function "size()" to FoldingSet to return the number of
nodes in the FoldingSet.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43531 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-30 23:35:55 +00:00
Ted Kremenek
1a43e5ffe1 Added serialization support for APInt.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43405 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-26 21:50:10 +00:00
Ted Kremenek
7f46734b66 Fixed incorrect "path name" in preamble (comment) of header file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43402 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-26 20:44:02 +00:00
Ted Kremenek
02760ed19a Fixed incorrect "path name" in preamble (comment) of header file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43401 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-26 20:42:45 +00:00
Chris Lattner
10c42185d8 add a nice predicate to check to see if nan
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43304 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-24 18:54:28 +00:00
Christopher Lamb
c5ccbdbe32 Add an uppercase conversion utility function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43146 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-18 19:31:38 +00:00
Ted Kremenek
52e2d83e65 Changed the return type of type-specific Allocate() methods to return
void*.  This is hint that we are returning uninitialized memory rather
than a constructed object.

Patched ImutAVLTree to conform to this new interface.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43106 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-18 00:30:14 +00:00
Ted Kremenek
fa4710427f ImutAVLTree now allocates tree nodes from the BumpPtrAllocator using
the new type-aligned Allocate() method.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43100 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-17 22:17:01 +00:00
Ted Kremenek
6740463c74 Minor cosmetic cleanups in the calculation of alignments for
StringMapEntry objects.  No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43097 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-17 22:09:45 +00:00
Ted Kremenek
9080aaba0b Updated StringMap to use llvm::AlignOf to compute the alignment of map
entries.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43089 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-17 21:13:50 +00:00
Hartmut Kaiser
efd4a5144b 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?

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43073 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-17 14:56:40 +00:00
Ted Kremenek
fd9c58adde Fixed incorrect renaming of method name (forgot two characters).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42999 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-15 19:15:48 +00:00
Ted Kremenek
85d03ae1ae Added more doxygen comments.
Renamed internal method of ImutAVLTree::RemoveMutableFlag to MarkImmutable.
Added enum for bit manipulation (more self-documentating).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42998 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-15 18:52:34 +00:00
Neil Booth
e5e0194583 Consolidate logic for creating NaNs. Silence compiler warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42966 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-14 10:39:51 +00:00
Chris Lattner
1ff2ddda08 don't use intptr_t without including it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42921 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-12 18:16:23 +00:00
Chris Lattner
b89f67e3e6 Make this compute the correct offset, handling alignment of the element
pointer correctly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42918 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-12 17:49:52 +00:00
Neil Booth
96c7471b39 Implement correctly-rounded decimal->binary conversion, i.e. conversion
from user input strings.

Such conversions are more intricate and subtle than they may appear;
it is unlikely I have got it completely right first time.  I would
appreciate being informed of any bugs and incorrect roundings you
might discover.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42912 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-12 16:02:31 +00:00
Chris Lattner
886636445d 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42889 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-12 03:48:59 +00:00
Ted Kremenek
0b22da3d73 Provided accessors to internal allocator for ImutAVLTree and ImmutableSet.
Added postfix ++,-- support for ImmutableSet::iterator.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42877 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-11 21:51:04 +00:00
Dale Johannesen
a471c2ecda Next PPC long double bits. First cut at constants.
No compile-time support for constant operations yet,
just format transformations.  Make readers and
writers work.  Split constants into 2 doubles in
Legalize.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42865 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-11 18:07:22 +00:00
Chris Lattner
343960af31 make bitvector &= do the right thing if vectors have mismatched length.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42860 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-11 06:12:33 +00:00
Ted Kremenek
bdc2154986 Added iterators to ImmutableSet.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42851 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-11 00:14:49 +00:00
Ted Kremenek
37474bce02 Added some doxygen comments to ImmutableSet.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42850 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-10 23:47:03 +00:00
Ted Kremenek
ac6084dfc2 Removed uninformative assertions that catch problems that will
fire anyway at runtime due to a NULL dereference.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42848 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-10 23:35:04 +00:00
Ted Kremenek
13a21b0237 Removed "height" of an AVL tree node from its Profile. This is
implicitly captured by using the addresses of its children in the
profile.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42847 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-10 23:32:01 +00:00
Ted Kremenek
b308cdbc5f Removed spurious forward declaration to a structure that will no longer be used.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42839 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-10 20:45:34 +00:00
Ted Kremenek
ea34bc892c Added some doxygen comments to a few methods of ImutAVLTree.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42837 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-10 20:44:21 +00:00
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
Chuck Rose III
418d360518 Fix for VisualStudio. It is treating a 2 bit enum as a signed int for comparison purposes, causing failures. Using an extra bit fixes it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41784 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-08 04:17:08 +00:00
Owen Anderson
718cb665ca Add lengthof and endof templates that hide a lot of sizeof computations.
Patch by Sterling Stein!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41758 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-07 04:06:50 +00:00
Dale Johannesen
6d5e7d917b fix reversal bug in preceding checkin
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41705 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-04 17:32:27 +00:00
Dale Johannesen
c4dd3c3b51 Add mod, copysign, abs operations to APFloat.
Implement some constant folding in SelectionDAG and
DAGCombiner using APFloat.  Remove double versions
of constructor and getValue from ConstantFPSDNode.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41664 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-31 23:34:27 +00:00
Dale Johannesen
ee8476847d Revise per review of previous patch.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41645 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-31 17:03:33 +00:00
Dale Johannesen
eaf089430e Enhance APFloat to retain bits of NaNs (fixes oggenc).
Use APFloat interfaces for more references, mostly
of ConstantFPSDNode.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41632 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-31 04:03:46 +00:00
Chris Lattner
cd3c4cac6e getMinSignedBits needs to take into consider the sign bit when the value is positive.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41566 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-29 16:21:18 +00:00
Dan Gohman
81975f6dfd Add explicit keywords and remove spurious trailing semicolons.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41482 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-27 14:50:10 +00:00
Dale Johannesen
21dcae17f5 Comment out declaration of operator== (undefined).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41383 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-25 00:40:41 +00:00
Dale Johannesen
12595d7b16 Poison APFloat::operator==. Replace existing uses with bitwiseIsEqual.
This means backing out the preceding change to Constants.cpp, alas.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41378 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-24 22:09:56 +00:00
Dale Johannesen
d3b51fd170 Revised per review feedback from previous patch.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41353 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-24 05:08:11 +00:00
Dale Johannesen
343e770983 Change internal representation of ConstantFP to use APFloat.
Interface to rest of the compiler unchanged, as yet.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41348 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-24 00:56:33 +00:00
Chris Lattner
006f5a3c66 default this to radix 10 like the toString(Un)Signed methods.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41311 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-23 05:21:48 +00:00
Chris Lattner
028760fd88 Avoid hiding issues.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41310 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-23 05:20:48 +00:00
Chris Lattner
9132a2b818 rename APInt::toString -> toStringUnsigned for symmetry with toStringSigned()
Add an APSInt::toString() method.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41309 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-23 05:15:32 +00:00
Chris Lattner
b39cdde41d initial checkin of Neil's APFloat work.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41203 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-20 22:49:32 +00:00
Chris Lattner
8568122b41 add reverse iterators to smallvector
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41198 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-20 21:22:48 +00:00
Chris Lattner
6de84985a4 improve iplist comments. Switch iplist from allocating its sentinal object (for
end()) eagerly to allocating it lazily.  This saves a lot of memory for JIT applications
that read a module but don't materialize most of the functions (e.g. 62K for 252.eon).



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41142 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-17 16:49:19 +00:00
Chris Lattner
fe8e14a6c9 This adds a bunch of static functions that implement unsigned
two's complement bignum arithmetic.  They could be used to
implement much of APInt, but the idea is they are enough to
implement APFloat as well, which the current APInt interface
is not suited for.

Patch by Neil Booth!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41124 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-16 15:56:55 +00:00
Owen Anderson
3d345631db Forgot a line.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41115 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-16 00:25:42 +00:00
Owen Anderson
67280e1dd2 Add a copy constructor and an assignment operator to DenseMap.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41114 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-16 00:18:32 +00:00
Anton Korobeynikov
ebf0303810 Properly use const qualifiers
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41111 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-15 21:12:30 +00:00
Reid Spencer
276222a5ae 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41033 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-12 08:12:35 +00:00
Chris Lattner
4f155b4c85 memcpy with zero length is hugely expensive, so avoid it. This speeds up coallescing from 1.17s to 0.88s on siod.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40984 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-10 07:02:50 +00:00
Chris Lattner
02cee38647 small speedup in the case where a smallvector is default ctor'd from
an empty vector.  This speeds up llc slightly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40983 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-10 06:54:38 +00:00
Chandler Carruth
b1183c1ff3 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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40871 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-06 20:52:17 +00:00
Reid Spencer
f094f81d36 Document a missing parameter.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40852 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-05 19:36:39 +00:00
Chris Lattner
7b54452c84 Fix a bug in DenseMap::clear, where we never reset a tombstone
to EmptyKey.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40839 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-05 08:43:36 +00:00
Chris Lattner
42e4bdf257 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40837 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-05 07:32:14 +00:00
Anders Carlsson
bfbfcdafbe Fix bug spotted by Chris.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40725 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-02 06:05:19 +00:00
Anders Carlsson
7ccd9ec4f4 Add extend and extOrTrunc methods that do sign or zero extension depending on whether the integer is signed or not
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40724 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-02 06:00:13 +00:00
Owen Anderson
e992a56ae9 Allow SmallPtrSet to hold pointers to const data.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40556 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-27 18:07:02 +00:00
Chris Lattner
c6402013c8 Disable the string map copy ctor and assignment operators,
they don't do the right thing.  

Implement StringMap::erase.

Fix a nasty bug in the default ctor.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40395 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-22 20:08:01 +00:00
Owen Anderson
398b40671b Make the heuristic for shrinking DenseMap smarter.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40114 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-20 18:56:46 +00:00
Owen Anderson
6ad5fde5d0 Have DenseMap auto-shrink itself on clear(). This improves the time to optimize
403.gcc from 15.2s to 14.3s.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40100 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-20 16:15:24 +00:00
Reid Spencer
845b31de0c Unbreak the build by putting calls to free into the implementation file and
having that implementation file #include <cstdlib>.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@39952 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-17 02:16:12 +00:00
Owen Anderson
1629a1fa87 Use realloc() to (potentially) resize the contents of SmallPtrSet in place.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@39926 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-16 21:27:44 +00:00
Chris Lattner
f7b71c64cf add a helper method.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@39885 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-15 23:32:03 +00:00
Owen Anderson
c5c7f755c8 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@38481 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-10 02:01:16 +00:00
Owen Anderson
0c81450a0c When resizing a BitVector with size 0, be sure to clear the low word before using it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@38476 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-09 23:39:39 +00:00
Owen Anderson
4d6f96d699 Make the assignment operator for SmallPtrSet return a reference, and fix a long-standing bug in the copy
ctor while I'm at it.

Thanks to Chris Lattner for help with this patch.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@38470 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-09 20:59:01 +00:00
Chris Lattner
95fd3189f8 work around an aparent gcc name resolution bug by
detemplatizing this.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@38461 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-09 17:11:53 +00:00
Chris Lattner
91f0158d4d implement operator= for smallptrset
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@38460 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-09 16:54:03 +00:00
Dan Gohman
59310c3dc0 Add an explicit keyword. Thanks Chris!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37819 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-29 22:16:25 +00:00
John Criswell
e644ef7b09 Convert .cvsignore files
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37801 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-29 16:35:07 +00:00
Dan Gohman
8b42bcdd1a Add a default parameter to a SmallVector constructor to allow it to
be called with just an initial length value, just like in std::vector.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37779 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-28 20:27:24 +00:00
Owen Anderson
d3fb671480 Have internal df_iterator's use SmallPtrSet instead of std::set. This provides compile time speedups to any pass using df_iterator.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37694 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-21 21:25:36 +00:00
Chris Lattner
26b146ccf1 silence some "comparison between signed and unsigned integer expressions"
warnings


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37177 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-17 20:01:40 +00:00
Dan Gohman
df799afbec Fix some sporadic segfaults that are triggered when SmallVector's heap
storage lands near the end of the available address space. In the expression
Begin+N > Capacity, the Begin+N was overflowing. Fix this by replacing it
by with an expression that doesn't involve computation of an address
beyond the end of allocated memory.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37171 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-17 18:29:01 +00:00
Reid Spencer
19dc32a2d4 Add some things needed by the llvm-gcc version supporting bit accurate integer
types:
1. Functions to compute div/rem at the same time.
2. Further assurance that an APInt with 0 bitwidth cannot be constructed.
3. Left and right rotate operations.
4. An exactLogBase2 function which requires an exact power of two or it
   returns -1.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37025 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-13 23:44:59 +00:00
Chris Lattner
82493289e0 This is a patch to fix a compile error in STLExtras.h, and
a bug in GraphWriter.cpp.

Patch by Florian Brandner


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36684 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-03 18:32:10 +00:00
Chris Lattner
49e1580214 remove useless type qualifiers
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36676 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-03 17:09:36 +00:00
Jeff Cohen
2864b77efc Rename identifier that GCC uses as a macro, breaking llvm-gcc build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36474 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-26 15:07:47 +00:00