Neil Booth
db4dbedfea
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.
llvm-svn: 42733
2007-10-07 12:07:53 +00:00
Neil Booth
6e01c5df37
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.
llvm-svn: 42732
2007-10-07 11:45:55 +00:00
Neil Booth
726126f4d6
combineLostFractions does not need to be a member function
...
llvm-svn: 42729
2007-10-07 08:51:21 +00:00
Neil Booth
beba899ff0
Cleaner, more general exponent output.
...
llvm-svn: 42690
2007-10-06 07:29:25 +00:00
Chris Lattner
a1de966c80
silence warnings in no-assert build.
...
llvm-svn: 42687
2007-10-06 06:13:42 +00:00
Neil Booth
0613ec4ee6
Fix and clarify some comments.
...
llvm-svn: 42670
2007-10-06 00:43:45 +00:00
Neil Booth
2c4419d71b
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.
llvm-svn: 42669
2007-10-06 00:24:48 +00:00
Neil Booth
2dc065755d
Add APFloat -> hexadecimal string conversion, as per %a and %A in C99.
...
Useful for diagnostics and debugging.
llvm-svn: 42598
2007-10-03 22:26:02 +00:00
Chris Lattner
de233151af
Add initial iterator support for folding set.
...
llvm-svn: 42589
2007-10-03 21:12:09 +00:00
Chris Lattner
8955442092
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
Neil Booth
1e709921bc
Tweak RoundAwayFromZero the bit number below which is truncated, and make
...
it const.
Preparation for APFloat -> hexadecimal string conversion.
llvm-svn: 42576
2007-10-03 15:16:41 +00:00
Dale Johannesen
4b203b8e44
Simplify and fix signed int -> FP conversions.
...
llvm-svn: 42483
2007-09-30 18:17:01 +00:00
Neil Booth
3b53530d78
Whitespace and compiler warning cleanup.
...
llvm-svn: 42373
2007-09-26 21:33:42 +00:00
Dale Johannesen
bc41438bab
Make APFloat->int conversions deterministic even in
...
cases with undefined behavior.
llvm-svn: 42328
2007-09-25 23:07:07 +00:00
Dale Johannesen
ee2f3359f4
Fix long double<->shorter FP type conversions
...
of zero, infinity, and NaNs.
llvm-svn: 42298
2007-09-25 17:25:00 +00:00
Neil Booth
8cb885c389
Handle storage complications of float->float conversions.
...
llvm-svn: 42220
2007-09-22 02:56:19 +00:00
Dale Johannesen
c7279629cc
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.
llvm-svn: 42210
2007-09-21 22:09:37 +00:00
Dale Johannesen
346a949bd8
Fix PR 1688. See comments there.
...
llvm-svn: 42181
2007-09-20 23:47:58 +00:00
Devang Patel
547d418b8e
Do not hide APInt::dump() inside #ifndef NDEBUG.
...
llvm-svn: 42068
2007-09-17 22:24:00 +00:00
Chris Lattner
bb109aed3d
fix a gcc warning: comparison between signed and unsigned integer expressions
...
llvm-svn: 41972
2007-09-14 22:57:00 +00:00
Dale Johannesen
575bd6070a
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
1c9bf0bfb9
And an FoldingSetImpl::NodeID::AddInteger overload for int64_t, to avoid
...
ambiguity.
llvm-svn: 41960
2007-09-14 20:48:42 +00:00
Dan Gohman
53119779c2
Remove spurious consts. This fixes warnings with compilers that
...
are strict about such things.
llvm-svn: 41956
2007-09-14 20:08:19 +00:00
Dale Johannesen
4b03ae1ff5
Compensate for partCount change in Bogus definition
...
(could break hash table in ConstantFP)
llvm-svn: 41874
2007-09-12 01:22:05 +00:00
Dale Johannesen
7bc3969cea
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).
llvm-svn: 41858
2007-09-11 18:32:33 +00:00
Evan Cheng
e6c68e7668
Smarter Reset(). Instead of deallocating all memory regions and reallocate the
...
first region, just deallocate all but the last region in the list.
llvm-svn: 41782
2007-09-08 00:02:17 +00:00
Evan Cheng
5977c55f5d
Added Reset() to free all allocated memory regions and reset state to be the same as right after ctor.
...
llvm-svn: 41728
2007-09-05 21:41:34 +00:00
Dale Johannesen
1d92d23a89
Fix mod so it actually works. Fix conversions to
...
native types to handle denormals correctly.
llvm-svn: 41726
2007-09-05 20:39:49 +00:00
Dale Johannesen
b336f6207c
Oops, should be part of 41664; won't work very well without this piece.
...
llvm-svn: 41665
2007-08-31 23:35:31 +00:00
Dale Johannesen
81d6ecb886
Enhance APFloat to retain bits of NaNs (fixes oggenc).
...
Use APFloat interfaces for more references, mostly
of ConstantFPSDNode.
llvm-svn: 41632
2007-08-31 04:03:46 +00:00
Dale Johannesen
e91a908971
Change LegalFPImmediates to use APFloat.
...
Add APFloat interfaces to ConstantFP, SelectionDAG.
Fix integer bit in double->APFloat conversion.
Convert LegalizeDAG to use APFloat interface in
ConstantFPSDNode uses.
llvm-svn: 41587
2007-08-30 00:23:21 +00:00
Dale Johannesen
9ec1e28e79
Poison APFloat::operator==. Replace existing uses with bitwiseIsEqual.
...
This means backing out the preceding change to Constants.cpp, alas.
llvm-svn: 41378
2007-08-24 22:09:56 +00:00
Dale Johannesen
0aaabb858b
Revised per review feedback from previous patch.
...
llvm-svn: 41353
2007-08-24 05:08:11 +00:00
Chris Lattner
91df26be0f
silence some warnings in an optimized build.
...
llvm-svn: 41352
2007-08-24 03:02:34 +00:00
Dale Johannesen
a3ab055b9d
Change internal representation of ConstantFP to use APFloat.
...
Interface to rest of the compiler unchanged, as yet.
llvm-svn: 41348
2007-08-24 00:56:33 +00:00
Chris Lattner
742b745b0c
rename APInt::toString -> toStringUnsigned for symmetry with toStringSigned()
...
Add an APSInt::toString() method.
llvm-svn: 41309
2007-08-23 05:15:32 +00:00
Chris Lattner
401698e8b5
initial checkin of Neil's APFloat work.
...
llvm-svn: 41203
2007-08-20 22:49:32 +00:00
Chris Lattner
4c6c787315
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!
llvm-svn: 41124
2007-08-16 15:56:55 +00:00
Anton Korobeynikov
958dcad32d
Properly use const qualifiers
...
llvm-svn: 41111
2007-08-15 21:12:30 +00:00
Reid Spencer
e8aa5a5832
Make getSTDIN return null if the standard input is empty, as the header file
...
documentation implies and as its uses depend.
llvm-svn: 40939
2007-08-08 20:01:58 +00:00
Reid Spencer
0de4350acf
Escape some escapes that confuse doxygen.
...
llvm-svn: 40850
2007-08-05 19:33:11 +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
997b15d967
Allow SmallPtrSet to hold pointers to const data.
...
llvm-svn: 40556
2007-07-27 18:07:02 +00:00
Owen Anderson
f22326ad3d
Make the copy constructor of SmallPtrSet much faster.
...
llvm-svn: 40474
2007-07-24 21:31:23 +00:00
Owen Anderson
21e3bd1cdc
Remember to free the heap allocated array if we're not going to use it.
...
llvm-svn: 40043
2007-07-19 06:45:33 +00:00
Owen Anderson
03b56ad400
Fix an issue where assignments that caused a SmallPtrSet to become non-small
...
would result in calling realloc() on a null pointer. Instead, if we encounter
this situation, make a normal call to malloc().
llvm-svn: 40014
2007-07-18 19:54:15 +00:00
Reid Spencer
3dd7b1699b
Unbreak the build by putting calls to free into the implementation file and
...
having that implementation file #include <cstdlib>.
llvm-svn: 39952
2007-07-17 02:16:12 +00:00
Owen Anderson
f01c29815d
Use realloc() to (potentially) resize the contents of SmallPtrSet in place.
...
llvm-svn: 39926
2007-07-16 21:27:44 +00:00
Nick Lewycky
701e227136
Clarify the language. Pointed out by Duncan Sands.
...
llvm-svn: 39857
2007-07-14 17:41:03 +00:00
Nick Lewycky
42e8a060a0
Add alternate ConstantRange intersection algorithm.
...
llvm-svn: 39851
2007-07-14 02:51:34 +00:00