Commit Graph

212 Commits

Author SHA1 Message Date
Daniel Dunbar 316b4a0206 Drop the raw_ostream required buffer size to 1.
- As best I can tell, we have eliminated all the code which used to require a
   larger buffer size.

llvm-svn: 81912
2009-09-15 20:31:46 +00:00
Daniel Dunbar 6ced391121 Attempt to fix some 4.0.0 build warnings.
llvm-svn: 81752
2009-09-14 02:38:53 +00:00
Daniel Dunbar 96ccc47a13 Build (not test) the unittests as part of a normal build.
- 'make unittests' still builds and tests.
 - 'make unitcheck' inside a unittest directory runs the tests in that directory.

llvm-svn: 81725
2009-09-13 22:39:27 +00:00
Daniel Dunbar 6be903e185 Move unittest driver to utils/unittest/UnitTestMain.
- This eliminates a race between building the unittests and linking the
   UnitTestMain library.

llvm-svn: 81719
2009-09-13 21:31:21 +00:00
Daniel Dunbar 63f5a77822 Revert unittests build changes temporarily, the unit test build isn't -j safe.
llvm-svn: 81692
2009-09-13 18:58:14 +00:00
Daniel Dunbar 37af2a9588 Build (not test) the unittests as part of a normal build.
- 'make unittests' still builds and tests.
 - 'make unitcheck' inside a unittest directory runs the tests in that directory.

llvm-svn: 81687
2009-09-13 18:43:46 +00:00
Jeffrey Yasskin ccbeaf5f94 Make TypeBuilder's result depend on the LLVMContext it's passed.
TypeBuilder was using a local static variable to cache its result. This made it
ignore changes in its LLVMContext argument and always return a type constructed
from the argument to the first call.

llvm-svn: 81316
2009-09-09 05:04:01 +00:00
Daniel Dunbar 8feee907e4 Update unittests for MDNode uniquing disable.
llvm-svn: 81142
2009-09-07 04:19:02 +00:00
Daniel Dunbar da30ecdcdd Simplify, now that gtest supports raw_ostream directly.
llvm-svn: 81102
2009-09-06 02:31:26 +00:00
Nick Lewycky d592399beb Now that googletest can print ConstantRange, use EXPECT_EQ when testing for
equality. Prefer EXPECT_EQ(foo, Full) over EXPECT_TRUE(foo.isFullSet()) because
the former will print out the contents of the constant range that failed.

llvm-svn: 81094
2009-09-05 18:27:40 +00:00
Jeffrey Yasskin b797fdc365 Teach googletest to use raw_ostream instead of just std::ostream.
This can break when there are implicit conversions from types raw_ostream
understands but std::ostream doesn't, but it increases the number of cases that
Just Work.

llvm-svn: 81093
2009-09-05 18:16:17 +00:00
Daniel Dunbar bc52e4fe73 Add test for PR4873, which works for me.
llvm-svn: 80965
2009-09-03 22:57:02 +00:00
Devang Patel f7188325ef Now Bitcode reader bug is fixed. Reapply 80839.
Use CallbackVH, instead of WeakVH, to hold MDNode elements.
Use FoldingSetNode to unique MDNodes in a context.
Use CallbackVH hooks to update context's MDNodeSet appropriately.

llvm-svn: 80868
2009-09-03 01:39:20 +00:00
Devang Patel c180029be4 Revert 80839 for now. It causes test failures.
llvm-svn: 80841
2009-09-02 21:49:26 +00:00
Devang Patel 36309cd391 Use CallbackVH, instead of WeakVH, to hold MDNode elements.
Use FoldingSetNode to unique MDNodes in a context.
Use CallbackVH hooks to update context's MDNodeSet appropriately.

llvm-svn: 80839
2009-09-02 21:22:09 +00:00
Devang Patel 34455c9c65 Disable uniqueness test for now.
llvm-svn: 80741
2009-09-02 00:16:33 +00:00
Chris Lattner b1c3df239d update unit test for previous change.
llvm-svn: 80528
2009-08-31 00:28:46 +00:00
Torok Edwin e14d4cdb5f Add regular expression matching support, based on OpenBSD regexec()/regcomp()
implementation.

llvm-svn: 80493
2009-08-30 08:24:09 +00:00
Chris Lattner 0ffe0e096d 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 40b384eade Unbreak unit tests.
llvm-svn: 79879
2009-08-24 02:02:58 +00:00
Daniel Dunbar 47a309c5ca Fix off-by-one in llvm::Format::print.
- This also shortens the Format.h implementation, and uses the print buffer
   fully (it was wasting a character).

 - This manifested as llvm-test failures, because one side effect was that
   raw_ostream would write garbage '\x00' values into the output stream if it
   happened that the string was at the end of the buffer. This meant that grep
   would report 'Binary file matches', which meant the silly pattern matching
   llvm-test eventually does would fail. Cute. :)

