1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 19:12:56 +02:00
Commit Graph

42 Commits

Author SHA1 Message Date
Nick Lewycky
3b459607de Fix ConstantRange::unionWith. Also make it work a little hard in some cases to
return the smallest union of two ranges instead of just any range that happens
to contain the union.

llvm-svn: 76360
2009-07-19 03:44:35 +00:00
Nick Lewycky
ec10fcbd04 Replace intersectWith with maximalIntersectWith. The latter guarantees that
all values belonging to the intersection will belong to the resulting range.
The former was inconsistent about that point (either way is fine, just pick
one.) This is part of PR4545.

llvm-svn: 76289
2009-07-18 06:34:42 +00:00
Nick Lewycky
0cc1d245c4 Fix an error in ConstantRange::getSignedMax on wrapped ranges. Thanks once
again to Daniel Dunbar and KLEE!

llvm-svn: 75449
2009-07-13 04:50:21 +00:00
Nick Lewycky
41a9bdab7b 'i8 full-range' sign extended to i16 should equal [-128, 128) not [-128, 127).
Found by Daniel Dunbar and KLEE.

llvm-svn: 75448
2009-07-13 04:17:23 +00:00
Nick Lewycky
fee90bcb80 Multiply was very wrong for wrapped ranges. This supplies a half-fix that will
generally return Full on all wrapped inputs. "Fixes" PR4545.

llvm-svn: 75444
2009-07-13 03:27:41 +00:00
Nick Lewycky
7280c39dc7 Fix a bug summing two full sets. The overflow checking doesn't handle sets as
large as the full set, only those one size smaller. Thanks to Daniel Dunbar
who found this bug using Klee!

llvm-svn: 75443
2009-07-13 02:49:08 +00:00
Nick Lewycky
dc5ef94320 Implement udiv for ConstantRanges.
llvm-svn: 75413
2009-07-12 05:18:18 +00:00
Nick Lewycky
6663d6ad6f Implement ConstantRange::multiply based on the code in LoopVR.
llvm-svn: 75410
2009-07-12 02:19:05 +00:00
Nick Lewycky
3e43cd4105 Fix handling of max and full set.
A full set is a constant range that represents any number. If you take the
umax of that and [5, 10) you end up with [5, INT_MAX] because the values less
than 5 would be umax's against a value which is at least 5.

llvm-svn: 75372
2009-07-11 19:22:21 +00:00
Nick Lewycky
58a6fd9824 Clarify and simplify.
llvm-svn: 75366
2009-07-11 17:04:01 +00:00
Nick Lewycky
fee40fdcd9 Move a method that creates constant ranges relative to another constant range
per icmp predicate out of predsimplify and into ConstantRange.

Add another utility method that determines whether one range is a subset of
another. Combine with the former to determine whether icmp pred range, range
is known to be true or not.

llvm-svn: 75357
2009-07-11 06:15:39 +00:00
Dan Gohman
8a58b8f83b Revert the part of 75177 that split ConstantRange into two classes, and
merge the new functionality and unittests into ConstantRange. Thanks to
Nick Lewycky for pointing out that it isn't necessary to have two separate
classes here.

llvm-svn: 75191
2009-07-09 23:16:10 +00:00
Dan Gohman
33251eff97 Add a ConstantSignedRange class, which does for signed integers
what ConstantRange does for unsigned integers. Factor out a
common base class for common functionality.

Add some new functions for performing arithmetic on constant
ranges. Some of these are currently just stubbed out with
conservative implementations.

Add unittests for ConstantRange and ConstantSignedRange.

llvm-svn: 75177
2009-07-09 22:07:27 +00:00
Chris Lattner
fe3155fc62 Switch the asmprinter (.ll) and all the stuff it requires over to
use raw_ostream instead of std::ostream.  Among other goodness,
this speeds up llvm-dis of kc++ with a release build from 0.85s
to 0.49s (88% faster).

Other interesting changes:
 1) This makes Value::print be non-virtual.
 2) AP[S]Int and ConstantRange can no longer print to ostream directly, 
    use raw_ostream instead.
 3) This fixes a bug in raw_os_ostream where it didn't flush itself 
    when destroyed.
 4) This adds a new SDNode::print method, instead of only allowing "dump".


A lot of APIs have both std::ostream and raw_ostream versions, it would
be useful to go through and systematically anihilate the std::ostream 
versions.

This passes dejagnu, but there may be minor fallout, plz let me know if
so and I'll fix it.

llvm-svn: 55263
2008-08-23 22:23:09 +00:00
Chris Lattner
c0610874cc Rework the routines that convert AP[S]Int into a string. Now, instead of
returning an std::string by value, it fills in a SmallString/SmallVector
passed in.  This significantly reduces string thrashing in some cases.

