Commit Graph

475 Commits

Author SHA1 Message Date
Jay Foad 814f1bb8e3 Remove the "ugly" method BranchInst::setUnconditionalDest().
llvm-svn: 123026
2011-01-07 20:26:51 +00:00
Michael J. Spencer 1d3c4a7b94 UnitTests/Path: Add magical tests. This will also test identify_magic.
llvm-svn: 122948
2011-01-06 05:58:02 +00:00
Michael J. Spencer 1f06360002 UnitTests/Path: More ASSERT_NO_ERROR cleanup.
llvm-svn: 122947
2011-01-06 05:57:54 +00:00
Michael J. Spencer 42368cc15f UnitTests/Path: Fix typo, add error number, and enable the directory cleanup code.
llvm-svn: 122885
2011-01-05 16:39:46 +00:00
Michael J. Spencer 346a13381a UnitTests/PathV2: Setup a test fixture to make tracking created file system
entities easier.

llvm-svn: 122880
2011-01-05 16:39:05 +00:00
Michael J. Spencer 52714863db Support/PathV2: Implement directory iteration on POSIX.
llvm-svn: 122879
2011-01-05 16:38:57 +00:00
Michael J. Spencer 3b264ba91a UnitTests/Path: Produce useful diagnostics on error.
llvm-svn: 122812
2011-01-04 17:00:18 +00:00
Chris Lattner 1be1fe033c fix PR8867: a crash handling fp128. Thanks to Nick for the testcase.
llvm-svn: 122613
2010-12-29 01:33:36 +00:00
Jeffrey Yasskin 9b43f33620 Change all self assignments X=X to (void)X, so that we can turn on a
new gcc warning that complains on self-assignments and
self-initializations.

llvm-svn: 122458
2010-12-23 00:58:24 +00:00
Jakob Stoklund Olesen baee655c5e Add ADT/IntEqClasses.h as a light-weight implementation of EquivalenceClasses.h.
This implementation already exists as ConnectedVNInfoEqClasses in
LiveInterval.cpp, and it seems to be generally useful to have a light-weight way
of forming equivalence classes of small integers.

IntEqClasses doesn't allow enumeration of the elements in a class.

llvm-svn: 122293
2010-12-21 00:04:46 +00:00
Jakob Stoklund Olesen 00b29fbdec Add more checks to IntervalMapOverlaps::advance() to ensure that advanceTo sees
monotonic keys.

llvm-svn: 122093
2010-12-17 22:07:54 +00:00
Jakob Stoklund Olesen 54912ed921 It is allowed to call IntervalMap::const_iterator::advanceTo() with a key that
moves the iterator to end(), and it is valid to call it on end().

That means it is valid to call advanceTo() with any monotonic key sequence.

llvm-svn: 122092
2010-12-17 22:07:51 +00:00
Jakob Stoklund Olesen 213de04d75 Fix crash when IntervalMapOverlaps::advanceTo moves past the last overlap.
llvm-svn: 122081
2010-12-17 19:18:38 +00:00
Jakob Stoklund Olesen 649a72b94e Complete tests for IntervalMapOverlaps.
llvm-svn: 122019
2010-12-17 01:31:49 +00:00
Jakob Stoklund Olesen af49e9774a Add basic test exposing many bugs.
llvm-svn: 121995
2010-12-16 19:46:09 +00:00
Michael J. Spencer f616b218c8 Support/PathV2: Change most functions in the path namespace to return their work
via their return value instead of an out parameter.

llvm-svn: 121149
2010-12-07 17:04:04 +00:00
Frits van Bommel 716f34c6fb CMake: Fix warning in gtest header used by unit tests.
llvm-svn: 121127
2010-12-07 10:22:07 +00:00
Jay Foad 583abbc4df 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
NAKAMURA Takumi 7291ebc353 unittests/CMakeLists.txt: Tweak unittests' layout to be identical to GNU build.
llvm-svn: 121117
2010-12-07 07:41:23 +00:00
Michael J. Spencer 1e090f0b8f Support/PathV2: Remove the error_code return type from all functions in the path
namespace. None of them return anything except for success anyway. These will be
converted to returning their result soon.

