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

308 Commits

Author SHA1 Message Date
Bill Wendling
48c8ee1c11 Use non-bool values for .count.
llvm-svn: 108048
2010-07-10 18:56:35 +00:00
Daniel Dunbar
956f97134b ADT: Add DAGDeltaAlgorithm, which is a DAG minimization algorithm built on top of the standard 'delta debugging' algorithm.
- This can give substantial speedups in the delta process for inputs we can construct dependency information for.

llvm-svn: 105612
2010-06-08 16:21:22 +00:00
Jakob Stoklund Olesen
1c0aa5f14a Add StringRef::compare_numeric and use it to sort TableGen register records.
This means that our Registers are now ordered R7, R8, R9, R10, R12, ...
Not R1, R10, R11, R12, R2, R3, ...

llvm-svn: 104745
2010-05-26 21:47:28 +00:00
Daniel Dunbar
10ef3afee3 Fix const ilist_node::get{Prev,Next}Node() to actually compile. Picky, picky.
llvm-svn: 103723
2010-05-13 18:35:02 +00:00
Daniel Dunbar
78bb7f4dc9 ADT: Add ilist_node::get{Prev,Next}Node, which return the adjacent node or null.
- This provides a convenient alternative to using something llvm::prior or
   manual iterator access, for example::

    if (T *Prev = foo->getPrevNode())
      ...

   instead of::

     iterator it(foo);
     if (it != begin()) {
       --it;
       ... 
     }

 - Chris, please review.

llvm-svn: 103647
2010-05-12 21:35:19 +00:00
Dan Gohman
73722062f7 Update BitVectorTest.cpp to stay in sync with SmallBitVectorTest.cpp,
and fix a bug in BitVector's reference proxy class which this exposed.

llvm-svn: 102768
2010-04-30 20:50:28 +00:00
Benjamin Kramer
f3e9546fc1 SmallBitVector: Rework find_first/find_next and tweak test to test them (at least on 64 bit platforms).
llvm-svn: 102712
2010-04-30 13:40:27 +00:00
Benjamin Kramer
e4ebf09068 Implement a read/write operator[] for SmallBitVector with a proxy class.
llvm-svn: 102709
2010-04-30 12:29:39 +00:00
Chris Lattner
733984a968 silence some unused-value warnings.
llvm-svn: 101689
2010-04-18 03:28:20 +00:00
Dan Gohman
8d37faa2f7 Fix SmallVector's insert to handle non-random-access iterators.
llvm-svn: 99633
2010-03-26 18:53:37 +00:00
Dan Gohman
73fc4f80ba Make this test more lenient; with SmallVector now using actually
aligned storage, the capacity may be more than what is explicitly
requested.

llvm-svn: 98846
2010-03-18 18:47:50 +00:00
Jeffrey Yasskin
4443f00d2b Fix death tests in -Asserts builds.
llvm-svn: 98701
2010-03-17 01:18:45 +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
John McCall
bb9c3309b2 Make APFloat's string-parsing routines a bit safer against very large exponents.
llvm-svn: 97278
2010-02-26 22:20:41 +00:00
Jeffrey Yasskin
eb0dbdca22 Fix (harmless) memory leak found by memcheck.
llvm-svn: 95862
2010-02-11 07:16:13 +00:00
Benjamin Kramer
0a0f0f6465 Silence GCC warnings.
llvm-svn: 95779
2010-02-10 13:34:02 +00:00
Dan Gohman
2dd0d36f14 Implement operators |=, &=, and ^= for SmallBitVector, and remove the
restriction in BitVector for |= and ^= that the operand must be the
same length.

llvm-svn: 95768
2010-02-10 05:54:04 +00:00
Dale Johannesen
af10702e49 Disable unittests/ADT/BitVectorTest on PPC Darwin.
It fails with a release build only, for reasons
as yet unknown.  (If there's a better way to Xfail
things here let me know, doesn't seem to be any
prior art in unittests.)

llvm-svn: 95700
2010-02-09 22:15:27 +00:00
John McCall
8bcabdeffc Make APInt::countLeadingZerosSlowCase() treat the contents of padding bits
as undefined.  Fixes an assertion in APFloat::toString noticed by Dale.

llvm-svn: 95196
2010-02-03 03:42:44 +00:00
Dan Gohman
090f279ac5 Add a SmallBitVector class, which mimics BitVector but uses only
a single pointer (PointerIntPair) member. In "small" mode, the
pointer field is reinterpreted as a set of bits. In "large" mode,
the pointer points to a heap-allocated object.

Also, give BitVector empty and swap functions.

