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

1292 Commits

Author SHA1 Message Date
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
Jeffrey Yasskin
c5bf1f8ad9 Move the Function*->allocated blocks map from the JITMemoryManager to the
JITEmitter.

I'm gradually making Functions auto-remove themselves from the JIT when they're
destroyed. In this case, the Function needs to be removed from the JITEmitter,
but the map recording which Functions need to be removed lived behind the
JITMemoryManager interface, which made things difficult.

This patch replaces the deallocateMemForFunction(Function*) method with a pair
of methods deallocateFunctionBody(void *) and deallocateExceptionTable(void *)
corresponding to the two startFoo/endFoo pairs.

llvm-svn: 84651
2009-10-20 18:13:21 +00:00
Daniel Dunbar
0d83671555 PowerPC ifdef'ing considered more complicated than one might like.
llvm-svn: 84603
2009-10-20 05:33:23 +00:00
Nick Lewycky
ce81bfe51c Correct test for PowerPC.
llvm-svn: 84595
2009-10-20 04:09:50 +00:00
Daniel Dunbar
6de2000f8f Also check for __POWERPC__ when skipping these tests.
llvm-svn: 84482
2009-10-19 09:19:32 +00:00
Daniel Dunbar
5aa3eebc5d Add raw_ostream::write_escaped, for writing escaped strings.
llvm-svn: 84355
2009-10-17 20:43:08 +00:00
Benjamin Kramer
1ae4bc038e Disable another unittest that doesn't work on arm and ppc.
llvm-svn: 84186
2009-10-15 16:49:16 +00:00
Nick Lewycky
9b8cbbe11a The ARM and PowerPC jits are broken in this regard.
llvm-svn: 84128
2009-10-14 20:04:41 +00:00
Jeffrey Yasskin
8a0bdbb7f3 Keep track of stubs that are created. This fixes PR5162 and probably PR4822 and
4406. Patch by Nick Lewycky!

llvm-svn: 84032
2009-10-13 21:32:57 +00:00
Jeffrey Yasskin
3eacbf419d Make the ExecutionEngine automatically remove global mappings on when their
GlobalValue is destroyed.  Function destruction still leaks machine code and
can crash on leaked stubs, but this is some progress.

llvm-svn: 83987
2009-10-13 17:42:08 +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
Jeffrey Yasskin
7d85d5a366 Fix http://llvm.org/PR5160, to let CallbackVHs modify other ValueHandles on the
same Value without breaking things.

llvm-svn: 83861
2009-10-12 17:43:32 +00:00
Jeffrey Yasskin
7edab17bef ExecutionEngine::clearGlobalMappingsFromModule failed to remove reverse
mappings, which could cause errors and assert-failures.  This patch fixes that,
adds a test, and refactors the global-mapping-removal code into a single place.

llvm-svn: 83678
2009-10-09 22:10:27 +00:00
Jeffrey Yasskin
d326d37781 Fix illegal cross-type aliasing. Found by baldrick on a newer gcc.
llvm-svn: 83401
2009-10-06 19:06:16 +00:00
Duncan Sands
2400ad7236 Introduce and use convenience methods for getting pointer types
where the element is of a basic builtin type.  For example, to get
an i8* use getInt8PtrTy.

