1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 03:53:04 +02:00
Commit Graph

39 Commits

Author SHA1 Message Date
NAKAMURA Takumi
1b224b5ec5 Reformat headers in ADT and Support partially.
Note, I didn't reformat entirely, but partially where I touched in previous commits.

llvm-svn: 244432
2015-08-10 04:22:36 +00:00
NAKAMURA Takumi
c1197d9021 Whitespace.
llvm-svn: 244431
2015-08-10 04:22:09 +00:00
NAKAMURA Takumi
b93b06ef3e Reformat linebreaks.
llvm-svn: 244430
2015-08-10 04:21:43 +00:00
Alex Lorenz
80dea2fad8 ADT: Add a string APSInt constructor.
This commit moves the APSInt initialization code that's used by
the LLLexer class into a new APSInt constructor that constructs
APSInts from strings.

This change is useful for MIR Serialization, as it would allow
the MILexer class to use the same APSInt initialization as 
LLexer when parsing immediate machine operands.

llvm-svn: 240436
2015-06-23 18:22:10 +00:00
Duncan P. N. Exon Smith
7f33c007a0 ADT: Add int64_t interoperability to APSInt
Add some API to `APSInt` to make it easier to compare with `int64_t`.

  - `APSInt::compareValues(APSInt, APSInt)` returns 1, -1 or 0 for
    greater, lesser, or equal, doing the right thing for mismatched
    "has-sign" and bitwidths.  This is just like `isSameValue()` (and is
    now the implementation of it).
  - `APSInt::get(int64_t)` gets a signed `APSInt`.
  - `operator<(int64_t)`, etc., are implemented trivially via `get()`
    and `compareValues()`.
  - Also added `APSInt::getUnsigned(uint64_t)` to make it easier to test
    `compareValues()`.

llvm-svn: 228239
2015-02-05 00:17:43 +00:00
Benjamin Kramer
b9370b2435 APSInt: Simplify code to reduce the number of copies. No functionality change.
llvm-svn: 219586
2014-10-12 15:36:31 +00:00
Ed Maste
c934bba310 ADT: correct typo in comment
llvm-svn: 211196
2014-06-18 18:08:55 +00:00
Benjamin Kramer
e3d4c30feb Give APInt move semantics.
The interaction between defaulted operators and move elision isn't
totally obvious, add a unit test so it doesn't break unintentionally.

llvm-svn: 202662
2014-03-02 20:56:28 +00:00
Benjamin Kramer
56648addca Annotate APInt methods where it's not clear whether they are in place with warn_unused_result.
Fix ScalarEvolution bugs uncovered by this.

llvm-svn: 194928
2013-11-16 16:25:41 +00:00
Jakub Staszak
9d539599f4 Use pre-inc, pre-dec when possible.
They are generally faster (at least not slower) than post-inc, post-dec.

llvm-svn: 177608
2013-03-20 23:56:19 +00:00
Jakub Staszak
f1ea1a7f37 Fix include guards so they exactly match file names.
llvm-svn: 172025
2013-01-10 00:45:19 +00:00
Richard Smith
c8f921953e Don't leave IsUnsigned uninitialized in a default-constructed APSInt. Copying
such a structure has undefined behavior. Caught by -fsanitize=bool.

llvm-svn: 170652
2012-12-20 03:59:24 +00:00
Richard Trieu
6fd83cc91a Add operator== to APSInt. This will compare the signed bit before doing
the comparison.  This prevents large unsigned integers from being equal to
signed negative integers of the same bit width.

llvm-svn: 160642
2012-07-23 20:24:23 +00:00
Eric Christopher
73191af11c Move IsSameValue from clang's ASTImporter to be methods on the
APInt/APSInt classes.

Part of rdar://11875995

llvm-svn: 160223
2012-07-15 00:23:36 +00:00
Jay Foad
79e18ed269 PR5207: Change APInt methods trunc(), sext(), zext(), sextOrTrunc() and
zextOrTrunc(), and APSInt methods extend(), extOrTrunc() and new method
trunc(), to be const and to return a new value instead of modifying the
object in place.

llvm-svn: 121120
2010-12-07 08:25:19 +00:00
Ted Kremenek
53921b8722 Fix bug where APSInt::operator-- incremented instead of decremented.
llvm-svn: 64687
2009-02-16 22:39:08 +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
526d29d06a Fix a bug in getMaxValue/getMinValue to pass the right signedness the
the constructed APSInt, patch suggested by Ben Laurie!