llvm-svn: 121109
2010-12-07 03:57:37 +00:00
Michael J. Spencer 92903a3339 Support/PathV2: Move make_absolute from path to fs.
llvm-svn: 121108
2010-12-07 03:57:17 +00:00
Michael J. Spencer 7ecd94cc0b Support/FileSystem: Add directory_iterator implementation.
llvm-svn: 120989
2010-12-06 04:28:42 +00:00
Michael J. Spencer 4fb115d2f3 Unittests/Support/PathV2: Add FileSystem tests.
llvm-svn: 120888
2010-12-04 03:18:42 +00:00
Jakob Stoklund Olesen e7ed7b6cfd Add IntervalMap::iterator::set{Start,Stop,Value} methods that allow limited
editing of the current interval.

These methods may cause coalescing, there are corresponding set*Unchecked
methods for editing without coalescing. The non-coalescing methods are useful
for applying monotonic transforms to all keys or values in a map without
accidentally coalescing transformed and untransformed intervals.

llvm-svn: 120829
2010-12-03 19:02:00 +00:00
Michael J. Spencer 6e74e11c85 Support/FileSystem: Add remove implementation.
llvm-svn: 120817
2010-12-03 17:53:43 +00:00
Benjamin Kramer 23e6bdf1ae unittests/Support/PathV2: remove(3) requires a terminated string.
llvm-svn: 120803
2010-12-03 12:33:32 +00:00
Michael J. Spencer b5ca6447bb Unittests/Support/PathV2: Cleanup and remove output.
llvm-svn: 120785
2010-12-03 02:22:34 +00:00
Michael J. Spencer ab16054770 unittests/Support/PathV2: Comment out test because some systems are saying that
a file exists when it shouldn't.

llvm-svn: 120784
2010-12-03 02:10:30 +00:00
Michael J. Spencer 4571040ea1 Support/FileSystem: Add unique_file and exists implementations.
llvm-svn: 120776
2010-12-03 01:21:28 +00:00
Michael J. Spencer 75942f9d93 Make valgrind happy.
llvm-svn: 120616
2010-12-01 22:28:42 +00:00
Michael J. Spencer f2cc8287ed Support/ADT/Twine: Add toNullTerminatedStringRef.
llvm-svn: 120600
2010-12-01 20:37:30 +00:00
Michael J. Spencer 9ceae88ffc unittests/Support/PathV2: Fix -pedantic warning.
llvm-svn: 120590
2010-12-01 19:23:49 +00:00
Jay Foad 25a5e4ca1f PR5207: Rename overloaded APInt methods set(), clear(), flip() to
setAllBits(), setBit(unsigned), etc.

llvm-svn: 120564
2010-12-01 08:53:58 +00:00
Michael J. Spencer a72df5fae8 Support/PathV2: Add is_{absolute,relative} implementation.
llvm-svn: 120560
2010-12-01 06:21:53 +00:00
Michael J. Spencer 112a769379 Support/PathV2: Add has_{root_path,root_name,root_directory,parent_path,filename,stem,extension} implementation.
llvm-svn: 120559
2010-12-01 06:03:50 +00:00
Michael J. Spencer 4d0c6fdda6 unittests/Support/PathV2: Make tests much shorter; although harder to understand.
I'm going to replace this all anyway with a proper table and separated tests
when done.

