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

138 Commits

Author SHA1 Message Date
Jay Foad
c663d7e4f6 PR5207: Make APInt::set(), APInt::clear() and APInt::flip() return void.
llvm-svn: 120413
2010-11-30 09:02:01 +00:00
Jay Foad
eb28ac4a7a PR5207: remove unused methods APInt::Emit() and APInt::Read().
llvm-svn: 120262
2010-11-28 21:05:31 +00:00
Jay Foad
7378352505 PR5207: change APInt::doubleToBits() and APInt::floatToBits() to be
static methods that return a new APInt.

llvm-svn: 120261
2010-11-28 21:04:48 +00:00
Dan Gohman
67f95d770b Factor code out of APInt to form a isUIntN helper function.
llvm-svn: 118133
2010-11-03 00:38:40 +00:00
Chris Lattner
451a0accb5 add uadd_ov/usub_ov to apint, consolidate constant folding
logic to use the new APInt methods.  Among other things this
implements rdar://8501501 - llvm.smul.with.overflow.i32 should constant fold

which comes from "clang -ftrapv", originally brought to my attention from PR8221.

llvm-svn: 116457
2010-10-14 00:05:07 +00:00
Chris Lattner
365326538a missed a line :(
llvm-svn: 116456
2010-10-13 23:57:00 +00:00
Chris Lattner
093d5fe0a9 constify these methods.
llvm-svn: 116455
2010-10-13 23:54:10 +00:00
Chris Lattner
70a78ab2c5 add a few operations for signed operations that also
return an overflow flag.

llvm-svn: 116452
2010-10-13 23:46:33 +00:00
Benjamin Kramer
1725ef6c89 Use getAllOnesValue, saves a copy and looks better.
llvm-svn: 110991
2010-08-13 00:29:44 +00:00
Benjamin Kramer
da3e6cdb26 Don't pass StringRef by reference.
llvm-svn: 108366
2010-07-14 22:38:02 +00:00
Dan Gohman
127f5c53e1 Add variants of ult, ule, etc. which take a uint64_t RHS, for convenience.
llvm-svn: 100824
2010-04-08 23:03:40 +00:00
John McCall
b6e6dd63ad Add an override to StringRef::getAsInteger which parses into an APInt.
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.

llvm-svn: 97381
2010-02-28 09:55:58 +00:00
John McCall
69bc985550 Teach APFloat how to create both QNaNs and SNaNs and with arbitrary-width
payloads.  APFloat's internal folding routines always make QNaNs now,
instead of sometimes making QNaNs and sometimes SNaNs depending on the
type.

llvm-svn: 97364
2010-02-28 02:51:25 +00:00
Dan Gohman
f9067da535 Add a ceilLogBase2 function to APInt.
llvm-svn: 83932
2009-10-13 01:49:02 +00:00
Chris Lattner
c02ffc37e0 remove the dead std::ostream APInt inserter
llvm-svn: 79875
2009-08-23 23:11:28 +00:00
Daniel Dunbar
3a5a25d5d5 Convert APint::{fromString,APInt,getBitsNeeded} to use StringRef.
- Patch by Erick Tryzelaar, with some edits (and a bug fix) from me.

llvm-svn: 78885
2009-08-13 02:33:34 +00:00
Dan Gohman
148d3bb9b4 Reapply 74494, this time removing the conflicting definition of operator<<
in APIntTest.cpp.

llvm-svn: 74550
2009-06-30 20:10:56 +00:00
Bill Wendling
1121a4ce5e Temporarily revert r74494. It was causing failures in the unit tests.
llvm-svn: 74515
2009-06-30 07:05:27 +00:00
Dan Gohman
f207911974 Define an operator<< for APInt to be used with std::ostream.
This will allow it to be used in unittests that use gtest's
EXPECT_EQ.

llvm-svn: 74494
2009-06-30 01:28:08 +00:00
Jay Foad
9768cabf4a Move helper functions for optimizing division by constant into the APInt
class.

llvm-svn: 70488
2009-04-30 10:15:35 +00:00
Douglas Gregor
d2b9d57e20 Add a static APInt::getNumWords
llvm-svn: 68977
2009-04-13 19:43:10 +00:00
Dan Gohman
770f4158e5 Use CHAR_BIT instead of hard-coding 8 in several places where it
is appropriate. This helps visually differentiate host-oriented
calculations from target-oriented calculations.

llvm-svn: 68227
2009-04-01 18:45:54 +00:00
Misha Brukman
380e3db1b4 Fixed lint errors:
* Alphabetized #includes
* Removed trailing whitespace
* Wrapped or shortened lines over 80 chars

llvm-svn: 65181
2009-02-20 22:20:18 +00:00
Bill Wendling
a03453cace These function return 'void'. Don't have 'return' return anything.
llvm-svn: 64136
2009-02-09 12:31:26 +00:00
Chris Lattner
816e00f6a0 eliminate use of uint32_t to improve compatibility with cygwin
llvm-svn: 62591
2009-01-20 18:23:14 +00:00
Misha Brukman
da77da48f3 Removed trailing whitespace.
llvm-svn: 62000
2009-01-09 19:25:42 +00:00
Chris Lattner
a249224590 Fix isIntN to work with APInts > 64 bits. This method is only
used by clang apparently.

llvm-svn: 60446
2008-12-02 23:33:29 +00:00
Eli Friedman
401743c904 Fix bogus assertion using getSExtValue for legitimate values, like -1 in
an 128-bit-wide integer.  No testcase; the issue I ran into depends on 
local changes.

llvm-svn: 60311
2008-12-01 00:43:48 +00:00
Chris Lattner
fc98ac247e random cleanup
llvm-svn: 57383
2008-10-11 22:06:50 +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
bb8a53802b remove redundant include
llvm-svn: 55116
2008-08-21 06:41:07 +00:00
Chris Lattner
16121a7f73 Fix the build with gcc 4.3 as the host, patch by Zhongxing Xu!
llvm-svn: 55115
2008-08-21 06:25:28 +00:00
Nick Lewycky
d9012655db Fix build on GCC 4.3.
llvm-svn: 55110
2008-08-21 05:36:03 +00:00
Chris Lattner
c9fdd97035 Move the fast-path (<=i64) cases of various APInt methods inline
and the slow-path cases out of line.  This speeds up instcombine
a bit in real world cases.  Patch contributed by m-s.

llvm-svn: 55063
2008-08-20 17:02:31 +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
Chris Lattner
4e4a482a41 remove a dead APInt ctor.
llvm-svn: 54869
2008-08-17 04:58:58 +00:00
Duncan Sands
e667a05fcb Correct a comment.
llvm-svn: 53401
2008-07-10 11:21:59 +00:00
Wojciech Matyjewicz
1de28ac425 First step to fix PR2088. Implement routine to compute the
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.

llvm-svn: 52638
2008-06-23 19:39:50 +00:00
Duncan Sands
a487df7710 Remove some DAG combiner assumptions about sizes
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).

