1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-22 04:22:57 +02:00
Commit Graph

1080 Commits

Author SHA1 Message Date
Jakob Stoklund Olesen
c6f16354b9 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
Benjamin Kramer
3355314332 Remove PIC16 remnants.
llvm-svn: 120223
2010-11-27 18:20:30 +00:00
Daniel Dunbar
05a18ee325 Add an optional LowerCase argument to hexdigit().
llvm-svn: 120213
2010-11-27 13:19:46 +00:00
Daniel Dunbar
3258210b90 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.

llvm-svn: 120201
2010-11-27 08:11:02 +00:00
Benjamin Kramer
3b0f0fd785 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.

llvm-svn: 120183
2010-11-26 18:25:20 +00:00
Benjamin Kramer
75de69b73c StringRefs are POD-like.
llvm-svn: 120181
2010-11-26 14:36:54 +00:00
Jakob Stoklund Olesen
6e57d83076 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
Jakob Stoklund Olesen
8c952bc1cd Extract template function adjustSiblingSizes(), allowing instances to be shared
between B+-trees using the same KeyT.

llvm-svn: 120170
2010-11-26 06:54:17 +00:00
Michael J. Spencer
0d9fb7f72e Fix spelling!
llvm-svn: 120167
2010-11-26 04:16:20 +00:00
Michael J. Spencer
b2cfb3b443 Fix Whitespace.
llvm-svn: 120166
2010-11-26 04:16:08 +00:00
Jakob Stoklund Olesen
ac19a35444 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.)

llvm-svn: 120165
2010-11-26 01:39:40 +00:00
Ted Kremenek
bb322e520d 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
Jakob Stoklund Olesen
1cf4810406 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.

llvm-svn: 120068
2010-11-24 00:03:32 +00:00
Frits van Bommel
da0d866809 Test commit: Fix two -Asserts mode warnings in StringMap.h.
llvm-svn: 119907
2010-11-20 18:37:24 +00:00
Jakob Stoklund Olesen
08e5752828 Fix old GCC build error.
llvm-svn: 119884
2010-11-20 01:24:43 +00:00
Jakob Stoklund Olesen
de3ebc098a 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.

llvm-svn: 119880
2010-11-20 00:49:00 +00:00
Jakob Stoklund Olesen
4a44e92fd1 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.

llvm-svn: 119879
2010-11-20 00:48:57 +00:00
Jakob Stoklund Olesen
029e95d6d7 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.

llvm-svn: 119873
2010-11-19 23:28:59 +00:00
Jakob Stoklund Olesen
9dd0f0a04d Implement IntervalMap::clear().
llvm-svn: 119872
2010-11-19 23:28:57 +00:00
Jakob Stoklund Olesen
328eb0d328 Support backwards iteration starting from end().
llvm-svn: 119871
2010-11-19 23:28:53 +00:00
Jakob Stoklund Olesen
c65d4d6d14 Rename methods for clarity instead of brevity. No functional changes.
llvm-svn: 119820
2010-11-19 19:10:39 +00:00
Jakob Stoklund Olesen
0073a81d8d 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.

llvm-svn: 119818
2010-11-19 18:51:46 +00:00
Jakob Stoklund Olesen
c8ac0c3c97 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

llvm-svn: 119790
2010-11-19 05:36:51 +00:00
Jakob Stoklund Olesen
52d6dd3079 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
Jakob Stoklund Olesen
254cd4bc4d 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
7d82c5c710 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
Dan Gohman
ea25285426 Fix warnings about missing parents between || and &&.
llvm-svn: 119454
2010-11-17 02:40:30 +00:00
Jim Grosbach
4635621b41 Trailing whitespace.
llvm-svn: 118978
2010-11-13 04:17:15 +00:00
Dan Gohman
67f95d770b Factor code out of APInt to form a isUIntN helper function.
llvm-svn: 118133
2010-11-03 00:38:40 +00:00
Chandler Carruth
4d8fbad207 Add a specialization for 'long', a hole in the set of fundamental
specializations provided here. This is a little annoying because its size
changes from platform to platform. If possible, I may follow up with a patch
that uses standard constants to simplify much of this, but assuming for now
that was avoided for a reason.