llvm-svn: 120558
2010-12-01 06:03:33 +00:00
Michael J. Spencer 87106c59ed Support/PathV2: Add extension implementation.
llvm-svn: 120550
2010-12-01 03:37:41 +00:00
Michael J. Spencer 956955ed8b Support/PathV2: Add stem implementation.
llvm-svn: 120547
2010-12-01 03:18:33 +00:00
Michael J. Spencer 142692006b Support/PathV2: Add filename implementation.
llvm-svn: 120546
2010-12-01 03:18:17 +00:00
Michael J. Spencer 8002500ee1 Support/PathV2: Add native implementation.
llvm-svn: 120539
2010-12-01 02:48:27 +00:00
Michael J. Spencer fb3a95d8e2 Support/PathV2: Add replace_extension implementation.
llvm-svn: 120514
2010-12-01 00:52:55 +00:00
Michael J. Spencer 9c594095a6 Support/PathV2: Add remove_filename implementation.
llvm-svn: 120513
2010-12-01 00:52:28 +00:00
Michael J. Spencer 545cbdf063 Support/PathV2: Implement reverse iteration and parent_path.
llvm-svn: 120496
2010-11-30 23:28:07 +00:00
Michael J. Spencer b775d0b3ad Support/PathV2: Fix 80 col.
llvm-svn: 120349
2010-11-29 23:35:49 +00:00
Michael J. Spencer 3ef91c5593 unittests: Merge SystemTests back into SupportTests.
llvm-svn: 120330
2010-11-29 22:29:04 +00:00
Michael J. Spencer ebad2f9d36 Support: Add PathV2 implementation.
llvm-svn: 120329
2010-11-29 22:28:51 +00:00
Michael J. Spencer 447762da85 Merge System into Support.
llvm-svn: 120298
2010-11-29 18:16:10 +00:00
Jakob Stoklund Olesen 7aad398e0a Disallow overlapping inserts, even when inserting the same value.
We always disallowed overlapping inserts with different values, and this makes
the insertion code smaller and faster.

If an overwriting insert is needed, it can be added as a separate method that
trims any existing intervals before inserting. The immediate use cases for
IntervalMap don't need this - they only use disjoint insertions.

llvm-svn: 120264
2010-11-28 22:17:11 +00:00
Jakob Stoklund Olesen 8710e4f1ef Add default constructors for iterators.
These iterators don't point anywhere, and they can't be compared to anything.
They are only good for assigning to.

llvm-svn: 120239
2010-11-28 07:21:48 +00:00
Jakob Stoklund Olesen bd1a50e68f Implement const_iterator::advanceTo().
This is a version of find() that always searches forwards and is faster for
local searches.

llvm-svn: 120237
2010-11-28 07:00:46 +00:00
Jakob Stoklund Olesen 056356d502 Add more tests for erase(). Fix a few exposed bugs.
llvm-svn: 120227
2010-11-27 22:56:53 +00:00
Jakob Stoklund Olesen bb4bece211 Add test case with randomly ordered insertions, massive coalescing.
Implement iterator::erase() in a simple version that erases nodes when they
become empty, but doesn't try to redistribute elements among siblings for better
packing.

Handle coalescing across leaf nodes which may require erasing entries.

llvm-svn: 120226
2010-11-27 21:12:36 +00:00
NAKAMURA Takumi 98fa0159fc unittests/JITTests: Don't use --export-dynamic but --export-all-symbols on cygming.
GNU ld/PECOFF accepts but ignores them below;
  --version-script
  --export-dynamic
  --rpath

FIXME: autoconf should be aware of them.
llvm-svn: 120179
2010-11-26 09:32:02 +00:00
Jakob Stoklund Olesen 5e9c70ee57 Add B+-tree test case that creates a height 3 tree with a smaller root node.
Change temporary debugging code to write a dot file directly.

llvm-svn: 120171
2010-11-26 06:54:20 +00:00
Michael J. Spencer 02dd5544c4 google test depends on Support.
llvm-svn: 120105
2010-11-24 19:35:15 +00:00
Michael J. Spencer c33a41db85 unittests: Add initial Path-V2 test.
llvm-svn: 120103
2010-11-24 19:20:28 +00:00
Michael J. Spencer 98847783f2 unittests: Add SystemTests.
llvm-svn: 120101
2010-11-24 19:20:05 +00:00
Ted Kremenek 1ef52416c7 Tweak ImmutableMap/ImmutableSet/ImmutableList APIs
to use lowercase letters for the start of most
method names and to replace some method names
with more descriptive names (e.g., "getLeft()"
instead of "Left()").  No real functionality
change.

llvm-svn: 120070
2010-11-24 00:54:28 +00:00
Chris Lattner 8bec7227d4 reimplement SwapByteOrder.h in terms of overloading instead of
being in terms of excessively complex template logic.