llvm-svn: 83379
2009-10-06 15:40:36 +00:00
Jeffrey Yasskin
4b011e6a51 Fix http://llvm.org/PR5116 by rolling back r60822. This passes `make unittests
check-lit` on both x86-64 Linux and x86-32 Darwin.

llvm-svn: 83353
2009-10-06 00:35:55 +00:00
Benjamin Kramer
bb7785eb81 Try to fix unit test linking on linux ...
llvm-svn: 83252
2009-10-02 19:52:33 +00:00
Benjamin Kramer
8cebbc5761 MingW build fixes
- MingW needs -lpsapi (in ${LIBS}) linked after -lLLVMSystem.
  Noticed by Ronald Pijnacker!

- Some parts of the System library must be build with exceptions on windows.
  Based on a patch by Jay Foad!

llvm-svn: 83251
2009-10-02 19:36:31 +00:00
Nick Lewycky
6057c1a998 New unit test for the cloning module, which so far only covers cloning of
instructions' optimization flags.

llvm-svn: 82934
2009-09-27 21:39:46 +00:00
Nick Lewycky
171d7954c3 Link order: it matters.
llvm-svn: 82925
2009-09-27 20:58:01 +00:00
Chris Lattner
b47463f436 remove support for "NoSub" from regex. It seems like a minor optimization
and makes the API more annoying.  Add a Regex::getNumMatches() method.

llvm-svn: 82877
2009-09-26 21:27:04 +00:00
Jeffrey Yasskin
ae5a12200c Fix a compile failure introduced by r82675 on MinGW which doesn't have
setenv().  This patch just disables the test rather than getting putenv() to
work.  Thanks to Sandeep Patel for reporting the problem.

llvm-svn: 82797
2009-09-25 21:07:20 +00:00
Chris Lattner
af2ce37cb3 add and document regex support for FileCheck. You can now do stuff like:
; CHECK: movl {{%e[a-z][xi]}}, %eax

or whatever.

llvm-svn: 82717
2009-09-24 21:47:32 +00:00
Jeffrey Yasskin
2ca8a35c0f Roll back r82348, which introduced an infinite loop in ParseCStringVector() that
a trivial unittest would have caught.  This revision also adds the trivial
unittest.

llvm-svn: 82675
2009-09-24 01:14:07 +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
f1b6d523e4 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
23724b98d0 Attempt to fix some 4.0.0 build warnings.
llvm-svn: 81752
2009-09-14 02:38:53 +00:00
Daniel Dunbar
49c00ccc78 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
b57fad2300 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
f78cd25928 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
9eba9d4828 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
a78433a090 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
603f919e21 Update unittests for MDNode uniquing disable.
llvm-svn: 81142
2009-09-07 04:19:02 +00:00
Daniel Dunbar
7ef30987f7 Simplify, now that gtest supports raw_ostream directly.
llvm-svn: 81102
2009-09-06 02:31:26 +00:00
Nick Lewycky
729d642928 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
25713a50a3 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
29f5444a38 Add test for PR4873, which works for me.
llvm-svn: 80965
2009-09-03 22:57:02 +00:00
Devang Patel
27616c3c80 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
317ab82083 Revert 80839 for now. It causes test failures.
llvm-svn: 80841
2009-09-02 21:49:26 +00:00
Devang Patel
c4be6559c4 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
2a64f7b891 Disable uniqueness test for now.
llvm-svn: 80741
2009-09-02 00:16:33 +00:00
Chris Lattner
993712b47e update unit test for previous change.
llvm-svn: 80528
2009-08-31 00:28:46 +00:00
Torok Edwin
21897521c1 Add regular expression matching support, based on OpenBSD regexec()/regcomp()
implementation.

llvm-svn: 80493
2009-08-30 08:24:09 +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
Daniel Dunbar
e58499843b 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
1a57523da2 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
811acc1a6e upgrade for removed functions.
llvm-svn: 79822
2009-08-23 04:47:35 +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
Misha Brukman
93431d032f Fixed header comment.
llvm-svn: 79536
2009-08-20 17:01:14 +00:00
Daniel Dunbar
73d53b538a Add min and max tests.
llvm-svn: 79454
2009-08-19 19:58:19 +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
Owen Anderson
9df206d02d Push LLVMContexts through the IntegerType APIs.
llvm-svn: 78948
2009-08-13 21:58:54 +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
Benjamin Kramer
a191584fca 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
f4e8af6ecc StringRef: Add find(char) and find(StringRef).
Also, regroup functions.

llvm-svn: 78712
2009-08-11 20:47:15 +00:00
Jeffrey Yasskin
20848835bf 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
b904acbec0 Update unit test.
llvm-svn: 78260
2009-08-05 23:28:57 +00:00
Jeffrey Yasskin
61af405985 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
44b1be9788 Remove now empty unit test directory.
llvm-svn: 77790
2009-08-01 19:07:29 +00:00
Chris Lattner
c0be87a893 daniel says it's fine to nuke this.
llvm-svn: 77789
2009-08-01 18:38:21 +00:00
Chris Lattner
4efd0874b1 update for new api
llvm-svn: 77788
2009-08-01 18:35:49 +00:00
Owen Anderson
f86b0eb2a0 Fix unit tests.
llvm-svn: 77734
2009-07-31 21:38:10 +00:00
Benjamin Kramer
3f60efddfa Update unittest for LLVM API change.
llvm-svn: 77730
2009-07-31 20:56:31 +00:00
Owen Anderson
1dc40e205b 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
95715c96f3 Adjust unit test for the MCSection changes.
llvm-svn: 77714
2009-07-31 19:12:33 +00:00
Owen Anderson
93ccaf5c60 Move more code back to 2.5 APIs.
llvm-svn: 77635
2009-07-30 23:03:37 +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
Benjamin Kramer
85fa67c3c5 fix a unitialized pointer in NamedMDNode (and reenable unittest)
llvm-svn: 77597
2009-07-30 15:35:55 +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
Daniel Dunbar
9ac19401cd Disable the NamedMDNodeTest, it is failing everywhere.
llvm-svn: 77569
2009-07-30 02:08:27 +00:00
Devang Patel
fc9ef39a7e Add NamedMDNode test.
llvm-svn: 77550
2009-07-30 00:03:41 +00:00
Owen Anderson
881d928f9b Move types back to the 2.5 API.
llvm-svn: 77516
2009-07-29 22:17:13 +00:00
Benjamin Kramer
2464dfa8df Update unittest for LLVM API change.
llvm-svn: 77496
2009-07-29 19:18:13 +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
Benjamin Kramer
bb77e8e124 fix unittest
llvm-svn: 77375
2009-07-28 22:03:24 +00:00
Benjamin Kramer
6e3704568e 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
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
Reid Kleckner
b159a2bad6 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
9f50ab3c49 Finish migrating VMCore to StringRef/Twine based APIs.
llvm-svn: 77051
2009-07-25 06:02:13 +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
Owen Anderson
cc33e89571 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
6f78d7ac27 Add Twine ADT.
- Not currently used.

llvm-svn: 76956
2009-07-24 07:04:27 +00:00
Reid Kleckner
74ff34ab48 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
3f197c850d 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
5a7816053e 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
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
Devang Patel
45ce5c2ac1 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
6f9bf7f028 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
6b2162686a 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
b500f07edf 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
4c892c05ec 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
6bbe0f1151 Support writing a StringRef to a raw_ostream directly.
llvm-svn: 76754
2009-07-22 17:13:20 +00:00
Ryan Flynn
a78abdc35e 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
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
Nick Lewycky
3b459607de 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
ec10fcbd04 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
cf0c706052 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
5460ad390c 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
156565ace2 Add SmallString unit test.
- Patch by Ryan Flynn!

llvm-svn: 76081
2009-07-16 17:00:06 +00:00
Owen Anderson
8c85061ee6 Move EVER MORE stuff over to LLVMContext.
llvm-svn: 75703
2009-07-14 23:09:55 +00:00
Dan Gohman
b4db50265f Port this unittest to use LLVMContext.
llvm-svn: 75583
2009-07-14 01:26:26 +00:00
Nick Lewycky
0cc1d245c4 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
41a9bdab7b '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
393d8b0a0c 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
fee90bcb80 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
7280c39dc7 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
29416147f7 Clarify a FIXME.
llvm-svn: 75422
2009-07-12 19:45:34 +00:00
Nick Lewycky
dc5ef94320 Implement udiv for ConstantRanges.
llvm-svn: 75413
2009-07-12 05:18:18 +00:00
Nick Lewycky
7cb010e885 This is not overly conservative.
Some = [10, 2730). A subset of that is [1024..2048) which covers every possible
10-bit pattern.

llvm-svn: 75411
2009-07-12 02:28:40 +00:00
Nick Lewycky
6663d6ad6f Implement ConstantRange::multiply based on the code in LoopVR.
llvm-svn: 75410
2009-07-12 02:19:05 +00:00
Nick Lewycky
3e43cd4105 Fix handling of max and full set.
A full set is a constant range that represents any number. If you take the
umax of that and [5, 10) you end up with [5, INT_MAX] because the values less
than 5 would be umax's against a value which is at least 5.

llvm-svn: 75372
2009-07-11 19:22:21 +00:00
Nick Lewycky
d2817afb0e Break the world's largest unit test down a few logical lines. No semantic
changes.

llvm-svn: 75369
2009-07-11 18:43:20 +00:00
Dan Gohman
6f78ed8f74 Don't use a void return type with a function that returns a value.
llvm-svn: 75364
2009-07-11 13:56:14 +00:00
Owen Anderson
565efa7c72 Fix unit tests.
llvm-svn: 75262
2009-07-10 18:58:29 +00:00
Dan Gohman
8a58b8f83b Revert the part of 75177 that split ConstantRange into two classes, and
merge the new functionality and unittests into ConstantRange. Thanks to
Nick Lewycky for pointing out that it isn't necessary to have two separate
classes here.

llvm-svn: 75191
2009-07-09 23:16:10 +00:00
Dan Gohman
33251eff97 Add a ConstantSignedRange class, which does for signed integers
what ConstantRange does for unsigned integers. Factor out a
common base class for common functionality.

Add some new functions for performing arithmetic on constant
ranges. Some of these are currently just stubbed out with
conservative implementations.

Add unittests for ConstantRange and ConstantSignedRange.

llvm-svn: 75177
2009-07-09 22:07:27 +00:00
Jeffrey Yasskin
2ef60bd58a Add an option to allocate JITed global data separately from code. By
default, this option is not enabled to support clients who rely on
this behavior.

Fixes http://llvm.org/PR4483

A patch to allocate additional memory for globals after we run out is
forthcoming.

Patch by Reid Kleckner!

llvm-svn: 75059
2009-07-08 21:59:57 +00:00
Devang Patel
23e55694c5 Drop "constant" from
!0 = constant metadata !{...}

llvm-svn: 75057
2009-07-08 21:57:07 +00:00
Devang Patel
cbb39980cf Update SLotTracker to handle MDNode slots.
Simplify MDNode printing.

llvm-svn: 75053
2009-07-08 21:44:25 +00:00
Owen Anderson
cf112e59c3 Hold the LLVMContext by reference rather than by pointer.
llvm-svn: 74640
2009-07-01 21:22:36 +00:00
Owen Anderson
a2b98c3a6e Fix unit tests for LLVMContext+Module.
llvm-svn: 74622
2009-07-01 18:14:20 +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
Daniel Dunbar
b60266824c Fix order of arguments to EXPECT_EQ
llvm-svn: 74441
2009-06-29 19:57:24 +00:00
Torok Edwin
9c5c74d4ca Call doInitialization(), releaseMemory(), and doFinalization() for on-the-fly passes as well.
Also don't call finalizers for LoopPass if initialization was not called.
Add a unittest that tests that these methods are called, in the proper
order, and the correct number of times.

llvm-svn: 74438
2009-06-29 18:49:09 +00:00
Jeffrey Yasskin
c431f61520 Add a JITEventListener interface that gets called back when a new function is
emitted or the machine code for a function is freed.  Chris mentioned that we
may also want a notification when a stub is emitted, but that'll be a future
change.  I intend to use this to tell oprofile where functions are emitted and
what lines correspond to what addresses.

llvm-svn: 74157
2009-06-25 02:04:04 +00:00
Daniel Dunbar
5f2b8ca5e4 Sketch streamer support for .align, .org functionality.
llvm-svn: 74109
2009-06-24 19:25:34 +00:00
Daniel Dunbar
082dc70875 We decided to not worry about Atoms for now, it should be straightforward to
reintroduce them later.

Also, don't require MCSection* when creating a symbol.

llvm-svn: 74081
2009-06-24 17:00:42 +00:00
Daniel Dunbar
691e6009bd MCStreamer: Test printing values.
llvm-svn: 74076
2009-06-24 16:05:35 +00:00
Daniel Dunbar
0e5051b251 Start MCAsmStreamer implementation.
llvm-svn: 74044
2009-06-24 01:03:06 +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
Nick Lewycky
a9de2f1c81 Give embedded metadata its own type instead of relying on EmptyStructTy.
llvm-svn: 72610
2009-05-30 05:06:04 +00:00
Daniel Dunbar
711313f3ac Fix a compile warning.
llvm-svn: 71993
2009-05-18 03:44:24 +00:00
Nick Lewycky
f417462ddf Make MDNode use CallbackVH. Also change MDNode to store Value* instead of
Constant* in preperation of a future change to support holding non-Constants
in an MDNode.

llvm-svn: 71407
2009-05-10 20:57:05 +00:00
Dan Gohman
dc96a23780 Apply Jeffrey Yasskin's CallbackVH patch, with minor tweaks from me
to make the copy constructor and destructor protected, and corresponding
adjustments to the unittests.

llvm-svn: 70644
2009-05-02 21:10:48 +00:00
Stuart Hastings
b3c08d427a Prevent looping when DenseSet is abused.
llvm-svn: 70572
2009-05-01 20:47:53 +00:00
Jeffrey Yasskin
114afdef8b Add tests for WeakVH and AssertingVH. These pointed out that the overloads for
the comparison operators were not only unnecessary in the presence of the
implicit conversion; they caused ambiguous overload errors. So I deleted them.

llvm-svn: 70243
2009-04-27 20:32:07 +00:00
Chris Lattner
46c25c1285 Add a new TypeBuilder helper class, which eases making LLVM IR types.
Patch by Jeffrey Yasskin!

llvm-svn: 70084
2009-04-25 22:14:04 +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
Chris Lattner
e90528cac5 "I got annoyed at the compiler warnings from ConstantInt::get(Ty, -1,
true), and casts make me nervous and are verbose anyway, so here's a
ConstantInt::getSigned(Ty, int64_t) method. Just overloading
ConstantInt::get() to take an int64_t too would cause ambiguous
overload errors."

Patch by Jeffrey Yasskin!

llvm-svn: 69958
2009-04-24 05:30:14 +00:00
Owen Anderson
d2cf86afcb Use the testcase from PR2791.
llvm-svn: 69846
2009-04-23 00:15:26 +00:00
Nick Lewycky
c7edd80c95 Fix pointer casting problem.
llvm-svn: 68668
2009-04-09 03:10:03 +00:00
Misha Brukman
37fb714033 Fixed compiler warning.
llvm-svn: 68664
2009-04-09 00:42:37 +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
Nick Lewycky
eea5412e19 Add support for embedded metadata to LLVM. This introduces two new types of
Constant, MDString and MDNode which can only be used by globals with a name
that starts with "llvm." or as arguments to a function with the same naming
restriction.

llvm-svn: 68420
2009-04-04 07:22:01 +00:00
Bill Wendling
b61223b65b Make the constants fit.
llvm-svn: 68258
2009-04-01 22:44:18 +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
f4a8fdc064 Added tests for math utility functions; fixed another test's header comment.
llvm-svn: 68249
2009-04-01 21:36:40 +00:00
Misha Brukman
a47cb48efd include Makefile.common before using $(BuildMode) to get its definition
llvm-svn: 68167
2009-04-01 00:35:00 +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
Daniel Dunbar
41c5cb70e2 Minimal raw_ostream unit tests
llvm-svn: 67083
2009-03-17 16:14:59 +00:00
Nick Lewycky
bc0bb948cc Remove libtool.
llvm-svn: 65517
2009-02-26 07:44:16 +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
Bill Wendling
a0155c41c9 Modify the unittests Makefiles so that they don't rebuild parts of LLVM just to
run the tests. Most of this was stolen from the llvm/test Makefiles.

llvm-svn: 61648
2009-01-04 23:12:21 +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
Nuno Lopes
1ad1461930 make 'make clean' remove test binaries as well
llvm-svn: 61572
2009-01-02 12:25:22 +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