And, add some simple unittests for BitVector and SmallBitVector.

llvm-svn: 92730
2010-01-05 15:04:49 +00:00
Benjamin Kramer
9e60957f54 Silence compiler warning.
warning: comparison between signed and unsigned integer expressions
llvm-svn: 92359
2009-12-31 16:27:13 +00:00
Douglas Gregor
c4174c69ea Document the edit-distance algorithm used in StringRef, switch it over
to SmallVector, and add a unit test.

llvm-svn: 92340
2009-12-31 04:24:34 +00:00
John McCall
75f1b8beeb Implement support for converting to string at "natural precision", and fix some
major bugs in long-precision conversion.

llvm-svn: 92150
2009-12-24 23:18:09 +00:00
Douglas Gregor
1dafbbc020 Move the two definitions of operator<< into namespace llvm, so they
will be found by argument-dependent lookup. As with the previous
commit, GCC is allowing ill-formed code.

llvm-svn: 92146
2009-12-24 21:15:37 +00:00
Douglas Gregor
a31d6d49b0 Define the new operator<< for sets into namespace std, so that
argument-dependent lookup can find it. This is another case where an
LLVM bug (not making operator<< visible) was masked by a GCC bug
(looking in the global namespace when it shouldn't).

llvm-svn: 92144
2009-12-24 21:11:45 +00:00
John McCall
c71c44ec7f Add accessors for the largest-magnitude, smallest-magnitude, and
smallest-normalized-magnitude values in a given FP semantics.
Provide an APFloat-to-string conversion which I am quite ready to admit could
be much more efficient.

llvm-svn: 92126
2009-12-24 08:56:26 +00:00
Eli Friedman
fe6a796851 Change StringRef::startswith and StringRef::endswith to versions which are a
bit more verbose, but optimize to much shorter code.

llvm-svn: 91817
2009-12-21 06:49:24 +00:00
Daniel Dunbar
63e2201f3e Add an implementation of the delta debugging algorithm.
- This is a pretty slow / memory intensive implementation, and I will likely
   change it to an iterative model, but it works.

llvm-svn: 90447
2009-12-03 11:12:42 +00:00
Duncan Sands
78f8022d71 Only run this mutex test if threading is enabled. This
fixes PR5395.

llvm-svn: 89385
2009-11-19 20:48:14 +00:00
Benjamin Kramer
891fbcdb60 Reenable Split2 StringRef test with Apple gcc.
llvm-svn: 89357
2009-11-19 16:04:41 +00:00
Daniel Dunbar
e36c429c3b "XFAIL" the Split2 StringReft test with Apple gcc, which miscompiles it.
- I plan on fixing/workarounding this, but until then I'd like the bots to stay
   green.

llvm-svn: 89077
2009-11-17 09:29:59 +00:00
Rafael Espindola
bece8d9ae7 Distinguish "a," from "a". The first one splits into "a" + "" and the second one into
"a" + 0.

llvm-svn: 87084
2009-11-13 04:55:09 +00:00
Rafael Espindola
11ceba8119 Switch to smallvector. Also fix issue with using unsigend for MaxSplit.
llvm-svn: 87068
2009-11-13 02:18:25 +00:00
Rafael Espindola
22f040b797 Add a new split method to StringRef that puts the substrings in a vector.
llvm-svn: 87058
2009-11-13 01:24:40 +00:00
Daniel Dunbar
16a5387db2 Add From arguments to StringRef search functions, and tweak doxyments.
Also, add unittests for find_first_of and find_first_not_of.

llvm-svn: 86770
2009-11-11 00:28:53 +00:00
Jeffrey Yasskin
23ac706aab Fix DenseMap iterator constness.
This patch forbids implicit conversion of DenseMap::const_iterator to
DenseMap::iterator which was possible because DenseMapIterator inherited
(publicly) from DenseMapConstIterator. Conversion the other way around is now
allowed as one may expect.

The template DenseMapConstIterator is removed and the template parameter
IsConst which specifies whether the iterator is constant is added to
DenseMapIterator.

Actually IsConst parameter is not necessary since the constness can be
determined from KeyT but this is not relevant to the fix and can be addressed
later.

Patch by Victor Zverovich!

llvm-svn: 86636
2009-11-10 01:02:17 +00:00
Chris Lattner
fa5b1df64a Type.h doesn't need to #include LLVMContext.h
llvm-svn: 85254
2009-10-27 17:08:31 +00:00
Chandler Carruth
766362c707 Move DataTypes.h to include/llvm/System, update all users. This breaks the last
direct inclusion edge from System to Support.

llvm-svn: 85086
2009-10-26 01:35:46 +00:00
Jeffrey Yasskin
bc5f122491 Fix stylistic and documentation problems in ValueMap found by Nick Lewycky and
Evan Cheng.

llvm-svn: 84967
2009-10-23 20:54:00 +00:00
Jeffrey Yasskin
e90afea0ba Try r84890 again (adding ValueMap<>), now that I've tested the compile on
gcc-4.4.

llvm-svn: 84902
2009-10-22 22:11:22 +00:00
Jeffrey Yasskin
7555ed8cdc Revert r84890, which broke the linux build.
llvm-svn: 84892
2009-10-22 20:23:43 +00:00
Jeffrey Yasskin
ad8692124f Add a ValueMap<ValueOrSubclass*, T> type. ValueMap<Value*, T> is safe to use
even when keys get RAUWed and deleted during its lifetime. By default the keys
act like WeakVHs, but users can pass a third template parameter to configure
how updates work and whether to do anything beyond updating the map on each
action.

It's also possible to automatically acquire a lock around ValueMap updates
triggered by RAUWs and deletes, to support the ExecutionEngine.

llvm-svn: 84890
2009-10-22 20:10:20 +00:00
Duncan Sands
19c1644f1f Pacify the compiler (signed with unsigned comparison) by making
these constants unsigned.

llvm-svn: 83962
2009-10-13 09:23:11 +00:00
Dan Gohman
f9067da535 Add a ceilLogBase2 function to APInt.
llvm-svn: 83932
2009-10-13 01:49:02 +00:00
Daniel Dunbar
d4df08bb72 Fix a few more conversion warnings on 4.0
llvm-svn: 82232
2009-09-18 17:48:05 +00:00
Daniel Dunbar
b415837d62 Another try at fixing compile warnings on 4.0
llvm-svn: 82148
2009-09-17 17:46:53 +00:00
Daniel Dunbar
60e1dee7fa Add StringRef::{rfind, rsplit}
llvm-svn: 82087
2009-09-16 22:38:48 +00:00
Daniel Dunbar
23724b98d0 Attempt to fix some 4.0.0 build warnings.
llvm-svn: 81752
2009-09-14 02:38:53 +00:00
Daniel Dunbar
7ef30987f7 Simplify, now that gtest supports raw_ostream directly.
llvm-svn: 81102
2009-09-06 02:31:26 +00:00
Daniel Dunbar
29f5444a38 Add test for PR4873, which works for me.
llvm-svn: 80965
2009-09-03 22:57:02 +00:00
Chris Lattner
98f201632e split raw_os_ostream out to its own header and implementation file. This
means that raw_ostream no longer has to #include <iosfwd>.  Nothing in llvm
should use raw_os_ostream.h, but llvm-gcc and some unit tests do.

llvm-svn: 79886
2009-08-24 04:02:06 +00:00
Daniel Dunbar
56712ba250 Unbreak unit tests.
llvm-svn: 79879
2009-08-24 02:02:58 +00:00
Bill Wendling
e5dbd6b0f9 Correct for recent assert change.
llvm-svn: 79601
2009-08-21 06:35:41 +00:00
Erick Tryzelaar
ff8b504eb3 Fix bug with APInt::getBitsNeeded with for base 10 numbers 0-9.
llvm-svn: 79593
2009-08-21 03:15:28 +00:00
Erick Tryzelaar
11660bb729 Allow '+' to appear in APInt strings, and add more unit tests.
llvm-svn: 79592
2009-08-21 03:15:14 +00:00
Erick Tryzelaar
6bd69aaa86 Add support for including '+' in APFloat strings, more asserts,
and many new unit tests.

llvm-svn: 79574
2009-08-20 23:30:43 +00:00
Daniel Dunbar
9ad4b47cec Fix two APFloat bugs in converting hexadecimal constants.
llvm-svn: 79540
2009-08-20 17:12:33 +00:00
Benjamin Kramer
15b0649d13 Remove SmallString::append_*int* unit tests.
llvm-svn: 79451
2009-08-19 19:41:05 +00:00
Daniel Dunbar
6812c0db35 Add SmallVector::{capacity,set_size}.
- These allow clients to make use of the extra elements in the vector which
   have already been allocated, without requiring them to be value initialized.

llvm-svn: 79433
2009-08-19 17:48:28 +00:00
Daniel Dunbar
d334c67f60 Improve Triple to recognize the OS in i386-mingw32.
llvm-svn: 79359
2009-08-18 19:26:55 +00:00
Daniel Dunbar
09f40a7871 Fix pasto in StringRef::count(char)
llvm-svn: 79356
2009-08-18 18:34:22 +00:00
Daniel Dunbar
4a9a98a5de Add StringRef::count({char,StringRef})
llvm-svn: 79354
2009-08-18 18:26:35 +00:00
Erick Tryzelaar
3ca0a7b0e4 Wrap unit test death tests in GTEST_HAS_DEATH_TEST
llvm-svn: 79218
2009-08-17 00:55:33 +00:00
Erick Tryzelaar
9e37eae4d7 Change APFloatTest from using ASSERTs to EXPECTs
llvm-svn: 79216
2009-08-17 00:14:11 +00:00
Erick Tryzelaar
930c879b9e Modify APFloat to take a StringRef instead of a c string.
This also adds unit tests to APFloat that mainly tests the
string handling of APFloat, but not much else of it's api.

llvm-svn: 79210
2009-08-16 23:36:19 +00:00
Erick Tryzelaar
36d9dbb8a1 Add failure tests to APInt unit test.
llvm-svn: 79209
2009-08-16 23:36:01 +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
Daniel Dunbar
f4e8af6ecc StringRef: Add find(char) and find(StringRef).
Also, regroup functions.

llvm-svn: 78712
2009-08-11 20:47:15 +00:00
Daniel Dunbar
edd0313a36 Twine: Use raw_ostream::write_hex, remove unused itohexstr method.
llvm-svn: 77617
2009-07-30 18:30:19 +00:00
Daniel Dunbar
4d8b1776b4 Twine: Provide [u]int{32,64} conversions via implicit constructors instead of
explicitly.

llvm-svn: 77576
2009-07-30 03:47:15 +00:00
Benjamin Kramer
276a105601 fix unittest on platforms with unsigned chars (e.g. linux-ppc)
llvm-svn: 77471
2009-07-29 16:48:32 +00:00
Daniel Dunbar
d13fcdaae5 Twines: Support numeric conversion directly (uitostr, etc).
- Provides static constructors for doing number to string conversions without
   using temporaries.

 - There are several ways to do this, I think given the Twine constraints this
   is the simplest one.

 - One FIXME for fast number -> hex conversion.

 - Added another comment on one last major bit of perf work Twines need, which
   is to make raw_svector_ostream more efficient.

llvm-svn: 77445
2009-07-29 07:08:44 +00:00
Daniel Dunbar
5a9d56ab90 Update Triple to use StringRef/Twine based APIs.
- This is now shorter, simpler, safer, and more efficient, what a deal.

llvm-svn: 77119
2009-07-26 03:31:47 +00:00
Daniel Dunbar
b97f9fc3f5 Add StringRef::{slice, split}, two convenient string operations which are simple
and efficient on a StringRef.

llvm-svn: 77117
2009-07-26 03:18:15 +00:00
Jeffrey Yasskin
da42799098 Add a missing ilist_node.h #include to SparseBitVector, and add a very short
test for it. The test is by no means complete, but it tests the problem I was
fixing.

llvm-svn: 77025
2009-07-25 00:33:57 +00:00
Daniel Dunbar
6f78d7ac27 Add Twine ADT.
- Not currently used.

llvm-svn: 76956
2009-07-24 07:04:27 +00:00
Daniel Dunbar
b5adc13728 Convert StringMap to using StringRef for its APIs.
- Yay for '-'s and simplifications!

 - I kept StringMap::GetOrCreateValue for compatibility purposes, this can
   eventually go away. Likewise the StringMapEntry Create functions still follow
   the old style.

 - NIFC.

llvm-svn: 76888
2009-07-23 18:17:34 +00:00
Daniel Dunbar
6bbe0f1151 Support writing a StringRef to a raw_ostream directly.
llvm-svn: 76754
2009-07-22 17:13:20 +00:00
Daniel Dunbar
30c92a0aee Add StringRef::{substr, startswith}.
llvm-svn: 76559
2009-07-21 09:18:49 +00:00
Daniel Dunbar
8ab30670cc Add StringRef class, with fixes.
llvm-svn: 76543
2009-07-21 07:28:51 +00:00
Torok Edwin
4f4888bcf0 unbreak unit-tests on gcc-4.4.
llvm-svn: 76542
2009-07-21 07:09:05 +00:00
Daniel Dunbar
156565ace2 Add SmallString unit test.
- Patch by Ryan Flynn!

llvm-svn: 76081
2009-07-16 17:00:06 +00:00
Daniel Dunbar
29416147f7 Clarify a FIXME.
llvm-svn: 75422
2009-07-12 19:45: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
Daniel Dunbar
5d4e95558e Revert my intentional breakage.
llvm-svn: 74531
2009-06-30 16:26:57 +00:00
Daniel Dunbar
e2d86964db Intentionally break a unittest to test my buildbot gtest command.
- Apologies in advance for the noise.

llvm-svn: 74530
2009-06-30 16:11:58 +00:00
Misha Brukman
789c11dcc0 Reversed order of args in EXPECT_EQ() macros to be in the correct order:
EXPECT_EQ(expected, actual) .  This will make error messages understandable as
it uses terms such as "expected" and "actual" based on the order of arguments.

llvm-svn: 73150
2009-06-09 21:48:57 +00:00
Stuart Hastings
b3c08d427a Prevent looping when DenseSet is abused.
llvm-svn: 70572
2009-05-01 20:47:53 +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
Owen Anderson
d2cf86afcb Use the testcase from PR2791.
llvm-svn: 69846
2009-04-23 00:15:26 +00:00
Misha Brukman
56dff472d2 * Fixed calls to APInt ctor to work for negative values on Darwin/x86
* Converted C-style casts to C++-style casts

llvm-svn: 68613
2009-04-08 16:17:23 +00:00
Daniel Dunbar
588d3d1fd6 Add llvm::Triple class for abstracting access to target triples.
- The code is silly, I'm just amusing myself. Rewrite to be efficient
   if you like. :)

