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 | c141ba584e5339e1a7f6411204ce93151ca6e4af (patch) | |
tree | 3b3d6cdc60f8ddf0c05cc1c3c785f370dd48231c /llvm/lib/CodeGen/LiveIntervalUnion.cpp | |
parent | c65e1598ad69d2db2ce09c59427e456c47f6ae73 (diff) | |
download | bcm5719-llvm-c141ba584e5339e1a7f6411204ce93151ca6e4af.tar.gz bcm5719-llvm-c141ba584e5339e1a7f6411204ce93151ca6e4af.zip |
Move LiveUnionArray into LiveIntervalUnion.h
It is useful outside RegAllocBase.
llvm-svn: 158041
Diffstat (limited to 'llvm/lib/CodeGen/LiveIntervalUnion.cpp')
-rw-r--r-- | llvm/lib/CodeGen/LiveIntervalUnion.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/LiveIntervalUnion.cpp b/llvm/lib/CodeGen/LiveIntervalUnion.cpp index 9c579aff680..dadd02bfc65 100644 --- a/llvm/lib/CodeGen/LiveIntervalUnion.cpp +++ b/llvm/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; +} |