forked from OSchip/llvm-project
LiveRangeEdit: Simplify code; NFC
Simplify the code slightly: Instead of creating empty subranges in one case and immediately removing them, do not create them in the first place. llvm-svn: 322226
This commit is contained in:
parent
90e29b81d6
commit
63449f93a0
|
@ -121,6 +121,9 @@ private:
|
|||
/// main live range of \p LI or in one of the matching subregister ranges.
|
||||
bool useIsKill(const LiveInterval &LI, const MachineOperand &MO) const;
|
||||
|
||||
/// Create a new empty interval based on OldReg.
|
||||
LiveInterval &createEmptyIntervalFrom(unsigned OldReg, bool createSubRanges);
|
||||
|
||||
public:
|
||||
/// Create a LiveRangeEdit for breaking down parent into smaller pieces.
|
||||
/// @param parent The register being spilled or split.
|
||||
|
@ -174,16 +177,13 @@ public:
|
|||
return makeArrayRef(NewRegs).slice(FirstNew);
|
||||
}
|
||||
|
||||
/// createEmptyIntervalFrom - Create a new empty interval based on OldReg.
|
||||
LiveInterval &createEmptyIntervalFrom(unsigned OldReg);
|
||||
|
||||
/// createFrom - Create a new virtual register based on OldReg.
|
||||
unsigned createFrom(unsigned OldReg);
|
||||
|
||||
/// create - Create a new register with the same class and original slot as
|
||||
/// parent.
|
||||
LiveInterval &createEmptyInterval() {
|
||||
return createEmptyIntervalFrom(getReg());
|
||||
return createEmptyIntervalFrom(getReg(), true);
|
||||
}
|
||||
|
||||
unsigned create() { return createFrom(getReg()); }
|
||||
|
|
|
@ -31,21 +31,24 @@ STATISTIC(NumFracRanges, "Number of live ranges fractured by DCE");
|
|||
|
||||
void LiveRangeEdit::Delegate::anchor() { }
|
||||
|
||||
LiveInterval &LiveRangeEdit::createEmptyIntervalFrom(unsigned OldReg) {
|
||||
LiveInterval &LiveRangeEdit::createEmptyIntervalFrom(unsigned OldReg,
|
||||
bool createSubRanges) {
|
||||
unsigned VReg = MRI.createVirtualRegister(MRI.getRegClass(OldReg));
|
||||
if (VRM) {
|
||||
if (VRM)
|
||||
VRM->setIsSplitFromReg(VReg, VRM->getOriginal(OldReg));
|
||||
}
|
||||
|
||||
LiveInterval &LI = LIS.createEmptyInterval(VReg);
|
||||
if (Parent && !Parent->isSpillable())
|
||||
LI.markNotSpillable();
|
||||
// Create empty subranges if the OldReg's interval has them. Do not create
|
||||
// the main range here---it will be constructed later after the subranges
|
||||
// have been finalized.
|
||||
LiveInterval &OldLI = LIS.getInterval(OldReg);
|
||||
VNInfo::Allocator &Alloc = LIS.getVNInfoAllocator();
|
||||
for (LiveInterval::SubRange &S : OldLI.subranges())
|
||||
LI.createSubRange(Alloc, S.LaneMask);
|
||||
if (createSubRanges) {
|
||||
// Create empty subranges if the OldReg's interval has them. Do not create
|
||||
// the main range here---it will be constructed later after the subranges
|
||||
// have been finalized.
|
||||
LiveInterval &OldLI = LIS.getInterval(OldReg);
|
||||
VNInfo::Allocator &Alloc = LIS.getVNInfoAllocator();
|
||||
for (LiveInterval::SubRange &S : OldLI.subranges())
|
||||
LI.createSubRange(Alloc, S.LaneMask);
|
||||
}
|
||||
return LI;
|
||||
}
|
||||
|
||||
|
@ -357,8 +360,7 @@ void LiveRangeEdit::eliminateDeadDef(MachineInstr *MI, ToShrinkSet &ToShrink,
|
|||
// LiveRangeEdit::DeadRemats and will be deleted after all the
|
||||
// allocations of the func are done.
|
||||
if (isOrigDef && DeadRemats && TII.isTriviallyReMaterializable(*MI, AA)) {
|
||||
LiveInterval &NewLI = createEmptyIntervalFrom(Dest);
|
||||
NewLI.removeEmptySubRanges();
|
||||
LiveInterval &NewLI = createEmptyIntervalFrom(Dest, false);
|
||||
VNInfo *VNI = NewLI.getNextValue(Idx, LIS.getVNInfoAllocator());
|
||||
NewLI.addSegment(LiveInterval::Segment(Idx, Idx.getDeadSlot(), VNI));
|
||||
pop_back();
|
||||
|
|
Loading…
Reference in New Issue