Also, if you wish to debate the proper names of the triple components
I'm all ears.

llvm-svn: 68252
2009-04-01 21:53:23 +00:00
Misha Brukman
6e86395ae7 Converted a1.ll to unittests.
llvm-svn: 67652
2009-03-24 21:36:09 +00:00
Misha Brukman
3c59ac1164 Renamed unittest files to have a consistent {Tt}est suffix.
llvm-svn: 67326
2009-03-19 19:09:48 +00:00
Bill Wendling
6ef1b025ba Fix comment.
llvm-svn: 64137
2009-02-09 12:31:40 +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
Nick Lewycky
7c5381a70c Port this test from dejagnu to unit testing.
The way this worked before was to test APInt by running
"lli -force-interpreter=true" knowing the lli uses APInt under the hood to
store its values. Now, we test APInt directly.

llvm-svn: 62514
2009-01-19 18:08:33 +00:00
Bill Wendling
1c5828d337 Fix naming of file.
llvm-svn: 62035
2009-01-11 01:25:51 +00:00
Bill Wendling
d88988a11e Adding unittests for SmallVector. Test by Talin.
llvm-svn: 62025
2009-01-10 12:56:31 +00:00
Bill Wendling
282eca1712 Some generic clean-ups. Also make the StringMapEntryInitializer specialization apply only to the tests that are actually testing it.
llvm-svn: 61923
2009-01-08 09:31:36 +00:00
Bill Wendling
71f808dfa2 * Don't explicitly cast "0" to "void*". This doesn't work well with specialized
StringMapEntryInitializer classes. Leave it for the compiler to figure out what
 the type is and what "0" should be transformed into.