More specifically, this:
 - Adds an operator<< and a print method for APInt that allows you to 
   directly send them to an ostream.
 - Reimplements APInt::toString to be much simpler and more efficient
   algorithmically in addition to not thrashing strings quite as much.

This speeds up llvm-dis on kc++ by 7%, and may also slightly speed up the
asmprinter.  This also fixes a bug I introduced into the asmwriter in a
previous patch w.r.t. alias printing.

llvm-svn: 54873
2008-08-17 07:19:36 +00:00
Dan Gohman
92d5dff525 Tidy up whitespace in ConstantRange::print output.
llvm-svn: 51606
2008-05-27 20:29:07 +00:00
Chris Lattner
ad9a6ccb83 Remove attribution from file headers, per discussion on llvmdev.
llvm-svn: 45418
2007-12-29 20:36:04 +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
Nick Lewycky
e03bd9ddbb Fix edge case.
llvm-svn: 37532
2007-06-09 04:20:33 +00:00
Zhou Sheng
8c150f133c Using APInt more efficiently.
llvm-svn: 36475
2007-04-26 16:42:07 +00:00
Zhou Sheng
dedfc40044 Make the apint construction more effective.
llvm-svn: 35960
2007-04-13 05:57:32 +00:00
Nick Lewycky
ec51e934ef Add signExtend to ConstantRange, to complement zeroExtend and truncate.
llvm-svn: 35733
2007-04-07 15:41:33 +00:00
Nick Lewycky
03f9c0ffc9 Implement union of wrapped sets.
llvm-svn: 35534
2007-04-01 03:47:44 +00:00
Nick Lewycky
2af4a3ab17 Add getter methods for the extremes of a ConstantRange.
llvm-svn: 35056
2007-03-10 15:54:12 +00:00
Nick Lewycky
29f7380f34 Implement unionWith.
llvm-svn: 34833
2007-03-02 03:33:05 +00:00
Reid Spencer
3f3487918c Remove the "isSigned" parameters from ConstantRange. It turns out they
are not needed as the results are the same with or without it.

Patch by Nicholas Lewycky.

llvm-svn: 34782
2007-03-01 07:54:15 +00:00
Reid Spencer
f119927a6f Move ConstantRange class to lib/Support from lib/Analysis and make its
interface not depend on Type or ICmpInst.

llvm-svn: 34761
2007-02-28 22:02:48 +00:00
Misha Brukman
7c32d35f9e Move these files (which are dependent on VMCore) into VMCore
llvm-svn: 15825
2004-08-16 19:04:36 +00:00
Chris Lattner
ffd5effa5f Bug fixes for PR341
llvm-svn: 14838
2004-07-15 01:29:12 +00:00
Reid Spencer
50ec3f9325 Add #include <iostream> since Value.h does not #include it any more.
llvm-svn: 14622
2004-07-04 12:19:56 +00:00
Chris Lattner
e78381e9f1 Add some new methods
llvm-svn: 12539
2004-03-30 00:20:08 +00:00
Chris Lattner
dd7ed2912e Adjust to new itf
llvm-svn: 12534
2004-03-29 20:42:49 +00:00
Chris Lattner
2ff33e72ba Remove use of ConstantHandling itf
llvm-svn: 10800
2004-01-12 20:13:04 +00:00
Chris Lattner
2fdf5e32aa Finegrainify namespacification
llvm-svn: 10464
2003-12-14 21:35:53 +00:00
Brian Gaeke
d25f86d683 Put all LLVM code into the llvm namespace, as per bug 109.
llvm-svn: 9903
2003-11-11 22:41:34 +00:00
John Criswell
b402729b30 Added LLVM project notice to the top of every C++ source file.
Header files will be on the way.

llvm-svn: 9298
2003-10-20 19:43:21 +00:00
Chris Lattner
6ad460b336 Simplify code by using ConstantInt::getRawValue instead of checking to see
whether the constant is signed or unsigned, then casting

llvm-svn: 7252
2003-07-23 15:22:26 +00:00
Chris Lattner
fa03431b04 Minor bug fix.
llvm-svn: 3577
2002-09-03 23:12:40 +00:00
Chris Lattner
1d80a4fb6c Fix bugs
llvm-svn: 3569
2002-09-02 20:49:27 +00:00
Chris Lattner
1d7454a065 Add printing support to ConstantRange class
llvm-svn: 3565
2002-09-02 00:18:22 +00:00
Chris Lattner
dde20e4a6b Initial implementation of ConstantRange support
llvm-svn: 3563
2002-09-01 23:53:36 +00:00