llvm-svn: 63362
2009-01-30 01:58:19 +00:00
Misha Brukman
da77da48f3 Removed trailing whitespace.
llvm-svn: 62000
2009-01-09 19:25:42 +00:00
Ted Kremenek
543bdab683 Added static methods to APSInt: getMinValue and getMaxValue.
llvm-svn: 56355
2008-09-19 18:01:14 +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
Daniel Dunbar
e249d30421 Add default constructor to APSInt
- Creates uninitialized APInt. 
 - Prevents need for embedding arbitrary constants when used as an out
   parameter, for example.

llvm-svn: 54757
2008-08-13 20:53:17 +00:00
Ted Kremenek
557bbab669 Constified operator<< in APSInt.
llvm-svn: 46882
2008-02-08 07:14:19 +00:00
Ted Kremenek
62853a3478 constified operator~().
llvm-svn: 46707
2008-02-04 16:57:26 +00:00
Ted Kremenek
acc17d1b24 Altered ctor for APSInt to accept an optional "isUnsigned" flag. Default
behavior is unchanged.

llvm-svn: 46521
2008-01-29 18:55:14 +00:00
Ted Kremenek
274df5b7db Added additional overloaded operators for APSInt to match the operators of
APInt.

While some operators were already specifically overloaded for APSInt, others
resulted in using the overloaded operator methods in APInt, which would result
in the signedness bit being lost.

Modified the APSInt(APInt&) constructor to be "explicit" and to take an
extra (optional) flag to indicate the signedness.  Making the ctor explicit
will catch any implicit conversations between APSInt -> APInt -> APSInt that
results in the signedness flag being lost.

llvm-svn: 46316
2008-01-24 18:59:52 +00:00
Ted Kremenek
dce31b9785 Added FoldingSet style 'profiling' support for APSInt.
llvm-svn: 46189
2008-01-19 04:31:12 +00:00
Chris Lattner
e0b1ee937a Don't attribute in file headers anymore. See llvmdev for the
discussion of this change.  Boy are my fingers tired. ;-)

llvm-svn: 45411
2007-12-29 19:59:42 +00:00
Ted Kremenek
5b2ac3504a Fixed incorrect "path name" in preamble (comment) of header file.
llvm-svn: 43402
2007-10-26 20:44:02 +00:00
Hartmut Kaiser
ed12f66488 Updated VC++ build system.
Silenced some VC warnings.

I'm getting linker errors, though: unresolved externals:

llvm::Split<class llvm::BasicBlock *,struct llvm::GraphTraits<class llvm::BasicBlock *> >(class llvm::DominatorTreeBase<class llvm::BasicBlock> &,class llvm::BasicBlock *)

and

llvm::Split<struct llvm::Inverse<class llvm::BasicBlock *>,struct llvm::GraphTraits<struct llvm::Inverse<class llvm::BasicBlock *> > >(class llvm::DominatorTreeBase<class llvm::BasicBlock> &,class llvm::BasicBlock *)

Where are these defined?

llvm-svn: 43073
2007-10-17 14:56:40 +00:00
Chris Lattner
346bc59e4f default this to radix 10 like the toString(Un)Signed methods.
llvm-svn: 41311
2007-08-23 05:21:48 +00:00
Chris Lattner
66d4ebe00f Avoid hiding issues.
llvm-svn: 41310
2007-08-23 05:20:48 +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
Anders Carlsson
122059b2e9 Fix bug spotted by Chris.
llvm-svn: 40725
2007-08-02 06:05:19 +00:00
Anders Carlsson
89ea07e724 Add extend and extOrTrunc methods that do sign or zero extension depending on whether the integer is signed or not
llvm-svn: 40724
2007-08-02 06:00:13 +00:00
Chris Lattner
03bc1d9018 add a helper method.
llvm-svn: 39885
2007-07-15 23:32:03 +00:00
Chris Lattner
f661523670 add missing methods, mark stuff const
llvm-svn: 35862
2007-04-10 07:06:21 +00:00
Chris Lattner
d39ae2fa6d Add a helper class (APSInt) which can represent an APInt along with sign
information.  This is useful when a value does have a sign associated with
it.  This shouldn't be used generally in LLVM for mid-level optimizer stuff.

llvm-svn: 35681
2007-04-05 05:20:11 +00:00