return r->contains(I);
}
+// liveBeforeAndAt - Check if the interval is live at the index and the index
+// just before it. If index is liveAt, check if it starts a new live range.
+// If it does, then check if the previous live range ends at index-1.
+bool LiveInterval::liveBeforeAndAt(unsigned I) const {
+ Ranges::const_iterator r = std::upper_bound(ranges.begin(), ranges.end(), I);
+
+ if (r == ranges.begin())
+ return false;
+
+ --r;
+ if (!r->contains(I))
+ return false;
+ if (I != r->start)
+ return true;
+ // I is the start of a live range. Check if the previous live range ends
+ // at I-1.
+ if (r == ranges.begin())
+ return false;
+ return r->end == I;
+}
+
// overlaps - Return true if the intersection of the two live intervals is
// not empty.
//
// Otherwise, if this range ends in the middle of, or right next to, another
// interval, merge it into that interval.
- if (it != ranges.end())
+ if (it != ranges.end()) {
if (LR.valno == it->valno) {
if (it->start <= End) {
it = extendIntervalStartTo(it, Start);
assert(it->start >= End &&
"Cannot overlap two LiveRanges with differing ValID's");
}
+ }
// Otherwise, this is just a new range that doesn't interact with anything.
// Insert it.
return end();
}
+/// findDefinedVNInfo - Find the VNInfo that's defined at the specified index
+/// (register interval) or defined by the specified register (stack inteval).
+VNInfo *LiveInterval::findDefinedVNInfo(unsigned DefIdxOrReg) const {
+ VNInfo *VNI = NULL;
+ for (LiveInterval::const_vni_iterator i = vni_begin(), e = vni_end();
+ i != e; ++i)
+ if ((*i)->def == DefIdxOrReg) {
+ VNI = *i;
+ break;
+ }
+ return VNI;
+}
+
+
/// join - Join two live intervals (this, and other) together. This applies
/// mappings to the value numbers in the LHS/RHS intervals as specified. If
/// the intervals are not joinable, this aborts.
void LiveInterval::print(std::ostream &OS,
const TargetRegisterInfo *TRI) const {
- if (TRI && TargetRegisterInfo::isPhysicalRegister(reg))
+ if (isStackSlot())
+ OS << "SS#" << getStackSlotIndex();
+ else if (TRI && TargetRegisterInfo::isPhysicalRegister(reg))
OS << TRI->getName(reg);
else
OS << "%reg" << reg;
OS << ',' << weight;
if (empty())
- OS << "EMPTY";
+ OS << " EMPTY";
else {
OS << " = ";
for (LiveInterval::Ranges::const_iterator I = ranges.begin(),