mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-16 12:24:03 +00:00
Optimize LiveIntervals::intervalIsInOneMBB().
No looping and binary searches necessary. Return a pointer to the containing block instead of just a bool. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150218 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -1086,23 +1086,28 @@ LiveIntervals::isReMaterializable(const LiveInterval &li,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool LiveIntervals::intervalIsInOneMBB(const LiveInterval &li) const {
|
||||
LiveInterval::Ranges::const_iterator itr = li.ranges.begin();
|
||||
MachineBasicBlock*
|
||||
LiveIntervals::intervalIsInOneMBB(const LiveInterval &LI) const {
|
||||
// A local live range must be fully contained inside the block, meaning it is
|
||||
// defined and killed at instructions, not at block boundaries. It is not
|
||||
// live in or or out of any block.
|
||||
//
|
||||
// It is technically possible to have a PHI-defined live range identical to a
|
||||
// single block, but we are going to return false in that case.
|
||||
|
||||
MachineBasicBlock *mbb = indexes_->getMBBCoveringRange(itr->start, itr->end);
|
||||
SlotIndex Start = LI.beginIndex();
|
||||
if (Start.isBlock())
|
||||
return NULL;
|
||||
|
||||
if (mbb == 0)
|
||||
return false;
|
||||
SlotIndex Stop = LI.endIndex();
|
||||
if (Stop.isBlock())
|
||||
return NULL;
|
||||
|
||||
for (++itr; itr != li.ranges.end(); ++itr) {
|
||||
MachineBasicBlock *mbb2 =
|
||||
indexes_->getMBBCoveringRange(itr->start, itr->end);
|
||||
|
||||
if (mbb2 != mbb)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
// getMBBFromIndex doesn't need to search the MBB table when both indexes
|
||||
// belong to proper instructions.
|
||||
MachineBasicBlock *MBB1 = indexes_->getMBBFromIndex(Start);
|
||||
MachineBasicBlock *MBB2 = indexes_->getMBBFromIndex(Stop);
|
||||
return MBB1 == MBB2 ? MBB1 : NULL;
|
||||
}
|
||||
|
||||
float
|
||||
|
Reference in New Issue
Block a user