Commit Graph

1221 Commits

Author SHA1 Message Date
Jakob Stoklund Olesen
4aec85ae01 Fix crash when IntervalMapOverlaps::advanceTo moves past the last overlap.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122081 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 19:18:38 +00:00
Jakob Stoklund Olesen
ff2e9b4225 Provide LiveIntervalUnion::Query::checkLoopInterference.
This is a three-way interval list intersection between a virtual register, a
live interval union, and a loop. It will be used to identify interference-free
loops for live range splitting.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122034 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 04:09:47 +00:00
Jakob Stoklund Olesen
460ee0fd19 Add basic test exposing many bugs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121995 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-16 19:46:09 +00:00
Jakob Stoklund Olesen
cb9e08f328 Add IntervalMapOverlaps - An iterator for overlapping intervals in two
IntervalMaps.

The IntervalMaps can have different template parameters, but the KeyT and Traits
types must be the same.

Tests are forthcoming.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121935 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-16 01:18:29 +00:00
Jakob Stoklund Olesen
2ece4dead7 Remove debugging code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121738 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-14 00:37:52 +00:00
Michael J. Spencer
58fe86dc0e Support: Move c_str from SmallVector back to SmallString and add a free standing
templated c_str in Windows.h to replace it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121381 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-09 17:37:18 +00:00
Jakob Stoklund Olesen
da2fdcbb63 Fix begin() and end() on const IntervalMap.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121200 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-07 23:18:43 +00:00
Jay Foad
40f8f6264d 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121120 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-07 08:25:19 +00:00
Michael J. Spencer
e99bbd9ac3 Support/ADT: Move c_str() from SmallString to SmallVectorImpl. The Windows PathV2
implementation needs it for wchar_t and SmallVectorImpl in general.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120984 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-06 04:27:42 +00:00
Benjamin Kramer
fd6d53fbad APInt: microoptimize a few methods.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120912 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-04 18:05:36 +00:00
Benjamin Kramer
bd7d2622a2 Simplify APInt::getAllOnesValue.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120911 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-04 16:37:47 +00:00
Jakob Stoklund Olesen
7a26aca73f 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120829 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-03 19:02:00 +00:00
Michael J. Spencer
7dc7ac3cb2 Support/ADT/Twine: Add toNullTerminatedStringRef.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120600 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-01 20:37:30 +00:00
Jay Foad
7a874ddda0 PR5207: Rename overloaded APInt methods set(), clear(), flip() to
setAllBits(), setBit(unsigned), etc.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120564 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-01 08:53:58 +00:00
Michael J. Spencer
63c133b67d Support/ADT/StringRef: Add find_last_of.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120495 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-30 23:27:35 +00:00
Ted Kremenek
75627d3d2e Performance optimization on ImmutableMap/ImmutableSet:
- Use a DenseSet instead of a FoldingSet to cache
canonicalized nodes.  This reduces the overhead
of double-hashing.

- Use reference counts in ImutAVLTree to much
more aggressively recover tree nodes that are
no longer usable.  We can generate many
transient nodes while using add() and remove()
on ImmutableSet/ImmutableMaps to generate a final
set/map.

