Commit Graph

32 Commits

Author SHA1 Message Date
Nick Lewycky dcfdce9067 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 dc33ae27ed 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 5035fbf91c 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 0c19df4871 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 17f7165f84 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 e3a6a18364 Tidy up whitespace in ConstantRange::print output.
llvm-svn: 51606
2008-05-27 20:29:07 +00:00
Chris Lattner f3ebc3f3d2 Remove attribution from file headers, per discussion on llvmdev.
llvm-svn: 45418
2007-12-29 20:36:04 +00:00
Nick Lewycky ddc2f9ba57 Clarify the language. Pointed out by Duncan Sands.
llvm-svn: 39857
2007-07-14 17:41:03 +00:00
Nick Lewycky 61b4a265ee Add alternate ConstantRange intersection algorithm.
llvm-svn: 39851
2007-07-14 02:51:34 +00:00
Nick Lewycky d18b16034a Fix edge case.
llvm-svn: 37532
2007-06-09 04:20:33 +00:00
Zhou Sheng 3178736d50 Using APInt more efficiently.
llvm-svn: 36475
2007-04-26 16:42:07 +00:00
Zhou Sheng 01c175ec52 Make the apint construction more effective.
llvm-svn: 35960
2007-04-13 05:57:32 +00:00
Nick Lewycky b89804f246 Add signExtend to ConstantRange, to complement zeroExtend and truncate.
llvm-svn: 35733
2007-04-07 15:41:33 +00:00
Nick Lewycky f22938af1b Implement union of wrapped sets.
llvm-svn: 35534
2007-04-01 03:47:44 +00:00
Nick Lewycky e455937fae Add getter methods for the extremes of a ConstantRange.
llvm-svn: 35056
2007-03-10 15:54:12 +00:00
Nick Lewycky cf87f9eef5 Implement unionWith.
llvm-svn: 34833
2007-03-02 03:33:05 +00:00
Reid Spencer 6a44033465 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 9b3d6ec983 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 30cee49933 Move these files (which are dependent on VMCore) into VMCore
llvm-svn: 15825
2004-08-16 19:04:36 +00:00
Chris Lattner cae777bb4f Bug fixes for PR341
llvm-svn: 14838
2004-07-15 01:29:12 +00:00
Reid Spencer eb04d9bcb4 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 55481f78d3 Add some new methods
llvm-svn: 12539
2004-03-30 00:20:08 +00:00
Chris Lattner 5152b9ed34 Adjust to new itf
llvm-svn: 12534
2004-03-29 20:42:49 +00:00
Chris Lattner b1505c8594 Remove use of ConstantHandling itf
llvm-svn: 10800
2004-01-12 20:13:04 +00:00
Chris Lattner c9499b6a20 Finegrainify namespacification
llvm-svn: 10464
2003-12-14 21:35:53 +00:00
Brian Gaeke 960707c335 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 482202a601 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 6077c3195f 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 d4645902e6 Minor bug fix.
llvm-svn: 3577
2002-09-03 23:12:40 +00:00
Chris Lattner 5d2bce8555 Fix bugs
llvm-svn: 3569
2002-09-02 20:49:27 +00:00
Chris Lattner e0bb9ebc6d Add printing support to ConstantRange class
llvm-svn: 3565
2002-09-02 00:18:22 +00:00
Chris Lattner 113f2aec70 Initial implementation of ConstantRange support
llvm-svn: 3563
2002-09-01 23:53:36 +00:00