llvm-svn: 52142
2008-06-09 11:32:28 +00:00
Dan Gohman
edc136d18f Fix an error in the comment for APInt::getMinSignedBits.
llvm-svn: 51720
2008-05-30 00:46:49 +00:00
Evan Cheng
c2d34f03bf Suppress -Wshorten-64-to-32 warnings for 64-bit hosts.
llvm-svn: 50590
2008-05-02 21:15:08 +00:00
Dan Gohman
2b8022a8c6 Add support to APInt for shift and rotate operations with APInt
instead of uint32_t for the shift/rotate count operand type.

llvm-svn: 47741
2008-02-29 01:40:47 +00:00
Bill Wendling
ebb707d162 Detabify
llvm-svn: 47597
2008-02-26 10:49:39 +00:00
Dan Gohman
62071ec646 Remove inline keywords from in-class function definitions, for
consistency.

llvm-svn: 47393
2008-02-20 19:29:58 +00:00
Dan Gohman
00fed8a97e Add an intersects method to APInt, to capture a common idiom.
llvm-svn: 47379
2008-02-20 16:08:11 +00:00
Dan Gohman
5562e340b7 Fix a typo in a comment.
llvm-svn: 47097
2008-02-13 22:32:12 +00:00
Dan Gohman
588498082a Rename APInt's isPositive to isNonNegative, to reflect what it
actually does.

llvm-svn: 47090
2008-02-13 22:09:18 +00:00
Dan Gohman
d22101a970 Add countTrailingOnes member functions to APInt.
llvm-svn: 47086
2008-02-13 21:11:05 +00:00
Dan Gohman
547ea0a60d Fix a typo in a comment.
llvm-svn: 47085
2008-02-13 20:56:53 +00:00
Dan Gohman
f65b0b112c Change APInt::getBitsSet to accept a "half-open" range, where the
hiBit parameter marks the index one past the last desired set bit.

llvm-svn: 47032
2008-02-12 21:47:33 +00:00