diff options
author | Alkis Evlogimenos <alkis@evlogimenos.com> | 2004-02-05 20:45:40 +0000 |
---|---|---|
committer | Alkis Evlogimenos <alkis@evlogimenos.com> | 2004-02-05 20:45:40 +0000 |
commit | ad48cd6327df13ad4b8530733bbf115224bf9562 (patch) | |
tree | 5abea712e67ad93eb7eb619a020599e20d04bacd /lib/CodeGen/LiveIntervalAnalysis.cpp | |
parent | 913a934b368b922db56b3418b8e82e5589c3dabd (diff) |
We don't need to scan the blocks that we are live-in on every
access. Rather we only have to do it on the creation of the interval.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11135 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/LiveIntervalAnalysis.cpp')
-rw-r--r-- | lib/CodeGen/LiveIntervalAnalysis.cpp | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/lib/CodeGen/LiveIntervalAnalysis.cpp b/lib/CodeGen/LiveIntervalAnalysis.cpp index bef7653c05..f1bb499337 100644 --- a/lib/CodeGen/LiveIntervalAnalysis.cpp +++ b/lib/CodeGen/LiveIntervalAnalysis.cpp @@ -162,22 +162,23 @@ void LiveIntervals::handleVirtualRegisterDef(MachineBasicBlock* mbb, // update interval index for this register r2iMap_.insert(r2iit, std::make_pair(reg, --intervals_.end())); interval = &intervals_.back(); - } - else { - interval = &*r2iit->second; - } - // iterate over all of the blocks that the variable is completely - // live in, adding them to the live interval - for (unsigned i = 0, e = vi.AliveBlocks.size(); i != e; ++i) { - if (vi.AliveBlocks[i]) { - MachineBasicBlock* mbb = lv_->getIndexMachineBasicBlock(i); - if (!mbb->empty()) { - interval->addRange(getInstructionIndex(mbb->front()), - getInstructionIndex(mbb->back()) + 1); + // iterate over all of the blocks that the variable is + // completely live in, adding them to the live + // interval. obviously we only need to do this once. + for (unsigned i = 0, e = vi.AliveBlocks.size(); i != e; ++i) { + if (vi.AliveBlocks[i]) { + MachineBasicBlock* mbb = lv_->getIndexMachineBasicBlock(i); + if (!mbb->empty()) { + interval->addRange(getInstructionIndex(mbb->front()), + getInstructionIndex(mbb->back()) + 1); + } } } } + else { + interval = &*r2iit->second; + } bool killedInDefiningBasicBlock = false; for (int i = 0, e = vi.Kills.size(); i != e; ++i) { |