aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/ADT/APInt.h
Commit message (Collapse)AuthorAgeFilesLines
* Add an override to StringRef::getAsInteger which parses into an APInt.John McCall2010-02-281-0/+25
| | | | | | | | | | | | It gets its own implementation totally divorced from the (presumably performance-sensitive) routines which parse into a uint64_t. Add APInt::operator|=(uint64_t), which is situationally much better than using a full APInt. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97381 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach APFloat how to create both QNaNs and SNaNs and with arbitrary-widthJohn McCall2010-02-281-0/+3
| | | | | | | | | | payloads. APFloat's internal folding routines always make QNaNs now, instead of sometimes making QNaNs and sometimes SNaNs depending on the type. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97364 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a ceilLogBase2 function to APInt.Dan Gohman2009-10-131-0/+5
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83932 91177308-0d34-0410-b5e6-96231b3b80d8
* remove the dead std::ostream APInt inserterChris Lattner2009-08-231-5/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79875 91177308-0d34-0410-b5e6-96231b3b80d8
* Convert APint::{fromString,APInt,getBitsNeeded} to use StringRef.Daniel Dunbar2009-08-131-13/+13
| | | | | | | - Patch by Erick Tryzelaar, with some edits (and a bug fix) from me. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78885 91177308-0d34-0410-b5e6-96231b3b80d8
* Reapply 74494, this time removing the conflicting definition of operator<<Dan Gohman2009-06-301-0/+2
| | | | | | | in APIntTest.cpp. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74550 91177308-0d34-0410-b5e6-96231b3b80d8
* Temporarily revert r74494. It was causing failures in the unit tests.Bill Wendling2009-06-301-2/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74515 91177308-0d34-0410-b5e6-96231b3b80d8
* Define an operator<< for APInt to be used with std::ostream.Dan Gohman2009-06-301-0/+2
| | | | | | | | This will allow it to be used in unittests that use gtest's EXPECT_EQ. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74494 91177308-0d34-0410-b5e6-96231b3b80d8
* Move helper functions for optimizing division by constant into the APIntJay Foad2009-04-301-0/+25
| | | | | | class. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70488 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a static APInt::getNumWordsDouglas Gregor2009-04-131-0/+8
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68977 91177308-0d34-0410-b5e6-96231b3b80d8
* Use CHAR_BIT instead of hard-coding 8 in several places where itDan Gohman2009-04-011-1/+3
| | | | | | | | is appropriate. This helps visually differentiate host-oriented calculations from target-oriented calculations. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68227 91177308-0d34-0410-b5e6-96231b3b80d8
* Fixed lint errors:Misha Brukman2009-02-201-1/+2
| | | | | | | | | * Alphabetized #includes * Removed trailing whitespace * Wrapped or shortened lines over 80 chars git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@65181 91177308-0d34-0410-b5e6-96231b3b80d8
* These function return 'void'. Don't have 'return' return anything.Bill Wendling2009-02-091-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64136 91177308-0d34-0410-b5e6-96231b3b80d8
* eliminate use of uint32_t to improve compatibility with cygwinChris Lattner2009-01-201-76/+76
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62591 91177308-0d34-0410-b5e6-96231b3b80d8
* Removed trailing whitespace.Misha Brukman2009-01-091-93/+93
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62000 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix isIntN to work with APInts > 64 bits. This method is onlyChris Lattner2008-12-021-5/+7
| | | | | | | used by clang apparently. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60446 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix bogus assertion using getSExtValue for legitimate values, like -1 in Eli Friedman2008-12-011-1/+1
| | | | | | | | | an 128-bit-wide integer. No testcase; the issue I ran into depends on local changes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60311 91177308-0d34-0410-b5e6-96231b3b80d8
* random cleanupChris Lattner2008-10-111-2/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57383 91177308-0d34-0410-b5e6-96231b3b80d8
* Switch the asmprinter (.ll) and all the stuff it requires over toChris Lattner2008-08-231-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55263 91177308-0d34-0410-b5e6-96231b3b80d8
* remove redundant includeChris Lattner2008-08-211-1/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55116 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix the build with gcc 4.3 as the host, patch by Zhongxing Xu!Chris Lattner2008-08-211-0/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55115 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix build on GCC 4.3.Nick Lewycky2008-08-211-0/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55110 91177308-0d34-0410-b5e6-96231b3b80d8
* Move the fast-path (<=i64) cases of various APInt methods inlineChris Lattner2008-08-201-20/+159
| | | | | | | | and the slow-path cases out of line. This speeds up instcombine a bit in real world cases. Patch contributed by m-s. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55063 91177308-0d34-0410-b5e6-96231b3b80d8
* Rework the routines that convert AP[S]Int into a string. Now, instead ofChris Lattner2008-08-171-12/+25
| | | | | | | | | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54873 91177308-0d34-0410-b5e6-96231b3b80d8
* remove a dead APInt ctor.Chris Lattner2008-08-171-13/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54869 91177308-0d34-0410-b5e6-96231b3b80d8
* Correct a comment.Duncan Sands2008-07-101-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53401 91177308-0d34-0410-b5e6-96231b3b80d8
* First step to fix PR2088. Implement routine to compute the Wojciech Matyjewicz2008-06-231-4/+9
| | | | | | | | | multiplicative inverse of a given number. Modify udivrem to allow input and output pairs of arguments to overlap. Patch is based on the work by Chandler Carruth. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52638 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove some DAG combiner assumptions about sizesDuncan Sands2008-06-091-2/+3
| | | | | | | | | | | | of integer types. Fix the isMask APInt method to actually work (hopefully) rather than crashing because it adds apints of different bitwidths. It looks like isShiftedMask is also broken, but I'm leaving that one to the APInt people (it is not used anywhere). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52142 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix an error in the comment for APInt::getMinSignedBits.Dan Gohman2008-05-301-3/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51720 91177308-0d34-0410-b5e6-96231b3b80d8
* Suppress -Wshorten-64-to-32 warnings for 64-bit hosts.Evan Cheng2008-05-021-3/+6
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50590 91177308-0d34-0410-b5e6-96231b3b80d8
* Add support to APInt for shift and rotate operations with APIntDan Gohman2008-02-291-0/+22
| | | | | | | instead of uint32_t for the shift/rotate count operand type. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47741 91177308-0d34-0410-b5e6-96231b3b80d8
* DetabifyBill Wendling2008-02-261-13/+13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47597 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove inline keywords from in-class function definitions, forDan Gohman2008-02-201-32/+32
| | | | | | | consistency. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47393 91177308-0d34-0410-b5e6-96231b3b80d8
* Add an intersects method to APInt, to capture a common idiom.Dan Gohman2008-02-201-0/+6
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47379 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a typo in a comment.Dan Gohman2008-02-131-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47097 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename APInt's isPositive to isNonNegative, to reflect what itDan Gohman2008-02-131-6/+7
| | | | | | | actually does. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47090 91177308-0d34-0410-b5e6-96231b3b80d8
* Add countTrailingOnes member functions to APInt.Dan Gohman2008-02-131-2/+12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47086 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a typo in a comment.Dan Gohman2008-02-131-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47085 91177308-0d34-0410-b5e6-96231b3b80d8
* Change APInt::getBitsSet to accept a "half-open" range, where theDan Gohman2008-02-121-7/+7
| | | | | | | hiBit parameter marks the index one past the last desired set bit. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47032 91177308-0d34-0410-b5e6-96231b3b80d8
* Correct the order of the arguments in the examples in the commentsDan Gohman2008-02-111-3/+3
| | | | | | | for APInt::getBitsSet. And fix an off-by-one bug in "wrapping" mode. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46978 91177308-0d34-0410-b5e6-96231b3b80d8
* Add an isSignedIntN, like isIntN but for signed integer values instead ofDan Gohman2008-02-081-2/+13
| | | | | | | unsigned. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46894 91177308-0d34-0410-b5e6-96231b3b80d8
* Changed argument name for 'Profile' method to potentially fix a name conflictTed Kremenek2008-01-191-1/+1
| | | | | | | reported in pr1929 (http://llvm.org/PR1929). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46193 91177308-0d34-0410-b5e6-96231b3b80d8
* Added FoldingSet style 'profiling' support for APInt.Ted Kremenek2008-01-191-0/+5
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46188 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't attribute in file headers anymore. See llvmdev for theChris Lattner2007-12-291-2/+2
| | | | | | | | discussion of this change. Boy are my fingers tired. ;-) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45411 91177308-0d34-0410-b5e6-96231b3b80d8
* eliminate dependency on Bitcode headers.Chris Lattner2007-12-081-2/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44709 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix PR1816, by correcting the broken definition of APInt::countTrailingZeros.Chris Lattner2007-11-231-4/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44296 91177308-0d34-0410-b5e6-96231b3b80d8
* Fixed default ctor for APInt to properly initialize BitWidth to aTed Kremenek2007-11-071-1/+1
| | | | | | | non-random value. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43795 91177308-0d34-0410-b5e6-96231b3b80d8
* Added serialization support for APInt.Ted Kremenek2007-10-261-0/+11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43405 91177308-0d34-0410-b5e6-96231b3b80d8
* Fixed incorrect "path name" in preamble (comment) of header file.Ted Kremenek2007-10-261-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43401 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a new function tcExtract for extracting a bignum from anNeil Booth2007-10-081-0/+7
| | | | | | | | | | | | | | | 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