For the clang static analyzer (the main client
of these data structures), this results in
a slight speedup (0.5%) when analyzing sqlite3,
but much more importantly results in a 30-60%
reduction in peak memory usage when the analyzer
is analyzing a given function in a file.  On
average that's about a ** 44% reduction ** in the
memory footprint of the static analyzer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120459 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-30 20:26:45 +00:00
Jay Foad
a99793c5ea PR5207: Make APInt::set(), APInt::clear() and APInt::flip() return void.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120413 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-30 09:02:01 +00:00
Michael J. Spencer
1f6efa3996 Merge System into Support.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120298 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-29 18:16:10 +00:00
Jakob Stoklund Olesen
08d55342e3 Don't use std::copy and std::copy_backward, run 10% faster.
Sometimes std::copy can become a memmove call, and that is not a good idea when
copying relatively few bytes as we are doing. We also get a small win by
changing two loops into one.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120265 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-28 22:17:14 +00:00
Jakob Stoklund Olesen
5f456cda98 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120264 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-28 22:17:11 +00:00
Jay Foad
695ab519e4 PR5207: remove unused methods APInt::Emit() and APInt::Read().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120262 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-28 21:05:31 +00:00
Jay Foad
e4d19c9eb2 PR5207: change APInt::doubleToBits() and APInt::floatToBits() to be
static methods that return a new APInt.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120261 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-28 21:04:48 +00:00
Jakob Stoklund Olesen
bf953eaba3 Tweak comments to make it clear that we are working in a namespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120256 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-28 18:58:30 +00:00
Jakob Stoklund Olesen
9a08ca318e 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120239 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-28 07:21:48 +00:00
Jakob Stoklund Olesen
180e1247ca Implement const_iterator::advanceTo().
This is a version of find() that always searches forwards and is faster for
local searches.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120237 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-28 07:00:46 +00:00
Jakob Stoklund Olesen
79283768a3 Speed up simple insertions into an unbranched tree by not creating an iterator.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120232 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-28 06:14:33 +00:00
Jakob Stoklund Olesen
055942529b Add more tests for erase(). Fix a few exposed bugs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120227 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-27 22:56:53 +00:00
Jakob Stoklund Olesen
b0b7214fc9 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120226 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-27 21:12:36 +00:00
Benjamin Kramer
b837f587ed Remove PIC16 remnants.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120223 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-27 18:20:30 +00:00
Daniel Dunbar
4aeb489043 Add an optional LowerCase argument to hexdigit().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120213 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-27 13:19:46 +00:00
Daniel Dunbar
4581dae9ea ADT/InMemoryStruct: Add an experimental helper class intended for use in
situations where on the common path an API can return a pointer to some direct
memory, but which on an exceptional path may need to return a pointer to a
temporary struct.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120201 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-27 08:11:02 +00:00
Benjamin Kramer
28116c9f49 BitVector tweaks.
- Double the vector's capacity when growing to avoid unneeccesary reallocation.
- Do the reallocation with realloc(3) which can expand the memory in place.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120183 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-26 18:25:20 +00:00
Benjamin Kramer
847d2f93ca StringRefs are POD-like.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120181 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-26 14:36:54 +00:00
Jakob Stoklund Olesen
53bb5c009b 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120171 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-26 06:54:20 +00:00
Jakob Stoklund Olesen
bf77baf19c Extract template function adjustSiblingSizes(), allowing instances to be shared
between B+-trees using the same KeyT.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120170 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-26 06:54:17 +00:00
Michael J. Spencer
052f1eebdb Fix spelling!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120167 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-26 04:16:20 +00:00
Michael J. Spencer
326990f1eb Fix Whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120166 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-26 04:16:08 +00:00
Jakob Stoklund Olesen
706da9d8ca Move tree navigation to a new Path class that doesn't have to be a template.
The path also holds a reference to the root node, and that allows important
iterator accessors like start() and stop() to have no conditional code. (When
the compiler is clever enough to remove it.)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120165 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-26 01:39:40 +00:00
Ted Kremenek
9c336fabd5 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120070 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-24 00:54:28 +00:00
Jakob Stoklund Olesen
6c76f5fa2f Generalize overflowLeaf to also handle overflows in branch nodes.
This doesn't quite work yet because the calls to treeDecrement and treeIncrement
operate at the leaf level, not on pathNode(Level) as required.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120068 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-24 00:03:32 +00:00
Frits van Bommel
1c3f050309 Test commit: Fix two -Asserts mode warnings in StringMap.h.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119907 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-20 18:37:24 +00:00
Jakob Stoklund Olesen
487a5b786f Fix old GCC build error.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119884 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-20 01:24:43 +00:00
Jakob Stoklund Olesen
ddd0e65dba Detemplatize NodeRef.
It is now possible to navigate the B+-tree using NodeRef::subtree() and
NodeRef::size() without knowing the key and value template types used in the
tree.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119880 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-20 00:49:00 +00:00
Jakob Stoklund Olesen
a3b1082bb1 Rename NodeBase::{key,val} as {first,second} and swap the BranchNode arrays such
that the noderefs are the first member in the object.

This is in preparation of detemplatization of tree navigation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119879 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-20 00:48:57 +00:00
Jakob Stoklund Olesen
785ab18a05 Implement IntervalMap destructor.
Key and value objects may not be destructed instantly when they are erased from
the container, but they will be destructed eventually by the IntervalMap
destructor.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119873 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-19 23:28:59 +00:00
Jakob Stoklund Olesen
655fbb4f9b Implement IntervalMap::clear().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119872 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-19 23:28:57 +00:00
Jakob Stoklund Olesen
db52566d68 Support backwards iteration starting from end().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119871 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-19 23:28:53 +00:00
Jakob Stoklund Olesen
33fa490c50 Rename methods for clarity instead of brevity. No functional changes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119820 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-19 19:10:39 +00:00
Jakob Stoklund Olesen
805f105da0 Include raw_ostream.h unconditionally even if it is only used for debug code.
We don't want any clients acidentally depending on this and then failing in a
-Asserts build.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119818 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-19 18:51:46 +00:00
Jakob Stoklund Olesen
528900d9a4 Work around GCC 4.0 build error:
llvm/include/llvm/ADT/IntervalMap.h:334: error: '((llvm::IntervalMapImpl::DesiredNodeBytes / static_cast<unsigned int>(((2 * sizeof (KeyT)) + sizeof (ValT)))) >? 3u)' is not a valid template argument for type 'unsigned int' because it is a non-constant expression

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119790 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-19 05:36:51 +00:00