diff options
author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2011-04-11 23:57:14 +0000 |
---|---|---|
committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2011-04-11 23:57:14 +0000 |
commit | 560ab9ebf78532df11188770c916c4eb6dcce1b2 (patch) | |
tree | d743cb438ab55badddfbe29bfc453d35d1deee6c /lib/CodeGen/RegAllocBasic.cpp | |
parent | de16508955698a0f8890e0d54fee24efc9277ecd (diff) | |
download | llvm-560ab9ebf78532df11188770c916c4eb6dcce1b2.tar.gz llvm-560ab9ebf78532df11188770c916c4eb6dcce1b2.tar.bz2 llvm-560ab9ebf78532df11188770c916c4eb6dcce1b2.tar.xz |
Reuse live interval union between functions. This saves a bit of compile time
when compiling many small functions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129321 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/RegAllocBasic.cpp')
-rw-r--r-- | lib/CodeGen/RegAllocBasic.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/CodeGen/RegAllocBasic.cpp b/lib/CodeGen/RegAllocBasic.cpp index 708f55688b..af7da53b89 100644 --- a/lib/CodeGen/RegAllocBasic.cpp +++ b/lib/CodeGen/RegAllocBasic.cpp @@ -235,9 +235,12 @@ void RegAllocBase::init(VirtRegMap &vrm, LiveIntervals &lis) { MRI = &vrm.getRegInfo(); VRM = &vrm; LIS = &lis; - PhysReg2LiveUnion.init(UnionAllocator, TRI->getNumRegs()); - // Cache an interferece query for each physical reg - Queries.reset(new LiveIntervalUnion::Query[PhysReg2LiveUnion.numRegs()]); + const unsigned NumRegs = TRI->getNumRegs(); + if (NumRegs != PhysReg2LiveUnion.numRegs()) { + PhysReg2LiveUnion.init(UnionAllocator, NumRegs); + // Cache an interferece query for each physical reg + Queries.reset(new LiveIntervalUnion::Query[PhysReg2LiveUnion.numRegs()]); + } } void RegAllocBase::LiveUnionArray::clear() { @@ -251,7 +254,8 @@ void RegAllocBase::LiveUnionArray::clear() { } void RegAllocBase::releaseMemory() { - PhysReg2LiveUnion.clear(); + for (unsigned r = 0, e = PhysReg2LiveUnion.numRegs(); r != e; ++r) + PhysReg2LiveUnion[r].clear(); } // Visit all the live registers. If they are already assigned to a physical |