llvm-svn: 119992
2010-11-23 04:04:25 +00:00
Jakob Stoklund Olesen c041268c8c Implement IntervalMap::clear().
llvm-svn: 119872
2010-11-19 23:28:57 +00:00
Jakob Stoklund Olesen 46389fda3b Support backwards iteration starting from end().
llvm-svn: 119871
2010-11-19 23:28:53 +00:00
Dale Johannesen 87a98b57b8 Add test for PR 8111. By Frits van Bommel.
llvm-svn: 119870
2010-11-19 23:23:22 +00:00
Jakob Stoklund Olesen 345945e355 Add ADT/IntervalMap.
This is a sorted interval map data structure for small keys and values with
automatic coalescing and bidirectional iteration over coalesced intervals.

Except for coalescing intervals, it provides similar functionality to std::map.
It is however much more compact for small keys and values, and hopefully faster
too.

The container object itself can hold the first few intervals without any
allocations, then it switches to a cache conscious B+-tree representation. A
recycling allocator can be shared between many containers, even between
containers holding different types.

The IntervalMap is initially intended to be used with SlotIndex intervals for:

- Backing store for LiveIntervalUnion that is smaller and faster than std::set.

- Backing store for LiveInterval with less overhead than std::vector for typical
  intervals and O(N log N) merging of large intervals. 99% of virtual registers
  need 4 entries or less and would benefit from the small object optimization.

- Backing store for LiveDebugVariable which doesn't exist yet, but will track
  debug variables during register allocation.

This is a work in progress. Missing items are:

- Performance metrics.
- erase().
- insert() shrinkage.
- clear().
- More performance metrics.
- Simplification and detemplatization.

llvm-svn: 119787
2010-11-19 04:47:19 +00:00
NAKAMURA Takumi 1818edb53f unittests/CMakeLists.txt: [PR8225] Tweak linking JITTests on MSVC to add JITTests.def.
CMake can pass *.def to link.exe.

llvm-svn: 119783
2010-11-19 03:19:42 +00:00
NAKAMURA Takumi 7a953baa1d unittests/CMakeLists.txt: Suppress building ValueMapTest on MSVC older than 10(VS2010).
MSVC9 and 8 cannot compile ValueMapTest.cpp due to their bug.
See issue#331418 in Visual Studio.

llvm-svn: 119782
2010-11-19 03:19:32 +00:00
Jakob Stoklund Olesen 09770251f6 Revert "Add ADT/IntervalMap.", GCC doesn't like it.
This reverts r119772.

llvm-svn: 119773
2010-11-19 01:21:03 +00:00
Jakob Stoklund Olesen 6d89171dcc Add ADT/IntervalMap.
This is a sorted interval map data structure for small keys and values with
automatic coalescing and bidirectional iteration over coalesced intervals.

Except for coalescing intervals, it provides similar functionality to std::map.
It is however much more compact for small keys and values, and hopefully faster
too.

The container object itself can hold the first few intervals without any
allocations, then it switches to a cache conscious B+-tree representation. A
recycling allocator can be shared between many containers, even between
containers holding different types.

The IntervalMap is initially intended to be used with SlotIndex intervals for:

- Backing store for LiveIntervalUnion that is smaller and faster than std::set.

- Backing store for LiveInterval with less overhead than std::vector for typical
  intervals and O(N log N) merging of large intervals. 99% of virtual registers
  need 4 entries or less and would benefit from the small object optimization.

- Backing store for LiveDebugVariable which doesn't exist yet, but will track
  debug variables during register allocation.

This is a work in progress. Missing items are:

- Performance metrics.
- erase().
- insert() shrinkage.
- clear().
- More performance metrics.
- Simplification and detemplatization.

llvm-svn: 119772
2010-11-19 01:14:40 +00:00
Jim Grosbach 96ef39a8db Revert 119600 to unbreak the build. Francois, please investigate.
llvm-svn: 119606
2010-11-18 01:38:07 +00:00
Francois Pichet ce52087bf3 Appease MSVC 2008: you can't use keyword this inside EXPECT_EQ().
This is because of bug 331418 on Microsoft Connect.

