Commit Graph

651 Commits

Author SHA1 Message Date
Dale Johannesen
cce23a4c35 Simplify and fix signed int -> FP conversions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42483 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-30 18:17:01 +00:00
Neil Booth
4f88170be0 Whitespace and compiler warning cleanup.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42373 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-26 21:33:42 +00:00
Dale Johannesen
0edc47ad7b Make APFloat->int conversions deterministic even in
cases with undefined behavior.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42328 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-25 23:07:07 +00:00
Dale Johannesen
902ff94aff Fix long double<->shorter FP type conversions
of zero, infinity, and NaNs.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42298 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-25 17:25:00 +00:00
Neil Booth
c8db43ddaf Handle storage complications of float->float conversions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42220 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-22 02:56:19 +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
Dale Johannesen
a72a5a095d Fix PR 1688. See comments there.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42181 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-20 23:47:58 +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
2204906892 fix a gcc warning: comparison between signed and unsigned integer expressions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41972 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-14 22:57:00 +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
Dan Gohman
cb648f90a2 Remove spurious consts. This fixes warnings with compilers that
are strict about such things.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41956 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-14 20:08:19 +00:00
Dale Johannesen
257500db04 Compensate for partCount change in Bogus definition
(could break hash table in ConstantFP)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41874 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-12 01:22:05 +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
Evan Cheng
7dfda9e674 Smarter Reset(). Instead of deallocating all memory regions and reallocate the
first region, just deallocate all but the last region in the list.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41782 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-08 00:02:17 +00:00
Evan Cheng
188b5224fd Added Reset() to free all allocated memory regions and reset state to be the same as right after ctor.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41728 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-05 21:41:34 +00:00
Dale Johannesen
58c2e4c5fd Fix mod so it actually works. Fix conversions to
native types to handle denormals correctly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41726 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-05 20:39:49 +00:00
Dale Johannesen
e15c2db993 Oops, should be part of 41664; won't work very well without this piece.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41665 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-31 23:35:31 +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
Dale Johannesen
f04afdbb48 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41587 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-30 00:23:21 +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
Chris Lattner
ada530b4f5 silence some warnings in an optimized build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41352 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-24 03:02:34 +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
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
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
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
2372ccc111 Make getSTDIN return null if the standard input is empty, as the header file
documentation implies and as its uses depend.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40939 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-08 20:01:58 +00:00
Reid Spencer
c69b0dd19d Escape some escapes that confuse doxygen.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40850 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-05 19:33:11 +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
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
Owen Anderson
bf31b85ea2 Make the copy constructor of SmallPtrSet much faster.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40474 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-24 21:31:23 +00:00
Owen Anderson
71a1e57d18 Remember to free the heap allocated array if we're not going to use it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40043 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-19 06:45:33 +00:00
Owen Anderson
b54b315251 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().


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40014 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-18 19:54:15 +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
Nick Lewycky
28753f8df2 Clarify the language. Pointed out by Duncan Sands.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@39857 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-14 17:41:03 +00:00
Nick Lewycky
377b1190cb Add alternate ConstantRange intersection algorithm.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@39851 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-14 02:51:34 +00:00
Owen Anderson
69b5d12676 Make the assignment operator for SmallPtrSet much faster for normal cases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@38474 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-09 22:27:20 +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
Owen Anderson
da8ebc6b43 Fix an error in the assignment operator that was causing an infinite loop in GVNPRE.cpp.
Patch by Chis Lattner.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@38467 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-09 18:51:15 +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
Gabor Greif
a99be51bf5 Here is the bulk of the sanitizing.
Almost all occurrences of "bytecode" in the sources have been eliminated.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37913 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-05 17:07:56 +00:00
Nick Lewycky
ea332946d3 Fix undefined behaviour reported by the new --enable-expensive-checks option.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37829 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-01 03:06:30 +00:00
Owen Anderson
6394e5e4fd Fix a bug in SmallPtrSet that was causing GVNPRE to enter an infinite loop.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37697 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-22 00:11:18 +00:00
Chris Lattner
61766cae0b Two changes:
1. Make SmallPtrSet::erase faster in the small case by replacing a memmove
    with a pointer copy.
 2. Fix a bug where the null terminator at the end of the array in the small
    case was not copied


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37696 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-21 23:23:32 +00:00
Nick Lewycky
ae5eb7accf Fix edge case.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37532 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-09 04:20:33 +00:00
Dale Johannesen
81da02b553 Make tail merging the default, except on powerPC. There was no prior art
for a target-dependent default with a command-line override; this way
should be generally usable.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37285 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-22 17:14:46 +00:00
Reid Spencer
20a4c23bcc Fix an assertion introduced by my last change to the toString method. We
can't use getZExtValue() to extract the low order bits for each digit.
Instead, we need to access the low order word directly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37242 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-19 00:29:55 +00:00