Commit Graph

21 Commits

Author SHA1 Message Date
Reid Kleckner
8f51a62b41 Re-committing changes from r76825 to BumpPtrAllocator with a fix and tests for
an off-by-one error.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76891 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-23 18:34:13 +00:00
Reid Kleckner
4bf370698a Reverting r76825 and r76828, since they caused clang runtime errors and some build failure involving memset.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76838 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-23 01:40:54 +00:00
Reid Kleckner
95eb3ad353 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76825 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-23 00:30:41 +00:00
Mon P Wang
535f390bc3 Changed Allocate to use size_t instead of unsigned.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66602 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-10 23:48:49 +00:00
Mon P Wang
cabb383aba Fixed rounding up EltSize
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66594 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-10 23:04:40 +00:00
Misha Brukman
fe2cce63aa Removed trailing whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@65196 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-20 22:51:36 +00:00
Ted Kremenek
3f4c81de0a Deallocate() methods now take a 'const void*' instead of a 'void *', matching observed behavior with how 'delete[]' can be used.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63956 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-06 19:34:14 +00:00
Chris Lattner
6038840210 add a method to BumpPtrAllocator that allows allocating elements
with a specified alignment.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63629 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-03 07:39:50 +00:00
Ted Kremenek
07c2a78c2b Add member template MallocAllocator::Allocate(Num) (to match the same function in BumpPtrAllocator).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62202 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-14 00:38:21 +00:00
Dan Gohman
e8be6c6391 Add a new function, ReplaceAllUsesOfValuesWith, which handles bulk
replacement of multiple values. This is slightly more efficient
than doing multiple ReplaceAllUsesOfValueWith calls, and theoretically
could be optimized even further. However, an important property of this
new function is that it handles the case where the source value set and
destination value set overlap. This makes it feasible for isel to use
SelectNodeTo in many very common cases, which is advantageous because
SelectNodeTo avoids a temporary node and it doesn't require CSEMap
updates for users of values that don't change position.

Revamp MorphNodeTo, which is what does all the work of SelectNodeTo, to
handle operand lists more efficiently, and to correctly handle a number
of corner cases to which its new wider use exposes it.

This commit also includes a change to the encoding of post-isel opcodes
in SDNodes; now instead of being sandwiched between the target-independent
pre-isel opcodes and the target-dependent pre-isel opcodes, post-isel
opcodes are now represented as negative values. This makes it possible
to test if an opcode is pre-isel or post-isel without having to know
the size of the current target's post-isel instruction set.

These changes speed up llc overall by 3% and reduce memory usage by 10%
on the InstructionCombining.cpp testcase with -fast and -regalloc=local.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53728 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-17 19:10:17 +00:00
Dan Gohman
7698252750 Make BumpPtrAllocator noncopyable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53188 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-07 18:38:14 +00:00
Dan Gohman
dae6f4cf76 Add a space between * and /* to help simple-minded lexers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53187 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-07 18:34:27 +00:00
Bill Wendling
8032020cf2 Remove warnings about shadowed and unused variables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52791 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-26 18:11:45 +00:00
Dan Gohman
f4dc289cea Make Allocate<T>() return a T* instead of a void*. And use
static_cast instead of reinterpret_cast.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52686 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-24 17:49:26 +00:00
Evan Cheng
34cd4a484e Fix more -Wshorten-64-to-32 warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50659 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-05 18:30:58 +00:00
Chris Lattner
7ed47a1335 Don't attribute in file headers anymore. See llvmdev for the
discussion of this change.  Boy are my fingers tired. ;-)



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45411 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-29 19:59:42 +00:00
Dan Gohman
abb8bf131c Fix a typo in a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45031 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-14 15:11:58 +00:00
Ted Kremenek
52e2d83e65 Changed the return type of type-specific Allocate() methods to return
void*.  This is hint that we are returning uninitialized memory rather
than a constructed object.

Patched ImutAVLTree to conform to this new interface.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43106 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-18 00:30:14 +00:00
Ted Kremenek
869a3344f1 Added member template functions to MallocAllocator and
BumpPtrAllocator that implement allocations that return a properly
typed pointer.  For BumpPtrAllocator, the allocated memory is
automatically aligned to the minimum alignment of the type (as
calculated by llvm::AlignOf::Alignment).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43087 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-17 21:10:21 +00:00
Evan Cheng
188b5224fd Added Reset() to free all allocated memory regions and reset state to be the same as right after ctor.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41728 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-05 21:41:34 +00:00
Chris Lattner
9f617d64c5 Add a new llvm::Allocator abstraction, which will be used by a container
I'm about to add.  This is similar to, but necessarily different than, the
STL allocator class.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31285 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-29 22:08:03 +00:00