llvm-svn: 79862
2009-08-23 20:31:39 +00:00
Chris Lattner dbbdc79267 convert all the constant range EXPECT_EQ tests to use EXPECT_TRUE since
ConstantRange doesn't have an std::ostream inserter anymore.

llvm-svn: 79831
2009-08-23 06:32:25 +00:00
Chris Lattner be354a66d3 upgrade for removed functions.
llvm-svn: 79822
2009-08-23 04:47:35 +00:00
Bill Wendling ef793ccbdc Correct for recent assert change.
llvm-svn: 79601
2009-08-21 06:35:41 +00:00
Erick Tryzelaar dadb1571b7 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 1264bcb4de Allow '+' to appear in APInt strings, and add more unit tests.
llvm-svn: 79592
2009-08-21 03:15:14 +00:00
Erick Tryzelaar da666c801c 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 bf5998edfb Fix two APFloat bugs in converting hexadecimal constants.
llvm-svn: 79540
2009-08-20 17:12:33 +00:00
Misha Brukman 5851edb13e Fixed header comment.
llvm-svn: 79536
2009-08-20 17:01:14 +00:00
Daniel Dunbar faea97193c Add min and max tests.
llvm-svn: 79454
2009-08-19 19:58:19 +00:00
Benjamin Kramer 902ccf22b4 Remove SmallString::append_*int* unit tests.
llvm-svn: 79451
2009-08-19 19:41:05 +00:00
Daniel Dunbar 825e955e40 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 959323a260 Improve Triple to recognize the OS in i386-mingw32.
llvm-svn: 79359
2009-08-18 19:26:55 +00:00
Daniel Dunbar 3828a99ba6 Fix pasto in StringRef::count(char)
llvm-svn: 79356
2009-08-18 18:34:22 +00:00
Daniel Dunbar 5736db6527 Add StringRef::count({char,StringRef})
llvm-svn: 79354
2009-08-18 18:26:35 +00:00
Erick Tryzelaar 927191f179 Wrap unit test death tests in GTEST_HAS_DEATH_TEST
llvm-svn: 79218
2009-08-17 00:55:33 +00:00
Erick Tryzelaar bc0d74944e Change APFloatTest from using ASSERTs to EXPECTs
llvm-svn: 79216
2009-08-17 00:14:11 +00:00
Erick Tryzelaar 19f63b2e4d 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 2b01eab81c Add failure tests to APInt unit test.
llvm-svn: 79209
2009-08-16 23:36:01 +00:00
Owen Anderson 55f1c09e31 Push LLVMContexts through the IntegerType APIs.
llvm-svn: 78948
2009-08-13 21:58:54 +00:00
Daniel Dunbar 3a1efd11bb 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
Benjamin Kramer 9ace8b5763 Fix unit test on FreeBSD. We need to make sure there is enough space to save the pointer even if the memory returned from malloc was already aligned.
llvm-svn: 78805
2009-08-12 12:31:02 +00:00
Daniel Dunbar a1e04d43c4 StringRef: Add find(char) and find(StringRef).
Also, regroup functions.

llvm-svn: 78712
2009-08-11 20:47:15 +00:00
Jeffrey Yasskin 6bf87df579 To catch bugs like the one fixed in
http://llvm.org/viewvc/llvm-project?view=rev&revision=78127, I'm changing the
ExecutionEngine's global mappings to hold AssertingVH<const GlobalValue>. That
way, if unregistering a mapping fails to actually unregister it, we'll get an
assert. Running the jit nightly tests didn't uncover any actual instances of
the problem.

This also uncovered the fact that AssertingVH<const X> didn't work, so I fixed
that too.

llvm-svn: 78400
2009-08-07 19:54:29 +00:00
Owen Anderson ad3f916596 Update unit test.
llvm-svn: 78260
2009-08-05 23:28:57 +00:00
Jeffrey Yasskin 337b124a24 Make ExecutionEngine::updateGlobalMapping(GV, NULL) properly remove GV's old
address from the reverse mapping, and add a test that this works now.

llvm-svn: 78127
2009-08-04 23:53:16 +00:00
Benjamin Kramer c10898ce3e Remove now empty unit test directory.
llvm-svn: 77790
2009-08-01 19:07:29 +00:00
Chris Lattner fb1b51c2ed daniel says it's fine to nuke this.
llvm-svn: 77789
2009-08-01 18:38:21 +00:00
Chris Lattner 41a866d30d update for new api
llvm-svn: 77788
2009-08-01 18:35:49 +00:00
Owen Anderson 2358732164 Fix unit tests.
llvm-svn: 77734
2009-07-31 21:38:10 +00:00
Benjamin Kramer 93468cdd3e Update unittest for LLVM API change.
llvm-svn: 77730
2009-07-31 20:56:31 +00:00
Owen Anderson 5a1acd9912 Move a few more APIs back to 2.5 forms. The only remaining ones left to change back are
metadata related, which I'm waiting on to avoid conflicting with Devang.