llvm-svn: 119600
2010-11-18 00:59:50 +00:00
NAKAMURA Takumi dddfdc81ef unittests/CMakeLists.txt: Add missing VMCore/ValueMapTest.cpp to VMCoreTests.
llvm-svn: 119040
2010-11-14 12:37:51 +00:00
NAKAMURA Takumi dd7bb199b7 unittests/CMakeLists.txt: Don't use RTTI, or linking failed.
llvm-svn: 117646
2010-10-29 08:59:43 +00:00
Oscar Fuentes b1f9380cac Document LLVM_BUILD_TESTS, LLVM_INCLUDE_TESTS. New convenience target
UnitTests for building all the unit tests.

llvm-svn: 117545
2010-10-28 14:38:35 +00:00
Chandler Carruth 88c54b82c1 Switch attribute macros to use 'LLVM_' as a prefix. We retain the old names
until other LLVM projects using these are cleaned up.

llvm-svn: 117200
2010-10-23 08:10:43 +00:00
Michael J. Spencer b550b66543 Support: Add Endian.h
llvm-svn: 117057
2010-10-21 20:28:21 +00:00
Michael J. Spencer 58efb6d19b unittests: Use the correct defines and global variables when building on CMake.
llvm-svn: 116834
2010-10-19 18:04:19 +00:00
Owen Anderson 6c18d1aac0 Get rid of static constructors for pass registration. Instead, every pass exposes an initializeMyPassFunction(), which
must be called in the pass's constructor.  This function uses static dependency declarations to recursively initialize
the pass's dependencies.

Clients that only create passes through the createFooPass() APIs will require no changes.  Clients that want to use the
CommandLine options for passes will need to manually call the appropriate initialization functions in PassInitialization.h
before parsing commandline arguments.

I have tested this with all standard configurations of clang and llvm-gcc on Darwin.  It is possible that there are problems
with the static dependencies that will only be visible with non-standard options.  If you encounter any crash in pass
registration/creation, please send the testcase to me directly.

llvm-svn: 116820
2010-10-19 17:21:58 +00:00
Michael J. Spencer b28ce01e34 Unit Tests: Missed this error. MSVC and clang didn't complain.
llvm-svn: 116252
2010-10-11 22:04:38 +00:00
Michael J. Spencer ded95b79f2 System: Add SwapByteOrder and update Support/MathExtras.h to use it.
This time correctly.

llvm-svn: 116247
2010-10-11 21:56:16 +00:00
Michael J. Spencer 43e92d1162 Revert "System: Add SwapByteOrder and update Support/MathExtras.h to use it."
This reverts commit 116234.

It compiled just fine with MSVC and clang...

llvm-svn: 116242
2010-10-11 21:39:24 +00:00
Michael J. Spencer 8827889d89 Reduce dpendencies for SupportTests.
llvm-svn: 116235
2010-10-11 21:22:34 +00:00
Michael J. Spencer ae0c34e127 System: Add SwapByteOrder and update Support/MathExtras.h to use it.
llvm-svn: 116234
2010-10-11 21:22:22 +00:00
Francois Pichet 3ae028c3b9 static_cast to long, otherwise MSVC 2008 won't compile.
llvm-svn: 115503
2010-10-04 12:31:20 +00:00
Nick Lewycky 5154ee0bca Make ConstantRange::makeICmpRegion handle all the edge cases properly. This
also fixes PR8250.

llvm-svn: 114972
2010-09-28 18:18:36 +00:00
Douglas Gregor cc277157e3 Remove reference to nonexistent test in CMake makefile for unit tests
llvm-svn: 114835
2010-09-27 16:40:43 +00:00
Dan Gohman 38d773376a Move ValueMapTest from ADT to VMCore so that ADT doesn't need
to link in "core".