* Un-disable the unit tests which test the StringMapEntryInitializer class.

llvm-svn: 61922
2009-01-08 08:26:46 +00:00
Bill Wendling
e6c3d21d3c 80-column violation fix.
llvm-svn: 61919
2009-01-08 07:35:39 +00:00
Misha Brukman
4044287626 * Added unittests for StringMap
* Fixed but in StringMap::clear()
* Removed trailing whitespace

Original patch by Talin.

llvm-svn: 61914
2009-01-08 04:48:20 +00:00
Misha Brukman
c3fe8ccf6d Minor cleanup for unittest:
* Fixed {copy,assignment} constructor test names
* s/EXPECT_EQ(true, ...)/ASSERT_TRUE(...)/

Patch by Talin.

llvm-svn: 61883
2009-01-07 21:13:53 +00:00
Nuno Lopes
73135ab8ee improve test and address Misha's comments
llvm-svn: 61609
2009-01-03 14:55:26 +00:00
Bill Wendling
d06d6312d3 Reassign the buffer to the pointer so that we don't overwrite memory.
llvm-svn: 61596
2009-01-02 23:13:30 +00:00
Nuno Lopes
4bd71e86c9 fist short at a new unit test for ImmutableSets. no bugs found, though :P
llvm-svn: 61576
2009-01-02 13:49:50 +00:00
Misha Brukman
3b9228c5ce Original patch by Talin.
* Added the first LLVM unittest -- DenseMap.
* Updated mkpatch utility to include llvm/unittests dir
* Added top-level target "unittests" to run all unittests

llvm-svn: 61541
2009-01-01 02:24:48 +00:00