llvm-svn: 77721
2009-07-31 20:28:14 +00:00
Benjamin Kramer 8d3b57d462 Adjust unit test for the MCSection changes.
llvm-svn: 77714
2009-07-31 19:12:33 +00:00
Owen Anderson b292b8ce70 Move more code back to 2.5 APIs.
llvm-svn: 77635
2009-07-30 23:03:37 +00:00
Daniel Dunbar bd8556e0fb Twine: Use raw_ostream::write_hex, remove unused itohexstr method.
llvm-svn: 77617
2009-07-30 18:30:19 +00:00
Benjamin Kramer 5656e4fcd3 fix a unitialized pointer in NamedMDNode (and reenable unittest)
llvm-svn: 77597
2009-07-30 15:35:55 +00:00
Daniel Dunbar e8b3236284 Twine: Provide [u]int{32,64} conversions via implicit constructors instead of
explicitly.

llvm-svn: 77576
2009-07-30 03:47:15 +00:00
Daniel Dunbar 54914e2b3a Disable the NamedMDNodeTest, it is failing everywhere.
llvm-svn: 77569
2009-07-30 02:08:27 +00:00
Devang Patel 0924b33a1e Add NamedMDNode test.
llvm-svn: 77550
2009-07-30 00:03:41 +00:00
Owen Anderson 4056ca9568 Move types back to the 2.5 API.
llvm-svn: 77516
2009-07-29 22:17:13 +00:00
Benjamin Kramer 9a59b2a21d Update unittest for LLVM API change.
llvm-svn: 77496
2009-07-29 19:18:13 +00:00
Benjamin Kramer a6d0436b97 fix unittest on platforms with unsigned chars (e.g. linux-ppc)
llvm-svn: 77471
2009-07-29 16:48:32 +00:00
Daniel Dunbar b49994ad7e 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
Benjamin Kramer 28983a4cf6 fix unittest
llvm-svn: 77375
2009-07-28 22:03:24 +00:00
Benjamin Kramer 729749d34d Remove trailing slashes from include paths. Some versions of mingw don't like them.
llvm-svn: 77188
2009-07-27 09:39:18 +00:00
Daniel Dunbar 19e7076ddd 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 56563f33f7 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
Reid Kleckner 4b1f2f4779 Added a test and fixed a bug in BumpPtrAllocator relating to large alignment
values.  Hopefully this fixes PR4622.

llvm-svn: 77088
2009-07-25 21:26:02 +00:00
Daniel Dunbar d43b86d4a4 Finish migrating VMCore to StringRef/Twine based APIs.
llvm-svn: 77051
2009-07-25 06:02:13 +00:00
Jeffrey Yasskin f4e1db1722 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
Owen Anderson edb4a70325 Revert the ConstantInt constructors back to their 2.5 forms where possible, thanks to contexts-on-types. More to come.
llvm-svn: 77011
2009-07-24 23:12:02 +00:00
Daniel Dunbar afcf5b30cb Add Twine ADT.
- Not currently used.

llvm-svn: 76956
2009-07-24 07:04:27 +00:00
Reid Kleckner cbb9348e76 Fixing unittests on 32-bit Darwin, using 0x...ULL instead of 0x...U .
llvm-svn: 76904
2009-07-23 22:27:18 +00:00
Reid Kleckner 4b3a356493 Re-committing r76828 with the JIT memory manager changes now that the build
bots like the BumpPtrAllocator changes.

llvm-svn: 76902
2009-07-23 21:46:56 +00:00
Reid Kleckner c2d882dd1a Re-committing changes from r76825 to BumpPtrAllocator with a fix and tests for
an off-by-one error.

llvm-svn: 76891
2009-07-23 18:34:13 +00:00
Daniel Dunbar 5bf72e20eb 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
Devang Patel 6292003492 MDString
- Rename member function size(). New name is length().
- Store string beginning and length. Earlier it used to store string end.

llvm-svn: 76841
2009-07-23 02:00:51 +00:00
Reid Kleckner 921673225c Reverting r76825 and r76828, since they caused clang runtime errors and some build failure involving memset.
llvm-svn: 76838
2009-07-23 01:40:54 +00:00
Devang Patel e059ba6ed2 Derive MDNode from MetadataBase instead of Constant. Emit MDNodes into METADATA_BLOCK in bitcode file.
llvm-svn: 76834
2009-07-23 01:07:34 +00:00
Reid Kleckner 1a722d9b73 Make the JIT code emitter properly retry and ask for more memory when it runs
out of memory, and also make the default memory manager allocate more memory
when it runs out.