llvm-svn: 114831
2010-09-27 15:50:08 +00:00
Dan Gohman b179cb2ce7 Add an all() method to BitVector, for testing whether all bits are set.
llvm-svn: 114830
2010-09-27 15:48:37 +00:00
Oscar Fuentes 46d8a93005 Reverting "CMake: Don't include tools, unittets, or examples as
available targets unless LLVM_INCLUDE_X is ON. LLVM_BUILD_X implies
LLVM_INCLUDE_X"

It breaks the configuration phase when cmake is invoked without
parameters, it is too complex for the purpose and introduces an
incovenience for the user (as both LLVM_BUILD_X and LLVM_INCLUDE_X
must set to OFF for not including X on the build)

llvm-svn: 114795
2010-09-25 20:25:25 +00:00
Michael J. Spencer e35a611aa5 CMake: Don't include tools, unittets, or examples as available targets
unless LLVM_INCLUDE_X is ON. LLVM_BUILD_X implies LLVM_INCLUDE_X

llvm-svn: 114747
2010-09-24 19:10:51 +00:00
Michael J. Spencer d8010d6456 unittests: Support Windows.
llvm-svn: 114727
2010-09-24 09:01:34 +00:00
Michael J. Spencer 10d274d874 CMake: Build unittests.
llvm-svn: 114725
2010-09-24 09:01:13 +00:00
Duncan Sands 84a3bddfc3 Add better support for environment portion of triple. Original patch by
Cameron Esfahani, tweaked to use array_lengthof.

llvm-svn: 114073
2010-09-16 08:25:48 +00:00
Jakob Stoklund Olesen e1e70b93ca Attempt to unbreak the FreeBSD buildbot by XFAILing a unit test that seems to be
miscompiled by the system gcc-4.2.1

The test remains enabled for the second-stage test.

llvm-svn: 113824
2010-09-14 00:51:58 +00:00
Nick Lewycky a35462da3d Add a new isSignWrappedSet() method to ConstantRange.
Fix zeroExtend and signExtend to support empty sets, and to return the smallest
possible result set which contains the extension of each element in their
inputs. For example zext i8 [100, 10) to i16 is now [0, 256), not i16 [100, 10)
which contains 63446 members.

llvm-svn: 113187
2010-09-06 23:52:49 +00:00
Chris Lattner 2333b12c8a zap dead code.
llvm-svn: 112708
2010-09-01 15:44:05 +00:00
Benjamin Kramer 9bf0380a54 StringRef::compare_numeric also differed from StringRef::compare for characters > 127.
llvm-svn: 112189
2010-08-26 15:25:35 +00:00
Benjamin Kramer b04d4af057 Do unsigned char comparisons in StringRef::compare_lower to be more consistent with compare in corner cases.
llvm-svn: 112185
2010-08-26 14:21:08 +00:00
Bill Wendling bfba2f1725 Silence 'unused' warning.
llvm-svn: 111539
2010-08-19 18:52:02 +00:00
Anton Korobeynikov b356426046 This patch enables "make unittests" on enable-shared/mingw.
Patch by Takumi Nakamura!

llvm-svn: 111270
2010-08-17 19:34:40 +00:00
Duncan Sands 501dff76ce Add a 'normalize' method to the Triple class, which takes a mucked up
target triple and straightens it out.  This does less than gcc's script
config.sub, for example it turns i386-mingw32 into i386--mingw32 not
i386-pc-mingw32, but it does a decent job of turning funky triples into
something that the rest of the Triple class can understand.  The plan
is to use this to canonicalize triple's when they are first provided
by users, and have the rest of LLVM only deal with canonical triples.
Once this is done the special case workarounds in the Triple constructor
can be removed, making the class more regular and easier to use.  The
comments and unittests for the Triple class are already adjusted in this
patch appropriately for this brave new world of increased uniformity.

llvm-svn: 110909
2010-08-12 11:31:39 +00:00
Nick Lewycky d385c22cf3 Clean up ConstantRange a bit:
- remove ashr which never worked.
 - fix lshr and shl and add tests.
 - remove dead function "intersect1Wrapped".
 - add a new sub method to subtract ranges, with test.

llvm-svn: 110861
2010-08-11 22:04:36 +00:00