llvm-svn: 117880
2010-10-31 22:57:03 +00:00
Chris Lattner
ee8dea6453 Rename alignof -> alignOf to avoid irritating C++'0x compilers,
PR8423, patch by nobled.

llvm-svn: 117774
2010-10-30 05:14:01 +00:00
Douglas Gregor
a598c0fbce Extend StringRef's edit-distance algorithm to permit an upper bound on the allowed edit distance
llvm-svn: 116867
2010-10-19 22:13:48 +00:00
Chris Lattner
451a0accb5 add uadd_ov/usub_ov to apint, consolidate constant folding
logic to use the new APInt methods.  Among other things this
implements rdar://8501501 - llvm.smul.with.overflow.i32 should constant fold

which comes from "clang -ftrapv", originally brought to my attention from PR8221.

llvm-svn: 116457
2010-10-14 00:05:07 +00:00
Chris Lattner
365326538a missed a line :(
llvm-svn: 116456
2010-10-13 23:57:00 +00:00
Chris Lattner
093d5fe0a9 constify these methods.
llvm-svn: 116455
2010-10-13 23:54:10 +00:00
Chris Lattner
70a78ab2c5 add a few operations for signed operations that also
return an overflow flag.

llvm-svn: 116452
2010-10-13 23:46:33 +00:00
Duncan Sands
6284b3db58 GCC extensions are no longer used here - update the comment.
llvm-svn: 115463
2010-10-03 15:31:50 +00:00
Duncan Sands
39e0233734 Remove two uses of the gcc specific 'aligned' attribute. This
is partly because this attribute caused trouble in the past (the
SmallVector one had to be changed from aligned to aligned(8) due
to causing crashes on i386 for example; in theory the same might
be needed in the Allocator case...).  But it's mostly because
there seems to be no point in special casing gcc here.  Using the
same implementation for all compilers results in better testing.

llvm-svn: 115462
2010-10-03 15:15:19 +00:00
Dan Gohman
f9d7d6c9f9 Add an all() method to BitVector, for testing whether all bits are set.
llvm-svn: 114830
2010-09-27 15:48:37 +00:00
Dan Gohman
d299070514 Make SetVector's remove indicate whether it actually removed something.
llvm-svn: 114612
2010-09-22 23:20:04 +00:00
Mikhail Glushenkov
637b2871f8 Trailing whitespace.
llvm-svn: 114432
2010-09-21 14:59:34 +00:00
Duncan Sands
c128b42eb8 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
Nick Lewycky
cad1395824 Create PTX backend. Patch by Che-Liang Chiou!
llvm-svn: 113235
2010-09-07 18:14:24 +00:00
Chris Lattner
6c6f196725 fix this to work with allocators that have reference type with compilers
that diagnose invalid references to references.

llvm-svn: 113078
2010-09-04 18:45:02 +00:00
John McCall
b91df6e799 After some discussion with djg, teach SmallVector to grow from a zero
capacity and remove the workaround in SmallVector<T,0>.  There are some
theoretical benefits to a N->2N+1 growth policy anyway.

llvm-svn: 112870
2010-09-02 21:55:03 +00:00
Dan Gohman
ace824be4a Make the iterator form of erase return void, since it always succeeds,
and since this is what std::map and std::set do.

llvm-svn: 112701
2010-09-01 14:00:35 +00:00
Eric Christopher
5f8ae3dbd6 Kill a couple of unused variables.
llvm-svn: 112498
2010-08-30 18:31:44 +00:00
Dan Gohman
5110488830 Delete an unused declaration.
llvm-svn: 112424
2010-08-29 14:48:15 +00:00
John McCall
33faad67cc SmallVector's growth policies don't like starting from zero capacity.
I think there are good reasons to change this, but in the interests
of short-term stability, make SmallVector<...,0> reserve non-zero
capacity in its constructors.  This means that SmallVector<...,0>
uses more memory than SmallVector<...,1> and should really only be
used (unless/until this workaround is removed) by clients that
care about using SmallVector with an incomplete type.

llvm-svn: 112147
2010-08-26 02:11:48 +00:00
John McCall
0c3659857d Provide an explicit specialization of SmallVector at N=0 which does
not require its type argument to be complete if no members are
actually used.

llvm-svn: 112106
2010-08-25 23:11:24 +00:00