Also, switch function stubs and global data over to using the BumpPtrAllocator.

This makes it so the JIT no longer mmaps (or the equivalent on Windows) 16 MB
of memory, and instead allocates in 512K slabs.  I suspect this size could go
lower, especially on embedded platforms, now that more slabs can be allocated.

llvm-svn: 76828
2009-07-23 00:49:59 +00:00
Reid Kleckner 5bd6105d65 Parameterize the BumpPtrAllocator over a slab allocator. It defaults to using
malloc, so there should be no functional changes to other code.

These changes are necessary since I have plans to use this allocator in the JIT
memory manager, and it needs a special allocator.

I also added some tests which helped me pinpoint some bugs.

llvm-svn: 76825
2009-07-23 00:30:41 +00:00
Daniel Dunbar e23388b25c Support writing a StringRef to a raw_ostream directly.
llvm-svn: 76754
2009-07-22 17:13:20 +00:00
Ryan Flynn a845ef0be7 cast signed APInt constructor params to uint64_t to suppress signedness warning
llvm-svn: 76744
2009-07-22 16:17:36 +00:00
Daniel Dunbar 1f982105a6 Add StringRef::{substr, startswith}.
llvm-svn: 76559
2009-07-21 09:18:49 +00:00
Daniel Dunbar 25f9fc5851 Add StringRef class, with fixes.
llvm-svn: 76543
2009-07-21 07:28:51 +00:00
Torok Edwin e32cd94b47 unbreak unit-tests on gcc-4.4.
llvm-svn: 76542
2009-07-21 07:09:05 +00:00
Nick Lewycky 567daf3ce8 Fix ConstantRange::unionWith. Also make it work a little hard in some cases to
return the smallest union of two ranges instead of just any range that happens
to contain the union.

llvm-svn: 76360
2009-07-19 03:44:35 +00:00
Nick Lewycky 0d13903563 Replace intersectWith with maximalIntersectWith. The latter guarantees that
all values belonging to the intersection will belong to the resulting range.
The former was inconsistent about that point (either way is fine, just pick
one.) This is part of PR4545.

llvm-svn: 76289
2009-07-18 06:34:42 +00:00
Daniel Dunbar 38e46c46b4 Unbreak unittests build.
- Reid, please check, I'm not sure if this is what was intended.

llvm-svn: 76286
2009-07-18 06:08:49 +00:00
Reid Kleckner fc8a2d5a83 Add EngineBuilder to ExecutionEngine in favor of the five optional argument EE::create().
Also a test commit.

llvm-svn: 76276
2009-07-18 00:42:18 +00:00
Daniel Dunbar e5df197e70 Add SmallString unit test.
- Patch by Ryan Flynn!

llvm-svn: 76081
2009-07-16 17:00:06 +00:00
Owen Anderson b6b2530000 Move EVER MORE stuff over to LLVMContext.
llvm-svn: 75703
2009-07-14 23:09:55 +00:00
Dan Gohman 734759e5db Port this unittest to use LLVMContext.
llvm-svn: 75583
2009-07-14 01:26:26 +00:00
Nick Lewycky 571bf54569 Fix an error in ConstantRange::getSignedMax on wrapped ranges. Thanks once
again to Daniel Dunbar and KLEE!

llvm-svn: 75449
2009-07-13 04:50:21 +00:00
Nick Lewycky 5edc459220 'i8 full-range' sign extended to i16 should equal [-128, 128) not [-128, 127).
Found by Daniel Dunbar and KLEE.

llvm-svn: 75448
2009-07-13 04:17:23 +00:00
Owen Anderson 53a52215b5 Begin the painful process of tearing apart the rat'ss nest that is Constants.cpp and ConstantFold.cpp.
This involves temporarily hard wiring some parts to use the global context.  This isn't ideal, but it's
the only way I could figure out to make this process vaguely incremental.

llvm-svn: 75445
2009-07-13 04:09:18 +00:00
Nick Lewycky 5302389442 Multiply was very wrong for wrapped ranges. This supplies a half-fix that will
generally return Full on all wrapped inputs. "Fixes" PR4545.

llvm-svn: 75444
2009-07-13 03:27:41 +00:00
Nick Lewycky 73b704dd9c Fix a bug summing two full sets. The overflow checking doesn't handle sets as
large as the full set, only those one size smaller. Thanks to Daniel Dunbar
who found this bug using Klee!

llvm-svn: 75443
2009-07-13 02:49:08 +00:00
Daniel Dunbar 6d6023b5f7 Clarify a FIXME.
llvm-svn: 75422
2009-07-12 19:45:34 +00:00
Nick Lewycky f1b8cb3760 Implement udiv for ConstantRanges.
llvm-svn: 75413
2009-07-12 05:18:18 +00:00