diff options
author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2012-06-05 23:57:30 +0000 |
---|---|---|
committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2012-06-05 23:57:30 +0000 |
commit | 0e5a60b4ebc06a4fe6bb58f0200acf130d7be685 (patch) | |
tree | 8e5b642a02bf98a805655d150272c6a37fd0fad7 /lib/CodeGen/LiveIntervalUnion.cpp | |
parent | 2fd0923593c4d30691a45ade1e8b0bd484896c3f (diff) | |
download | llvm-0e5a60b4ebc06a4fe6bb58f0200acf130d7be685.tar.gz llvm-0e5a60b4ebc06a4fe6bb58f0200acf130d7be685.tar.bz2 llvm-0e5a60b4ebc06a4fe6bb58f0200acf130d7be685.tar.xz |
Move LiveUnionArray into LiveIntervalUnion.h
It is useful outside RegAllocBase.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158041 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/LiveIntervalUnion.cpp')
-rw-r--r-- | lib/CodeGen/LiveIntervalUnion.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/CodeGen/LiveIntervalUnion.cpp b/lib/CodeGen/LiveIntervalUnion.cpp index 9c579aff68..dadd02bfc6 100644 --- a/lib/CodeGen/LiveIntervalUnion.cpp +++ b/lib/CodeGen/LiveIntervalUnion.cpp @@ -208,3 +208,26 @@ bool LiveIntervalUnion::Query::checkLoopInterference(MachineLoopRange *Loop) { VRI = VirtReg->advanceTo(VRI, Overlaps.start()); } } + +void LiveIntervalUnion::Array::init(LiveIntervalUnion::Allocator &Alloc, + unsigned NSize) { + // Reuse existing allocation. + if (NSize == Size) + return; + clear(); + Size = NSize; + LIUs = static_cast<LiveIntervalUnion*>( + malloc(sizeof(LiveIntervalUnion)*NSize)); + for (unsigned i = 0; i != Size; ++i) + new(LIUs + i) LiveIntervalUnion(Alloc); +} + +void LiveIntervalUnion::Array::clear() { + if (!LIUs) + return; + for (unsigned i = 0; i != Size; ++i) + LIUs[i].~LiveIntervalUnion(); + free(LIUs); + Size = 0; + LIUs = 0; +} |