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

137 Commits

Author SHA1 Message Date
Torok Edwin
f955a6ef49 llvm_unreachable->llvm_unreachable(0), LLVM_UNREACHABLE->llvm_unreachable.
This adds location info for all llvm_unreachable calls (which is a macro now) in
!NDEBUG builds.
In NDEBUG builds location info and the message is off (it only prints
"UREACHABLE executed").

llvm-svn: 75640
2009-07-14 16:55:14 +00:00
Daniel Dunbar
8338833066 Switch to raw_ostream.
llvm-svn: 75451
2009-07-13 05:27:30 +00:00
Torok Edwin
ae8a3ff177 assert(0) -> LLVM_UNREACHABLE.
Make llvm_unreachable take an optional string, thus moving the cerr<< out of
line.
LLVM_UNREACHABLE is now a simple wrapper that makes the message go away for
NDEBUG builds.

llvm-svn: 75379
2009-07-11 20:10:48 +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
Evan Cheng
dd4f34ed9a 80 column violation.
llvm-svn: 72235
2009-05-21 23:47:47 +00:00
Mike Stump
6666fa7a2c Fix whitespacing (space after switch).
llvm-svn: 71738
2009-05-13 23:23:20 +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
Chris Lattner
d68b203337 Fix PR4040: APInt's string constructor is too strict
patch by Jeff Yasskin!

llvm-svn: 70058
2009-04-25 18:34:04 +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
Duncan Sands
45d4adde66 Fix comment typo.
llvm-svn: 67302
2009-03-19 11:37:15 +00:00
Stuart Hastings
4ee393a21a Fix a hashing bug in APInt. A certain pathological testcase (too
large for the testsuite) took over six minutes to compile on my Mac.
The patched LLVM-GCC compiles that testcase in three seconds (GCC
takes less than one second).  This hash function is more complex
(about 35 instructions on x86) than what Chris wanted, but I expect it
will be well-behaved with arbitrary inputs.

Thank you to everyone who responded to my previous request for advice.

llvm-svn: 66962
2009-03-13 21:51:13 +00:00
Torok Edwin
47c303034d APInt's countLeadingOnes() was broken for negative i128 values,
causing assertion failures in getSExtValue().
Fix it by making highWordBits actually contain what its name says,
and add some more unit-tests for APInt.
This fixes PR3419.

llvm-svn: 63107
2009-01-27 18:06:03 +00:00
Chris Lattner
ca83aa289a Remove uses of uint32_t in favor of 'unsigned' for better
compatibility with cygwin.  Patch by Jay Foad!

llvm-svn: 62695
2009-01-21 18:09:24 +00:00
Nick Lewycky
b98042a414 Fix typo, sentence fragment.
llvm-svn: 62512
2009-01-19 17:42:33 +00:00
Chris Lattner
3d1cdfc99e rearrange some code.
llvm-svn: 57384
2008-10-11 22:07:19 +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
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
Dan Gohman
9a43334166 It's not necessary to check if a value is null before delete[].
llvm-svn: 55053
2008-08-20 14:55:37 +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
Wojciech Matyjewicz
eea926ec20 Fix PR2088. Use modulo linear equation solver to compute loop iteration
count.

llvm-svn: 53810
2008-07-20 15:55:14 +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
Dan Gohman
e6da01721b Avoid creating a redundant zero APInt.
llvm-svn: 52602
2008-06-21 22:03:12 +00:00
Zhou Sheng
0d32cd97e1 As comments said, for negative value, the arithmetic
over-shift-right should return -1. So here it should be signed-extended,
when bitwidth larger than 64.

test case: llvm/test/ExecutionEngine/2008-06-05-APInt-OverAShr.ll

llvm-svn: 51999
2008-06-05 13:27:38 +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
26c2127be9 Make several symbols static.
llvm-svn: 49496
2008-04-10 21:11:47 +00:00
Dan Gohman
22002efa15 A quick nm audit turned up several fixed tables and objects that were
marked read-write. Use const so that they can be allocated in a
read-only segment.

llvm-svn: 48800
2008-03-25 21:45:14 +00:00
Bill Wendling
301783caf7 Add assert for non-hexadecimal radixes.
llvm-svn: 48421
2008-03-16 20:05:52 +00:00
Evan Cheng
41a16a1347 Fix a typo. It's causing consumer-typeset to miscompile. Perhaps more.
llvm-svn: 48035
2008-03-07 22:39:49 +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
Ted Kremenek
0449b1da95 Fixed bug in APInt::Profile() where the BitWidth field was not included in the
profile of the APSInt object. This caused unexpected Profile collisions where
none should have occurred.

llvm-svn: 47338
2008-02-19 20:50:41 +00:00
Dan Gohman
9ca30afc39 Fix a warning about comparison between signed and unsigned,
being consistent with the rest of the APInt implementation.

llvm-svn: 47138
2008-02-14 22:38:45 +00:00
Dan Gohman
d22101a970 Add countTrailingOnes member functions to APInt.
llvm-svn: 47086
2008-02-13 21:11:05 +00:00
Ted Kremenek
702d3b8f37 Added FoldingSet style 'profiling' support for APInt.
llvm-svn: 46188
2008-01-19 04:23:33 +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
Anton Korobeynikov
a0113f6c70 Cygwin defines uint32_t as unsigned long. Unbreak call to std::min in this case
llvm-svn: 45342
2007-12-24 11:16:47 +00:00
Reid Spencer
3a83a29e21 Don't have APInt.cpp depend upon DerivedTypes.h. This helps with splitting the
Support libraries separately into their own module.

llvm-svn: 44852
2007-12-11 06:53:58 +00:00
Chris Lattner
36854c740d Fix PR1816, by correcting the broken definition of APInt::countTrailingZeros.
llvm-svn: 44296
2007-11-23 22:42:31 +00:00
Chris Lattner
57a40dc2ad Fix APInt::countTrailingZeros to return BitWidth if the input is zero instead of returning some random large number.
llvm-svn: 44294
2007-11-23 22:36:25 +00:00
Neil Booth
39cc673e61 Don't attempt to mask no bits
llvm-svn: 42909
2007-10-12 15:31:31 +00:00
Neil Booth
f003f9bf1a Add a new function tcExtract for extracting a bignum from an
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.

llvm-svn: 42745
2007-10-08 13:47:12 +00:00
Neil Booth
0613ec4ee6 Fix and clarify some comments.
llvm-svn: 42670
2007-10-06 00:43:45 +00:00
Neil Booth
2c4419d71b Generalize tcFullMultiply so that the operands can be of differing
part widths.  Also, return the number of parts actually required to
hold the result's value.
Remove an over-cautious condition from rounding of float->hex conversion.

llvm-svn: 42669
2007-10-06 00:24:48 +00:00
Dale Johannesen
c7279629cc 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.

llvm-svn: 42210
2007-09-21 22:09:37 +00:00
Devang Patel
547d418b8e Do not hide APInt::dump() inside #ifndef NDEBUG.
llvm-svn: 42068
2007-09-17 22:24:00 +00:00
Dale Johannesen
575bd6070a 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).

llvm-svn: 41967
2007-09-14 22:26:36 +00:00
Chris Lattner
742b745b0c rename APInt::toString -> toStringUnsigned for symmetry with toStringSigned()
Add an APSInt::toString() method.

llvm-svn: 41309
2007-08-23 05:15:32 +00:00
Chris Lattner
401698e8b5 initial checkin of Neil's APFloat work.
llvm-svn: 41203
2007-08-20 22:49:32 +00:00